chore: adopt new localization pipeline (#1515)

* chore: adopt new localization pipeline

Fixes https://github.com/microsoft/vscode/issues/164438

* update

* add l10n path

* update

* update

* fix function name

* fixup
This commit is contained in:
Connor Peet 2023-01-14 13:30:20 -08:00 коммит произвёл GitHub
Родитель 749f75d6b2
Коммит 175d9120d2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
60 изменённых файлов: 17645 добавлений и 16356 удалений

Просмотреть файл

@ -38,3 +38,6 @@ extends:
- script: npm run compile -- package:prepare
displayName: Package Stable
- script: npx -y @vscode/l10n-dev export --outDir ./l10n-extract ./src
displayName: Extract localization

Просмотреть файл

@ -6,7 +6,6 @@ const del = require('del');
const filter = require('gulp-filter');
const gulp = require('gulp');
const minimist = require('minimist');
const nls = require('vscode-nls-dev');
const path = require('path');
const sourcemaps = require('gulp-sourcemaps');
const tsb = require('gulp-tsb');
@ -26,9 +25,6 @@ const got = require('got').default;
const execa = require('execa');
const dirname = 'js-debug';
const translationProjectName = 'vscode-extensions';
const translationExtensionName = 'js-debug';
const sources = ['src/**/*.{ts,tsx}'];
const allPackages = [];
@ -191,7 +187,7 @@ async function runWebpack({
];
let todo = [];
for (const { entry, target, library, filename } of packages) {
for (const { entry, target, library, filename, isInExtension } of packages) {
const config = {
mode,
target: target || 'async-node',
@ -203,7 +199,7 @@ async function runWebpack({
},
devtool: devtool,
resolve: {
extensions: ['.js', '.json'],
extensions: isInExtension ? ['.js', '.json'] : ['.js', '.json'],
alias: {
// their .mjs seems broken:
acorn: require.resolve('acorn'),
@ -213,12 +209,6 @@ async function runWebpack({
},
module: {
rules: [
{
loader: 'vscode-nls-dev/lib/webpack-loader',
options: {
base: path.join(__dirname, 'out/src'),
},
},
{
test: '\\.node$', // will be regex'd in the webpackBuild script
loader: 'node-loader',
@ -243,6 +233,13 @@ async function runWebpack({
config.output.libraryTarget = 'commonjs2';
}
if (isInExtension) {
config.resolve.alias['@vscode/l10n'] = path.resolve(
__dirname,
`${buildSrcDir}/common/l10n.extensionOnly.js`,
);
}
todo.push(
execa('node', [path.join(__dirname, 'src/build/webpackBuild')], {
stdio: 'inherit',
@ -251,6 +248,7 @@ async function runWebpack({
CONFIG: JSON.stringify(config),
ANALYZE_SIZE: String(process.argv.includes('--analyze-size')),
WATCH: String(watch),
USE_VSCODE_L10N: Boolean(isInExtension),
},
}),
);
@ -262,7 +260,12 @@ async function runWebpack({
/** Run webpack to bundle the extension output files */
gulp.task('package:webpack-bundle', async () => {
const packages = [
{ entry: `${buildSrcDir}/extension.js`, filename: 'extension.js', library: true },
{
entry: `${buildSrcDir}/extension.js`,
filename: 'extension.js',
library: true,
isInExtension: true,
},
];
return runWebpack({ packages });
});
@ -321,60 +324,6 @@ gulp.task('package:createVSIX', () =>
}),
);
gulp.task('nls:bundle-download', async () => {
const res = await got.stream('https://github.com/microsoft/vscode-loc/archive/main.zip');
await new Promise((resolve, reject) =>
res
.pipe(unzipper.Parse())
.on('entry', entry => {
const match = /vscode-language-pack-(.*?)\/.+ms-vscode\.js-debug.*?\.i18n\.json$/.exec(
entry.path,
);
if (!match) {
return entry.autodrain();
}
const buffer = new streamBuffers.WritableStreamBuffer();
const locale = match[1];
entry.pipe(buffer).on('finish', () => {
try {
const strings = JSON.parse(buffer.getContentsAsString('utf-8'));
fs.writeFileSync(
path.join(distDir, `nls.bundle.${locale}.json`),
JSON.stringify(strings.contents),
);
signale.info(`Added strings for ${locale}`);
} catch (e) {
reject(`Error parsing ${entry.path}: ${e}`);
}
});
})
.on('end', resolve)
.on('error', reject)
.resume(),
);
});
gulp.task('nls:bundle-create', () =>
gulp
.src(sources, { base: __dirname })
.pipe(nls.createMetaDataFiles())
.pipe(nls.bundleMetaDataFiles(`ms-vscode.${extensionName}`, ''))
.pipe(nls.bundleLanguageFiles())
.pipe(filter('**/nls.*.json'))
.pipe(gulp.dest('dist')),
);
gulp.task(
'translations-export',
gulp.series('clean', 'compile', 'nls:bundle-create', () =>
gulp
.src(['out/package.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles(translationProjectName, translationExtensionName))
.pipe(gulp.dest(`../vscode-translations-export`)),
),
);
/** Clean, compile, bundle, and create vsix for the extension */
gulp.task(
'package:prepare',
@ -386,7 +335,6 @@ gulp.task(
'package:webpack-bundle',
'package:bootloader-as-cdp',
'package:copy-extension-files',
'nls:bundle-create',
'package:createVSIX',
),
);
@ -401,7 +349,6 @@ gulp.task(
'flatSessionBundle:webpack-bundle',
'package:bootloader-as-cdp',
'package:copy-extension-files',
gulp.parallel('nls:bundle-download', 'nls:bundle-create'),
),
);
@ -415,7 +362,6 @@ gulp.task(
'flatSessionBundle:webpack-bundle',
'package:bootloader-as-cdp',
'package:copy-extension-files',
gulp.parallel('nls:bundle-download', 'nls:bundle-create'),
),
);

543
package-lock.json сгенерированный
Просмотреть файл

@ -11,6 +11,7 @@
"dependencies": {
"@c4312/chromehash": "^0.3.0",
"@vscode/js-debug-browsers": "^1.0.8",
"@vscode/l10n": "^0.0.10",
"@vscode/win32-app-container-tokens": "^0.1.0",
"acorn": "^8.7.0",
"acorn-loose": "^8.3.0",
@ -36,7 +37,6 @@
"source-map-support": "^0.5.21",
"split2": "^4.1.0",
"to-absolute-glob": "^2.0.2",
"vscode-nls": "^5.0.0",
"vscode-tas-client": "^0.1.42",
"ws": "^8.5.0"
},
@ -120,7 +120,6 @@
"vsce": "^2.7.0",
"vscode-debugadapter-testsupport": "^1.47.0",
"vscode-debugprotocol": "^1.47.0",
"vscode-nls-dev": "^4.0.0",
"webpack": "^5.70.0",
"webpack-bundle-analyzer": "^4.5.0"
},
@ -2256,6 +2255,11 @@
"node": ">= 8"
}
},
"node_modules/@vscode/l10n": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.10.tgz",
"integrity": "sha512-E1OCmDcDWa0Ya7vtSjp/XfHFGqYJfh+YPC1RkATU71fTac+j1JjCcB3qwSzmlKAighx2WxhLlfhS0RwAN++PFQ=="
},
"node_modules/@vscode/test-electron": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.1.5.tgz",
@ -5814,21 +5818,6 @@
"es5-ext": "~0.10.14"
}
},
"node_modules/event-stream": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz",
"integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==",
"dev": true,
"dependencies": {
"duplexer": "^0.1.1",
"from": "^0.1.7",
"map-stream": "0.0.7",
"pause-stream": "^0.0.11",
"split": "^1.0.1",
"stream-combiner": "^0.2.2",
"through": "^2.3.8"
}
},
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@ -6666,12 +6655,6 @@
"node": ">= 0.6"
}
},
"node_modules/from": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
"node_modules/fromentries": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz",
@ -7252,6 +7235,7 @@
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/gulp-tsb/-/gulp-tsb-4.0.6.tgz",
"integrity": "sha512-55HSu1zvOOq7D+OqPScvGQaJPKveLbM1T5jEnSJUhbcbwX1Kx0SWv4UVe7MfFcBwFe3wMiWSkKoajNONEv5E9g==",
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
"dev": true,
"dependencies": {
"ansi-colors": "^1.0.1",
@ -7839,15 +7823,6 @@
"node": ">= 0.10"
}
},
"node_modules/is": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz",
"integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==",
"dev": true,
"engines": {
"node": "*"
}
},
"node_modules/is-absolute": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
@ -9271,12 +9246,6 @@
"node": ">=0.10.0"
}
},
"node_modules/map-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz",
"integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=",
"dev": true
},
"node_modules/map-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
@ -12124,15 +12093,6 @@
"node": "*"
}
},
"node_modules/pause-stream": {
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"dev": true,
"dependencies": {
"through": "~2.3"
}
},
"node_modules/pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
@ -13891,18 +13851,6 @@
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
"dev": true
},
"node_modules/split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"dev": true,
"dependencies": {
"through": "2"
},
"engines": {
"node": "*"
}
},
"node_modules/split-string": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
@ -13981,16 +13929,6 @@
"node": ">= 0.10.0"
}
},
"node_modules/stream-combiner": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
"dev": true,
"dependencies": {
"duplexer": "~0.1.1",
"through": "~2.3.4"
}
},
"node_modules/stream-exhaust": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz",
@ -14466,7 +14404,7 @@
"node_modules/through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
"dev": true
},
"node_modules/through2": {
@ -15403,214 +15341,6 @@
"deprecated": "This package has been renamed to @vscode/debugprotocol, please update to the new name",
"dev": true
},
"node_modules/vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA=="
},
"node_modules/vscode-nls-dev": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls-dev/-/vscode-nls-dev-4.0.0.tgz",
"integrity": "sha512-2JcEOy1EQKcF8JhtYfFdwAkzxFKrB2ZbHoQwKkzEFOc/RlLAPqO3laBvO2wK4k6G4XUCno/XLQjuDM33/+baRg==",
"dev": true,
"dependencies": {
"ansi-colors": "^4.1.1",
"clone": "^2.1.2",
"event-stream": "^3.3.4",
"fancy-log": "^1.3.3",
"glob": "^7.2.0",
"iconv-lite": "^0.6.3",
"is": "^3.3.0",
"source-map": "^0.6.1",
"typescript": "^4.5.4",
"vinyl": "^2.2.1",
"xml2js": "^0.4.23",
"yargs": "^17.3.0"
},
"bin": {
"vscl": "lib/vscl.js"
}
},
"node_modules/vscode-nls-dev/node_modules/ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/vscode-nls-dev/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/vscode-nls-dev/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/vscode-nls-dev/node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"node_modules/vscode-nls-dev/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/vscode-nls-dev/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/vscode-nls-dev/node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/vscode-nls-dev/node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/vscode-nls-dev/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/vscode-nls-dev/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/vscode-nls-dev/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/vscode-nls-dev/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/vscode-nls-dev/node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/vscode-nls-dev/node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/vscode-nls-dev/node_modules/yargs": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz",
"integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==",
"dev": true,
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/vscode-nls-dev/node_modules/yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"node_modules/vscode-tas-client": {
"version": "0.1.42",
"resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.42.tgz",
@ -17854,6 +17584,11 @@
}
}
},
"@vscode/l10n": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.10.tgz",
"integrity": "sha512-E1OCmDcDWa0Ya7vtSjp/XfHFGqYJfh+YPC1RkATU71fTac+j1JjCcB3qwSzmlKAighx2WxhLlfhS0RwAN++PFQ=="
},
"@vscode/test-electron": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.1.5.tgz",
@ -18069,15 +17804,13 @@
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
"integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
"dev": true,
"requires": {}
"dev": true
},
"acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"dev": true,
"requires": {}
"dev": true
},
"acorn-loose": {
"version": "8.3.0",
@ -18128,8 +17861,7 @@
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true,
"requires": {}
"dev": true
},
"ansi-colors": {
"version": "1.1.0",
@ -19099,8 +18831,7 @@
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.5.0.tgz",
"integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==",
"dev": true,
"requires": {}
"dev": true
},
"chai-subset": {
"version": "1.6.0",
@ -20513,8 +20244,7 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz",
"integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==",
"dev": true,
"requires": {}
"dev": true
},
"eslint-plugin-react": {
"version": "7.29.4",
@ -20668,21 +20398,6 @@
"es5-ext": "~0.10.14"
}
},
"event-stream": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz",
"integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==",
"dev": true,
"requires": {
"duplexer": "^0.1.1",
"from": "^0.1.7",
"map-stream": "0.0.7",
"pause-stream": "^0.0.11",
"split": "^1.0.1",
"stream-combiner": "^0.2.2",
"through": "^2.3.8"
}
},
"events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@ -21359,12 +21074,6 @@
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
"dev": true
},
"from": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
"fromentries": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz",
@ -22139,8 +21848,7 @@
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz",
"integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==",
"dev": true,
"requires": {}
"dev": true
},
"ieee754": {
"version": "1.2.1",
@ -22230,12 +21938,6 @@
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"dev": true
},
"is": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz",
"integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==",
"dev": true
},
"is-absolute": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
@ -23361,12 +23063,6 @@
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
"dev": true
},
"map-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz",
"integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=",
"dev": true
},
"map-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
@ -25536,15 +25232,6 @@
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
"dev": true
},
"pause-stream": {
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"dev": true,
"requires": {
"through": "~2.3"
}
},
"pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
@ -25760,8 +25447,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz",
"integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==",
"dev": true,
"requires": {}
"dev": true
},
"postcss-modules-local-by-default": {
"version": "4.0.0",
@ -26894,15 +26580,6 @@
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
"dev": true
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"dev": true,
"requires": {
"through": "2"
}
},
"split-string": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
@ -26962,16 +26639,6 @@
"integrity": "sha512-DQi1h8VEBA/lURbSwFtEHnSTb9s2/pwLEaFuNhXwy1Dx3Sa0lOuYT2yNUr4/j2fs8oCAMANtrZ5OrPZtyVs3MQ==",
"dev": true
},
"stream-combiner": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
"dev": true,
"requires": {
"duplexer": "~0.1.1",
"through": "~2.3.4"
}
},
"stream-exhaust": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz",
@ -27184,8 +26851,7 @@
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.1.tgz",
"integrity": "sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ==",
"dev": true,
"requires": {}
"dev": true
},
"supports-color": {
"version": "5.4.0",
@ -27317,7 +26983,7 @@
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
"dev": true
},
"through2": {
@ -28085,165 +27751,6 @@
"integrity": "sha512-ii7oCz3Wfr/SGtFr5AYop5dJm0dUmpg0hq2lTzTBdaht8nSheYMMjPntxULBR+2TUxXLcCKFZkF2UEJQduYsIQ==",
"dev": true
},
"vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA=="
},
"vscode-nls-dev": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls-dev/-/vscode-nls-dev-4.0.0.tgz",
"integrity": "sha512-2JcEOy1EQKcF8JhtYfFdwAkzxFKrB2ZbHoQwKkzEFOc/RlLAPqO3laBvO2wK4k6G4XUCno/XLQjuDM33/+baRg==",
"dev": true,
"requires": {
"ansi-colors": "^4.1.1",
"clone": "^2.1.2",
"event-stream": "^3.3.4",
"fancy-log": "^1.3.3",
"glob": "^7.2.0",
"iconv-lite": "^0.6.3",
"is": "^3.3.0",
"source-map": "^0.6.1",
"typescript": "^4.5.4",
"vinyl": "^2.2.1",
"xml2js": "^0.4.23",
"yargs": "^17.3.0"
},
"dependencies": {
"ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true
},
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
}
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.1"
}
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
}
},
"y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true
},
"yargs": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz",
"integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==",
"dev": true,
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
}
},
"yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==",
"dev": true
}
}
},
"vscode-tas-client": {
"version": "0.1.42",
"resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.42.tgz",
@ -28378,8 +27885,7 @@
"version": "7.5.7",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz",
"integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==",
"dev": true,
"requires": {}
"dev": true
}
}
},
@ -28494,8 +28000,7 @@
"ws": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
"requires": {}
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg=="
},
"xdg-default-browser": {
"version": "2.1.0",

Просмотреть файл

@ -50,6 +50,7 @@
"dependencies": {
"@c4312/chromehash": "^0.3.0",
"@vscode/js-debug-browsers": "^1.0.8",
"@vscode/l10n": "^0.0.10",
"@vscode/win32-app-container-tokens": "^0.1.0",
"acorn": "^8.7.0",
"acorn-loose": "^8.3.0",
@ -75,7 +76,6 @@
"source-map-support": "^0.5.21",
"split2": "^4.1.0",
"to-absolute-glob": "^2.0.2",
"vscode-nls": "^5.0.0",
"vscode-tas-client": "^0.1.42",
"ws": "^8.5.0"
},
@ -166,7 +166,6 @@
"vsce": "^2.7.0",
"vscode-debugadapter-testsupport": "^1.47.0",
"vscode-debugprotocol": "^1.47.0",
"vscode-nls-dev": "^4.0.0",
"webpack": "^5.70.0",
"webpack-bundle-analyzer": "^4.5.0"
},

