@@ -29,6 +29,7 @@ import { PluginManager, TypeScriptServerPlugin } from './tsServer/plugins';
2929import { TelemetryProperties , TelemetryReporter , VSCodeTelemetryReporter } from './logging/telemetry' ;
3030import Tracer from './logging/tracer' ;
3131import { ProjectType , inferredProjectCompilerOptions } from './tsconfig' ;
32+ import { Schemes } from './configuration/schemes' ;
3233
3334
3435export interface TsDiagnostics {
@@ -762,6 +763,18 @@ export default class TypeScriptServiceClient extends Disposable implements IType
762763 return undefined ;
763764 }
764765
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+
765778 for ( const root of roots . sort ( ( a , b ) => a . uri . fsPath . length - b . uri . fsPath . length ) ) {
766779 if ( root . uri . scheme === resource . scheme && root . uri . authority === resource . authority ) {
767780 if ( resource . fsPath . startsWith ( root . uri . fsPath + path . sep ) ) {
@@ -770,7 +783,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
770783 }
771784 }
772785
773- return undefined ;
786+ return vscode . workspace . getWorkspaceFolder ( resource ) ?. uri ;
774787 }
775788
776789 public execute ( command : keyof TypeScriptRequests , args : any , token : vscode . CancellationToken , config ?: ExecConfig ) : Promise < ServerResponse . Response < Proto . Response > > {
0 commit comments