@@ -29,6 +29,7 @@ import { PluginManager, TypeScriptServerPlugin } from './tsServer/plugins';
29
29
import { TelemetryProperties , TelemetryReporter , VSCodeTelemetryReporter } from './logging/telemetry' ;
30
30
import Tracer from './logging/tracer' ;
31
31
import { ProjectType , inferredProjectCompilerOptions } from './tsconfig' ;
32
+ import { Schemes } from './configuration/schemes' ;
32
33
33
34
34
35
export interface TsDiagnostics {
@@ -762,6 +763,18 @@ export default class TypeScriptServiceClient extends Disposable implements IType
762
763
return undefined ;
763
764
}
764
765
766
+ // For notebook cells, we need to use the notebook document to look up the workspace
767
+ if ( resource . scheme === Schemes . notebookCell ) {
768
+ for ( const notebook of vscode . workspace . notebookDocuments ) {
769
+ for ( const cell of notebook . getCells ( ) ) {
770
+ if ( cell . document . uri . toString ( ) === resource . toString ( ) ) {
771
+ resource = notebook . uri ;
772
+ break ;
773
+ }
774
+ }
775
+ }
776
+ }
777
+
765
778
for ( const root of roots . sort ( ( a , b ) => a . uri . fsPath . length - b . uri . fsPath . length ) ) {
766
779
if ( root . uri . scheme === resource . scheme && root . uri . authority === resource . authority ) {
767
780
if ( resource . fsPath . startsWith ( root . uri . fsPath + path . sep ) ) {
@@ -770,7 +783,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
770
783
}
771
784
}
772
785
773
- return undefined ;
786
+ return vscode . workspace . getWorkspaceFolder ( resource ) ?. uri ;
774
787
}
775
788
776
789
public execute ( command : keyof TypeScriptRequests , args : any , token : vscode . CancellationToken , config ?: ExecConfig ) : Promise < ServerResponse . Response < Proto . Response > > {
0 commit comments