File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,13 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
287
287
diagnosticProvider . updateDiagnostics ( vscode . window . activeTextEditor . document ) ;
288
288
}
289
289
290
+ const proposed = packageJson . enableProposedApi
291
+ ? [
292
+ vscode . workspace . registerFileSearchProvider ( FILESYSTEM_SCHEMA , new FileSearchProvider ( ) ) ,
293
+ vscode . workspace . registerTextSearchProvider ( FILESYSTEM_SCHEMA , new TextSearchProvider ( ) ) ,
294
+ ]
295
+ : [ ] ;
296
+
290
297
context . subscriptions . push (
291
298
reporter ,
292
299
workspace . onDidChangeTextDocument ( event => {
@@ -457,8 +464,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
457
464
) ,
458
465
459
466
/* from proposed api */
460
- vscode . workspace . registerFileSearchProvider ( FILESYSTEM_SCHEMA , new FileSearchProvider ( ) ) ,
461
- vscode . workspace . registerTextSearchProvider ( FILESYSTEM_SCHEMA , new TextSearchProvider ( ) )
467
+ ...proposed
462
468
) ;
463
469
reporter . sendTelemetryEvent ( "extensionActivated" ) ;
464
470
}
Original file line number Diff line number Diff line change @@ -22,7 +22,14 @@ export interface CurrentFile {
22
22
}
23
23
24
24
export function currentFile ( document ?: vscode . TextDocument ) : CurrentFile {
25
- document = document || ( vscode . window . activeTextEditor . document ? vscode . window . activeTextEditor . document : null ) ;
25
+ document =
26
+ document ||
27
+ ( vscode . window . activeTextEditor && vscode . window . activeTextEditor . document
28
+ ? vscode . window . activeTextEditor . document
29
+ : null ) ;
30
+ if ( ! document ) {
31
+ return null ;
32
+ }
26
33
if (
27
34
! schemas . includes ( document . uri . scheme ) &&
28
35
( ! document || ! document . fileName || ! document . languageId || ! document . languageId . startsWith ( "objectscript" ) )
You can’t perform that action at this time.
0 commit comments