Skip to content

Commit

Permalink
Fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Colengms committed Oct 30, 2024
1 parent 2b9137f commit 1d79e27
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Extension/src/LanguageServer/protocolFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
import { Middleware } from 'vscode-languageclient';
import * as util from '../common';
import { logAndReturn } from '../Utility/Async/returns';
import { Client } from './client';
import { clients } from './extension';
import { shouldChangeFromCToCpp } from './utils';
Expand Down Expand Up @@ -36,20 +37,20 @@ export function createProtocolFilter(): Middleware {
client.addFileAssociations(mappingString, "cpp");
client.sendDidChangeSettings();
// This will cause the file to be closed and reopened.
vscode.languages.setTextDocumentLanguage(document, "cpp");
void vscode.languages.setTextDocumentLanguage(document, "cpp");
return;
}
// client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
client.onDidOpenTextDocument(document);
client.takeOwnership(document);
sendMessage(document).then(() => {
void sendMessage(document).then(() => {
// For a file already open when we activate, sometimes we don't get any notifications about visible
// or active text editors, visible ranges, or text selection. As a workaround, we trigger
// onDidChangeVisibleTextEditors here, only for the first file opened.
if (!anyFileOpened) {
anyFileOpened = true;
const cppEditors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => util.isCpp(e.document));
client.onDidChangeVisibleTextEditors(cppEditors);
client.onDidChangeVisibleTextEditors(cppEditors).catch(logAndReturn.undefined);
}
});
}
Expand All @@ -68,8 +69,8 @@ export function createProtocolFilter(): Middleware {
if (me.TrackedDocuments.has(uriString)) {
me.onDidCloseTextDocument(document);
me.TrackedDocuments.delete(uriString);
sendMessage(document);
void sendMessage(document);
}
},
}
};
}

0 comments on commit 1d79e27

Please sign in to comment.