@@ -484,6 +484,7 @@ const PauseAnalysisNotification: NotificationType<void, void> = new Notification
484484const ResumeAnalysisNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/resumeAnalysis' ) ;
485485const CancelAnalysisNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/cancelAnalysis' ) ;
486486const ActiveDocumentChangeNotification : NotificationType < TextDocumentIdentifier , void > = new NotificationType < TextDocumentIdentifier , void > ( 'cpptools/activeDocumentChange' ) ;
487+ const RestartIntelliSenseForFileNotification : NotificationType < TextDocumentIdentifier , void > = new NotificationType < TextDocumentIdentifier , void > ( 'cpptools/restartIntelliSenseForFile' ) ;
487488const TextEditorSelectionChangeNotification : NotificationType < Range , void > = new NotificationType < Range , void > ( 'cpptools/textEditorSelectionChange' ) ;
488489const ChangeCppPropertiesNotification : NotificationType < CppPropertiesParams , void > = new NotificationType < CppPropertiesParams , void > ( 'cpptools/didChangeCppProperties' ) ;
489490const ChangeCompileCommandsNotification : NotificationType < FileChangedParams , void > = new NotificationType < FileChangedParams , void > ( 'cpptools/didChangeCompileCommands' ) ;
@@ -630,6 +631,7 @@ export interface Client {
630631 awaitUntilLanguageClientReady ( ) : void ;
631632 requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > ;
632633 activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > ;
634+ restartIntelliSenseForFile ( document : vscode . TextDocument ) : Promise < void > ;
633635 activate ( ) : void ;
634636 selectionChanged ( selection : Range ) : void ;
635637 resetDatabase ( ) : void ;
@@ -2439,9 +2441,16 @@ export class DefaultClient implements Client {
24392441 */
24402442 public async activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > {
24412443 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 ) ) ;
24452454 }
24462455
24472456 /**
@@ -3011,6 +3020,7 @@ class NullClient implements Client {
30113020 awaitUntilLanguageClientReady ( ) : void { }
30123021 requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > { return Promise . resolve ( "" ) ; }
30133022 activeDocumentChanged ( document : vscode . TextDocument ) : Promise < void > { return Promise . resolve ( ) ; }
3023+ restartIntelliSenseForFile ( document : vscode . TextDocument ) : Promise < void > { return Promise . resolve ( ) ; }
30143024 activate ( ) : void { }
30153025 selectionChanged ( selection : Range ) : void { }
30163026 resetDatabase ( ) : void { }
0 commit comments