@@ -8,16 +8,13 @@ import * as path from 'path';
8
8
import * as vscode from 'vscode' ;
9
9
import { Middleware } from 'vscode-languageclient' ;
10
10
import * as util from '../common' ;
11
- import { logAndReturn } from '../Utility/Async/returns' ;
12
11
import { Client } from './client' ;
13
12
import { clients } from './extension' ;
14
13
import { shouldChangeFromCToCpp } from './utils' ;
15
14
16
15
export const RequestCancelled : number = - 32800 ;
17
16
export const ServerCancelled : number = - 32802 ;
18
17
19
- let anyFileOpened : boolean = false ;
20
-
21
18
export function createProtocolFilter ( ) : Middleware {
22
19
return {
23
20
didOpen : async ( document , sendMessage ) => {
@@ -43,16 +40,7 @@ export function createProtocolFilter(): Middleware {
43
40
// client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
44
41
client . onDidOpenTextDocument ( document ) ;
45
42
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 ) ;
56
44
}
57
45
}
58
46
} ,
0 commit comments