fetching dependencies from the server

This commit is contained in:
Bruno Ortiz 2023-04-02 21:58:20 -03:00
parent 1201b156d8
commit 09e0a00d36
9 changed files with 155 additions and 156 deletions

View file

@ -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 });
}
}
};