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>
287287 diagnosticProvider . updateDiagnostics ( vscode . window . activeTextEditor . document ) ;
288288 }
289289
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+
290297 context . subscriptions . push (
291298 reporter ,
292299 workspace . onDidChangeTextDocument ( event => {
@@ -457,8 +464,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
457464 ) ,
458465
459466 /* from proposed api */
460- vscode . workspace . registerFileSearchProvider ( FILESYSTEM_SCHEMA , new FileSearchProvider ( ) ) ,
461- vscode . workspace . registerTextSearchProvider ( FILESYSTEM_SCHEMA , new TextSearchProvider ( ) )
467+ ...proposed
462468 ) ;
463469 reporter . sendTelemetryEvent ( "extensionActivated" ) ;
464470}
Original file line number Diff line number Diff line change @@ -22,7 +22,14 @@ export interface CurrentFile {
2222}
2323
2424export 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+ }
2633 if (
2734 ! schemas . includes ( document . uri . scheme ) &&
2835 ( ! document || ! document . fileName || ! document . languageId || ! document . languageId . startsWith ( "objectscript" ) )
You can’t perform that action at this time.
0 commit comments