Skip to content

Commit a204903

Browse files
authored
Fix an error on startup if a file is open (#13487)
1 parent 1709999 commit a204903

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Extension/src/LanguageServer/protocolFilter.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ export function createProtocolFilter(): Middleware {
4545
// client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
4646
client.takeOwnership(document);
4747
void sendMessage(document);
48-
const cppEditors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => util.isCpp(e.document));
49-
client.onDidChangeVisibleTextEditors(cppEditors).catch(logAndReturn.undefined);
48+
client.ready.then(() => {
49+
const cppEditors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => util.isCpp(e.document));
50+
client.onDidChangeVisibleTextEditors(cppEditors).catch(logAndReturn.undefined);
51+
}).catch(logAndReturn.undefined);
5052
}
5153
}
5254
},

0 commit comments

Comments
 (0)