Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/.npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
registry=https://pkgs.dev.azure.com/azure-public/VisualCpp/_packaging/cpp_PublicPackages/npm/registry/
# Disable postinstall scripts for supply chain security. Allowlist exceptions with npm trust: https://docs.npmjs.com/cli/v11/commands/npm-trust
ignore-scripts=true

min-release-age=7
audit=true
audit-level=high
1 change: 1 addition & 0 deletions .github/workflows/ci_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ jobs:
platform: mac
checkout-ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target-ref || github.ref }}
yarn-args: --network-timeout 100000

81 changes: 40 additions & 41 deletions .github/workflows/job-compile-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
run: yarn install ${{ inputs.yarn-args }}
working-directory: Extension

- name: Install gdb (linux)
if: ${{ inputs.platform == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install -y gdb

- name: Compile Sources
run: yarn run compile
working-directory: Extension
Expand All @@ -50,53 +56,46 @@ jobs:
run: yarn test
working-directory: Extension

# These tests don't require the binary.
# On Linux, it is failing (before the tests actually run) with: Test run terminated with signal SIGSEGV.
# But it works on Linux during the E2E test.
- name: Run SingleRootProject tests
if: ${{ inputs.platform != 'linux' }}
run: yarn test --scenario=SingleRootProject --skipCheckBinaries
- name: Acquire Native Binaries
run: yarn install-and-copy-binaries-for-test
working-directory: Extension

# NOTE : We can't run the test that require the native binary files
# yet -- there will be an update soon that allows the tester to
# acquire them on-the-fly
# - name: Run languageServer integration tests
# if: ${{ inputs.platform == 'windows' }}
# run: yarn test --scenario=SingleRootProject
# working-directory: Extension
- name: Run languageServer integration tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: yarn test --scenario=SingleRootProject
working-directory: Extension

# - name: Run E2E IntelliSense features tests
# if: ${{ inputs.platform == 'windows' }}
# run: yarn test --scenario=MultirootDeadlockTest
# working-directory: Extension
- name: Run E2E IntelliSense features tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: yarn test --scenario=MultirootDeadlockTest
working-directory: Extension

# - name: Run E2E IntelliSense features tests
# if: ${{ inputs.platform == 'windows' }}
# run: yarn test --scenario=RunWithoutDebugging
# working-directory: Extension
- name: Run RunWithoutDebugging tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: yarn test --scenario=RunWithoutDebugging
working-directory: Extension

# NOTE: For mac/linux run the tests with xvfb-action for UI support.
# Another way to start xvfb https://github.com/microsoft/vscode-test/blob/master/sample/azure-pipelines.yml

# - name: Run languageServer integration tests (xvfb)
# if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
# uses: coactions/setup-xvfb@v1
# with:
# run: yarn test --scenario=SingleRootProject
# working-directory: Extension

# - name: Run E2E IntelliSense features tests (xvfb)
# if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
# uses: coactions/setup-xvfb@v1
# with:
# run: yarn test --scenario=MultirootDeadlockTest
# working-directory: Extension

# - name: Run E2E IntelliSense features tests (xvfb)
# if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
# uses: coactions/setup-xvfb@v1
# with:
# run: yarn test --scenario=RunWithoutDebugging
# working-directory: Extension
- name: Run languageServer integration tests (linux/macOS)
if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
uses: coactions/setup-xvfb@v1
with:
run: yarn test --scenario=SingleRootProject
working-directory: Extension

- name: Run E2E IntelliSense features tests (linux/macOS)
if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
uses: coactions/setup-xvfb@v1
with:
run: yarn test --scenario=MultirootDeadlockTest
working-directory: Extension

- name: Run RunWithoutDebugging tests (linux/macOS)
if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
uses: coactions/setup-xvfb@v1
with:
run: yarn test --scenario=RunWithoutDebugging --scenario-arg=skipExternalConsole
working-directory: Extension

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ OneLocBuild

# ignore imported localization xlf directory
vscode-translations-import

.vscode/settings.json
4 changes: 4 additions & 0 deletions Extension/.npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
registry=https://pkgs.dev.azure.com/azure-public/VisualCpp/_packaging/cpp_PublicPackages/npm/registry/
# Disable postinstall scripts for supply chain security. Allowlist exceptions with npm trust: https://docs.npmjs.com/cli/v11/commands/npm-trust
ignore-scripts=true

min-release-age=7
audit=true
audit-level=high
11 changes: 10 additions & 1 deletion Extension/.scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ import { verbose } from '../src/Utility/Text/streams';
export const $root = resolve(`${__dirname}/..`);
export let $cmd = 'main';
export let $scenario = '';
export const $scenarioArgs: string[] = [];

// loop through the args and pick out --scenario=... and remove it from the $args and set $scenario
process.argv.slice(2).filter(each => !(each.startsWith('--scenario=') && ($scenario = each.substring('--scenario='.length))));
// parse out the scenario arguments.
process.argv.slice(2).reduce<string[]>((acc, arg) => {
if (arg.startsWith('--scenario-arg=')) {
acc.push(arg.substring('--scenario-arg='.length));
}
return acc;
}, $scenarioArgs);

export const $args = process.argv.slice(2).filter(each => !each.startsWith('--'));
export const $switches = process.argv.slice(2).filter(each => each.startsWith('--'));

Expand All @@ -39,7 +48,7 @@ chdir($root);

// dump unhandled async errors to the console and exit.
process.on('unhandledRejection', (reason: any, _promise) => {
error(`${reason?.stack?.split(/\r?\n/).filter(l => !l.includes('node:internal') && !l.includes('node_modules')).join('\n')}`);
error(`${reason?.stack?.split(/\r?\n/).filter((l: string) => !l.includes('node:internal') && !l.includes('node_modules')).join('\n')}`);
process.exit(1);
});

Expand Down
44 changes: 39 additions & 5 deletions Extension/.scripts/copyExtensionBinaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import { cp, readdir, rm, stat } from 'node:fs/promises';
import { homedir } from 'node:os';
import { join } from 'node:path';
import { basename, join } from 'node:path';
import { verbose } from '../src/Utility/Text/streams';
import { $args, $root, green, heading, note } from './common';

const extensionPrefix = 'ms-vscode.cpptools-';
Expand Down Expand Up @@ -73,17 +74,47 @@ async function getInstalledExtensions(root: string): Promise<InstalledExtension[
}
}

async function findLatestInstalledExtension(providedPath?: string): Promise<string> {
if (providedPath) {
return providedPath;
async function findExtensionsFolder(root: string): Promise<string | undefined> {
try {
const entries = await readdir(root, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory()) {
if (entry.name === 'extensions') {
const extensionEntries = await readdir(join(root, entry.name), { withFileTypes: true });
for (const extensionEntry of extensionEntries) {
if (extensionEntry.isDirectory() && extensionEntry.name.startsWith(extensionPrefix)) {
return join(root, entry.name);
}
}
} else {
const result = await findExtensionsFolder(join(root, entry.name));
if (result) {
return result;
}
}
}
}
} catch {
// Ignore errors (permission denied, etc.)
}
return undefined;
}

async function findLatestInstalledExtension(providedPath?: string): Promise<string> {
const searchRoots: string[] = [
join(homedir(), '.vscode', 'extensions'),
join(homedir(), '.vscode-insiders', 'extensions'),
join(homedir(), '.vscode-server', 'extensions'),
join(homedir(), '.vscode-server-insiders', 'extensions')
];
if (providedPath) {
// find a folder called 'extensions' recursively under the provided path and add it to the front of the search roots
const extensionsFolderPath = await findExtensionsFolder(providedPath);
if (extensionsFolderPath) {
verbose(`Found extensions folder under provided path: ${extensionsFolderPath}`);
searchRoots.unshift(extensionsFolderPath);
}
}

const installed: InstalledExtension[] = (await Promise.all(searchRoots.map(each => getInstalledExtensions(each)))).flat();
if (!installed.length) {
Expand All @@ -94,7 +125,7 @@ async function findLatestInstalledExtension(providedPath?: string): Promise<stri
return installed[0].path;
}

export async function main(sourcePath = $args[0]) {
export async function main(sourcePath = $args[0]): Promise<string | undefined> {
console.log(heading('Copy installed extension binaries'));

const installedExtensionPath: string = await findLatestInstalledExtension(sourcePath);
Expand All @@ -110,4 +141,7 @@ export async function main(sourcePath = $args[0]) {
}

note(`Copied installed binaries into ${$root}`);

const installedVersion = tryParseVersion(basename(installedExtensionPath));
return installedVersion?.join('.');
}
14 changes: 12 additions & 2 deletions Extension/.scripts/generateOptionsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ function replaceReferences(definitions: any, objects: any): any {
objects[key].anyOf = replaceReferences(definitions, objects[key].anyOf);
}

// Recursively replace references if this object has properties.
if (objects[key].hasOwnProperty('type') && objects[key].type === 'object' && objects[key].properties !== null) {
// Handle 'oneOf' with references
if (objects[key].hasOwnProperty('oneOf')) {
objects[key].oneOf = replaceReferences(definitions, objects[key].oneOf);
}

// Recursively replace references if this schema node has properties.
if (objects[key].hasOwnProperty('properties') && objects[key].properties !== null) {
objects[key].properties = replaceReferences(definitions, objects[key].properties);
objects[key].properties = updateDefaults(objects[key].properties, objects[key].default);
}
Expand Down Expand Up @@ -117,11 +122,13 @@ function mergeReferences(baseDefinitions: any, additionalDefinitions: any): void
export async function main() {
const packageJSON: any = JSON.parse(await read(resolve($root, 'package.json')));
const schemaJSON: any = JSON.parse(await read(resolve($root, 'tools/OptionsSchema.json')));
const taskDefinitionsJSON: any = JSON.parse(await read(resolve($root, 'tools/TaskDefinitionsSchema.json')));
const symbolSettingsJSON: any = JSON.parse(await read(resolve($root, 'tools/VSSymbolSettings.json')));

mergeReferences(schemaJSON.definitions, symbolSettingsJSON.definitions);

schemaJSON.definitions = replaceReferences(schemaJSON.definitions, schemaJSON.definitions);
taskDefinitionsJSON.definitions = replaceReferences(taskDefinitionsJSON.definitions, taskDefinitionsJSON.definitions);

// Hard Code adding in configurationAttributes launch and attach.
// cppdbg
Expand All @@ -132,6 +139,9 @@ export async function main() {
packageJSON.contributes.debuggers[1].configurationAttributes.launch = schemaJSON.definitions.CppvsdbgLaunchOptions;
packageJSON.contributes.debuggers[1].configurationAttributes.attach = schemaJSON.definitions.CppvsdbgAttachOptions;

// task definitions
packageJSON.contributes.taskDefinitions = [taskDefinitionsJSON.definitions.CppBuildTaskDefinition];

let content: string = JSON.stringify(packageJSON, null, 4);

// We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. This process will
Expand Down
35 changes: 35 additions & 0 deletions Extension/.scripts/installAndCopyBinaries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import { runVSCodeCommand } from '@vscode/test-electron';
import { writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { $root, error, heading, note } from './common';
import * as copy from './copyExtensionBinaries';
import { install, isolated, options } from "./vscode";

export async function main() {
console.log(heading(`Install VS Code`));
const vscode = await install();
if (!vscode) {
error('Failed to install VS Code');
return;
}

console.log(heading('Install latest C/C++ Extension'));
const result = await runVSCodeCommand([...vscode.args ?? [], '--install-extension', 'ms-vscode.cpptools', '--pre-release'], options);
if (result.stdout) {
console.log(result.stdout.toString());
}
if (result.stderr) {
error(result.stderr.toString());
}

const binaryVersion = await copy.main(isolated);
if (binaryVersion) {
await writeFile(join($root, 'bin', 'binaryVersion.json'), JSON.stringify({ version: binaryVersion }));
note(`Wrote binary version ${binaryVersion} to bin/binaryVersion.json`);
}
}
5 changes: 3 additions & 2 deletions Extension/.scripts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { filepath } from '../src/Utility/Filesystem/filepath';
import { is } from '../src/Utility/System/guards';
import { verbose } from '../src/Utility/Text/streams';
import { getTestInfo } from '../test/common/selectTests';
import { $args, $root, $scenario, assertAnyFile, assertAnyFolder, brightGreen, checkBinaries, cmdSwitch, cyan, error, gray, green, readJson, red, writeJson } from './common';
import { $args, $root, $scenario, $scenarioArgs, assertAnyFile, assertAnyFolder, brightGreen, checkBinaries, cmdSwitch, cyan, error, gray, green, readJson, red, writeJson } from './common';
import { install, isolated, options } from './vscode';

export { install, reset } from './vscode';
Expand Down Expand Up @@ -90,7 +90,8 @@ async function scenarioTests(assets: string, name: string, workspace: string) {
extensionTestsPath: resolve($root, 'dist/test/common/selectTests'),
launchArgs: workspace ? [...options.launchArgs, workspace] : options.launchArgs,
extensionTestsEnv: {
SCENARIO: assets
SCENARIO: assets,
SCENARIO_ARGS: $scenarioArgs.join(',')
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions Extension/.scripts/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const settings = resolve(userDir, "User", 'settings.json');

export const options = {
cachePath: `${isolated}/cache`,
launchArgs: ['--no-sandbox', '--disable-updates', '--skip-welcome', '--skip-release-notes', `--extensions-dir=${extensionsDir}`, `--user-data-dir=${userDir}`, '--disable-workspace-trust']
launchArgs: ['--no-sandbox', '--disable-updates', '--skip-welcome', '--skip-release-notes', '--disable-extensions', `--extensions-dir=${extensionsDir}`, `--user-data-dir=${userDir}`, '--disable-workspace-trust']
};

export async function install() {
Expand All @@ -34,9 +34,9 @@ export async function install() {
args.push(`--extensions-dir=${extensionsDir}`, `--user-data-dir=${userDir}`);

// install the appropriate extensions
// spawnSync(cli, [...args, '--install-extension', 'ms-vscode.cpptools'], { encoding: 'utf-8', stdio: 'ignore' });
// spawnSync(cli, [...args, '--install-extension', 'twxs.cmake'], { encoding: 'utf-8', stdio: 'ignore' });
// spawnSync(cli, [...args, '--install-extension', 'ms-vscode.cmake-tools'], { encoding: 'utf-8', stdio: 'ignore' });
// runVSCodeCommand([...args, '--install-extension', 'ms-vscode.cpptools'], options);
// runVSCodeCommand([...args, '--install-extension', 'twxs.cmake'], options);
// runVSCodeCommand([...args, '--install-extension', 'ms-vscode.cmake-tools'], options);
const settingsJson = await readJson(settings, {});
if (!settingsJson["workbench.colorTheme"]) {
settingsJson["workbench.colorTheme"] = "Tomorrow Night Blue";
Expand Down
2 changes: 2 additions & 0 deletions Extension/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.json-language-features",
"editor.tabSize": 4,
"editor.detectIndentation": true,
"files.insertFinalNewline": false
},
"[jsonc]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.json-language-features",
"editor.tabSize": 4,
"editor.detectIndentation": true,
"files.insertFinalNewline": true
},
"[typescript]": {
Expand Down
14 changes: 13 additions & 1 deletion Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# C/C++ for Visual Studio Code Changelog

## Version 1.33.3: July 6, 2026
### Enhancement
* Allow platform overrides in `cppbuild` tasks. [#11601](https://github.com/microsoft/vscode-cpptools/issues/11601)

### Bug Fixes
* Fix `[[no_unique_address]]` empty-base layout `sizeof` being computed too large. [#14524](https://github.com/microsoft/vscode-cpptools/issues/14524)
* Fix C/C++ debug data-tips on members of a dereferenced expression. [PR #14540](https://github.com/microsoft/vscode-cpptools/pull/14540)
* Thanks for the contribution. [@tieo](https://github.com/tieo)
* Fix `clang-format`/`clang-tidy` version check failing on Windows. [PR #14552](https://github.com/microsoft/vscode-cpptools/pull/14552)
* Fix Windows backslash paths being mangled when adding an SSH target. [PR #14554](https://github.com/microsoft/vscode-cpptools/pull/14554)
* Fix "directory_cache" crashes.
* Fix spurious IntelliSense error on `std::variant` brace-initialization.

## Version 1.33.2: June 26, 2026
### Bug Fixes
* Fix a regression with 'Find All References' with functions that exist in both C and C++ files. [#14546](https://github.com/microsoft/vscode-cpptools/issues/14546)
* Fix some regression crashes.

## Version 1.33.1: June 23, 2026
### Bug Fixes
Expand Down
Loading
Loading