Skip to content

Commit

Permalink
Merge pull request #6785 from microsoft/seanmcm/1_2_0_insiders_updates
Browse files Browse the repository at this point in the history
1 2 0 insiders updates
  • Loading branch information
sean-mcmanus authored Jan 15, 2021
2 parents 4258608 + ed584b2 commit 37cca41
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
2 changes: 2 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Show configuration squiggles when configurations with the same name exist. [#3412](https://github.com/microsoft/vscode-cpptools/issues/3412)
* Add command `Generate EditorConfig contents from VC Format settings`. [#6018](https://github.com/microsoft/vscode-cpptools/issues/6018)
* Update to clang-format 11.1. [#6326](https://github.com/microsoft/vscode-cpptools/issues/6326)
* Add clang-format built for Windows ARM64. [#6494](https://github.com/microsoft/vscode-cpptools/issues/6494)
* Add support for the `/await` flag with msvc IntelliSense. [#6596](https://github.com/microsoft/vscode-cpptools/issues/6596)
* Increase document/workspace symbol limit from 1000 to 10000. [#6766](https://github.com/microsoft/vscode-cpptools/issues/6766)

Expand Down Expand Up @@ -62,6 +63,7 @@
* Fix `.` to `->` completion with multiple cursors. [#6720](https://github.com/microsoft/vscode-cpptools/issues/6720)
* Fix bug with configured cl.exe path not being used to choose appropriate system include paths, or cl.exe not being used at all if it's not also installed via the VS Installer. [#6746](https://github.com/microsoft/vscode-cpptools/issues/6746)
* Fix bugs with parsing of quotes and escape sequences in compiler args. [#6761](https://github.com/microsoft/vscode-cpptools/issues/6761)
* Fix the configuration not showing in the status bar when `c_cpp_properties.json` is active. [#6765](https://github.com/microsoft/vscode-cpptools/issues/6765)
* Fix "D" command line warnings not appearing with cl.exe cppbuild build tasks.
* Fix cl.exe cppbuild tasks when `/nologo` is used (and make /nologo a default arg).
* Fix a cpptools crash and multiple deadlocks.
Expand Down
3 changes: 2 additions & 1 deletion Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,9 @@ export class CppProperties {

private isConfigNameUnique(configName: string): string | undefined {
let errorMsg: string | undefined;
// TODO: make configName non-case sensitive.
const occurrences: number | undefined = this.ConfigurationNames?.filter(function (name): boolean { return name === configName; }).length;
if (occurrences) {
if (occurrences && occurrences > 1) {
errorMsg = localize('duplicate.name', "{0} is a duplicate. The configuration name should be unique.", configName);
}
return errorMsg;
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ export function processDelayedDidOpen(document: vscode.TextDocument): void {
const client: Client = clients.getClientFor(document.uri);
if (client) {
// Log warm start.
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
if (clients.checkOwnership(client, document)) {
if (!client.TrackedDocuments.has(document)) {
// If not yet tracked, process as a newly opened file. (didOpen is sent to server in client.takeOwnership()).
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
client.TrackedDocuments.add(document);
const finishDidOpen = (doc: vscode.TextDocument) => {
client.provideCustomConfiguration(doc.uri, undefined);
Expand Down
58 changes: 30 additions & 28 deletions Extension/src/LanguageServer/protocolFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,42 @@ export function createProtocolFilter(clients: ClientCollection): Middleware {
didOpen: (document, sendMessage) => {
const editor: vscode.TextEditor | undefined = vscode.window.visibleTextEditors.find(e => e.document === document);
if (editor) {
// Log warm start.
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
// If the file was visible editor when we were activated, we will not get a call to
// onDidChangeVisibleTextEditors, so immediately open any file that is visible when we receive didOpen.
// Otherwise, we defer opening the file until it's actually visible.
const me: Client = clients.getClientFor(document.uri);
if (clients.checkOwnership(me, document)) {
me.TrackedDocuments.add(document);
const finishDidOpen = (doc: vscode.TextDocument) => {
me.provideCustomConfiguration(doc.uri, undefined);
me.notifyWhenReady(() => {
sendMessage(doc);
me.onDidOpenTextDocument(doc);
if (editor && editor === vscode.window.activeTextEditor) {
onDidChangeActiveTextEditor(editor);
}
});
};
let languageChanged: boolean = false;
if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") {
const cppSettings: CppSettings = new CppSettings();
if (cppSettings.autoAddFileAssociations) {
const fileName: string = path.basename(document.uri.fsPath);
const mappingString: string = fileName + "@" + document.uri.fsPath;
me.addFileAssociations(mappingString, false);
me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }});
vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => {
finishDidOpen(newDoc);
if (!me.TrackedDocuments.has(document)) {
// Log warm start.
clients.timeTelemetryCollector.setDidOpenTime(document.uri);
if (clients.checkOwnership(me, document)) {
me.TrackedDocuments.add(document);
const finishDidOpen = (doc: vscode.TextDocument) => {
me.provideCustomConfiguration(doc.uri, undefined);
me.notifyWhenReady(() => {
sendMessage(doc);
me.onDidOpenTextDocument(doc);
if (editor && editor === vscode.window.activeTextEditor) {
onDidChangeActiveTextEditor(editor);
}
});
languageChanged = true;
};
let languageChanged: boolean = false;
if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") {
const cppSettings: CppSettings = new CppSettings();
if (cppSettings.autoAddFileAssociations) {
const fileName: string = path.basename(document.uri.fsPath);
const mappingString: string = fileName + "@" + document.uri.fsPath;
me.addFileAssociations(mappingString, false);
me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }});
vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => {
finishDidOpen(newDoc);
});
languageChanged = true;
}
}
if (!languageChanged) {
finishDidOpen(document);
}
}
if (!languageChanged) {
finishDidOpen(document);
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class UI {
const isCpp: boolean = (activeEditor.document.uri.scheme === "file" && (activeEditor.document.languageId === "cpp" || activeEditor.document.languageId === "c"));

let isCppPropertiesJson: boolean = false;
if (activeEditor.document.languageId === "json") {
if (activeEditor.document.languageId === "json" || activeEditor.document.languageId === "jsonc") {
isCppPropertiesJson = activeEditor.document.fileName.endsWith("c_cpp_properties.json");
if (isCppPropertiesJson) {
vscode.languages.setTextDocumentLanguage(activeEditor.document, "jsonc");
Expand Down

0 comments on commit 37cca41

Please sign in to comment.