Compare commits

...
21 Commits
Author SHA1 Message Date
Sean McManus 25d74973b0 Update TPN for release. (#6622) 2020-12-03 17:44:20 -08:00
Sean McManus adf99597f6 Merge pull request #6620 from microsoft/seanmcm/cherryPick6619
cherry pick6619
2020-12-03 16:12:07 -08:00
Sean McManus 52fe7952d6 Update changelog. 2020-12-03 14:14:30 -08:00
Sean McManus aa4c5df4b7 Fix cwd. (#6619)
Fixes #6618
2020-12-03 14:11:07 -08:00
Sean McManus a3de2f9bee Merge pull request #6614 from microsoft/seanmcm/cherryPick6609
cherry pick 6609
2020-12-02 22:17:06 -08:00
Colen Garoutte-Carson 28f6dd66d2 Add field to activation telemetry for web-based Codespaces (#6609) 2020-12-02 22:15:07 -08:00
Colen Garoutte-Carson 89fd6a960c Remove telemetry for remoteName (#6537) 2020-12-02 22:10:26 -08:00
Sean McManus 8b06e7d04f Merge pull request #6607 from microsoft/seanmcm/1_1_3
Merge for 1.1.3 release
2020-12-01 20:53:46 -08:00
Sean McManus b1021432ec Update changelog and @types/vscode 2020-12-01 17:41:56 -08:00
Sean McManus 2cca514128 Fix infinite loop after cpptools crashes. (#6604)
* Fix infinite loop after cpptools crashes: https://github.com/microsoft/vscode-cpptools/issues/6603
2020-12-01 17:25:04 -08:00
Sean McManus 2e33027272 Fix cppbuild task warnings. (#6557)
* Fix cppbuild task warnings: https://github.com/microsoft/vscode-cpptools/issues/6556
2020-12-01 17:21:30 -08:00
Elaheh Rashedi 73a0b95df7 Add localization to strings in LanguageServer\cppBuildTaskProvider.ts (#6544)
* localizing for task provider

* localize single_file_mode_not_available

* remove end of line from localalized string

* modify error(s)

* remove space from localized string

* remove space from localized string
2020-12-01 17:20:56 -08:00
Sean McManus 39f32a3b45 Fix build task bugs. (#6539)
* Fix build task bugs.
* Use VS Code's variable resolution.
2020-12-01 17:20:42 -08:00
Sean McManus 16f352169c 1_1_2 release (#6532)
* Fix fileDirname. (#6482)
* Update changelog.
* Update the version.
2020-11-17 18:02:59 -08:00
Sean McManus adff6e66d5 Merge pull request #6481 from microsoft/seanmcm/1_1_1_release
1_1_1 release
2020-11-09 16:05:21 -08:00
Sean McManus 1877aed36a Merge. 2020-11-09 16:01:38 -08:00
Sean McManus 50c1efadd8 Fix version. (#6449) 2020-11-05 15:41:17 -08:00
Sean McManus 83df90082a Merge pull request #6448 from microsoft/seanmcm/1_1_0_release
1_1_0 release
2020-11-05 15:30:17 -08:00
Sean McManus b1d7d19ed7 Merge branch 'master' into seanmcm/1_1_0_release 2020-11-05 15:25:21 -08:00
Andrew Wang 80ea255a7c Merge branch 'master' into release 2020-10-06 13:05:19 -07:00
Bob Brown (DEVDIV) f3f151075b removing duplicate cleanup stage 2020-09-22 10:28:05 -07:00
11 changed files with 694 additions and 340 deletions
+13
View File
@@ -1,5 +1,18 @@
# C/C++ for Visual Studio Code Change Log
## Version 1.1.3: December 3, 2020
### Bug Fixes
* Disable the "join Insiders" prompt for Linux CodeSpaces. [#6491](https://github.com/microsoft/vscode-cpptools/issues/6491)
* Fix "shell" tasks giving error "Cannot read property `includes` of undefined". [#6538](https://github.com/microsoft/vscode-cpptools/issues/6538)
* Fix various task variables not getting resolved with `cppbuild` tasks. [#6538](https://github.com/microsoft/vscode-cpptools/issues/6538)
* Fix warnings not appearing with `cppbuild` tasks. [#6556](https://github.com/microsoft/vscode-cpptools/issues/6556)
* Fix endless CPU/memory usage if the cpptools process crashes. [#6603](https://github.com/microsoft/vscode-cpptools/issues/6603)
* Fix the default `cwd` for `cppbuild` tasks. [#6618](https://github.com/microsoft/vscode-cpptools/issues/6618)
## Version 1.1.2: November 17, 2020
### Bug Fix
* Fix resolution of `${fileDirname}` with `cppbuild` tasks. [#6386](https://github.com/microsoft/vscode-cpptools/issues/6386)
## Version 1.1.1: November 9, 2020
### Bug Fixes
* Fix cpptools binaries sometimes not getting installed on Windows. [#6453](https://github.com/microsoft/vscode-cpptools/issues/6453)
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.1.1-master",
"version": "1.1.3",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
@@ -2347,7 +2347,7 @@
"@types/plist": "^3.0.2",
"@types/semver": "^7.1.0",
"@types/tmp": "^0.1.0",
"@types/vscode": "1.44.0",
"@types/vscode": "1.49.0",
"@types/webpack": "^4.39.0",
"@types/which": "^1.3.2",
"@types/yauzl": "^2.9.1",
@@ -150,12 +150,16 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
}
// Filter out build tasks that don't match the currently selected debug configuration type.
buildTasks = buildTasks.filter((task: CppBuildTask) => {
const command: string = task.definition.command as string;
if (!command) {
return false;
}
if (defaultConfig.name.startsWith("(Windows) ")) {
if ((task.definition.command as string).includes("cl.exe")) {
if (command.includes("cl.exe")) {
return true;
}
} else {
if (!(task.definition.command as string).includes("cl.exe")) {
if (!command.includes("cl.exe")) {
return true;
}
}
@@ -174,10 +178,13 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
newConfig.preLaunchTask = task.name;
newConfig.externalConsole = false;
const exeName: string = path.join("${fileDirname}", "${fileBasenameNoExtension}");
newConfig.program = platform === "win32" ? exeName + ".exe" : exeName;
const isWindows: boolean = platform === 'win32';
newConfig.program = isWindows ? exeName + ".exe" : exeName;
// Add the "detail" property to show the compiler path in QuickPickItem.
// This property will be removed before writing the DebugConfiguration in launch.json.
newConfig.detail = task.detail ? task.detail : definition.command;
const isCl: boolean = compilerName === "cl.exe";
newConfig.cwd = isWindows && !isCl && !process.env.PATH?.includes(compilerPath) ? path.dirname(compilerPath) : "${workspaceFolder}";
return new Promise<vscode.DebugConfiguration>(resolve => {
if (platform === "darwin") {
@@ -197,7 +204,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
debuggerName = "gdb";
}
if (platform === "win32") {
if (isWindows) {
debuggerName += ".exe";
}
+1 -1
View File
@@ -50,7 +50,7 @@ export function initialize(context: vscode.ExtensionContext): void {
// Not enabled because we do not react to single-file mode correctly yet.
// We get an ENOENT when the user's c_cpp_properties.json is attempted to be parsed.
// The DefaultClient will also have its configuration accessed, but since it doesn't exist it errors out.
vscode.window.showErrorMessage('This command is not yet available for single-file mode.');
vscode.window.showErrorMessage(localize("single_file_mode_not_available", "This command is not available for single-file mode."));
return Promise.resolve();
}
@@ -91,7 +91,11 @@ export class ClientCollection {
}
public forEach(callback: (client: cpptools.Client) => void): void {
this.languageClients.forEach(callback);
// Copy this.languageClients to languageClients to avoid an infinite foreach loop
// when callback modifies this.languageClients (e.g. when cpptools crashes).
const languageClients: cpptools.Client[] = [];
this.languageClients.forEach(client => languageClients.push(client));
languageClients.forEach(callback);
}
public checkOwnership(client: cpptools.Client, document: vscode.TextDocument): boolean {
@@ -246,7 +246,9 @@ export class CppProperties {
}
private onConfigurationsChanged(): void {
this.configurationsChanged.fire(this.Configurations);
if (this.Configurations) {
this.configurationsChanged.fire(this.Configurations);
}
}
private onSelectionChanged(): void {
@@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */
import * as path from 'path';
import {
TaskDefinition, Task, TaskGroup, WorkspaceFolder, ShellExecution, Uri, workspace,
TaskDefinition, Task, TaskGroup, ShellExecution, Uri, workspace,
TaskProvider, TaskScope, CustomExecution, ProcessExecution, TextEditor, Pseudoterminal, EventEmitter, Event, TerminalDimensions, window
} from 'vscode';
import * as os from 'os';
@@ -15,6 +15,10 @@ import * as configs from './configurations';
import * as ext from './extension';
import * as cp from "child_process";
import { OtherSettings } from './settings';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export interface CppBuildTaskDefinition extends TaskDefinition {
type: string;
@@ -156,14 +160,14 @@ export class CppBuildTaskProvider implements TaskProvider {
if (!definition) {
const taskLabel: string = ((appendSourceToName && !compilerPathBase.startsWith(CppBuildTaskProvider.CppBuildSourceStr)) ?
CppBuildTaskProvider.CppBuildSourceStr + ": " : "") + compilerPathBase + " build active file";
CppBuildTaskProvider.CppBuildSourceStr + ": " : "") + compilerPathBase + " " + localize("build_active_file", "build active file");
const filePath: string = path.join('${fileDirname}', '${fileBasenameNoExtension}');
const isWindows: boolean = os.platform() === 'win32';
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);
}
const cwd: string = isCl ? "${workspaceFolder}" : path.dirname(compilerPath);
const cwd: string = isWindows && !isCl && !process.env.PATH?.includes(compilerPath) ? path.dirname(compilerPath) : "${workspaceFolder}";
const options: cp.ExecOptions | undefined = { cwd: cwd };
definition = {
type: CppBuildTaskProvider.CppBuildScriptType,
@@ -185,13 +189,13 @@ export class CppBuildTaskProvider implements TaskProvider {
const scope: TaskScope = TaskScope.Workspace;
const task: CppBuildTask = new Task(definition, scope, definition.label, CppBuildTaskProvider.CppBuildSourceStr,
new CustomExecution(async (): Promise<Pseudoterminal> =>
new CustomExecution(async (resolvedDefinition: TaskDefinition): Promise<Pseudoterminal> =>
// When the task is executed, this callback will run. Here, we setup for running the task.
new CustomBuildTaskTerminal(resolvedcompilerPath, definition ? definition.args : [], definition ? definition.options : undefined)
new CustomBuildTaskTerminal(resolvedcompilerPath, resolvedDefinition.args, resolvedDefinition.options)
), isCl ? '$msCompile' : '$gcc');
task.group = TaskGroup.Build;
task.detail = detail ? detail : "compiler: " + resolvedcompilerPath;
task.detail = detail ? detail : localize("compiler_details", "compiler:") + " " + resolvedcompilerPath;
return task;
};
@@ -200,6 +204,9 @@ export class CppBuildTaskProvider implements TaskProvider {
const rawJson: any = await this.getRawTasksJson();
const rawTasksJson: any = (!rawJson.tasks) ? new Array() : rawJson.tasks;
const buildTasksJson: CppBuildTask[] = rawTasksJson.map((task: any) => {
if (!task.label) {
return null;
}
const definition: CppBuildTaskDefinition = {
type: task.type,
label: task.label,
@@ -211,7 +218,7 @@ export class CppBuildTaskProvider implements TaskProvider {
cppBuildTask.detail = task.detail;
return cppBuildTask;
});
return buildTasksJson;
return buildTasksJson.filter((task: CppBuildTask) => task !== null);
}
public async ensureBuildTaskExists(taskLabel: string): Promise<void> {
@@ -252,7 +259,7 @@ export class CppBuildTaskProvider implements TaskProvider {
...selectedTask.definition,
problemMatcher: selectedTask.problemMatchers,
group: { kind: "build", "isDefault": true },
detail: "Generated task by Debugger"
detail: localize("task_generated_by_debugger", "Task generated by Debugger.")
};
rawTasksJson.tasks.push(newTask);
}
@@ -333,7 +340,7 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
async open(_initialDimensions: TerminalDimensions | undefined): Promise<void> {
telemetry.logLanguageServerEvent("cppBuildTaskStarted");
// At this point we can start using the terminal.
this.writeEmitter.fire(`Starting build...${this.endOfLine}`);
this.writeEmitter.fire(localize("starting_build", "Starting build...") + this.endOfLine);
await this.doBuild();
}
@@ -343,16 +350,16 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
private async doBuild(): Promise<any> {
// Do build.
let activeCommand: string = util.resolveVariables(this.command, this.AdditionalEnvironment);
let activeCommand: string = util.resolveVariables(this.command);
this.args.forEach(value => {
let temp: string = util.resolveVariables(value, this.AdditionalEnvironment);
let temp: string = util.resolveVariables(value);
if (temp && temp.includes(" ")) {
temp = "\"" + temp + "\"";
}
activeCommand = activeCommand + " " + temp;
});
if (this.options?.cwd) {
this.options.cwd = util.resolveVariables(this.options.cwd, this.AdditionalEnvironment);
this.options.cwd = util.resolveVariables(this.options.cwd);
}
const splitWriteEmitter = (lines: string | Buffer) => {
@@ -363,16 +370,34 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
try {
const result: number = await new Promise<number>((resolve, reject) => {
cp.exec(activeCommand, this.options, (_error, stdout, _stderr) => {
const dot: string = (stdout || _stderr) ? ":" : ".";
if (_error) {
telemetry.logLanguageServerEvent("cppBuildTaskError");
const dot: string = (stdout || _stderr) ? ":" : ".";
this.writeEmitter.fire(`Build finished with error${dot}${this.endOfLine}`);
splitWriteEmitter(stdout);
splitWriteEmitter(_stderr);
this.writeEmitter.fire(localize("build_finished_with_error", "Build finished with errors(s)") + dot + this.endOfLine);
if (stdout) {
splitWriteEmitter(stdout); // cl.exe
} else if (_stderr) {
splitWriteEmitter(_stderr); // gcc/clang
} else {
splitWriteEmitter(_error.message); // e.g. command executable not found
}
resolve(-1);
} else {
return;
} else if (_stderr && !stdout) { // gcc/clang
telemetry.logLanguageServerEvent("cppBuildTaskWarnings");
this.writeEmitter.fire(localize("build_finished_with_warnings", "Build finished with warning(s)") + dot + this.endOfLine);
splitWriteEmitter(_stderr);
resolve(0);
} else if (stdout && stdout.includes("warning C")) { // cl.exe
telemetry.logLanguageServerEvent("cppBuildTaskWarnings");
this.writeEmitter.fire(localize("build_finished_with_warnings", "Build finished with warning(s)") + dot + this.endOfLine);
splitWriteEmitter(stdout);
this.writeEmitter.fire(`Build finished successfully.${this.endOfLine}`);
resolve(0);
} else {
if (stdout) {
splitWriteEmitter(stdout); // cl.exe
}
this.writeEmitter.fire(localize("build finished successfully", "Build finished successfully.") + this.endOfLine);
resolve(0);
}
});
@@ -382,23 +407,4 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
this.closeEmitter.fire(-1);
}
}
private get AdditionalEnvironment(): { [key: string]: string | string[] } | undefined {
const editor: TextEditor | undefined = window.activeTextEditor;
if (!editor) {
return undefined;
}
const fileDir: WorkspaceFolder | undefined = workspace.getWorkspaceFolder(editor.document.uri);
if (!fileDir) {
window.showErrorMessage('This command is not yet available for single-file mode.');
return undefined;
}
const file: string = editor.document.fileName;
return {
"file": file,
"fileDirname": fileDir.uri.fsPath,
"fileBasenameNoExtension": path.parse(file).name,
"workspaceFolder": fileDir.uri.fsPath
};
}
}
+2 -2
View File
@@ -276,8 +276,8 @@ function sendActivationTelemetry(): void {
}
machineIdPersistentState.Value = vscode.env.machineId;
}
if (vscode.env.remoteName) {
activateEvent["remoteName"] = vscode.env.remoteName;
if (vscode.env.uiKind === vscode.UIKind.Web) {
activateEvent["WebUI"] = "1";
}
telemetry.logLanguageServerEvent("Activate", activateEvent);
}
@@ -13,8 +13,8 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export class ReferencesTreeDataProvider implements vscode.TreeDataProvider<TreeNode> {
private referencesModel: ReferencesModel | undefined;
private readonly _onDidChangeTreeData = new vscode.EventEmitter<TreeNode>();
readonly onDidChangeTreeData: vscode.Event<TreeNode>;
private readonly _onDidChangeTreeData = new vscode.EventEmitter<void>();
readonly onDidChangeTreeData: vscode.Event<void>;
constructor() {
this.onDidChangeTreeData = this._onDidChangeTreeData.event;
+4 -4
View File
@@ -204,10 +204,10 @@
dependencies:
source-map "^0.6.1"
"@types/[email protected]4.0":
version "1.44.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.44.0.tgz#62ecfe3d0e38942fce556574da54ee1013c775b7"
integrity sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==
"@types/[email protected]9.0":
version "1.49.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.49.0.tgz#f3731d97d7e8b2697510eb26f6e6d04ee8c17352"
integrity sha512-wfNQmLmm1VdMBr6iuNdprWmC1YdrgZ9dQzadv+l2eSjJlElOdJw8OTm4RU4oGTBcfvG6RZI2jOcppkdSS18mZw==
"@types/webpack-sources@*":
version "0.1.6"