@@ -8,6 +8,7 @@ import * as path from 'path';
88import * as vscode from 'vscode' ;
99import { Middleware } from 'vscode-languageclient' ;
1010import * as util from '../common' ;
11+ import { logAndReturn } from '../Utility/Async/returns' ;
1112import { Client } from './client' ;
1213import { clients } from './extension' ;
1314import { shouldChangeFromCToCpp } from './utils' ;
@@ -36,20 +37,20 @@ export function createProtocolFilter(): Middleware {
3637 client . addFileAssociations ( mappingString , "cpp" ) ;
3738 client . sendDidChangeSettings ( ) ;
3839 // This will cause the file to be closed and reopened.
39- vscode . languages . setTextDocumentLanguage ( document , "cpp" ) ;
40+ void vscode . languages . setTextDocumentLanguage ( document , "cpp" ) ;
4041 return ;
4142 }
4243 // client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
4344 client . onDidOpenTextDocument ( document ) ;
4445 client . takeOwnership ( document ) ;
45- sendMessage ( document ) . then ( ( ) => {
46+ void sendMessage ( document ) . then ( ( ) => {
4647 // For a file already open when we activate, sometimes we don't get any notifications about visible
4748 // or active text editors, visible ranges, or text selection. As a workaround, we trigger
4849 // onDidChangeVisibleTextEditors here, only for the first file opened.
4950 if ( ! anyFileOpened ) {
5051 anyFileOpened = true ;
5152 const cppEditors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => util . isCpp ( e . document ) ) ;
52- client . onDidChangeVisibleTextEditors ( cppEditors ) ;
53+ client . onDidChangeVisibleTextEditors ( cppEditors ) . catch ( logAndReturn . undefined ) ;
5354 }
5455 } ) ;
5556 }
@@ -68,8 +69,8 @@ export function createProtocolFilter(): Middleware {
6869 if ( me . TrackedDocuments . has ( uriString ) ) {
6970 me . onDidCloseTextDocument ( document ) ;
7071 me . TrackedDocuments . delete ( uriString ) ;
71- sendMessage ( document ) ;
72+ void sendMessage ( document ) ;
7273 }
73- } ,
74+ }
7475 } ;
7576}
0 commit comments