mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Adopt l10n for ts extension (#165450)
For #164438 Also refines the eslint rule from #165448
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
"@vscode/extension-telemetry": "0.6.2",
|
||||
"jsonc-parser": "^2.2.1",
|
||||
"semver": "5.5.1",
|
||||
"vscode-nls": "^5.2.0",
|
||||
"vscode-tas-client": "^0.1.63",
|
||||
"vscode-uri": "^3.0.3"
|
||||
},
|
||||
|
||||
+1
-3
@@ -4,14 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../../protocol';
|
||||
import { CachedResponse } from '../../tsServer/cachedResponse';
|
||||
import { ITypeScriptServiceClient } from '../../typescriptService';
|
||||
import { escapeRegExp } from '../../utils/regexp';
|
||||
import * as typeConverters from '../../utils/typeConverters';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class ReferencesCodeLens extends vscode.CodeLens {
|
||||
constructor(
|
||||
@@ -32,7 +30,7 @@ export abstract class TypeScriptBaseCodeLensProvider implements vscode.CodeLensP
|
||||
};
|
||||
|
||||
public static readonly errorCommand: vscode.Command = {
|
||||
title: localize('referenceErrorLabel', 'Could not determine references'),
|
||||
title: vscode.l10n.t("Could not determine references"),
|
||||
command: ''
|
||||
};
|
||||
|
||||
|
||||
+2
-4
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../../protocol';
|
||||
import * as PConst from '../../protocol.const';
|
||||
import { CachedResponse } from '../../tsServer/cachedResponse';
|
||||
@@ -15,7 +14,6 @@ import { LanguageDescription } from '../../utils/languageDescription';
|
||||
import * as typeConverters from '../../utils/typeConverters';
|
||||
import { getSymbolRange, ReferencesCodeLens, TypeScriptBaseCodeLensProvider } from './baseCodeLensProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class TypeScriptImplementationsCodeLensProvider extends TypeScriptBaseCodeLensProvider {
|
||||
|
||||
@@ -61,8 +59,8 @@ export default class TypeScriptImplementationsCodeLensProvider extends TypeScrip
|
||||
|
||||
private getTitle(locations: vscode.Location[]): string {
|
||||
return locations.length === 1
|
||||
? localize('oneImplementationLabel', '1 implementation')
|
||||
: localize('manyImplementationLabel', '{0} implementations', locations.length);
|
||||
? vscode.l10n.t("1 implementation")
|
||||
: vscode.l10n.t("{0} implementations", locations.length);
|
||||
}
|
||||
|
||||
protected extractSymbol(
|
||||
|
||||
+2
-4
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../../protocol';
|
||||
import * as PConst from '../../protocol.const';
|
||||
import { CachedResponse } from '../../tsServer/cachedResponse';
|
||||
@@ -16,7 +15,6 @@ import { LanguageDescription } from '../../utils/languageDescription';
|
||||
import * as typeConverters from '../../utils/typeConverters';
|
||||
import { getSymbolRange, ReferencesCodeLens, TypeScriptBaseCodeLensProvider } from './baseCodeLensProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvider {
|
||||
public constructor(
|
||||
@@ -56,8 +54,8 @@ export class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLens
|
||||
|
||||
private getCodeLensLabel(locations: ReadonlyArray<vscode.Location>): string {
|
||||
return locations.length === 1
|
||||
? localize('oneReferenceLabel', '1 reference')
|
||||
: localize('manyReferenceLabel', '{0} references', locations.length);
|
||||
? vscode.l10n.t("1 reference")
|
||||
: vscode.l10n.t("{0} references", locations.length);
|
||||
}
|
||||
|
||||
protected extractSymbol(
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import type * as Proto from '../protocol';
|
||||
import * as PConst from '../protocol.const';
|
||||
@@ -23,7 +22,6 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import TypingsStatus from '../utils/typingsStatus';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
interface DotAccessorContext {
|
||||
readonly range: vscode.Range;
|
||||
@@ -622,7 +620,7 @@ class ApplyCompletionCodeActionCommand implements Command {
|
||||
description: '',
|
||||
action,
|
||||
})), {
|
||||
placeHolder: localize('selectCodeAction', 'Select code action to apply')
|
||||
placeHolder: vscode.l10n.t("Select code action to apply")
|
||||
});
|
||||
|
||||
if (selection) {
|
||||
@@ -692,12 +690,14 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider<
|
||||
|
||||
if (this.typingsStatus.isAcquiringTypings) {
|
||||
return Promise.reject<vscode.CompletionList<MyCompletionItem>>({
|
||||
label: localize(
|
||||
{ key: 'acquiringTypingsLabel', comment: ['Typings refers to the *.d.ts typings files that power our IntelliSense. It should not be localized'] },
|
||||
'Acquiring typings...'),
|
||||
detail: localize(
|
||||
{ key: 'acquiringTypingsDetail', comment: ['Typings refers to the *.d.ts typings files that power our IntelliSense. It should not be localized'] },
|
||||
'Acquiring typings definitions for IntelliSense.')
|
||||
label: vscode.l10n.t({
|
||||
message: "Acquiring typings...",
|
||||
comment: ['Typings refers to the *.d.ts typings files that power our IntelliSense. It should not be localized'],
|
||||
}),
|
||||
detail: vscode.l10n.t({
|
||||
message: "Acquiring typings definitions for IntelliSense.",
|
||||
comment: ['Typings refers to the *.d.ts typings files that power our IntelliSense. It should not be localized'],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+4
-14
@@ -4,12 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { DocumentSelector } from '../utils/documentSelector';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
interface Directive {
|
||||
readonly value: string;
|
||||
@@ -19,19 +17,13 @@ interface Directive {
|
||||
const tsDirectives: Directive[] = [
|
||||
{
|
||||
value: '@ts-check',
|
||||
description: localize(
|
||||
'ts-check',
|
||||
"Enables semantic checking in a JavaScript file. Must be at the top of a file.")
|
||||
description: vscode.l10n.t("Enables semantic checking in a JavaScript file. Must be at the top of a file.")
|
||||
}, {
|
||||
value: '@ts-nocheck',
|
||||
description: localize(
|
||||
'ts-nocheck',
|
||||
"Disables semantic checking in a JavaScript file. Must be at the top of a file.")
|
||||
description: vscode.l10n.t("Disables semantic checking in a JavaScript file. Must be at the top of a file.")
|
||||
}, {
|
||||
value: '@ts-ignore',
|
||||
description: localize(
|
||||
'ts-ignore',
|
||||
"Suppresses @ts-check errors on the next line of a file.")
|
||||
description: vscode.l10n.t("Suppresses @ts-check errors on the next line of a file.")
|
||||
}
|
||||
];
|
||||
|
||||
@@ -39,9 +31,7 @@ const tsDirectives390: Directive[] = [
|
||||
...tsDirectives,
|
||||
{
|
||||
value: '@ts-expect-error',
|
||||
description: localize(
|
||||
'ts-expect-error',
|
||||
"Suppresses @ts-check errors on the next line of a file, expecting at least one to exist.")
|
||||
description: vscode.l10n.t("Suppresses @ts-check errors on the next line of a file, expecting at least one to exist.")
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { isSupportedLanguageMode } from '../utils/languageIds';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class FileReferencesCommand implements Command {
|
||||
|
||||
@@ -26,31 +24,31 @@ class FileReferencesCommand implements Command {
|
||||
|
||||
public async execute(resource?: vscode.Uri) {
|
||||
if (this.client.apiVersion.lt(FileReferencesCommand.minVersion)) {
|
||||
vscode.window.showErrorMessage(localize('error.unsupportedVersion', "Find file references failed. Requires TypeScript 4.2+."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Find file references failed. Requires TypeScript 4.2+."));
|
||||
return;
|
||||
}
|
||||
|
||||
resource ??= vscode.window.activeTextEditor?.document.uri;
|
||||
if (!resource) {
|
||||
vscode.window.showErrorMessage(localize('error.noResource', "Find file references failed. No resource provided."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Find file references failed. No resource provided."));
|
||||
return;
|
||||
}
|
||||
|
||||
const document = await vscode.workspace.openTextDocument(resource);
|
||||
if (!isSupportedLanguageMode(document)) {
|
||||
vscode.window.showErrorMessage(localize('error.unsupportedLanguage', "Find file references failed. Unsupported file type."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Find file references failed. Unsupported file type."));
|
||||
return;
|
||||
}
|
||||
|
||||
const openedFiledPath = this.client.toOpenedFilePath(document);
|
||||
if (!openedFiledPath) {
|
||||
vscode.window.showErrorMessage(localize('error.unknownFile', "Find file references failed. Unknown file type."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Find file references failed. Unknown file type."));
|
||||
return;
|
||||
}
|
||||
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('progress.title', "Finding file references")
|
||||
title: vscode.l10n.t("Finding file references")
|
||||
}, async (_progress, token) => {
|
||||
|
||||
const response = await this.client.execute('fileReferences', {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
@@ -16,7 +15,6 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import { DiagnosticsManager } from './diagnostics';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
interface AutoFix {
|
||||
readonly codes: Set<number>;
|
||||
@@ -133,7 +131,7 @@ class SourceFixAll extends SourceAction {
|
||||
static readonly kind = vscode.CodeActionKind.SourceFixAll.append('ts');
|
||||
|
||||
constructor() {
|
||||
super(localize('autoFix.label', 'Fix all fixable JS/TS issues'), SourceFixAll.kind);
|
||||
super(vscode.l10n.t("Fix all fixable JS/TS issues"), SourceFixAll.kind);
|
||||
}
|
||||
|
||||
async build(client: ITypeScriptServiceClient, file: string, diagnostics: readonly vscode.Diagnostic[], token: vscode.CancellationToken): Promise<void> {
|
||||
@@ -155,7 +153,7 @@ class SourceRemoveUnused extends SourceAction {
|
||||
static readonly kind = vscode.CodeActionKind.Source.append('removeUnused').append('ts');
|
||||
|
||||
constructor() {
|
||||
super(localize('autoFix.unused.label', 'Remove all unused code'), SourceRemoveUnused.kind);
|
||||
super(vscode.l10n.t("Remove all unused code"), SourceRemoveUnused.kind);
|
||||
}
|
||||
|
||||
async build(client: ITypeScriptServiceClient, file: string, diagnostics: readonly vscode.Diagnostic[], token: vscode.CancellationToken): Promise<void> {
|
||||
@@ -171,7 +169,7 @@ class SourceAddMissingImports extends SourceAction {
|
||||
static readonly kind = vscode.CodeActionKind.Source.append('addMissingImports').append('ts');
|
||||
|
||||
constructor() {
|
||||
super(localize('autoFix.missingImports.label', 'Add all missing imports'), SourceAddMissingImports.kind);
|
||||
super(vscode.l10n.t("Add all missing imports"), SourceAddMissingImports.kind);
|
||||
}
|
||||
|
||||
async build(client: ITypeScriptServiceClient, file: string, diagnostics: readonly vscode.Diagnostic[], token: vscode.CancellationToken): Promise<void> {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient, ServerType } from '../typescriptService';
|
||||
import { conditionalRegistration, requireSomeCapability } from '../utils/dependentRegistration';
|
||||
@@ -13,7 +12,6 @@ import { markdownDocumentation } from '../utils/previewer';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
class TypeScriptHoverProvider implements vscode.HoverProvider {
|
||||
@@ -61,10 +59,10 @@ class TypeScriptHoverProvider implements vscode.HoverProvider {
|
||||
|
||||
if (source === ServerType.Syntax && this.client.hasCapabilityForResource(resource, ClientCapability.Semantic)) {
|
||||
displayParts.push(
|
||||
localize({
|
||||
key: 'loadingPrefix',
|
||||
vscode.l10n.t({
|
||||
message: "(loading...)",
|
||||
comment: ['Prefix displayed for hover entries while the server is still loading']
|
||||
}, "(loading...)"));
|
||||
}));
|
||||
}
|
||||
|
||||
displayParts.push(data.displayString);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { DocumentSelector } from '../utils/documentSelector';
|
||||
import { LanguageDescription } from '../utils/languageDescription';
|
||||
@@ -12,7 +11,6 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const defaultJsDoc = new vscode.SnippetString(`/**\n * $0\n */`);
|
||||
|
||||
@@ -22,7 +20,7 @@ class JsDocCompletionItem extends vscode.CompletionItem {
|
||||
public readonly position: vscode.Position
|
||||
) {
|
||||
super('/** */', vscode.CompletionItemKind.Text);
|
||||
this.detail = localize('typescript.jsDocCompletionItem.documentation', 'JSDoc comment');
|
||||
this.detail = vscode.l10n.t("JSDoc comment");
|
||||
this.sortText = '\0';
|
||||
|
||||
const line = document.lineAt(position.line).text;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import type * as Proto from '../protocol';
|
||||
import { OrganizeImportsMode } from '../protocol.const';
|
||||
@@ -17,7 +16,6 @@ import { TelemetryReporter } from '../utils/telemetry';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
interface OrganizeImportsCommandMetadata {
|
||||
readonly ids: readonly string[];
|
||||
@@ -30,7 +28,7 @@ interface OrganizeImportsCommandMetadata {
|
||||
const organizeImportsCommand: OrganizeImportsCommandMetadata = {
|
||||
ids: ['typescript.organizeImports'],
|
||||
minVersion: API.v280,
|
||||
title: localize('organizeImportsAction.title', "Organize Imports"),
|
||||
title: vscode.l10n.t("Organize Imports"),
|
||||
kind: vscode.CodeActionKind.SourceOrganizeImports,
|
||||
mode: OrganizeImportsMode.All,
|
||||
};
|
||||
@@ -38,7 +36,7 @@ const organizeImportsCommand: OrganizeImportsCommandMetadata = {
|
||||
const sortImportsCommand: OrganizeImportsCommandMetadata = {
|
||||
ids: ['typescript.sortImports', 'javascript.sortImports'],
|
||||
minVersion: API.v430,
|
||||
title: localize('sortImportsAction.title', "Sort Imports"),
|
||||
title: vscode.l10n.t("Sort Imports"),
|
||||
kind: vscode.CodeActionKind.Source.append('sortImports'),
|
||||
mode: OrganizeImportsMode.SortAndCombine,
|
||||
};
|
||||
@@ -46,7 +44,7 @@ const sortImportsCommand: OrganizeImportsCommandMetadata = {
|
||||
const removeUnusedImportsCommand: OrganizeImportsCommandMetadata = {
|
||||
ids: ['typescript.removeUnusedImports', 'javascript.removeUnusedImports'],
|
||||
minVersion: API.v490,
|
||||
title: localize('removeUnusedImportsAction.title', "Remove Unused Imports"),
|
||||
title: vscode.l10n.t("Remove Unused Imports"),
|
||||
kind: vscode.CodeActionKind.Source.append('removeUnusedImports'),
|
||||
mode: OrganizeImportsMode.RemoveUnused,
|
||||
};
|
||||
@@ -73,7 +71,7 @@ class OrganizeImportsCommand implements Command {
|
||||
if (!file) {
|
||||
const activeEditor = vscode.window.activeTextEditor;
|
||||
if (!activeEditor) {
|
||||
vscode.window.showErrorMessage(localize('error.organizeImports.noResource', "Organize Imports failed. No resource provided."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Organize Imports failed. No resource provided."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,7 +79,7 @@ class OrganizeImportsCommand implements Command {
|
||||
const document = await vscode.workspace.openTextDocument(resource);
|
||||
const openedFiledPath = this.client.toOpenedFilePath(document);
|
||||
if (!openedFiledPath) {
|
||||
vscode.window.showErrorMessage(localize('error.organizeImports.unknownFile', "Organize Imports failed. Unknown file type."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Organize Imports failed. Unknown file type."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
|
||||
@@ -21,7 +20,6 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import { DiagnosticsManager } from './diagnostics';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class ApplyCodeActionCommand implements Command {
|
||||
public static readonly ID = '_typescript.applyCodeActionCommand';
|
||||
@@ -350,7 +348,7 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode
|
||||
const action = new VsCodeFixAllCodeAction(
|
||||
tsAction,
|
||||
file,
|
||||
tsAction.fixAllDescription || localize('fixAllInFileLabel', '{0} (Fix all in file)', tsAction.description),
|
||||
tsAction.fixAllDescription || vscode.l10n.t("{0} (Fix all in file)", tsAction.description),
|
||||
vscode.CodeActionKind.QuickFix);
|
||||
|
||||
action.diagnostics = [diagnostic];
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import { LearnMoreAboutRefactoringsCommand } from '../commands/learnMoreAboutRefactorings';
|
||||
import type * as Proto from '../protocol';
|
||||
@@ -18,7 +17,6 @@ import { TelemetryReporter } from '../utils/telemetry';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FormattingOptionsManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
interface DidApplyRefactoringCommand_Args {
|
||||
@@ -48,7 +46,7 @@ class DidApplyRefactoringCommand implements Command {
|
||||
});
|
||||
|
||||
if (!args.codeAction.edit?.size) {
|
||||
vscode.window.showErrorMessage(localize('refactoringFailed', "Could not apply refactoring"));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Could not apply refactoring"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,7 +98,7 @@ class SelectRefactorCommand implements Command {
|
||||
|
||||
if (tsAction.edit) {
|
||||
if (!(await vscode.workspace.applyEdit(tsAction.edit))) {
|
||||
vscode.window.showErrorMessage(localize('refactoringFailed', "Could not apply refactoring"));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Could not apply refactoring"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -273,7 +271,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
||||
kind: vscode.CodeActionKind.Refactor,
|
||||
command: {
|
||||
command: LearnMoreAboutRefactoringsCommand.id,
|
||||
title: localize('refactor.documentation.title', "Learn more about JS/TS refactorings")
|
||||
title: vscode.l10n.t("Learn more about JS/TS refactorings")
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -441,11 +439,11 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
||||
|
||||
if (!actions.some(action => action.kind && Extract_Constant.kind.contains(action.kind))) {
|
||||
const disabledAction = new vscode.CodeAction(
|
||||
localize('extractConstant.disabled.title', "Extract to constant"),
|
||||
vscode.l10n.t("Extract to constant"),
|
||||
Extract_Constant.kind);
|
||||
|
||||
disabledAction.disabled = {
|
||||
reason: localize('extractConstant.disabled.reason', "The current selection cannot be extracted"),
|
||||
reason: vscode.l10n.t("The current selection cannot be extracted"),
|
||||
};
|
||||
disabledAction.isPreferred = true;
|
||||
|
||||
@@ -454,11 +452,11 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
||||
|
||||
if (!actions.some(action => action.kind && Extract_Function.kind.contains(action.kind))) {
|
||||
const disabledAction = new vscode.CodeAction(
|
||||
localize('extractFunction.disabled.title', "Extract to function"),
|
||||
vscode.l10n.t("Extract to function"),
|
||||
Extract_Function.kind);
|
||||
|
||||
disabledAction.disabled = {
|
||||
reason: localize('extractFunction.disabled.reason', "The current selection cannot be extracted"),
|
||||
reason: vscode.l10n.t("The current selection cannot be extracted"),
|
||||
};
|
||||
actions.push(disabledAction);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
@@ -14,7 +13,6 @@ import { DocumentSelector } from '../utils/documentSelector';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||
public constructor(
|
||||
@@ -65,7 +63,7 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||
if (edits) {
|
||||
return edits;
|
||||
} else {
|
||||
return Promise.reject<vscode.WorkspaceEdit>(localize('fileRenameFail', "An error occurred while renaming file"));
|
||||
return Promise.reject<vscode.WorkspaceEdit>(vscode.l10n.t("An error occurred while renaming file"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, CommandManager } from '../commands/commandManager';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { isSupportedLanguageMode } from '../utils/languageIds';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
class SourceDefinitionCommand implements Command {
|
||||
|
||||
@@ -27,32 +24,32 @@ class SourceDefinitionCommand implements Command {
|
||||
|
||||
public async execute() {
|
||||
if (this.client.apiVersion.lt(SourceDefinitionCommand.minVersion)) {
|
||||
vscode.window.showErrorMessage(localize('error.unsupportedVersion', "Go to Source Definition failed. Requires TypeScript 4.7+."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Go to Source Definition failed. Requires TypeScript 4.7+."));
|
||||
return;
|
||||
}
|
||||
|
||||
const activeEditor = vscode.window.activeTextEditor;
|
||||
if (!activeEditor) {
|
||||
vscode.window.showErrorMessage(localize('error.noResource', "Go to Source Definition failed. No resource provided."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Go to Source Definition failed. No resource provided."));
|
||||
return;
|
||||
}
|
||||
|
||||
const resource = activeEditor.document.uri;
|
||||
const document = await vscode.workspace.openTextDocument(resource);
|
||||
if (!isSupportedLanguageMode(document)) {
|
||||
vscode.window.showErrorMessage(localize('error.unsupportedLanguage', "Go to Source Definition failed. Unsupported file type."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Go to Source Definition failed. Unsupported file type."));
|
||||
return;
|
||||
}
|
||||
|
||||
const openedFiledPath = this.client.toOpenedFilePath(document);
|
||||
if (!openedFiledPath) {
|
||||
vscode.window.showErrorMessage(localize('error.unknownFile', "Go to Source Definition failed. Unknown file type."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Go to Source Definition failed. Unknown file type."));
|
||||
return;
|
||||
}
|
||||
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('progress.title', "Finding source definitions")
|
||||
title: vscode.l10n.t("Finding source definitions")
|
||||
}, async (_progress, token) => {
|
||||
|
||||
const position = activeEditor.selection.anchor;
|
||||
@@ -74,7 +71,7 @@ class SourceDefinitionCommand implements Command {
|
||||
}
|
||||
}
|
||||
|
||||
vscode.window.showErrorMessage(localize('error.noReferences', "No source definitions found."));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("No source definitions found."));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import * as jsonc from 'jsonc-parser';
|
||||
import { basename, dirname, join, posix } from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Utils } from 'vscode-uri';
|
||||
import { coalesce } from '../utils/arrays';
|
||||
import { exists } from '../utils/fs';
|
||||
@@ -23,7 +22,6 @@ type OpenExtendsLinkCommandArgs = {
|
||||
extendsValue: string;
|
||||
};
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class TsconfigLinkProvider implements vscode.DocumentLinkProvider {
|
||||
|
||||
@@ -62,7 +60,7 @@ class TsconfigLinkProvider implements vscode.DocumentLinkProvider {
|
||||
const link = new vscode.DocumentLink(
|
||||
this.getRange(document, extendsNode),
|
||||
vscode.Uri.parse(`command:${openExtendsLinkCommandId}?${JSON.stringify(args)}`));
|
||||
link.tooltip = localize('documentLink.tooltip', 'Follow link');
|
||||
link.tooltip = vscode.l10n.t("Follow link");
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -203,7 +201,7 @@ export function register() {
|
||||
vscode.commands.registerCommand(openExtendsLinkCommandId, async ({ resourceUri, extendsValue, }: OpenExtendsLinkCommandArgs) => {
|
||||
const tsconfigPath = await getTsconfigPath(Utils.dirname(resourceUri), extendsValue);
|
||||
if (tsconfigPath === undefined) {
|
||||
vscode.window.showErrorMessage(localize('openTsconfigExtendsModuleFail', "Failed to resolve {0} as module", extendsValue));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("Failed to resolve {0} as module", extendsValue));
|
||||
return;
|
||||
}
|
||||
// Will suggest to create a .json variant if it doesn't exist yet (but only for relative paths)
|
||||
|
||||
+9
-11
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
@@ -18,7 +17,6 @@ import { doesResourceLookLikeATypeScriptFile } from '../utils/languageDescriptio
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const updateImportsOnFileMoveName = 'updateImportsOnFileMove.enabled';
|
||||
|
||||
@@ -87,7 +85,7 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
|
||||
this._delayer.trigger(() => {
|
||||
vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('renameProgress.title', "Checking for update of JS/TS imports")
|
||||
title: vscode.l10n.t("Checking for update of JS/TS imports")
|
||||
}, () => this.flushRenames());
|
||||
});
|
||||
}));
|
||||
@@ -148,26 +146,26 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
|
||||
}
|
||||
|
||||
const rejectItem: vscode.MessageItem = {
|
||||
title: localize('reject.title', "No"),
|
||||
title: vscode.l10n.t("No"),
|
||||
isCloseAffordance: true,
|
||||
};
|
||||
|
||||
const acceptItem: vscode.MessageItem = {
|
||||
title: localize('accept.title', "Yes"),
|
||||
title: vscode.l10n.t("Yes"),
|
||||
};
|
||||
|
||||
const alwaysItem: vscode.MessageItem = {
|
||||
title: localize('always.title', "Always automatically update imports"),
|
||||
title: vscode.l10n.t("Always automatically update imports"),
|
||||
};
|
||||
|
||||
const neverItem: vscode.MessageItem = {
|
||||
title: localize('never.title', "Never automatically update imports"),
|
||||
title: vscode.l10n.t("Never automatically update imports"),
|
||||
};
|
||||
|
||||
const response = await vscode.window.showInformationMessage(
|
||||
newResources.length === 1
|
||||
? localize('prompt', "Update imports for '{0}'?", path.basename(newResources[0].fsPath))
|
||||
: this.getConfirmMessage(localize('promptMoreThanOne', "Update imports for the following {0} files?", newResources.length), newResources), {
|
||||
? vscode.l10n.t("Update imports for '{0}'?", path.basename(newResources[0].fsPath))
|
||||
: this.getConfirmMessage(vscode.l10n.t("Update imports for the following {0} files?", newResources.length), newResources), {
|
||||
modal: true,
|
||||
}, rejectItem, acceptItem, alwaysItem, neverItem);
|
||||
|
||||
@@ -261,9 +259,9 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
|
||||
|
||||
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
|
||||
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
|
||||
paths.push(localize('moreFile', "...1 additional file not shown"));
|
||||
paths.push(vscode.l10n.t("...1 additional file not shown"));
|
||||
} else {
|
||||
paths.push(localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
|
||||
paths.push(vscode.l10n.t("...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import * as jsonc from 'jsonc-parser';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { wait } from '../test/testUtils';
|
||||
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||
import { coalesce } from '../utils/arrays';
|
||||
@@ -17,7 +16,6 @@ import { Lazy } from '../utils/lazy';
|
||||
import { isImplicitProjectConfigFile } from '../utils/tsconfig';
|
||||
import { TSConfig, TsConfigProvider } from './tsconfigProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
enum AutoDetect {
|
||||
on = 'on',
|
||||
@@ -74,7 +72,7 @@ class TscTaskProvider extends Disposable implements vscode.TaskProvider {
|
||||
const definition = <TypeScriptTaskDefinition>task.definition;
|
||||
if (/\\tsconfig.*\.json/.test(definition.tsconfig)) {
|
||||
// Warn that the task has the wrong slash type
|
||||
vscode.window.showWarningMessage(localize('badTsConfig', "TypeScript Task in tasks.json contains \"\\\\\". TypeScript tasks tsconfig must use \"/\""));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("TypeScript Task in tasks.json contains \"\\\\\". TypeScript tasks tsconfig must use \"/\""));
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -210,7 +208,7 @@ class TscTaskProvider extends Disposable implements vscode.TaskProvider {
|
||||
const buildTask = new vscode.Task(
|
||||
buildTaskidentifier,
|
||||
workspaceFolder || vscode.TaskScope.Workspace,
|
||||
localize('buildTscLabel', 'build - {0}', label),
|
||||
vscode.l10n.t("build - {0}", label),
|
||||
'tsc',
|
||||
new vscode.ShellExecution(command, args),
|
||||
'$tsc');
|
||||
@@ -223,7 +221,7 @@ class TscTaskProvider extends Disposable implements vscode.TaskProvider {
|
||||
const watchTask = new vscode.Task(
|
||||
watchTaskidentifier,
|
||||
workspaceFolder || vscode.TaskScope.Workspace,
|
||||
localize('buildAndWatchTscLabel', 'watch - {0}', label),
|
||||
vscode.l10n.t("watch - {0}", label),
|
||||
'tsc',
|
||||
new vscode.ShellExecution(command, [...args, '--watch']),
|
||||
'$tsc-watch');
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { memoize } from '../utils/memoize';
|
||||
@@ -12,7 +11,6 @@ import { TsServerProcess, TsServerProcessKind } from './server';
|
||||
import { TypeScriptVersion } from './versionProvider';
|
||||
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
declare const Worker: any;
|
||||
declare type Worker = any;
|
||||
@@ -64,7 +62,7 @@ export class WorkerServerProcess implements TsServerProcess {
|
||||
|
||||
@memoize
|
||||
private get output(): vscode.OutputChannel {
|
||||
return vscode.window.createOutputChannel(localize('channelName', 'TypeScript Server Log'));
|
||||
return vscode.window.createOutputChannel(vscode.l10n.t("TypeScript Server Log"));
|
||||
}
|
||||
|
||||
write(serverRequest: Proto.Request): void {
|
||||
|
||||
@@ -8,7 +8,6 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import type { Readable } from 'stream';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import API from '../utils/api';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
@@ -17,7 +16,6 @@ import { TsServerProcess, TsServerProcessFactory, TsServerProcessKind } from './
|
||||
import { TypeScriptVersionManager } from './versionManager';
|
||||
import { TypeScriptVersion } from './versionProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const defaultSize: number = 8192;
|
||||
const contentLength: string = 'Content-Length: ';
|
||||
@@ -259,7 +257,7 @@ export class ElectronServiceProcessFactory implements TsServerProcessFactory {
|
||||
let tsServerPath = version.tsServerPath;
|
||||
|
||||
if (!fs.existsSync(tsServerPath)) {
|
||||
vscode.window.showWarningMessage(localize('noServerFound', 'The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', tsServerPath));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', tsServerPath"));
|
||||
versionManager.reset();
|
||||
tsServerPath = versionManager.currentVersion.tsServerPath;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { setImmediate } from '../utils/async';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { ITypeScriptVersionProvider, TypeScriptVersion } from './versionProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const useWorkspaceTsdkStorageKey = 'typescript.useWorkspaceTsdk';
|
||||
const suppressPromptWorkspaceTsdkStorageKey = 'typescript.suppressPromptWorkspaceTsdk';
|
||||
@@ -89,9 +87,7 @@ export class TypeScriptVersionManager extends Disposable {
|
||||
},
|
||||
LearnMorePickItem,
|
||||
], {
|
||||
placeHolder: localize(
|
||||
'selectTsVersion',
|
||||
"Select the TypeScript version used for JavaScript and TypeScript language features"),
|
||||
placeHolder: vscode.l10n.t("Select the TypeScript version used for JavaScript and TypeScript language features"),
|
||||
});
|
||||
|
||||
return selected?.run();
|
||||
@@ -102,7 +98,7 @@ export class TypeScriptVersionManager extends Disposable {
|
||||
return {
|
||||
label: (!this.useWorkspaceTsdkSetting || !vscode.workspace.isTrusted
|
||||
? '• '
|
||||
: '') + localize('useVSCodeVersionOption', "Use VS Code's Version"),
|
||||
: '') + vscode.l10n.t("Use VS Code's Version"),
|
||||
description: bundledVersion.displayName,
|
||||
detail: bundledVersion.pathLabel,
|
||||
run: async () => {
|
||||
@@ -117,7 +113,7 @@ export class TypeScriptVersionManager extends Disposable {
|
||||
return {
|
||||
label: (this.useWorkspaceTsdkSetting && vscode.workspace.isTrusted && this.currentVersion.eq(version)
|
||||
? '• '
|
||||
: '') + localize('useWorkspaceVersionOption', "Use Workspace Version"),
|
||||
: '') + vscode.l10n.t("Use Workspace Version"),
|
||||
description: version.displayName,
|
||||
detail: version.pathLabel,
|
||||
run: async () => {
|
||||
@@ -140,11 +136,11 @@ export class TypeScriptVersionManager extends Disposable {
|
||||
throw new Error('Could not prompt to use workspace TypeScript version because no workspace version is specified');
|
||||
}
|
||||
|
||||
const allowIt = localize('allow', 'Allow');
|
||||
const dismissPrompt = localize('dismiss', 'Dismiss');
|
||||
const suppressPrompt = localize('suppress prompt', 'Never in this Workspace');
|
||||
const allowIt = vscode.l10n.t("Allow");
|
||||
const dismissPrompt = vscode.l10n.t("Dismiss");
|
||||
const suppressPrompt = vscode.l10n.t("Never in this Workspace");
|
||||
|
||||
const result = await vscode.window.showInformationMessage(localize('promptUseWorkspaceTsdk', 'This workspace contains a TypeScript version. Would you like to use the workspace TypeScript version for TypeScript and JavaScript language features?'),
|
||||
const result = await vscode.window.showInformationMessage(vscode.l10n.t("This workspace contains a TypeScript version. Would you like to use the workspace TypeScript version for TypeScript and JavaScript language features?"),
|
||||
allowIt,
|
||||
dismissPrompt,
|
||||
suppressPrompt
|
||||
@@ -185,7 +181,7 @@ export class TypeScriptVersionManager extends Disposable {
|
||||
}
|
||||
|
||||
const LearnMorePickItem: QuickPickItem = {
|
||||
label: localize('learnMore', "Learn more about managing TypeScript versions"),
|
||||
label: vscode.l10n.t("Learn more about managing TypeScript versions"),
|
||||
description: '',
|
||||
run: () => {
|
||||
vscode.env.openExternal(vscode.Uri.parse('https://go.microsoft.com/fwlink/?linkid=839919'));
|
||||
|
||||
@@ -6,13 +6,11 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import API from '../utils/api';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { RelativeWorkspacePathResolver } from '../utils/relativePathResolver';
|
||||
import { ITypeScriptVersionProvider, TypeScriptVersion, TypeScriptVersionSource } from './versionProvider';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider {
|
||||
|
||||
@@ -70,9 +68,7 @@ export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider
|
||||
return version;
|
||||
}
|
||||
|
||||
vscode.window.showErrorMessage(localize(
|
||||
'noBundledServerFound',
|
||||
'VS Code\'s tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code.'));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("VS Code\'s tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code."));
|
||||
throw new Error('Could not find bundled tsserver.js');
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
import API from '../utils/api';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export const enum TypeScriptVersionSource {
|
||||
Bundled = 'bundled',
|
||||
@@ -54,8 +53,7 @@ export class TypeScriptVersion {
|
||||
|
||||
public get displayName(): string {
|
||||
const version = this.apiVersion;
|
||||
return version ? version.displayName : localize(
|
||||
'couldNotLoadTsVersion', 'Could not load the TypeScript version at this path');
|
||||
return version ? version.displayName : vscode.l10n.t("Could not load the TypeScript version at this path");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { IExperimentationTelemetryReporter } from './experimentTelemetryReporter';
|
||||
import { DiagnosticKind, DiagnosticsManager } from './languageFeatures/diagnostics';
|
||||
import * as Proto from './protocol';
|
||||
@@ -31,7 +30,6 @@ import { TelemetryProperties, TelemetryReporter, VSCodeTelemetryReporter } from
|
||||
import Tracer from './utils/tracer';
|
||||
import { inferredProjectCompilerOptions, ProjectType } from './utils/tsconfig';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export interface TsDiagnostics {
|
||||
readonly kind: DiagnosticKind;
|
||||
@@ -372,7 +370,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
|
||||
let version = this._versionManager.currentVersion;
|
||||
if (!version.isValid) {
|
||||
vscode.window.showWarningMessage(localize('noServerFound', 'The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', version.path));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', version.path"));
|
||||
|
||||
this._versionManager.reset();
|
||||
version = this._versionManager.currentVersion;
|
||||
@@ -410,7 +408,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
|
||||
if (err) {
|
||||
vscode.window.showErrorMessage(localize('serverExitedWithError', 'TypeScript language server exited with error. Error message is: {0}', err.message || err.name));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t("TypeScript language server exited with error. Error message is: {0}", err.message || err.name));
|
||||
}
|
||||
|
||||
this.serverState = new ServerState.Errored(err, handle.tsServerLogFile);
|
||||
@@ -483,13 +481,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
public async openTsServerLogFile(): Promise<boolean> {
|
||||
if (this._configuration.tsServerLogLevel === TsServerLogLevel.Off) {
|
||||
vscode.window.showErrorMessage<vscode.MessageItem>(
|
||||
localize(
|
||||
'typescript.openTsServerLog.loggingNotEnabled',
|
||||
'TS Server logging is off. Please set `typescript.tsserver.log` and restart the TS server to enable logging'),
|
||||
vscode.l10n.t("TS Server logging is off. Please set `typescript.tsserver.log` and restart the TS server to enable logging"),
|
||||
{
|
||||
title: localize(
|
||||
'typescript.openTsServerLog.enableAndReloadOption',
|
||||
'Enable logging and restart TS server'),
|
||||
title: vscode.l10n.t("Enable logging and restart TS server"),
|
||||
})
|
||||
.then(selection => {
|
||||
if (selection) {
|
||||
@@ -503,9 +497,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
|
||||
if (this.serverState.type !== ServerState.Type.Running || !this.serverState.server.tsServerLogFile) {
|
||||
vscode.window.showWarningMessage(localize(
|
||||
'typescript.openTsServerLog.noLogFile',
|
||||
'TS Server has not started logging.'));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("TS Server has not started logging."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -521,9 +513,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(this.serverState.server.tsServerLogFile));
|
||||
return true;
|
||||
} catch {
|
||||
vscode.window.showWarningMessage(localize(
|
||||
'openTsServerLog.openFileFailedFailed',
|
||||
'Could not open TS Server log file'));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("Could not open TS Server log file"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -588,7 +578,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
|
||||
const pluginExtensionList = this.pluginManager.plugins.map(plugin => plugin.extension.id).join(', ');
|
||||
const reportIssueItem: vscode.MessageItem = {
|
||||
title: localize('serverDiedReportIssue', 'Report Issue'),
|
||||
title: vscode.l10n.t("Report Issue"),
|
||||
};
|
||||
let prompt: Thenable<undefined | vscode.MessageItem> | undefined = undefined;
|
||||
|
||||
@@ -600,8 +590,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
this.hasServerFatallyCrashedTooManyTimes = true;
|
||||
prompt = vscode.window.showErrorMessage(
|
||||
this.pluginManager.plugins.length
|
||||
? localize('serverDiedImmediatelyWithPlugins', "The JS/TS language service immediately crashed 5 times. The service will not be restarted.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: localize('serverDiedImmediately', "The JS/TS language service immediately crashed 5 times. The service will not be restarted."),
|
||||
? vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: vscode.l10n.t("The JS/TS language service immediately crashed 5 times. The service will not be restarted."),
|
||||
reportIssueItem);
|
||||
|
||||
/* __GDPR__
|
||||
@@ -618,8 +608,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
if (!this._isPromptingAfterCrash) {
|
||||
prompt = vscode.window.showWarningMessage(
|
||||
this.pluginManager.plugins.length
|
||||
? localize('serverDiedFiveTimesWithPlugins', "The JS/TS language service crashed 5 times in the last 5 Minutes.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: localize('serverDiedFiveTimes', "The JS/TS language service crashed 5 times in the last 5 Minutes."),
|
||||
? vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: vscode.l10n.t("The JS/TS language service crashed 5 times in the last 5 Minutes."),
|
||||
reportIssueItem);
|
||||
}
|
||||
}
|
||||
@@ -629,8 +619,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
if (!this._isPromptingAfterCrash) {
|
||||
prompt = vscode.window.showWarningMessage(
|
||||
this.pluginManager.plugins.length
|
||||
? localize('serverDiedOnceWithPlugins', "The JS/TS language service crashed.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: localize('serverDiedOnce', "The JS/TS language service crashed."),
|
||||
? vscode.l10n.t("The JS/TS language service crashed.\nThis may be caused by a plugin contributed by one of these extensions: {0}", pluginExtensionList)
|
||||
: vscode.l10n.t("The JS/TS language service crashed."),
|
||||
reportIssueItem);
|
||||
}
|
||||
}
|
||||
@@ -647,13 +637,12 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
|
||||
if (minModernTsVersion && this.apiVersion.lt(minModernTsVersion)) {
|
||||
vscode.window.showWarningMessage(
|
||||
localize('usingOldTsVersion.title', 'Please update your TypeScript version'),
|
||||
vscode.l10n.t("Please update your TypeScript version"),
|
||||
{
|
||||
modal: true,
|
||||
detail: localize(
|
||||
'usingOldTsVersion.detail',
|
||||
'The workspace is using an old version of TypeScript ({0}).\n\nBefore reporting an issue, please update the workspace to use the latest stable TypeScript release to make sure the bug has not already been fixed.',
|
||||
previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError ? previousState.error.version.apiVersion?.displayName : undefined),
|
||||
detail: vscode.l10n.t(
|
||||
"The workspace is using an old version of TypeScript ({0}).\n\nBefore reporting an issue, please update the workspace to use the latest stable TypeScript release to make sure the bug has not already been fixed.",
|
||||
(previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError ? previousState.error.version.apiVersion?.displayName : undefined) + ''),
|
||||
useCustom: true
|
||||
});
|
||||
} else {
|
||||
@@ -1113,7 +1102,7 @@ class ServerInitializingIndicator extends Disposable {
|
||||
|
||||
vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('serverLoading.progress', "Initializing JS/TS language features"),
|
||||
title: vscode.l10n.t("Initializing JS/TS language features"),
|
||||
}, () => new Promise<void>(resolve => {
|
||||
this._task = { project: projectName, resolve };
|
||||
}));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { CommandManager } from '../commands/commandManager';
|
||||
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { ActiveJsTsEditorTracker } from '../utils/activeJsTsEditorTracker';
|
||||
@@ -12,7 +11,6 @@ import { Disposable } from '../utils/dispose';
|
||||
import { isSupportedLanguageMode, isTypeScriptDocument, jsTsLanguageModes } from '../utils/languageIds';
|
||||
import { isImplicitProjectConfigFile, openOrCreateConfig, openProjectConfigForFile, openProjectConfigOrPromptToCreate, ProjectType } from '../utils/tsconfig';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
namespace IntellisenseState {
|
||||
export const enum Type { None, Pending, Resolved, SyntaxOnly }
|
||||
@@ -148,7 +146,7 @@ export class IntellisenseStatus extends Disposable {
|
||||
case IntellisenseState.Type.Pending: {
|
||||
const statusItem = this.ensureStatusItem();
|
||||
statusItem.severity = vscode.LanguageStatusSeverity.Information;
|
||||
statusItem.text = localize('pending.detail', 'Loading IntelliSense status');
|
||||
statusItem.text = vscode.l10n.t("Loading IntelliSense status");
|
||||
statusItem.detail = undefined;
|
||||
statusItem.command = undefined;
|
||||
statusItem.busy = true;
|
||||
@@ -156,16 +154,16 @@ export class IntellisenseStatus extends Disposable {
|
||||
}
|
||||
case IntellisenseState.Type.Resolved: {
|
||||
const noConfigFileText = this._state.projectType === ProjectType.TypeScript
|
||||
? localize('resolved.detail.noTsConfig', "No tsconfig")
|
||||
: localize('resolved.detail.noJsConfig', "No jsconfig");
|
||||
? vscode.l10n.t("No tsconfig")
|
||||
: vscode.l10n.t("No jsconfig");
|
||||
|
||||
const rootPath = this._client.getWorkspaceRootForResource(this._state.resource);
|
||||
if (!rootPath) {
|
||||
if (this._statusItem) {
|
||||
this._statusItem.text = noConfigFileText;
|
||||
this._statusItem.detail = !vscode.workspace.workspaceFolders
|
||||
? localize('resolved.detail.noOpenedFolders', 'No opened folders')
|
||||
: localize('resolved.detail.notInOpenedFolder', 'File is not part opened folders');
|
||||
? vscode.l10n.t("No opened folders")
|
||||
: vscode.l10n.t("File is not part opened folders");
|
||||
this._statusItem.busy = false;
|
||||
}
|
||||
return;
|
||||
@@ -182,8 +180,8 @@ export class IntellisenseStatus extends Disposable {
|
||||
statusItem.command = {
|
||||
command: this.createConfigCommandId,
|
||||
title: this._state.projectType === ProjectType.TypeScript
|
||||
? localize('resolved.command.title.createTsconfig', "Create tsconfig")
|
||||
: localize('resolved.command.title.createJsconfig', "Create jsconfig"),
|
||||
? vscode.l10n.t("Create tsconfig")
|
||||
: vscode.l10n.t("Create jsconfig"),
|
||||
arguments: [rootPath],
|
||||
};
|
||||
} else {
|
||||
@@ -191,7 +189,7 @@ export class IntellisenseStatus extends Disposable {
|
||||
statusItem.detail = undefined;
|
||||
statusItem.command = {
|
||||
command: this.openOpenConfigCommandId,
|
||||
title: localize('resolved.command.title.open', "Open config file"),
|
||||
title: vscode.l10n.t("Open config file"),
|
||||
arguments: [rootPath],
|
||||
};
|
||||
}
|
||||
@@ -200,11 +198,11 @@ export class IntellisenseStatus extends Disposable {
|
||||
case IntellisenseState.Type.SyntaxOnly: {
|
||||
const statusItem = this.ensureStatusItem();
|
||||
statusItem.severity = vscode.LanguageStatusSeverity.Warning;
|
||||
statusItem.text = localize('syntaxOnly.text', 'Partial Mode');
|
||||
statusItem.detail = localize('syntaxOnly.detail', 'Project Wide IntelliSense not available');
|
||||
statusItem.text = vscode.l10n.t("Partial Mode");
|
||||
statusItem.detail = vscode.l10n.t("Project Wide IntelliSense not available");
|
||||
statusItem.busy = false;
|
||||
statusItem.command = {
|
||||
title: localize('syntaxOnly.command.title.learnMore', "Learn More"),
|
||||
title: vscode.l10n.t("Learn More"),
|
||||
command: 'vscode.open',
|
||||
arguments: [
|
||||
vscode.Uri.parse('https://aka.ms/vscode/jsts/partial-mode'),
|
||||
@@ -218,7 +216,7 @@ export class IntellisenseStatus extends Disposable {
|
||||
private ensureStatusItem(): vscode.LanguageStatusItem {
|
||||
if (!this._statusItem) {
|
||||
this._statusItem = vscode.languages.createLanguageStatusItem('typescript.projectStatus', jsTsLanguageModes);
|
||||
this._statusItem.name = localize('statusItem.name', "JS/TS IntelliSense Status");
|
||||
this._statusItem.name = vscode.l10n.t("JS/TS IntelliSense Status");
|
||||
}
|
||||
return this._statusItem;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as cp from 'child_process';
|
||||
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { CommandManager } from '../commands/commandManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export async function nodeWasResolvable(): Promise<boolean> {
|
||||
let execStr: string;
|
||||
@@ -88,12 +86,12 @@ async function createNewJSFile(walkthroughState: JsWalkthroughState) {
|
||||
async function debugJsFile(walkthroughState: JsWalkthroughState) {
|
||||
const hasNode = await nodeWasResolvable();
|
||||
if (!hasNode) {
|
||||
const reloadResponse = localize('reloadWindowForNode', 'Reload VS Code');
|
||||
const debugAnywayResponse = localize('nodeNotFoundDebugAnyway', 'Try Debugging Anyway');
|
||||
const dismissResponse = localize('nodeNotFoundDismissDialog', 'Dismiss');
|
||||
const reloadResponse = vscode.l10n.t("Reload VS Code");
|
||||
const debugAnywayResponse = vscode.l10n.t("Try Debugging Anyway");
|
||||
const dismissResponse = vscode.l10n.t("Dismiss");
|
||||
const response = await vscode.window.showErrorMessage(
|
||||
// The message
|
||||
localize('noNodeInstallFound', 'We couldn\'t find Node.js on this computer. If you just installed it, you might need to reload VS Code.'),
|
||||
vscode.l10n.t("We couldn\'t find Node.js on this computer. If you just installed it, you might need to reload VS Code."),
|
||||
// The options
|
||||
reloadResponse,
|
||||
debugAnywayResponse,
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SelectTypeScriptVersionCommand } from '../commands/selectTypeScriptVersion';
|
||||
import { TypeScriptVersion } from '../tsServer/versionProvider';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { jsTsLanguageModes } from '../utils/languageIds';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class VersionStatus extends Disposable {
|
||||
|
||||
@@ -24,8 +22,8 @@ export class VersionStatus extends Disposable {
|
||||
|
||||
this._statusItem = this._register(vscode.languages.createLanguageStatusItem('typescript.version', jsTsLanguageModes));
|
||||
|
||||
this._statusItem.name = localize('versionStatus.name', "TypeScript Version");
|
||||
this._statusItem.detail = localize('versionStatus.detail', "TypeScript Version");
|
||||
this._statusItem.name = vscode.l10n.t("TypeScript Version");
|
||||
this._statusItem.detail = vscode.l10n.t("TypeScript Version");
|
||||
|
||||
this._register(this._client.onTsServerStarted(({ version }) => this.onDidChangeTypeScriptVersion(version)));
|
||||
}
|
||||
@@ -34,7 +32,7 @@ export class VersionStatus extends Disposable {
|
||||
this._statusItem.text = version.displayName;
|
||||
this._statusItem.command = {
|
||||
command: SelectTypeScriptVersionCommand.id,
|
||||
title: localize('versionStatus.command', "Select Version"),
|
||||
title: vscode.l10n.t("Select Version"),
|
||||
tooltip: version.path
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as semver from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class API {
|
||||
public static fromSimpleString(value: string): API {
|
||||
@@ -46,7 +45,7 @@ export default class API {
|
||||
public static fromVersionString(versionString: string): API {
|
||||
let version = semver.valid(versionString);
|
||||
if (!version) {
|
||||
return new API(localize('invalidVersion', 'invalid version'), '1.0.0', '1.0.0');
|
||||
return new API(vscode.l10n.t("invalid version"), '1.0.0', '1.0.0');
|
||||
}
|
||||
|
||||
// Cut off any prerelease tag since we sometimes consume those on purpose.
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { loadMessageBundle } from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { TelemetryReporter } from './telemetry';
|
||||
import { isImplicitProjectConfigFile, openOrCreateConfig, ProjectType } from './tsconfig';
|
||||
|
||||
const localize = loadMessageBundle();
|
||||
|
||||
interface Hint {
|
||||
message: string;
|
||||
@@ -24,7 +22,7 @@ class ExcludeHintItem {
|
||||
private readonly telemetryReporter: TelemetryReporter
|
||||
) {
|
||||
this._item = vscode.window.createStatusBarItem('status.typescript.exclude', vscode.StatusBarAlignment.Right, 98 /* to the right of typescript version status (99) */);
|
||||
this._item.name = localize('statusExclude', "TypeScript: Configure Excludes");
|
||||
this._item.name = vscode.l10n.t("TypeScript: Configure Excludes");
|
||||
this._item.command = 'js.projectStatus.command';
|
||||
}
|
||||
|
||||
@@ -39,12 +37,12 @@ class ExcludeHintItem {
|
||||
public show(largeRoots?: string) {
|
||||
this._currentHint = {
|
||||
message: largeRoots
|
||||
? localize('hintExclude', "To enable project-wide JavaScript/TypeScript language features, exclude folders with many files, like: {0}", largeRoots)
|
||||
: localize('hintExclude.generic', "To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on.")
|
||||
? vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude folders with many files, like: {0}", largeRoots)
|
||||
: vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on.")
|
||||
};
|
||||
this._item.tooltip = this._currentHint.message;
|
||||
this._item.text = localize('large.label', "Configure Excludes");
|
||||
this._item.tooltip = localize('hintExclude.tooltip', "To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on.");
|
||||
this._item.text = vscode.l10n.t("Configure Excludes");
|
||||
this._item.tooltip = vscode.l10n.t("To enable project-wide JavaScript/TypeScript language features, exclude large folders with source files that you do not work on.");
|
||||
this._item.color = '#A5DF3B';
|
||||
this._item.show();
|
||||
/* __GDPR__
|
||||
@@ -76,7 +74,7 @@ function createLargeProjectMonitorFromTypeScript(item: ExcludeHintItem, client:
|
||||
item.configFileName = configFileName;
|
||||
vscode.window.showWarningMessage<LargeProjectMessageItem>(item.getCurrentHint().message,
|
||||
{
|
||||
title: localize('large.label', "Configure Excludes"),
|
||||
title: vscode.l10n.t("Configure Excludes"),
|
||||
index: 0
|
||||
}).then(selected => {
|
||||
if (selected && selected.index === 0) {
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { TsServerLogLevel } from './configuration';
|
||||
import { Disposable } from './dispose';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class LogLevelMonitor extends Disposable {
|
||||
|
||||
@@ -78,19 +76,13 @@ export class LogLevelMonitor extends Disposable {
|
||||
}
|
||||
|
||||
vscode.window.showInformationMessage<Item>(
|
||||
localize(
|
||||
'typescript.extendedLogging.isEnabled',
|
||||
"TS Server logging is currently enabled which may impact performance."),
|
||||
vscode.l10n.t("TS Server logging is currently enabled which may impact performance."),
|
||||
{
|
||||
title: localize(
|
||||
'typescript.extendedLogging.disableLogging',
|
||||
"Disable logging"),
|
||||
title: vscode.l10n.t("Disable logging"),
|
||||
choice: Choice.DisableLogging
|
||||
},
|
||||
{
|
||||
title: localize(
|
||||
'typescript.extendedLogging.doNotShowAgain',
|
||||
"Don't show again"),
|
||||
title: vscode.l10n.t("Don't show again"),
|
||||
choice: Choice.DoNotShowAgain
|
||||
})
|
||||
.then(selection => {
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { memoize } from './memoize';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
type LogLevel = 'Trace' | 'Info' | 'Error';
|
||||
|
||||
@@ -15,7 +13,7 @@ export class Logger {
|
||||
|
||||
@memoize
|
||||
private get output(): vscode.OutputChannel {
|
||||
return vscode.window.createOutputChannel(localize('channelName', 'TypeScript'));
|
||||
return vscode.window.createOutputChannel('TypeScript');
|
||||
}
|
||||
|
||||
private data2String(data: any): string {
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||
import { nulToken } from '../utils/cancellation';
|
||||
import { TypeScriptServiceConfiguration } from './configuration';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export const enum ProjectType {
|
||||
TypeScript,
|
||||
@@ -121,14 +119,14 @@ export async function openProjectConfigOrPromptToCreate(
|
||||
|
||||
const CreateConfigItem: vscode.MessageItem = {
|
||||
title: projectType === ProjectType.TypeScript
|
||||
? localize('typescript.configureTsconfigQuickPick', 'Configure tsconfig.json')
|
||||
: localize('typescript.configureJsconfigQuickPick', 'Configure jsconfig.json'),
|
||||
? vscode.l10n.t("Configure tsconfig.json")
|
||||
: vscode.l10n.t("Configure jsconfig.json"),
|
||||
};
|
||||
|
||||
const selected = await vscode.window.showInformationMessage(
|
||||
(projectType === ProjectType.TypeScript
|
||||
? localize('typescript.noTypeScriptProjectConfig', 'File is not part of a TypeScript project. View the [tsconfig.json documentation]({0}) to learn more.', 'https://go.microsoft.com/fwlink/?linkid=841896')
|
||||
: localize('typescript.noJavaScriptProjectConfig', 'File is not part of a JavaScript project. View the [jsconfig.json documentation]({0}) to learn more.', 'https://go.microsoft.com/fwlink/?linkid=759670')
|
||||
? vscode.l10n.t("File is not part of a TypeScript project. View the [tsconfig.json documentation]({0}) to learn more.", 'https://go.microsoft.com/fwlink/?linkid=841896')
|
||||
: vscode.l10n.t("File is not part of a JavaScript project. View the [jsconfig.json documentation]({0}) to learn more.", 'https://go.microsoft.com/fwlink/?linkid=759670')
|
||||
),
|
||||
CreateConfigItem);
|
||||
|
||||
@@ -147,9 +145,7 @@ export async function openProjectConfigForFile(
|
||||
const rootPath = client.getWorkspaceRootForResource(resource);
|
||||
if (!rootPath) {
|
||||
vscode.window.showInformationMessage(
|
||||
localize(
|
||||
'typescript.projectConfigNoWorkspace',
|
||||
'Please open a folder in VS Code to use a TypeScript or JavaScript project'));
|
||||
vscode.l10n.t("Please open a folder in VS Code to use a TypeScript or JavaScript project"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,9 +153,7 @@ export async function openProjectConfigForFile(
|
||||
// TSServer errors when 'projectInfo' is invoked on a non js/ts file
|
||||
if (!file || !await client.toPath(resource)) {
|
||||
vscode.window.showWarningMessage(
|
||||
localize(
|
||||
'typescript.projectConfigUnsupportedFile',
|
||||
'Could not determine TypeScript or JavaScript project. Unsupported file type'));
|
||||
vscode.l10n.t("Could not determine TypeScript or JavaScript project. Unsupported file type"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,7 +165,7 @@ export async function openProjectConfigForFile(
|
||||
}
|
||||
|
||||
if (res?.type !== 'response' || !res.body) {
|
||||
vscode.window.showWarningMessage(localize('typescript.projectConfigCouldNotGetInfo', 'Could not determine TypeScript or JavaScript project'));
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("Could not determine TypeScript or JavaScript project"));
|
||||
return;
|
||||
}
|
||||
return openProjectConfigOrPromptToCreate(projectType, client, rootPath, res.body.configFileName);
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { loadMessageBundle } from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { Disposable } from './dispose';
|
||||
|
||||
const localize = loadMessageBundle();
|
||||
|
||||
const typingsInstallTimeout = 30 * 1000;
|
||||
|
||||
@@ -84,7 +82,7 @@ export class AtaProgressReporter extends Disposable {
|
||||
|
||||
vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('installingPackages', "Fetching data for better TypeScript IntelliSense")
|
||||
title: vscode.l10n.t("Fetching data for better TypeScript IntelliSense")
|
||||
}, () => promise);
|
||||
}
|
||||
|
||||
@@ -101,11 +99,10 @@ export class AtaProgressReporter extends Disposable {
|
||||
|
||||
if (config.get<boolean>('check.npmIsInstalled', true)) {
|
||||
const dontShowAgain: vscode.MessageItem = {
|
||||
title: localize('typesInstallerInitializationFailed.doNotCheckAgain', "Don't Show Again"),
|
||||
title: vscode.l10n.t("Don't Show Again"),
|
||||
};
|
||||
const selected = await vscode.window.showWarningMessage(
|
||||
localize(
|
||||
'typesInstallerInitializationFailed.title',
|
||||
vscode.l10n.t(
|
||||
"Could not install typings files for JavaScript language features. Please ensure that NPM is installed, or configure 'typescript.npm' in your user settings. Alternatively, check the [documentation]({0}) to learn more.",
|
||||
'https://go.microsoft.com/fwlink/?linkid=847635'
|
||||
),
|
||||
|
||||
@@ -85,11 +85,6 @@ tas-client@0.1.58:
|
||||
dependencies:
|
||||
axios "^0.26.1"
|
||||
|
||||
vscode-nls@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f"
|
||||
integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==
|
||||
|
||||
vscode-tas-client@^0.1.63:
|
||||
version "0.1.63"
|
||||
resolved "https://registry.yarnpkg.com/vscode-tas-client/-/vscode-tas-client-0.1.63.tgz#df89e67e9bf7ecb46471a0fb8a4a522d2aafad65"
|
||||
|
||||
Reference in New Issue
Block a user