Compare commits
92
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08776b77f7 | ||
|
|
b34766054b | ||
|
|
8914e28c26 | ||
|
|
2a39dc402a | ||
|
|
b55a98c697 | ||
|
|
08b9c995bd | ||
|
|
6da34e4236 | ||
|
|
e172440607 | ||
|
|
2a5198ed9d | ||
|
|
3d7f5ea0ca | ||
|
|
3abe8a564b | ||
|
|
4fc18a7eb4 | ||
|
|
c3dd4405a6 | ||
|
|
32ba555dee | ||
|
|
f31caa30f4 | ||
|
|
fab35332eb | ||
|
|
8bea1ecb35 | ||
|
|
caecbf9532 | ||
|
|
c3312d3fba | ||
|
|
7886ac0e98 | ||
|
|
8eea7fb23e | ||
|
|
ec511b941d | ||
|
|
17140a9fde | ||
|
|
b30c098dc1 | ||
|
|
e135b011bc | ||
|
|
2913721755 | ||
|
|
7a83d8d76a | ||
|
|
db67ca332c | ||
|
|
69cf11512a | ||
|
|
011b5c12a9 | ||
|
|
b5c13664a6 | ||
|
|
f95b1cebf7 | ||
|
|
4813194480 | ||
|
|
97fd5b6bb9 | ||
|
|
75d131d3ea | ||
|
|
abc3c11cab | ||
|
|
88f0bbebb9 | ||
|
|
7b175d4ab4 | ||
|
|
29e8ff6f3b | ||
|
|
d0985f5c82 | ||
|
|
7f996068d4 | ||
|
|
27d1ac3897 | ||
|
|
999f28bf83 | ||
|
|
f7d0b1bf22 | ||
|
|
eede66558e | ||
|
|
a9890f62ae | ||
|
|
c98303bd2c | ||
|
|
c658673abb | ||
|
|
7ad30dae85 | ||
|
|
2ab63a451a | ||
|
|
857bce91ee | ||
|
|
49b8160a58 | ||
|
|
4d80ef39cb | ||
|
|
8ea76a7d8b | ||
|
|
046821112b | ||
|
|
18ac98a353 | ||
|
|
fad828ed78 | ||
|
|
f675d7ece3 | ||
|
|
213799975c | ||
|
|
3512a088d6 | ||
|
|
8ec3dfa3fd | ||
|
|
905f8dc216 | ||
|
|
6464f55fcf | ||
|
|
dba4a28d88 | ||
|
|
53a3864fdc | ||
|
|
0ea25159d4 | ||
|
|
143207aadb | ||
|
|
0edf6c3ea7 | ||
|
|
4e22b6577f | ||
|
|
1ab60bc247 | ||
|
|
33eb2f6abe | ||
|
|
11262438e3 | ||
|
|
673a68d4cc | ||
|
|
437d9b333a | ||
|
|
0139274856 | ||
|
|
87cfa702bc | ||
|
|
013bff267e | ||
|
|
d942d64b7b | ||
|
|
1a2bf6fc4c | ||
|
|
32c1d6bf52 | ||
|
|
ebd5314b48 | ||
|
|
5c7f551dba | ||
|
|
6ccea3878b | ||
|
|
e5fd036af9 | ||
|
|
4254419e76 | ||
|
|
f9ecc9c6f9 | ||
|
|
9405f41521 | ||
|
|
37cca41225 | ||
|
|
ed584b23e2 | ||
|
|
f7cab674a4 | ||
|
|
42586081fa | ||
|
|
c49e51d386 |
@@ -1,6 +1,6 @@
|
||||
# C/C++ for Visual Studio Code Change Log
|
||||
|
||||
## Version 1.11.1 (pre-release): June 29, 2022
|
||||
## Version 1.11.1 (pre-release): July 7, 2022
|
||||
### Enhancements
|
||||
* Move "auto" inlay hints to the right by default and add `C_Cpp.inlayHints.autoDeclarationTypes.showOnLeft`. [#9478](https://github.com/microsoft/vscode-cpptools/issues/9478)
|
||||
* Allow breakpoints for Rust debugging. [PR #9484](https://github.com/microsoft/vscode-cpptools/pull/9484)
|
||||
@@ -10,12 +10,16 @@
|
||||
|
||||
### Bug Fixes
|
||||
* Fix "unknown register name" IntelliSense error. [#4382](https://github.com/microsoft/vscode-cpptools/issues/4382)
|
||||
* Fix performance issue with tag parsing a file with a lot of defines. [#6454](https://github.com/microsoft/vscode-cpptools/issues/6454)
|
||||
* Fix missing logging when `C_Cpp.intelliSenseEngine` is set to `"Disabled"`. [#9277](https://github.com/microsoft/vscode-cpptools/issues/9277)
|
||||
* Fix the code analysis "disable" option not automatically clearing the disabled diagnostics. [#9364](https://github.com/microsoft/vscode-cpptools/issues/9364)
|
||||
* Fix `-isystem` not being used for system headers with code analysis. [#9366](https://github.com/microsoft/vscode-cpptools/issues/9366)
|
||||
* Fix compiler querying for EDG-based compilers. [#9410](https://github.com/microsoft/vscode-cpptools/issues/9410)
|
||||
* Fix bug with the environment being incorrect when compiler querying. [#9472](https://github.com/microsoft/vscode-cpptools/issues/9472)
|
||||
* Fix inlay hints not having padding on the left if there is no existing space. [#9479](https://github.com/microsoft/vscode-cpptools/issues/9479)
|
||||
* Fix duplicate inlay hints appearing sometimes. [#9487](https://github.com/microsoft/vscode-cpptools/issues/9487)
|
||||
* Fix duplicate compiler args in compiler query with custom configuration providers using cpptools-api prior to v6. [#9531](https://github.com/microsoft/vscode-cpptools/issues/9531)
|
||||
* Fix cl.exe build tasks not showing for .c files and .c build tasks being cached for .cpp files (and vice versa). [PR #9544](https://github.com/microsoft/vscode-cpptools/pull/9544)
|
||||
* Fix process launching concurrency issues on Windows.
|
||||
|
||||
## Version 1.11.0 (pre-release): June 20, 2022
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
"windows.sdk.version": "Wersja zestawu Windows SDK",
|
||||
"windows.sdk.version.description": "Wersja ścieżki dyrektywy include zestawu Windows SDK, która ma być używana w systemie Windows, np. {0}.",
|
||||
"mac.framework.path": "Ścieżka do platformy Mac",
|
||||
"mac.framework.path.description": "Lista ścieżek do użycia przez aparat IntelliSense podczas wyszukiwania dołączonych nagłówków z platform Mac. Obsługiwane tylko w przypadku konfiguracji dla systemu MacOS.",
|
||||
"mac.framework.path.description": "Lista ścieżek do użycia przez aparat IntelliSense podczas wyszukiwania dołączonych nagłówków z platform Mac. Obsługiwane tylko w przypadku konfiguracji dla systemu macOS.",
|
||||
"one.path.per.line": "Jedna ścieżka na wiersz.",
|
||||
"forced.include": "Wymuszone dołączanie",
|
||||
"forced.include.description": "Lista plików, które powinny zostać uwzględnione przed przetworzeniem każdego innego znaku w pliku źródłowym. Pliki są uwzględniane w podanej kolejności.",
|
||||
|
||||
@@ -38,6 +38,8 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
|
||||
private assetProvider: IConfigurationAssetProvider;
|
||||
// Keep a list of tasks detected by cppBuildTaskProvider.
|
||||
private static detectedBuildTasks: CppBuildTask[] = [];
|
||||
private static detectedCppBuildTasks: CppBuildTask[] = [];
|
||||
private static detectedCBuildTasks: CppBuildTask[] = [];
|
||||
protected static recentBuildTaskLabel: string;
|
||||
|
||||
public constructor(assetProvider: IConfigurationAssetProvider, type: DebuggerType) {
|
||||
@@ -449,8 +451,44 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
|
||||
}
|
||||
|
||||
private async loadDetectedTasks(): Promise<void> {
|
||||
if (!DebugConfigurationProvider.detectedBuildTasks || DebugConfigurationProvider.detectedBuildTasks.length === 0) {
|
||||
DebugConfigurationProvider.detectedBuildTasks = await cppBuildTaskProvider.getTasks(true);
|
||||
const editor: vscode.TextEditor | undefined = vscode.window.activeTextEditor;
|
||||
const emptyTasks: CppBuildTask[] = [];
|
||||
if (!editor) {
|
||||
DebugConfigurationProvider.detectedBuildTasks = emptyTasks;
|
||||
return;
|
||||
}
|
||||
|
||||
const fileExt: string = path.extname(editor.document.fileName);
|
||||
if (!fileExt) {
|
||||
DebugConfigurationProvider.detectedBuildTasks = emptyTasks;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't offer tasks for header files.
|
||||
const isHeader: boolean = util.isHeaderFile (editor.document.uri);
|
||||
if (isHeader) {
|
||||
DebugConfigurationProvider.detectedBuildTasks = emptyTasks;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't offer tasks if the active file's extension is not a recognized C/C++ extension.
|
||||
const fileIsCpp: boolean = util.isCppFile(editor.document.uri);
|
||||
const fileIsC: boolean = util.isCFile(editor.document.uri);
|
||||
if (!(fileIsCpp || fileIsC)) {
|
||||
DebugConfigurationProvider.detectedBuildTasks = emptyTasks;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileIsCpp) {
|
||||
if (!DebugConfigurationProvider.detectedCppBuildTasks || DebugConfigurationProvider.detectedCppBuildTasks.length === 0) {
|
||||
DebugConfigurationProvider.detectedCppBuildTasks = await cppBuildTaskProvider.getTasks(true);
|
||||
}
|
||||
DebugConfigurationProvider.detectedBuildTasks = DebugConfigurationProvider.detectedCppBuildTasks;
|
||||
} else {
|
||||
if (!DebugConfigurationProvider.detectedCBuildTasks || DebugConfigurationProvider.detectedCBuildTasks.length === 0) {
|
||||
DebugConfigurationProvider.detectedCBuildTasks = await cppBuildTaskProvider.getTasks(true);
|
||||
}
|
||||
DebugConfigurationProvider.detectedBuildTasks = DebugConfigurationProvider.detectedCBuildTasks;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
import * as vscode from 'vscode';
|
||||
import { Position, Range, RequestType, TextEdit } from 'vscode-languageclient';
|
||||
import * as util from '../../common';
|
||||
import { DefaultClient } from '../client';
|
||||
import { CodeActionCodeInfo, CodeActionDiagnosticInfo, codeAnalysisFileToCodeActions, codeAnalysisCodeToFixes,
|
||||
codeAnalysisAllFixes } from '../codeAnalysis';
|
||||
import { makeVscodeRange } from '../utils';
|
||||
import { CppSettings } from '../settings';
|
||||
|
||||
type LocalizeStringParams = util.LocalizeStringParams;
|
||||
import { getLocalizedString, LocalizeStringParams } from '../localization';
|
||||
|
||||
interface GetCodeActionsRequestParams {
|
||||
uri: string;
|
||||
@@ -63,7 +61,7 @@ export class CodeActionProvider implements vscode.CodeActionProvider {
|
||||
|
||||
// Convert to vscode.CodeAction array
|
||||
commands.forEach((command) => {
|
||||
const title: string = util.getLocalizedString(command.localizeStringParams);
|
||||
const title: string = getLocalizedString(command.localizeStringParams);
|
||||
let wsEdit: vscode.WorkspaceEdit | undefined;
|
||||
let codeActionKind: vscode.CodeActionKind = vscode.CodeActionKind.QuickFix;
|
||||
if (command.edit) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
import * as vscode from 'vscode';
|
||||
import { DefaultClient, LocalizeDocumentSymbol, GetDocumentSymbolRequestParams, GetDocumentSymbolRequest, SymbolScope } from '../client';
|
||||
import * as util from '../../common';
|
||||
import { processDelayedDidOpen } from '../extension';
|
||||
import { makeVscodeRange } from '../utils';
|
||||
import { getLocalizedString, getLocalizedSymbolScope } from '../localization';
|
||||
|
||||
export class DocumentSymbolProvider implements vscode.DocumentSymbolProvider {
|
||||
private client: DefaultClient;
|
||||
@@ -17,18 +17,18 @@ export class DocumentSymbolProvider implements vscode.DocumentSymbolProvider {
|
||||
const documentSymbols: vscode.DocumentSymbol[] = [];
|
||||
if (symbols) {
|
||||
symbols.forEach((symbol) => {
|
||||
let detail: string = util.getLocalizedString(symbol.detail);
|
||||
let detail: string = getLocalizedString(symbol.detail);
|
||||
if (symbol.scope === SymbolScope.Private) {
|
||||
if (detail.length === 0) {
|
||||
detail = "private";
|
||||
} else {
|
||||
detail = util.getLocalizedSymbolScope("private", detail);
|
||||
detail = getLocalizedSymbolScope("private", detail);
|
||||
}
|
||||
} else if (symbol.scope === SymbolScope.Protected) {
|
||||
if (detail.length === 0) {
|
||||
detail = "protected";
|
||||
} else {
|
||||
detail = util.getLocalizedSymbolScope("protected", detail);
|
||||
detail = getLocalizedSymbolScope("protected", detail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { DefaultClient, GetSymbolInfoRequest, WorkspaceSymbolParams, LocalizeSymbolInformation, SymbolScope } from '../client';
|
||||
import { makeVscodeLocation } from '../utils';
|
||||
import * as util from '../../common';
|
||||
import { getLocalizedString, getLocalizedSymbolScope } from '../localization';
|
||||
|
||||
export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
|
||||
private client: DefaultClient;
|
||||
@@ -23,13 +23,13 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
|
||||
|
||||
// Convert to vscode.Command array
|
||||
symbols.forEach((symbol) => {
|
||||
let suffix: string = util.getLocalizedString(symbol.suffix);
|
||||
let suffix: string = getLocalizedString(symbol.suffix);
|
||||
let name: string = symbol.name;
|
||||
if (suffix.length) {
|
||||
if (symbol.scope === SymbolScope.Private) {
|
||||
suffix = util.getLocalizedSymbolScope("private", suffix);
|
||||
suffix = getLocalizedSymbolScope("private", suffix);
|
||||
} else if (symbol.scope === SymbolScope.Protected) {
|
||||
suffix = util.getLocalizedSymbolScope("protected", suffix);
|
||||
suffix = getLocalizedSymbolScope("protected", suffix);
|
||||
}
|
||||
name = name + ' (' + suffix + ')';
|
||||
} else {
|
||||
|
||||
@@ -24,7 +24,7 @@ import { InlayHintsProvider } from './Providers/inlayHintProvider';
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, NotificationType, TextDocumentIdentifier, RequestType, ErrorAction, CloseAction, DidOpenTextDocumentParams, Range, Position, DocumentFilter } from 'vscode-languageclient';
|
||||
import { SourceFileConfigurationItem, WorkspaceBrowseConfiguration, SourceFileConfiguration, Version } from 'vscode-cpptools';
|
||||
import { Status, IntelliSenseStatus } from 'vscode-cpptools/out/testApi';
|
||||
import { getLocalizedString, LocalizeStringParams } from './localization';
|
||||
import { getLocaleId, getLocalizedString, LocalizeStringParams } from './localization';
|
||||
import { Location, TextEdit } from './commonTypes';
|
||||
import { makeVscodeRange, makeVscodeLocation } from './utils';
|
||||
import * as util from '../common';
|
||||
@@ -37,7 +37,6 @@ import { ClientCollection } from './clientCollection';
|
||||
import { createProtocolFilter } from './protocolFilter';
|
||||
import { DataBinding } from './dataBinding';
|
||||
import minimatch = require("minimatch");
|
||||
import * as logger from '../logger';
|
||||
import { updateLanguageConfigurations, CppSourceStr } from './extension';
|
||||
import { SettingsTracker, getTracker } from './settingsTracker';
|
||||
import { getTestHook, TestHook } from '../testHook';
|
||||
@@ -49,6 +48,7 @@ import * as nls from 'vscode-nls';
|
||||
import { lookupString, localizedStringCount } from '../nativeStrings';
|
||||
import { CodeAnalysisDiagnosticIdentifiersAndUri, RegisterCodeAnalysisNotifications, removeAllCodeAnalysisProblems,
|
||||
removeCodeAnalysisProblems, RemoveCodeAnalysisProblemsParams } from './codeAnalysis';
|
||||
import { DebugProtocolParams, getDiagnosticsChannel, getOutputChannelLogger, logDebugProtocol, Logger, logLocalized, showWarning, ShowWarningParams } from '../logger';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
@@ -64,10 +64,6 @@ const languageClientCrashTimes: number[] = [];
|
||||
let clientCollection: ClientCollection;
|
||||
let pendingTask: util.BlockingTask<any> | undefined;
|
||||
let compilerDefaults: configs.CompilerDefaults;
|
||||
let diagnosticsChannel: vscode.OutputChannel;
|
||||
let outputChannel: vscode.OutputChannel;
|
||||
let debugChannel: vscode.OutputChannel;
|
||||
let warningChannel: vscode.OutputChannel;
|
||||
let diagnosticsCollectionIntelliSense: vscode.DiagnosticCollection;
|
||||
|
||||
let workspaceDisposables: vscode.Disposable[] = [];
|
||||
@@ -91,32 +87,10 @@ function logTelemetry(notificationBody: TelemetryPayload): void {
|
||||
function setupOutputHandlers(): void {
|
||||
console.assert(languageClient !== undefined, "This method must not be called until this.languageClient is set in \"onReady\"");
|
||||
|
||||
languageClient.onNotification(DebugProtocolNotification, (output) => {
|
||||
if (!debugChannel) {
|
||||
debugChannel = vscode.window.createOutputChannel(`${localize("c.cpp.debug.protocol", "C/C++ Debug Protocol")}`);
|
||||
workspaceDisposables.push(debugChannel);
|
||||
}
|
||||
debugChannel.appendLine("");
|
||||
debugChannel.appendLine("************************************************************************************************************************");
|
||||
debugChannel.append(`${output}`);
|
||||
});
|
||||
|
||||
languageClient.onNotification(DebugProtocolNotification, logDebugProtocol);
|
||||
languageClient.onNotification(DebugLogNotification, logLocalized);
|
||||
}
|
||||
|
||||
function log(output: string): void {
|
||||
if (!outputChannel) {
|
||||
outputChannel = logger.getOutputChannel();
|
||||
workspaceDisposables.push(outputChannel);
|
||||
}
|
||||
outputChannel.appendLine(`${output}`);
|
||||
}
|
||||
|
||||
function logLocalized(params: LocalizeStringParams): void {
|
||||
const output: string = getLocalizedString(params);
|
||||
log(output);
|
||||
}
|
||||
|
||||
/** Note: We should not await on the following functions,
|
||||
* or any funstion that returns a promise acquired from them,
|
||||
* vscode.window.showInformationMessage, vscode.window.showWarningMessage, vscode.window.showErrorMessage
|
||||
@@ -139,21 +113,6 @@ function showMessageWindow(params: ShowMessageWindowParams): void {
|
||||
}
|
||||
}
|
||||
|
||||
function showWarning(params: ShowWarningParams): void {
|
||||
const message: string = getLocalizedString(params.localizeStringParams);
|
||||
let showChannel: boolean = false;
|
||||
if (!warningChannel) {
|
||||
warningChannel = vscode.window.createOutputChannel(`${localize("c.cpp.warnings", "C/C++ Configuration Warnings")}`);
|
||||
workspaceDisposables.push(warningChannel);
|
||||
showChannel = true;
|
||||
}
|
||||
// Append before showing the channel, to avoid a delay.
|
||||
warningChannel.appendLine(`[${new Date().toLocaleString()}] ${message}`);
|
||||
if (showChannel) {
|
||||
warningChannel.show(true);
|
||||
}
|
||||
}
|
||||
|
||||
function publishIntelliSenseDiagnostics(params: PublishIntelliSenseDiagnosticsParams): void {
|
||||
if (!diagnosticsCollectionIntelliSense) {
|
||||
diagnosticsCollectionIntelliSense = vscode.languages.createDiagnosticCollection(CppSourceStr);
|
||||
@@ -192,12 +151,6 @@ interface TelemetryPayload {
|
||||
metrics?: { [key: string]: number };
|
||||
}
|
||||
|
||||
interface DebugProtocolParams {
|
||||
jsonrpc: string;
|
||||
method: string;
|
||||
params?: any;
|
||||
}
|
||||
|
||||
interface ReportStatusNotificationBody extends WorkspaceFolderParams {
|
||||
status: string;
|
||||
}
|
||||
@@ -301,10 +254,6 @@ interface ShowMessageWindowParams {
|
||||
localizeStringParams: LocalizeStringParams;
|
||||
}
|
||||
|
||||
interface ShowWarningParams {
|
||||
localizeStringParams: LocalizeStringParams;
|
||||
}
|
||||
|
||||
export interface GetDocumentSymbolRequestParams {
|
||||
uri: string;
|
||||
}
|
||||
@@ -1378,7 +1327,7 @@ export class DefaultClient implements Client {
|
||||
},
|
||||
vcpkg_root: util.getVcpkgRoot(),
|
||||
experimentalFeatures: workspaceSettings.experimentalFeatures,
|
||||
edgeMessagesDirectory: path.join(util.getExtensionFilePath("bin"), "messages", util.getLocaleId()),
|
||||
edgeMessagesDirectory: path.join(util.getExtensionFilePath("bin"), "messages", getLocaleId()),
|
||||
localizedStrings: localizedStrings,
|
||||
packageVersion: util.packageJson.version,
|
||||
legacyCompilerArgsBehavior: settings_legacyCompilerArgsBehavior
|
||||
@@ -1518,7 +1467,7 @@ export class DefaultClient implements Client {
|
||||
this.loggingLevel = newLoggingLevel;
|
||||
const newLoggingLevelLogged: boolean = !!newLoggingLevel && newLoggingLevel !== "None" && newLoggingLevel !== "Error";
|
||||
if (oldLoggingLevelLogged || newLoggingLevelLogged) {
|
||||
const out: logger.Logger = logger.getOutputChannelLogger();
|
||||
const out: Logger = getOutputChannelLogger();
|
||||
out.appendLine(localize({ key: "loggingLevel.changed", comment: ["{0} is the setting name 'loggingLevel', {1} is a string value such as 'Debug'"] }, "{0} has changed to: {1}", "loggingLevel", changedSettings["loggingLevel"]));
|
||||
}
|
||||
}
|
||||
@@ -1810,12 +1759,8 @@ export class DefaultClient implements Client {
|
||||
|
||||
public async logDiagnostics(): Promise<void> {
|
||||
const response: GetDiagnosticsResult = await this.requestWhenReady(() => this.languageClient.sendRequest(GetDiagnosticsRequest, null));
|
||||
if (!diagnosticsChannel) {
|
||||
diagnosticsChannel = vscode.window.createOutputChannel(localize("c.cpp.diagnostics", "C/C++ Diagnostics"));
|
||||
workspaceDisposables.push(diagnosticsChannel);
|
||||
} else {
|
||||
diagnosticsChannel.clear();
|
||||
}
|
||||
const diagnosticsChannel: vscode.OutputChannel = getDiagnosticsChannel();
|
||||
diagnosticsChannel.clear();
|
||||
|
||||
const header: string = `-------- Diagnostics - ${new Date().toLocaleString()}\n`;
|
||||
const version: string = `Version: ${util.packageJson.version}\n`;
|
||||
@@ -2352,7 +2297,7 @@ export class DefaultClient implements Client {
|
||||
} else if (message.endsWith("IntelliSense done")) {
|
||||
const settings: CppSettings = new CppSettings();
|
||||
if (settings.loggingLevel === "Debug") {
|
||||
const out: logger.Logger = logger.getOutputChannelLogger();
|
||||
const out: Logger = getOutputChannelLogger();
|
||||
const duration: number = Date.now() - timeStamp;
|
||||
out.appendLine(localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", duration / 1000));
|
||||
}
|
||||
@@ -2425,7 +2370,7 @@ export class DefaultClient implements Client {
|
||||
}
|
||||
|
||||
private updateTagParseStatus(notificationBody: LocalizeStringParams): void {
|
||||
this.model.parsingWorkspaceStatus.Value = util.getLocalizedString(notificationBody);
|
||||
this.model.parsingWorkspaceStatus.Value = getLocalizedString(notificationBody);
|
||||
if (notificationBody.text.startsWith("Workspace parsing paused")) {
|
||||
this.model.isParsingWorkspacePausable.Value = true;
|
||||
this.model.isParsingWorkspacePaused.Value = true;
|
||||
@@ -2768,7 +2713,7 @@ export class DefaultClient implements Client {
|
||||
}
|
||||
|
||||
const settings: CppSettings = new CppSettings();
|
||||
const out: logger.Logger = logger.getOutputChannelLogger();
|
||||
const out: Logger = getOutputChannelLogger();
|
||||
if (settings.loggingLevel === "Debug") {
|
||||
out.appendLine(localize("configurations.received", "Custom configurations received:"));
|
||||
}
|
||||
@@ -2872,7 +2817,7 @@ export class DefaultClient implements Client {
|
||||
|
||||
const settings: CppSettings = new CppSettings();
|
||||
if (settings.loggingLevel === "Debug") {
|
||||
const out: logger.Logger = logger.getOutputChannelLogger();
|
||||
const out: Logger = getOutputChannelLogger();
|
||||
out.appendLine(localize("browse.configuration.received", "Custom browse configuration received: {0}", JSON.stringify(sanitized, null, 2)));
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,6 @@ export class ClientCollection {
|
||||
// this.defaultClient is already in this.languageClients, so do not call dispose() on it.
|
||||
this.languageClients.forEach(client => client.dispose());
|
||||
this.languageClients.clear();
|
||||
cpptools.disposeWorkspaceData();
|
||||
return cpptools.DefaultClient.stopLanguageClient();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,10 +122,19 @@ export class CppBuildTaskProvider implements TaskProvider {
|
||||
const knownCompilerPathsSet: Set<string> = new Set();
|
||||
let knownCompilers: configs.KnownCompiler[] | undefined = await activeClient.getKnownCompilers();
|
||||
if (knownCompilers) {
|
||||
const compiler_condition: (info: configs.KnownCompiler) => boolean = info => ((fileIsCpp && !info.isC) || (fileIsC && info.isC)) &&
|
||||
(!isCompilerValid || (!!userCompilerPathAndArgs &&
|
||||
(path.basename(info.path) !== userCompilerPathAndArgs.compilerName))) &&
|
||||
(!isWindows || !info.path.startsWith("/")); // TODO: Add WSL compiler support.
|
||||
const compiler_condition: (info: configs.KnownCompiler) => boolean = info =>
|
||||
(
|
||||
// Filter out c compilers for cpp files and vice versa, except for cl.exe, which handles both.
|
||||
path.basename(info.path) === "cl.exe" ||
|
||||
(fileIsCpp && !info.isC) || (fileIsC && info.isC)
|
||||
) &&
|
||||
(
|
||||
!isCompilerValid || (!!userCompilerPathAndArgs &&
|
||||
(path.basename(info.path) !== userCompilerPathAndArgs.compilerName))
|
||||
) &&
|
||||
(
|
||||
!isWindows || !info.path.startsWith("/")
|
||||
); // TODO: Add WSL compiler support.
|
||||
const cl_to_add: configs.KnownCompiler | undefined = userCompilerIsCl ? undefined : knownCompilers.find(info =>
|
||||
((path.basename(info.path) === "cl.exe") && compiler_condition(info)));
|
||||
knownCompilers = knownCompilers.filter(info =>
|
||||
|
||||
@@ -4,7 +4,14 @@
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { getExtensionFilePath } from '../common';
|
||||
import { lookupString } from '../nativeStrings';
|
||||
import * as nls from 'vscode-nls';
|
||||
import path = require('path');
|
||||
import * as fs from 'fs';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
|
||||
export interface LocalizeStringParams {
|
||||
text: string;
|
||||
@@ -24,3 +31,45 @@ export function getLocalizedString(params: LocalizeStringParams): string {
|
||||
}
|
||||
return indent + text;
|
||||
}
|
||||
|
||||
interface VSCodeNlsConfig {
|
||||
locale: string;
|
||||
availableLanguages: {
|
||||
[pack: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function getLocaleId(): string {
|
||||
// This replicates the language detection used by initializeSettings() in vscode-nls
|
||||
if (typeof process.env.VSCODE_NLS_CONFIG === 'string') {
|
||||
const vscodeOptions: VSCodeNlsConfig = JSON.parse(process.env.VSCODE_NLS_CONFIG) as VSCodeNlsConfig;
|
||||
if (vscodeOptions.availableLanguages) {
|
||||
const value: any = vscodeOptions.availableLanguages['*'];
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
if (typeof vscodeOptions.locale === 'string') {
|
||||
return vscodeOptions.locale.toLowerCase();
|
||||
}
|
||||
}
|
||||
return "en";
|
||||
}
|
||||
|
||||
export function getLocalizedHtmlPath(originalPath: string): string {
|
||||
const locale: string = getLocaleId();
|
||||
if (!locale.startsWith("en")) {
|
||||
const localizedFilePath: string = getExtensionFilePath(path.join("dist/html/", locale, originalPath));
|
||||
if (fs.existsSync(localizedFilePath)) {
|
||||
return localizedFilePath;
|
||||
}
|
||||
}
|
||||
return getExtensionFilePath(originalPath);
|
||||
}
|
||||
|
||||
export function getLocalizedSymbolScope(scope: string, detail: string): string {
|
||||
return localize({
|
||||
key: "c.cpp.symbolscope.separator", comment:
|
||||
["{0} is an untranslated C++ keyword (e.g. \"private\") and {1} is either another keyword (e.g. \"typedef\") or a localized property (e.g. a localized version of \"declaration\""]
|
||||
}, "{0}, {1}", scope, detail);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import * as vscode from 'vscode';
|
||||
import * as util from '../common';
|
||||
import * as config from './configurations';
|
||||
import * as telemetry from '../telemetry';
|
||||
import { getLocalizedHtmlPath } from './localization';
|
||||
|
||||
// TODO: share ElementId between SettingsPanel and SettingsApp. Investigate why SettingsApp cannot import/export
|
||||
const elementId: { [key: string]: string } = {
|
||||
@@ -373,7 +374,7 @@ export class SettingsPanel {
|
||||
private getHtml(): string {
|
||||
let content: string | undefined;
|
||||
|
||||
content = fs.readFileSync(util.getLocalizedHtmlPath("ui/settings.html")).toString();
|
||||
content = fs.readFileSync(getLocalizedHtmlPath("ui/settings.html")).toString();
|
||||
|
||||
if (this.panel && this.panel.webview) {
|
||||
const cppImageUri: vscode.Uri = this.panel.webview.asWebviewUri(vscode.Uri.file(path.join(util.extensionPath, 'LanguageCCPP_color_128x.png')));
|
||||
|
||||
@@ -17,7 +17,6 @@ import * as assert from 'assert';
|
||||
import * as https from 'https';
|
||||
import * as tmp from 'tmp';
|
||||
import { ClientRequest, OutgoingHttpHeaders } from 'http';
|
||||
import { lookupString } from './nativeStrings';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Readable } from 'stream';
|
||||
import * as jsonc from 'comment-json';
|
||||
@@ -1197,67 +1196,6 @@ export class BlockingTask<T> {
|
||||
}
|
||||
}
|
||||
|
||||
interface VSCodeNlsConfig {
|
||||
locale: string;
|
||||
availableLanguages: {
|
||||
[pack: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function getLocaleId(): string {
|
||||
// This replicates the language detection used by initializeSettings() in vscode-nls
|
||||
if (isString(process.env.VSCODE_NLS_CONFIG)) {
|
||||
const vscodeOptions: VSCodeNlsConfig = JSON.parse(process.env.VSCODE_NLS_CONFIG) as VSCodeNlsConfig;
|
||||
if (vscodeOptions.availableLanguages) {
|
||||
const value: any = vscodeOptions.availableLanguages['*'];
|
||||
if (isString(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
if (isString(vscodeOptions.locale)) {
|
||||
return vscodeOptions.locale.toLowerCase();
|
||||
}
|
||||
}
|
||||
return "en";
|
||||
}
|
||||
|
||||
export function getLocalizedHtmlPath(originalPath: string): string {
|
||||
const locale: string = getLocaleId();
|
||||
if (!locale.startsWith("en")) {
|
||||
const localizedFilePath: string = getExtensionFilePath(path.join("dist/html/", locale, originalPath));
|
||||
if (fs.existsSync(localizedFilePath)) {
|
||||
return localizedFilePath;
|
||||
}
|
||||
}
|
||||
return getExtensionFilePath(originalPath);
|
||||
}
|
||||
|
||||
export interface LocalizeStringParams {
|
||||
text: string;
|
||||
stringId: number;
|
||||
stringArgs: string[];
|
||||
indentSpaces: number;
|
||||
}
|
||||
|
||||
export function getLocalizedString(params: LocalizeStringParams): string {
|
||||
let indent: string = "";
|
||||
if (params.indentSpaces) {
|
||||
indent = " ".repeat(params.indentSpaces);
|
||||
}
|
||||
let text: string = params.text;
|
||||
if (params.stringId !== 0) {
|
||||
text = lookupString(params.stringId, params.stringArgs);
|
||||
}
|
||||
return indent + text;
|
||||
}
|
||||
|
||||
export function getLocalizedSymbolScope(scope: string, detail: string): string {
|
||||
return localize({
|
||||
key: "c.cpp.symbolscope.separator", comment:
|
||||
["{0} is an untranslated C++ keyword (e.g. \"private\") and {1} is either another keyword (e.g. \"typedef\") or a localized property (e.g. a localized version of \"declaration\""]
|
||||
}, "{0}, {1}", scope, detail);
|
||||
}
|
||||
|
||||
function decodeUCS16(input: string): number[] {
|
||||
const output: number[] = [];
|
||||
let counter: number = 0;
|
||||
|
||||
+76
-1
@@ -8,6 +8,11 @@ import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import { CppSettings } from './LanguageServer/settings';
|
||||
import { CppSourceStr } from './LanguageServer/extension';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { getLocalizedString, LocalizeStringParams } from './LanguageServer/localization';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
|
||||
// This is used for testing purposes
|
||||
let Subscriber: (message: string) => void;
|
||||
@@ -67,7 +72,10 @@ export class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
let outputChannel: vscode.OutputChannel | undefined;
|
||||
export let outputChannel: vscode.OutputChannel | undefined;
|
||||
export let diagnosticsChannel: vscode.OutputChannel | undefined;
|
||||
export let debugChannel: vscode.OutputChannel | undefined;
|
||||
export let warningChannel: vscode.OutputChannel | undefined;
|
||||
|
||||
export function getOutputChannel(): vscode.OutputChannel {
|
||||
if (!outputChannel) {
|
||||
@@ -81,6 +89,13 @@ export function getOutputChannel(): vscode.OutputChannel {
|
||||
return outputChannel;
|
||||
}
|
||||
|
||||
export function getDiagnosticsChannel(): vscode.OutputChannel {
|
||||
if (!diagnosticsChannel) {
|
||||
diagnosticsChannel = vscode.window.createOutputChannel(localize("c.cpp.diagnostics", "C/C++ Diagnostics"));
|
||||
}
|
||||
return diagnosticsChannel;
|
||||
}
|
||||
|
||||
export function showOutputChannel(): void {
|
||||
getOutputChannel().show();
|
||||
}
|
||||
@@ -93,3 +108,63 @@ export function getOutputChannelLogger(): Logger {
|
||||
}
|
||||
return outputChannelLogger;
|
||||
}
|
||||
|
||||
export function log(output: string): void {
|
||||
if (!outputChannel) {
|
||||
outputChannel = getOutputChannel();
|
||||
}
|
||||
outputChannel.appendLine(`${output}`);
|
||||
}
|
||||
|
||||
export interface DebugProtocolParams {
|
||||
jsonrpc: string;
|
||||
method: string;
|
||||
params?: any;
|
||||
}
|
||||
|
||||
export function logDebugProtocol(output: DebugProtocolParams): void {
|
||||
if (!debugChannel) {
|
||||
debugChannel = vscode.window.createOutputChannel(`${localize("c.cpp.debug.protocol", "C/C++ Debug Protocol")}`);
|
||||
}
|
||||
debugChannel.appendLine("");
|
||||
debugChannel.appendLine("************************************************************************************************************************");
|
||||
debugChannel.append(`${output}`);
|
||||
}
|
||||
|
||||
export interface ShowWarningParams {
|
||||
localizeStringParams: LocalizeStringParams;
|
||||
}
|
||||
|
||||
export function showWarning(params: ShowWarningParams): void {
|
||||
const message: string = getLocalizedString(params.localizeStringParams);
|
||||
let showChannel: boolean = false;
|
||||
if (!warningChannel) {
|
||||
warningChannel = vscode.window.createOutputChannel(`${localize("c.cpp.warnings", "C/C++ Configuration Warnings")}`);
|
||||
showChannel = true;
|
||||
}
|
||||
// Append before showing the channel, to avoid a delay.
|
||||
warningChannel.appendLine(`[${new Date().toLocaleString()}] ${message}`);
|
||||
if (showChannel) {
|
||||
warningChannel.show(true);
|
||||
}
|
||||
}
|
||||
|
||||
export function logLocalized(params: LocalizeStringParams): void {
|
||||
const output: string = getLocalizedString(params);
|
||||
log(output);
|
||||
}
|
||||
|
||||
export function disposeOutputChannels(): void {
|
||||
if (outputChannel) {
|
||||
outputChannel.dispose();
|
||||
}
|
||||
if (diagnosticsChannel) {
|
||||
diagnosticsChannel.dispose();
|
||||
}
|
||||
if (debugChannel) {
|
||||
debugChannel.dispose();
|
||||
}
|
||||
if (warningChannel) {
|
||||
warningChannel.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
+13
-5
@@ -21,6 +21,8 @@ import { TargetPopulation } from 'vscode-tas-client';
|
||||
import * as semver from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { cppBuildTaskProvider, CppBuildTaskProvider } from './LanguageServer/cppBuildTaskProvider';
|
||||
import { getLocaleId, getLocalizedHtmlPath } from './LanguageServer/localization';
|
||||
import { disposeOutputChannels, log } from './logger';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
@@ -40,7 +42,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
|
||||
public async provideTextDocumentContent(uri: vscode.Uri): Promise<string> {
|
||||
console.assert(uri.path[0] === '/', "A preceeding slash is expected on schema uri path");
|
||||
const fileName: string = uri.path.substring(1);
|
||||
const locale: string = util.getLocaleId();
|
||||
const locale: string = getLocaleId();
|
||||
let localizedFilePath: string = util.getExtensionFilePath(path.join("dist/schema/", locale, fileName));
|
||||
const fileExists: boolean = await util.checkFileExists(localizedFilePath);
|
||||
if (!fileExists) {
|
||||
@@ -79,7 +81,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
|
||||
// Read the setting and determine whether we should activate the language server prior to installing callbacks,
|
||||
// to ensure there is no potential race condition. LanguageServer.activate() is called near the end of this
|
||||
// function, to allow any further setup to occur here, prior to activation.
|
||||
const shouldActivateLanguageServer: boolean = (settings.intelliSenseEngine !== "Disabled" && !isOldMacOs);
|
||||
const isIntelliSenseEngineDisabled: boolean = settings.intelliSenseEngine === "Disabled";
|
||||
const shouldActivateLanguageServer: boolean = (!isIntelliSenseEngineDisabled && !isOldMacOs);
|
||||
|
||||
if (isOldMacOs) {
|
||||
languageServiceDisabled = true;
|
||||
@@ -134,19 +137,24 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
|
||||
|
||||
if (shouldActivateLanguageServer) {
|
||||
await LanguageServer.activate();
|
||||
} else if (isIntelliSenseEngineDisabled) {
|
||||
// The check here for isIntelliSenseEngineDisabled avoids logging
|
||||
// the message on old Macs that we've already displayed a warning for.
|
||||
log(localize("intellisense.disabled", "intelliSenseEngine is Disabled"));
|
||||
}
|
||||
|
||||
return cppTools;
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> {
|
||||
export async function deactivate(): Promise<void> {
|
||||
DebuggerExtension.dispose();
|
||||
Telemetry.deactivate();
|
||||
disposables.forEach(d => d.dispose());
|
||||
if (languageServiceDisabled) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return LanguageServer.deactivate();
|
||||
await LanguageServer.deactivate();
|
||||
disposeOutputChannels();
|
||||
}
|
||||
|
||||
async function makeBinariesExecutable(): Promise<void> {
|
||||
@@ -322,7 +330,7 @@ async function checkVsixCompatibility(): Promise<void> {
|
||||
if (promise) {
|
||||
promise.then(async (value) => {
|
||||
if (value === moreInfoButton) {
|
||||
await vscode.commands.executeCommand("markdown.showPreview", vscode.Uri.file(util.getLocalizedHtmlPath("Reinstalling the Extension.md")));
|
||||
await vscode.commands.executeCommand("markdown.showPreview", vscode.Uri.file(getLocalizedHtmlPath("Reinstalling the Extension.md")));
|
||||
} else if (value === ignoreButton) {
|
||||
ignoreMismatchedCompatibleVsix.Value = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -6181,4 +6181,4 @@ yauzl@^2.10.0:
|
||||
yocto-queue@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||
Reference in New Issue
Block a user