Skip to content

Commit ed584b2

Browse files
committed
Merge branch 'main' into seanmcm/1_2_0_insiders_updates
2 parents f7cab67 + 8e8482b commit ed584b2

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

Extension/src/LanguageServer/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ export function processDelayedDidOpen(document: vscode.TextDocument): void {
432432
const client: Client = clients.getClientFor(document.uri);
433433
if (client) {
434434
// Log warm start.
435-
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
436435
if (clients.checkOwnership(client, document)) {
437436
if (!client.TrackedDocuments.has(document)) {
438437
// If not yet tracked, process as a newly opened file. (didOpen is sent to server in client.takeOwnership()).
438+
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
439439
client.TrackedDocuments.add(document);
440440
const finishDidOpen = (doc: vscode.TextDocument) => {
441441
client.provideCustomConfiguration(doc.uri, undefined);

Extension/src/LanguageServer/protocolFilter.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,42 @@ export function createProtocolFilter(clients: ClientCollection): Middleware {
2626
didOpen: (document, sendMessage) => {
2727
const editor: vscode.TextEditor | undefined = vscode.window.visibleTextEditors.find(e => e.document === document);
2828
if (editor) {
29-
// Log warm start.
30-
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
3129
// If the file was visible editor when we were activated, we will not get a call to
3230
// onDidChangeVisibleTextEditors, so immediately open any file that is visible when we receive didOpen.
3331
// Otherwise, we defer opening the file until it's actually visible.
3432
const me: Client = clients.getClientFor(document.uri);
35-
if (clients.checkOwnership(me, document)) {
36-
me.TrackedDocuments.add(document);
37-
const finishDidOpen = (doc: vscode.TextDocument) => {
38-
me.provideCustomConfiguration(doc.uri, undefined);
39-
me.notifyWhenReady(() => {
40-
sendMessage(doc);
41-
me.onDidOpenTextDocument(doc);
42-
if (editor && editor === vscode.window.activeTextEditor) {
43-
onDidChangeActiveTextEditor(editor);
44-
}
45-
});
46-
};
47-
let languageChanged: boolean = false;
48-
if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") {
49-
const cppSettings: CppSettings = new CppSettings();
50-
if (cppSettings.autoAddFileAssociations) {
51-
const fileName: string = path.basename(document.uri.fsPath);
52-
const mappingString: string = fileName + "@" + document.uri.fsPath;
53-
me.addFileAssociations(mappingString, false);
54-
me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }});
55-
vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => {
56-
finishDidOpen(newDoc);
33+
if (!me.TrackedDocuments.has(document)) {
34+
// Log warm start.
35+
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
36+
if (clients.checkOwnership(me, document)) {
37+
me.TrackedDocuments.add(document);
38+
const finishDidOpen = (doc: vscode.TextDocument) => {
39+
me.provideCustomConfiguration(doc.uri, undefined);
40+
me.notifyWhenReady(() => {
41+
sendMessage(doc);
42+
me.onDidOpenTextDocument(doc);
43+
if (editor && editor === vscode.window.activeTextEditor) {
44+
onDidChangeActiveTextEditor(editor);
45+
}
5746
});
58-
languageChanged = true;
47+
};
48+
let languageChanged: boolean = false;
49+
if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") {
50+
const cppSettings: CppSettings = new CppSettings();
51+
if (cppSettings.autoAddFileAssociations) {
52+
const fileName: string = path.basename(document.uri.fsPath);
53+
const mappingString: string = fileName + "@" + document.uri.fsPath;
54+
me.addFileAssociations(mappingString, false);
55+
me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }});
56+
vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => {
57+
finishDidOpen(newDoc);
58+
});
59+
languageChanged = true;
60+
}
61+
}
62+
if (!languageChanged) {
63+
finishDidOpen(document);
5964
}
60-
}
61-
if (!languageChanged) {
62-
finishDidOpen(document);
6365
}
6466
}
6567
} else {

0 commit comments

Comments
 (0)