@@ -484,6 +484,7 @@ const PauseAnalysisNotification: NotificationType<void, void> = new Notification
484
484
const ResumeAnalysisNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/resumeAnalysis' ) ;
485
485
const CancelAnalysisNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/cancelAnalysis' ) ;
486
486
const ActiveDocumentChangeNotification : NotificationType < TextDocumentIdentifier , void > = new NotificationType < TextDocumentIdentifier , void > ( 'cpptools/activeDocumentChange' ) ;
487
+ const RestartIntelliSenseForFileNotification : NotificationType < TextDocumentIdentifier , void > = new NotificationType < TextDocumentIdentifier , void > ( 'cpptools/restartIntelliSenseForFile' ) ;
487
488
const TextEditorSelectionChangeNotification : NotificationType < Range , void > = new NotificationType < Range , void > ( 'cpptools/textEditorSelectionChange' ) ;
488
489
const ChangeCppPropertiesNotification : NotificationType < CppPropertiesParams , void > = new NotificationType < CppPropertiesParams , void > ( 'cpptools/didChangeCppProperties' ) ;
489
490
const ChangeCompileCommandsNotification : NotificationType < FileChangedParams , void > = new NotificationType < FileChangedParams , void > ( 'cpptools/didChangeCompileCommands' ) ;
@@ -630,6 +631,7 @@ export interface Client {
630
631
awaitUntilLanguageClientReady ( ) : void ;
631
632
requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > ;
632
633
activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > ;
634
+ restartIntelliSenseForFile ( document : vscode . TextDocument ) : Promise < void > ;
633
635
activate ( ) : void ;
634
636
selectionChanged ( selection : Range ) : void ;
635
637
resetDatabase ( ) : void ;
@@ -2439,9 +2441,16 @@ export class DefaultClient implements Client {
2439
2441
*/
2440
2442
public async activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > {
2441
2443
await this . updateActiveDocumentTextOptions ( ) ;
2442
- this . notifyWhenLanguageClientReady ( ( ) => {
2443
- this . languageClient . sendNotification ( ActiveDocumentChangeNotification , this . languageClient . code2ProtocolConverter . asTextDocumentIdentifier ( document ) ) ;
2444
- } ) ;
2444
+ await this . awaitUntilLanguageClientReady ( ) ;
2445
+ this . languageClient . sendNotification ( ActiveDocumentChangeNotification , this . languageClient . code2ProtocolConverter . asTextDocumentIdentifier ( document ) ) ;
2446
+ }
2447
+
2448
+ /**
2449
+ * send notifications to the language server to restart IntelliSense for the selected file.
2450
+ */
2451
+ public async restartIntelliSenseForFile ( document : vscode . TextDocument ) : Promise < void > {
2452
+ await this . awaitUntilLanguageClientReady ( ) ;
2453
+ this . languageClient . sendNotification ( RestartIntelliSenseForFileNotification , this . languageClient . code2ProtocolConverter . asTextDocumentIdentifier ( document ) ) ;
2445
2454
}
2446
2455
2447
2456
/**
@@ -3011,6 +3020,7 @@ class NullClient implements Client {
3011
3020
awaitUntilLanguageClientReady ( ) : void { }
3012
3021
requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > { return Promise . resolve ( "" ) ; }
3013
3022
activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > { return Promise . resolve ( ) ; }
3023
+ restartIntelliSenseForFile ( document : vscode . TextDocument ) : Promise < void > { return Promise . resolve ( ) ; }
3014
3024
activate ( ) : void { }
3015
3025
selectionChanged ( selection : Range ) : void { }
3016
3026
resetDatabase ( ) : void { }
0 commit comments