Pass in correct project root for notebook cells

This commit is contained in:
Matt Bierner 2021-04-08 16:48:42 -07:00
parent f5ea03079a
commit 84391165c3
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -710,16 +710,20 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return undefined;
}
if (resource.scheme === fileSchemes.file || resource.scheme === fileSchemes.untitled) {
for (const root of roots.sort((a, b) => a.uri.fsPath.length - b.uri.fsPath.length)) {
if (resource.fsPath.startsWith(root.uri.fsPath + path.sep)) {
return root.uri.fsPath;
switch (resource.scheme) {
case fileSchemes.file:
case fileSchemes.untitled:
case fileSchemes.vscodeNotebookCell:
for (const root of roots.sort((a, b) => a.uri.fsPath.length - b.uri.fsPath.length)) {
if (resource.fsPath.startsWith(root.uri.fsPath + path.sep)) {
return root.uri.fsPath;
}
}
}
return roots[0].uri.fsPath;
}
return roots[0].uri.fsPath;
return undefined;
default:
return undefined;
}
}
public execute(command: keyof TypeScriptRequests, args: any, token: vscode.CancellationToken, config?: ExecConfig): Promise<ServerResponse.Response<Proto.Response>> {