Skip to content

Commit

Permalink
roots: More relative cwd in completions
Browse files Browse the repository at this point in the history
Summary: ^

Reviewed By: iguridi

Differential Revision: D65845843

fbshipit-source-id: bc1d7a9f61f2cd287e5a493f019a2486802c2a1f
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Nov 15, 2024
1 parent bef15f2 commit fe9854b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions app/buck2_cmd_completion_client/src/complete/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'a> PackageCompleter<'a> {
let cwd_cell_name = self
.cell_configs
.cell_resolver
.get_cell_path_from_abs_path(self.cwd.path().as_abs_path(), &self.roots.project_root)?
.get_cell_path(&self.roots.cwd)?
.cell();
let cwd_cell_root = self.cell_configs.cell_resolver.get(cwd_cell_name)?.path();
let cwd_cell_root = self.roots.project_root.resolve(cwd_cell_root);
Expand Down Expand Up @@ -97,10 +97,7 @@ impl<'a> PackageCompleter<'a> {
let cell_resolver = &self.cell_configs.cell_resolver;
let alias_resolver = self
.cell_configs
.get_cell_alias_resolver_for_cwd_fast(
&self.roots.project_root,
&self.roots.project_root.relativize(self.cwd.path())?,
)
.get_cell_alias_resolver_for_cwd_fast(&self.roots.project_root, &self.roots.cwd)
.await?;
for (cell_alias, cell_name) in alias_resolver.mappings() {
let canonical_cell_root = format!("{}//", cell_alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl PathSanitizer {
self.cwd.path().join_normalized(path_str)?
};

let cwd_cell_name = self.resolve_cell(self.cwd.path())?;
let cwd_cell_name = self.cell_resovler.find(&self.cwd_roots.cwd)?;

let cell_name = self.resolve_cell(&abs_path)?;
let cell_path = self.relative_to_cell(&abs_path)?;
Expand Down Expand Up @@ -149,7 +149,7 @@ impl PathSanitizer {
cell_path: &str,
) -> Result<SanitizedPath, anyhow::Error> {
let given_cell = if given_cell_str == "" {
self.resolve_cell(self.cwd.path())?
self.cell_resovler.find(&self.cwd_roots.cwd)?
} else {
self.resolve_alias(given_cell_str)?
};
Expand Down

0 comments on commit fe9854b

Please sign in to comment.