Skip to content

Commit 51615a3

Browse files
authored
Merge pull request #13833 from microsoft/main
Merge for 1.27.0 (4th time)
2 parents bcb0bc4 + c6c2208 commit 51615a3

File tree

9 files changed

+61
-39
lines changed

9 files changed

+61
-39
lines changed

Extension/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# C/C++ for Visual Studio Code Changelog
22

3-
## Version 1.27.0: August 4, 2025
3+
## Version 1.27.0: August 7, 2025
44
### Bug Fixes
55
* Fix an IntelliSense crash in `add_cached_tokens_to_string`. [#11900](https://github.com/microsoft/vscode-cpptools/issues/11900)
66
* Fix an IntelliSense crash in `find_subobject_for_interpreter_address`. [#12464](https://github.com/microsoft/vscode-cpptools/issues/12464)
@@ -15,6 +15,9 @@
1515
* Fix `-imacro` not configuring IntelliSense correctly. [#13785](https://github.com/microsoft/vscode-cpptools/issues/13785)
1616
* Fix `pipeTransport.quoteArgs` not being handled correctly. [#13791](https://github.com/microsoft/vscode-cpptools/issues/13791)
1717
* Thank you for the contribution. [@mrjist (Matt)](https://github.com/mrjist) [PR #13794](https://github.com/microsoft/vscode-cpptools/pull/13794)
18+
* Fix `.txx` and `.tpp` not being handled as C++ header files. [#13808](https://github.com/microsoft/vscode-cpptools/issues/13808)
19+
* Fix an error when using GitHub Copilot with VS Code older than 1.90.0. [#13818](https://github.com/microsoft/vscode-cpptools/issues/13818)
20+
* Fix activation failing if the `c_cpp_properties.json` exists but fails to be opened. [#13829](https://github.com/microsoft/vscode-cpptools/issues/13829)
1821
* Fix an IntelliSense bug that could cause incorrect string lengths to be reported for string literals in files that use certain file encodings.
1922

2023
## Version 1.26.3: June 24, 2025

Extension/ThirdPartyNotices.txt

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,29 @@ the licensed code:
10631063
DEALINGS IN THE SOFTWARE.
10641064

10651065

1066+
---------------------------------------------------------
1067+
1068+
---------------------------------------------------------
1069+
1070+
vscode-cpptools 7.1.1 - LicenseRef-scancode-generic-cla AND MIT
1071+
https://github.com/Microsoft/vscode-cpptools-api#readme
1072+
1073+
Copyright (c) Microsoft Corporation
1074+
1075+
vscode-cpptools-api
1076+
1077+
Copyright (c) Microsoft Corporation
1078+
All rights reserved.
1079+
1080+
MIT License
1081+
1082+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1083+
1084+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1085+
1086+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1087+
1088+
10661089
---------------------------------------------------------
10671090

10681091
---------------------------------------------------------
@@ -2658,7 +2681,7 @@ SOFTWARE.
26582681

26592682
---------------------------------------------------------
26602683

2661-
tmp 0.2.3 - MIT
2684+
tmp 0.2.4 - MIT
26622685
http://github.com/raszi/node-tmp
26632686

26642687
Copyright (c) 2014 KARASZI Istvan
@@ -2738,29 +2761,6 @@ The above copyright notice and this permission notice shall be included in all c
27382761

27392762
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27402763

2741-
---------------------------------------------------------
2742-
2743-
---------------------------------------------------------
2744-
2745-
vscode-cpptools 7.1.1 - MIT
2746-
https://github.com/Microsoft/vscode-cpptools-api#readme
2747-
2748-
Copyright (c) Microsoft Corporation
2749-
2750-
vscode-cpptools-api
2751-
2752-
Copyright (c) Microsoft Corporation
2753-
All rights reserved.
2754-
2755-
MIT License
2756-
2757-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2758-
2759-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2760-
2761-
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2762-
2763-
27642764
---------------------------------------------------------
27652765

27662766
---------------------------------------------------------
@@ -2952,7 +2952,6 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
29522952
whatwg-url 5.0.0 - MIT
29532953
https://github.com/jsdom/whatwg-url#readme
29542954

2955-
(c) extraPathPercentEncodeSet.has
29562955
Copyright (c) 2015-2016 Sebastian Mayr
29572956

29582957
The MIT License (MIT)

Extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6614,7 +6614,7 @@
66146614
"posix-getopt": "^1.2.1",
66156615
"shell-quote": "^1.8.1",
66166616
"ssh-config": "^4.4.4",
6617-
"tmp": "^0.2.3",
6617+
"tmp": "^0.2.4",
66186618
"vscode-cpptools": "^7.1.1",
66196619
"vscode-languageclient": "^8.1.0",
66206620
"vscode-nls": "^5.2.0",

Extension/src/LanguageServer/Providers/CopilotHoverProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as vscode from 'vscode';
66
import { Position, ResponseError } from 'vscode-languageclient';
77
import * as nls from 'vscode-nls';
8+
import { getVSCodeLanguageModel } from '../../common';
89
import { modelSelector } from '../../constants';
910
import * as telemetry from '../../telemetry';
1011
import { DefaultClient, GetCopilotHoverInfoParams, GetCopilotHoverInfoRequest, GetCopilotHoverInfoResult } from '../client';
@@ -42,7 +43,7 @@ export class CopilotHoverProvider implements vscode.HoverProvider {
4243
}
4344

4445
// Ensure the user has access to Copilot.
45-
const vscodelm = (vscode as any).lm;
46+
const vscodelm = getVSCodeLanguageModel();
4647
if (vscodelm) {
4748
const [model] = await vscodelm.selectChatModels(modelSelector);
4849
if (!model) {

Extension/src/LanguageServer/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ export class DefaultClient implements Client {
26552655
});
26562656

26572657
// TODO: Handle new associations without a reload.
2658-
this.associations_for_did_change = new Set<string>(["cu", "cuh", "c", "i", "cpp", "cc", "cxx", "c++", "cp", "hpp", "hh", "hxx", "h++", "hp", "h", "ii", "ino", "inl", "ipp", "tcc", "idl"]);
2658+
this.associations_for_did_change = new Set<string>(["cu", "cuh", "c", "i", "cpp", "cc", "cxx", "c++", "cp", "hpp", "hh", "hxx", "h++", "hp", "h", "ii", "ino", "inl", "ipp", "tcc", "txx", "tpp", "idl"]);
26592659
const assocs: any = new OtherSettings().filesAssociations;
26602660
for (const assoc in assocs) {
26612661
const dotIndex: number = assoc.lastIndexOf('.');

Extension/src/LanguageServer/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,7 @@ export async function preReleaseCheck(): Promise<void> {
14131413
async function onCopilotHover(): Promise<void> {
14141414
telemetry.logLanguageServerEvent("CopilotHover");
14151415

1416-
// Check if the user has access to vscode language model.
1417-
const vscodelm = (vscode as any).lm;
1416+
const vscodelm = util.getVSCodeLanguageModel();
14181417
if (!vscodelm) {
14191418
return;
14201419
}
@@ -1477,6 +1476,7 @@ async function onCopilotHover(): Promise<void> {
14771476

14781477
let chatResponse: vscode.LanguageModelChatResponse | undefined;
14791478
try {
1479+
// Select the chat model.
14801480
const [model] = await vscodelm.selectChatModels(modelSelector);
14811481

14821482
chatResponse = await model.sendRequest(

Extension/src/common.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function getVcpkgRoot(): string {
165165
export function isHeaderFile(uri: vscode.Uri): boolean {
166166
const fileExt: string = path.extname(uri.fsPath);
167167
const fileExtLower: string = fileExt.toLowerCase();
168-
return !fileExt || [".cuh", ".hpp", ".hh", ".hxx", ".h++", ".hp", ".h", ".inl", ".ipp", ".tcc", ".tlh", ".tli", ""].some(ext => fileExtLower === ext);
168+
return !fileExt || [".cuh", ".hpp", ".hh", ".hxx", ".h++", ".hp", ".h", ".inl", ".ipp", ".tcc", ".txx", ".tpp", ".tlh", ".tli", ""].some(ext => fileExtLower === ext);
169169
}
170170

171171
export function isCppFile(uri: vscode.Uri): boolean {
@@ -1828,3 +1828,16 @@ export function equals(array1: string[] | undefined, array2: string[] | undefine
18281828
}
18291829
return true;
18301830
}
1831+
1832+
export function getVSCodeLanguageModel(): any | undefined {
1833+
// Check if the user has access to vscode language model.
1834+
const vscodelm = (vscode as any).lm;
1835+
if (!vscodelm) {
1836+
return undefined;
1837+
}
1838+
// Check that vscodelm has a method called 'selectChatModels'
1839+
if (!vscodelm.selectChatModels || typeof vscodelm.selectChatModels !== 'function') {
1840+
return undefined;
1841+
}
1842+
return vscodelm;
1843+
}

Extension/src/main.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,15 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
125125
for (let i: number = 0; i < vscode.workspace.workspaceFolders.length; ++i) {
126126
const config: string = path.join(vscode.workspace.workspaceFolders[i].uri.fsPath, ".vscode/c_cpp_properties.json");
127127
if (await util.checkFileExists(config)) {
128-
const doc: vscode.TextDocument = await vscode.workspace.openTextDocument(config);
129-
void vscode.languages.setTextDocumentLanguage(doc, "jsonc");
130-
util.setWorkspaceIsCpp();
128+
try {
129+
const doc: vscode.TextDocument = await vscode.workspace.openTextDocument(config);
130+
void vscode.languages.setTextDocumentLanguage(doc, "jsonc");
131+
util.setWorkspaceIsCpp();
132+
} catch (err) {
133+
// The c_cpp_properties.json might not be openable (e.g. an executable).
134+
// Catching the exception prevents our extension activation from failing.
135+
// VS Code itself will report an error message.
136+
}
131137
}
132138
}
133139
}

Extension/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4712,10 +4712,10 @@ timers-ext@^0.1.7:
47124712
es5-ext "^0.10.64"
47134713
next-tick "^1.1.0"
47144714

4715-
tmp@^0.2.3:
4716-
version "0.2.3"
4717-
resolved "https://pkgs.dev.azure.com/azure-public/VisualCpp/_packaging/cpp_PublicPackages/npm/registry/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae"
4718-
integrity sha1-63g8wivB6L69BnFHbUbqTrMqea4=
4715+
tmp@^0.2.4:
4716+
version "0.2.4"
4717+
resolved "https://pkgs.dev.azure.com/azure-public/VisualCpp/_packaging/cpp_PublicPackages/npm/registry/tmp/-/tmp-0.2.4.tgz#c6db987a2ccc97f812f17137b36af2b6521b0d13"
4718+
integrity sha1-xtuYeizMl/gS8XE3s2rytlIbDRM=
47194719

47204720
to-absolute-glob@^2.0.0, to-absolute-glob@^2.0.2:
47214721
version "2.0.2"

0 commit comments

Comments
 (0)