mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 19:34:16 +00:00
fetching dependencies from the server
This commit is contained in:
parent
1201b156d8
commit
09e0a00d36
9 changed files with 155 additions and 156 deletions
|
@ -272,19 +272,19 @@ export function revealDependency(ctx: CtxInit): Cmd {
|
|||
const rootPath = vscode.workspace.workspaceFolders![0].uri.fsPath;
|
||||
const documentPath = editor.document.uri.fsPath;
|
||||
if (documentPath.startsWith(rootPath)) return;
|
||||
const dep = ctx.dependencies.getDependency(documentPath);
|
||||
const dep = ctx.dependencies?.getDependency(documentPath);
|
||||
if (dep) {
|
||||
await ctx.treeView.reveal(dep, { select: true, expand: true });
|
||||
await ctx.treeView?.reveal(dep, { select: true, expand: true });
|
||||
} else {
|
||||
let documentPath = editor.document.uri.fsPath;
|
||||
const parentChain: DependencyId[] = [{ id: documentPath.toLowerCase() }];
|
||||
do {
|
||||
documentPath = path.dirname(documentPath);
|
||||
parentChain.push({ id: documentPath.toLowerCase() });
|
||||
} while (!ctx.dependencies.contains(documentPath));
|
||||
} while (!ctx.dependencies?.contains(documentPath));
|
||||
parentChain.reverse();
|
||||
for (const idx in parentChain) {
|
||||
await ctx.treeView.reveal(parentChain[idx], { select: true, expand: true });
|
||||
await ctx.treeView?.reveal(parentChain[idx], { select: true, expand: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue