@@ -8,16 +8,13 @@ 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' ;
1211import { Client } from './client' ;
1312import { clients } from './extension' ;
1413import { shouldChangeFromCToCpp } from './utils' ;
1514
1615export const RequestCancelled : number = - 32800 ;
1716export const ServerCancelled : number = - 32802 ;
1817
19- let anyFileOpened : boolean = false ;
20-
2118export function createProtocolFilter ( ) : Middleware {
2219 return {
2320 didOpen : async ( document , sendMessage ) => {
@@ -43,16 +40,7 @@ export function createProtocolFilter(): Middleware {
4340 // client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
4441 client . onDidOpenTextDocument ( document ) ;
4542 client . takeOwnership ( document ) ;
46- void sendMessage ( document ) . then ( ( ) => {
47- // For a file already open when we activate, sometimes we don't get any notifications about visible
48- // or active text editors, visible ranges, or text selection. As a workaround, we trigger
49- // onDidChangeVisibleTextEditors here, only for the first file opened.
50- if ( ! anyFileOpened ) {
51- anyFileOpened = true ;
52- const cppEditors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => util . isCpp ( e . document ) ) ;
53- client . onDidChangeVisibleTextEditors ( cppEditors ) . catch ( logAndReturn . undefined ) ;
54- }
55- } ) ;
43+ void sendMessage ( document ) ;
5644 }
5745 }
5846 } ,
0 commit comments