Просмотреть файл

@ -9,7 +9,7 @@ import { Event } from 'vscode';
import { EventEmitter } from '../common/events';
import { OutFiles } from '../common/fileGlobList';
import { ILogger, LogTag } from '../common/logging';
import { forceForwardSlashes } from '../common/pathUtils';
import { fixDriveLetterAndSlashes, forceForwardSlashes } from '../common/pathUtils';
import { ISourceMapMetadata } from '../common/sourceMaps/sourceMap';
import { ISourceMapFactory } from '../common/sourceMaps/sourceMapFactory';
import {
@ -144,7 +144,7 @@ export abstract class BreakpointSearch {
});
}
return { discovered, compiledPath: metadata.compiledPath };
return { discovered, compiledPath: fixDriveLetterAndSlashes(metadata.compiledPath) };
},
onProcessedMap: ({ discovered }) => {
for (const discovery of discovered) {

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import Cdp from '../../cdp/api';
import { getDeferred } from '../../common/promiseUtil';
import Dap from '../../dap/api';
@ -10,8 +10,6 @@ import { BreakpointManager } from '../breakpoints';
import { Breakpoint, BreakpointCdpReference, CdpReferenceState } from './breakpointBase';
import { IBreakpointCondition } from './conditions';
const localize = nls.loadMessageBundle();
export class UserDefinedBreakpoint extends Breakpoint {
/**
* A deferred that resolves once the breakpoint 'set' response has been
@ -89,7 +87,7 @@ export class UserDefinedBreakpoint extends Breakpoint {
return {
id: this.dapId,
verified: false,
message: localize('breakpoint.provisionalBreakpoint', `Unbound breakpoint`), // TODO: Put a useful message here
message: l10n.t('Unbound breakpoint'), // TODO: Put a useful message here
};
}

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import Cdp from '../../cdp/api';
import Dap from '../../dap/api';
import { previewRemoteObject } from '../objectPreview';
@ -10,8 +10,6 @@ import { previewThis } from '../templates/previewThis';
import { Thread } from '../threads';
import { IConsoleMessage } from './consoleMessage';
const localize = nls.loadMessageBundle();
/**
* Message sent as the result of querying objects on the runtime.
*/
@ -22,7 +20,7 @@ export class QueryObjectsMessage implements IConsoleMessage {
if (!this.protoObj.objectId) {
return {
category: 'stderr',
output: localize('queryObject.invalidObject', 'Only objects can be queried'),
output: l10n.t('Only objects can be queried'),
};
}
@ -35,7 +33,7 @@ export class QueryObjectsMessage implements IConsoleMessage {
if (!response) {
return {
category: 'stderr',
output: localize('queryObject.couldNotQuery', 'Could not query the provided object'),
output: l10n.t('Could not query the provided object'),
};
}
@ -51,7 +49,7 @@ export class QueryObjectsMessage implements IConsoleMessage {
} catch (e) {
return {
category: 'stderr',
output: localize('queryObject.errorPreview', 'Could generate preview: {0}', e.message),
output: l10n.t(e.message),
};
}

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import Cdp from '../../cdp/api';
import { once } from '../../common/objUtils';
import { StackTraceParser } from '../../common/stackTraceParser';
@ -15,8 +15,6 @@ import { StackFrame, StackTrace } from '../stackTrace';
import { Thread } from '../threads';
import { IConsoleMessage } from './consoleMessage';
const localize = nls.loadMessageBundle();
export abstract class TextualMessage<T extends { stackTrace?: Cdp.Runtime.StackTrace }>
implements IConsoleMessage
{
@ -129,7 +127,7 @@ export class AssertMessage extends TextualMessage<Cdp.Runtime.ConsoleAPICalledEv
*/
public async toDap(thread: Thread): Promise<Dap.OutputEventParams> {
if (this.event.args[0]?.value === 'console.assert') {
this.event.args[0].value = localize('console.assert', 'Assertion failed');
this.event.args[0].value = l10n.t('Assertion failed');
}
return {

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import Cdp from '../cdp/api';
import * as nls from 'vscode-nls';
export type CustomBreakpointId = string;
@ -20,8 +20,6 @@ const map: Map<string, ICustomBreakpoint> = new Map();
export function customBreakpoints(): Map<string, ICustomBreakpoint> {
if (map.size) return map;
const localize = nls.loadMessageBundle();
function g(group: string, breakpoints: ICustomBreakpoint[]) {
for (const b of breakpoints) {
b.group = group;
@ -42,9 +40,8 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
// If there is a hex code of the error, display only this.
errorName = errorName.replace(/^.*(0x[0-9a-f]+).*$/i, '$1');
return {
short: localize('breakpoint.webglErrorNamed', 'WebGL Error "{0}"', errorName),
long: localize(
'breakpoint.webglErrorNamedDetails',
short: errorName,
long: l10n.t(
'Paused on WebGL Error instrumentation breakpoint, error "{0}"',
errorName,
),
@ -52,13 +49,8 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
}
if (instrumentation === 'scriptBlockedByCSP' && data['directiveText']) {
return {
short: localize(
'breakpoint.cspViolationNamed',
'CSP violation "{0}"',
data['directiveText'],
),
long: localize(
'breakpoint.cspViolationNamedDetails',
short: l10n.t('CSP violation "{0}"', data['directiveText']),
long: l10n.t(
'Paused on Content Security Policy violation instrumentation breakpoint, directive "{0}"',
data['directiveText'],
),
@ -66,11 +58,7 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
}
return {
short: title,
long: localize(
'breakpoint.instrumentationNamed',
'Paused on instrumentation breakpoint "{0}"',
title,
),
long: l10n.t('Paused on instrumentation breakpoint "{0}"', title),
};
},
apply: async (cdp: Cdp.Api, enabled: boolean): Promise<boolean> => {
@ -97,8 +85,7 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
const eventTargetName = (data.targetName || '*').toLowerCase();
return {
short: eventTargetName + '.' + eventName,
long: localize(
'breakpoint.eventListenerNamed',
long: l10n.t(
'Paused on event listener breakpoint "{0}", triggered on "{1}"',
eventName,
eventTargetName,
@ -129,33 +116,18 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
}
g(`Animation`, [
i(
'requestAnimationFrame',
localize('breakpoint.requestAnimationFrame', 'Request Animation Frame'),
),
i(
'cancelAnimationFrame',
localize('breakpoint.cancelAnimationFrame', 'Cancel Animation Frame'),
),
i(
'requestAnimationFrame.callback',
localize('breakpoint.animationFrameFired', 'Animation Frame Fired'),
),
i('requestAnimationFrame', l10n.t('Request Animation Frame')),
i('cancelAnimationFrame', l10n.t('Cancel Animation Frame')),
i('requestAnimationFrame.callback', l10n.t('Animation Frame Fired')),
]);
g(`Canvas`, [
i('canvasContextCreated', localize('breakpoint.createCanvasContext', 'Create canvas context')),
i('webglErrorFired', localize('breakpoint.webglErrorFired', 'WebGL Error Fired')),
i('webglWarningFired', localize('breakpoint.webglWarningFired', 'WebGL Warning Fired')),
i('canvasContextCreated', l10n.t('Create canvas context')),
i('webglErrorFired', l10n.t('WebGL Error Fired')),
i('webglWarningFired', l10n.t('WebGL Warning Fired')),
]);
g(`Script`, [
i(
'scriptFirstStatement',
localize('breakpoint.scriptFirstStatement', 'Script First Statement'),
),
i(
'scriptBlockedByCSP',
localize('breakpoint.cspViolation', 'Script Blocked by Content Security Policy'),
),
i('scriptFirstStatement', l10n.t('Script First Statement')),
i('scriptBlockedByCSP', l10n.t('Script Blocked by Content Security Policy')),
]);
g(`Geolocation`, [
i('Geolocation.getCurrentPosition', `getCurrentPosition`),
@ -163,7 +135,7 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
]);
g(`Notification`, [i('Notification.requestPermission', `requestPermission`)]);
g(`Parse`, [
i('Element.setInnerHTML', localize('breakpoint.setInnerHtml', 'Set innerHTML')),
i('Element.setInnerHTML', l10n.t('Set innerHTML')),
i('Document.write', `document.write`),
]);
g(`Timer`, [
@ -171,15 +143,15 @@ export function customBreakpoints(): Map<string, ICustomBreakpoint> {
i('clearTimeout'),
i('setInterval'),
i('clearInterval'),
i('setTimeout.callback', localize('breakpoint.setTimeoutFired', 'setTimeout fired')),
i('setInterval.callback', localize('breakpoint.setIntervalFired', 'setInterval fired')),
i('setTimeout.callback', l10n.t('setTimeout fired')),
i('setInterval.callback', l10n.t('setInterval fired')),
]);
g(`Window`, [i('DOMWindow.close', `window.close`)]);
g(`WebAudio`, [
i('audioContextCreated', localize('breakpoint.createAudioContext', 'Create AudioContext')),
i('audioContextClosed', localize('breakpoint.closeAudioContext', 'Close AudioContext')),
i('audioContextResumed', localize('breakpoint.resumeAudioContext', 'Resume AudioContext')),
i('audioContextSuspended', localize('breakpoint.suspendAudioContext', 'Suspend AudioContext')),
i('audioContextCreated', l10n.t('Create AudioContext')),
i('audioContextClosed', l10n.t('Close AudioContext')),
i('audioContextResumed', l10n.t('Resume AudioContext')),
i('audioContextSuspended', l10n.t('Suspend AudioContext')),
]);
const av = ['audio', 'video'];
g(`Media`, [

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { Container } from 'inversify';
import * as nls from 'vscode-nls';
import { Cdp } from '../cdp/api';
import { DisposableList, IDisposable } from '../common/disposable';
import { ILogger, LogTag } from '../common/logging';
@ -40,8 +40,6 @@ import { ISourceWithMap, SourceContainer, SourceFromMap } from './sources';
import { Thread } from './threads';
import { VariableStore } from './variableStore';
const localize = nls.loadMessageBundle();
// This class collects configuration issued before "launch" request,
// to be applied after launch.
export class DebugAdapter implements IDisposable {
@ -219,24 +217,18 @@ export class DebugAdapter implements IDisposable {
exceptionBreakpointFilters: [
{
filter: PauseOnExceptionsState.All,
label: localize('breakpoint.caughtExceptions', 'Caught Exceptions'),
label: l10n.t('Caught Exceptions'),
default: false,
supportsCondition: true,
description: localize(
'breakpoint.caughtExceptions.description',
"Breaks on all throw errors, even if they're caught later.",
),
description: l10n.t("Breaks on all throw errors, even if they're caught later."),
conditionDescription: `error.name == "MyError"`,
},
{
filter: PauseOnExceptionsState.Uncaught,
label: localize('breakpoint.uncaughtExceptions', 'Uncaught Exceptions'),
label: l10n.t('Uncaught Exceptions'),
default: false,
supportsCondition: true,
description: localize(
'breakpoint.caughtExceptions.description',
'Breaks only on errors or promise rejections that are not handled.',
),
description: l10n.t('Breaks only on errors or promise rejections that are not handled.'),
conditionDescription: `error.name == "MyError"`,
},
],
@ -300,11 +292,11 @@ export class DebugAdapter implements IDisposable {
private async _onDisableSourcemap(params: Dap.DisableSourcemapParams) {
const source = this.sourceContainer.source(params.source);
if (!source) {
return errors.createSilentError(localize('error.sourceNotFound', 'Source not found'));
return errors.createSilentError(l10n.t('Source not found'));
}
if (!(source instanceof SourceFromMap)) {
return errors.createSilentError(localize('error.sourceNotFound', 'Source not a source map'));
return errors.createSilentError(l10n.t('Source not a source map'));
}
for (const compiled of source.compiledToSourceUrl.keys()) {
@ -324,7 +316,7 @@ export class DebugAdapter implements IDisposable {
params.source.path = urlUtils.platformPathToPreferredCase(params.source.path);
const source = this.sourceContainer.source(params.source);
if (!source) {
return errors.createSilentError(localize('error.sourceNotFound', 'Source not found'));
return errors.createSilentError(l10n.t('Source not found'));
}
const content = await source.content();
@ -333,9 +325,7 @@ export class DebugAdapter implements IDisposable {
this.dap.suggestDisableSourcemap({ source: params.source });
}
return errors.createSilentError(
localize('error.sourceContentDidFail', 'Unable to retrieve source content'),
);
return errors.createSilentError(l10n.t('Unable to retrieve source content'));
}
return { content, mimeType: source.getSuggestedMimeType };
@ -413,8 +403,7 @@ export class DebugAdapter implements IDisposable {
async _onSetVariable(params: Dap.SetVariableParams): Promise<Dap.SetVariableResult | Dap.Error> {
const variableStore = this.findVariableStore(v => v.hasVariable(params.variablesReference));
if (!variableStore)
return errors.createSilentError(localize('error.variableNotFound', 'Variable not found'));
if (!variableStore) return errors.createSilentError(l10n.t('Variable not found'));
params.value = sourceUtils.wrapObjectLiteral(params.value.trim());
return variableStore.setVariable(params);
}
@ -518,14 +507,12 @@ export class DebugAdapter implements IDisposable {
params.source.path = urlUtils.platformPathToPreferredCase(params.source.path);
const source = this.sourceContainer.source(params.source);
if (!source) {
return errors.createSilentError(localize('error.sourceNotFound', 'Source not found'));
return errors.createSilentError(l10n.t('Source not found'));
}
const prettified = await source.prettyPrint();
if (!prettified) {
return errors.createSilentError(
localize('error.cannotPrettyPrint', 'Unable to pretty print'),
);
return errors.createSilentError(l10n.t('Unable to pretty print'));
}
const { map: sourceMap, source: generated } = prettified;

Просмотреть файл

@ -2,11 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { randomBytes } from 'crypto';
import { inject, injectable } from 'inversify';
import { tmpdir } from 'os';
import { join } from 'path';
import * as nls from 'vscode-nls';
import Cdp from '../cdp/api';
import { ICdpApi } from '../cdp/connection';
import Dap from '../dap/api';
@ -19,8 +19,6 @@ import { getDefaultProfileName, IProfile, IProfilerFactory } from './profiling';
import { BasicCpuProfiler } from './profiling/basicCpuProfiler';
import { Thread } from './threads';
const localize = nls.loadMessageBundle();
/**
* Provides profiling functionality for the debug adapter.
*/
@ -63,7 +61,7 @@ export class ProfileController implements IProfileController {
this.cdp.Profiler.on('consoleProfileStarted', () => {
dap.output({
output: localize('profileController.console.started', 'Console profile started') + '\n',
output: l10n.t('Console profile started') + '\n',
category: 'console',
});
});
@ -100,12 +98,7 @@ export class ProfileController implements IProfileController {
await this.basicCpuProfiler.save(evt.profile, withExt);
dap.output({
output:
localize(
'profileController.console.ended',
'CPU profile saved as "{0}" in your workspace folder',
withExt,
) + '\n',
output: l10n.t('CPU profile saved as "{0}" in your workspace folder', withExt) + '\n',
category: 'console',
});
}

Просмотреть файл

@ -2,9 +2,9 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { isAbsolute, join } from 'path';
import * as nls from 'vscode-nls';
import { IProfile, IProfiler, StartProfileParams } from '.';
import Cdp from '../../cdp/api';
import { ICdpApi } from '../../cdp/connection';
@ -16,8 +16,6 @@ import { FS, FsPromises } from '../../ioc-extras';
import { SourceContainer } from '../sources';
import { SourceAnnotationHelper } from './sourceAnnotationHelper';
const localize = nls.loadMessageBundle();
export interface IBasicProfileParams {
precise: boolean;
}
@ -30,9 +28,8 @@ export interface IBasicProfileParams {
export class BasicCpuProfiler implements IProfiler<IBasicProfileParams> {
public static readonly type = 'cpu';
public static readonly extension = '.cpuprofile';
public static readonly label = localize('profile.cpu.label', 'CPU Profile');
public static readonly description = localize(
'profile.cpu.description',
public static readonly label = l10n.t('CPU Profile');
public static readonly description = l10n.t(
'Generates a .cpuprofile file you can open in the Chrome devtools',
);
public static readonly editable = true;

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import * as nls from 'vscode-nls';
import { IProfile, IProfiler, StartProfileParams } from '.';
import Cdp from '../../cdp/api';
import { ICdpApi } from '../../cdp/connection';
@ -15,8 +15,6 @@ import { FS, FsPromises } from '../../ioc-extras';
import { SourceContainer } from '../sources';
import { SourceAnnotationHelper } from './sourceAnnotationHelper';
const localize = nls.loadMessageBundle();
/**
* Basic profiler that uses the stable `HeapProfiler` API available everywhere.
* In Chrome, and probably in Node, this will be superceded by the Tracing API.
@ -25,9 +23,8 @@ const localize = nls.loadMessageBundle();
export class BasicHeapProfiler implements IProfiler<{}> {
public static readonly type = 'heap';
public static readonly extension = '.heapprofile';
public static readonly label = localize('profile.heap.label', 'Heap Profile');
public static readonly description = localize(
'profile.heap.description',
public static readonly label = l10n.t('Heap Profile');
public static readonly description = l10n.t(
'Generates a .heapprofile file you can open in the Chrome devtools',
);
public static readonly editable = true;

Просмотреть файл

@ -2,16 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { createWriteStream, WriteStream } from 'fs';
import { inject, injectable } from 'inversify';
import * as nls from 'vscode-nls';
import { IProfile, IProfiler, StartProfileParams } from '.';
import Cdp from '../../cdp/api';
import { ICdpApi } from '../../cdp/connection';
import { EventEmitter } from '../../common/events';
const localize = nls.loadMessageBundle();
/**
* Basic instant that uses the HeapProfiler API to grab a snapshot.
*/
@ -19,9 +17,8 @@ const localize = nls.loadMessageBundle();
export class HeapDumpProfiler implements IProfiler<void> {
public static readonly type = 'memory';
public static readonly extension = '.heapsnapshot';
public static readonly label = localize('profile.heap.label', 'Heap Snapshot');
public static readonly description = localize(
'profile.heap.description',
public static readonly label = l10n.t('Heap Snapshot');
public static readonly description = l10n.t(
'Generates a .heapsnapshot file you can open in the Chrome devtools',
);
public static readonly instant = true;

Просмотреть файл

@ -2,12 +2,12 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { xxHash32 } from 'js-xxhash';
import { relative } from 'path';
import { NullableMappedPosition, SourceMapConsumer } from 'source-map';
import { URL } from 'url';
import * as nls from 'vscode-nls';
import Cdp from '../cdp/api';
import { MapUsingProjection } from '../common/datastructure/mapUsingProjection';
import { EventEmitter } from '../common/events';
@ -33,8 +33,6 @@ import { ScriptSkipper } from './scriptSkipper/implementation';
import { IScriptSkipper } from './scriptSkipper/scriptSkipper';
import { Script } from './threads';
const localize = nls.loadMessageBundle();
// This is a ui location which corresponds to a position in the document user can see (Source, Dap.Source).
export interface IUiLocation {
lineNumber: number; // 1-based
@ -63,22 +61,6 @@ type ContentGetter = () => Promise<string | undefined>;
// Each source map has a number of compiled sources referncing it.
type SourceMapData = { compiled: Set<ISourceWithMap>; map?: SourceMap; loaded: Promise<void> };
export const enum SourceConstants {
/**
* Extension of evaluated sources internal to the debugger. Sources with
* this suffix will be ignored when displaying sources or stacktracees.
*/
InternalExtension = '.cdp',
/**
* Extension of evaluated REPL source. Stack traces which include frames
* from this suffix will be truncated to keep only frames from code called
* by the REPL.
*/
ReplExtension = '.repl',
}
export type SourceMapTimeouts = {
// This is a source map loading delay used for testing.
load: number;
@ -303,7 +285,7 @@ export class Source {
path: this._fqname,
sourceReference: this.sourceReference,
presentationHint: this.blackboxed() ? 'deemphasize' : undefined,
origin: this.blackboxed() ? localize('source.skipFiles', 'Skipped by skipFiles') : undefined,
origin: this.blackboxed() ? l10n.t('Skipped by skipFiles') : undefined,
};
if (existingAbsolutePath) {
@ -349,7 +331,7 @@ export class Source {
return '<eval>/VM' + this.sourceReference;
}
if (this.url.endsWith(SourceConstants.ReplExtension)) {
if (this.url.endsWith(sourceUtils.SourceConstants.ReplExtension)) {
return 'repl';
}

Просмотреть файл

@ -2,20 +2,19 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import Cdp from '../cdp/api';
import { once, posInt32Counter } from '../common/objUtils';
import { Base0Position } from '../common/positions';
import { SourceConstants } from '../common/sourceUtils';
import Dap from '../dap/api';
import { asyncScopesNotAvailable } from '../dap/errors';
import { ProtocolError } from '../dap/protocolError';
import { shouldStepOverStackFrame, StackFrameStepOverReason } from './smartStepping';
import { IPreferredUiLocation, SourceConstants } from './sources';
import { IPreferredUiLocation } from './sources';
import { RawLocation, Thread } from './threads';
import { IExtraProperty, IScopeRef, IVariableContainer } from './variableStore';
const localize = nls.loadMessageBundle();
export interface IFrameElement {
/** DAP stack frame ID */
frameId: number;
@ -316,36 +315,36 @@ export class StackFrame implements IFrameElement {
let presentationHint: 'arguments' | 'locals' | 'registers' | undefined;
switch (scope.type) {
case 'global':
name = localize('scope.global', 'Global');
name = l10n.t('Global');
break;
case 'local':
name = localize('scope.local', 'Local');
name = l10n.t('Local');
presentationHint = 'locals';
break;
case 'with':
name = localize('scope.with', 'With Block');
name = l10n.t('With Block');
presentationHint = 'locals';
break;
case 'closure':
name = localize('scope.closure', 'Closure');
name = l10n.t('Closure');
presentationHint = 'arguments';
break;
case 'catch':
name = localize('scope.catch', 'Catch Block');
name = l10n.t('Catch Block');
presentationHint = 'locals';
break;
case 'block':
name = localize('scope.block', 'Block');
name = l10n.t('Block');
presentationHint = 'locals';
break;
case 'script':
name = localize('scope.script', 'Script');
name = l10n.t('Script');
break;
case 'eval':
name = localize('scope.eval', 'Eval');
name = l10n.t('Eval');
break;
case 'module':
name = localize('scope.module', 'Module');
name = l10n.t('Module');
break;
default:
// fallback for custom scope types from other runtimes (#651)
@ -353,7 +352,7 @@ export class StackFrame implements IFrameElement {
break;
}
if (scope.name && scope.type === 'closure') {
name = localize('scope.closureNamed', 'Closure ({0})', scope.name);
name = l10n.t('Closure ({0})', scope.name);
} else if (scope.name) {
name = `${name}: ${scope.name}`;
}
@ -393,8 +392,8 @@ export class StackFrame implements IFrameElement {
if (isSmartStepped && source) {
source.origin =
isSmartStepped === StackFrameStepOverReason.SmartStep
? localize('smartStepSkipLabel', 'Skipped by smartStep')
: localize('source.skipFiles', 'Skipped by skipFiles');
? l10n.t('Skipped by smartStep')
: l10n.t('Skipped by skipFiles');
}
const line = (uiLocation || this._rawLocation).lineNumber;
@ -461,7 +460,7 @@ export class StackFrame implements IFrameElement {
if (scope.thisObject) extraProperties.push({ name: 'this', value: scope.thisObject });
if (scope.returnValue)
extraProperties.push({
name: localize('scope.returnValue', 'Return value'),
name: l10n.t('Return value'),
value: scope.returnValue,
});
}

Просмотреть файл

@ -6,7 +6,7 @@ import { Node, parseExpressionAt } from 'acorn';
import { randomBytes } from 'crypto';
import { Expression } from 'estree';
import Cdp from '../../cdp/api';
import { SourceConstants } from '../sources';
import { SourceConstants } from '../../common/sourceUtils';
/**
* Gets the suffix containing the `sourceURL` to mark a script as internal.

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { randomBytes } from 'crypto';
import * as nls from 'vscode-nls';
import Cdp from '../cdp/api';
import { DebugType } from '../common/contributionUtils';
import { EventEmitter } from '../common/events';
@ -42,7 +42,6 @@ import {
IUiLocation,
rawToUiOffset,
Source,
SourceConstants,
SourceContainer,
} from './sources';
import { StackFrame, StackTrace } from './stackTrace';
@ -51,7 +50,6 @@ import {
serializeForClipboardTmpl,
} from './templates/serializeForClipboard';
import { IVariableStoreLocationProvider, VariableStore } from './variableStore';
const localize = nls.loadMessageBundle();
export type PausedReason =
| 'step'
@ -145,7 +143,9 @@ const sourcesEqual = (a: Dap.Source, b: Dap.Source) =>
urlUtils.comparePathsWithoutCasing(a.path || '', b.path || '');
const getReplSourceSuffix = () =>
`\n//# sourceURL=eval-${randomBytes(4).toString('hex')}${SourceConstants.ReplExtension}\n`;
`\n//# sourceURL=eval-${randomBytes(4).toString('hex')}${
sourceUtils.SourceConstants.ReplExtension
}\n`;
export class Thread implements IVariableStoreLocationProvider {
private static _lastThreadId = 0;
@ -248,7 +248,7 @@ export class Thread implements IVariableStoreLocationProvider {
if (!(await this._cdp.Debugger.resume({}))) {
// We don't report the failure if the target wasn't paused. VS relies on this behavior.
if (this._pausedDetails !== undefined) {
return errors.createSilentError(localize('error.resumeDidFail', 'Unable to resume'));
return errors.createSilentError(l10n.t('Unable to resume'));
}
}
return { allThreadsContinued: false };
@ -261,7 +261,7 @@ export class Thread implements IVariableStoreLocationProvider {
return {};
}
return errors.createSilentError(localize('error.pauseDidFail', 'Unable to pause'));
return errors.createSilentError(l10n.t('Unable to pause'));
}
async stepOver(): Promise<Dap.NextResult | Dap.Error> {
@ -270,7 +270,7 @@ export class Thread implements IVariableStoreLocationProvider {
return {};
}
return errors.createSilentError(localize('error.stepOverDidFail', 'Unable to step next'));
return errors.createSilentError(l10n.t('Unable to step next'));
}
async stepInto(targetId?: number): Promise<Dap.StepInResult | Dap.Error> {
@ -292,7 +292,7 @@ export class Thread implements IVariableStoreLocationProvider {
}
}
return errors.createSilentError(localize('error.stepInDidFail', 'Unable to step in'));
return errors.createSilentError(l10n.t('Unable to step in'));
}
async stepOut(): Promise<Dap.StepOutResult | Dap.Error> {
@ -302,17 +302,15 @@ export class Thread implements IVariableStoreLocationProvider {
return {};
}
return errors.createSilentError(localize('error.stepOutDidFail', 'Unable to step out'));
return errors.createSilentError(l10n.t('Unable to step out'));
}
_stackFrameNotFoundError(): Dap.Error {
return errors.createSilentError(localize('error.stackFrameNotFound', 'Stack frame not found'));
return errors.createSilentError(l10n.t('Stack frame not found'));
}
_evaluateOnAsyncFrameError(): Dap.Error {
return errors.createSilentError(
localize('error.evaluateOnAsyncStackFrame', 'Unable to evaluate on async stack frame'),
);
return errors.createSilentError(l10n.t('Unable to evaluate on async stack frame'));
}
async restartFrame(params: Dap.RestartFrameParams): Promise<Dap.RestartFrameResult | Dap.Error> {
@ -323,9 +321,7 @@ export class Thread implements IVariableStoreLocationProvider {
const callFrameId = stackFrame.callFrameId();
if (!callFrameId) {
return errors.createUserError(
localize('error.restartFrameAsync', 'Cannot restart asynchronous frame'),
);
return errors.createUserError(l10n.t('Cannot restart asynchronous frame'));
}
// Cast is necessary since the devtools-protocol is being slow to update:
@ -336,14 +332,12 @@ export class Thread implements IVariableStoreLocationProvider {
mode: 'StepInto',
} as Cdp.Debugger.RestartFrameParams);
if (!ok) {
return errors.createUserError(
localize('error.unknownRestartError', 'Frame could not be restarted'),
);
return errors.createUserError(l10n.t('Frame could not be restarted'));
}
this._expectedPauseReason = {
reason: 'frame_entry',
description: localize('reason.description.restart', 'Paused on frame entry'),
description: l10n.t('Paused on frame entry'),
};
// Chromium versions before 104 didn't have an explicit `canBeRestarted`
@ -358,8 +352,7 @@ export class Thread implements IVariableStoreLocationProvider {
}
async stackTrace(params: Dap.StackTraceParams): Promise<Dap.StackTraceResult | Dap.Error> {
if (!this._pausedDetails)
return errors.createSilentError(localize('error.threadNotPaused', 'Thread is not paused'));
if (!this._pausedDetails) return errors.createSilentError(l10n.t('Thread is not paused'));
return this._pausedDetails.stackTrace.toDap(params);
}
@ -373,10 +366,7 @@ export class Thread implements IVariableStoreLocationProvider {
async exceptionInfo(): Promise<Dap.ExceptionInfoResult | Dap.Error> {
const exception = this._pausedDetails && this._pausedDetails.exception;
if (!exception)
return errors.createSilentError(
localize('error.threadNotPausedOnException', 'Thread is not paused on exception'),
);
if (!exception) return errors.createSilentError(l10n.t('Thread is not paused on exception'));
const preview = objectPreview.previewException(exception);
return {
exceptionId: preview.title,
@ -517,10 +507,7 @@ export class Thread implements IVariableStoreLocationProvider {
}
const response = await responsePromise;
if (!response)
throw new ProtocolError(
errors.createSilentError(localize('error.evaluateDidFail', 'Unable to evaluate')),
);
if (!response) throw new ProtocolError(errors.createSilentError(l10n.t('Unable to evaluate')));
if (response.exceptionDetails) {
let text = response.exceptionDetails.exception
? objectPreview.previewException(response.exceptionDetails.exception).title
@ -531,9 +518,7 @@ export class Thread implements IVariableStoreLocationProvider {
const variableStore = callFrameId ? this._pausedVariables : this.replVariables;
if (!variableStore) {
throw new ProtocolError(
errors.createSilentError(localize('error.evaluateDidFail', 'Unable to evaluate')),
);
throw new ProtocolError(errors.createSilentError(l10n.t('Unable to evaluate')));
}
const variable = await variableStore
@ -591,8 +576,7 @@ export class Thread implements IVariableStoreLocationProvider {
setImmediate(() =>
this.console.enqueue(this, {
toDap: () => ({
output: localize(
'repl.truncated',
output: l10n.t(
'Output has been truncated to the first {0} characters. Run `{1}` to copy the full output.',
budget,
`copy(${originalCall.expression.trim()}))`,
@ -1201,7 +1185,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'breakpoint',
description: localize('pause.breakpoint', 'Paused on breakpoint'),
description: l10n.t('Paused on breakpoint'),
};
}
@ -1211,7 +1195,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'step',
description: localize('pause.default', 'Paused'),
description: l10n.t('Paused'),
};
}
@ -1222,7 +1206,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'exception',
description: localize('pause.assert', 'Paused on assert'),
description: l10n.t('Paused on assert'),
};
case 'debugCommand':
return {
@ -1230,7 +1214,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'pause',
description: localize('pause.debugCommand', 'Paused on debug() call'),
description: l10n.t('Paused on debug() call'),
};
case 'DOM':
return {
@ -1238,7 +1222,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'data breakpoint',
description: localize('pause.DomBreakpoint', 'Paused on DOM breakpoint'),
description: l10n.t('Paused on DOM breakpoint'),
};
case 'EventListener':
return this._resolveEventListenerBreakpointDetails(stackTrace, event);
@ -1248,7 +1232,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'exception',
description: localize('pause.exception', 'Paused on exception'),
description: l10n.t('Paused on exception'),
exception: event.data as Cdp.Runtime.RemoteObject | undefined,
};
case 'promiseRejection':
@ -1257,7 +1241,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'exception',
description: localize('pause.promiseRejection', 'Paused on promise rejection'),
description: l10n.t('Paused on promise rejection'),
exception: event.data as Cdp.Runtime.RemoteObject | undefined,
};
case 'instrumentation':
@ -1267,7 +1251,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'step',
description: localize('pause.default', 'Paused'),
description: l10n.t('Paused'),
};
}
return {
@ -1275,7 +1259,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'function breakpoint',
description: localize('pause.instrumentation', 'Paused on instrumentation breakpoint'),
description: l10n.t('Paused on instrumentation breakpoint'),
};
case 'XHR':
return {
@ -1283,7 +1267,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'data breakpoint',
description: localize('pause.xhr', 'Paused on XMLHttpRequest or fetch'),
description: l10n.t('Paused on XMLHttpRequest or fetch'),
};
case 'OOM':
return {
@ -1291,7 +1275,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'exception',
description: localize('pause.oom', 'Paused before Out Of Memory exception'),
description: l10n.t('Paused before Out Of Memory exception'),
};
default:
if (event.hitBreakpoints && event.hitBreakpoints.length) {
@ -1326,7 +1310,7 @@ export class Thread implements IVariableStoreLocationProvider {
stackTrace,
hitBreakpoints: event.hitBreakpoints,
reason: isStopOnEntry ? 'entry' : 'breakpoint',
description: localize('pause.breakpoint', 'Paused on breakpoint'),
description: l10n.t('Paused on breakpoint'),
};
}
if (this._expectedPauseReason) {
@ -1334,7 +1318,7 @@ export class Thread implements IVariableStoreLocationProvider {
thread: this,
event,
stackTrace,
description: localize('pause.default', 'Paused'),
description: l10n.t('Paused'),
...this._expectedPauseReason,
};
}
@ -1343,7 +1327,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'pause',
description: localize('pause.default', 'Paused on debugger statement'),
description: l10n.t('Paused on debugger statement'),
};
}
}
@ -1371,7 +1355,7 @@ export class Thread implements IVariableStoreLocationProvider {
event,
stackTrace,
reason: 'function breakpoint',
description: localize('pause.eventListener', 'Paused on event listener'),
description: l10n.t('Paused on event listener'),
};
}
@ -1393,7 +1377,7 @@ export class Thread implements IVariableStoreLocationProvider {
}
private _onScriptParsed(event: Cdp.Debugger.ScriptParsedEvent) {
if (event.url.endsWith(SourceConstants.InternalExtension)) {
if (event.url.endsWith(sourceUtils.SourceConstants.InternalExtension)) {
// The customer doesn't care about the internal cdp files, so skip this event
return;
}
@ -1534,8 +1518,7 @@ export class Thread implements IVariableStoreLocationProvider {
this._dap.with(dap =>
dap.output({
category: 'stderr',
output: localize(
'warnings.handleSourceMapPause.didNotWait',
output: l10n.t(
'WARNING: Processing source-maps of {0} took longer than {1} ms so we continued execution without waiting for all the breakpoints for the script to be set.',
script.url || script.scriptId,
timeout,

Просмотреть файл

@ -2,9 +2,9 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { generate } from 'astring';
import { inject, injectable } from 'inversify';
import * as nls from 'vscode-nls';
import Cdp from '../cdp/api';
import { ICdpApi } from '../cdp/connection';
import { flatten, isInstanceOf } from '../common/objUtils';
@ -26,8 +26,6 @@ import { invokeGetter } from './templates/invokeGetter';
import { readMemory } from './templates/readMemory';
import { writeMemory } from './templates/writeMemory';
const localize = nls.loadMessageBundle();
const getVariableId = (() => {
let last = 0;
const max = 0x7fffffff - 1;
@ -114,12 +112,7 @@ const localizeIndescribable = (str: string) => {
return str;
}
return localize(
'error.customValueDescriptionGeneratorFailed',
"{0} (couldn't describe: {1})",
error,
key,
);
return l10n.t("{0} (couldn't describe: {1})", error, key);
};
/**
@ -292,7 +285,7 @@ class VariableContext {
ErrorVariable,
{ name: '', sortOrder: SortOrder.Error },
result as Cdp.Runtime.RemoteObject,
result?.description || errorDescription || localize('error.unknown', 'Unknown error'),
result?.description || errorDescription || l10n.t('Unknown error'),
),
]);
}
@ -493,7 +486,7 @@ class VariableContext {
return { errorDescription: customValueDescription.result.description };
}
}
return { errorDescription: localize('error.unknown', 'Unknown error') };
return { errorDescription: l10n.t('Unknown error') };
} catch (e) {
return { errorDescription: e.stack || e.message || String(e) };
}
@ -578,11 +571,7 @@ class Variable implements IVariable {
});
if (!result) {
throw new ProtocolError(
errors.createSilentError(
localize('error.setVariableDidFail', 'Unable to set variable value'),
),
);
throw new ProtocolError(errors.createSilentError(l10n.t('Unable to set variable value')));
}
if (result.exceptionDetails) {
@ -988,9 +977,7 @@ class Scope implements IVariableContainer {
callFrameId: this.ref.callFrameId,
});
if (!evaluated) {
throw new ProtocolError(
errors.createUserError(localize('error.invalidExpression', 'Invalid expression')),
);
throw new ProtocolError(errors.createUserError(l10n.t('Invalid expression')));
}
if (evaluated.exceptionDetails) {
throw new ProtocolError(errorFromException(evaluated.exceptionDetails));
@ -1208,18 +1195,14 @@ export class VariableStore {
const container = this.vars.get(params.variablesReference);
if (!params.value) {
throw new ProtocolError(
errors.createUserError(localize('error.emptyExpression', 'Cannot set an empty value')),
);
throw new ProtocolError(errors.createUserError(l10n.t('Cannot set an empty value')));
}
if (container instanceof Scope || container instanceof Variable) {
const newVar = await container.setProperty(params.name, params.value);
return await newVar.toDap(PreviewContextType.PropertyValue, params.format);
} else {
throw new ProtocolError(
errors.createSilentError(localize('error.variableNotFound', 'Variable not found')),
);
throw new ProtocolError(errors.createSilentError(l10n.t('Variable not found')));
}
}

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { Container } from 'inversify';
import * as os from 'os';
import { CancellationToken } from 'vscode';
import * as nls from 'vscode-nls';
import { getAsyncStackPolicy, IAsyncStackPolicy } from './adapter/asyncStackPolicy';
import { DebugAdapter } from './adapter/debugAdapter';
import { DiagnosticToolSuggester } from './adapter/diagnosticToolSuggester';
@ -37,8 +37,6 @@ import {
installUnhandledErrorReporter,
} from './telemetry/unhandledErrorReporter';
const localize = nls.loadMessageBundle();
export interface IBinderDelegate {
acquireDap(target: ITarget): Promise<DapConnection>;
// Returns whether we should disable child session treatment.
@ -109,7 +107,7 @@ export class Binder implements IDisposable {
params.breakpoints?.map(() => ({
id: ++lastBreakpointId,
verified: false,
message: localize('breakpoint.provisionalBreakpoint', `Unbound breakpoint`),
message: l10n.t('Unbound breakpoint'),
})) ?? [],
}; // TODO: Put a useful message here
});

Просмотреть файл

@ -4,6 +4,8 @@
const path = require('path');
const config = JSON.parse(process.env.CONFIG);
const webpack = require('webpack');
for (const rule of config.module.rules) {
if (typeof rule.test === 'string') {
rule.test = new RegExp(rule.test);
@ -19,7 +21,13 @@ if (process.env.ANALYZE_SIZE === 'true') {
);
}
const compiler = require('webpack')(config);
if (process.env.USE_VSCODE_L10N === 'true') {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/common\/l10n(.js)?$/, './l10n.extensionOnly.js'),
);
}
const compiler = webpack(config);
const handleResult = (err, stats) => {
if (err) {

Просмотреть файл

@ -58,6 +58,14 @@ export const enum Commands {
//#endregion
}
export const enum DebugType {
ExtensionHost = 'pwa-extensionHost',
Terminal = 'node-terminal',
Node = 'pwa-node',
Chrome = 'pwa-chrome',
Edge = 'pwa-msedge',
}
export const preferredDebugTypes: ReadonlyMap<DebugType, string> = new Map([
[DebugType.Node, 'node'],
[DebugType.Chrome, 'chrome'],
@ -68,14 +76,6 @@ export const preferredDebugTypes: ReadonlyMap<DebugType, string> = new Map([
export const getPreferredOrDebugType = <T extends DebugType>(t: T) =>
(preferredDebugTypes.get(t) as T) || t;
export const enum DebugType {
ExtensionHost = 'pwa-extensionHost',
Terminal = 'node-terminal',
Node = 'pwa-node',
Chrome = 'pwa-chrome',
Edge = 'pwa-msedge',
}
// constructing it this way makes sure we can't forget to add a type:
const debugTypes: { [K in DebugType]: null } = {
[DebugType.ExtensionHost]: null,

Просмотреть файл

@ -106,7 +106,7 @@ export class Hasher implements IDisposable {
return undefined;
}
const instance = (this.instance = new Worker(join(__dirname, 'hash.bundle.js')));
const instance = (this.instance = new Worker(join(__dirname, 'hash.js')));
instance.setMaxListeners(Infinity);
instance.on('message', raw => {

Просмотреть файл

@ -0,0 +1,11 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as vscode from 'vscode';
/**
* This file is only included in the extension build, to pull localization from
* the vscode API. Otherwise, the l10n.t(s file is used.
*/
export const t = vscode.l10n.t;

Просмотреть файл

@ -23,6 +23,21 @@ import { isWithinAsar } from './pathUtils';
import { acornOptions, parseProgram } from './sourceCodeManipulations';
import { SourceMap } from './sourceMaps/sourceMap';
export const enum SourceConstants {
/**
* Extension of evaluated sources internal to the debugger. Sources with
* this suffix will be ignored when displaying sources or stacktracees.
*/
InternalExtension = '.cdp',
/**
* Extension of evaluated REPL source. Stack traces which include frames
* from this suffix will be truncated to keep only frames from code called
* by the REPL.
*/
ReplExtension = '.repl',
}
export async function prettyPrintAsSourceMap(
fileName: string,
minified: string,

Просмотреть файл

@ -2,12 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import Dap from './api';
import { ProtocolError } from './protocolError';
const localize = nls.loadMessageBundle();
export const enum ErrorCodes {
SilentError = 9222,
UserError,
@ -65,8 +63,7 @@ export function createUserError(text: string, code = ErrorCodes.UserError): Dap.
export const nvmNotFound = () =>
createUserError(
localize(
'NVS_HOME.not.found.message',
l10n.t(
"Attribute 'runtimeVersion' requires Node.js version manager 'nvs' or 'nvm' to be installed.",
),
ErrorCodes.NvmOrNvsNotFound,
@ -74,26 +71,19 @@ export const nvmNotFound = () =>
export const nvsNotFound = () =>
createUserError(
localize(
'NVS_HOME.not.found.message',
"Attribute 'runtimeVersion' with a flavor/architecture requires 'nvs' to be installed.",
),
l10n.t("Attribute 'runtimeVersion' with a flavor/architecture requires 'nvs' to be installed."),
ErrorCodes.NvsNotFound,
);
export const nvmHomeNotFound = () =>
createUserError(
localize(
'NVM_HOME.not.found.message',
"Attribute 'runtimeVersion' requires Node.js version manager 'nvm-windows' or 'nvs'.",
),
l10n.t("Attribute 'runtimeVersion' requires Node.js version manager 'nvm-windows' or 'nvs'."),
ErrorCodes.NvmHomeNotFound,
);
export const nvmVersionNotFound = (version: string, versionManager: string) =>
createUserError(
localize(
'runtime.version.not.found.message',
l10n.t(
"Node.js version '{0}' not installed using version manager {1}.",
version,
versionManager,
@ -103,20 +93,19 @@ export const nvmVersionNotFound = (version: string, versionManager: string) =>
export const cannotLaunchInTerminal = (errorMessage: string) =>
createUserError(
localize('VSND2011', 'Cannot launch debug target in terminal ({0}).', errorMessage),
l10n.t('Cannot launch debug target in terminal ({0}).', errorMessage),
ErrorCodes.CannotLaunchInTerminal,
);
export const cannotLoadEnvironmentVars = (errorMessage: string) =>
createUserError(
localize('VSND2029', "Can't load environment variables from file ({0}).", errorMessage),
l10n.t("Can't load environment variables from file ({0}).", errorMessage),
ErrorCodes.CannotLoadEnvironmentVariables,
);
export const cannotFindNodeBinary = (attemptedPath: string, reason: string) =>
createUserError(
localize(
'runtime.node.notfound',
l10n.t(
'Can\'t find Node.js binary "{0}": {1}. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json',
attemptedPath,
reason,
@ -126,8 +115,7 @@ export const cannotFindNodeBinary = (attemptedPath: string, reason: string) =>
export const nodeBinaryOutOfDate = (readVersion: string, attemptedPath: string) =>
createUserError(
localize(
'runtime.node.outdated',
l10n.t(
'The Node version in "{0}" is outdated (version {1}), we require at least Node 8.x.',
attemptedPath,
readVersion,
@ -137,8 +125,7 @@ export const nodeBinaryOutOfDate = (readVersion: string, attemptedPath: string)
export const invalidHitCondition = (expression: string) =>
createUserError(
localize(
'invalidHitCondition',
l10n.t(
'Invalid hit condition "{0}". Expected an expression like "> 42" or "== 2".',
expression,
),
@ -147,16 +134,13 @@ export const invalidHitCondition = (expression: string) =>
export const profileCaptureError = () =>
createUserError(
localize('profile.error.generic', 'An error occurred taking a profile from the target.'),
l10n.t('An error occurred taking a profile from the target.'),
ErrorCodes.ProfileCaptureError,
);
export const invalidConcurrentProfile = () =>
createUserError(
localize(
'profile.error.concurrent',
'Please stop the running profile before starting a new one.',
),
l10n.t('Please stop the running profile before starting a new one.'),
ErrorCodes.InvalidConcurrentProfile,
);
@ -169,12 +153,10 @@ export const browserNotFound = (
) =>
createUserError(
requested === '*' && !available.length
? localize(
'noBrowserInstallFound',
? l10n.t(
'Unable to find an installation of the browser on your system. Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json.',
)
: localize(
'browserVersionNotFound',
: l10n.t(
'Unable to find {0} version {1}. Available auto-discovered versions are: {2}. You can set the "runtimeExecutable" in your launch.json to one of these, or provide an absolute path to the browser executable.',
browserType,
requested,
@ -185,20 +167,16 @@ export const browserNotFound = (
export const browserLaunchFailed = (innerError: Error) =>
createUserError(
localize('error.browserLaunchError', 'Unable to launch browser: "{0}"', innerError.message),
l10n.t('Unable to launch browser: "{0}"', innerError.message),
ErrorCodes.BrowserLaunchFailed,
);
export const browserAttachFailed = (message?: string) =>
createUserError(
message ?? localize('error.browserAttachError', 'Unable to attach to browser'),
ErrorCodes.BrowserAttachFailed,
);
createUserError(message ?? l10n.t('Unable to attach to browser'), ErrorCodes.BrowserAttachFailed);
export const targetPageNotFound = () =>
createUserError(
localize(
'error.threadNotFound',
l10n.t(
'Target page not found. You may need to update your "urlFilter" to match the page you want to debug.',
),
ErrorCodes.TargetPageNotFound,
@ -209,14 +187,13 @@ export const invalidLogPointSyntax = (error: string) =>
export const asyncScopesNotAvailable = () =>
createSilentError(
localize('asyncScopesNotAvailable', 'Variables not available in async stacks'),
l10n.t('Variables not available in async stacks'),
ErrorCodes.AsyncScopesNotAvailable,
);
export const invalidBreakPointCondition = (params: Dap.SourceBreakpoint, error: string) =>
createUserError(
localize(
'breakpointSyntaxError',
l10n.t(
'Syntax error setting breakpoint with condition {0} on line {1}: {2}',
JSON.stringify(params.condition),
params.line,
@ -226,27 +203,19 @@ export const invalidBreakPointCondition = (params: Dap.SourceBreakpoint, error:
);
export const threadNotAvailable = () =>
createSilentError(
localize('error.threadNotFound', 'Thread not found'),
ErrorCodes.ThreadNotAvailable,
);
createSilentError(l10n.t('Thread not found'), ErrorCodes.ThreadNotAvailable);
// use the compiledUrl instead of the source map url here, since the source
// map could be a very large data URI
export const sourceMapParseFailed = (compiledUrl: string, message: string) =>
createUserError(
localize('sourcemapParseError', 'Could not read source map for {0}: {1}', compiledUrl, message),
);
createUserError(l10n.t('Could not read source map for {0}: {1}', compiledUrl, message));
export const uwpPipeNotAvailable = () =>
createUserError(
localize('uwpPipeNotAvailable', 'UWP webview debugging is not available on your platform.'),
);
createUserError(l10n.t('UWP webview debugging is not available on your platform.'));
export const noUwpPipeFound = () =>
createUserError(
localize(
'noUwpPipeFound',
l10n.t(
'Could not connect to any UWP Webview pipe. Make sure your webview is hosted in debug mode, and that the `pipeName` in your `launch.json` is correct.',
),
);

Просмотреть файл

@ -2,23 +2,20 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { createGlobalContainer, createTopLevelSessionContainer } from './ioc';
import * as l10n from '@vscode/l10n';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as net from 'net';
import { Binder, IBinderDelegate } from './binder';
import DapConnection from './dap/connection';
import * as os from 'os';
import * as path from 'path';
import { DebugAdapter } from './adapter/debugAdapter';
import Dap from './dap/api';
import { Binder, IBinderDelegate } from './binder';
import { IDisposable } from './common/disposable';
import * as nls from 'vscode-nls';
import { TargetOrigin } from './targets/targetOrigin';
import { ILogger } from './common/logging';
import Dap from './dap/api';
import DapConnection from './dap/connection';
import { StreamDapTransport } from './dap/transport';
const localize = nls.loadMessageBundle();
import { createGlobalContainer, createTopLevelSessionContainer } from './ioc';
import { TargetOrigin } from './targets/targetOrigin';
const storagePath = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-js-debug-'));
@ -40,7 +37,7 @@ class Configurator {
const breakpoints = ids.map(id => ({
id,
verified: false,
message: localize('breakpoint.provisionalBreakpoint', `Unbound breakpoint`),
message: l10n.t('Unbound breakpoint'),
})); // TODO: Put a useful message here
return { breakpoints };
});

Просмотреть файл

@ -5,7 +5,6 @@
import { diffChars } from 'diff';
import { Fragment, FunctionComponent, h } from 'preact';
import { useState } from 'preact/hooks';
import { CdpReferenceState } from '../adapter/breakpoints/breakpointBase';
import {
DiagnosticBreakpointArgs,
IDiagnosticBreakpoint,
@ -78,10 +77,8 @@ const buildTracing = (bp: IDiagnosticBreakpoint, dump: IDiagnosticDump) => {
</li>,
);
const applied = bp.cdp.filter(cdp => cdp.state === CdpReferenceState.Applied);
const uiLocations = flatten(
applied.map(a => (a.state === CdpReferenceState.Applied ? a.uiLocations : [])),
);
const applied = bp.cdp.filter(cdp => cdp.state === 1 /* Applied */);
const uiLocations = flatten(applied.map(a => (a.state === 1 /* Applied */ ? a.uiLocations : [])));
if (!uiLocations.length) {
steps.push(
<li key={key++}>

Просмотреть файл

@ -3,18 +3,17 @@
*--------------------------------------------------------*/
import { IDiagnosticDump, IDiagnosticSource } from '../adapter/diagnosics';
import { DebugType } from '../common/contributionUtils';
const nodeInternalMarker = '<node_internals>';
const node16InternalUrl = 'node:';
export const isNodeType = (dump: IDiagnosticDump) =>
dump.config.type === DebugType.Node ||
dump.config.type === DebugType.ExtensionHost ||
dump.config.type === DebugType.Terminal;
dump.config.type === 'pwa-node' ||
dump.config.type === 'pwa-extensionHost' ||
dump.config.type === 'node-terminal';
export const isBrowserType = (dump: IDiagnosticDump) =>
dump.config.type === DebugType.Chrome || dump.config.type === DebugType.Edge;
dump.config.type === 'pwa-chrome' || dump.config.type === 'pwa-msedge';
export const sortScore = (source: IDiagnosticSource) => {
if (

Просмотреть файл

@ -4,4 +4,4 @@
import { join } from 'path';
export const toolPath = join(__dirname, 'diagnosticTool.bundle.js');
export const toolPath = join(__dirname, 'diagnosticTool.js');

Просмотреть файл

@ -3,26 +3,30 @@
*--------------------------------------------------------*/
require('source-map-support').install(); // Enable TypeScript stack traces translation
import 'reflect-metadata';
import * as l10n from '@vscode/l10n';
import * as fs from 'fs';
/**
* This script launches the pwa adapter in "flat session" mode for DAP, which means
* that all DAP traffic will be routed through a single connection (either tcp socket or stdin/out)
* and use the sessionId field on each message to route it to the correct child session
*/
import * as net from 'net';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import { createGlobalContainer } from './ioc';
import { IDebugSessionLike, SessionManager, ISessionLauncher } from './sessionManager';
import { getDeferred } from './common/promiseUtil';
import DapConnection from './dap/connection';
import { IDapTransport, StreamDapTransport, SessionIdDapTransport } from './dap/transport';
import * as path from 'path';
import 'reflect-metadata';
import { Readable, Writable } from 'stream';
import { IPseudoAttachConfiguration } from './configuration';
import { DebugConfiguration } from 'vscode';
import { DebugType } from './common/contributionUtils';
import { getDeferred } from './common/promiseUtil';
import { IPseudoAttachConfiguration } from './configuration';
import DapConnection from './dap/connection';
import { IDapTransport, SessionIdDapTransport, StreamDapTransport } from './dap/transport';
import { createGlobalContainer } from './ioc';
import { IDebugSessionLike, ISessionLauncher, SessionManager } from './sessionManager';
if (process.env.L10N_FSPATH_TO_BUNDLE) {
l10n.config({ fsPath: process.env.L10N_FSPATH_TO_BUNDLE });
}
const storagePath = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-js-debug-'));

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable, optional } from 'inversify';
import type * as vscodeType from 'vscode';
import { CancellationToken } from 'vscode';
import * as nls from 'vscode-nls';
import CdpConnection from '../../cdp/connection';
import { NeverCancelled } from '../../common/cancellation';
import { DebugType } from '../../common/contributionUtils';
@ -28,8 +28,6 @@ import { BrowserTargetManager } from './browserTargetManager';
import { BrowserTargetType } from './browserTargets';
import * as launcher from './launcher';
const localize = nls.loadMessageBundle();
@injectable()
export class BrowserAttacher<
T extends AnyChromiumAttachConfiguration = AnyChromiumAttachConfiguration,
@ -198,7 +196,7 @@ export class BrowserAttacher<
return target => target.targetId === targets[0].targetId;
}
const placeHolder = localize('chrome.targets.placeholder', 'Select a tab');
const placeHolder = l10n.t('Select a tab');
const selected = await this.vscode.window.showQuickPick(
targets.map(target => ({
label: target.title,
@ -229,8 +227,7 @@ export class BrowserAttacher<
if (cancellationToken.isCancellationRequested) {
throw new ProtocolError(
browserAttachFailed(
localize(
'attach.cannotConnect',
l10n.t(
'Cannot connect to the target at {0}: {1}',
`${params.address}:${params.port}`,
e.message,
@ -245,8 +242,7 @@ export class BrowserAttacher<
throw new ProtocolError(
browserAttachFailed(
localize(
'attach.cannotConnect',
l10n.t(
'Cannot connect to the target at {0}: {1}',
`${params.address}:${params.port}`,
'Cancelled',

Просмотреть файл

@ -192,7 +192,7 @@ export class AutoAttachLauncher
await Promise.all([
copyFile(this.fs, bootloaderDefaultPath, bootloaderPath),
copyFile(this.fs, watchdogPath, path.join(storagePath, 'watchdog.bundle.js')),
copyFile(this.fs, watchdogPath, path.join(storagePath, 'watchdog.js')),
]);
const p = forceForwardSlashes(bootloaderPath);

Просмотреть файл

@ -4,5 +4,5 @@
import { join } from 'path';
export const watchdogPath = join(__dirname, 'watchdog.bundle.js');
export const bootloaderDefaultPath = join(__dirname, 'bootloader.bundle.js');
export const watchdogPath = join(__dirname, 'watchdog.js');
export const bootloaderDefaultPath = join(__dirname, 'bootloader.js');

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import * as nls from 'vscode-nls';
import { IPortLeaseTracker } from '../../adapter/portLeaseTracker';
import { getSourceSuffix } from '../../adapter/templates';
import Cdp from '../../cdp/api';
@ -25,8 +25,6 @@ import { IProgram, StubProgram, WatchDogProgram } from './program';
import { IRestartPolicy, RestartPolicyFactory } from './restartPolicy';
import { WatchDog } from './watchdogSpawn';
const localize = nls.loadMessageBundle();
/**
* Attaches to ongoing Node processes. This works pretty similar to the
* existing Node launcher, except with how we attach to the entry point:
@ -117,11 +115,7 @@ export class NodeAttacher extends NodeAttacherBase<INodeAttachConfiguration> {
}
runData.context.dap.output({
output: localize(
'node.attach.restart.message',
'Lost connection to debugee, reconnecting in {0}ms\r\n',
nextRestart.delay,
),
output: l10n.t('Lost connection to debugee, reconnecting in {0}ms\r\n', nextRestart.delay),
});
const deferred = new StubProgram();

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable, optional } from 'inversify';
import { basename, dirname, extname, isAbsolute, resolve } from 'path';
import type * as vscodeType from 'vscode';
import * as nls from 'vscode-nls';
import { EnvironmentVars } from '../../common/environmentVars';
import { ILogger, LogTag } from '../../common/logging';
import { findExecutable, findInPath } from '../../common/pathUtils';
@ -22,8 +22,6 @@ import { ProtocolError } from '../../dap/protocolError';
import { FS, FsPromises, VSCodeApi } from '../../ioc-extras';
import { IPackageJsonProvider } from './packageJsonProvider';
const localize = nls.loadMessageBundle();
export const INodeBinaryProvider = Symbol('INodeBinaryProvider');
export const enum Capability {
@ -74,16 +72,14 @@ const warningMessages: ReadonlyArray<IWarningMessage> = [
{
inclusiveMin: new Semver(16, 0, 0),
inclusiveMax: new Semver(16, 3, 99),
message: localize(
'warning.16bpIssue',
message: l10n.t(
'Some breakpoints might not work in your version of Node.js. We recommend upgrading for the latest bug, performance, and security fixes. Details: https://aka.ms/AAcsvqm',
),
},
{
inclusiveMin: new Semver(7, 0, 0),
inclusiveMax: new Semver(8, 99, 99),
message: localize(
'warning.8outdated',
message: l10n.t(
"You're running an outdated version of Node.js. We recommend upgrading for the latest bug, performance, and security fixes.",
),
},
@ -256,12 +252,7 @@ export class NodeBinaryProvider {
const location = await this.resolveBinaryLocation(executable, env);
this.logger.info(LogTag.RuntimeLaunch, 'Using binary at', { location, executable });
if (!location) {
throw new ProtocolError(
cannotFindNodeBinary(
executable,
localize('runtime.node.notfound.enoent', 'path does not exist'),
),
);
throw new ProtocolError(cannotFindNodeBinary(executable, l10n.t('path does not exist')));
}
if (explicitVersion) {
@ -356,12 +347,7 @@ export class NodeBinaryProvider {
});
return stdout.trim();
} catch (e) {
throw new ProtocolError(
cannotFindNodeBinary(
binary,
localize('runtime.node.notfound.spawnErr', 'error getting version: {0}', e.message),
),
);
throw new ProtocolError(cannotFindNodeBinary(binary, e.message));
}
}
}
@ -384,11 +370,8 @@ export class InteractiveNodeBinaryProvider extends NodeBinaryProvider {
return false;
}
const yes = localize('yes', 'Yes');
const response = await this.vscode.window.showErrorMessage(
localize('outOfDate', '{0} Would you like to try debugging anyway?', message),
yes,
);
const yes = l10n.t('Yes');
const response = await this.vscode.window.showErrorMessage(message, yes);
return response === yes;
}

32406
src/typings/vscode.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

10
src/typings/vscode.proposed.tunnels.d.ts поставляемый
Просмотреть файл

@ -12,6 +12,10 @@ declare module 'vscode' {
// The desired local port. If this port can't be used, then another will be chosen.
localAddressPort?: number;
label?: string;
/**
* @deprecated Use privacy instead
*/
public?: boolean;
privacy?: string;
protocol?: string;
}
@ -20,6 +24,10 @@ declare module 'vscode' {
remoteAddress: { port: number; host: string };
//The complete local address(ex. localhost:1234)
localAddress: { port: number; host: string } | string;
/**
* @deprecated Use privacy instead
*/
public?: boolean;
privacy?: string;
// If protocol is not provided it is assumed to be http, regardless of the localAddress.
protocol?: string;
@ -51,6 +59,6 @@ declare module 'vscode' {
/**
* Fired when the list of tunnels has changed.
*/
// export const onDidChangeTunnels: Event<void>;
export const onDidChangeTunnels: Event<void>;
}
}

Просмотреть файл

@ -1,9 +1,9 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { Container } from 'inversify';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { IPortLeaseTracker } from '../adapter/portLeaseTracker';
import { Commands, Configuration, readConfig, registerCommand } from '../common/contributionUtils';
import { ProxyLogger } from '../common/logging/proxyLogger';
@ -18,8 +18,6 @@ import { noPackageJsonProvider } from '../targets/node/packageJsonProvider';
import { NodeOnlyPathResolverFactory } from '../targets/sourcePathResolverFactory';
import { launchVirtualTerminalParent } from './debugTerminalUI';
const localize = nls.loadMessageBundle();
export function registerAutoAttach(
context: vscode.ExtensionContext,
delegate: DelegateLauncherFactory,
@ -76,7 +74,7 @@ export function registerAutoAttach(
return { ipcAddress: launcher.deferredSocketName as string };
} catch (e) {
if (e instanceof AutoAttachPreconditionFailed && e.helpLink) {
const details = localize('details', 'Details');
const details = l10n.t('Details');
if ((await vscode.window.showErrorMessage(e.message, details)) === details) {
vscode.env.openExternal(vscode.Uri.parse(e.helpLink));
}

Просмотреть файл

@ -2,15 +2,13 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { URL } from 'url';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Configuration, readConfig } from '../common/contributionUtils';
import Dap from '../dap/api';
import { DebugSessionTunnels } from './debugSessionTunnels';
const localize = nls.loadMessageBundle();
const isTunnelForPort = (port: number) => (tunnel: vscode.TunnelDescription) =>
typeof tunnel.localAddress === 'string'
? tunnel.localAddress.endsWith(`:${port}`)
@ -57,8 +55,7 @@ const launchCompanionBrowser = async (
if (vscode.env.uiKind === vscode.UIKind.Web) {
vscode.debug.stopDebugging(session);
return vscode.window.showErrorMessage(
localize(
'cannotDebugInBrowser',
l10n.t(
"We can't launch a browser in debug mode from here. Open this workspace in VS Code on your desktop to enable debugging.",
),
);

Просмотреть файл

@ -2,11 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { tmpdir } from 'os';
import { basename, join } from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { DebugType } from '../../common/contributionUtils';
import { isPortOpen } from '../../common/findOpenPort';
import { existsWithoutDeref } from '../../common/fsUtils';
@ -25,8 +25,6 @@ import { BaseConfigurationResolver } from './baseConfigurationResolver';
import { NodeConfigurationResolver } from './nodeDebugConfigurationResolver';
import { TerminalDebugConfigurationResolver } from './terminalDebugConfigurationResolver';
const localize = nls.loadMessageBundle();
const isLaunch = (
value: ResolvingConfiguration<unknown>,
): value is ResolvingConfiguration<IChromiumLaunchConfiguration> => value.request === 'launch';
@ -167,14 +165,13 @@ export abstract class ChromiumDebugConfigurationResolver<T extends AnyChromiumCo
]);
if (lockfileExists) {
const debugAnyway = localize('existingBrowser.debugAnyway', 'Debug Anyway');
const debugAnyway = l10n.t('Debug Anyway');
const result = await vscode.window.showErrorMessage(
localize(
'existingBrowser.alert',
l10n.t(
'It looks like a browser is already running from {0}. Please close it before trying to debug, otherwise VS Code may not be able to connect to it.',
cast.userDataDir === true
? localize('existingBrowser.location.default', 'an old debug session')
: localize('existingBrowser.location.userDataDir', 'the configured userDataDir'),
? l10n.t('an old debug session')
: l10n.t('the configured userDataDir'),
),
{ modal: true },
debugAnyway,
@ -229,7 +226,7 @@ export abstract class ChromiumDebugConfigurationProvider<
return {
type: this.getType(),
request: 'launch',
name: localize('chrome.launch.name', 'Launch Chrome against localhost'),
name: l10n.t('Launch Chrome against localhost'),
url: 'http://localhost:8080',
webRoot: '${workspaceFolder}',
} as ResolvingConfiguration<T>;

Просмотреть файл

@ -2,9 +2,9 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { injectable } from 'inversify';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { DebugType } from '../../common/contributionUtils';
import {
AnyEdgeConfiguration,
@ -18,8 +18,6 @@ import {
ChromiumDebugConfigurationResolver,
} from './chromiumDebugConfigurationProvider';
const localize = nls.loadMessageBundle();
/**
* Configuration provider for Chrome debugging.
*/
@ -75,7 +73,7 @@ export class EdgeDebugConfigurationProvider extends ChromiumDebugConfigurationPr
protected getDefaultLaunch() {
return {
...super.getDefaultLaunch(),
name: localize('chrome.launch.name', 'Launch Edge against localhost'),
name: l10n.t('Launch Edge against localhost'),
};
}
}

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { injectable } from 'inversify';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { DebugType, getPreferredOrDebugType } from '../../common/contributionUtils';
import { flatten } from '../../common/objUtils';
import {
@ -21,8 +21,6 @@ import { getPackageManager } from '../getRunScriptCommand';
import { BaseConfigurationProvider } from './baseConfigurationProvider';
import { createLaunchConfigFromContext } from './nodeDebugConfigurationResolver';
const localize = nls.loadMessageBundle();
@injectable()
export class NodeInitialDebugConfigurationProvider extends BaseConfigurationProvider<AnyNodeConfiguration> {
protected provide(folder?: vscode.WorkspaceFolder) {
@ -81,7 +79,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv
protected async getFromNpmScripts(folder?: vscode.WorkspaceFolder): Promise<DynamicConfig[]> {
const openTerminal: AnyResolvingConfiguration = {
type: getPreferredOrDebugType(DebugType.Terminal),
name: localize('debug.terminal.label', 'JavaScript Debug Terminal'),
name: l10n.t('JavaScript Debug Terminal'),
request: 'launch',
cwd: folder?.uri.fsPath,
};
@ -99,7 +97,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv
return scripts
.map<DynamicConfig>(script => ({
type: getPreferredOrDebugType(DebugType.Terminal),
name: localize('node.launch.script', 'Run Script: {0}', script.name),
name: l10n.t('Run Script: {0}', script.name),
request: 'launch',
command: `${packageManager} run ${script.name}`,
cwd: script.directory,
@ -123,7 +121,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv
return [
{
type: getPreferredOrDebugType(DebugType.Node),
name: localize('node.launch.currentFile', 'Run Current File'),
name: l10n.t('Run Current File'),
request: 'launch',
program: editor.document.uri.fsPath,
},

Просмотреть файл

@ -2,12 +2,12 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { promises as fs } from 'fs';
import { inject, injectable } from 'inversify';
import * as path from 'path';
import * as vscode from 'vscode';
import { CancellationToken } from 'vscode';
import * as nls from 'vscode-nls';
import { writeToConsole } from '../../common/console';
import { DebugType } from '../../common/contributionUtils';
import { EnvironmentVars } from '../../common/environmentVars';
@ -31,8 +31,6 @@ import { fixInspectFlags } from '../configurationUtils';
import { resolveProcessId } from '../processPicker';
import { BaseConfigurationResolver } from './baseConfigurationResolver';
const localize = nls.loadMessageBundle();
type ResolvingNodeConfiguration =
| ResolvingNodeAttachConfiguration
| ResolvingNodeLaunchConfiguration;
@ -73,7 +71,7 @@ export class NodeConfigurationResolver extends BaseConfigurationResolver<AnyNode
const stats = await existsInjected(fs, config.cwd);
if (!stats) {
vscode.window.showErrorMessage(
localize('cwd.notFound', 'The configured `cwd` {0} does not exist.', config.cwd),
l10n.t('The configured `cwd` {0} does not exist.', config.cwd),
{ modal: true },
);
return;
@ -81,7 +79,7 @@ export class NodeConfigurationResolver extends BaseConfigurationResolver<AnyNode
if (!stats.isDirectory()) {
vscode.window.showErrorMessage(
localize('cwd.notFound', 'The configured `cwd` {0} is not a folder.', config.cwd),
l10n.t('The configured `cwd` {0} is not a folder.', config.cwd),
{ modal: true },
);
return;
@ -102,10 +100,7 @@ export class NodeConfigurationResolver extends BaseConfigurationResolver<AnyNode
if (!config.name && !config.type && !config.request) {
config = await createLaunchConfigFromContext(folder, true, config);
if (config.request === 'launch' && !config.program) {
vscode.window.showErrorMessage(
localize('program.not.found.message', 'Cannot find a program to debug'),
{ modal: true },
);
vscode.window.showErrorMessage(l10n.t('Cannot find a program to debug'), { modal: true });
return;
}
}
@ -320,7 +315,7 @@ export async function createLaunchConfigFromContext(
const config: ResolvingNodeConfiguration = {
type: DebugType.Node,
request: 'launch',
name: localize('node.launch.config.name', 'Launch Program'),
name: l10n.t('Launch Program'),
skipFiles: ['<node_internals>/**'],
};
@ -334,13 +329,7 @@ export async function createLaunchConfigFromContext(
if (pkg && pkg.name === 'mern-starter') {
if (resolve) {
writeToConsole(
localize(
'mern.starter.explanation',
"Launch configuration for '{0}' project created.",
'Mern Starter',
),
);
writeToConsole(l10n.t("Launch configuration for '{0}' project created.", 'Mern Starter'));
}
configureMern(config);
return config;
@ -350,12 +339,7 @@ export async function createLaunchConfigFromContext(
// try to find a value for 'program' by analysing package.json
program = await guessProgramFromPackage(folder, pkg, resolve);
if (program && resolve) {
writeToConsole(
localize(
'program.guessed.from.package.json.explanation',
"Launch configuration created based on 'package.json'.",
),
);
writeToConsole(l10n.t("Launch configuration created based on 'package.json'."));
}
}
@ -406,8 +390,7 @@ export async function createLaunchConfigFromContext(
) {
if (resolve) {
writeToConsole(
localize(
'outFiles.explanation',
l10n.t(
"Adjust glob pattern(s) in the 'outFiles' attribute so that they cover the generated JavaScript.",
),
);

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { URL } from 'url';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import {
Commands,
Configuration,
@ -16,8 +16,6 @@ import {
import { DefaultBrowser, IDefaultBrowserProvider } from '../common/defaultBrowserProvider';
import { ExtensionContext, IExtensionContribution } from '../ioc-extras';
const localize = nls.loadMessageBundle();
function getPossibleUrl(link: string, requirePort: boolean): string | undefined {
if (!link) {
return;
@ -109,7 +107,7 @@ export class DebugLinkUi implements IExtensionContribution {
placeHolder: 'https://localhost:8080',
validateInput: input => {
if (input && !getPossibleUrl(input, false)) {
return localize('debugLink.invalidUrl', 'The URL provided is invalid');
return l10n.t('The URL provided is invalid');
}
},
});
@ -133,15 +131,12 @@ export class DebugLinkUi implements IExtensionContribution {
return;
}
const yes = localize('yes', 'Yes');
const never = localize('never', 'Never');
const yes = l10n.t('Yes');
const never = l10n.t('Never');
const r = await vscode.window.showInformationMessage(
localize(
'debugLink.savePrompt',
'Would you like to save a configuration in your launch.json for easy access later?',
),
l10n.t('Would you like to save a configuration in your launch.json for easy access later?'),
yes,
localize('no', 'No'),
l10n.t('No'),
never,
);

Просмотреть файл

@ -2,16 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Commands, runCommand } from '../common/contributionUtils';
import { readfile } from '../common/fsUtils';
import { getRunScriptCommand } from './getRunScriptCommand';
const localize = nls.loadMessageBundle();
interface IScript {
directory: string;
name: string;
@ -99,10 +97,7 @@ export async function findScripts(
if (!folders || folders.length === 0) {
if (!silent) {
vscode.window.showErrorMessage(
localize(
'debug.npm.noWorkspaceFolder',
'You need to open a workspace folder to debug npm scripts.',
),
l10n.t('You need to open a workspace folder to debug npm scripts.'),
);
}
return;
@ -140,7 +135,7 @@ export async function findScripts(
if (!silent) {
promptToOpen(
'showWarningMessage',
localize('debug.npm.parseError', 'Could not read {0}: {1}', fsPath, e.message),
l10n.t('Could not read {0}: {1}', fsPath, e.message),
fsPath,
);
}
@ -170,7 +165,7 @@ export async function findScripts(
if (editCandidate.path && !silent) {
promptToOpen(
'showErrorMessage',
localize('debug.npm.noScripts', 'No npm scripts found in your package.json'),
l10n.t('No npm scripts found in your package.json'),
editCandidate.path,
);
}
@ -189,7 +184,7 @@ async function promptToOpen(
message: string,
file: string,
) {
const openAction = localize('debug.npm.notFound.open', 'Edit package.json');
const openAction = l10n.t('Edit package.json');
if ((await vscode.window[method](message, openAction)) !== openAction) {
return;
}

Просмотреть файл

@ -2,10 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { Container } from 'inversify';
import { homedir } from 'os';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { IPortLeaseTracker } from '../adapter/portLeaseTracker';
import { NeverCancelled } from '../common/cancellation';
import {
@ -34,8 +34,6 @@ import { ITarget } from '../targets/targets';
import { DapTelemetryReporter } from '../telemetry/dapTelemetryReporter';
import { TerminalLinkHandler } from './terminalLinkHandler';
const localize = nls.loadMessageBundle();
export const launchVirtualTerminalParent = (
delegate: DelegateLauncherFactory,
launcher: ITerminalLauncherLike,
@ -176,10 +174,7 @@ async function getWorkspaceFolder() {
folder,
})),
{
placeHolder: localize(
'terminal.cwdpick',
'Select current working directory for new terminal',
),
placeHolder: l10n.t('Select current working directory for new terminal'),
},
);

Просмотреть файл

@ -2,14 +2,13 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Commands, Contributions, isDebugType, registerCommand } from '../common/contributionUtils';
import { ExtensionContext, FS, FsPromises, IExtensionContribution } from '../ioc-extras';
import { DebugSessionTracker } from './debugSessionTracker';
const localize = nls.loadMessageBundle();
const neverRemindKey = 'neverRemind';
@injectable()
@ -58,9 +57,9 @@ export class DiagnosticsUI implements IExtensionContribution {
this.isPrompting = true;
const yes = localize('yes', 'Yes');
const notNow = localize('notNow', 'Not Now');
const never = localize('never', 'Never');
const yes = l10n.t('Yes');
const notNow = l10n.t('Not Now');
const never = l10n.t('Never');
const response = await vscode.window.showInformationMessage(
'It looks like you might be having trouble with breakpoints. Would you like to open our diagnostic tool?',
yes,
@ -106,7 +105,7 @@ export class DiagnosticsUI implements IExtensionContribution {
private pickSession() {
return DebugSessionTracker.pickSession(
this.tracker.getConcreteSessions(),
localize('selectInspectSession', 'Select the session you want to inspect:'),
l10n.t('Select the session you want to inspect:'),
);
}
@ -116,8 +115,7 @@ export class DiagnosticsUI implements IExtensionContribution {
) {
if (!session || !this.tracker.isRunning(session)) {
vscode.window.showErrorMessage(
localize(
'inspectSessionEnded',
l10n.t(
'It looks like your debug session has already ended. Try debugging again, then run the "Debug: Diagnose Breakpoint Problems" command.',
),
);

Просмотреть файл

@ -2,16 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { injectable } from 'inversify';
import * as vscode from 'vscode';
import { ExtensionContext } from 'vscode';
import * as nls from 'vscode-nls';
import { Configuration, isDebugType, readConfig, writeConfig } from '../common/contributionUtils';
import Dap from '../dap/api';
import { IExtensionContribution } from '../ioc-extras';
const localize = nls.loadMessageBundle();
@injectable()
export class DisableSourceMapUI implements IExtensionContribution {
public register(context: ExtensionContext) {
@ -37,18 +35,17 @@ export class DisableSourceMapUI implements IExtensionContribution {
}
private async prompt() {
const always = localize('always', 'Always');
const alwayInWorkspace = localize('always', 'Always in this Workspace');
const yes = localize('yes', 'Yes');
const always = l10n.t('Always');
const alwayInWorkspace = l10n.t('Always in this Workspace');
const yes = l10n.t('Yes');
const result = await vscode.window.showInformationMessage(
localize(
'disableSourceMapUi.msg',
l10n.t(
'This is a missing file path referenced by a sourcemap. Would you like to debug the compiled version instead?',
),
always,
alwayInWorkspace,
localize('no', 'No'),
l10n.t('No'),
yes,
);

Просмотреть файл

@ -2,16 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Commands, DebugType, registerCommand } from '../common/contributionUtils';
import { IExtensionContribution } from '../ioc-extras';
import { BrowserTargetType } from '../targets/browser/browserTargets';
import { DebugSessionTracker } from './debugSessionTracker';
const localize = nls.loadMessageBundle();
const qualifies = (session: vscode.DebugSession) => {
if (session?.type !== DebugType.Edge) {
return false;
@ -45,10 +43,7 @@ export class EdgeDevToolOpener implements IExtensionContribution {
? vscode.debug.activeDebugSession
: await DebugSessionTracker.pickSession(
this.tracker.getConcreteSessions().filter(qualifies),
localize(
'selectEdgeToolSession',
'Select the page where you want to open the devtools',
),
l10n.t('Select the page where you want to open the devtools'),
);
if (!session) {

Просмотреть файл

@ -2,14 +2,12 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import type * as vscodeType from 'vscode';
import * as nls from 'vscode-nls';
import { ExtensionContext, VSCodeApi } from '../ioc-extras';
import { ILinkedBreakpointLocation } from './linkedBreakpointLocation';
const localize = nls.loadMessageBundle();
const ignoreStorageKey = 'linkBpWarnIgnored';
const docLink =
'https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_can-i-debug-if-im-using-symlinks';
@ -29,8 +27,8 @@ export class LinkedBreakpointLocationUI implements ILinkedBreakpointLocation {
}
this.didWarn = true;
const readMore = localize('readMore', 'Read More');
const ignore = localize('ignore', 'Ignore');
const readMore = l10n.t('Read More');
const ignore = l10n.t('Ignore');
const r = await this.vscode.window.showWarningMessage(
'It looks like you have symlinked files. You might need to update your configuration to make this work as expected.',

Просмотреть файл

@ -2,14 +2,12 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { join } from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { ExtensionContext, IExtensionContribution } from '../ioc-extras';
const localize = nls.loadMessageBundle();
const omitLongPredictionKey = 'omitLongPredictions';
@injectable()
@ -33,12 +31,11 @@ export class LongPredictionUI implements IExtensionContribution {
return;
}
const message = localize(
'longPredictionWarning.message',
const message = l10n.t(
"It's taking a while to configure your breakpoints. You can speed this up by updating the 'outFiles' in your launch.json.",
);
const openLaunch = localize('longPredictionWarning.open', 'Open launch.json');
const dontShow = localize('longPredictionWarning.disable', "Don't show again");
const openLaunch = l10n.t('Open launch.json');
const dontShow = l10n.t("Don't show again");
const result = await vscode.window.showWarningMessage(message, dontShow, openLaunch);
if (result === dontShow) {
@ -55,9 +52,7 @@ export class LongPredictionUI implements IExtensionContribution {
}
if (!workspaceFolder) {
await vscode.window.showWarningMessage(
localize('longPredictionWarning.noFolder', 'No workspace folder open.'),
);
await vscode.window.showWarningMessage(l10n.t('No workspace folder open.'));
return;
}

Просмотреть файл

@ -2,11 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { execSync } from 'child_process';
import { promises as fsPromises } from 'fs';
import { basename } from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Configuration, readConfig } from '../common/contributionUtils';
import { LocalFsUtils } from '../common/fsUtils';
import { isSubdirectoryOf } from '../common/pathUtils';
@ -20,8 +20,6 @@ import { analyseArguments, processTree } from './processTree/processTree';
const INSPECTOR_PORT_DEFAULT = 9229;
const localize = nls.loadMessageBundle();
interface IProcessItem extends vscode.QuickPickItem {
pidAndPort: string; // picker result
sortKey: number;
@ -70,11 +68,7 @@ export async function resolveProcessId(
const result = processId && decodePidAndPort(processId);
if (!result || isNaN(result.pid)) {
throw new Error(
localize(
'process.id.error',
"Attach to process: '{0}' doesn't look like a process id.",
processId,
),
l10n.t("Attach to process: '{0}' doesn't look like a process id.", processId || '<unknown>'),
);
}
@ -123,10 +117,9 @@ export async function pickProcess(): Promise<string | null> {
const item = await listProcesses();
return item ? item.pidAndPort : null;
} catch (err) {
await vscode.window.showErrorMessage(
localize('process.picker.error', 'Process picker failed ({0})', err.message),
{ modal: true },
);
await vscode.window.showErrorMessage(l10n.t('Process picker failed ({0})', err.message), {
modal: true,
});
return null;
}
}
@ -144,7 +137,7 @@ async function listProcesses(): Promise<IProcessItem | undefined> {
let seq = 0; // default sort key
const quickPick = vscode.window.createQuickPick<IProcessItem>();
quickPick.placeholder = localize('pickNodeProcess', 'Pick the node.js process to attach to');
quickPick.placeholder = l10n.t('Pick the node.js process to attach to');
quickPick.matchOnDescription = true;
quickPick.matchOnDetail = true;
quickPick.busy = true;
@ -179,14 +172,8 @@ async function listProcesses(): Promise<IProcessItem | undefined> {
pidAndPort: encodePidAndPort(leaf.pid, port),
sortKey: leaf.date ? leaf.date : seq++,
detail: port
? localize(
'process.id.port.signal',
'process id: {0}, debug port: {1} ({2})',
leaf.pid,
port,
'SIGUSR1',
)
: localize('process.id.signal', 'process id: {0} ({1})', leaf.pid, 'SIGUSR1'),
? l10n.t('process id: {0}, debug port: {1} ({2})', leaf.pid, port, 'SIGUSR1')
: l10n.t('process id: {0} ({1})', leaf.pid, 'SIGUSR1'),
};
const index = acc.findIndex(item => item.sortKey < newItem.sortKey);
@ -220,12 +207,7 @@ function putPidInDebugMode(pid: number): void {
}
} catch (e) {
throw new Error(
localize(
'cannot.enable.debug.mode.error',
"Attach to process: cannot enable debug mode for process '{0}' ({1}).",
pid,
e,
),
l10n.t("Attach to process: cannot enable debug mode for process '{0}' ({1}).", pid, e),
);
}
}

Просмотреть файл

@ -2,16 +2,15 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { memoize, truthy } from '../../common/objUtils';
import Dap from '../../dap/api';
import { ExtensionContext, FS, FsPromises } from '../../ioc-extras';
import { ITerminationCondition, ITerminationConditionFactory } from './terminationCondition';
const localize = nls.loadMessageBundle();
const warnedKey = 'breakpointTerminationWarnedSlow';
type BreakpointPickItem = {
@ -23,11 +22,8 @@ type BreakpointPickItem = {
export class BreakpointTerminationConditionFactory implements ITerminationConditionFactory {
public readonly sortOrder = 2;
public readonly id = 'breakpoint';
public readonly label = localize('profile.termination.breakpoint.label', 'Pick Breakpoint');
public readonly description = localize(
'profile.termination.breakpoint.description',
'Run until a specific breakpoint is hit',
);
public readonly label = l10n.t('Pick Breakpoint');
public readonly description = l10n.t('Run until a specific breakpoint is hit');
constructor(
@inject(FS) private readonly fs: FsPromises,
@ -95,11 +91,10 @@ export class BreakpointTerminationConditionFactory implements ITerminationCondit
}
vscode.window.showWarningMessage(
localize(
'breakpointTerminationWarnSlow',
l10n.t(
'Profiling with breakpoints enabled can change the performance of your code. It can be useful to validate your findings with the "duration" or "manual" termination conditions.',
),
localize('breakpointTerminationWarnConfirm', 'Got it!'),
l10n.t('Got it!'),
);
await this.context.workspaceState.update(warnedKey, true);
}

Просмотреть файл

@ -2,14 +2,12 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { ITerminationConditionFactory, ITerminationCondition } from './terminationCondition';
import * as nls from 'vscode-nls';
import * as vscode from 'vscode';
import { UiProfileSession, Category } from './uiProfileSession';
import * as l10n from '@vscode/l10n';
import { injectable } from 'inversify';
import * as vscode from 'vscode';
import { DisposableList } from '../../common/disposable';
const localize = nls.loadMessageBundle();
import { ITerminationCondition, ITerminationConditionFactory } from './terminationCondition';
import { Category, UiProfileSession } from './uiProfileSession';
@injectable()
export class DurationTerminationConditionFactory implements ITerminationConditionFactory {
@ -17,11 +15,8 @@ export class DurationTerminationConditionFactory implements ITerminationConditio
public readonly sortOrder = 1;
public readonly id = 'duration';
public readonly label = localize('profile.termination.duration.label', 'Duration');
public readonly description = localize(
'profile.termination.duration.description',
'Run for a specific amount of time',
);
public readonly label = l10n.t('Duration');
public readonly description = l10n.t('Run for a specific amount of time');
public async onPick(_session: vscode.DebugSession, duration?: number) {
if (duration) {
@ -29,11 +24,8 @@ export class DurationTerminationConditionFactory implements ITerminationConditio
}
const input = vscode.window.createInputBox();
input.title = localize('profile.termination.duration.inputTitle', 'Duration of Profile');
input.placeholder = localize(
'profile.termination.duration.placeholder',
'Profile duration in seconds, e.g "5"',
);
input.title = l10n.t('Duration of Profile');
input.placeholder = l10n.t('Profile duration in seconds, e.g "5"');
if (this.lastDuration) {
input.value = String(this.lastDuration);
@ -41,15 +33,9 @@ export class DurationTerminationConditionFactory implements ITerminationConditio
input.onDidChangeValue(value => {
if (!/^[0-9]+$/.test(value)) {
input.validationMessage = localize(
'profile.termination.duration.invalidFormat',
'Please enter a number',
);
input.validationMessage = l10n.t('Please enter a number');
} else if (Number(value) < 1) {
input.validationMessage = localize(
'profile.termination.duration.invalidLength',
'Please enter a number greater than 1',
);
input.validationMessage = l10n.t('Please enter a number greater than 1');
} else {
input.validationMessage = undefined;
}

Просмотреть файл

@ -2,21 +2,16 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { ITerminationConditionFactory, ITerminationCondition } from './terminationCondition';
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import { injectable } from 'inversify';
const localize = nls.loadMessageBundle();
import { ITerminationCondition, ITerminationConditionFactory } from './terminationCondition';
@injectable()
export class ManualTerminationConditionFactory implements ITerminationConditionFactory {
public readonly sortOrder = 0;
public readonly id = 'manual';
public readonly label = localize('profile.termination.duration.label', 'Manual');
public readonly description = localize(
'profile.termination.duration.description',
'Run until manually stopped',
);
public readonly label = l10n.t('Manual');
public readonly description = l10n.t('Run until manually stopped');
public async onPick() {
return new ManualTerminationCondition();

Просмотреть файл

@ -2,11 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable, multiInject } from 'inversify';
import { homedir } from 'os';
import { basename, join } from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { getDefaultProfileName, ProfilerFactory } from '../../adapter/profiling';
import { Commands, ContextKey, setContextKey } from '../../common/contributionUtils';
import { DisposableList, IDisposable } from '../../common/disposable';
@ -19,8 +19,6 @@ import { ManualTerminationCondition } from './manualTerminationCondition';
import { ITerminationCondition, ITerminationConditionFactory } from './terminationCondition';
import { UiProfileSession } from './uiProfileSession';
const localize = nls.loadMessageBundle();
const isProfileCandidate = (session: vscode.DebugSession) =>
'__pendingTargetId' in session.configuration;
@ -195,7 +193,7 @@ export class UiProfileManager implements IDisposable {
*/
private registerSession(uiSession: UiProfileSession, onCompleteCommand?: string) {
this.activeSessions.set(uiSession.session.id, uiSession);
this.sessionStates.add(uiSession.session.id, localize('profile.sessionState', 'Profiling'));
this.sessionStates.add(uiSession.session.id, l10n.t('Profiling'));
uiSession.onStatusChange(() => this.updateStatusBar());
uiSession.onStop(file => {
if (file) {
@ -265,16 +263,12 @@ export class UiProfileManager implements IDisposable {
if (this.activeSessions.size === 1) {
const session: UiProfileSession = this.activeSessions.values().next().value;
this.statusBarItem.text = session.status
? localize(
'profile.status.single',
'$(loading~spin) Click to Stop Profiling ({0})',
session.status,
)
: localize('profile.status.default', '$(loading~spin) Click to Stop Profiling');
? l10n.t('{0} Click to Stop Profiling ({1})', '$(loading~spin)', session.status)
: l10n.t('{0} Click to Stop Profiling', '$(loading~spin)');
} else {
this.statusBarItem.text = localize(
'profile.status.multiSession',
'$(loading~spin) Click to Stop Profiling ({0} sessions)',
this.statusBarItem.text = l10n.t(
'{0} Click to Stop Profiling ({1} sessions)',
'$(loading~spin)',
this.activeSessions.size,
);
}
@ -287,11 +281,10 @@ export class UiProfileManager implements IDisposable {
* if they want to stop and start profiling it again.
*/
private async alreadyRunningSession(existing: UiProfileSession) {
const yes = localize('yes', 'Yes');
const no = localize('no', 'No');
const yes = l10n.t('Yes');
const no = l10n.t('No');
const stopExisting = await vscode.window.showErrorMessage(
localize(
'profile.alreadyRunning',
l10n.t(
'A profiling session is already running, would you like to stop it and start a new session?',
),
yes,
@ -334,7 +327,7 @@ export class UiProfileManager implements IDisposable {
}
const chosen = await this.pickWithLastDefault(
localize('profile.type.title', 'Type of profile:'),
l10n.t('Type of profile:'),
ProfilerFactory.ctors.filter(ctor => ctor.canApplyTo(params)),
this.lastChosenType,
);
@ -360,7 +353,7 @@ export class UiProfileManager implements IDisposable {
}
const chosen = await this.pickWithLastDefault(
localize('profile.termination.title', 'How long to run the profile:'),
l10n.t('How long to run the profile:'),
this.terminationConditions,
this.lastChosenTermination,
);

Просмотреть файл

@ -2,16 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { IProfilerCtor } from '../../adapter/profiling';
import { DisposableList, IDisposable } from '../../common/disposable';
import { EventEmitter } from '../../common/events';
import Dap from '../../dap/api';
import { ITerminationCondition } from './terminationCondition';
const localize = nls.loadMessageBundle();
const enum State {
Collecting,
Saving,
@ -85,7 +83,7 @@ export class UiProfileSession implements IDisposable {
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window,
title: localize('progress.profile.start', 'Starting profile...'),
title: l10n.t('Starting profile...'),
},
() =>
this.session.customRequest('startProfile', {
@ -123,13 +121,13 @@ export class UiProfileSession implements IDisposable {
return;
}
this.setStatus(Category.Overwrite, localize('profile.saving', 'Saving'));
this.setStatus(Category.Overwrite, l10n.t('Saving'));
this.state = State.Saving;
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window,
title: localize('progress.profile.stop', 'Stopping profile...'),
title: l10n.t('Stopping profile...'),
},
() => this.session.customRequest('stopProfile', {}),
);

Просмотреть файл

@ -2,11 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as l10n from '@vscode/l10n';
import { inject, injectable } from 'inversify';
import { find as findLink } from 'linkifyjs';
import { URL } from 'url';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import {
Configuration,
DebugByLinkState,
@ -18,8 +18,6 @@ import { DisposableList, IDisposable } from '../common/disposable';
import { once } from '../common/objUtils';
import { isLoopbackIp, isMetaAddress } from '../common/urlUtils';
const localize = nls.loadMessageBundle();
interface ITerminalLink extends vscode.TerminalLink {
target: URL;
workspaceFolder?: number;
@ -123,7 +121,7 @@ export class TerminalLinkHandler
links.push({
startIndex: start,
length: link.value.length,
tooltip: localize('terminalLinkHover.debug', 'Debug URL'),
tooltip: l10n.t('Debug URL'),
target: uri,
workspaceFolder: getCwd()?.index,
});
@ -158,8 +156,7 @@ export class TerminalLinkHandler
}
vscode.window.showInformationMessage(
localize(
'cantOpenChromeOnWeb',
l10n.t(
"We can't launch a browser in debug mode from here. If you want to debug this webpage, open this workspace from VS Code on your desktop.",
),
);

Просмотреть файл

@ -3,6 +3,7 @@
*--------------------------------------------------------*/
require('source-map-support').install(); // Enable TypeScript stack traces translation
import * as l10n from '@vscode/l10n';
import * as fs from 'fs';
/**
* This script launches vscode-js-debug in server mode for Visual Studio
@ -13,7 +14,6 @@ import * as path from 'path';
import 'reflect-metadata';
import { Readable, Writable } from 'stream';
import { DebugConfiguration } from 'vscode';
import * as nls from 'vscode-nls';
import { DebugType } from './common/contributionUtils';
import { getDeferred, IDeferred } from './common/promiseUtil';
import { IPseudoAttachConfiguration } from './configuration';
@ -25,7 +25,9 @@ import { ITarget } from './targets/targets';
const storagePath = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-js-debug-'));
const localize = nls.loadMessageBundle();
if (process.env.L10N_FSPATH_TO_BUNDLE) {
l10n.config({ fsPath: process.env.L10N_FSPATH_TO_BUNDLE });
}
class VSDebugSession implements IDebugSessionLike {
constructor(
@ -62,7 +64,7 @@ class VsDebugServer implements ISessionLauncher<VSDebugSession> {
const deferredConnection: IDeferred<DapConnection> = getDeferred();
const rootSession = new VSDebugSession(
'root',
localize('session.rootSessionName', 'JavaScript debug adapter'),
l10n.t('JavaScript debug adapter'),
deferredConnection.promise,
{ type: DebugType.Chrome, name: 'root', request: 'launch' },
);