Compare commits

...
9 Commits
Author SHA1 Message Date
Michelle Matias b33117997a Update cpptools-api to 4.0.1 in release branch for 0.28.3 (#5624) 2020-06-08 15:54:31 -07:00
Sean McManus 734ce74be2 Merge pull request #5593 from microsoft/seanmcm/0_28_2_release
0_28_2 release
2020-06-02 12:17:27 -07:00
Sean McManus 5262a75d87 Merge. 2020-06-01 15:56:51 -07:00
Sean McManus b7488e61b0 0_28_2 changelog (#5592)
* Update changelog for 0.28.2.
2020-06-01 15:55:09 -07:00
Sean McManus 5210e23479 Fix task bugs. (#5585)
Fixes https://github.com/microsoft/vscode-docs/issues/3724, https://github.com/microsoft/vscode-cpptools/issues/5561, https://github.com/microsoft/vscode-cpptools/issues/3295, https://github.com/microsoft/vscode-cpptools/issues/4761 .

Problems are:
1. The task source was incorrectly changed to "shell" (regression). Only the "type" registered task type needed to be shell: https://github.com/microsoft/vscode-docs/issues/3724 . 
2. Using Configure Default Build Task would create a task with "shell: " or "C/C++: " in the name, while F5 would not. The adding of the source to the name is caused by VS. I had added a bug report at https://github.com/microsoft/vscode/issues/98838, but I just closed it since we can work around the issue via always adding the source to the name.
3. Added the problemMatcher and group fields to the tasks created from F5 (and Build and Debug Active File): https://github.com/microsoft/vscode-cpptools/issues/3295 .
4. Change the cwd to be ${workspaceFolder} instead of "/usr/bin": https://github.com/microsoft/vscode-cpptools/issues/4761 . The reason we did this originally was because Cygwin would fail, but that can be worked around via either adding Cygwin's bin folder the path or changing the cwd for those cases (but most users won't want cwd to be the path to the compiler, and Cygwin usage is low compared to other scenarios).
2020-06-01 13:40:36 -07:00
Krishna Ersson 64ecdb78ad Join string arrays in env with the correct delimiter based on platform (#5510) 2020-05-29 15:16:01 -07:00
csigsandDevDiv Build Lab - Dev14 8c3e10cb5e Localization - Translated Strings (#5582)
Co-authored-by: DevDiv Build Lab - Dev14 <[email protected]>
2020-05-29 10:27:04 -07:00
csigsandDevDiv Build Lab - Dev14 2737f46885 Localization - Translated Strings (#5576)
Co-authored-by: DevDiv Build Lab - Dev14 <[email protected]>
2020-05-28 10:57:08 -07:00
Colen Garoutte-Carson dfca58c539 Handle quoted spaces when stripping args from compilerPath (#5513) 2020-05-21 12:09:24 -07:00
13 changed files with 102 additions and 33 deletions
+16
View File
@@ -1,5 +1,21 @@
# C/C++ for Visual Studio Code Change Log
## Version 0.28.3: June 9, 2020
### Enhancements
* Update version of vscode-cpptools API to 4.0.1 [PR #5624](https://github.com/microsoft/vscode-cpptools/pull/5624)
## Version 0.28.2: June 1, 2020
### Regression Bug Fixes
* Fix string arrays in `env` not being joined properly. [#5509](https://github.com/microsoft/vscode-cpptools/issues/5509)
* Krishna Ersson (@kersson) [PR #5510](https://github.com/microsoft/vscode-cpptools/pull/5510)
* Fix `shell` being used as the C/C++ build task source instead of `C/C++`. [vscode-docs#3724](https://github.com/microsoft/vscode-docs/issues/3724)
### Other Bug Fixes
* Fix `problemMatcher` not being added to C/C++ build tasks. [#3295](https://github.com/microsoft/vscode-cpptools/issues/3295)
* Fix `/usr/bin` being used as the default `cwd` (instead of `${workspaceFolder}`) for C/C++ build tasks. [#4761](https://github.com/microsoft/vscode-cpptools/issues/4761)
* Fix processing of quoted arguments with spaces in `compilerPath`. [PR #5513](https://github.com/microsoft/vscode-cpptools/pull/5513)
* Fix inconsistent task `label` and `preLaunchTask` being used for C/C++ build tasks. [#5561](https://github.com/microsoft/vscode-cpptools/issues/5561)
## Version 0.28.1: May 20, 2020
### Bug Fixes
* Fix errors not appearing after switching between a WSL and non-WSL config on Windows. [#5474](https://github.com/microsoft/vscode-cpptools/issues/5474)
+1 -1
View File
@@ -6,7 +6,7 @@
{
"architecture.not.supported": "体系结构 {0} 不受支持。",
"apline.containers.not.supported": "Alpine 容器不受支持。",
"native.binaries.not.supported": "扩展的此 {0} 版本与你的操作系统不兼容。请下载并安装扩展的“{1}”版本。",
"native.binaries.not.supported": "扩展的此 {0} 版本与你的 OS 不兼容。请下载并安装扩展的“{1}”版本。",
"download.button": "转到下载页",
"initialization.failed": "C/C++ 扩展安装失败。有关详细信息,请查看输出窗口。",
"updating.dependencies": "正在更新 C/C++ 依赖项...",
+1 -1
View File
@@ -6,7 +6,7 @@
{
"architecture.not.supported": "不支援架構 {0}。 ",
"apline.containers.not.supported": "不支援 Alpine 容器。",
"native.binaries.not.supported": "此 {0} 版本的延伸模組與您的 OS 不相容。請下載並安裝 \"{1}\" 版本的延伸模組。",
"native.binaries.not.supported": "此 {0} 版延伸模組與您的 OS 不相容。請下載並安裝 \"{1}\" 版本的延伸模組。",
"download.button": "前往 &#91;下載&#92; 頁面",
"initialization.failed": "C/C + + 延伸模組安裝失敗。如需詳細資訊,請查看 [輸出] 視窗。",
"updating.dependencies": "正在更新 C/C + + 相依性...",
+1 -1
View File
@@ -6,7 +6,7 @@
{
"architecture.not.supported": "Die Architektur \"{0}\" wird nicht unterstützt. ",
"apline.containers.not.supported": "Alpine-Container werden nicht unterstützt.",
"native.binaries.not.supported": "Diese Version ({0}) der Erweiterung ist nicht mit Ihrem Betriebssystem kompatibel. Laden Sie Version {1} der Erweiterung herunter, und installieren Sie sie.",
"native.binaries.not.supported": "Diese Version für {0} der Erweiterung ist nicht mit Ihrem Betriebssystem kompatibel. Laden Sie Version {1} der Erweiterung herunter, und installieren Sie sie.",
"download.button": "Gehe zu Downloadseite",
"initialization.failed": "Fehler bei der Installation der C/C++-Erweiterung. Weitere Informationen finden Sie im Ausgabefenster.",
"updating.dependencies": "C/C++-Abhängigkeiten werden aktualisiert...",
+1 -1
View File
@@ -6,7 +6,7 @@
{
"architecture.not.supported": "La arquitectura {0} no se admite. ",
"apline.containers.not.supported": "Los contenedores de Alpine no se admiten.",
"native.binaries.not.supported": "Esta versión {0} de la extensión no es compatible con el sistema operativo. Descargue la versión \"{1}\" de la extensión e instálela.",
"native.binaries.not.supported": "La versión para {0} de la extensión no es compatible con el sistema operativo. Descargue la versión \"{1}\" de la extensión e instálela.",
"download.button": "Ir a la página de descarga",
"initialization.failed": "No se pudo instalar la extensión de C/C++. Para obtener más información, consulte la ventana de salida.",
"updating.dependencies": "Actualizando las dependencias de C/C++...",
+1 -1
View File
@@ -6,7 +6,7 @@
{
"architecture.not.supported": "Архитектура {0} не поддерживается. ",
"apline.containers.not.supported": "Контейнеры Alpine не поддерживаются.",
"native.binaries.not.supported": "Версия расширения {0} не совместима с вашей ОС. Скачайте и установите версию расширения \"{1}\".",
"native.binaries.not.supported": "Версия расширения для {0} не совместима с вашей ОС. Скачайте и установите версию расширения \"{1}\".",
"download.button": "Перейти к странице скачивания",
"initialization.failed": "Не удалось установить расширение C/C++. Дополнительные сведения см. в окне вывода.",
"updating.dependencies": "Обновление зависимостей C/C++...",
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "0.28.1",
"version": "0.28.3",
"publisher": "ms-vscode",
"preview": true,
"icon": "LanguageCCPP_color_128x.png",
@@ -1563,7 +1563,7 @@
"ts-loader": "^6.0.4",
"tslint": "^5.19.0",
"typescript": "^3.5.3",
"vscode-cpptools": "^3.1.0",
"vscode-cpptools": "^4.0.1",
"vscode-debugadapter": "^1.35.0",
"vscode-debugprotocol": "^1.35.0",
"vscode-extension-telemetry": "^0.1.2",
@@ -105,7 +105,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
* Returns a list of initial debug configurations based on contextual information, e.g. package.json or folder.
*/
async provideDebugConfigurations(folder?: vscode.WorkspaceFolder, token?: vscode.CancellationToken): Promise<vscode.DebugConfiguration[]> {
let buildTasks: vscode.Task[] = await getBuildTasks(true);
let buildTasks: vscode.Task[] = await getBuildTasks(true, true);
if (buildTasks.length === 0) {
return Promise.resolve(this.provider.getInitialConfigurations(this.type));
}
@@ -119,11 +119,11 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
// Filter out build tasks that don't match the currently selected debug configuration type.
buildTasks = buildTasks.filter((task: vscode.Task) => {
if (defaultConfig.name.startsWith("(Windows) ")) {
if (task.name.startsWith("cl.exe")) {
if (task.name.startsWith("C/C++: cl.exe")) {
return true;
}
} else {
if (!task.name.startsWith("cl.exe")) {
if (!task.name.startsWith("C/C++: cl.exe")) {
return true;
}
}
@@ -531,9 +531,8 @@ export class CppProperties {
let result: string[] = [];
if (paths) {
paths = this.resolveDefaults(paths, defaultValue);
let delimiter: string = (process.platform === 'win32') ? ";" : ":";
paths.forEach(entry => {
let entries: string[] = util.resolveVariables(entry, env).split(delimiter).filter(e => e);
let entries: string[] = util.resolveVariables(entry, env).split(util.envDelimiter).filter(e => e);
result = result.concat(entries);
});
}
+9 -8
View File
@@ -47,7 +47,8 @@ let realActivationOccurred: boolean = false;
let tempCommands: vscode.Disposable[] = [];
let activatedPreviously: PersistentWorkspaceState<boolean>;
let buildInfoCache: BuildInfo | undefined;
const taskSourceStr: string = "shell";
const taskTypeStr: string = "shell";
const taskSourceStr: string = "C/C++";
const cppInstallVsixStr: string = 'C/C++: Install vsix -- ';
let taskProvider: vscode.Disposable;
let codeActionProvider: vscode.Disposable;
@@ -171,8 +172,8 @@ export function activate(activationEventOccurred: boolean): void {
return;
}
taskProvider = vscode.tasks.registerTaskProvider(taskSourceStr, {
provideTasks: () => getBuildTasks(false),
taskProvider = vscode.tasks.registerTaskProvider(taskTypeStr, {
provideTasks: () => getBuildTasks(false, false),
resolveTask(task: vscode.Task): vscode.Task | undefined {
// Currently cannot implement because VS Code does not call this. Can implement custom output file directory when enabled.
return undefined;
@@ -243,7 +244,7 @@ export interface BuildTaskDefinition extends vscode.TaskDefinition {
/**
* Generate tasks to build the current file based on the user's detected compilers, the user's compilerPath setting, and the current file's extension.
*/
export async function getBuildTasks(returnCompilerPath: boolean): Promise<vscode.Task[]> {
export async function getBuildTasks(returnCompilerPath: boolean, appendSourceToName: boolean): Promise<vscode.Task[]> {
const editor: vscode.TextEditor | undefined = vscode.window.activeTextEditor;
if (!editor) {
return [];
@@ -345,20 +346,20 @@ export async function getBuildTasks(returnCompilerPath: boolean): Promise<vscode
let createTask: (compilerPath: string, compilerArgs?: string []) => vscode.Task = (compilerPath: string, compilerArgs?: string []) => {
const filePath: string = path.join('${fileDirname}', '${fileBasenameNoExtension}');
const compilerPathBase: string = path.basename(compilerPath);
const taskName: string = compilerPathBase + " build active file";
const taskName: string = (appendSourceToName ? taskSourceStr + ": " : "") + compilerPathBase + " build active file";
const isCl: boolean = compilerPathBase === "cl.exe";
const cwd: string = isCl ? "" : path.dirname(compilerPath);
const cwd: string = "${workspaceFolder}";
let args: string[] = isCl ? ['/Zi', '/EHsc', '/Fe:', filePath + '.exe', '${file}'] : ['-g', '${file}', '-o', filePath + (isWindows ? '.exe' : '')];
if (compilerArgs && compilerArgs.length > 0) {
args = args.concat(compilerArgs);
}
let kind: vscode.TaskDefinition = {
type: 'shell',
type: taskTypeStr,
label: taskName,
command: isCl ? compilerPathBase : compilerPath,
args: args,
options: isCl ? undefined : {"cwd": cwd}
options: { "cwd": cwd }
};
if (returnCompilerPath) {
+60 -7
View File
@@ -31,6 +31,9 @@ export type Mutable<T> = {
-readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U> ? Mutable<U>[] : Mutable<T[P]>
};
// Platform-specific environment variable delimiter
export const envDelimiter: string = (process.platform === 'win32') ? ";" : ":";
export let extensionPath: string;
export let extensionContext: vscode.ExtensionContext | undefined;
export function setExtensionContext(context: vscode.ExtensionContext): void {
@@ -93,7 +96,7 @@ export async function ensureBuildTaskExists(taskName: string): Promise<void> {
return;
}
const buildTasks: vscode.Task[] = await getBuildTasks(false);
const buildTasks: vscode.Task[] = await getBuildTasks(false, true);
selectedTask = buildTasks.find(task => task.name === taskName);
console.assert(selectedTask);
if (!selectedTask) {
@@ -104,7 +107,12 @@ export async function ensureBuildTaskExists(taskName: string): Promise<void> {
let selectedTask2: vscode.Task = selectedTask;
if (!rawTasksJson.tasks.find((task: any) => task.label === selectedTask2.definition.label)) {
rawTasksJson.tasks.push(selectedTask2.definition);
let task: any = {
...selectedTask2.definition,
problemMatcher: selectedTask2.problemMatchers,
group: { kind: "build", "isDefault": true }
};
rawTasksJson.tasks.push(task);
}
// TODO: It's dangerous to overwrite this file. We could be wiping out comments.
@@ -355,7 +363,7 @@ export function resolveVariables(input: string | undefined, additionalEnvironmen
if (isString(v)) {
newValue = v;
} else if (input === match && isArrayOfString(v)) {
newValue = v.join(";");
newValue = v.join(envDelimiter);
}
if (newValue === undefined) {
newValue = process.env[name];
@@ -867,6 +875,53 @@ export interface CompilerPathAndArgs {
additionalArgs: string[];
}
function extractArgs(argsString: string): string[] {
let isWindows: boolean = os.platform() === 'win32';
let result: string[] = [];
let currentArg: string = "";
let isWithinDoubleQuote: boolean = false;
let isWithinSingleQuote: boolean = false;
for (let i: number = 0; i < argsString.length; i++) {
let c: string = argsString[i];
if (c === '\\') {
currentArg += c;
if (++i === argsString.length) {
if (currentArg !== "") {
result.push(currentArg);
}
return result;
}
currentArg += argsString[i];
continue;
}
if (c === '"') {
if (!isWithinSingleQuote) {
isWithinDoubleQuote = !isWithinDoubleQuote;
}
} else if (c === '\'') {
// On Windows, a single quote string is not allowed to join multiple args into a single arg
if (!isWindows) {
if (!isWithinDoubleQuote) {
isWithinSingleQuote = !isWithinSingleQuote;
}
}
} else if (c === ' ') {
if (!isWithinDoubleQuote && !isWithinSingleQuote) {
if (currentArg !== "") {
result.push(currentArg);
currentArg = "";
}
continue;
}
}
currentArg += c;
}
if (currentArg !== "") {
result.push(currentArg);
}
return result;
}
export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputCompilerArgs?: string[]): CompilerPathAndArgs {
let compilerPath: string | undefined = inputCompilerPath;
let compilerName: string = "";
@@ -881,8 +936,7 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp
// Input has quotes around compiler path
let endQuote: number = compilerPath.substr(1).search("\"") + 1;
if (endQuote !== -1) {
additionalArgs = compilerPath.substr(endQuote + 1).split(" ");
additionalArgs = additionalArgs.filter((arg: string) => arg.trim().length !== 0); // Remove empty args.
additionalArgs = extractArgs(compilerPath.substr(endQuote + 1));
compilerPath = compilerPath.substr(1, endQuote - 1);
compilerName = path.basename(compilerPath);
}
@@ -903,8 +957,7 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp
}
if (compilerPath !== potentialCompilerPath) {
// Found a valid compilerPath and args.
additionalArgs = compilerPath.substr(spaceStart + 1).split(" ");
additionalArgs = additionalArgs.filter((arg: string) => arg.trim().length !== 0); // Remove empty args.
additionalArgs = extractArgs(compilerPath.substr(spaceStart + 1));
compilerPath = potentialCompilerPath;
}
compilerName = path.basename(compilerPath);
+2 -2
View File
@@ -3,7 +3,7 @@
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import * as assert from "assert";
import { resolveVariables, escapeForSquiggles } from "../../src/common";
import { envDelimiter, resolveVariables, escapeForSquiggles } from "../../src/common";
suite("Common Utility validation", () => {
suite("resolveVariables", () => {
@@ -32,7 +32,7 @@ suite("Common Utility validation", () => {
inputAndEnvironment("${test}", {
test: ["foo", "bar"]
})
.shouldResolveTo("foo;bar");
.shouldResolveTo(`foo${envDelimiter}bar`);
});
test("solo env input with empty array env value", () => {
+4 -4
View File
@@ -5591,10 +5591,10 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
vscode-cpptools@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-3.1.0.tgz#fbc0e493e81a05baf01702ea8b9467c39fba257d"
integrity sha512-z4W/A1TQMEtqTEWNY3Hb4HJcJ2J3HeaLHp3TyqCotoRkLU8ovH4jmDb5tNTyh3DgIiaAAnDalO03A4wm5IvNBg==
vscode-cpptools@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-4.0.1.tgz#7e591572b437a6aca47b767487b52bc253e6d911"
integrity sha512-2IjtWe7rjIp20J+5m0Yjpa8TjGhdQWChwE49iYJBUUTHFqJDFq0aXNAyiDNw6BDWI1Q2Z/gmeQGsJBoxTb0J0Q==
vscode-debugadapter@^1.35.0:
version "1.38.0"