diff --git a/.gitignore b/.gitignore index eb8b02d00b17..296d7b2dbdf8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,7 @@ pydevd*.log nodeLanguageServer/** nodeLanguageServer.*/** dist/** +# translation files +*.xlf +*.nls.*.json +*.i18n.json diff --git a/.vscodeignore b/.vscodeignore index ee4685d9067b..cc0c255eb3d5 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -45,6 +45,7 @@ debug_coverage*/** images/**/*.gif images/**/*.png ipywidgets/** +i18n/** news/** node_modules/** obj/** diff --git a/build/azure-pipeline.pre-release.yml b/build/azure-pipeline.pre-release.yml index a1a1b9c0c137..a609b8c58ead 100644 --- a/build/azure-pipeline.pre-release.yml +++ b/build/azure-pipeline.pre-release.yml @@ -21,6 +21,8 @@ resources: extends: template: azure-pipelines/extension/pre-release.yml@templates parameters: + locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json + locBundleDestination: $(Build.SourcesDirectory)/out/client buildSteps: - task: NodeTool@0 inputs: diff --git a/build/azure-pipeline.stable.yml b/build/azure-pipeline.stable.yml index daeae384fa32..df249bb89c10 100644 --- a/build/azure-pipeline.stable.yml +++ b/build/azure-pipeline.stable.yml @@ -24,6 +24,10 @@ extends: template: azure-pipelines/extension/stable.yml@templates parameters: publishExtension: ${{ parameters.publishExtension }} + + locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json + locBundleDestination: $(Build.SourcesDirectory)/out/client + buildSteps: - task: NodeTool@0 inputs: diff --git a/build/webpack/webpack.extension.config.js b/build/webpack/webpack.extension.config.js index b1b3922126d6..24c6a8d56109 100644 --- a/build/webpack/webpack.extension.config.js +++ b/build/webpack/webpack.extension.config.js @@ -26,6 +26,12 @@ const config = { }, module: { rules: [ + { + loader: 'vscode-nls-dev/lib/webpack-loader', + options: { + base: constants.ExtensionRootDir, + }, + }, { test: /\.ts$/, use: [ diff --git a/gulpfile.js b/gulpfile.js index 28ebde894027..2949490abd66 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,12 +21,14 @@ const flat = require('flat'); const { argv } = require('yargs'); const os = require('os'); const rmrf = require('rimraf'); +const typescript = require('typescript'); + +const tsProject = ts.createProject('./tsconfig.json', { typescript }); const isCI = process.env.TRAVIS === 'true' || process.env.TF_BUILD !== undefined; gulp.task('compile', (done) => { let failed = false; - const tsProject = ts.createProject('tsconfig.json'); tsProject .src() .pipe(tsProject()) diff --git a/news/1 Enhancements/18286.md b/news/1 Enhancements/18286.md new file mode 100644 index 000000000000..11c312d18711 --- /dev/null +++ b/news/1 Enhancements/18286.md @@ -0,0 +1 @@ +Enable localization using vscode-nlsß diff --git a/package-lock.json b/package-lock.json index 11edfd6f8002..8cd0b1a8ef17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "vscode-languageclient": "8.0.0-next.18", "vscode-languageserver": "8.0.0-next.14", "vscode-languageserver-protocol": "3.17.0-next.20", + "vscode-nls": "^5.0.1", "vscode-tas-client": "^0.1.22", "winreg": "^1.2.4", "xml2js": "^0.4.19" @@ -115,6 +116,8 @@ "uuid": "^8.3.2", "vsce": "^2.6.6", "vscode-debugadapter-testsupport": "^1.27.0", + "vscode-nls-dev": "^4.0.0", + "vscode-telemetry-extractor": "^1.9.5", "webpack": "^5.70.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.2", @@ -479,6 +482,48 @@ "node": ">= 6" } }, + "node_modules/@ts-morph/common": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.11.1.tgz", + "integrity": "sha512-7hWZS0NRpEsNV8vWJzg7FEz6V8MaLNeJOmwmghqUXTpzk16V1LLZhdo+4QvE/+zv4cVci0OviuJFnqhEfoV3+g==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@ts-morph/common/node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true + }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -1330,6 +1375,15 @@ "node": ">=0.4.0" } }, + "node_modules/agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/aggregate-error": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", @@ -3043,6 +3097,15 @@ "node": ">=0.10.0" } }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, "node_modules/clone-buffer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", @@ -3092,6 +3155,12 @@ "readable-stream": "^2.3.5" } }, + "node_modules/code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, "node_modules/code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -5143,6 +5212,21 @@ "node": ">=0.10.0" } }, + "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", @@ -5990,6 +6074,12 @@ "node": ">=0.10.0" } }, + "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/from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -7268,6 +7358,15 @@ "node": ">=0.10.0" } }, + "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", @@ -8815,6 +8914,12 @@ "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", @@ -10808,6 +10913,15 @@ "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/pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -12396,6 +12510,18 @@ "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", @@ -12482,6 +12608,16 @@ "readable-stream": "^2.0.2" } }, + "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", @@ -13378,6 +13514,16 @@ "lodash": "^4.17.5" } }, + "node_modules/ts-morph": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-12.2.0.tgz", + "integrity": "sha512-WHXLtFDcIRwoqaiu0elAoZ/AmI+SwwDafnPKjgJmdwJ2gRVO0jMKBt88rV2liT/c6MTsXyuWbGFiHe9MRddWJw==", + "dev": true, + "dependencies": { + "@ts-morph/common": "~0.11.1", + "code-block-writer": "^10.1.1" + } + }, "node_modules/ts-node": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", @@ -14047,9 +14193,9 @@ } }, "node_modules/vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", + "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==", "dev": true, "dependencies": { "clone": "^2.1.1", @@ -14121,15 +14267,6 @@ "node": ">=0.10.0" } }, - "node_modules/vinyl/node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, "node_modules/vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -14321,6 +14458,214 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.0-next.12.tgz", "integrity": "sha512-kaXEKkIrkd8UaQzkwUYSMgG6VVr8lplvng+/UKPb6rPYdOJ5a6JqNd87ohgIIWFE/tDWPiFM8TTGIQ2IJe02eg==" }, + "node_modules/vscode-nls": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.1.tgz", + "integrity": "sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==" + }, + "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-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/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/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/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.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.1.tgz", + "integrity": "sha512-WSZD9jgobAg3ZKuCQZSa3g9QOJeCCqLoLAykiWgmXnDo9EPnn4RPf5qVTtzgOx66o6/oqhcA5tHtJXpG8pMt3g==", + "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.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/vscode-ripgrep": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/vscode-ripgrep/-/vscode-ripgrep-1.13.2.tgz", + "integrity": "sha512-RlK9U87EokgHfiOjDQ38ipQQX936gWOcWPQaJpYf+kAkz1PQ1pK2n7nhiscdOmLu6XGjTs7pWFJ/ckonpN7twQ==", + "deprecated": "This package has been renamed to @vscode/ripgrep, please update to the new name", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "https-proxy-agent": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/vscode-ripgrep/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vscode-ripgrep/node_modules/https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "dependencies": { + "agent-base": "5", + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/vscode-tas-client": { "version": "0.1.22", "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.22.tgz", @@ -14332,6 +14677,21 @@ "vscode": "^1.19.1" } }, + "node_modules/vscode-telemetry-extractor": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/vscode-telemetry-extractor/-/vscode-telemetry-extractor-1.9.5.tgz", + "integrity": "sha512-saUkRZrXVi9sKNqT6xqjky3oqybrj6ipdRCA257Ao1MgU260A2K4mD5kEZhupBdSD4+t+QwCv8WCFIcZDRD0Aw==", + "deprecated": "This package has been renamed to @vscode/telemetry-extractor, please update to the new name", + "dev": true, + "dependencies": { + "command-line-args": "^5.2.0", + "ts-morph": "^12.2.0", + "vscode-ripgrep": "^1.12.1" + }, + "bin": { + "vscode-telemetry-extractor": "out/extractor.js" + } + }, "node_modules/vscode-uri": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", @@ -15389,6 +15749,41 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@ts-morph/common": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.11.1.tgz", + "integrity": "sha512-7hWZS0NRpEsNV8vWJzg7FEz6V8MaLNeJOmwmghqUXTpzk16V1LLZhdo+4QvE/+zv4cVci0OviuJFnqhEfoV3+g==", + "dev": true, + "requires": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true + } + } + }, "@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -16108,6 +16503,12 @@ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, "aggregate-error": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", @@ -17445,6 +17846,12 @@ } } }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, "clone-buffer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", @@ -17488,6 +17895,12 @@ "readable-stream": "^2.3.5" } }, + "code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -19142,6 +19555,21 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "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", @@ -19795,6 +20223,12 @@ "map-cache": "^0.2.2" } }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, "from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -20791,6 +21225,12 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "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", @@ -22003,6 +22443,12 @@ "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", @@ -23570,6 +24016,15 @@ "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" + } + }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -24811,6 +25266,15 @@ "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", @@ -24879,6 +25343,16 @@ "readable-stream": "^2.0.2" } }, + "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", @@ -25571,6 +26045,16 @@ "lodash": "^4.17.5" } }, + "ts-morph": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-12.2.0.tgz", + "integrity": "sha512-WHXLtFDcIRwoqaiu0elAoZ/AmI+SwwDafnPKjgJmdwJ2gRVO0jMKBt88rV2liT/c6MTsXyuWbGFiHe9MRddWJw==", + "dev": true, + "requires": { + "@ts-morph/common": "~0.11.1", + "code-block-writer": "^10.1.1" + } + }, "ts-node": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", @@ -26109,9 +26593,9 @@ } }, "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", + "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==", "dev": true, "requires": { "clone": "^2.1.1", @@ -26120,14 +26604,6 @@ "cloneable-readable": "^1.0.0", "remove-trailing-separator": "^1.0.1", "replace-ext": "^1.0.0" - }, - "dependencies": { - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - } } }, "vinyl-fs": { @@ -26333,6 +26809,166 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.0-next.12.tgz", "integrity": "sha512-kaXEKkIrkd8UaQzkwUYSMgG6VVr8lplvng+/UKPb6rPYdOJ5a6JqNd87ohgIIWFE/tDWPiFM8TTGIQ2IJe02eg==" }, + "vscode-nls": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.1.tgz", + "integrity": "sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==" + }, + "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-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 + }, + "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 + }, + "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" + } + }, + "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.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.1.tgz", + "integrity": "sha512-WSZD9jgobAg3ZKuCQZSa3g9QOJeCCqLoLAykiWgmXnDo9EPnn4RPf5qVTtzgOx66o6/oqhcA5tHtJXpG8pMt3g==", + "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.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", + "dev": true + } + } + }, + "vscode-ripgrep": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/vscode-ripgrep/-/vscode-ripgrep-1.13.2.tgz", + "integrity": "sha512-RlK9U87EokgHfiOjDQ38ipQQX936gWOcWPQaJpYf+kAkz1PQ1pK2n7nhiscdOmLu6XGjTs7pWFJ/ckonpN7twQ==", + "dev": true, + "requires": { + "https-proxy-agent": "^4.0.0", + "proxy-from-env": "^1.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + } + } + }, "vscode-tas-client": { "version": "0.1.22", "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.22.tgz", @@ -26341,6 +26977,17 @@ "tas-client": "0.1.21" } }, + "vscode-telemetry-extractor": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/vscode-telemetry-extractor/-/vscode-telemetry-extractor-1.9.5.tgz", + "integrity": "sha512-saUkRZrXVi9sKNqT6xqjky3oqybrj6ipdRCA257Ao1MgU260A2K4mD5kEZhupBdSD4+t+QwCv8WCFIcZDRD0Aw==", + "dev": true, + "requires": { + "command-line-args": "^5.2.0", + "ts-morph": "^12.2.0", + "vscode-ripgrep": "^1.12.1" + } + }, "vscode-uri": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", diff --git a/package.json b/package.json index 582bae0903b2..a5c09a34c4bf 100644 --- a/package.json +++ b/package.json @@ -1800,6 +1800,7 @@ "vscode-languageclient": "8.0.0-next.18", "vscode-languageserver": "8.0.0-next.14", "vscode-languageserver-protocol": "3.17.0-next.20", + "vscode-nls": "^5.0.1", "vscode-tas-client": "^0.1.22", "winreg": "^1.2.4", "xml2js": "^0.4.19" @@ -1874,6 +1875,8 @@ "uuid": "^8.3.2", "vsce": "^2.6.6", "vscode-debugadapter-testsupport": "^1.27.0", + "vscode-nls-dev": "^4.0.0", + "vscode-telemetry-extractor": "^1.9.5", "webpack": "^5.70.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.2", diff --git a/package.nls.de.json b/package.nls.de.json deleted file mode 100644 index 1a1d49c2be9c..000000000000 --- a/package.nls.de.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "python.command.python.sortImports.title": "Sortieren der Importe", - "python.command.python.startREPL.title": "Starten des REPL", - "python.command.python.createTerminal.title": "Terminal erstellen", - "python.command.python.execInTerminal.title": "Python-Datei im Terminal ausführen", - "python.command.python.setInterpreter.title": "Interpreter auswählen", - "python.command.python.execSelectionInTerminal.title": "Selektion/Reihe in Python-Terminal ausführen", - "python.command.python.execSelectionInDjangoShell.title": "Selektion/Reihe in Django-Shell ausführen", - "python.command.python.goToPythonObject.title": "Gehe zu Python-Objekt", - "python.command.python.setLinter.title": "Linter auswählen", - "python.command.python.enableLinting.title": "Linting aktivieren", - "python.command.python.runLinting.title": "Linting ausführen", - "python.snippet.launch.standard.label": "Python: Aktuelle Datei", - "python.snippet.launch.module.label": "Python: Modul", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid-Anwendung", - "python.snippet.launch.attach.label": "Python: Anfügen" -} diff --git a/package.nls.es.json b/package.nls.es.json deleted file mode 100644 index 2cd46f60a892..000000000000 --- a/package.nls.es.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "python.command.python.sortImports.title": "Ordenar importaciones", - "python.command.python.startREPL.title": "Crear REPL", - "python.command.python.createTerminal.title": "Nuevo terminal", - "python.command.python.execInTerminal.title": "Ejecutar archivo Python en la terminal", - "python.command.python.setInterpreter.title": "Seleccionar intérprete", - "python.command.python.execSelectionInTerminal.title": "Ejecutar línea/selección en la terminal", - "python.command.python.execSelectionInDjangoShell.title": "Ejecutar línea/selección en el intérprete de Django", - "python.command.python.goToPythonObject.title": "Ir al objeto de Python", - "python.command.python.setLinter.title": "Seleccionar Linter", - "python.command.python.enableLinting.title": "Habilitar Linting", - "python.command.python.runLinting.title": "Ejecutar Linting", - "python.snippet.launch.standard.label": "Python: Archivo actual", - "python.snippet.launch.module.label": "Python: Módulo", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid", - "python.snippet.launch.attach.label": "Python: Adjuntar" -} diff --git a/package.nls.fr.json b/package.nls.fr.json deleted file mode 100644 index 605c7a16a74e..000000000000 --- a/package.nls.fr.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "python.command.python.sortImports.title": "Trier les imports", - "python.command.python.startREPL.title": "Démarrer la console interactive", - "python.command.python.createTerminal.title": "Créer un terminal", - "python.command.python.execInTerminal.title": "Exécuter le script Python dans un terminal", - "python.command.python.setInterpreter.title": "Sélectionner l'interpreteur", - "python.command.python.execSelectionInTerminal.title": "Exécuter la ligne/sélection dans un terminal Python", - "python.command.python.execSelectionInDjangoShell.title": "Exécuter la ligne/sélection dans un shell Django", - "python.command.python.goToPythonObject.title": "Se rendre à l'objet Python", - "python.command.python.setLinter.title": "Sélectionner le linter", - "python.command.python.enableLinting.title": "Activer le linting", - "python.command.python.runLinting.title": "Exécuter le linting", - "python.snippet.launch.standard.label": "Python : Fichier actuel", - "python.snippet.launch.module.label": "Python: Module", - "python.snippet.launch.django.label": "Python : Django", - "python.snippet.launch.flask.label": "Python : Flask", - "python.snippet.launch.pyramid.label": "Python : application Pyramid", - "python.snippet.launch.attach.label": "Python: Attacher" -} diff --git a/package.nls.it.json b/package.nls.it.json deleted file mode 100644 index 9ff7f2e83c9f..000000000000 --- a/package.nls.it.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "python.command.python.sortImports.title": "Ordina gli import", - "python.command.python.startREPL.title": "Apri nuova REPL", - "python.command.python.createTerminal.title": "Apri nuovo terminale", - "python.command.python.execInTerminal.title": "Esegui file Python nel terminale", - "python.command.python.setInterpreter.title": "Seleziona interprete", - "python.command.python.execSelectionInTerminal.title": "Esegui selezione/linea nel terminale di Python", - "python.command.python.execSelectionInDjangoShell.title": "Esegui selezione/linea nella shell Django", - "python.command.python.goToPythonObject.title": "Vai a oggetto Python", - "python.command.python.setLinter.title": "Selezione Linter", - "python.command.python.enableLinting.title": "Attiva Linting", - "python.command.python.runLinting.title": "Esegui Linting", - "python.snippet.launch.standard.label": "Python: File corrente", - "python.snippet.launch.module.label": "Python: Modulo", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Applicazione Pyramid", - "python.snippet.launch.attach.label": "Python: Allega", - "ExtensionSurveyBanner.bannerLabelYes": "Sì, prenderò il sondaggio ora" -} diff --git a/package.nls.ja.json b/package.nls.ja.json deleted file mode 100644 index a6c2d1541819..000000000000 --- a/package.nls.ja.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "python.command.python.sortImports.title": "import 文を並び替える", - "python.command.python.startREPL.title": "REPL を開始", - "python.command.python.execInTerminal.title": "ターミナルで Python ファイルを実行", - "python.command.python.setInterpreter.title": "インタープリターを選択", - "python.command.python.execSelectionInTerminal.title": "Python ターミナルで選択範囲/行を実行", - "python.command.python.execSelectionInDjangoShell.title": "Django シェルで選択範囲/行を実行", - "python.command.python.goToPythonObject.title": "Python オブジェクトに移動", - "python.snippet.launch.standard.label": "Python: Current File", - "python.snippet.launch.module.label": "Python: モジュール", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid アプリケーション", - "python.snippet.launch.attach.label": "Python: アタッチ" -} diff --git a/package.nls.json b/package.nls.json index 7550a65d7828..e52df951c462 100644 --- a/package.nls.json +++ b/package.nls.json @@ -24,198 +24,5 @@ "python.command.python.analysis.restartLanguageServer.title": "Restart Language Server", "python.command.python.launchTensorBoard.title": "Launch TensorBoard", "python.command.python.refreshTensorBoard.title": "Refresh TensorBoard", - "python.menu.createNewFile.title": "Python File", - "python.snippet.launch.standard.label": "Python: Current File", - "python.snippet.launch.module.label": "Python: Module", - "python.snippet.launch.module.default": "enter-your-module-name", - "python.snippet.launch.attach.label": "Python: Remote Attach", - "python.snippet.launch.attachpid.label": "Python: Attach using Process Id", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.fastapi.label": "Python: FastAPI", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid Application", - "Pylance.remindMeLater": "Remind me later", - "Pylance.pylanceNotInstalledMessage": "Pylance extension is not installed.", - "Pylance.pylanceInstalledReloadPromptMessage": "Pylance extension is now installed. Reload window to activate?", - "Pylance.pylanceRevertToJediPrompt": "The Pylance extension is not installed but the python.languageServer value is set to \"Pylance\". Would you like to install the Pylance extension to use Pylance, or revert back to Jedi?", - "Pylance.pylanceInstallPylance": "Install Pylance", - "Pylance.pylanceRevertToJedi": "Revert to Jedi", - "Experiments.inGroup": "Experiment '{0}' is active", - "Experiments.optedOutOf": "Experiment '{0}' is inactive", - "Interpreters.installingPython": "Installing Python into Environment...", - "Interpreters.clearAtWorkspace": "Clear at workspace level", - "Interpreters.RefreshingInterpreters": "Refreshing Python Interpreters", - "Interpreters.entireWorkspace": "Select at workspace level", - "Interpreters.pythonInterpreterPath": "Python interpreter path: {0}", - "Interpreters.DiscoveringInterpreters": "Discovering Python Interpreters", - "Interpreters.condaInheritEnvMessage": "We noticed you're using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change \"terminal.integrated.inheritEnv\" to false in your user settings.", - "Logging.CurrentWorkingDirectory": "cwd:", - "InterpreterQuickPickList.workspaceGroupName": "Workspace", - "InterpreterQuickPickList.globalGroupName": "Global", - "InterpreterQuickPickList.quickPickListPlaceholder": "Selected Interpreter: {0}", - "InterpreterQuickPickList.enterPath.label": "Enter interpreter path...", - "InterpreterQuickPickList.enterPath.placeholder": "Enter path to a Python interpreter.", - "InterpreterQuickPickList.refreshInterpreterList": "Refresh Interpreter list", - "InterpreterQuickPickList.browsePath.label": "Find...", - "InterpreterQuickPickList.browsePath.detail": "Browse your file system to find a Python interpreter.", - "InterpreterQuickPickList.browsePath.title": "Select Python interpreter", - "InterpreterQuickPickList.defaultInterpreterPath.label": "Use Python from `python.defaultInterpreterPath` setting", - "Common.clearAll": "Clear all", - "Common.bannerLabelYes": "Yes", - "Common.bannerLabelNo": "No", - "Common.doNotShowAgain": "Do not show again", - "Common.reload": "Reload", - "Common.moreInfo": "More Info", - "Common.and": "and", - "Common.ok": "Ok", - "Common.error": "Error", - "Common.install": "Install", - "Common.learnMore": "Learn more", - "Common.reportThisIssue": "Report this issue", - "Common.recommended": "Recommended", - "CommonSurvey.remindMeLaterLabel": "Remind me later", - "CommonSurvey.yesLabel": "Yes, take survey now", - "CommonSurvey.noLabel": "No, thanks", - "OutputChannelNames.languageServer": "Python Language Server", - "OutputChannelNames.python": "Python", - "OutputChannelNames.pythonTest": "Python Test Log", - "ExtensionSurveyBanner.bannerMessage": "Can you please take 2 minutes to tell us how the Python extension is working for you?", - "ExtensionSurveyBanner.bannerLabelYes": "Yes, take survey now", - "ExtensionSurveyBanner.bannerLabelNo": "No, thanks", - "ExtensionSurveyBanner.maybeLater": "Maybe later", - "Interpreters.environmentPromptMessage": "We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?", - "Linter.replaceWithSelectedLinter": "Multiple linters are enabled in settings. Replace with '{0}'?", - "Linter.install": "Install a linter to get error reporting.", - "Linter.selectLinter": "Select Linter", - "Installer.noCondaOrPipInstaller": "There is no Conda or Pip installer available in the selected environment.", - "Installer.noPipInstaller": "There is no Pip installer available in the selected environment.", - "Installer.searchForHelp": "Search for help", - "Installer.couldNotInstallLibrary": "Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.", - "Installer.dataScienceInstallPrompt": "Data Science library {0} is not installed. Install?", - "diagnostics.removedPythonPathFromSettings": "The \"python.pythonPath\" setting in your settings.json is no longer used by the Python extension. If you want, you can use a new setting called \"python.defaultInterpreterPath\" instead. Keep in mind that you need to change the value of this setting manually as the Python extension doesn’t modify it when you change interpreters. [Learn more](https://aka.ms/AA7jfor).", - "diagnostics.warnSourceMaps": "Source map support is enabled in the Python Extension, this will adversely impact performance of the extension.", - "diagnostics.disableSourceMaps": "Disable Source Map Support", - "diagnostics.warnBeforeEnablingSourceMaps": "Enabling source map support in the Python Extension will adversely impact performance of the extension.", - "diagnostics.enableSourceMapsAndReloadVSC": "Enable and reload Window", - "diagnostics.lsNotSupported": "Your operating system does not meet the minimum requirements of the Python Language Server. Reverting to the alternative autocompletion provider, Jedi.", - "diagnostics.invalidPythonPathInDebuggerSettings": "You need to select a Python interpreter before you start debugging.\n\nTip: click on \"Select Python Interpreter\" in the status bar.", - "diagnostics.invalidPythonPathInDebuggerLaunch": "The Python path in your debug configuration is invalid.", - "diagnostics.invalidDebuggerTypeDiagnostic": "Your launch.json file needs to be updated to change the \"pythonExperimental\" debug configurations to use the \"python\" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", - "diagnostics.consoleTypeDiagnostic": "Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", - "diagnostics.justMyCodeDiagnostic": "Configuration \"debugStdLib\" in launch.json is no longer supported. It's recommended to replace it with \"justMyCode\", which is the exact opposite of using \"debugStdLib\". Would you like to automatically update your launch.json file to do that?", - "diagnostics.checkIsort5UpgradeGuide": "We found outdated configuration for sorting imports in this workspace. Check the [isort upgrade guide](https://aka.ms/AA9j5x4) to update your settings.", - "diagnostics.yesUpdateLaunch": "Yes, update launch.json", - "diagnostics.invalidTestSettings": "Your settings needs to be updated to change the setting \"python.unitTest.\" to \"python.testing.\", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?", - "diagnostics.pylanceDefaultMessage": "The Python extension now includes Pylance to improve completions, code navigation, overall performance and much more! You can learn more about the update and learn how to change your language server [here](https://aka.ms/new-python-bundle).\n\nRead Pylance’s license [here](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license).", - "Common.canceled": "Canceled", - "Common.cancel": "Cancel", - "Common.yesPlease": "Yes, please", - "Common.loadingPythonExtension": "Python extension loading...", - "debug.selectConfigurationTitle": "Select a debug configuration", - "debug.selectConfigurationPlaceholder": "Debug Configuration", - "debug.launchJsonConfigurationsCompletionLabel": "Python", - "debug.launchJsonConfigurationsCompletionDescription": "Select a Python debug configuration", - "debug.debugFileConfigurationLabel": "Python File", - "debug.debugFileConfigurationDescription": "Debug the currently active Python file", - "debug.debugModuleConfigurationLabel": "Module", - "debug.debugModuleConfigurationDescription": "Debug a Python module by invoking it with '-m'", - "debug.moduleEnterModuleTitle": "Debug Module", - "debug.moduleEnterModulePrompt": "Enter a Python module/package name", - "debug.moduleEnterModuleDefault": "enter-your-module-name", - "debug.moduleEnterModuleInvalidNameError": "Enter a valid module name", - "debug.remoteAttachConfigurationLabel": "Remote Attach", - "debug.remoteAttachConfigurationDescription": "Attach to a remote debug server", - "debug.attachRemoteHostTitle": "Remote Debugging", - "debug.attachRemoteHostPrompt": "Enter the host name", - "debug.attachRemoteHostValidationError": "Enter a valid host name or IP address", - "debug.attachRemotePortTitle": "Remote Debugging", - "debug.attachRemotePortPrompt": "Enter the port number that the debug server is listening on", - "debug.attachRemotePortValidationError": "Enter a valid port number", - "debug.attachPidConfigurationLabel": "Attach using Process ID", - "debug.attachPidConfigurationDescription": "Attach to a local process", - "debug.debugDjangoConfigurationLabel": "Django", - "debug.debugDjangoConfigurationDescription": "Launch and debug a Django web application", - "debug.djangoEnterManagePyPathTitle": "Debug Django", - "debug.djangoEnterManagePyPathPrompt": "Enter the path to manage.py ('${workspaceFolderToken}' points to the root of the current workspace folder)", - "debug.djangoEnterManagePyPathInvalidFilePathError": "Enter a valid Python file path", - "debug.debugFastAPIConfigurationLabel": "FastAPI", - "debug.debugFastAPIConfigurationDescription": "Launch and debug a FastAPI web application", - "debug.fastapiEnterAppPathOrNamePathTitle": "Debug FastAPI", - "debug.fastapiEnterAppPathOrNamePathPrompt": "Enter the path to the application, e.g. 'main.py' or 'main'", - "debug.fastapiEnterAppPathOrNamePathInvalidNameError": "Enter a valid name", - "debug.debugFlaskConfigurationLabel": "Flask", - "debug.debugFlaskConfigurationDescription": "Launch and debug a Flask web application", - "debug.flaskEnterAppPathOrNamePathTitle": "Debug Flask", - "debug.flaskEnterAppPathOrNamePathPrompt": "Enter the path to the application, e.g. 'app.py' or 'app'", - "debug.flaskEnterAppPathOrNamePathInvalidNameError": "Enter a valid name", - "debug.debugPyramidConfigurationLabel": "Pyramid", - "debug.debugPyramidConfigurationDescription": "Launch and debug a Pyramid web application", - "debug.pyramidEnterDevelopmentIniPathTitle": "Debug Pyramid", - "debug.pyramidEnterDevelopmentIniPathPrompt": "`Enter the path to development.ini ('${workspaceFolderToken}' points to the root of the current workspace folder)`", - "debug.pyramidEnterDevelopmentIniPathInvalidFilePathError": "Enter a valid file path", - "Testing.configureTests": "Configure Test Framework", - "Testing.testNotConfigured": "No test framework configured.", - "Testing.cancelUnittestDiscovery": "Canceled unittest test discovery", - "Testing.errorUnittestDiscovery": "Unittest test discovery error", - "Testing.seePythonOutput": "(see Output > Python)", - "Common.openOutputPanel": "Show output", - "LanguageService.statusItem.name": "Python IntelliSense Status", - "LanguageService.statusItem.text": "Partial Mode", - "LanguageService.virtualWorkspaceStatusItem.detail": "Only limited IntelliSense is supported", - "LanguageService.statusItem.detail": "Limited IntelliSense provided by Pylance", - "LanguageService.lsFailedToStart": "We encountered an issue starting the language server. Reverting to Jedi language engine. Check the Python output panel for details.", - "LanguageService.lsFailedToDownload": "We encountered an issue downloading the language server. Reverting to Jedi language engine. Check the Python output panel for details.", - "LanguageService.lsFailedToExtract": "We encountered an issue extracting the language server. Reverting to Jedi language engine. Check the Python output panel for details.", - "LanguageService.untrustedWorkspaceMessage": "Only Pylance is supported in untrusted workspaces, setting language server to None.", - "LanguageService.downloadFailedOutputMessage": "Language server download failed", - "LanguageService.extractionFailedOutputMessage": "Language server extraction failed", - "LanguageService.extractionCompletedOutputMessage": "Language server download complete", - "LanguageService.extractionDoneOutputMessage": "done", - "LanguageService.reloadVSCodeIfSeachPathHasChanged": "Search paths have changed for this Python interpreter. Please reload the extension to ensure that the IntelliSense works correctly", - "LanguageService.startingPylance": "Starting Pylance language server.", - "LanguageService.startingJedi": "Starting Jedi language server for {0}.", - "LanguageService.startingNone": "Editor support is inactive since language server is set to None.", - "LanguageService.reloadAfterLanguageServerChange": "Please reload the window switching between language servers.", - "AttachProcess.unsupportedOS": "Operating system '{0}' not supported.", - "AttachProcess.attachTitle": "Attach to process", - "AttachProcess.selectProcessPlaceholder": "Select the process to attach to", - "AttachProcess.noProcessSelected": "No process selected", - "AttachProcess.refreshList": "Refresh process list", - "diagnostics.updateSettings": "Yes, update settings", - "Common.noIWillDoItLater": "No, I will do it later", - "Common.notNow": "Not now", - "Common.gotIt": "Got it!", - "Interpreters.selectInterpreterTip": "Tip: you can change the Python interpreter used by the Python extension by clicking on the Python version in the status bar", - "downloading.file": "Downloading {0}...", - "downloading.file.progress": "{0}{1} of {2} KB ({3}%)", - "products.installingModule": "Installing {0}", - "products.formatterNotInstalled": "Formatter {0} is not installed. Install?", - "products.useFormatter": "Use {0}", - "products.invalidFormatterPath": "Path to the {0} formatter is invalid ({1})", - "OutdatedDebugger.updateDebuggerMessage": "We noticed you are attaching to ptvsd (Python debugger), which was deprecated on May 1st, 2020. Please switch to [debugpy](https://aka.ms/migrateToDebugpy).", - "Python27Support.jediMessage": "IntelliSense with Jedi for Python 2.7 is no longer supported. [Learn more](https://aka.ms/python-27-support).", - "Jupyter.extensionRequired": "The Jupyter extension is required to perform that task. Click Yes to open the Jupyter extension installation page.", - "TensorBoard.missingSourceFile": "We could not locate the requested source file on disk. Please manually specify the file.", - "TensorBoard.selectMissingSourceFile": "Choose File", - "TensorBoard.selectMissingSourceFileDescription": "The source file's contents may not match the original contents in the trace.", - "TensorBoard.useCurrentWorkingDirectory": "Use current working directory", - "TensorBoard.currentDirectory": "Current: {0}", - "TensorBoard.logDirectoryPrompt": "Select a log directory to start TensorBoard with", - "TensorBoard.progressMessage": "Starting TensorBoard session...", - "TensorBoard.failedToStartSessionError": "We failed to start a TensorBoard session due to the following error: {0}", - "TensorBoard.nativeTensorBoardPrompt": "VS Code now has integrated TensorBoard support. Would you like to launch TensorBoard? (Tip: Launch TensorBoard anytime by opening the command palette and searching for \"Launch TensorBoard\".)", - "TensorBoard.selectAFolder": "Select a folder", - "TensorBoard.selectAnotherFolder": "Select another folder", - "TensorBoard.selectAFolderDetail": "Select a log directory containing tfevent files", - "TensorBoard.selectAnotherFolderDetail": "Use the file explorer to select another folder", - "TensorBoard.useCurrentWorkingDirectoryDetail": "TensorBoard will search for tfevent files in all subdirectories of the current working directory", - "TensorBoard.installPrompt": "The package TensorBoard is required to launch a TensorBoard session. Would you like to install it?", - "TensorBoard.installTensorBoardAndProfilerPluginPrompt": "TensorBoard >= 2.4.1 and the PyTorch Profiler TensorBoard Plugin are required. Would you like to install these packages?", - "TensorBoard.installProfilerPluginPrompt": "We recommend installing the PyTorch Profiler TensorBoard plugin. Would you like to install the package?", - "TensorBoard.upgradePrompt": "Integrated TensorBoard support is only available for TensorBoard >= 2.4.1. Would you like to upgrade your copy of TensorBoard?", - "TensorBoard.launchNativeTensorBoardSessionCodeAction": "Launch TensorBoard session", - "TensorBoard.launchNativeTensorBoardSessionCodeLens": "▶ Launch TensorBoard Session", - "TensorBoard.enterRemoteUrl": "Enter remote URL", - "TensorBoard.enterRemoteUrlDetail": "Enter a URL pointing to a remote directory containing your TensorBoard log files", - "SwitchToDefaultLS.bannerMessage": "The Microsoft Python Language Server has reached end of life. Your language server has been set to the default for Python in VS Code, Pylance. If you’d like to change your language server, you can learn about how to do so [here](https://devblogs.microsoft.com/python/python-in-visual-studio-code-may-2021-release/#configuring-your-language-server). Read Pylance’s license [here](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license)." + "python.menu.createNewFile.title": "Python File" } diff --git a/package.nls.ko-kr.json b/package.nls.ko-kr.json deleted file mode 100644 index 7ecce3df7453..000000000000 --- a/package.nls.ko-kr.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "python.command.python.sortImports.title": "Import문 정렬", - "python.command.python.startREPL.title": "REPL 시작", - "python.command.python.execInTerminal.title": "터미널에서 Python 파일 실행", - "python.command.python.setInterpreter.title": "인터프리터 선택", - "python.command.python.execSelectionInTerminal.title": "Python 터미널에서 선택 영역/줄 실행", - "python.command.python.execSelectionInDjangoShell.title": "Django 셸에서 선택 영역/줄 실행", - "python.command.python.goToPythonObject.title": " Python 객체로 이동", - "python.snippet.launch.standard.label": "Python: Current File", - "python.snippet.launch.module.label": "Python: 모듈", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid 응용 프로그램", - "python.snippet.launch.attach.label": "Python: 연결" -} diff --git a/package.nls.nl.json b/package.nls.nl.json deleted file mode 100644 index 6b840e61dbe2..000000000000 --- a/package.nls.nl.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "python.command.python.sortImports.title": "Import sorteren", - "python.command.python.startREPL.title": "REPL starten", - "python.command.python.createTerminal.title": "Terminal aanmaken", - "python.command.python.execInTerminal.title": "Python-bestand in terminal uitvoeren", - "python.command.python.setInterpreter.title": "Interpreter selecteren", - "python.command.python.execSelectionInTerminal.title": "Selectie/rij in Python-terminal uitvoeren", - "python.command.python.execSelectionInDjangoShell.title": "Selectie/rij in Django-shell uitvoeren", - "python.command.python.goToPythonObject.title": "Naar Python-object gaan", - "python.command.python.setLinter.title": "Linter selecteren", - "python.command.python.enableLinting.title": "Linting activeren", - "python.command.python.runLinting.title": "Linting uitvoeren", - "python.command.python.enableSourceMapSupport.title": "Bronkaartondersteuning voor extensie-debugging inschakelen", - "python.snippet.launch.standard.label": "Python: Huidige bestand", - "python.snippet.launch.module.label": "Python: Module", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid-applicatie", - "python.snippet.launch.attach.label": "Python: aankoppelen", - "ExtensionSurveyBanner.bannerLabelYes": "Ja, neem nu deel aan het onderzoek", - "ExtensionSurveyBanner.bannerLabelNo": "Nee, bedankt", - "LanguageService.lsFailedToStart": "We zijn een probleem tegengekomen bij het starten van de language server. Aan het terugschakelen naar het alternatief, Jedi. Bekijk het weergavepaneel voor details.", - "LanguageService.lsFailedToDownload": "We zijn een probleem tegengekomen bij het downloaden van de language server. Aan het terugschakelen naar het alternatief, Jedi. Bekijk het weergavepaneel voor details.", - "LanguageService.lsFailedToExtract": "We zijn een probleem tegengekomen bij het uitpakken van de language server. Aan het terugschakelen naar het alternatief, Jedi. Bekijk het weergavepaneel voor details.", - "Interpreters.RefreshingInterpreters": "Python-Interpreters verversen", - "Linter.InstalledButNotEnabled": "Linter {0} is geinstalleerd maar niet ingeschakeld.", - "Linter.replaceWithSelectedLinter": "Meerdere linters zijn ingeschakeld in de instellingen. Vervangen met '{0}'?", - "diagnostics.warnSourceMaps": "Bronkaartondersteuning is ingeschakeld in de Python-extensie, dit zal een ongunstige impact hebben op de uitvoering van de extensie.", - "diagnostics.disableSourceMaps": "Bronkaartondersteuning uitschakelen", - "diagnostics.warnBeforeEnablingSourceMaps": "Bronkaartondersteuning inschakelen in de Python-extensie zal een ongunstige impact hebben op de uitvoering van de extensie.", - "diagnostics.enableSourceMapsAndReloadVSC": "Venster inschakelen en herladen", - "diagnostics.lsNotSupported": "Uw besturingssysteem voldoet niet aan de minimumeisen van de language server. Aan het terugschakelen naar het alternatief, Jedi.", - "Common.canceled": "Geannuleerd", - "Common.loadingPythonExtension": "Python-extensie aan het laden...", - "debug.selectConfigurationTitle": "Een debug-configuratie selecteren", - "debug.selectConfigurationPlaceholder": "Debug-configuratie", - "debug.debugFileConfigurationLabel": "Python-bestand", - "debug.debugFileConfigurationDescription": "Python-bestand debuggen", - "debug.debugModuleConfigurationLabel": "Module", - "debug.debugModuleConfigurationDescription": "Python module/package debuggen", - "debug.remoteAttachConfigurationLabel": "Extern aankoppelen", - "debug.remoteAttachConfigurationDescription": "Een externe Python-applicatie debuggen", - "debug.debugDjangoConfigurationLabel": "Django", - "debug.debugDjangoConfigurationDescription": "Web-applicatie", - "debug.debugFlaskConfigurationLabel": "Flask", - "debug.debugFlaskConfigurationDescription": "Web-applicatie", - "debug.debugPyramidConfigurationLabel": "Pyramid", - "debug.debugPyramidConfigurationDescription": "Web-applicatie", - "debug.djangoEnterManagePyPathTitle": "Django debuggen", - "debug.djangoEnterManagePyPathPrompt": "Voer een pad in naar manage.py ('${workspaceFolderToken}' verwijzen naar de root van de huidige werkruimtemap)", - "debug.djangoEnterManagePyPathInvalidFilePathError": "Voer een geldig Python-bestandspad in", - "debug.flaskEnterAppPathOrNamePathTitle": "Flask debuggen", - "debug.flaskEnterAppPathOrNamePathPrompt": "Voer een pad in naar een applicatie, bijvoorbeeld 'app.py' of 'app'", - "debug.flaskEnterAppPathOrNamePathInvalidNameError": "Voer een geldige naam in", - "debug.moduleEnterModuleTitle": "Module debuggen", - "debug.moduleEnterModulePrompt": "Voer Python module/package naam in", - "debug.moduleEnterModuleInvalidNameError": "Voer een geldige naam in", - "debug.pyramidEnterDevelopmentIniPathTitle": "Pyramid debuggen", - "debug.pyramidEnterDevelopmentIniPathPrompt": "`Voer een pad in naar development.ini ('${workspaceFolderToken}' verwijzen naar de root van de huidige werkruimtemap)`", - "debug.pyramidEnterDevelopmentIniPathInvalidFilePathError": "Voer een geldig bestandspad in", - "debug.attachRemotePortTitle": "Extern debuggen", - "debug.attachRemotePortPrompt": "Voer een port-nummer in", - "debug.attachRemotePortValidationError": "Voer een geldig port-nummer in", - "debug.attachRemoteHostTitle": "Extern debuggen", - "debug.attachRemoteHostPrompt": "Voer een hostname of IP-adres in", - "debug.attachRemoteHostValidationError": "Voer een geldige hostname of IP-adres in" -} diff --git a/package.nls.pl.json b/package.nls.pl.json deleted file mode 100644 index 29c0a84f1709..000000000000 --- a/package.nls.pl.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "python.command.python.sortImports.title": "Sortuj importy", - "python.command.python.startREPL.title": "Uruchom REPL", - "python.command.python.createTerminal.title": "Otwórz Terminal", - "python.command.python.execInTerminal.title": "Uruchom plik pythonowy w terminalu", - "python.command.python.setInterpreter.title": "Wybierz wersję interpretera", - "python.command.python.viewOutput.title": "Pokaż wyniki", - "python.command.python.configureTests.title": "Konfiguruj testy jednostkowe", - "python.command.python.execSelectionInTerminal.title": "Uruchom zaznaczony obszar w interpreterze Pythona", - "python.command.python.execSelectionInDjangoShell.title": "Uruchom zaznaczony obszar w powłoce Django", - "python.command.python.goToPythonObject.title": "Idź do obiektu pythonowego", - "python.command.python.setLinter.title": "Wybierz linter", - "python.command.python.enableLinting.title": "Włącz linting", - "python.command.python.runLinting.title": "Uruchom linting", - "python.command.python.enableSourceMapSupport.title": "Włącz obsługę map źródłowych do debugowania rozszerzeń" -} diff --git a/package.nls.pt-br.json b/package.nls.pt-br.json deleted file mode 100644 index 9418af230bee..000000000000 --- a/package.nls.pt-br.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "python.command.python.sortImports.title": "Ordenar Importações", - "python.command.python.startREPL.title": "Iniciar REPL", - "python.command.python.createTerminal.title": "Criar Terminal", - "python.command.python.execInTerminal.title": "Executar Arquivo no Terminal", - "python.command.python.setInterpreter.title": "Selecionar Interpretador", - "python.command.python.execSelectionInTerminal.title": "Executar Seleção/Linha no Terminal", - "python.command.python.execSelectionInDjangoShell.title": "Executar Seleção/Linha no Django Shell", - "python.command.python.goToPythonObject.title": "Ir para Objeto Python", - "python.command.python.setLinter.title": "Selecionar Linter", - "python.command.python.enableLinting.title": "Habilitar Linting", - "python.command.python.runLinting.title": "Executar Linting", - "python.snippet.launch.standard.label": "Python: Arquivo Atual", - "python.snippet.launch.module.label": "Python: Módulo", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Aplicação Pyramid", - "python.snippet.launch.attach.label": "Python: Anexar" -} diff --git a/package.nls.ru.json b/package.nls.ru.json deleted file mode 100644 index df09b32ce72b..000000000000 --- a/package.nls.ru.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "python.command.python.sortImports.title": "Отсортировать Imports", - "python.command.python.startREPL.title": "Открыть REPL", - "python.command.python.execInTerminal.title": "Выполнить файл в консоли", - "python.command.python.setInterpreter.title": "Выбрать интерпретатор", - "python.command.python.execSelectionInTerminal.title": "Выполнить выбранный текст или текущую строку в консоли", - "python.command.python.execSelectionInDjangoShell.title": "Выполнить выбранный текст или текущую строку в оболочке Django", - "python.command.python.goToPythonObject.title": "Перейти к объекту Python", - "python.command.python.setLinter.title": "Выбрать анализатор кода", - "python.command.python.enableLinting.title": "Включить анализатор кода", - "python.command.python.runLinting.title": "Выполнить анализ кода", - "python.snippet.launch.standard.label": "Python: Текущий файл", - "python.snippet.launch.module.label": "Python: Модуль", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Приложение Pyramid", - "python.snippet.launch.attach.label": "Python: Подключить отладчик", - "ExtensionSurveyBanner.bannerLabelYes": "Да, открыть опрос сейчас", - "ExtensionSurveyBanner.bannerLabelNo": "Нет, спасибо", - "ExtensionSurveyBanner.maybeLater": "Может быть, позже", - "ExtensionSurveyBanner.bannerMessage": "Не могли бы вы потратить пару минут на опрос о языковом сервере Pylance?", - "Pylance.remindMeLater": "Напомните позже", - "Pylance.pylanceNotInstalledMessage": "Расширение Pylance не установлено.", - "Pylance.pylanceInstalledReloadPromptMessage": "Расширение Pylance установлено. Перезагрузить окно для его активации?", - "LanguageService.reloadAfterLanguageServerChange": "Пожалуйста, перезагрузите окно после смены типа языкового сервера." -} diff --git a/package.nls.tr.json b/package.nls.tr.json deleted file mode 100644 index 1982ee70012e..000000000000 --- a/package.nls.tr.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "python.command.python.sortImports.title": "Import İfadelerini Sırala", - "python.command.python.startREPL.title": "REPL Başlat", - "python.command.python.createTerminal.title": "Terminal Oluştur", - "python.command.python.execInTerminal.title": "Terminalde Çalıştır", - "python.command.python.setInterpreter.title": "Bir Interpreter Seçin", - "python.command.python.execSelectionInTerminal.title": "Seçimi/Satırı Terminalde Çalıştır", - "python.command.python.execSelectionInDjangoShell.title": "Seçimi/Satırı Django Shell'inde Çalıştır", - "python.command.python.goToPythonObject.title": "Python Nesnesine Git", - "python.command.python.setLinter.title": "Bir Linter Seç", - "python.command.python.enableLinting.title": "Linting'i Aktifleştir", - "python.command.python.runLinting.title": "Linter Çalıştır", - "python.snippet.launch.standard.label": "Python: Geçerli Dosya", - "python.snippet.launch.module.label": "Python: Modül", - "python.snippet.launch.module.default": "modül-adını-yazın", - "python.snippet.launch.attach.label": "Python: Remote Attach", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid Uygulaması" -} diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json deleted file mode 100644 index 30d10e9a60e3..000000000000 --- a/package.nls.zh-cn.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "python.command.python.sortImports.title": "排序 import 语句", - "python.command.python.startREPL.title": "启动 REPL", - "python.command.python.createTerminal.title": "创建终端", - "python.command.python.execInTerminal.title": "在终端中运行 Python 文件", - "python.command.python.setInterpreter.title": "选择解释器", - "python.command.python.clearWorkspaceInterpreter.title": "清除工作区解释器设置", - "python.command.python.viewOutput.title": "显示输出", - "python.command.python.viewLanguageServerOutput.title": "显示语言服务器输出", - "python.command.python.configureTests.title": "配置单元测试", - "python.command.testing.rerunFailedTests.title": "重新进行出错的单元测试", - "python.command.python.execSelectionInTerminal.title": "在 Python 终端中运行选定内容/行", - "python.command.python.execSelectionInDjangoShell.title": "在 Django Shell 中运行选定内容/行", - "python.command.python.goToPythonObject.title": "转到 Python 对象", - "python.command.python.reportIssue.title": "报告 Issue", - "python.command.python.setLinter.title": "选择代码检查器", - "python.command.python.enableLinting.title": "启用代码检查", - "python.command.python.runLinting.title": "执行代码检查", - "python.command.python.enableSourceMapSupport.title": "为扩展调试启用 Source Map 支持", - "python.command.python.clearPersistentStorage.title": "清空扩展内部缓存", - "python.command.python.analysis.restartLanguageServer.title": "重启语言服务器", - "python.command.python.launchTensorBoard.title": "启动 TensorBoard", - "python.command.python.refreshTensorBoard.title": "刷新 TensorBoard", - "python.snippet.launch.standard.label": "Python: 当前文件", - "python.snippet.launch.module.label": "Python: 模块", - "python.snippet.launch.module.default": "请输入模块名称", - "python.snippet.launch.attach.label": "Python: 远程连接", - "python.snippet.launch.attachpid.label": "Python: 使用 PID 连接", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.fastapi.label": "Python: FastAPI", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid 应用", - "Pylance.remindMeLater": "稍后提醒", - "Pylance.pylanceNotInstalledMessage": "Pylance 扩展未安装。", - "Pylance.pylanceInstalledReloadPromptMessage": "Pylance 扩展已安装。重新加载窗口以激活?", - "Pylance.pylanceRevertToJediPrompt": "Pylance 扩展未安装,但 python.languageServer 的值被设为了 \"Pylance\"。是否安装 Pylance 扩展,或选择使用 Jedi?", - "Pylance.pylanceInstallPylance": "安装 Pylance", - "Pylance.pylanceRevertToJedi": "使用 Jedi", - "Experiments.inGroup": "用户属于 '{0}' 实验组", - "Experiments.optedOutOf": "用户已退出 '{0}' 实验组", - "Interpreters.RefreshingInterpreters": "正在刷新 Python 解释器", - "Interpreters.entireWorkspace": "完整工作区", - "Interpreters.pythonInterpreterPath": "Python 解释器路径: {0}", - "Interpreters.condaInheritEnvMessage": "您正在使用 conda 环境,如果您在集成终端中遇到相关问题,建议您允许 Python 扩展将用户设置中的 \"terminal.integrated.inheritEnv\" 改为 false。", - "Logging.CurrentWorkingDirectory": "cwd:", - "InterpreterQuickPickList.enterPath.label": "输入解释器路径...", - "InterpreterQuickPickList.enterPath.placeholder": "请输入 Python 解释器的路径。", - "InterpreterQuickPickList.refreshInterpreterList": "刷新解释器列表", - "InterpreterQuickPickList.browsePath.label": "浏览...", - "InterpreterQuickPickList.browsePath.detail": "浏览文件系统来选择一个 Python 解释器。", - "InterpreterQuickPickList.browsePath.title": "选择 Python 解释器", - "InterpreterQuickPickList.defaultInterpreterPath.label": "使用默认 Python 解释器路径", - "Common.bannerLabelYes": "是", - "Common.bannerLabelNo": "否", - "Common.doNotShowAgain": "不再提示", - "Common.reload": "重新加载", - "Common.moreInfo": "更多信息", - "Common.and": "和", - "Common.ok": "好的", - "Common.install": "安装", - "Common.learnMore": "了解更多", - "Common.reportThisIssue": "反馈此问题", - "CommonSurvey.remindMeLaterLabel": "稍后提醒", - "CommonSurvey.yesLabel": "是的,现在接受调查", - "CommonSurvey.noLabel": "不,谢谢", - "OutputChannelNames.languageServer": "Python 语言服务器", - "OutputChannelNames.python": "Python", - "OutputChannelNames.pythonTest": "Python 测试日志", - "ExtensionSurveyBanner.bannerMessage": "请您花两分钟的时间告诉我们 Python 扩展是否正常工作?", - "ExtensionSurveyBanner.bannerLabelYes": "是的,现在接受调查", - "ExtensionSurveyBanner.bannerLabelNo": "不,谢谢", - "ExtensionSurveyBanner.maybeLater": "稍后提醒", - "Interpreters.environmentPromptMessage": "检测到新的虚拟环境,是否在此工作区中使用它?", - "Linter.replaceWithSelectedLinter": "设置中启用了多个代码检查器,是否用 '{0}' 替换?", - "Linter.install": "请安装一个代码检查器以获得错误报告。", - "Linter.selectLinter": "选择代码检查器", - "Installer.noCondaOrPipInstaller": "所选环境中没有可用的 Conda 或 pip 安装器。", - "Installer.noPipInstaller": "所选环境中没有可用的 pip 安装器。", - "Installer.searchForHelp": "搜索帮助", - "Installer.couldNotInstallLibrary": "无法安装 {0} 。如果 pip 不可用,请使用选择的包管理器手动将此库安装到您的 Python 环境中。", - "Installer.dataScienceInstallPrompt": "数据科学库 {0} 未安装,是否安装?", - "diagnostics.removedPythonPathFromSettings": "Python 扩展将不再使用 settings.json 中的 \"python.pythonPath\" 设置。可以将其替换为新设置 \"python.defaultInterpreterPath\"。请注意默认解释器需要手动修改,Python 扩展不会在每次切换解释器时修改该设置。[了解更多](https://aka.ms/AA7jfor).", - "diagnostics.warnSourceMaps": "已启用 Source Map 支持,这会影响 Python 扩展的性能。", - "diagnostics.disableSourceMaps": "禁用 Source Map 支持", - "diagnostics.warnBeforeEnablingSourceMaps": "启用 Source Map 支持将影响 Python 扩展的性能。", - "diagnostics.enableSourceMapsAndReloadVSC": "启用并重新加载窗口", - "diagnostics.lsNotSupported": "该操作系统不符合 Python 语言服务器的最低要求,正在恢复替代的自动补全器 Jedi。", - "diagnostics.invalidPythonPathInDebuggerSettings": "您需要在开始调试前选择一个 Python 解释器。\n\n提示: 点击状态栏中的 \"选择解释器\"。", - "diagnostics.invalidPythonPathInDebuggerLaunch": "调试设置中的 Python 路径无效。", - "diagnostics.invalidDebuggerTypeDiagnostic": "您的 launch.json 文件需要更新,以将 \"pythonExperimental\" 调试设置设为使用 \"python\" 调试器,否则 Python 调试器可能无法工作。立即自动更新 launch.json?", - "diagnostics.consoleTypeDiagnostic": "您的 launch.json 文件需要更新,以将控制台类型字符串从 \"none\" 改为 \"internalConsole\",否则 Python 调试器可能无法工作。立即自动更新 launch.json?", - "diagnostics.justMyCodeDiagnostic": "不再支持 launch.json 中的配置 \"debugStdLib\",建议用 \"justMyCode\" 代替,这与使用 \"debugStdLib\" 完全相反。是否自动更新 launch.json?", - "diagnostics.checkIsort5UpgradeGuide": "此工作区的排序 import 语句配置已过时。查看 [isort 升级指南](https://aka.ms/AA9j5x4) 来更新设置。", - "diagnostics.yesUpdateLaunch": "是,更新 launch.json", - "diagnostics.invalidTestSettings": "您的设置需要更新,以将设置 \"python.unitTest.\" 改为 \"python.testing.\",否则使用该扩展测试 Python 代码可能无法工作。是否自动更新设置?", - "diagnostics.pylanceDefaultMessage": "Python 扩展现在使用 Pylance 以改善代码补全、导航等功能并提升性能。[了解该更新的更多内容以及如何更换语言服务器](https://aka.ms/new-python-bundle)\n\n[Pylance 许可协议](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license).", - "Common.canceled": "已取消", - "Common.cancel": "取消", - "Common.yesPlease": "好的", - "Common.loadingPythonExtension": "Python 扩展正在加载...", - "debug.selectConfigurationTitle": "选择调试配置", - "debug.selectConfigurationPlaceholder": "调试配置", - "debug.launchJsonConfigurationsCompletionLabel": "Python", - "debug.launchJsonConfigurationsCompletionDescription": "选择 Python 调试配置", - "debug.debugFileConfigurationLabel": "Python 文件", - "debug.debugFileConfigurationDescription": "调试打开的 Python 文件", - "debug.debugModuleConfigurationLabel": "模块", - "debug.debugModuleConfigurationDescription": "用'-m'调用 Python 模块进行调试", - "debug.moduleEnterModuleTitle": "调试模块", - "debug.moduleEnterModulePrompt": "请输入 Python 模块/包名", - "debug.moduleEnterModuleDefault": "请输入模块名称", - "debug.moduleEnterModuleInvalidNameError": "请输入有效的模块名称", - "debug.remoteAttachConfigurationLabel": "远程连接", - "debug.remoteAttachConfigurationDescription": "连接到远程调试服务器", - "debug.attachRemoteHostTitle": "远程连接", - "debug.attachRemoteHostPrompt": "请输入主机名", - "debug.attachRemoteHostValidationError": "请输入有效的主机名或 IP 地址", - "debug.attachRemotePortTitle": "远程调试", - "debug.attachRemotePortPrompt": "请输入调试服务器的监听端口号", - "debug.attachRemotePortValidationError": "请输入有效的端口号", - "debug.attachPidConfigurationLabel": "使用 PID 连接", - "debug.attachPidConfigurationDescription": "连接到本地进程", - "debug.debugDjangoConfigurationLabel": "Django", - "debug.debugDjangoConfigurationDescription": "启动并调试 Django Web 应用", - "debug.djangoEnterManagePyPathTitle": "调试 Django", - "debug.djangoEnterManagePyPathPrompt": "请输入 manage.py 的路径('${workspaceFolderToken}'指向当前工作区文件夹的根目录)", - "debug.djangoEnterManagePyPathInvalidFilePathError": "请输入有效的 Python 文件路径", - "debug.debugFastAPIConfigurationLabel": "FastAPI", - "debug.debugFastAPIConfigurationDescription": "启动并调试 FastAPI Web 应用", - "debug.fastapiEnterAppPathOrNamePathTitle": "调试 FastAPI", - "debug.fastapiEnterAppPathOrNamePathPrompt": "请输入应用路径,例如 'main.py' 或 'main'", - "debug.fastapiEnterAppPathOrNamePathInvalidNameError": "请输入有效的名称", - "debug.debugFlaskConfigurationLabel": "Flask", - "debug.debugFlaskConfigurationDescription": "启动并调试 Flask Web 应用", - "debug.flaskEnterAppPathOrNamePathTitle": "调试 Flask", - "debug.flaskEnterAppPathOrNamePathPrompt": "请输入应用路径,例如 'app.py' 或 'app'", - "debug.flaskEnterAppPathOrNamePathInvalidNameError": "请输入有效的名称", - "debug.debugPyramidConfigurationLabel": "Pyramid", - "debug.debugPyramidConfigurationDescription": "Web 应用", - "debug.pyramidEnterDevelopmentIniPathTitle": "调试 Pyramid", - "debug.pyramidEnterDevelopmentIniPathPrompt": "`请输入development.ini的路径('${workspaceFolderToken}'指向当前工作区文件夹的根目录)`", - "debug.pyramidEnterDevelopmentIniPathInvalidFilePathError": "请输入有效的文件路径", - "Testing.configureTests": "配置单元测试框架", - "Common.openOutputPanel": "显示输出", - "LanguageService.lsFailedToStart": "启动语言服务器时出错,正在恢复到 Jedi 语言引擎。查看 Python 输出面板了解详情。", - "LanguageService.lsFailedToDownload": "下载语言服务器时出错,正在恢复到 Jedi 语言引擎。查看 Python 输出面板了解详情。", - "LanguageService.lsFailedToExtract": "提取语言服务器时出错,正在恢复到 Jedi 语言引擎。查看 Python 输出面板了解详情。", - "LanguageService.downloadFailedOutputMessage": "语言服务器下载失败", - "LanguageService.extractionFailedOutputMessage": "语言服务器提取失败", - "LanguageService.extractionCompletedOutputMessage": "语言服务器下载完成", - "LanguageService.extractionDoneOutputMessage": "完成", - "LanguageService.reloadVSCodeIfSeachPathHasChanged": "该 Python 解释器的搜索路径已改变,请重新加载扩展以确保 IntelliSense 正常工作。", - "LanguageService.startingPylance": "正在启动 Pylance 语言服务器。", - "LanguageService.startingJedi": "正在启动 Jedi Python 语言服务器。", - "LanguageService.startingNone": "由于语言服务器设置为空,编辑器支持处于非活动状态。", - "LanguageService.reloadAfterLanguageServerChange": "切换语言服务器后请重新加载窗口。", - "AttachProcess.unsupportedOS": "不支持 '{0}' 操作系统。", - "AttachProcess.attachTitle": "连接到进程", - "AttachProcess.selectProcessPlaceholder": "选择要连接的流程", - "AttachProcess.noProcessSelected": "未选择进程", - "AttachProcess.refreshList": "刷新进程列表", - "diagnostics.updateSettings": "是,更新设置", - "Common.noIWillDoItLater": "稍后再做", - "Common.notNow": "稍后提醒", - "Common.gotIt": "好的!", - "Interpreters.selectInterpreterTip": "提示:您可以通过点击状态栏中的 Python 版本来更改 Python 扩展所使用的 Python 解释器", - "downloading.file": "正在下载 {0}...", - "downloading.file.progress": "{2} 中的 {0}{1} KB ({3}%)", - "products.installingModule": "正在安装 {0}", - "OutdatedDebugger.updateDebuggerMessage": "您正在连接至 ptvsd (Python 调试器),而 ptvsd 已于2020年5月1日停止更新。请切换至 [debugpy](https://aka.ms/migrateToDebugpy)。", - "Jupyter.extensionRequired": "执行该任务需要 Jupyter 扩展。点击\"是 \"打开 Jupyter 扩展的安装页面。", - "Jupyter.extensionNotInstalled": "该功能需要安装 Jupyter 扩展才能使用。", - "TensorBoard.missingSourceFile": "源文件缺失,请手动定位文件。", - "TensorBoard.selectMissingSourceFile": "选择文件", - "TensorBoard.selectMissingSourceFileDescription": "源文件的内容可能与记录中的原始内容不一致。", - "TensorBoard.useCurrentWorkingDirectory": "使用当前工作目录", - "TensorBoard.currentDirectory": "当前:{0}", - "TensorBoard.logDirectoryPrompt": "选择一个日志目录来启动 TensorBoard", - "TensorBoard.progressMessage": "正在启动 TensorBoard 会话...", - "TensorBoard.failedToStartSessionError": "启动 TensorBoard 会话失败,错误:{0}", - "TensorBoard.nativeTensorBoardPrompt": "VS Code 现已集成了 TensorBoard 支持。是否启动 TensorBoard?(提示:打开命令面板并搜索 \"启动 TensorBoard\",即可随时启动 TensorBoard。)", - "TensorBoard.selectAFolder": "选择一个文件夹", - "TensorBoard.selectAnotherFolder": "选择另一个文件夹", - "TensorBoard.selectAFolderDetail": "选择一个包含 tfevent 文件的日志目录", - "TensorBoard.selectAnotherFolderDetail": "使用文件资源管理器选择另一个文件夹", - "TensorBoard.useCurrentWorkingDirectoryDetail": "TensorBoard 将在当前工作目录的所有子目录中搜索 tfevent 文件", - "TensorBoard.installPrompt": "启动 TensorBoard 会话需要安装 TensorBoard 包。是否安装?", - "TensorBoard.installTensorBoardAndProfilerPluginPrompt": "需要安装 TensorBoard >= 2.4.1 与 PyTorch TensorBoard 分析器扩展。是否安装这些包?", - "TensorBoard.installProfilerPluginPrompt": "建议安装 PyTorch TensorBoard 分析器扩展。是否安装此包?", - "TensorBoard.upgradePrompt": "TensorBoard 整合仅支持 TensorBoard >= 2.4.1。是否更新 TensorBoard?", - "TensorBoard.launchNativeTensorBoardSessionCodeAction": "启动 TensorBoard 会话", - "TensorBoard.launchNativeTensorBoardSessionCodeLens": "▶ 启动 TensorBoard 会话", - "TensorBoard.enterRemoteUrl": "输入远程 URL", - "TensorBoard.enterRemoteUrlDetail": "输入指向 TensorBoard 远程日志文件夹的 URL" -} diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json deleted file mode 100644 index c29696d5bf32..000000000000 --- a/package.nls.zh-tw.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "python.command.python.sortImports.title": "排序 Import 語句", - "python.command.python.startREPL.title": "啟動 REPL", - "python.command.python.createTerminal.title": "新增終端機", - "python.command.python.execInTerminal.title": "在終端機中執行 Python 檔案", - "python.command.python.debugInTerminal.title": "偵錯 Python 檔案", - "python.command.python.execInTerminalIcon.title": "執行 Python 檔案", - "python.command.python.setInterpreter.title": "選擇直譯器", - "python.command.python.execSelectionInTerminal.title": "在 Python 終端機中執行選定內容/行", - "python.command.python.execSelectionInDjangoShell.title": "在 Django Shell 中執行選定內容/行", - "python.command.python.goToPythonObject.title": "跳至 Python 物件", - "python.command.python.setLinter.title": "選擇 Linter", - "python.command.python.enableLinting.title": "啟用 Linting", - "python.command.python.runLinting.title": "執行 Linting", - "python.snippet.launch.standard.label": "Python: 目前檔案", - "python.snippet.launch.module.label": "Python: 模組", - "python.snippet.launch.module.default": "請輸入-模組-名稱", - "python.snippet.launch.django.label": "Python: Django", - "python.snippet.launch.fastapi.label": "Python: FastAPI", - "python.snippet.launch.flask.label": "Python: Flask", - "python.snippet.launch.pyramid.label": "Python: Pyramid 程式", - "python.snippet.launch.attach.label": "Python: 附加", - "python.snippet.launch.attachpid.label": "Python: 使用 PID 附加", - "Pylance.remindMeLater": "稍後提醒", - "Pylance.pylanceNotInstalledMessage": "Pylance 延伸模組未安裝。", - "Pylance.pylanceInstalledReloadPromptMessage": "Pylance 延伸模組已安裝。重新載入視窗以啟用?", - "Pylance.pylanceRevertToJediPrompt": "Pylance 延伸模組未安裝,但 python.languageServer 的值被設為 \"Pylance\"。是否安裝 Pylance 延伸模組,或選擇使用 Jedi?", - "Pylance.pylanceInstallPylance": "安裝 Pylance", - "Pylance.pylanceRevertToJedi": "使用 Jedi", - "python.command.python.clearWorkspaceInterpreter.title": "清除工作區直譯器設定", - "python.command.python.reportIssue.title": "回報問題...", - "python.command.python.viewOutput.title": "顯示輸出", - "python.command.python.viewLanguageServerOutput.title": "顯示語言伺服器輸出", - "python.command.python.configureTests.title": "設定測試", - "python.command.python.enableSourceMapSupport.title": "啟用供偵錯延伸模組的原始碼映射 (Source Map) 支援", - "python.command.python.analysis.clearCache.title": "清除模組分析快取", - "python.command.python.clearPersistentStorage.title": "清除延伸模組內部快取", - "python.command.python.analysis.restartLanguageServer.title": "重新啟動語言伺服器", - "python.command.python.launchTensorBoard.title": "啟動 TensorBoard", - "python.command.python.refreshTensorBoard.title": "重新整理 TensorBoard", - "LanguageService.lsFailedToStart": "啟動語言伺服器時遇到問題。改回使用替代方案 \"Jedi\"。請檢查 Python 輸出面板以取得更多資訊。", - "LanguageService.lsFailedToDownload": "下載語言伺服器時遇到問題。改回使用替代方案 \"Jedi\"。請檢查 Python 輸出面板以取得更多資訊。", - "LanguageService.lsFailedToExtract": "擷取語言伺服器時遇到問題。改回使用替代方案 \"Jedi\"。請檢查 Python 輸出面板以取得更多資訊。", - "Experiments.inGroup": "使用者屬於 \"{0}\" 實驗性群組", - "Experiments.optedOutOf": "使用者已退出 '{0}' 實驗性群組", - "Interpreters.RefreshingInterpreters": "正在重新整理 Python 直譯器", - "Interpreters.condaInheritEnvMessage": "我們發覺到您在使用 conda 環境。如果你在整合式終端器中使用這個環境時遇到問題,建議您讓 Python 延伸模組變更使用者設定中的 \"terminal.integrated.inheritEnv\" 為 false。", - "Interpreters.entireWorkspace": "完整工作區", - "Interpreters.pythonInterpreterPath": "Python 直譯器路徑: {0}", - "Logging.CurrentWorkingDirectory": "cwd:", - "InterpreterQuickPickList.enterPath.label": "輸入直譯器路徑...", - "InterpreterQuickPickList.enterPath.placeholder": "輸入 Python 直譯器的路徑。", - "InterpreterQuickPickList.refreshInterpreterList": "重新整理直譯器清單", - "InterpreterQuickPickList.browsePath.label": "瀏覽...", - "InterpreterQuickPickList.browsePath.detail": "瀏覽檔案來選擇 Python 直譯器。", - "InterpreterQuickPickList.browsePath.title": "選擇 Python 直譯器", - "InterpreterQuickPickList.defaultInterpreterPath.label": "使用 `python.defaultInterpreterPath` 設定", - "Common.doNotShowAgain": "不再顯示", - "Common.reload": "重新載入", - "Common.moreInfo": "更多資訊", - "Common.bannerLabelYes": "是", - "Common.bannerLabelNo": "否", - "Common.and": "和", - "Common.ok": "是", - "Common.install": "安裝", - "Common.learnMore": "了解更多", - "Common.reportThisIssue": "回報此問題", - "Common.recommended": "建議", - "CommonSurvey.remindMeLaterLabel": "稍後提醒", - "CommonSurvey.yesLabel": "是,現在接受調查", - "CommonSurvey.noLabel": "不,謝謝", - "OutputChannelNames.languageServer": "Python 語言伺服器", - "OutputChannelNames.python": "Python", - "OutputChannelNames.pythonTest": "Python 測試記錄", - "ExtensionSurveyBanner.bannerMessage": "請問您是否可以用兩分鐘的時間,告訴我們 Python 延伸模組在您環境中的運作情況?", - "ExtensionSurveyBanner.bannerLabelYes": "是,現在填寫調查", - "ExtensionSurveyBanner.bannerLabelNo": "不了,謝謝", - "ExtensionSurveyBanner.maybeLater": "等一下", - "Interpreters.environmentPromptMessage": "We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?", - "Linter.replaceWithSelectedLinter": "設定中啟用了多個 Linter。是否用 '{0}' 取代?", - "Installer.noCondaOrPipInstaller": "選取環境中沒有可用的 Conda 或 Pip 安裝工具。", - "Installer.noPipInstaller": "選取環境中沒有可用的 Pip 安裝工具。", - "Installer.searchForHelp": "搜尋說明", - "diagnostics.warnSourceMaps": "已在 Python 延伸模組中啟用原始碼映射 (Source Map) 支援,這會降低延伸模組效能。", - "diagnostics.disableSourceMaps": "停用原始碼映射 (Source Map) 支援", - "diagnostics.warnBeforeEnablingSourceMaps": "在 Python 延伸模組中啟用原始碼映射 (Source Map) 支援會降低延伸模組效能。", - "diagnostics.enableSourceMapsAndReloadVSC": "啟用並重新載入視窗", - "diagnostics.lsNotSupported": "您的作業系統不符合 Python 語言伺服器的最低需求。改回使用替代自動完成提供者 \"Jedi\"。", - "diagnostics.invalidPythonPathInDebuggerSettings": "開始偵錯前,您需要選取 Python 直譯器。\n\n小提示:按一下狀態列的 \"選擇 Python 直譯器\"。", - "diagnostics.invalidPythonPathInDebuggerLaunch": "偵錯設定檔的 Python 路徑無效。", - "diagnostics.invalidDebuggerTypeDiagnostic": "Your launch.json file needs to be updated to change the \"pythonExperimental\" debug configurations to use the \"python\" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", - "diagnostics.consoleTypeDiagnostic": "Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?", - "diagnostics.justMyCodeDiagnostic": "Configuration \"debugStdLib\" in launch.json is no longer supported. It's recommended to replace it with \"justMyCode\", which is the exact opposite of using \"debugStdLib\". Would you like to automatically update your launch.json file to do that?", - "diagnostics.yesUpdateLaunch": "是,更新 launch.json", - "diagnostics.invalidTestSettings": "Your settings needs to be updated to change the setting \"python.unitTest.\" to \"python.testing.\", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?", - "Common.canceled": "已取消", - "Common.cancel": "取消", - "Common.loadingPythonExtension": "正在載入 Python 延伸模組...", - "debug.selectConfigurationTitle": "選擇偵錯設定檔", - "debug.selectConfigurationPlaceholder": "偵錯設定檔", - "debug.launchJsonConfigurationsCompletionLabel": "Python", - "debug.launchJsonConfigurationsCompletionDescription": "選取 Python 偵錯設定檔", - "debug.debugFileConfigurationLabel": "Python 檔案", - "debug.debugFileConfigurationDescription": "偵錯目前使用中的 Python 檔案", - "debug.debugModuleConfigurationLabel": "模組", - "debug.debugModuleConfigurationDescription": "使用 '-m' 叫用以偵錯 Python 模組", - "debug.moduleEnterModuleTitle": "偵錯模組", - "debug.moduleEnterModulePrompt": "輸入 Python 模組 / 套件名稱", - "debug.moduleEnterModuleDefault": "輸入-模組-名稱", - "debug.moduleEnterModuleInvalidNameError": "請輸入有效的模組名稱", - "debug.remoteAttachConfigurationLabel": "遠端連結", - "debug.remoteAttachConfigurationDescription": "連結到遠端偵錯伺服器", - "debug.attachRemoteHostTitle": "遠端偵錯", - "debug.attachRemoteHostPrompt": "輸入主機名稱", - "debug.attachRemoteHostValidationError": "請輸入有效的主機名稱或 IP 位址", - "debug.attachRemotePortTitle": "遠端偵錯", - "debug.attachRemotePortPrompt": "輸入偵錯伺服器正在監聽的連線埠號。", - "debug.attachRemotePortValidationError": "請輸入有效的連線埠號。", - "debug.attachPidConfigurationLabel": "使用處理程序 ID 連結", - "debug.attachPidConfigurationDescription": "連結至本機處理程序", - "debug.debugDjangoConfigurationLabel": "Django", - "debug.debugDjangoConfigurationDescription": "執行並偵錯 Django 網路應用程式", - "debug.djangoEnterManagePyPathTitle": "偵錯 Django", - "debug.djangoEnterManagePyPathPrompt": "請輸入 manage.py 的路徑 ('${workspaceFolderToken}' 指向目前工作區資料夾的根目錄)", - "debug.djangoEnterManagePyPathInvalidFilePathError": "請輸入有效的 Python 檔案路徑", - "debug.debugFastAPIConfigurationLabel": "FastAPI", - "debug.debugFastAPIConfigurationDescription": "執行並偵錯 FastAPI 網路應用程式", - "debug.fastapiEnterAppPathOrNamePathTitle": "偵錯 FastAPI", - "debug.fastapiEnterAppPathOrNamePathPrompt": "請輸入應用程式路徑。例如:'main.py' or 'main'", - "debug.fastapiEnterAppPathOrNamePathInvalidNameError": "請輸入有效名稱", - "debug.debugFlaskConfigurationLabel": "Flask", - "debug.debugFlaskConfigurationDescription": "執行並偵錯 Flask 網路應用程式", - "debug.flaskEnterAppPathOrNamePathTitle": "偵錯 Flask", - "debug.flaskEnterAppPathOrNamePathPrompt": "請輸入應用程式路徑。例如:'app.py' 或 'app'", - "debug.flaskEnterAppPathOrNamePathInvalidNameError": "請輸入有效名稱", - "debug.debugPyramidConfigurationLabel": "Pyramid", - "debug.debugPyramidConfigurationDescription": "網路應用程式", - "debug.pyramidEnterDevelopmentIniPathTitle": "偵錯 Pyramid", - "debug.pyramidEnterDevelopmentIniPathPrompt": "`請輸入 development.ini 的路徑 ('${workspaceFolderToken}' 指向目前工作區資料夾的根目錄)`", - "debug.pyramidEnterDevelopmentIniPathInvalidFilePathError": "請輸入有效的檔案路徑", - "Testing.configureTests": "設定測試框架", - "Testing.testNotConfigured": "未設定測試框架。", - "Common.openOutputPanel": "顯示輸出", - "LanguageService.downloadFailedOutputMessage": "下載語言伺服器失敗", - "LanguageService.extractionFailedOutputMessage": "擷取語言伺服器失敗", - "LanguageService.extractionCompletedOutputMessage": "下載語言伺服器完成", - "LanguageService.extractionDoneOutputMessage": "完成", - "LanguageService.reloadVSCodeIfSeachPathHasChanged": "已為此 Python 解譯器變更搜尋路徑。請重新載入延伸模組以確保 IntelliSense 能夠正常運作", - "LanguageService.startingMicrosoft": "正在啟動 Microsoft Python 語言伺服器。", - "LanguageService.startingPylance": "正在啟動 Pylance 語言伺服器。", - "LanguageService.startingJedi": "正在啟動 Jedi 語言伺服器。", - "LanguageService.startingNone": "由於未設定語言伺服器,所以無法使用編輯器支援。", - "LanguageService.reloadAfterLanguageServerChange": "切換語言伺服器後請重新載入視窗。", - "AttachProcess.unsupportedOS": "不支援 '{0}' 作業系統。", - "AttachProcess.attachTitle": "連結至處理程序", - "AttachProcess.selectProcessPlaceholder": "選擇要連結的處理程序", - "AttachProcess.noProcessSelected": "沒有選取的處理程序", - "AttachProcess.refreshList": "重新整理處理程序列表", - "diagnostics.updateSettings": "是,更新設定", - "Common.noIWillDoItLater": "否,我稍候再做", - "Common.notNow": "先不要", - "Common.gotIt": "懂了!", - "Interpreters.selectInterpreterTip": "小提示:您能透過按下狀態列中的 Python 版本,變更 Python 延伸模組使用的 Python 解譯器。", - "downloading.file": "正在下載 {0}...", - "downloading.file.progress": "目前 {0}{1},總共 {2} KB ({3}%)", - "products.installingModule": "正在安裝 {0}" -} diff --git a/src/client/activation/common/languageServerChangeHandler.ts b/src/client/activation/common/languageServerChangeHandler.ts index daae78a88d2b..83ff204ed6e7 100644 --- a/src/client/activation/common/languageServerChangeHandler.ts +++ b/src/client/activation/common/languageServerChangeHandler.ts @@ -16,15 +16,15 @@ export async function promptForPylanceInstall( configService: IConfigurationService, ): Promise { const response = await appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ); - if (response === Pylance.pylanceInstallPylance()) { + if (response === Pylance.pylanceInstallPylance) { commandManager.executeCommand('extension.open', PYLANCE_EXTENSION_ID); - } else if (response === Pylance.pylanceRevertToJedi()) { + } else if (response === Pylance.pylanceRevertToJedi) { const inspection = workspace.getConfiguration('python').inspect('languageServer'); let target: ConfigurationTarget | undefined; diff --git a/src/client/activation/common/outputChannel.ts b/src/client/activation/common/outputChannel.ts index cefe221b37dc..033f888cefdd 100644 --- a/src/client/activation/common/outputChannel.ts +++ b/src/client/activation/common/outputChannel.ts @@ -23,7 +23,7 @@ export class LanguageServerOutputChannel implements ILanguageServerOutputChannel public get channel(): IOutputChannel { if (!this.output) { - this.output = this.appShell.createOutputChannel(OutputChannelNames.languageServer()); + this.output = this.appShell.createOutputChannel(OutputChannelNames.languageServer); this.registerCommand().ignoreErrors(); } return this.output; diff --git a/src/client/activation/extensionSurvey.ts b/src/client/activation/extensionSurvey.ts index 885893e9f54e..6d1d784237ba 100644 --- a/src/client/activation/extensionSurvey.ts +++ b/src/client/activation/extensionSurvey.ts @@ -82,24 +82,20 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService @traceDecoratorError('Failed to display prompt for extension survey') public async showSurvey() { - const prompts = [ - ExtensionSurveyBanner.bannerLabelYes(), - ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain(), - ]; + const prompts = [ExtensionSurveyBanner.bannerLabelYes, ExtensionSurveyBanner.maybeLater, Common.doNotShowAgain]; const telemetrySelections: ['Yes', 'Maybe later', 'Do not show again'] = [ 'Yes', 'Maybe later', 'Do not show again', ]; - const selection = await this.appShell.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts); + const selection = await this.appShell.showInformationMessage(ExtensionSurveyBanner.bannerMessage, ...prompts); sendTelemetryEvent(EventName.EXTENSION_SURVEY_PROMPT, undefined, { selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); if (!selection) { return; } - if (selection === ExtensionSurveyBanner.bannerLabelYes()) { + if (selection === ExtensionSurveyBanner.bannerLabelYes) { this.launchSurvey(); // Disable survey for a few weeks await this.persistentState @@ -109,7 +105,7 @@ export class ExtensionSurveyPrompt implements IExtensionSingleActivationService timeToDisableSurveyFor, ) .updateValue(true); - } else if (selection === Common.doNotShowAgain()) { + } else if (selection === Common.doNotShowAgain) { // Never show the survey again await this.persistentState .createGlobalPersistentState(extensionSurveyStateKeys.doNotShowAgain, false) diff --git a/src/client/activation/partialModeStatus.ts b/src/client/activation/partialModeStatus.ts index 0bc999d82acf..1105f6529ac8 100644 --- a/src/client/activation/partialModeStatus.ts +++ b/src/client/activation/partialModeStatus.ts @@ -40,14 +40,14 @@ export class PartialModeStatusItem implements IExtensionSingleActivationService const statusItem = vscode.languages.createLanguageStatusItem('python.projectStatus', { language: 'python', }); - statusItem.name = LanguageService.statusItem.name(); + statusItem.name = LanguageService.statusItem.name; statusItem.severity = vscode.LanguageStatusSeverity.Warning; - statusItem.text = LanguageService.statusItem.text(); + statusItem.text = LanguageService.statusItem.text; statusItem.detail = !this.workspace.isTrusted - ? LanguageService.statusItem.detail() - : LanguageService.virtualWorkspaceStatusItem.detail(); + ? LanguageService.statusItem.detail + : LanguageService.virtualWorkspaceStatusItem.detail; statusItem.command = { - title: Common.learnMore(), + title: Common.learnMore, command: 'vscode.open', arguments: [vscode.Uri.parse('https://aka.ms/AAdzyh4')], }; diff --git a/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts b/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts index 0034564a632f..d6757d5a844e 100644 --- a/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts +++ b/src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts @@ -17,9 +17,9 @@ import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '. import { DiagnosticScope, IDiagnostic, IDiagnosticHandlerService } from '../types'; const messages = { - [DiagnosticCodes.InvalidDebuggerTypeDiagnostic]: Diagnostics.invalidDebuggerTypeDiagnostic(), - [DiagnosticCodes.JustMyCodeDiagnostic]: Diagnostics.justMyCodeDiagnostic(), - [DiagnosticCodes.ConsoleTypeDiagnostic]: Diagnostics.consoleTypeDiagnostic(), + [DiagnosticCodes.InvalidDebuggerTypeDiagnostic]: Diagnostics.invalidDebuggerTypeDiagnostic, + [DiagnosticCodes.JustMyCodeDiagnostic]: Diagnostics.justMyCodeDiagnostic, + [DiagnosticCodes.ConsoleTypeDiagnostic]: Diagnostics.consoleTypeDiagnostic, [DiagnosticCodes.ConfigPythonPathDiagnostic]: '', }; @@ -140,7 +140,7 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { } const commandPrompts = [ { - prompt: Diagnostics.yesUpdateLaunch(), + prompt: Diagnostics.yesUpdateLaunch, command: { diagnostic, invoke: async (): Promise => { @@ -149,7 +149,7 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService { }, }, { - prompt: Common.noIWillDoItLater(), + prompt: Common.noIWillDoItLater, }, ]; diff --git a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts index 61460f9db701..d74cd7403e73 100644 --- a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts +++ b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts @@ -27,8 +27,8 @@ import { } from '../types'; const messages = { - [DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic]: Diagnostics.invalidPythonPathInDebuggerSettings(), - [DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch(), + [DiagnosticCodes.InvalidPythonPathInDebuggerSettingsDiagnostic]: Diagnostics.invalidPythonPathInDebuggerSettings, + [DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch, }; class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic { diff --git a/src/client/application/diagnostics/checks/jediPython27NotSupported.ts b/src/client/application/diagnostics/checks/jediPython27NotSupported.ts index cc53c49689bc..3d358325032e 100644 --- a/src/client/application/diagnostics/checks/jediPython27NotSupported.ts +++ b/src/client/application/diagnostics/checks/jediPython27NotSupported.ts @@ -53,7 +53,7 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe // We don't need to check for JediLSP here, because we retrieve the setting from the configuration service, // Which already switched the JediLSP option to Jedi. if (interpreter && (interpreter.version?.major ?? 0) < 3 && languageServer === LanguageServerType.Jedi) { - return [new JediPython27NotSupportedDiagnostic(Python27Support.jediMessage(), resource)]; + return [new JediPython27NotSupportedDiagnostic(Python27Support.jediMessage, resource)]; } return []; @@ -71,10 +71,10 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe const commandFactory = this.serviceContainer.get(IDiagnosticsCommandFactory); const options = [ { - prompt: Common.gotIt(), + prompt: Common.gotIt, }, { - prompt: Common.doNotShowAgain(), + prompt: Common.doNotShowAgain, command: commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }), }, ]; diff --git a/src/client/application/diagnostics/checks/macPythonInterpreter.ts b/src/client/application/diagnostics/checks/macPythonInterpreter.ts index 0e1e65300d09..d1bebed87ab7 100644 --- a/src/client/application/diagnostics/checks/macPythonInterpreter.ts +++ b/src/client/application/diagnostics/checks/macPythonInterpreter.ts @@ -5,6 +5,7 @@ import { inject, injectable } from 'inversify'; import { DiagnosticSeverity } from 'vscode'; import '../../../common/extensions'; +import * as nls from 'vscode-nls'; import { IPlatformService } from '../../../common/platform/types'; import { IConfigurationService, @@ -22,11 +23,17 @@ import { DiagnosticCodes } from '../constants'; import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '../promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerService } from '../types'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + const messages = { - [DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic]: + [DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic]: localize( + 'DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic', 'You have selected the macOS system install of Python, which is not recommended for use with the Python extension. Some functionality will be limited, please select a different interpreter.', - [DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic]: + ), + [DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic]: localize( + 'DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic', 'The macOS system install of Python is not recommended, some functionality in the extension will be limited. Install another version of Python for the best experience.', + ), }; export class InvalidMacPythonInterpreterDiagnostic extends BaseDiagnostic { diff --git a/src/client/application/diagnostics/checks/pylanceDefault.ts b/src/client/application/diagnostics/checks/pylanceDefault.ts index eec3082f8165..16ee2968c8d6 100644 --- a/src/client/application/diagnostics/checks/pylanceDefault.ts +++ b/src/client/application/diagnostics/checks/pylanceDefault.ts @@ -50,7 +50,7 @@ export class PylanceDefaultDiagnosticService extends BaseDiagnosticsService { return []; } - return [new PylanceDefaultDiagnostic(Diagnostics.pylanceDefaultMessage(), resource)]; + return [new PylanceDefaultDiagnostic(Diagnostics.pylanceDefaultMessage, resource)]; } protected async onHandle(diagnostics: IDiagnostic[]): Promise { @@ -63,7 +63,7 @@ export class PylanceDefaultDiagnosticService extends BaseDiagnosticsService { return; } - const options = [{ prompt: Common.ok() }]; + const options = [{ prompt: Common.ok }]; await this.messageService.handle(diagnostic, { commandPrompts: options, diff --git a/src/client/application/diagnostics/checks/pythonInterpreter.ts b/src/client/application/diagnostics/checks/pythonInterpreter.ts index f46d5247a24f..075dc05451df 100644 --- a/src/client/application/diagnostics/checks/pythonInterpreter.ts +++ b/src/client/application/diagnostics/checks/pythonInterpreter.ts @@ -5,6 +5,7 @@ import { inject, injectable } from 'inversify'; import { DiagnosticSeverity } from 'vscode'; import '../../../common/extensions'; +import * as nls from 'vscode-nls'; import { IConfigurationService, IDisposableRegistry, Resource } from '../../../common/types'; import { IInterpreterService } from '../../../interpreter/contracts'; import { IServiceContainer } from '../../../ioc/types'; @@ -22,11 +23,17 @@ import { IDiagnosticMessageOnCloseHandler, } from '../types'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + const messages = { - [DiagnosticCodes.NoPythonInterpretersDiagnostic]: + [DiagnosticCodes.NoPythonInterpretersDiagnostic]: localize( + 'DiagnosticCodes.NoPythonInterpretersDiagnostic', 'Python is not installed. Please download and install Python before using the extension.', - [DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic]: + ), + [DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic]: localize( + 'DiagnosticCodes.NoCurrentlySelectedPythonInterpreterDiagnostic', 'No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.', + ), }; export class InvalidPythonInterpreterDiagnostic extends BaseDiagnostic { diff --git a/src/client/application/diagnostics/checks/pythonPathDeprecated.ts b/src/client/application/diagnostics/checks/pythonPathDeprecated.ts index 1cb516cd79a9..f88347f33fe4 100644 --- a/src/client/application/diagnostics/checks/pythonPathDeprecated.ts +++ b/src/client/application/diagnostics/checks/pythonPathDeprecated.ts @@ -50,7 +50,7 @@ export class PythonPathDeprecatedDiagnosticService extends BaseDiagnosticsServic const isCodeWorkspaceSettingSet = this.workspaceService.workspaceFile && setting.workspaceValue !== undefined; const isSettingsJsonSettingSet = setting.workspaceFolderValue !== undefined; if (isCodeWorkspaceSettingSet || isSettingsJsonSettingSet) { - return [new PythonPathDeprecatedDiagnostic(Diagnostics.removedPythonPathFromSettings(), resource)]; + return [new PythonPathDeprecatedDiagnostic(Diagnostics.removedPythonPathFromSettings, resource)]; } return []; } @@ -66,7 +66,7 @@ export class PythonPathDeprecatedDiagnosticService extends BaseDiagnosticsServic const commandFactory = this.serviceContainer.get(IDiagnosticsCommandFactory); const options = [ { - prompt: Common.ok(), + prompt: Common.ok, }, ]; const command = commandFactory.createCommand(diagnostic, { type: 'ignore', options: DiagnosticScope.Global }); diff --git a/src/client/application/diagnostics/checks/switchToDefaultLS.ts b/src/client/application/diagnostics/checks/switchToDefaultLS.ts index 76830ea6fdf7..bd93a684d9a2 100644 --- a/src/client/application/diagnostics/checks/switchToDefaultLS.ts +++ b/src/client/application/diagnostics/checks/switchToDefaultLS.ts @@ -56,7 +56,7 @@ export class SwitchToDefaultLanguageServerDiagnosticService extends BaseDiagnost } return Promise.resolve( - changed ? [new SwitchToDefaultLanguageServerDiagnostic(SwitchToDefaultLS.bannerMessage(), resource)] : [], + changed ? [new SwitchToDefaultLanguageServerDiagnostic(SwitchToDefaultLS.bannerMessage, resource)] : [], ); } @@ -72,7 +72,7 @@ export class SwitchToDefaultLanguageServerDiagnosticService extends BaseDiagnost await this.messageService.handle(diagnostic, { commandPrompts: [ { - prompt: Common.gotIt(), + prompt: Common.gotIt, }, ], }); diff --git a/src/client/application/diagnostics/surceMapSupportService.ts b/src/client/application/diagnostics/surceMapSupportService.ts index 02ff47375411..8ff491e4cb06 100644 --- a/src/client/application/diagnostics/surceMapSupportService.ts +++ b/src/client/application/diagnostics/surceMapSupportService.ts @@ -34,9 +34,9 @@ export class SourceMapSupportService implements ISourceMapSupportService { await this.commandManager.executeCommand('workbench.action.reloadWindow'); } protected async onEnable(): Promise { - const enableSourceMapsAndReloadVSC = Diagnostics.enableSourceMapsAndReloadVSC(); + const enableSourceMapsAndReloadVSC = Diagnostics.enableSourceMapsAndReloadVSC; const selection = await this.shell.showWarningMessage( - Diagnostics.warnBeforeEnablingSourceMaps(), + Diagnostics.warnBeforeEnablingSourceMaps, enableSourceMapsAndReloadVSC, ); if (selection === enableSourceMapsAndReloadVSC) { diff --git a/src/client/browser/extension.ts b/src/client/browser/extension.ts index c9f7ff9cb9e9..173f68440cb6 100644 --- a/src/client/browser/extension.ts +++ b/src/client/browser/extension.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import '../../setupNls'; import * as vscode from 'vscode'; import TelemetryReporter from 'vscode-extension-telemetry'; import { LanguageClientOptions } from 'vscode-languageclient'; @@ -8,7 +9,6 @@ import { LanguageClient } from 'vscode-languageclient/browser'; import { LanguageClientMiddlewareBase } from '../activation/languageClientMiddlewareBase'; import { LanguageServerType } from '../activation/types'; import { AppinsightsKey, PVSC_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../common/constants'; -import { loadLocalizedStringsForBrowser } from '../common/utils/localizeHelpers'; import { EventName } from '../telemetry/constants'; import { createStatusItem } from './intellisenseStatus'; @@ -19,8 +19,6 @@ interface BrowserConfig { let languageClient: LanguageClient | undefined; export async function activate(context: vscode.ExtensionContext): Promise { - // Run in a promise and return early so that VS Code can go activate Pylance. - await loadLocalizedStringsForBrowser(); const pylanceExtension = vscode.extensions.getExtension(PYLANCE_EXTENSION_ID); if (pylanceExtension) { await runPylance(context, pylanceExtension); diff --git a/src/client/browser/intellisenseStatus.ts b/src/client/browser/intellisenseStatus.ts index 89258dedac9b..b7a49e86dbb0 100644 --- a/src/client/browser/intellisenseStatus.ts +++ b/src/client/browser/intellisenseStatus.ts @@ -10,12 +10,12 @@ export function createStatusItem(): vscode.Disposable { const statusItem = vscode.languages.createLanguageStatusItem('python.projectStatus', { language: 'python', }); - statusItem.name = LanguageService.statusItem.name(); + statusItem.name = LanguageService.statusItem.name; statusItem.severity = vscode.LanguageStatusSeverity.Warning; - statusItem.text = LanguageService.statusItem.text(); - statusItem.detail = LanguageService.statusItem.detail(); + statusItem.text = LanguageService.statusItem.text; + statusItem.detail = LanguageService.statusItem.detail; statusItem.command = { - title: Common.learnMore(), + title: Common.learnMore, command: 'vscode.open', arguments: [vscode.Uri.parse('https://aka.ms/AAdzyh4')], }; diff --git a/src/client/browser/localize.ts b/src/client/browser/localize.ts index ca66b01266ac..24f2cde53c9a 100644 --- a/src/client/browser/localize.ts +++ b/src/client/browser/localize.ts @@ -6,7 +6,9 @@ /* eslint-disable @typescript-eslint/no-namespace */ // IMPORTANT: Do not import any node fs related modules here, as they do not work in browser. -import { getLocalizedString } from '../common/utils/localizeHelpers'; +import * as nls from 'vscode-nls'; + +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); export namespace LanguageService { export const statusItem = { @@ -19,8 +21,3 @@ export namespace LanguageService { export namespace Common { export const learnMore = localize('Common.learnMore', 'Learn more'); } - -function localize(key: string, defValue?: string) { - // Return a pointer to function so that we refetch it on each call. - return (): string => getLocalizedString(key, defValue); -} diff --git a/src/client/common/application/commands/reloadCommand.ts b/src/client/common/application/commands/reloadCommand.ts index fa07f212c5db..ebad15dbb70d 100644 --- a/src/client/common/application/commands/reloadCommand.ts +++ b/src/client/common/application/commands/reloadCommand.ts @@ -23,8 +23,8 @@ export class ReloadVSCodeCommandHandler implements IExtensionSingleActivationSer this.commandManager.registerCommand('python.reloadVSCode', this.onReloadVSCode, this); } private async onReloadVSCode(message: string) { - const item = await this.appShell.showInformationMessage(message, Common.reload()); - if (item === Common.reload()) { + const item = await this.appShell.showInformationMessage(message, Common.reload); + if (item === Common.reload) { this.commandManager.executeCommand('workbench.action.reloadWindow').then(noop, noop); } } diff --git a/src/client/common/cancellation.ts b/src/client/common/cancellation.ts index 20878993b6e3..c820c1ad4324 100644 --- a/src/client/common/cancellation.ts +++ b/src/client/common/cancellation.ts @@ -11,7 +11,7 @@ import * as localize from './utils/localize'; */ export class CancellationError extends Error { constructor() { - super(localize.Common.canceled()); + super(localize.Common.canceled); } } /** diff --git a/src/client/common/experiments/service.ts b/src/client/common/experiments/service.ts index 3b989ce4e85c..75fff9bbcd11 100644 --- a/src/client/common/experiments/service.ts +++ b/src/client/common/experiments/service.ts @@ -5,15 +5,17 @@ import { inject, injectable } from 'inversify'; import { getExperimentationService, IExperimentationService, TargetPopulation } from 'vscode-tas-client'; +import * as nls from 'vscode-nls'; import { traceLog } from '../../logging'; import { sendTelemetryEvent } from '../../telemetry'; import { EventName } from '../../telemetry/constants'; import { IApplicationEnvironment, IWorkspaceService } from '../application/types'; import { PVSC_EXTENSION_ID } from '../constants'; import { IExperimentService, IPersistentStateFactory } from '../types'; -import { Experiments } from '../utils/localize'; import { ExperimentationTelemetry } from './telemetry'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + const EXP_MEMENTO_KEY = 'VSCode.ABExp.FeatureData'; const EXP_CONFIG_ID = 'vscode'; @@ -162,7 +164,7 @@ export class ExperimentService implements IExperimentService { if (this._optOutFrom.includes('All')) { // We prioritize opt out first - traceLog(Experiments.optedOutOf().format('All')); + traceLog(localize('Experiments.optedOutOf', "Experiment '{0}' is inactive", 'All')); // Since we are in the Opt Out all case, this means when checking for experiment we // short circuit and return. So, printing out additional experiment info might cause @@ -171,7 +173,7 @@ export class ExperimentService implements IExperimentService { } if (this._optInto.includes('All')) { // Only if 'All' is not in optOut then check if it is in Opt In. - traceLog(Experiments.inGroup().format('All')); + traceLog(localize('Experiments.inGroup', "Experiment '{0}' is active", 'All')); // Similar to the opt out case. If user is opting into to all experiments we short // circuit the experiment checks. So, skip printing any additional details to the logs. @@ -182,14 +184,14 @@ export class ExperimentService implements IExperimentService { this._optOutFrom .filter((exp) => exp !== 'All' && exp.toLowerCase().startsWith('python')) .forEach((exp) => { - traceLog(Experiments.optedOutOf().format(exp)); + traceLog(localize('Experiments.manuallyOptedOutOf', "Experiment '{0}' is inactive", exp)); }); // Log experiments that users manually opt into, these are experiments which are added using the exp framework. this._optInto .filter((exp) => exp !== 'All' && exp.toLowerCase().startsWith('python')) .forEach((exp) => { - traceLog(Experiments.inGroup().format(exp)); + traceLog(localize('Experiments.manuallyOptIntoExperiments', "Experiment '{0}' is active", exp)); }); if (!experimentsDisabled) { @@ -202,7 +204,7 @@ export class ExperimentService implements IExperimentService { !this._optOutFrom.includes(exp) && !this._optInto.includes(exp) ) { - traceLog(Experiments.inGroup().format(exp)); + traceLog(localize('Experiments.autoOptIntoExperiments', "Experiment '{0}' is active", exp)); } }); } diff --git a/src/client/common/installer/channelManager.ts b/src/client/common/installer/channelManager.ts index 76624aaddfb9..d2950859ab80 100644 --- a/src/client/common/installer/channelManager.ts +++ b/src/client/common/installer/channelManager.ts @@ -85,9 +85,9 @@ export class InstallationChannelManager implements IInstallationChannelManager { const search = 'Search for help'; let result: string | undefined; if (interpreter.envType === EnvironmentType.Conda) { - result = await appShell.showErrorMessage(Installer.noCondaOrPipInstaller(), Installer.searchForHelp()); + result = await appShell.showErrorMessage(Installer.noCondaOrPipInstaller, Installer.searchForHelp); } else { - result = await appShell.showErrorMessage(Installer.noPipInstaller(), Installer.searchForHelp()); + result = await appShell.showErrorMessage(Installer.noPipInstaller, Installer.searchForHelp); } if (result === search) { const platform = this.serviceContainer.get(IPlatformService); diff --git a/src/client/common/installer/moduleInstaller.ts b/src/client/common/installer/moduleInstaller.ts index e859eeb2e900..276ce9fc73cb 100644 --- a/src/client/common/installer/moduleInstaller.ts +++ b/src/client/common/installer/moduleInstaller.ts @@ -18,10 +18,12 @@ import * as internalPython from '../process/internal/python'; import { IProcessServiceFactory } from '../process/types'; import { ITerminalServiceFactory, TerminalCreationOptions } from '../terminal/types'; import { ExecutionInfo, IConfigurationService, IOutputChannel, Product } from '../types'; -import { Products } from '../utils/localize'; import { isResource } from '../utils/misc'; import { ProductNames } from './productNames'; import { IModuleInstaller, InstallOptions, InterpreterUri, ModuleInstallFlags } from './types'; +import * as nls from 'vscode-nls'; + +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); @injectable() export abstract class ModuleInstaller implements IModuleInstaller { @@ -128,7 +130,7 @@ export abstract class ModuleInstaller implements IModuleInstaller { const options: ProgressOptions = { location: ProgressLocation.Notification, cancellable: true, - title: Products.installingModule().format(name), + title: localize('products.installingModule', 'Installing {0}', name), }; await shell.withProgress(options, async (_, token: CancellationToken) => install(wrapCancellationTokens(token, cancel)), diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index 4ff1371a8ff4..223769842101 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -4,6 +4,7 @@ import { inject, injectable } from 'inversify'; import * as semver from 'semver'; import { CancellationToken, Uri } from 'vscode'; import '../extensions'; +import * as nls from 'vscode-nls'; import { IInterpreterService } from '../../interpreter/contracts'; import { IServiceContainer } from '../../ioc/types'; import { LinterId } from '../../linters/types'; @@ -22,7 +23,7 @@ import { Product, ProductType, } from '../types'; -import { Common, Installer, Linters, Products } from '../utils/localize'; +import { Common, Linters } from '../utils/localize'; import { isResource, noop } from '../utils/misc'; import { translateProductToModule } from './moduleInstaller'; import { ProductNames } from './productNames'; @@ -41,6 +42,8 @@ import { isParentPath } from '../platform/fs-paths'; export { Product } from '../types'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + // Products which may not be available to install from certain package registries, keyed by product name // Installer implementations can check this to determine a suitable installation channel for a product // This is temporary and can be removed when https://github.com/microsoft/vscode-jupyter/issues/5034 is unblocked @@ -249,16 +252,25 @@ export class FormatterInstaller extends BaseInstaller { const formatterNames = formatters.map((formatter) => ProductNames.get(formatter)!); const productName = ProductNames.get(product)!; formatterNames.splice(formatterNames.indexOf(productName), 1); - const useOptions = formatterNames.map((name) => Products.useFormatter().format(name)); - const yesChoice = Common.bannerLabelYes(); - - const options = [...useOptions, Common.doNotShowAgain()]; - let message = Products.formatterNotInstalled().format(productName); + const useOptions = formatterNames.map((name) => localize('products.useFormatter', 'Use {0}', name)); + const yesChoice = Common.bannerLabelYes; + + const options = [...useOptions, Common.doNotShowAgain]; + let message = localize( + 'products.formatterNotInstalled', + 'Formatter {0} is not installed. Install?', + productName, + ); if (this.isExecutableAModule(product, resource)) { options.splice(0, 0, yesChoice); } else { const executable = this.getExecutableNameFromSettings(product, resource); - message = Products.invalidFormatterPath().format(productName, executable); + message = localize( + 'products.invalidFormatterPath', + 'Path to the {0} formatter is invalid ({1})', + productName, + executable, + ); } const item = await this.appShell.showErrorMessage(message, ...options); @@ -266,7 +278,7 @@ export class FormatterInstaller extends BaseInstaller { return this.install(product, resource, cancel); } - if (item === Common.doNotShowAgain()) { + if (item === Common.doNotShowAgain) { neverShowAgain.updateValue(true); return InstallerResponse.Ignore; } @@ -316,10 +328,10 @@ export class LinterInstaller extends BaseInstaller { private async oldPromptForInstallation(product: Product, resource?: Uri, cancel?: CancellationToken) { const productName = ProductNames.get(product)!; - const install = Common.install(); - const doNotShowAgain = Common.doNotShowAgain(); + const { install } = Common; + const { doNotShowAgain } = Common; const disableLinterInstallPromptKey = `${productName}_DisableLinterInstallPrompt`; - const selectLinter = Linters.selectLinter(); + const { selectLinter } = Linters; if (this.getStoredResponse(disableLinterInstallPromptKey) === true) { return InstallerResponse.Ignore; @@ -327,12 +339,17 @@ export class LinterInstaller extends BaseInstaller { const options = [selectLinter, doNotShowAgain]; - let message = `Linter ${productName} is not installed.`; + let message = localize('Linter.notInstalled', 'Linter {0} is not installed.', productName); if (this.isExecutableAModule(product, resource)) { options.splice(0, 0, install); } else { const executable = this.getExecutableNameFromSettings(product, resource); - message = `Path to the ${productName} linter is invalid (${executable})`; + message = localize( + 'Linter.invalidPath', + 'Path to the {0} linter is invalid ({1})', + productName, + executable, + ); } const response = await this.appShell.showErrorMessage(message, ...options); if (response === install) { @@ -387,16 +404,25 @@ export class TestFrameworkInstaller extends BaseInstaller { const productName = ProductNames.get(product)!; const options: string[] = []; - let message = `Test framework ${productName} is not installed. Install?`; + let message = localize( + 'TestFramework.notIstalled', + 'Test framework {0} is not installed. Install?', + productName, + ); if (this.isExecutableAModule(product, resource)) { - options.push(...['Yes', 'No']); + options.push(...[Common.bannerLabelYes, Common.bannerLabelNo]); } else { const executable = this.getExecutableNameFromSettings(product, resource); - message = `Path to the ${productName} test framework is invalid (${executable})`; + message = localize( + 'TestFramework.invalidPath', + 'Path to the {0} test framework is invalid ({1})', + productName, + executable, + ); } const item = await this.appShell.showErrorMessage(message, ...options); - return item === 'Yes' ? this.install(product, resource, cancel) : InstallerResponse.Ignore; + return item === Common.bannerLabelYes ? this.install(product, resource, cancel) : InstallerResponse.Ignore; } } @@ -501,7 +527,15 @@ export class DataScienceInstaller extends BaseInstaller { const installerModule: IModuleInstaller | undefined = channels.find((v) => v.type === requiredInstaller); if (!installerModule) { - this.appShell.showErrorMessage(Installer.couldNotInstallLibrary().format(moduleName)).then(noop, noop); + this.appShell + .showErrorMessage( + localize( + 'Installer.couldNotInstallLibrary', + 'Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.', + moduleName, + ), + ) + .then(noop, noop); sendTelemetryEvent(EventName.PYTHON_INSTALL_PACKAGE, undefined, { installer: 'unavailable', requiredInstaller, @@ -541,11 +575,15 @@ export class DataScienceInstaller extends BaseInstaller { ): Promise { const productName = ProductNames.get(product)!; const item = await this.appShell.showErrorMessage( - Installer.dataScienceInstallPrompt().format(productName), - 'Yes', - 'No', + localize( + 'Installer.dataScienceInstallPrompt', + 'Data Science library {0} is not installed. Install?', + productName, + ), + Common.bannerLabelYes, + Common.bannerLabelNo, ); - if (item === 'Yes') { + if (item === Common.bannerLabelYes) { return this.install(product, resource, cancel); } return InstallerResponse.Ignore; diff --git a/src/client/common/net/fileDownloader.ts b/src/client/common/net/fileDownloader.ts index 6b0da675b0d3..5c54ae247911 100644 --- a/src/client/common/net/fileDownloader.ts +++ b/src/client/common/net/fileDownloader.ts @@ -4,6 +4,7 @@ 'use strict'; import { inject, injectable } from 'inversify'; +import * as nls from 'vscode-nls'; import * as requestTypes from 'request'; import { Progress } from 'vscode'; import { traceLog } from '../../logging'; @@ -11,9 +12,10 @@ import { IApplicationShell } from '../application/types'; import { Octicons } from '../constants'; import { IFileSystem, WriteStream } from '../platform/types'; import { DownloadOptions, IFileDownloader, IHttpClient } from '../types'; -import { Http } from '../utils/localize'; import { noop } from '../utils/misc'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + @injectable() export class FileDownloader implements IFileDownloader { constructor( @@ -22,7 +24,7 @@ export class FileDownloader implements IFileDownloader { @inject(IApplicationShell) private readonly appShell: IApplicationShell, ) {} public async downloadFile(uri: string, options: DownloadOptions): Promise { - traceLog(Http.downloadingFile().format(uri)); + traceLog(localize('downloading.file', 'Downloading {0}...', uri)); const tempFile = await this.fs.createTemporaryFile(options.extension); await this.downloadFileWithStatusBarProgress(uri, options.progressMessagePrefix, tempFile.filePath).then( @@ -97,7 +99,9 @@ function formatProgressMessageWithState(progressMessagePrefix: string, state: Re const total = Math.round(state.size.total / 1024); const percentage = Math.round(100 * state.percent); - return Http.downloadingFileProgress().format( + return localize( + 'downloading.file.progress', + '{0}{1} of {2} KB ({3}%)', progressMessagePrefix, received.toString(), total.toString(), diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index 827cd031991b..cf8014cb18d7 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -27,7 +27,7 @@ export class ProcessLogger implements IProcessLogger { : fileOrCommand; const info = [`> ${this.getDisplayCommands(command)}`]; if (options && options.cwd) { - info.push(`${Logging.currentWorkingDirectory()} ${this.getDisplayCommands(options.cwd)}`); + info.push(`${Logging.currentWorkingDirectory} ${this.getDisplayCommands(options.cwd)}`); } info.forEach((line) => { diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index c183099f99bf..c58011adf004 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -3,8 +3,9 @@ 'use strict'; -import { FileSystem } from '../platform/fileSystem'; -import { getLocalizedString, loadLocalizedStringsUsingNodeFS, shouldLoadUsingNodeFS } from './localizeHelpers'; +import * as nls from 'vscode-nls'; + +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); /* eslint-disable @typescript-eslint/no-namespace, no-shadow */ @@ -98,7 +99,6 @@ export namespace CommonSurvey { } export namespace AttachProcess { - export const unsupportedOS = localize('AttachProcess.unsupportedOS', "Operating system '{0}' not supported."); export const attachTitle = localize('AttachProcess.attachTitle', 'Attach to process'); export const selectProcessPlaceholder = localize( 'AttachProcess.selectProcessPlaceholder', @@ -142,16 +142,11 @@ export namespace TensorBoard { 'TensorBoard.useCurrentWorkingDirectory', 'Use current working directory', ); - export const currentDirectory = localize('TensorBoard.currentDirectory', 'Current: {0}'); export const logDirectoryPrompt = localize( 'TensorBoard.logDirectoryPrompt', 'Select a log directory to start TensorBoard with', ); export const progressMessage = localize('TensorBoard.progressMessage', 'Starting TensorBoard session...'); - export const failedToStartSessionError = localize( - 'TensorBoard.failedToStartSessionError', - 'We failed to start a TensorBoard session due to the following error: {0}', - ); export const nativeTensorBoardPrompt = localize( 'TensorBoard.nativeTensorBoardPrompt', 'VS Code now has integrated TensorBoard support. Would you like to launch TensorBoard? (Tip: Launch TensorBoard anytime by opening the command palette and searching for "Launch TensorBoard".)', @@ -214,7 +209,6 @@ export namespace LanguageService { detail: localize('LanguageService.statusItem.detail', 'Limited IntelliSense provided by Pylance'), }; export const startingPylance = localize('LanguageService.startingPylance', 'Starting Pylance language server.'); - export const startingJedi = localize('LanguageService.startingJedi', 'Starting Jedi language server for {0}.'); export const startingNone = localize( 'LanguageService.startingNone', 'Editor support is inactive since language server is set to None.', @@ -259,15 +253,6 @@ export namespace LanguageService { 'Search paths have changed for this Python interpreter. Please reload the extension to ensure that the IntelliSense works correctly.', ); } - -export namespace Http { - export const downloadingFile = localize('downloading.file', 'Downloading {0}...'); - export const downloadingFileProgress = localize('downloading.file.progress', '{0}{1} of {2} KB ({3}%)'); -} -export namespace Experiments { - export const inGroup = localize('Experiments.inGroup', "Experiment '{0}' is active"); - export const optedOutOf = localize('Experiments.optedOutOf', "Experiment '{0}' is inactive"); -} export namespace Interpreters { export const installingPython = localize('Interpreters.installingPython', 'Installing Python into Environment...'); export const discovering = localize('Interpreters.DiscoveringInterpreters', 'Discovering Python Interpreters'); @@ -286,16 +271,11 @@ export namespace Interpreters { 'Interpreters.selectInterpreterTip', 'Tip: you can change the Python interpreter used by the Python extension by clicking on the Python version in the status bar', ); - export const pythonInterpreterPath = localize('Interpreters.pythonInterpreterPath', 'Python interpreter path: {0}'); } export namespace InterpreterQuickPickList { export const globalGroupName = localize('InterpreterQuickPickList.globalGroupName', 'Global'); export const workspaceGroupName = localize('InterpreterQuickPickList.workspaceGroupName', 'Workspace'); - export const quickPickListPlaceholder = localize( - 'InterpreterQuickPickList.quickPickListPlaceholder', - 'Selected Interpreter: {0}', - ); export const enterPath = { label: localize('InterpreterQuickPickList.enterPath.label', 'Enter interpreter path...'), placeholder: localize('InterpreterQuickPickList.enterPath.placeholder', 'Enter path to a Python interpreter.'), @@ -332,10 +312,6 @@ export namespace Logging { } export namespace Linters { - export const replaceWithSelectedLinter = localize( - 'Linter.replaceWithSelectedLinter', - "Multiple linters are enabled in settings. Replace with '{0}'?", - ); export const selectLinter = localize('Linter.selectLinter', 'Select Linter'); } @@ -349,14 +325,6 @@ export namespace Installer { 'There is no Pip installer available in the selected environment.', ); export const searchForHelp = localize('Installer.searchForHelp', 'Search for help'); - export const couldNotInstallLibrary = localize( - 'Installer.couldNotInstallLibrary', - 'Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.', - ); - export const dataScienceInstallPrompt = localize( - 'Installer.dataScienceInstallPrompt', - 'Data Science library {0} is not installed. Install?', - ); } export namespace ExtensionSurveyBanner { @@ -368,144 +336,157 @@ export namespace ExtensionSurveyBanner { export const bannerLabelNo = localize('ExtensionSurveyBanner.bannerLabelNo', 'No, thanks'); export const maybeLater = localize('ExtensionSurveyBanner.maybeLater', 'Maybe later'); } - -export namespace Products { - export const installingModule = localize('products.installingModule', 'Installing {0}'); - export const formatterNotInstalled = localize( - 'products.formatterNotInstalled', - 'Formatter {0} is not installed. Install?', - ); - export const useFormatter = localize('products.useFormatter', 'Use {0}'); - export const invalidFormatterPath = localize( - 'products.invalidFormatterPath', - 'Path to the {0} formatter is invalid ({1})', - ); -} export namespace DebugConfigStrings { export const selectConfiguration = { - title: localize('debug.selectConfigurationTitle'), - placeholder: localize('debug.selectConfigurationPlaceholder'), + title: localize('debug.selectConfigurationTitle', 'Select a debug configuration'), + placeholder: localize('debug.selectConfigurationPlaceholder', 'Debug Configuration'), }; export const launchJsonCompletions = { - label: localize('debug.launchJsonConfigurationsCompletionLabel'), - description: localize('debug.launchJsonConfigurationsCompletionDescription'), + label: localize('debug.launchJsonConfigurationsCompletionLabel', 'Python'), + description: localize( + 'debug.launchJsonConfigurationsCompletionDescription', + 'Select a Python debug configuration', + ), }; export namespace file { export const snippet = { - name: localize('python.snippet.launch.standard.label'), + name: localize('python.snippet.launch.standard.label', 'Python: Current File'), }; export const selectConfiguration = { - label: localize('debug.debugFileConfigurationLabel'), - description: localize('debug.debugFileConfigurationDescription'), + label: localize('debug.debugFileConfigurationLabel', 'Python File'), + description: localize('debug.debugFileConfigurationDescription', 'Debug the currently active Python file'), }; } export namespace module { export const snippet = { - name: localize('python.snippet.launch.module.label'), - default: localize('python.snippet.launch.module.default'), + name: localize('python.snippet.launch.module.label', 'Python: Module'), + default: localize('python.snippet.launch.module.default', 'enter-your-module-name'), }; export const selectConfiguration = { - label: localize('debug.debugModuleConfigurationLabel'), - description: localize('debug.debugModuleConfigurationDescription'), + label: localize('debug.debugModuleConfigurationLabel', 'Module'), + description: localize( + 'debug.debugModuleConfigurationDescription', + "Debug a Python module by invoking it with '-m'", + ), }; export const enterModule = { - title: localize('debug.moduleEnterModuleTitle'), - prompt: localize('debug.moduleEnterModulePrompt'), - default: localize('debug.moduleEnterModuleDefault'), - invalid: localize('debug.moduleEnterModuleInvalidNameError'), + title: localize('debug.moduleEnterModuleTitle', 'Debug Module'), + prompt: localize('debug.moduleEnterModulePrompt', 'Enter a Python module/package name'), + default: localize('debug.moduleEnterModuleDefault', 'enter-your-module-name'), + invalid: localize('debug.moduleEnterModuleInvalidNameError', 'Enter a valid module name'), }; } export namespace attach { export const snippet = { - name: localize('python.snippet.launch.attach.label'), + name: localize('python.snippet.launch.attach.label', 'Python: Remote Attach'), }; export const selectConfiguration = { - label: localize('debug.remoteAttachConfigurationLabel'), - description: localize('debug.remoteAttachConfigurationDescription'), + label: localize('debug.remoteAttachConfigurationLabel', 'Remote Attach'), + description: localize('debug.remoteAttachConfigurationDescription', 'Attach to a remote debug server'), }; export const enterRemoteHost = { - title: localize('debug.attachRemoteHostTitle'), - prompt: localize('debug.attachRemoteHostPrompt'), - invalid: localize('debug.attachRemoteHostValidationError'), + title: localize('debug.attachRemoteHostTitle', 'Remote Debugging'), + prompt: localize('debug.attachRemoteHostPrompt', 'Enter a valid host name or IP address'), + invalid: localize('debug.attachRemoteHostValidationError', 'Enter a valid host name or IP address'), }; export const enterRemotePort = { - title: localize('debug.attachRemotePortTitle'), - prompt: localize('debug.attachRemotePortPrompt'), - invalid: localize('debug.attachRemotePortValidationError'), + title: localize('debug.attachRemotePortTitle', 'Remote Debugging'), + prompt: localize( + 'debug.attachRemotePortPrompt', + 'Enter the port number that the debug server is listening on', + ), + invalid: localize('debug.attachRemotePortValidationError', 'Enter a valid port number'), }; } export namespace attachPid { export const snippet = { - name: localize('python.snippet.launch.attachpid.label'), + name: localize('python.snippet.launch.attachpid.label', 'Python: Attach using Process Id'), }; export const selectConfiguration = { - label: localize('debug.attachPidConfigurationLabel'), - description: localize('debug.attachPidConfigurationDescription'), + label: localize('debug.attachPidConfigurationLabel', 'Attach using Process ID'), + description: localize('debug.attachPidConfigurationDescription', 'Attach to a local process'), }; } export namespace django { export const snippet = { - name: localize('python.snippet.launch.django.label'), + name: localize('python.snippet.launch.django.label', 'Python: Django'), }; export const selectConfiguration = { - label: localize('debug.debugDjangoConfigurationLabel'), - description: localize('debug.debugDjangoConfigurationDescription'), + label: localize('debug.debugDjangoConfigurationLabel', 'Django'), + description: localize( + 'debug.debugDjangoConfigurationDescription', + 'Launch and debug a Django web application', + ), }; export const enterManagePyPath = { - title: localize('debug.djangoEnterManagePyPathTitle'), - prompt: localize('debug.djangoEnterManagePyPathPrompt'), - invalid: localize('debug.djangoEnterManagePyPathInvalidFilePathError'), + title: localize('debug.djangoEnterManagePyPathTitle', 'Debug Django'), + prompt: localize( + 'debug.djangoEnterManagePyPathPrompt', + "Enter the path to manage.py ('${workspaceFolderToken}' points to the root of the current workspace folder)", + ), + invalid: localize('debug.djangoEnterManagePyPathInvalidFilePathError', 'Enter a valid Python file path'), }; } export namespace fastapi { export const snippet = { - name: localize('python.snippet.launch.fastapi.label'), + name: localize('python.snippet.launch.fastapi.label', 'Python: FastAPI'), }; export const selectConfiguration = { - label: localize('debug.debugFastAPIConfigurationLabel'), - description: localize('debug.debugFastAPIConfigurationDescription'), + label: localize('debug.debugFastAPIConfigurationLabel', 'FastAPI'), + description: localize( + 'debug.debugFastAPIConfigurationDescription', + 'Launch and debug a FastAPI web application', + ), }; export const enterAppPathOrNamePath = { - title: localize('debug.fastapiEnterAppPathOrNamePathTitle'), - prompt: localize('debug.fastapiEnterAppPathOrNamePathPrompt'), - invalid: localize('debug.fastapiEnterAppPathOrNamePathInvalidNameError'), + title: localize('debug.fastapiEnterAppPathOrNamePathTitle', 'Debug FastAPI'), + prompt: localize( + 'debug.fastapiEnterAppPathOrNamePathPrompt', + "Enter the path to the application, e.g. 'main.py' or 'main'", + ), + invalid: localize('debug.fastapiEnterAppPathOrNamePathInvalidNameError', 'Enter a valid name'), }; } export namespace flask { export const snippet = { - name: localize('python.snippet.launch.flask.label'), + name: localize('python.snippet.launch.flask.label', 'Python: Flask'), }; export const selectConfiguration = { - label: localize('debug.debugFlaskConfigurationLabel'), - description: localize('debug.debugFlaskConfigurationDescription'), + label: localize('debug.debugFlaskConfigurationLabel', 'Flask'), + description: localize( + 'debug.debugFlaskConfigurationDescription', + 'Launch and debug a Flask web application', + ), }; export const enterAppPathOrNamePath = { - title: localize('debug.flaskEnterAppPathOrNamePathTitle'), - prompt: localize('debug.flaskEnterAppPathOrNamePathPrompt'), - invalid: localize('debug.flaskEnterAppPathOrNamePathInvalidNameError'), + title: localize('debug.flaskEnterAppPathOrNamePathTitle', 'Debug Flask'), + prompt: localize('debug.flaskEnterAppPathOrNamePathPrompt', 'Python: Flask'), + invalid: localize('debug.flaskEnterAppPathOrNamePathInvalidNameError', 'Enter a valid name'), }; } export namespace pyramid { export const snippet = { - name: localize('python.snippet.launch.pyramid.label'), + name: localize('python.snippet.launch.pyramid.label', 'Python: Pyramid Application'), }; export const selectConfiguration = { - label: localize('debug.debugPyramidConfigurationLabel'), - description: localize('debug.debugPyramidConfigurationDescription'), + label: localize('debug.debugPyramidConfigurationLabel', 'Pyramid'), + description: localize( + 'debug.debugPyramidConfigurationDescription', + 'Launch and debug a Pyramid web application', + ), }; export const enterDevelopmentIniPath = { - title: localize('debug.pyramidEnterDevelopmentIniPathTitle'), - prompt: localize('debug.pyramidEnterDevelopmentIniPathPrompt'), - invalid: localize('debug.pyramidEnterDevelopmentIniPathInvalidFilePathError'), + title: localize('debug.pyramidEnterDevelopmentIniPathTitle', 'Debug Pyramid'), + invalid: localize('debug.pyramidEnterDevelopmentIniPathInvalidFilePathError', 'Enter a valid file path'), }; } } @@ -541,18 +522,3 @@ export namespace SwitchToDefaultLS { "The Microsoft Python Language Server has reached end of life. Your language server has been set to the default for Python in VS Code, Pylance.\n\nIf you'd like to change your language server, you can learn about how to do so [here](https://devblogs.microsoft.com/python/python-in-visual-studio-code-may-2021-release/#configuring-your-language-server).\n\nRead Pylance's license [here](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license).", ); } - -function localize(key: string, defValue?: string) { - // Return a pointer to function so that we refetch it on each call. - return (): string => getString(key, defValue); -} - -function getString(key: string, defValue?: string) { - if (shouldLoadUsingNodeFS()) { - loadLocalizedStringsUsingNodeFS(new FileSystem()); - } - return getLocalizedString(key, defValue); -} - -// Default to loading the current locale -loadLocalizedStringsUsingNodeFS(new FileSystem()); diff --git a/src/client/common/utils/localizeHelpers.ts b/src/client/common/utils/localizeHelpers.ts deleted file mode 100644 index 5a4eed6d98e6..000000000000 --- a/src/client/common/utils/localizeHelpers.ts +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -// IMPORTANT: Do not import any node fs related modules here, as they do not work in browser. - -import * as vscode from 'vscode'; -import * as path from 'path'; -import { EXTENSION_ROOT_DIR } from '../../constants'; -import { IFileSystem } from '../platform/types'; - -// Skip using vscode-nls and instead just compute our strings based on key values. Key values -// can be loaded out of the nls..json files -let loadedCollection: Record | undefined; -let defaultCollection: Record | undefined; -let askedForCollection: Record = {}; -let loadedLocale: string; - -// This is exported only for testing purposes. -export function _resetCollections(): void { - loadedLocale = ''; - loadedCollection = undefined; - askedForCollection = {}; -} - -// This is exported only for testing purposes. -export function _getAskedForCollection(): Record { - return askedForCollection; -} - -export function shouldLoadUsingNodeFS(): boolean { - return !loadedCollection || parseLocale() !== loadedLocale; -} - -declare let navigator: { language: string } | undefined; - -function parseLocale(): string { - try { - if (navigator?.language) { - return navigator.language.toLowerCase(); - } - } catch { - // Fall through - } - // Attempt to load from the vscode locale. If not there, use english - const vscodeConfigString = process.env.VSCODE_NLS_CONFIG; - return vscodeConfigString ? JSON.parse(vscodeConfigString).locale : 'en-us'; -} - -export function getLocalizedString(key: string, defValue?: string): string { - // The default collection (package.nls.json) is the fallback. - // Note that we are guaranteed the following (during shipping) - // 1. defaultCollection was initialized by the load() call above - // 2. defaultCollection has the key (see the "keys exist" test) - let collection = defaultCollection; - - // Use the current locale if the key is defined there. - if (loadedCollection && loadedCollection.hasOwnProperty(key)) { - collection = loadedCollection; - } - if (collection === undefined) { - throw new Error(`Localizations haven't been loaded yet for key: ${key}`); - } - let result = collection[key]; - if (!result && defValue) { - // This can happen during development if you haven't fixed up the nls file yet or - // if for some reason somebody broke the functional test. - result = defValue; - } - askedForCollection[key] = result; - - return result; -} - -/** - * Can be used to synchronously load localized strings, useful if we want localized strings at module level itself. - * Cannot be used in VSCode web or any browser. Must be called before any use of the locale. - */ -export function loadLocalizedStringsUsingNodeFS(fs: IFileSystem): void { - // Figure out our current locale. - loadedLocale = parseLocale(); - - // Find the nls file that matches (if there is one) - const nlsFile = path.join(EXTENSION_ROOT_DIR, `package.nls.${loadedLocale}.json`); - if (fs.fileExistsSync(nlsFile)) { - const contents = fs.readFileSync(nlsFile); - loadedCollection = JSON.parse(contents); - } else { - // If there isn't one, at least remember that we looked so we don't try to load a second time - loadedCollection = {}; - } - - // Get the default collection if necessary. Strings may be in the default or the locale json - if (!defaultCollection) { - const defaultNlsFile = path.join(EXTENSION_ROOT_DIR, 'package.nls.json'); - if (fs.fileExistsSync(defaultNlsFile)) { - const contents = fs.readFileSync(defaultNlsFile); - defaultCollection = JSON.parse(contents); - } else { - defaultCollection = {}; - } - } -} - -/** - * Only uses the VSCode APIs to query filesystem and not the node fs APIs, as - * they're not available in browser. Must be called before any use of the locale. - */ -export async function loadLocalizedStringsForBrowser(): Promise { - // Figure out our current locale. - loadedLocale = parseLocale(); - - loadedCollection = await parseNLS(loadedLocale); - - // Get the default collection if necessary. Strings may be in the default or the locale json - if (!defaultCollection) { - defaultCollection = await parseNLS(); - } -} - -async function parseNLS(locale?: string) { - try { - const filename = locale ? `package.nls.${locale}.json` : `package.nls.json`; - const nlsFile = vscode.Uri.joinPath(vscode.Uri.file(EXTENSION_ROOT_DIR), filename); - const buffer = await vscode.workspace.fs.readFile(nlsFile); - const contents = new TextDecoder().decode(buffer); - return JSON.parse(contents); - } catch { - // If there isn't one, at least remember that we looked so we don't try to load a second time. - return {}; - } -} diff --git a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts index a492dd85a33b..c86f3a9ef206 100644 --- a/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts +++ b/src/client/debugger/extension/adapter/outdatedDebuggerPrompt.ts @@ -22,9 +22,9 @@ class OutdatedDebuggerPrompt implements DebugAdapterTracker { public onDidSendMessage(message: DebugProtocol.ProtocolMessage) { if (this.promptCheck.shouldShowPrompt() && this.isPtvsd(message)) { - const prompts = [Common.moreInfo()]; + const prompts = [Common.moreInfo]; this.appShell - .showInformationMessage(OutdatedDebugger.outdatedDebuggerMessage(), ...prompts) + .showInformationMessage(OutdatedDebugger.outdatedDebuggerMessage, ...prompts) .then((selection) => { if (selection === prompts[0]) { this.browserService.launch('https://aka.ms/migrateToDebugpy'); diff --git a/src/client/debugger/extension/attachQuickPick/picker.ts b/src/client/debugger/extension/attachQuickPick/picker.ts index a2a995c6848e..a296a9b3163a 100644 --- a/src/client/debugger/extension/attachQuickPick/picker.ts +++ b/src/client/debugger/extension/attachQuickPick/picker.ts @@ -23,12 +23,12 @@ export class AttachPicker implements IAttachPicker { const refreshButton = { iconPath: getIcon(REFRESH_BUTTON_ICON), - tooltip: AttachProcess.refreshList(), + tooltip: AttachProcess.refreshList, }; const quickPick = this.applicationShell.createQuickPick(); - quickPick.title = AttachProcess.attachTitle(); - quickPick.placeholder = AttachProcess.selectProcessPlaceholder(); + quickPick.title = AttachProcess.attachTitle; + quickPick.placeholder = AttachProcess.selectProcessPlaceholder; quickPick.canSelectMany = false; quickPick.matchOnDescription = true; quickPick.matchOnDetail = true; @@ -51,7 +51,7 @@ export class AttachPicker implements IAttachPicker { quickPick.onDidAccept( () => { if (quickPick.selectedItems.length !== 1) { - reject(new Error(AttachProcess.noProcessSelected())); + reject(new Error(AttachProcess.noProcessSelected)); } const selectedId = quickPick.selectedItems[0].id; @@ -70,7 +70,7 @@ export class AttachPicker implements IAttachPicker { disposables.forEach((item) => item.dispose()); quickPick.dispose(); - reject(new Error(AttachProcess.noProcessSelected())); + reject(new Error(AttachProcess.noProcessSelected)); }, undefined, disposables, diff --git a/src/client/debugger/extension/attachQuickPick/provider.ts b/src/client/debugger/extension/attachQuickPick/provider.ts index ad6ccafee530..26bb80067f93 100644 --- a/src/client/debugger/extension/attachQuickPick/provider.ts +++ b/src/client/debugger/extension/attachQuickPick/provider.ts @@ -4,13 +4,15 @@ 'use strict'; import { inject, injectable } from 'inversify'; +import * as nls from 'vscode-nls'; import { IPlatformService } from '../../../common/platform/types'; import { IProcessServiceFactory } from '../../../common/process/types'; -import { AttachProcess as AttachProcessLocalization } from '../../../common/utils/localize'; import { PsProcessParser } from './psProcessParser'; import { IAttachItem, IAttachProcessProvider, ProcessListCommand } from './types'; import { WmicProcessParser } from './wmicProcessParser'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + @injectable() export class AttachProcessProvider implements IAttachProcessProvider { constructor( @@ -69,7 +71,13 @@ export class AttachProcessProvider implements IAttachProcessProvider { } else if (this.platformService.isWindows) { processCmd = WmicProcessParser.wmicCommand; } else { - throw new Error(AttachProcessLocalization.unsupportedOS().format(this.platformService.osType)); + throw new Error( + localize( + 'AttachProcess.unsupportedOS', + "Operating system '{0}' not supported.", + this.platformService.osType, + ), + ); } const processService = await this.processServiceFactory.create(); diff --git a/src/client/debugger/extension/configuration/debugConfigurationService.ts b/src/client/debugger/extension/configuration/debugConfigurationService.ts index 2de0fc682d55..103fd15969f5 100644 --- a/src/client/debugger/extension/configuration/debugConfigurationService.ts +++ b/src/client/debugger/extension/configuration/debugConfigurationService.ts @@ -108,44 +108,44 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi type DebugConfigurationQuickPickItem = QuickPickItem & { type: DebugConfigurationType }; const items: DebugConfigurationQuickPickItem[] = [ { - label: DebugConfigStrings.file.selectConfiguration.label(), + label: DebugConfigStrings.file.selectConfiguration.label, type: DebugConfigurationType.launchFile, - description: DebugConfigStrings.file.selectConfiguration.description(), + description: DebugConfigStrings.file.selectConfiguration.description, }, { - label: DebugConfigStrings.module.selectConfiguration.label(), + label: DebugConfigStrings.module.selectConfiguration.label, type: DebugConfigurationType.launchModule, - description: DebugConfigStrings.module.selectConfiguration.description(), + description: DebugConfigStrings.module.selectConfiguration.description, }, { - label: DebugConfigStrings.attach.selectConfiguration.label(), + label: DebugConfigStrings.attach.selectConfiguration.label, type: DebugConfigurationType.remoteAttach, - description: DebugConfigStrings.attach.selectConfiguration.description(), + description: DebugConfigStrings.attach.selectConfiguration.description, }, { - label: DebugConfigStrings.attachPid.selectConfiguration.label(), + label: DebugConfigStrings.attachPid.selectConfiguration.label, type: DebugConfigurationType.pidAttach, - description: DebugConfigStrings.attachPid.selectConfiguration.description(), + description: DebugConfigStrings.attachPid.selectConfiguration.description, }, { - label: DebugConfigStrings.django.selectConfiguration.label(), + label: DebugConfigStrings.django.selectConfiguration.label, type: DebugConfigurationType.launchDjango, - description: DebugConfigStrings.django.selectConfiguration.description(), + description: DebugConfigStrings.django.selectConfiguration.description, }, { - label: DebugConfigStrings.fastapi.selectConfiguration.label(), + label: DebugConfigStrings.fastapi.selectConfiguration.label, type: DebugConfigurationType.launchFastAPI, - description: DebugConfigStrings.fastapi.selectConfiguration.description(), + description: DebugConfigStrings.fastapi.selectConfiguration.description, }, { - label: DebugConfigStrings.flask.selectConfiguration.label(), + label: DebugConfigStrings.flask.selectConfiguration.label, type: DebugConfigurationType.launchFlask, - description: DebugConfigStrings.flask.selectConfiguration.description(), + description: DebugConfigStrings.flask.selectConfiguration.description, }, { - label: DebugConfigStrings.pyramid.selectConfiguration.label(), + label: DebugConfigStrings.pyramid.selectConfiguration.label, type: DebugConfigurationType.launchPyramid, - description: DebugConfigStrings.pyramid.selectConfiguration.description(), + description: DebugConfigStrings.pyramid.selectConfiguration.description, }, ]; state.config = {}; @@ -153,8 +153,8 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi DebugConfigurationQuickPickItem, IQuickPickParameters >({ - title: DebugConfigStrings.selectConfiguration.title(), - placeholder: DebugConfigStrings.selectConfiguration.placeholder(), + title: DebugConfigStrings.selectConfiguration.title, + placeholder: DebugConfigStrings.selectConfiguration.placeholder, activeItem: items[0], items: items, }); diff --git a/src/client/debugger/extension/configuration/launch.json/completionProvider.ts b/src/client/debugger/extension/configuration/launch.json/completionProvider.ts index da6595c5bb2a..d89201b940ee 100644 --- a/src/client/debugger/extension/configuration/launch.json/completionProvider.ts +++ b/src/client/debugger/extension/configuration/launch.json/completionProvider.ts @@ -54,14 +54,14 @@ export class LaunchJsonCompletionProvider implements CompletionItemProvider, IEx { command: { command: 'python.SelectAndInsertDebugConfiguration', - title: DebugConfigStrings.launchJsonCompletions.description(), + title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document, position, token], }, - documentation: DebugConfigStrings.launchJsonCompletions.description(), + documentation: DebugConfigStrings.launchJsonCompletions.description, sortText: 'AAAA', preselect: true, kind: CompletionItemKind.Enum, - label: DebugConfigStrings.launchJsonCompletions.label(), + label: DebugConfigStrings.launchJsonCompletions.label, insertText: new SnippetString(), }, ]; diff --git a/src/client/debugger/extension/configuration/providers/djangoLaunch.ts b/src/client/debugger/extension/configuration/providers/djangoLaunch.ts index 3ea7039e82f8..0b80f9e0cf14 100644 --- a/src/client/debugger/extension/configuration/providers/djangoLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/djangoLaunch.ts @@ -32,7 +32,7 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati let manuallyEnteredAValue: boolean | undefined; const defaultProgram = `${workspaceFolderToken}${this.pathUtils.separator}manage.py`; const config: Partial = { - name: DebugConfigStrings.django.snippet.name(), + name: DebugConfigStrings.django.snippet.name, type: DebuggerTypeName, request: 'launch', program: program || defaultProgram, @@ -42,9 +42,9 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati }; if (!program) { const selectedProgram = await input.showInputBox({ - title: DebugConfigStrings.django.enterManagePyPath.title(), + title: DebugConfigStrings.django.enterManagePyPath.title, value: defaultProgram, - prompt: DebugConfigStrings.django.enterManagePyPath.prompt(), + prompt: DebugConfigStrings.django.enterManagePyPath.prompt, validate: (value) => this.validateManagePy(state.folder, defaultProgram, value), }); if (selectedProgram) { @@ -65,7 +65,7 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati defaultValue: string, selected?: string, ): Promise { - const error = DebugConfigStrings.django.enterManagePyPath.invalid(); + const error = DebugConfigStrings.django.enterManagePyPath.invalid; if (!selected || selected.trim().length === 0) { return error; } diff --git a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts index 5e7c09177b21..a534ec21379c 100644 --- a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts @@ -25,7 +25,7 @@ export class FastAPILaunchDebugConfigurationProvider implements IDebugConfigurat const application = await this.getApplicationPath(state.folder); let manuallyEnteredAValue: boolean | undefined; const config: Partial = { - name: DebugConfigStrings.fastapi.snippet.name(), + name: DebugConfigStrings.fastapi.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'uvicorn', @@ -36,14 +36,14 @@ export class FastAPILaunchDebugConfigurationProvider implements IDebugConfigurat if (!application) { const selectedPath = await input.showInputBox({ - title: DebugConfigStrings.fastapi.enterAppPathOrNamePath.title(), + title: DebugConfigStrings.fastapi.enterAppPathOrNamePath.title, value: 'main.py', - prompt: DebugConfigStrings.fastapi.enterAppPathOrNamePath.prompt(), + prompt: DebugConfigStrings.fastapi.enterAppPathOrNamePath.prompt, validate: (value) => Promise.resolve( value && value.trim().length > 0 ? undefined - : DebugConfigStrings.fastapi.enterAppPathOrNamePath.invalid(), + : DebugConfigStrings.fastapi.enterAppPathOrNamePath.invalid, ), }); if (selectedPath) { diff --git a/src/client/debugger/extension/configuration/providers/fileLaunch.ts b/src/client/debugger/extension/configuration/providers/fileLaunch.ts index a6cfcc42cbc9..d6d51cb0528c 100644 --- a/src/client/debugger/extension/configuration/providers/fileLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/fileLaunch.ts @@ -21,7 +21,7 @@ export class FileLaunchDebugConfigurationProvider implements IDebugConfiguration ) public async buildConfiguration(_input: MultiStepInput, state: DebugConfigurationState) { const config: Partial = { - name: DebugConfigStrings.file.snippet.name(), + name: DebugConfigStrings.file.snippet.name, type: DebuggerTypeName, request: 'launch', program: '${file}', diff --git a/src/client/debugger/extension/configuration/providers/flaskLaunch.ts b/src/client/debugger/extension/configuration/providers/flaskLaunch.ts index 69d4019dd55a..07d5522f27ca 100644 --- a/src/client/debugger/extension/configuration/providers/flaskLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/flaskLaunch.ts @@ -25,7 +25,7 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio const application = await this.getApplicationPath(state.folder); let manuallyEnteredAValue: boolean | undefined; const config: Partial = { - name: DebugConfigStrings.flask.snippet.name(), + name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'flask', @@ -40,14 +40,14 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio if (!application) { const selectedApp = await input.showInputBox({ - title: DebugConfigStrings.flask.enterAppPathOrNamePath.title(), + title: DebugConfigStrings.flask.enterAppPathOrNamePath.title, value: 'app.py', - prompt: DebugConfigStrings.flask.enterAppPathOrNamePath.prompt(), + prompt: DebugConfigStrings.flask.enterAppPathOrNamePath.prompt, validate: (value) => Promise.resolve( value && value.trim().length > 0 ? undefined - : DebugConfigStrings.flask.enterAppPathOrNamePath.invalid(), + : DebugConfigStrings.flask.enterAppPathOrNamePath.invalid, ), }); if (selectedApp) { diff --git a/src/client/debugger/extension/configuration/providers/moduleLaunch.ts b/src/client/debugger/extension/configuration/providers/moduleLaunch.ts index 972633282b7c..9134655e1143 100644 --- a/src/client/debugger/extension/configuration/providers/moduleLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/moduleLaunch.ts @@ -17,19 +17,19 @@ export class ModuleLaunchDebugConfigurationProvider implements IDebugConfigurati public async buildConfiguration(input: MultiStepInput, state: DebugConfigurationState) { let manuallyEnteredAValue: boolean | undefined; const config: Partial = { - name: DebugConfigStrings.module.snippet.name(), + name: DebugConfigStrings.module.snippet.name, type: DebuggerTypeName, request: 'launch', - module: DebugConfigStrings.module.snippet.default(), + module: DebugConfigStrings.module.snippet.default, justMyCode: true, }; const selectedModule = await input.showInputBox({ - title: DebugConfigStrings.module.enterModule.title(), - value: config.module || DebugConfigStrings.module.enterModule.default(), - prompt: DebugConfigStrings.module.enterModule.prompt(), + title: DebugConfigStrings.module.enterModule.title, + value: config.module || DebugConfigStrings.module.enterModule.default, + prompt: DebugConfigStrings.module.enterModule.prompt, validate: (value) => Promise.resolve( - value && value.trim().length > 0 ? undefined : DebugConfigStrings.module.enterModule.invalid(), + value && value.trim().length > 0 ? undefined : DebugConfigStrings.module.enterModule.invalid, ), }); if (selectedModule) { diff --git a/src/client/debugger/extension/configuration/providers/pidAttach.ts b/src/client/debugger/extension/configuration/providers/pidAttach.ts index 808d9feb1789..8225ec175e65 100644 --- a/src/client/debugger/extension/configuration/providers/pidAttach.ts +++ b/src/client/debugger/extension/configuration/providers/pidAttach.ts @@ -21,7 +21,7 @@ export class PidAttachDebugConfigurationProvider implements IDebugConfigurationP ) public async buildConfiguration(_input: MultiStepInput, state: DebugConfigurationState) { const config: Partial = { - name: DebugConfigStrings.attachPid.snippet.name(), + name: DebugConfigStrings.attachPid.snippet.name, type: DebuggerTypeName, request: 'attach', processId: '${command:pickProcess}', diff --git a/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts b/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts index ecc7fcd14bc4..04233df11039 100644 --- a/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/pyramidLaunch.ts @@ -17,6 +17,9 @@ import { EventName } from '../../../../telemetry/constants'; import { DebuggerTypeName } from '../../../constants'; import { LaunchRequestArguments } from '../../../types'; import { DebugConfigurationState, DebugConfigurationType, IDebugConfigurationProvider } from '../../types'; +import * as nls from 'vscode-nls'; + +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); const workspaceFolderToken = '${workspaceFolder}'; @@ -33,7 +36,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat let manuallyEnteredAValue: boolean | undefined; const config: Partial = { - name: DebugConfigStrings.pyramid.snippet.name(), + name: DebugConfigStrings.pyramid.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'pyramid.scripts.pserve', @@ -45,9 +48,13 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat if (!iniPath) { const selectedIniPath = await input.showInputBox({ - title: DebugConfigStrings.pyramid.enterDevelopmentIniPath.title(), + title: DebugConfigStrings.pyramid.enterDevelopmentIniPath.title, value: defaultIni, - prompt: DebugConfigStrings.pyramid.enterDevelopmentIniPath.prompt(), + prompt: localize( + 'debug.pyramidEnterDevelopmentIniPathPrompt', + 'Enter the path to development.ini ({0} points to the root of the current workspace folder)', + workspaceFolderToken, + ), validate: (value) => this.validateIniPath(state ? state.folder : undefined, defaultIni, value), }); if (selectedIniPath) { @@ -71,7 +78,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat if (!folder) { return; } - const error = DebugConfigStrings.pyramid.enterDevelopmentIniPath.invalid(); + const error = DebugConfigStrings.pyramid.enterDevelopmentIniPath.invalid; if (!selected || selected.trim().length === 0) { return error; } diff --git a/src/client/debugger/extension/configuration/providers/remoteAttach.ts b/src/client/debugger/extension/configuration/providers/remoteAttach.ts index 3939ab0aea0b..d8ecb16016d2 100644 --- a/src/client/debugger/extension/configuration/providers/remoteAttach.ts +++ b/src/client/debugger/extension/configuration/providers/remoteAttach.ts @@ -22,7 +22,7 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati state: DebugConfigurationState, ): Promise | void> { const config: Partial = { - name: DebugConfigStrings.attach.snippet.name(), + name: DebugConfigStrings.attach.snippet.name, type: DebuggerTypeName, request: 'attach', connect: { @@ -40,14 +40,14 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati const connect = config.connect!; connect.host = await input.showInputBox({ - title: DebugConfigStrings.attach.enterRemoteHost.title(), + title: DebugConfigStrings.attach.enterRemoteHost.title, step: 1, totalSteps: 2, value: connect.host || defaultHost, - prompt: DebugConfigStrings.attach.enterRemoteHost.prompt(), + prompt: DebugConfigStrings.attach.enterRemoteHost.prompt, validate: (value) => Promise.resolve( - value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid(), + value && value.trim.length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid, ), }); if (!connect.host) { @@ -68,16 +68,14 @@ export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurati ) { const connect = config.connect || (config.connect = {}); const port = await input.showInputBox({ - title: DebugConfigStrings.attach.enterRemotePort.title(), + title: DebugConfigStrings.attach.enterRemotePort.title, step: 2, totalSteps: 2, value: (connect.port || defaultPort).toString(), - prompt: DebugConfigStrings.attach.enterRemotePort.prompt(), + prompt: DebugConfigStrings.attach.enterRemotePort.prompt, validate: (value) => Promise.resolve( - value && /^\d+$/.test(value.trim()) - ? undefined - : DebugConfigStrings.attach.enterRemotePort.invalid(), + value && /^\d+$/.test(value.trim()) ? undefined : DebugConfigStrings.attach.enterRemotePort.invalid, ), }); if (port && /^\d+$/.test(port.trim())) { diff --git a/src/client/extension.ts b/src/client/extension.ts index 4c2c37467877..181315b7df5a 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -28,6 +28,7 @@ initializeFileLogging(logDispose); //=============================================== // loading starts here +import '../setupNls'; import { ProgressLocation, ProgressOptions, window } from 'vscode'; import { buildApi } from './api'; import { IApplicationShell, IWorkspaceService } from './common/application/types'; @@ -164,7 +165,7 @@ async function activateUnsafe( } function displayProgress(promise: Promise) { - const progressOptions: ProgressOptions = { location: ProgressLocation.Window, title: Common.loadingExtension() }; + const progressOptions: ProgressOptions = { location: ProgressLocation.Window, title: Common.loadingExtension }; window.withProgress(progressOptions, () => promise); } diff --git a/src/client/extensionInit.ts b/src/client/extensionInit.ts index 1644fbdf1e99..506679d66fc2 100644 --- a/src/client/extensionInit.ts +++ b/src/client/extensionInit.ts @@ -53,7 +53,7 @@ export function initializeGlobals( serviceManager.addSingletonInstance(IMemento, context.workspaceState, WORKSPACE_MEMENTO); serviceManager.addSingletonInstance(IExtensionContext, context); - const standardOutputChannel = window.createOutputChannel(OutputChannelNames.python()); + const standardOutputChannel = window.createOutputChannel(OutputChannelNames.python); context.subscriptions.push(registerLogger(new OutputChannelLogger(standardOutputChannel))); const workspaceService = new WorkspaceService(); @@ -61,7 +61,7 @@ export function initializeGlobals( workspaceService.isVirtualWorkspace || !workspaceService.isTrusted ? // Do not create any test related output UI when using virtual workspaces. instance(mock()) - : window.createOutputChannel(OutputChannelNames.pythonTest()); + : window.createOutputChannel(OutputChannelNames.pythonTest); serviceManager.addSingletonInstance(IOutputChannel, standardOutputChannel, STANDARD_OUTPUT_CHANNEL); serviceManager.addSingletonInstance(IOutputChannel, unitTestOutChannel, TEST_OUTPUT_CHANNEL); diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/base.ts b/src/client/interpreter/configuration/interpreterSelector/commands/base.ts index e549745ff58f..6ed2dee36c89 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/base.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/base.ts @@ -67,7 +67,7 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle let quickPickItems: WorkspaceSelectionQuickPickItem[] = options?.resetTarget ? [ { - label: Common.clearAll(), + label: Common.clearAll, }, ] : []; @@ -85,7 +85,7 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle }; }), { - label: options?.resetTarget ? Interpreters.clearAtWorkspace() : Interpreters.entireWorkspace(), + label: options?.resetTarget ? Interpreters.clearAtWorkspace : Interpreters.entireWorkspace, uri: workspaceFolders[0].uri, }, ); @@ -96,7 +96,7 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle : 'Select the workspace folder to set the interpreter', }); - if (selection?.label === Common.clearAll()) { + if (selection?.label === Common.clearAll) { const folderTargets: { folderUri: Resource; configTarget: ConfigurationTarget; @@ -111,7 +111,7 @@ export abstract class BaseInterpreterSelectorCommand implements IExtensionSingle } return selection - ? selection.label === Interpreters.entireWorkspace() || selection.label === Interpreters.clearAtWorkspace() + ? selection.label === Interpreters.entireWorkspace || selection.label === Interpreters.clearAtWorkspace ? [{ folderUri: selection.uri, configTarget: ConfigurationTarget.Workspace }] : [{ folderUri: selection.uri, configTarget: ConfigurationTarget.WorkspaceFolder }] : undefined; diff --git a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts index 09e149809570..89b22e16a37f 100644 --- a/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts +++ b/src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts @@ -7,6 +7,7 @@ import { inject, injectable } from 'inversify'; import { cloneDeep } from 'lodash'; import * as path from 'path'; import { QuickPick, QuickPickItem, QuickPickItemKind } from 'vscode'; +import * as nls from 'vscode-nls'; import { IApplicationShell, ICommandManager, IWorkspaceService } from '../../../../common/application/types'; import { Commands, Octicons } from '../../../../common/constants'; import { isParentPath } from '../../../../common/platform/fs-paths'; @@ -34,6 +35,7 @@ import { } from '../../types'; import { BaseInterpreterSelectorCommand } from './base'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); const untildify = require('untildify'); export type InterpreterStateArgs = { path?: string; workspace: Resource }; @@ -53,22 +55,22 @@ function isSeparatorItem(item: QuickPickType): item is QuickPickItem { // eslint-disable-next-line @typescript-eslint/no-namespace export namespace EnvGroups { - export const Workspace = InterpreterQuickPickList.workspaceGroupName(); + export const Workspace = InterpreterQuickPickList.workspaceGroupName; export const Conda = 'Conda'; - export const Global = InterpreterQuickPickList.globalGroupName(); + export const Global = InterpreterQuickPickList.globalGroupName; export const VirtualEnv = 'VirtualEnv'; export const PipEnv = 'PipEnv'; export const Pyenv = 'Pyenv'; export const Venv = 'Venv'; export const Poetry = 'Poetry'; export const VirtualEnvWrapper = 'VirtualEnvWrapper'; - export const Recommended = Common.recommended(); + export const Recommended = Common.recommended; } @injectable() export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { private readonly manualEntrySuggestion: ISpecialQuickPickItem = { - label: `${Octicons.Add} ${InterpreterQuickPickList.enterPath.label()}`, + label: `${Octicons.Add} ${InterpreterQuickPickList.enterPath.label}`, alwaysShow: true, }; @@ -115,18 +117,22 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { state.workspace ? state.workspace.fsPath : undefined, ); const selection = await input.showQuickPick>({ - placeholder: InterpreterQuickPickList.quickPickListPlaceholder().format(currentInterpreterPathDisplay), + placeholder: localize( + 'InterpreterQuickPickList.quickPickListPlaceholder', + 'Selected Interpreter: {0}', + currentInterpreterPathDisplay, + ), items: suggestions, sortByLabel: !preserveOrderWhenFiltering, keepScrollPosition: true, activeItem: await this.getActiveItem(state.workspace, suggestions), matchOnDetail: true, matchOnDescription: true, - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, customButtonSetup: { button: { iconPath: getIcon(REFRESH_BUTTON_ICON), - tooltip: InterpreterQuickPickList.refreshInterpreterList(), + tooltip: InterpreterQuickPickList.refreshInterpreterList, }, callback: () => this.interpreterService.triggerRefresh().ignoreErrors(), }, @@ -213,7 +219,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { const defaultInterpreterPathValue = systemVariables.resolveAny(config.get('defaultInterpreterPath')); if (defaultInterpreterPathValue && defaultInterpreterPathValue !== 'python') { return { - label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label()}`, + label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label}`, description: this.pathUtils.getDisplayName( defaultInterpreterPathValue, resource ? resource.fsPath : undefined, @@ -311,7 +317,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { recommended.description = areItemsGrouped ? // No need to add a tag as "Recommended" group already exists. recommended.description - : `${recommended.description ?? ''} - ${Common.recommended()}`; + : `${recommended.description ?? ''} - ${Common.recommended}`; const index = items.findIndex( (item) => isInterpreterQuickPickItem(item) && item.interpreter.id === recommended.interpreter.id, ); @@ -329,13 +335,13 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { ): Promise> { const items: QuickPickItem[] = [ { - label: InterpreterQuickPickList.browsePath.label(), - detail: InterpreterQuickPickList.browsePath.detail(), + label: InterpreterQuickPickList.browsePath.label, + detail: InterpreterQuickPickList.browsePath.detail, }, ]; const selection = await input.showQuickPick({ - placeholder: InterpreterQuickPickList.enterPath.placeholder(), + placeholder: InterpreterQuickPickList.enterPath.placeholder, items, acceptFilterBoxTextAsSelection: true, }); @@ -345,16 +351,16 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand { sendTelemetryEvent(EventName.SELECT_INTERPRETER_ENTER_CHOICE, undefined, { choice: 'enter' }); state.path = selection; this.sendInterpreterEntryTelemetry(selection, state.workspace, suggestions); - } else if (selection && selection.label === InterpreterQuickPickList.browsePath.label()) { + } else if (selection && selection.label === InterpreterQuickPickList.browsePath.label) { sendTelemetryEvent(EventName.SELECT_INTERPRETER_ENTER_CHOICE, undefined, { choice: 'browse' }); const filtersKey = 'Executables'; const filtersObject: { [name: string]: string[] } = {}; filtersObject[filtersKey] = ['exe']; const uris = await this.applicationShell.showOpenDialog({ filters: this.platformService.isWindows ? filtersObject : undefined, - openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), + openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title(), + title: InterpreterQuickPickList.browsePath.title, }); if (uris && uris.length > 0) { state.path = uris[0].fsPath; diff --git a/src/client/interpreter/display/index.ts b/src/client/interpreter/display/index.ts index cf48c580126f..7c9c8bac47cd 100644 --- a/src/client/interpreter/display/index.ts +++ b/src/client/interpreter/display/index.ts @@ -5,7 +5,7 @@ import { IApplicationShell, IWorkspaceService } from '../../common/application/t import { Commands, PYTHON_LANGUAGE } from '../../common/constants'; import '../../common/extensions'; import { IDisposableRegistry, IPathUtils, Resource } from '../../common/types'; -import { InterpreterQuickPickList, Interpreters } from '../../common/utils/localize'; +import { InterpreterQuickPickList } from '../../common/utils/localize'; import { IServiceContainer } from '../../ioc/types'; import { traceLog } from '../../logging'; import { PythonEnvironment } from '../../pythonEnvironments/info'; @@ -15,6 +15,9 @@ import { IInterpreterService, IInterpreterStatusbarVisibilityFilter, } from '../contracts'; +import * as nls from 'vscode-nls'; + +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); /** * Based on https://github.com/microsoft/vscode-python/issues/18040#issuecomment-992567670. @@ -64,7 +67,7 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle }); this.languageStatus.severity = LanguageStatusSeverity.Information; this.languageStatus.command = { - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, command: Commands.Set_Interpreter, }; this.disposableRegistry.push(this.languageStatus); @@ -114,7 +117,9 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle this.statusBar.tooltip = this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath); if (this.currentlySelectedInterpreterPath !== interpreter.path) { traceLog( - Interpreters.pythonInterpreterPath().format( + localize( + 'Interpreters.sttausBarPythonInterpreterPath', + 'Python interpreter path: {0}', this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath), ), ); @@ -127,7 +132,7 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle } else { this.statusBar.tooltip = ''; this.statusBar.color = ''; - this.statusBar.text = `$(alert) ${InterpreterQuickPickList.browsePath.openButtonLabel()}`; + this.statusBar.text = `$(alert) ${InterpreterQuickPickList.browsePath.openButtonLabel}`; this.currentlySelectedInterpreterDisplay = undefined; } } else if (this.languageStatus) { @@ -135,7 +140,9 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle this.languageStatus.detail = this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath); if (this.currentlySelectedInterpreterPath !== interpreter.path) { traceLog( - Interpreters.pythonInterpreterPath().format( + localize( + 'Interpreters.pythonInterpreterPath', + 'Python interpreter path: {0}', this.pathUtils.getDisplayName(interpreter.path, workspaceFolder?.fsPath), ), ); diff --git a/src/client/interpreter/display/progressDisplay.ts b/src/client/interpreter/display/progressDisplay.ts index 2f54a03074e3..09e8c9db0cb2 100644 --- a/src/client/interpreter/display/progressDisplay.ts +++ b/src/client/interpreter/display/progressDisplay.ts @@ -61,7 +61,7 @@ export class InterpreterLocatorProgressStatubarHandler implements IExtensionSing const progressOptions: ProgressOptions = { location: ProgressLocation.Window, title: `[${ - this.isFirstTimeLoadingInterpreters ? Interpreters.discovering() : Interpreters.refreshing() + this.isFirstTimeLoadingInterpreters ? Interpreters.discovering : Interpreters.refreshing }](command:${Commands.Set_Interpreter})`, }; this.isFirstTimeLoadingInterpreters = false; diff --git a/src/client/interpreter/interpreterService.ts b/src/client/interpreter/interpreterService.ts index b9ef85bf0f5c..9bdbafdc3bf6 100644 --- a/src/client/interpreter/interpreterService.ts +++ b/src/client/interpreter/interpreterService.ts @@ -205,7 +205,7 @@ export class InterpreterService implements Disposable, IInterpreterService { const shell = this.serviceContainer.get(IApplicationShell); const progressOptions: ProgressOptions = { location: ProgressLocation.Window, - title: `[${Interpreters.installingPython()}](command:${Commands.ViewOutput})`, + title: `[${Interpreters.installingPython}](command:${Commands.ViewOutput})`, }; traceLog('Conda envs without Python are known to not work well; fixing conda environment...'); const promise = installer.install(Product.python, await this.getInterpreterDetails(pythonPath)); diff --git a/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts b/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts index 495e7181264b..da3d22a72bee 100644 --- a/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts +++ b/src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts @@ -52,9 +52,9 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService { if (!notificationPromptEnabled.value) { return; } - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.moreInfo()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.moreInfo]; const telemetrySelections: ['Yes', 'No', 'More Info'] = ['Yes', 'No', 'More Info']; - const selection = await this.appShell.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts); + const selection = await this.appShell.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts); sendTelemetryEvent(EventName.CONDA_INHERIT_ENV_PROMPT, undefined, { selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); diff --git a/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts b/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts index 492c850ae542..889e0205747b 100644 --- a/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts +++ b/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts @@ -64,12 +64,9 @@ export class VirtualEnvironmentPrompt implements IExtensionActivationService { if (!notificationPromptEnabled.value) { return; } - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const telemetrySelections: ['Yes', 'No', 'Ignore'] = ['Yes', 'No', 'Ignore']; - const selection = await this.appShell.showInformationMessage( - Interpreters.environmentPromptMessage(), - ...prompts, - ); + const selection = await this.appShell.showInformationMessage(Interpreters.environmentPromptMessage, ...prompts); sendTelemetryEvent(EventName.PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT, undefined, { selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined, }); diff --git a/src/client/languageServer/pylanceLSExtensionManager.ts b/src/client/languageServer/pylanceLSExtensionManager.ts index 34c94af1eb66..f740eb74e059 100644 --- a/src/client/languageServer/pylanceLSExtensionManager.ts +++ b/src/client/languageServer/pylanceLSExtensionManager.ts @@ -102,6 +102,6 @@ export class PylanceLSExtensionManager extends LanguageServerCapabilities this.configurationService, ); - traceLog(Pylance.pylanceNotInstalledMessage()); + traceLog(Pylance.pylanceNotInstalledMessage); } } diff --git a/src/client/languageServer/watcher.ts b/src/client/languageServer/watcher.ts index b3ea01b3bd0e..c876f6abef7e 100644 --- a/src/client/languageServer/watcher.ts +++ b/src/client/languageServer/watcher.ts @@ -4,6 +4,7 @@ import * as path from 'path'; import { inject, injectable } from 'inversify'; import { ConfigurationChangeEvent, Uri, WorkspaceFoldersChangeEvent } from 'vscode'; +import * as nls from 'vscode-nls'; import { LanguageServerChangeHandler } from '../activation/common/languageServerChangeHandler'; import { IExtensionActivationService, @@ -34,6 +35,8 @@ import { NoneLSExtensionManager } from './noneLSExtensionManager'; import { PylanceLSExtensionManager } from './pylanceLSExtensionManager'; import { ILanguageServerExtensionManager, ILanguageServerWatcher } from './types'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + @injectable() /** * The Language Server Watcher class implements the ILanguageServerWatcher interface, which is the one-stop shop for language server activation. @@ -144,7 +147,7 @@ export class LanguageServerWatcher serverType !== LanguageServerType.Node && serverType !== LanguageServerType.None ) { - traceLog(LanguageService.untrustedWorkspaceMessage()); + traceLog(LanguageService.untrustedWorkspaceMessage); serverType = LanguageServerType.None; } @@ -325,13 +328,13 @@ function logStartup(languageServerType: LanguageServerType, resource: Uri): void switch (languageServerType) { case LanguageServerType.Jedi: - outputLine = LanguageService.startingJedi().format(basename); + outputLine = localize('LanguageService.startingJedi', 'Starting Jedi language server for {0}.', basename); break; case LanguageServerType.Node: - outputLine = LanguageService.startingPylance(); + outputLine = LanguageService.startingPylance; break; case LanguageServerType.None: - outputLine = LanguageService.startingNone(); + outputLine = LanguageService.startingNone; break; default: throw new Error(`Unknown language server type: ${languageServerType}`); diff --git a/src/client/linters/linterCommands.ts b/src/client/linters/linterCommands.ts index 9011bbeaf7bb..0f2b1f6fea96 100644 --- a/src/client/linters/linterCommands.ts +++ b/src/client/linters/linterCommands.ts @@ -4,15 +4,18 @@ 'use strict'; import { DiagnosticCollection, Disposable, QuickPickOptions, Uri } from 'vscode'; +import * as nls from 'vscode-nls'; import { IApplicationShell, ICommandManager, IDocumentManager } from '../common/application/types'; import { Commands } from '../common/constants'; import { IDisposable } from '../common/types'; -import { Linters } from '../common/utils/localize'; +import { Common } from '../common/utils/localize'; import { IServiceContainer } from '../ioc/types'; import { sendTelemetryEvent } from '../telemetry'; import { EventName } from '../telemetry/constants'; import { ILinterManager, ILintingEngine, LinterId } from './types'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + export class LinterCommands implements IDisposable { private disposables: Disposable[] = []; @@ -71,11 +74,15 @@ export class LinterCommands implements IDisposable { const index = linters.findIndex((x) => x.id === selection); if (activeLinters.length > 1) { const response = await this.appShell.showWarningMessage( - Linters.replaceWithSelectedLinter().format(selection), - 'Yes', - 'No', + localize( + 'Linter.replaceWithSelectedLinter', + "Multiple linters are enabled in settings. Replace with '{0}'?", + selection, + ), + Common.bannerLabelYes, + Common.bannerLabelNo, ); - if (response !== 'Yes') { + if (response !== Common.bannerLabelYes) { return; } } diff --git a/src/client/providers/importSortProvider.ts b/src/client/providers/importSortProvider.ts index de09d4cae8fd..684f1b5ccae1 100644 --- a/src/client/providers/importSortProvider.ts +++ b/src/client/providers/importSortProvider.ts @@ -161,14 +161,14 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider { return; } const selection = await this.shell.showWarningMessage( - Diagnostics.checkIsort5UpgradeGuide(), - Common.openOutputPanel(), - Common.doNotShowAgain(), + Diagnostics.checkIsort5UpgradeGuide, + Common.openOutputPanel, + Common.doNotShowAgain, ); - if (selection === Common.openOutputPanel()) { + if (selection === Common.openOutputPanel) { const cmdManager = this.serviceContainer.get(ICommandManager); await cmdManager.executeCommand(Commands.ViewOutput); - } else if (selection === Common.doNotShowAgain()) { + } else if (selection === Common.doNotShowAgain) { await neverShowAgain.updateValue(true); } } diff --git a/src/client/sourceMapSupport.ts b/src/client/sourceMapSupport.ts index 8800fd7d3e29..0d1ba39eb941 100644 --- a/src/client/sourceMapSupport.ts +++ b/src/client/sourceMapSupport.ts @@ -26,8 +26,8 @@ export class SourceMapSupport { await this.enableSourceMaps(true); require('source-map-support').install(); const localize = require('./common/utils/localize') as typeof import('./common/utils/localize'); - const disable = localize.Diagnostics.disableSourceMaps(); - this.vscode.window.showWarningMessage(localize.Diagnostics.warnSourceMaps(), disable).then((selection) => { + const disable = localize.Diagnostics.disableSourceMaps; + this.vscode.window.showWarningMessage(localize.Diagnostics.warnSourceMaps, disable).then((selection) => { if (selection === disable) { this.disable().ignoreErrors(); } diff --git a/src/client/tensorBoard/nbextensionCodeLensProvider.ts b/src/client/tensorBoard/nbextensionCodeLensProvider.ts index ec5653e4ac7a..6d4c844cd392 100644 --- a/src/client/tensorBoard/nbextensionCodeLensProvider.ts +++ b/src/client/tensorBoard/nbextensionCodeLensProvider.ts @@ -44,7 +44,7 @@ export class TensorBoardNbextensionCodeLensProvider implements IExtensionSingleA public provideCodeLenses(document: TextDocument, cancelToken: CancellationToken): CodeLens[] { const command: Command = { - title: TensorBoard.launchNativeTensorBoardSessionCodeLens(), + title: TensorBoard.launchNativeTensorBoardSessionCodeLens, command: Commands.LaunchTensorBoard, arguments: [ { trigger: TensorBoardEntrypointTrigger.nbextension, entrypoint: TensorBoardEntrypoint.codelens }, diff --git a/src/client/tensorBoard/tensorBoardImportCodeLensProvider.ts b/src/client/tensorBoard/tensorBoardImportCodeLensProvider.ts index 388a79cfb244..cac29b1d7e7a 100644 --- a/src/client/tensorBoard/tensorBoardImportCodeLensProvider.ts +++ b/src/client/tensorBoard/tensorBoardImportCodeLensProvider.ts @@ -33,7 +33,7 @@ export class TensorBoardImportCodeLensProvider implements IExtensionSingleActiva // eslint-disable-next-line class-methods-use-this public provideCodeLenses(document: TextDocument, cancelToken: CancellationToken): CodeLens[] { const command: Command = { - title: TensorBoard.launchNativeTensorBoardSessionCodeLens(), + title: TensorBoard.launchNativeTensorBoardSessionCodeLens, command: Commands.LaunchTensorBoard, arguments: [ { trigger: TensorBoardEntrypointTrigger.fileimport, entrypoint: TensorBoardEntrypoint.codelens }, diff --git a/src/client/tensorBoard/tensorBoardPrompt.ts b/src/client/tensorBoard/tensorBoardPrompt.ts index d0c026411ecf..1c03a696dc1d 100644 --- a/src/client/tensorBoard/tensorBoardPrompt.ts +++ b/src/client/tensorBoard/tensorBoardPrompt.ts @@ -46,14 +46,14 @@ export class TensorBoardPrompt { public async showNativeTensorBoardPrompt(trigger: TensorBoardEntrypointTrigger): Promise { if (this.enabled && this.enabledInCurrentSession && !this.waitingForUserSelection) { - const yes = Common.bannerLabelYes(); - const no = Common.bannerLabelNo(); - const doNotAskAgain = Common.doNotShowAgain(); + const yes = Common.bannerLabelYes; + const no = Common.bannerLabelNo; + const doNotAskAgain = Common.doNotShowAgain; const options = [yes, no, doNotAskAgain]; this.waitingForUserSelection = true; this.sendTelemetryOnce(trigger); const selection = await this.applicationShell.showInformationMessage( - TensorBoard.nativeTensorBoardPrompt(), + TensorBoard.nativeTensorBoardPrompt, ...options, ); this.waitingForUserSelection = false; diff --git a/src/client/tensorBoard/tensorBoardSession.ts b/src/client/tensorBoard/tensorBoardSession.ts index c71119006792..e5bd67c94f6b 100644 --- a/src/client/tensorBoard/tensorBoardSession.ts +++ b/src/client/tensorBoard/tensorBoardSession.ts @@ -23,6 +23,7 @@ import { window, workspace, } from 'vscode'; +import * as nls from 'vscode-nls'; import { IApplicationShell, ICommandManager, IWorkspaceService } from '../common/application/types'; import { createPromiseFromCancellation } from '../common/cancellation'; import { tensorboardLauncher } from '../common/process/internal/scripts'; @@ -47,6 +48,8 @@ import { IMultiStepInputFactory } from '../common/utils/multiStepInput'; import { ModuleInstallFlags } from '../common/installer/types'; import { traceError, traceInfo } from '../logging'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + enum Messages { JumpToSource = 'jump_to_source', } @@ -147,8 +150,8 @@ export class TensorBoardSession { profilerPluginInstallStatus: ProductInstallStatus, ) { sendTelemetryEvent(EventName.TENSORBOARD_INSTALL_PROMPT_SHOWN); - const yes = Common.bannerLabelYes(); - const no = Common.bannerLabelNo(); + const yes = Common.bannerLabelYes; + const no = Common.bannerLabelNo; const isUpgrade = tensorBoardInstallStatus === ProductInstallStatus.NeedsUpgrade; let message; @@ -157,16 +160,16 @@ export class TensorBoardSession { profilerPluginInstallStatus !== ProductInstallStatus.Installed ) { // PyTorch user already has TensorBoard, just ask if they want the profiler plugin - message = TensorBoard.installProfilerPluginPrompt(); + message = TensorBoard.installProfilerPluginPrompt; } else if (profilerPluginInstallStatus !== ProductInstallStatus.Installed) { // PyTorch user doesn't have compatible TensorBoard or the profiler plugin - message = TensorBoard.installTensorBoardAndProfilerPluginPrompt(); + message = TensorBoard.installTensorBoardAndProfilerPluginPrompt; } else if (isUpgrade) { // Not a PyTorch user and needs upgrade, don't need to mention profiler plugin - message = TensorBoard.upgradePrompt(); + message = TensorBoard.upgradePrompt; } else { // Not a PyTorch user and needs install, again don't need to mention profiler plugin - message = TensorBoard.installPrompt(); + message = TensorBoard.installPrompt; } const selection = await this.applicationShell.showErrorMessage(message, ...[yes, no]); let telemetrySelection = TensorBoardPromptSelection.None; @@ -222,10 +225,10 @@ export class TensorBoardSession { tensorboardInstallStatus, isTorchUser ? profilerPluginInstallStatus : ProductInstallStatus.Installed, ); - if (selection !== Common.bannerLabelYes() && !needsTensorBoardInstall) { + if (selection !== Common.bannerLabelYes && !needsTensorBoardInstall) { return true; } - if (selection !== Common.bannerLabelYes()) { + if (selection !== Common.bannerLabelYes) { return false; } @@ -309,25 +312,25 @@ export class TensorBoardSession { if (logDir) { const useCwd = { - label: TensorBoard.useCurrentWorkingDirectory(), - detail: TensorBoard.useCurrentWorkingDirectoryDetail(), + label: TensorBoard.useCurrentWorkingDirectory, + detail: TensorBoard.useCurrentWorkingDirectoryDetail, }; const selectAnotherFolder = { - label: TensorBoard.selectAnotherFolder(), - detail: TensorBoard.selectAnotherFolderDetail(), + label: TensorBoard.selectAnotherFolder, + detail: TensorBoard.selectAnotherFolderDetail, }; items.push(useCwd, selectAnotherFolder); } else { const selectAFolder = { - label: TensorBoard.selectAFolder(), - detail: TensorBoard.selectAFolderDetail(), + label: TensorBoard.selectAFolder, + detail: TensorBoard.selectAFolderDetail, }; items.push(selectAFolder); } items.push({ - label: TensorBoard.enterRemoteUrl(), - detail: TensorBoard.enterRemoteUrlDetail(), + label: TensorBoard.enterRemoteUrl, + detail: TensorBoard.enterRemoteUrlDetail, }); return items; @@ -346,15 +349,15 @@ export class TensorBoardSession { } // No log directory in settings. Ask the user which directory to use const logDir = this.autopopulateLogDirectoryPath(); - const useCurrentWorkingDirectory = TensorBoard.useCurrentWorkingDirectory(); - const selectAFolder = TensorBoard.selectAFolder(); - const selectAnotherFolder = TensorBoard.selectAnotherFolder(); - const enterRemoteUrl = TensorBoard.enterRemoteUrl(); + const { useCurrentWorkingDirectory } = TensorBoard; + const { selectAFolder } = TensorBoard; + const { selectAnotherFolder } = TensorBoard; + const { enterRemoteUrl } = TensorBoard; const items: QuickPickItem[] = this.getQuickPickItems(logDir); const item = await this.applicationShell.showQuickPick(items, { canPickMany: false, ignoreFocusOut: false, - placeHolder: logDir ? TensorBoard.currentDirectory().format(logDir) : undefined, + placeHolder: logDir ? localize('TensorBoard.currentDirectory', 'Current: {0}', logDir) : undefined, }); switch (item?.label) { case useCurrentWorkingDirectory: @@ -364,7 +367,7 @@ export class TensorBoardSession { return this.showFilePicker(); case enterRemoteUrl: return this.applicationShell.showInputBox({ - prompt: TensorBoard.enterRemoteUrlDetail(), + prompt: TensorBoard.enterRemoteUrlDetail, }); default: return undefined; @@ -387,7 +390,7 @@ export class TensorBoardSession { // Display a progress indicator as TensorBoard takes at least a couple seconds to launch const progressOptions: ProgressOptions = { - title: TensorBoard.progressMessage(), + title: TensorBoard.progressMessage, location: ProgressLocation.Notification, cancellable: true, }; @@ -550,8 +553,8 @@ export class TensorBoardSession { // Prompt the user to pick the file on disk const items: QuickPickItem[] = [ { - label: TensorBoard.selectMissingSourceFile(), - description: TensorBoard.selectMissingSourceFileDescription(), + label: TensorBoard.selectMissingSourceFile, + description: TensorBoard.selectMissingSourceFileDescription, }, ]; // Using a multistep so that we can add a title to the quickpick @@ -559,11 +562,11 @@ export class TensorBoardSession { await multiStep.run(async (input) => { const selection = await input.showQuickPick({ items, - title: TensorBoard.missingSourceFile(), + title: TensorBoard.missingSourceFile, placeholder: fsPath, }); switch (selection?.label) { - case TensorBoard.selectMissingSourceFile(): { + case TensorBoard.selectMissingSourceFile: { const filePickerSelection = await this.applicationShell.showOpenDialog({ canSelectFiles: true, canSelectFolders: false, diff --git a/src/client/tensorBoard/tensorBoardSessionProvider.ts b/src/client/tensorBoard/tensorBoardSessionProvider.ts index 1b7085803940..c71be0b782ac 100644 --- a/src/client/tensorBoard/tensorBoardSessionProvider.ts +++ b/src/client/tensorBoard/tensorBoardSessionProvider.ts @@ -3,13 +3,13 @@ import { inject, injectable } from 'inversify'; import { ViewColumn } from 'vscode'; +import * as nls from 'vscode-nls'; import { IExtensionSingleActivationService } from '../activation/types'; import { IApplicationShell, ICommandManager, IWorkspaceService } from '../common/application/types'; import { Commands } from '../common/constants'; import { ContextKey } from '../common/contextKey'; import { IProcessServiceFactory } from '../common/process/types'; import { IDisposableRegistry, IInstaller, IPersistentState, IPersistentStateFactory } from '../common/types'; -import { TensorBoard } from '../common/utils/localize'; import { IMultiStepInputFactory } from '../common/utils/multiStepInput'; import { IInterpreterService } from '../interpreter/contracts'; import { traceError, traceInfo } from '../logging'; @@ -18,6 +18,8 @@ import { EventName } from '../telemetry/constants'; import { TensorBoardEntrypoint, TensorBoardEntrypointTrigger } from './constants'; import { TensorBoardSession } from './tensorBoardSession'; +const localize: nls.LocalizeFunc = nls.loadMessageBundle(); + const PREFERRED_VIEWGROUP = 'PythonTensorBoardWebviewPreferredViewGroup'; @injectable() @@ -109,7 +111,11 @@ export class TensorBoardSessionProvider implements IExtensionSingleActivationSer } catch (e) { traceError(`Encountered error while starting new TensorBoard session: ${e}`); await this.applicationShell.showErrorMessage( - TensorBoard.failedToStartSessionError().format((e as Error).message), + localize( + 'TensorBoard.failedToStartSessionError', + 'We failed to start a TensorBoard session due to the following error: {0}', + (e as Error).message, + ), ); } return undefined; diff --git a/src/client/testing/main.ts b/src/client/testing/main.ts index 13eda51e0a88..797ec0db568c 100644 --- a/src/client/testing/main.ts +++ b/src/client/testing/main.ts @@ -98,10 +98,10 @@ export class UnitTestManagementService implements IExtensionActivationService { // Once that is fixed delete this notification and test should be configured from the test view. const app = this.serviceContainer.get(IApplicationShell); const response = await app.showInformationMessage( - Testing.testNotConfigured(), - Testing.configureTests(), + Testing.testNotConfigured, + Testing.configureTests, ); - if (response === Testing.configureTests()) { + if (response === Testing.configureTests) { await commandManager.executeCommand( constants.Commands.Tests_Configure, undefined, diff --git a/src/client/testing/testController/workspaceTestAdapter.ts b/src/client/testing/testController/workspaceTestAdapter.ts index 1aa5e707d88a..69fcea9ce03c 100644 --- a/src/client/testing/testController/workspaceTestAdapter.ts +++ b/src/client/testing/testController/workspaceTestAdapter.ts @@ -62,13 +62,13 @@ export class WorkspaceTestAdapter { sendTelemetryEvent(EventName.UNITTEST_DISCOVERY_DONE, undefined, { tool: this.testProvider, failed: true }); const cancel = token?.isCancellationRequested - ? Testing.cancelUnittestDiscovery() - : Testing.errorUnittestDiscovery(); + ? Testing.cancelUnittestDiscovery + : Testing.errorUnittestDiscovery; traceError(`${cancel}\r\n`, ex); // Report also on the test view. - const message = util.format(`${cancel} ${Testing.seePythonOutput()}\r\n`, ex); + const message = util.format(`${cancel} ${Testing.seePythonOutput}\r\n`, ex); const options = buildErrorNodeOptions(this.workspaceUri, message); const errorNode = createErrorTestItem(testController, options); testController.items.add(errorNode); @@ -88,11 +88,11 @@ export class WorkspaceTestAdapter { // Check if there were any errors in the discovery process. if (rawTestData.status === 'error') { const { errors } = rawTestData; - traceError(Testing.errorUnittestDiscovery(), '\r\n', errors!.join('\r\n\r\n')); + traceError(Testing.errorUnittestDiscovery, '\r\n', errors!.join('\r\n\r\n')); let errorNode = testController.items.get(`DiscoveryError:${workspacePath}`); const message = util.format( - `${Testing.errorUnittestDiscovery()} ${Testing.seePythonOutput()}\r\n`, + `${Testing.errorUnittestDiscovery} ${Testing.seePythonOutput}\r\n`, errors!.join('\r\n\r\n'), ); diff --git a/src/setupNls.ts b/src/setupNls.ts new file mode 100644 index 000000000000..22ece182e5ae --- /dev/null +++ b/src/setupNls.ts @@ -0,0 +1,8 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as nls from 'vscode-nls'; + +nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone }); diff --git a/src/test/activation/extensionSurvey.unit.test.ts b/src/test/activation/extensionSurvey.unit.test.ts index e3618ce4bfb9..6449eae24f31 100644 --- a/src/test/activation/extensionSurvey.unit.test.ts +++ b/src/test/activation/extensionSurvey.unit.test.ts @@ -222,11 +222,7 @@ suite('Extension survey prompt - showSurvey()', () => { const packageJson = { version: 'extensionVersion', }; - const prompts = [ - ExtensionSurveyBanner.bannerLabelYes(), - ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain(), - ]; + const prompts = [ExtensionSurveyBanner.bannerLabelYes, ExtensionSurveyBanner.maybeLater, Common.doNotShowAgain]; const expectedUrl = `https://aka.ms/AA5rjx5?o=Windows&v=vscodeVersion&e=extensionVersion&m=sessionId`; appEnvironment .setup((a) => a.packageJson) @@ -245,8 +241,8 @@ suite('Extension survey prompt - showSurvey()', () => { .returns(() => OSType.Windows) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts)) - .returns(() => Promise.resolve(ExtensionSurveyBanner.bannerLabelYes())) + .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage, ...prompts)) + .returns(() => Promise.resolve(ExtensionSurveyBanner.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); browserService .setup((s) => s.launch(expectedUrl)) @@ -282,15 +278,11 @@ suite('Extension survey prompt - showSurvey()', () => { }); test("Do nothing if 'Maybe later' option is clicked", async () => { - const prompts = [ - ExtensionSurveyBanner.bannerLabelYes(), - ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain(), - ]; + const prompts = [ExtensionSurveyBanner.bannerLabelYes, ExtensionSurveyBanner.maybeLater, Common.doNotShowAgain]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell - .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts)) - .returns(() => Promise.resolve(ExtensionSurveyBanner.maybeLater())) + .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage, ...prompts)) + .returns(() => Promise.resolve(ExtensionSurveyBanner.maybeLater)) .verifiable(TypeMoq.Times.once()); browserService .setup((s) => s.launch(TypeMoq.It.isAny())) @@ -325,14 +317,10 @@ suite('Extension survey prompt - showSurvey()', () => { }); test('Do nothing if no option is clicked', async () => { - const prompts = [ - ExtensionSurveyBanner.bannerLabelYes(), - ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain(), - ]; + const prompts = [ExtensionSurveyBanner.bannerLabelYes, ExtensionSurveyBanner.maybeLater, Common.doNotShowAgain]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell - .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts)) + .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage, ...prompts)) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); browserService @@ -368,15 +356,11 @@ suite('Extension survey prompt - showSurvey()', () => { }); test("Disable prompt if 'Do not show again' option is clicked", async () => { - const prompts = [ - ExtensionSurveyBanner.bannerLabelYes(), - ExtensionSurveyBanner.maybeLater(), - Common.doNotShowAgain(), - ]; + const prompts = [ExtensionSurveyBanner.bannerLabelYes, ExtensionSurveyBanner.maybeLater, Common.doNotShowAgain]; platformService.setup((p) => p.osType).verifiable(TypeMoq.Times.never()); appShell - .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage(), ...prompts)) - .returns(() => Promise.resolve(Common.doNotShowAgain())) + .setup((a) => a.showInformationMessage(ExtensionSurveyBanner.bannerMessage, ...prompts)) + .returns(() => Promise.resolve(Common.doNotShowAgain)) .verifiable(TypeMoq.Times.once()); browserService .setup((s) => s.launch(TypeMoq.It.isAny())) diff --git a/src/test/activation/node/languageServerChangeHandler.unit.test.ts b/src/test/activation/node/languageServerChangeHandler.unit.test.ts index 0b06cccae812..7f1dffaf848b 100644 --- a/src/test/activation/node/languageServerChangeHandler.unit.test.ts +++ b/src/test/activation/node/languageServerChangeHandler.unit.test.ts @@ -52,25 +52,23 @@ suite('Language Server - Change Handler', () => { test('Handler should prompt for install when language server changes to Pylance and Pylance is not installed', async () => { when( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), ).thenReturn(Promise.resolve(undefined)); handler = makeHandler(undefined); await handler.handleLanguageServerChange(LanguageServerType.Node); - verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), - ).never(); + verify(appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange, Common.reload)).never(); verify( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), ).once(); }); @@ -78,12 +76,12 @@ suite('Language Server - Change Handler', () => { test('Handler should open Pylance store page when language server changes to Pylance, Pylance is not installed and user clicks Yes', async () => { when( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), - ).thenReturn(Promise.resolve(Pylance.pylanceInstallPylance())); + ).thenReturn(Promise.resolve(Pylance.pylanceInstallPylance)); handler = makeHandler(undefined); await handler.handleLanguageServerChange(LanguageServerType.Node); @@ -95,12 +93,12 @@ suite('Language Server - Change Handler', () => { test('Handler should not open Pylance store page when language server changes to Pylance, Pylance is not installed and user clicks No', async () => { when( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), - ).thenReturn(Promise.resolve(Pylance.remindMeLater())); + ).thenReturn(Promise.resolve(Pylance.remindMeLater)); handler = makeHandler(undefined); await handler.handleLanguageServerChange(LanguageServerType.Node); @@ -116,12 +114,12 @@ suite('Language Server - Change Handler', () => { when( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), - ).thenReturn(Promise.resolve(Pylance.pylanceRevertToJedi())); + ).thenReturn(Promise.resolve(Pylance.pylanceRevertToJedi)); when(workspace.getConfiguration('python')).thenReturn(instance(configuration)); @@ -137,14 +135,14 @@ suite('Language Server - Change Handler', () => { await handler.handleLanguageServerChange(LanguageServerType.Node); verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange, Common.reload), ).never(); verify( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), ).once(); verify(configService.updateSetting('languageServer', LanguageServerType.Jedi, undefined, target)).once(); @@ -158,12 +156,12 @@ suite('Language Server - Change Handler', () => { when( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), - ).thenReturn(Promise.resolve(Pylance.pylanceRevertToJedi())); + ).thenReturn(Promise.resolve(Pylance.pylanceRevertToJedi)); when(workspace.getConfiguration('python')).thenReturn(instance(configuration)); @@ -179,14 +177,14 @@ suite('Language Server - Change Handler', () => { await handler.handleLanguageServerChange(LanguageServerType.Node); verify( - appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange(), Common.reload()), + appShell.showInformationMessage(LanguageService.reloadAfterLanguageServerChange, Common.reload), ).never(); verify( appShell.showWarningMessage( - Pylance.pylanceRevertToJediPrompt(), - Pylance.pylanceInstallPylance(), - Pylance.pylanceRevertToJedi(), - Pylance.remindMeLater(), + Pylance.pylanceRevertToJediPrompt, + Pylance.pylanceInstallPylance, + Pylance.pylanceRevertToJedi, + Pylance.remindMeLater, ), ).once(); verify(configService.updateSetting(anything(), anything(), anything(), anything())).never(); diff --git a/src/test/activation/outputChannel.unit.test.ts b/src/test/activation/outputChannel.unit.test.ts index 87dace221985..9d54ef4cea17 100644 --- a/src/test/activation/outputChannel.unit.test.ts +++ b/src/test/activation/outputChannel.unit.test.ts @@ -25,7 +25,7 @@ suite('Language Server Output Channel', () => { test('Create output channel if one does not exist before and return it', async () => { appShell - .setup((a) => a.createOutputChannel(OutputChannelNames.languageServer())) + .setup((a) => a.createOutputChannel(OutputChannelNames.languageServer)) .returns(() => output.object) .verifiable(TypeMoq.Times.once()); const { channel } = languageServerOutputChannel; diff --git a/src/test/activation/partialModeStatus.unit.test.ts b/src/test/activation/partialModeStatus.unit.test.ts index 28f134379c87..12e4b6fc0c5b 100644 --- a/src/test/activation/partialModeStatus.unit.test.ts +++ b/src/test/activation/partialModeStatus.unit.test.ts @@ -79,12 +79,12 @@ suite('Partial Mode Status', async () => { language: 'python', }); assert.deepEqual(languageItem, ({ - name: LanguageService.statusItem.name(), + name: LanguageService.statusItem.name, severity: vscodeMock.LanguageStatusSeverity.Warning, - text: LanguageService.statusItem.text(), - detail: LanguageService.statusItem.detail(), + text: LanguageService.statusItem.text, + detail: LanguageService.statusItem.detail, command: { - title: Common.learnMore(), + title: Common.learnMore, command: 'vscode.open', arguments: ['https://aka.ms/AAdzyh4'], }, @@ -105,12 +105,12 @@ suite('Partial Mode Status', async () => { language: 'python', }); assert.deepEqual(languageItem, ({ - name: LanguageService.statusItem.name(), + name: LanguageService.statusItem.name, severity: vscodeMock.LanguageStatusSeverity.Warning, - text: LanguageService.statusItem.text(), - detail: LanguageService.virtualWorkspaceStatusItem.detail(), + text: LanguageService.statusItem.text, + detail: LanguageService.virtualWorkspaceStatusItem.detail, command: { - title: Common.learnMore(), + title: Common.learnMore, command: 'vscode.open', arguments: ['https://aka.ms/AAdzyh4'], }, @@ -131,12 +131,12 @@ suite('Partial Mode Status', async () => { language: 'python', }); assert.deepEqual(languageItem, ({ - name: LanguageService.statusItem.name(), + name: LanguageService.statusItem.name, severity: vscodeMock.LanguageStatusSeverity.Warning, - text: LanguageService.statusItem.text(), - detail: LanguageService.statusItem.detail(), + text: LanguageService.statusItem.text, + detail: LanguageService.statusItem.detail, command: { - title: Common.learnMore(), + title: Common.learnMore, command: 'vscode.open', arguments: ['https://aka.ms/AAdzyh4'], }, diff --git a/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts b/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts index e70046e9f6b6..d4eefd69dd5f 100644 --- a/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts +++ b/src/test/application/diagnostics/checks/invalidLaunchJsonDebugger.unit.test.ts @@ -271,7 +271,7 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => { messageHandler.verifyAll(); baseWorkspaceService.verifyAll(); expect(options!.commandPrompts).to.be.lengthOf(2); - expect(options!.commandPrompts[0].prompt).to.be.equal(Diagnostics.yesUpdateLaunch()); + expect(options!.commandPrompts[0].prompt).to.be.equal(Diagnostics.yesUpdateLaunch); expect(options!.commandPrompts[0].command).not.to.be.equal(undefined, 'Command not set'); } }); diff --git a/src/test/application/diagnostics/checks/jediPython27NotSupported.unit.test.ts b/src/test/application/diagnostics/checks/jediPython27NotSupported.unit.test.ts index 21c60d7860fe..d4af2e5ca901 100644 --- a/src/test/application/diagnostics/checks/jediPython27NotSupported.unit.test.ts +++ b/src/test/application/diagnostics/checks/jediPython27NotSupported.unit.test.ts @@ -141,7 +141,7 @@ suite('Application Diagnostics - Jedi with Python 2.7 deprecated', () => { const diagnostic = result[0]; assert.strictEqual(result.length, 1); - assert.strictEqual(diagnostic.message, Python27Support.jediMessage()); + assert.strictEqual(diagnostic.message, Python27Support.jediMessage); }); test('Should return a diagnostics array with one diagnostic if the language server is Jedi', async () => { @@ -175,7 +175,7 @@ suite('Application Diagnostics - Jedi with Python 2.7 deprecated', () => { const diagnostic = result[0]; assert.strictEqual(result.length, 1); - assert.strictEqual(diagnostic.message, Python27Support.jediMessage()); + assert.strictEqual(diagnostic.message, Python27Support.jediMessage); }); test('Should return an empty diagnostics array if the language server is Pylance', async () => { diff --git a/src/test/application/diagnostics/checks/pylanceDefault.unit.test.ts b/src/test/application/diagnostics/checks/pylanceDefault.unit.test.ts index 9fe4863db483..85dc5a4fb8af 100644 --- a/src/test/application/diagnostics/checks/pylanceDefault.unit.test.ts +++ b/src/test/application/diagnostics/checks/pylanceDefault.unit.test.ts @@ -72,7 +72,7 @@ suite('Application Diagnostics - Pylance informational prompt', () => { const diagnostics = await diagnosticService.diagnose(undefined); assert.deepStrictEqual(diagnostics, [ - new PylanceDefaultDiagnostic(Diagnostics.pylanceDefaultMessage(), undefined), + new PylanceDefaultDiagnostic(Diagnostics.pylanceDefaultMessage, undefined), ]); }); @@ -111,7 +111,7 @@ suite('Application Diagnostics - Pylance informational prompt', () => { assert.notDeepStrictEqual(messagePrompt, undefined); assert.notDeepStrictEqual(messagePrompt!.onClose, undefined); - assert.deepStrictEqual(messagePrompt!.commandPrompts, [{ prompt: Common.ok() }]); + assert.deepStrictEqual(messagePrompt!.commandPrompts, [{ prompt: Common.ok }]); }); test('Should return empty diagnostics if the diagnostic code has been ignored', async () => { diff --git a/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts b/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts index 82495623af3b..9feab57af375 100644 --- a/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts +++ b/src/test/application/diagnostics/checks/pythonPathDeprecated.unit.test.ts @@ -177,7 +177,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { expect(messagePrompt).to.be.deep.equal({ commandPrompts: [ { - prompt: Common.ok(), + prompt: Common.ok, }, ], }); @@ -244,7 +244,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { const diagnostics = await diagnosticService.diagnose(resource); expect(diagnostics.length).to.equal(1); - expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings()); + expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings); expect(diagnostics[0].resource).to.equal(resource); workspaceService.verifyAll(); @@ -269,7 +269,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { const diagnostics = await diagnosticService.diagnose(resource); expect(diagnostics.length).to.equal(1); - expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings()); + expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings); expect(diagnostics[0].resource).to.equal(resource); workspaceService.verifyAll(); @@ -294,7 +294,7 @@ suite('Application Diagnostics - Python Path Deprecated', () => { const diagnostics = await diagnosticService.diagnose(resource); expect(diagnostics.length).to.equal(1); - expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings()); + expect(diagnostics[0].message).to.equal(Diagnostics.removedPythonPathFromSettings); expect(diagnostics[0].resource).to.equal(resource); workspaceService.verifyAll(); diff --git a/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts b/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts index 2f34e302156b..3ff429742eb8 100644 --- a/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts +++ b/src/test/application/diagnostics/sourceMapSupportService.unit.test.ts @@ -68,7 +68,7 @@ suite('Diagnostisc - Source Maps', () => { configService.updateSetting('diagnostics.sourceMapsEnabled', true, undefined, ConfigurationTarget.Global), ).thenResolve(); when(shell.showWarningMessage(anything(), anything())).thenResolve( - Diagnostics.enableSourceMapsAndReloadVSC() as any, + Diagnostics.enableSourceMapsAndReloadVSC as any, ); when(commandManager.executeCommand('workbench.action.reloadWindow')).thenResolve(); diff --git a/src/test/common/application/commands/reloadCommand.unit.test.ts b/src/test/common/application/commands/reloadCommand.unit.test.ts index 6b2e598b569a..dfcc6a4ad434 100644 --- a/src/test/common/application/commands/reloadCommand.unit.test.ts +++ b/src/test/common/application/commands/reloadCommand.unit.test.ts @@ -33,29 +33,29 @@ suite('Common Commands ReloadCommand', () => { await commandHandler.call(reloadCommandHandler, message); - verify(appShell.showInformationMessage(message, Common.reload())).once(); + verify(appShell.showInformationMessage(message, Common.reload)).once(); }); test('Do not reload VS Code if user selects `Reload` option', async () => { const message = 'Hello World!'; const commandHandler = capture(cmdManager.registerCommand as any).first()[1] as Function; - when(appShell.showInformationMessage(message, Common.reload())).thenResolve(Common.reload() as any); + when(appShell.showInformationMessage(message, Common.reload)).thenResolve(Common.reload as any); await commandHandler.call(reloadCommandHandler, message); - verify(appShell.showInformationMessage(message, Common.reload())).once(); + verify(appShell.showInformationMessage(message, Common.reload)).once(); verify(cmdManager.executeCommand('workbench.action.reloadWindow')).once(); }); test('Do not reload VS Code if user does not select `Reload` option', async () => { const message = 'Hello World!'; const commandHandler = capture(cmdManager.registerCommand as any).first()[1] as Function; - when(appShell.showInformationMessage(message, Common.reload())).thenResolve(); + when(appShell.showInformationMessage(message, Common.reload)).thenResolve(); await commandHandler.call(reloadCommandHandler, message); - verify(appShell.showInformationMessage(message, Common.reload())).once(); + verify(appShell.showInformationMessage(message, Common.reload)).once(); verify(cmdManager.executeCommand('workbench.action.reloadWindow')).never(); }); }); diff --git a/src/test/common/experiments/service.unit.test.ts b/src/test/common/experiments/service.unit.test.ts index 452b4d46d95b..d198b37980b2 100644 --- a/src/test/common/experiments/service.unit.test.ts +++ b/src/test/common/experiments/service.unit.test.ts @@ -16,7 +16,6 @@ import { Channel } from '../../../client/common/constants'; import { ExperimentService } from '../../../client/common/experiments/service'; import { PersistentState } from '../../../client/common/persistentState'; import { IPersistentStateFactory } from '../../../client/common/types'; -import { Experiments } from '../../../client/common/utils/localize'; import { registerLogger } from '../../../client/logging'; import { OutputChannelLogger } from '../../../client/logging/outputChannelLogger'; import * as Telemetry from '../../../client/telemetry'; @@ -158,7 +157,7 @@ suite('Experimentation service', () => { instance(stateFactory), ); await exp.activate(); - const output = `${Experiments.inGroup().format('pythonExperiment')}\n`; + const output = "Experiment 'pythonExperiment' is active\n"; assert.strictEqual(outputChannel.output, output); }); diff --git a/src/test/common/installer/channelManager.unit.test.ts b/src/test/common/installer/channelManager.unit.test.ts index ce593751c62c..319a9647fec7 100644 --- a/src/test/common/installer/channelManager.unit.test.ts +++ b/src/test/common/installer/channelManager.unit.test.ts @@ -207,7 +207,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { .returns(() => Promise.resolve(activeInterpreter as any)); appShell - .setup((a) => a.showErrorMessage(Installer.noCondaOrPipInstaller(), Installer.searchForHelp())) + .setup((a) => a.showErrorMessage(Installer.noCondaOrPipInstaller, Installer.searchForHelp)) .verifiable(TypeMoq.Times.once()); installChannelManager = new InstallationChannelManager(serviceContainer.object); await installChannelManager.showNoInstallersMessage(resource); @@ -232,7 +232,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { .returns(() => Promise.resolve(activeInterpreter as any)); appShell - .setup((a) => a.showErrorMessage(Installer.noPipInstaller(), Installer.searchForHelp())) + .setup((a) => a.showErrorMessage(Installer.noPipInstaller, Installer.searchForHelp)) .verifiable(TypeMoq.Times.once()); installChannelManager = new InstallationChannelManager(serviceContainer.object); await installChannelManager.showNoInstallersMessage(resource); @@ -289,8 +289,8 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { platformService.setup((p) => p.isWindows).returns(() => testParams.isWindows); platformService.setup((p) => p.isMac).returns(() => testParams.isMac); appShell - .setup((a) => a.showErrorMessage(TypeMoq.It.isAny(), Installer.searchForHelp())) - .returns(() => Promise.resolve(Installer.searchForHelp())) + .setup((a) => a.showErrorMessage(TypeMoq.It.isAny(), Installer.searchForHelp)) + .returns(() => Promise.resolve(Installer.searchForHelp)) .verifiable(TypeMoq.Times.once()); appShell .setup((a) => a.openUrl(expectedURL)) @@ -326,7 +326,7 @@ suite('InstallationChannelManager - showNoInstallersMessage()', () => { .returns(() => Promise.resolve(activeInterpreter as any)); platformService.setup((p) => p.isWindows).returns(() => true); appShell - .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), Installer.searchForHelp())) + .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), Installer.searchForHelp)) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); appShell diff --git a/src/test/common/installer/moduleInstaller.unit.test.ts b/src/test/common/installer/moduleInstaller.unit.test.ts index 65e92ed4ace1..af0562b5ba13 100644 --- a/src/test/common/installer/moduleInstaller.unit.test.ts +++ b/src/test/common/installer/moduleInstaller.unit.test.ts @@ -37,7 +37,6 @@ import { Product, } from '../../../client/common/types'; import { getNamesAndValues } from '../../../client/common/utils/enum'; -import { Products } from '../../../client/common/utils/localize'; import { noop } from '../../../client/common/utils/misc'; import { Architecture } from '../../../client/common/utils/platform'; import { IComponentAdapter, ICondaService, IInterpreterService } from '../../../client/interpreter/contracts'; @@ -540,7 +539,7 @@ suite('Module Installer', () => { const options = { location: ProgressLocation.Notification, cancellable: true, - title: Products.installingModule().format(product.name), + title: `Installing ${product.name}`, }; appShell .setup((a) => a.withProgress(TypeMoq.It.isAny(), TypeMoq.It.isAny())) diff --git a/src/test/common/installer/productInstaller.unit.test.ts b/src/test/common/installer/productInstaller.unit.test.ts index 60fa0e5fed5d..ed1be158c0aa 100644 --- a/src/test/common/installer/productInstaller.unit.test.ts +++ b/src/test/common/installer/productInstaller.unit.test.ts @@ -18,7 +18,7 @@ import { IProductService, } from '../../../client/common/installer/types'; import { InstallerResponse, IPersistentStateFactory, Product, ProductType } from '../../../client/common/types'; -import { Common, Products } from '../../../client/common/utils/localize'; +import { Common } from '../../../client/common/utils/localize'; import { Architecture } from '../../../client/common/utils/platform'; import { IServiceContainer } from '../../../client/ioc/types'; import { EnvironmentType, ModuleInstallerType, PythonEnvironment } from '../../../client/pythonEnvironments/info'; @@ -291,15 +291,15 @@ suite('Formatter installer', async () => { test('If black is not installed, offer autopep8 and yapf as options', async () => { const messageOptions = [ - Common.bannerLabelYes(), - Products.useFormatter().format(ProductNames.get(Product.autopep8)!), - Products.useFormatter().format(ProductNames.get(Product.yapf)!), - Common.doNotShowAgain(), + Common.bannerLabelYes, + `Use ${ProductNames.get(Product.autopep8)!}`, + `Use ${ProductNames.get(Product.yapf)!}`, + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); productPathService .setup((p) => p.isExecutableAModule(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -323,15 +323,16 @@ suite('Formatter installer', async () => { test('If autopep8 is not installed, offer black and yapf as options', async () => { const messageOptions = [ - Common.bannerLabelYes(), - Products.useFormatter().format(ProductNames.get(Product.black)!), - Products.useFormatter().format(ProductNames.get(Product.yapf)!), - Common.doNotShowAgain(), + Common.bannerLabelYes, + + 'Use {0}'.format(ProductNames.get(Product.black)!), + 'Use {0}'.format(ProductNames.get(Product.yapf)!), + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); productPathService .setup((p) => p.isExecutableAModule(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -355,15 +356,15 @@ suite('Formatter installer', async () => { test('If yapf is not installed, offer autopep8 and black as options', async () => { const messageOptions = [ - Common.bannerLabelYes(), - Products.useFormatter().format(ProductNames.get(Product.autopep8)!), - Products.useFormatter().format(ProductNames.get(Product.black)!), - Common.doNotShowAgain(), + Common.bannerLabelYes, + `Use ${ProductNames.get(Product.autopep8)!}`, + `Use ${ProductNames.get(Product.black)!}`, + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); productPathService .setup((p) => p.isExecutableAModule(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -387,14 +388,14 @@ suite('Formatter installer', async () => { test('If the formatter is not executable as a module, display an error message', async () => { const messageOptions = [ - Products.useFormatter().format(ProductNames.get(Product.autopep8)!), - Products.useFormatter().format(ProductNames.get(Product.yapf)!), - Common.doNotShowAgain(), + `Use ${ProductNames.get(Product.autopep8)!}`, + `Use ${ProductNames.get(Product.yapf)!}`, + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); productPathService .setup((p) => p.isExecutableAModule(TypeMoq.It.isAny(), TypeMoq.It.isAny())) @@ -420,15 +421,15 @@ suite('Formatter installer', async () => { test('If "Do not show again" has been selected earlier, do not display the prompt', async () => { const messageOptions = [ - Common.bannerLabelYes(), - Products.useFormatter().format(ProductNames.get(Product.autopep8)!), - Products.useFormatter().format(ProductNames.get(Product.yapf)!), - Common.doNotShowAgain(), + Common.bannerLabelYes, + `Use ${ProductNames.get(Product.autopep8)!}`, + `Use ${ProductNames.get(Product.yapf)!}`, + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.never()); persistentStateFactory .setup((p) => p.createGlobalPersistentState(TypeMoq.It.isAnyString(), false)) @@ -448,15 +449,15 @@ suite('Formatter installer', async () => { test('If "Do not show again" is selected, do not install the formatter and do not show the prompt again', async () => { let value = false; const messageOptions = [ - Common.bannerLabelYes(), - Products.useFormatter().format(ProductNames.get(Product.autopep8)!), - Products.useFormatter().format(ProductNames.get(Product.yapf)!), - Common.doNotShowAgain(), + Common.bannerLabelYes, + `Use ${ProductNames.get(Product.autopep8)!}`, + `Use ${ProductNames.get(Product.yapf)!}`, + Common.doNotShowAgain, ]; appShell .setup((a) => a.showErrorMessage(TypeMoq.It.isAnyString(), ...messageOptions)) - .returns(() => Promise.resolve(Common.doNotShowAgain())) + .returns(() => Promise.resolve(Common.doNotShowAgain)) .verifiable(TypeMoq.Times.once()); productPathService .setup((p) => p.isExecutableAModule(TypeMoq.It.isAny(), TypeMoq.It.isAny())) diff --git a/src/test/common/net/fileDownloader.unit.test.ts b/src/test/common/net/fileDownloader.unit.test.ts index c9f4e916460d..515ed488dc2e 100644 --- a/src/test/common/net/fileDownloader.unit.test.ts +++ b/src/test/common/net/fileDownloader.unit.test.ts @@ -21,7 +21,6 @@ import { FileSystem } from '../../../client/common/platform/fileSystem'; import { PlatformService } from '../../../client/common/platform/platformService'; import { IFileSystem } from '../../../client/common/platform/types'; import { IHttpClient } from '../../../client/common/types'; -import { Http } from '../../../client/common/utils/localize'; import { EXTENSION_ROOT_DIR } from '../../../client/constants'; import * as logging from '../../../client/logging'; import { noop } from '../../core'; @@ -212,12 +211,7 @@ suite('File Downloader', () => { expect(progressReportStub.args[4][0].message).to.equal(getProgressMessage(50, 100)); function getProgressMessage(downloadedKb: number, percentage: number) { - return Http.downloadingFileProgress().format( - 'Downloading-something', - downloadedKb.toFixed(), - totalKb.toFixed(), - percentage.toString(), - ); + return `Downloading-something${downloadedKb.toFixed()} of ${totalKb.toFixed()} KB (${percentage.toString()}%)`; } }); }); @@ -255,7 +249,7 @@ suite('File Downloader', () => { extension: '.pdf', }); - traceLogStub.calledWithExactly(Http.downloadingFile().format('file to download')); + traceLogStub.calledWithExactly('Downloading file to download...'); }); test('Display progress when downloading', async () => { const tmpFile = { filePath: 'my temp file', dispose: noop }; diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index 48d8bca82220..c65c179966b3 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -41,7 +41,7 @@ suite('ProcessLogger suite', () => { logger.logProcess('test', ['--foo', '--bar'], options); sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar`); - sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory()} ${options.cwd}`); + sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory} ${options.cwd}`); }); test('Logger adds quotes around arguments if they contain spaces', async () => { @@ -51,7 +51,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar "import test"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} ${path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} ${path.join('debug', 'path')}`, ); }); @@ -62,7 +62,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar "import test"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} ${path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} ${path.join('debug', 'path')}`, ); }); @@ -73,7 +73,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar "import test"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} ${path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} ${path.join('debug', 'path')}`, ); }); @@ -84,7 +84,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar importtest`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} ${path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} ${path.join('debug', 'path')}`, ); }); @@ -95,7 +95,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> test --foo --bar`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} ${path.join('~', 'debug', 'path')}`, + `${Logging.currentWorkingDirectory} ${path.join('~', 'debug', 'path')}`, ); }); @@ -104,7 +104,7 @@ suite('ProcessLogger suite', () => { logger.logProcess(path.join(untildify('~'), 'test'), ['--foo', '--bar'], options); sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('~', 'test')} --foo --bar`); - sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory()} ${options.cwd}`); + sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory} ${options.cwd}`); }); test('Logger replaces the path/to/home with ~ if shell command is provided', async () => { @@ -112,7 +112,7 @@ suite('ProcessLogger suite', () => { logger.logProcess(`"${path.join(untildify('~'), 'test')}" "--foo" "--bar"`, undefined, options); sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('~', 'test')}" "--foo" "--bar"`); - sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory()} ${options.cwd}`); + sinon.assert.calledWithExactly(traceLogStub, `${Logging.currentWorkingDirectory} ${options.cwd}`); }); test('Logger replaces the path to workspace with . if exactly one workspace folder is opened', async () => { @@ -122,7 +122,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} .${path.sep + path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} .${path.sep + path.join('debug', 'path')}`, ); }); @@ -137,7 +137,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} .${path.sep + path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} .${path.sep + path.join('debug', 'path')}`, ); traceLogStub.resetHistory(); @@ -147,7 +147,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly( traceLogStub, - `${Logging.currentWorkingDirectory()} .${path.sep + path.join('debug', 'path')}`, + `${Logging.currentWorkingDirectory} .${path.sep + path.join('debug', 'path')}`, ); }); diff --git a/src/test/common/utils/localize.functional.test.ts b/src/test/common/utils/localize.functional.test.ts deleted file mode 100644 index 2388234c3424..000000000000 --- a/src/test/common/utils/localize.functional.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import * as assert from 'assert'; -import * as fs from 'fs'; -import * as path from 'path'; -import { EXTENSION_ROOT_DIR } from '../../../client/common/constants'; -import * as localize from '../../../client/common/utils/localize'; -import * as localizeHelpers from '../../../client/common/utils/localizeHelpers'; - -const defaultNLSFile = path.join(EXTENSION_ROOT_DIR, 'package.nls.json'); - -// Defines a Mocha test suite to group tests of similar kind together -suite('Localization', () => { - // Note: We use package.nls.json by default for tests. Use the - // setLocale() helper to switch to a different locale. - - let localeFiles: string[]; - let nls_orig: string | undefined; - - setup(() => { - localeFiles = []; - - nls_orig = process.env.VSCODE_NLS_CONFIG; - setLocale('en-us'); - - // Ensure each test starts fresh. - localizeHelpers._resetCollections(); - }); - - teardown(() => { - if (nls_orig) { - process.env.VSCODE_NLS_CONFIG = nls_orig; - } else { - delete process.env.VSCODE_NLS_CONFIG; - } - - const filenames = localeFiles; - localeFiles = []; - for (const filename of filenames) { - fs.unlinkSync(filename); - } - }); - - function addLocale(locale: string, nls: Record) { - const filename = addLocaleFile(locale, nls); - localeFiles.push(filename); - } - - test('keys', (done) => { - const val = localize.ExtensionSurveyBanner.bannerMessage(); - assert.strictEqual( - val, - 'Can you please take 2 minutes to tell us how the Python extension is working for you?', - 'LanguageService string doesnt match', - ); - done(); - }); - - test('keys italian', (done) => { - // Force a config change - setLocale('it'); - - const val = localize.ExtensionSurveyBanner.bannerLabelYes(); - assert.strictEqual(val, 'Sì, prenderò il sondaggio ora', 'bannerLabelYes is not being translated'); - done(); - }); - - test('key found for locale', (done) => { - addLocale('spam', { - 'debug.selectConfigurationTitle': '???', - 'Common.gotIt': '!!!', - }); - setLocale('spam'); - - const title = localize.DebugConfigStrings.selectConfiguration.title(); - const gotIt = localize.Common.gotIt(); - - assert.strictEqual(title, '???', 'not used'); - assert.strictEqual(gotIt, '!!!', 'not used'); - done(); - }); - - test('key not found for locale (default used)', (done) => { - addLocale('spam', { - 'debug.selectConfigurationTitle': '???', - }); - setLocale('spam'); - - const gotIt = localize.Common.gotIt(); - - assert.strictEqual(gotIt, 'Got it!', `default not used (got ${gotIt})`); - done(); - }); - - test('keys exist', (done) => { - // Read in the JSON object for the package.nls.json - const nlsCollection = getDefaultCollection(); - - // Now match all of our namespace entries to our nls entries - useEveryLocalization(localize); - - // Now verify all of the asked for keys exist - const askedFor = localizeHelpers._getAskedForCollection(); - const missing: Record = {}; - Object.keys(askedFor).forEach((key: string) => { - // Now check that this key exists somewhere in the nls collection - if (!nlsCollection[key]) { - missing[key] = askedFor[key]; - } - }); - - // If any missing keys, output an error - const missingKeys = Object.keys(missing); - if (missingKeys && missingKeys.length > 0) { - let message = 'Missing keys. Add the following to package.nls.json:\n'; - missingKeys.forEach((k: string) => { - message = message.concat(`\t"${k}" : "${missing[k]}",\n`); - }); - assert.fail(message); - } - - done(); - }); - - test('all keys used', function (done) { - // TODO: Unused keys need to be cleaned up. - - this.skip(); - //test('all keys used', done => { - const nlsCollection = getDefaultCollection(); - useEveryLocalization(localize); - - // Now verify all of the asked for keys exist - const askedFor = localizeHelpers._getAskedForCollection(); - const extra: Record = {}; - Object.keys(nlsCollection).forEach((key: string) => { - // Now check that this key exists somewhere in the nls collection - if (askedFor[key]) { - return; - } - extra[key] = nlsCollection[key]; - }); - - // If any missing keys, output an error - const extraKeys = Object.keys(extra); - if (extraKeys && extraKeys.length > 0) { - let message = 'Unused keys. Remove the following from package.nls.json:\n'; - extraKeys.forEach((k: string) => { - message = message.concat(`\t"${k}" : "${extra[k]}",\n`); - }); - assert.fail(message); - } - - done(); - }); -}); - -function addLocaleFile(locale: string, nls: Record) { - const filename = path.join(EXTENSION_ROOT_DIR, `package.nls.${locale}.json`); - if (fs.existsSync(filename)) { - throw Error(`NLS file ${filename} already exists`); - } - const contents = JSON.stringify(nls); - fs.writeFileSync(filename, contents); - return filename; -} - -function setLocale(locale: string) { - let nls: Record; - if (process.env.VSCODE_NLS_CONFIG) { - nls = JSON.parse(process.env.VSCODE_NLS_CONFIG); - nls.locale = locale; - } else { - nls = { locale: locale }; - } - process.env.VSCODE_NLS_CONFIG = JSON.stringify(nls); -} - -function getDefaultCollection() { - if (!fs.existsSync(defaultNLSFile)) { - throw Error('package.nls.json is missing'); - } - const contents = fs.readFileSync(defaultNLSFile, 'utf8'); - return JSON.parse(contents); -} - -function useEveryLocalization(topns: any) { - // Read all of the namespaces from the localize import. - const entries = Object.keys(topns); - - // Now match all of our namespace entries to our nls entries. - entries.forEach((e: string) => { - // @ts-ignore - if (typeof topns[e] === 'function') { - return; - } - // It must be a namespace. - useEveryLocalizationInNS(topns[e]); - }); -} - -function useEveryLocalizationInNS(ns: any) { - // The namespace should have functions inside of it. - // @ts-ignore - const props = Object.keys(ns); - - // Run every function and cover every sub-namespace. - // This should fill up our "asked-for keys" collection. - props.forEach((key: string) => { - if (typeof ns[key] === 'function') { - const func = ns[key]; - func(); - } else { - useEveryLocalizationInNS(ns[key]); - } - }); -} diff --git a/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts b/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts index c555734e5165..e1c3a960b99f 100644 --- a/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts +++ b/src/test/configuration/interpreterSelector/commands/resetInterpreter.unit.test.ts @@ -91,7 +91,7 @@ suite('Reset Interpreter Command', () => { test('Update selected workspace folder settings when there is more than one workspace folder', async () => { workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); const expectedItems = [ - { label: Common.clearAll() }, + { label: Common.clearAll }, { label: 'one', description: path.dirname(folder1.uri.fsPath), @@ -105,7 +105,7 @@ suite('Reset Interpreter Command', () => { detail: 'pythonPath', }, { - label: Interpreters.clearAtWorkspace(), + label: Interpreters.clearAtWorkspace, uri: folder1.uri, }, ]; @@ -141,7 +141,7 @@ suite('Reset Interpreter Command', () => { test('Update entire workspace settings when there is more than one workspace folder and `Select at workspace level` is selected', async () => { workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); const expectedItems = [ - { label: Common.clearAll() }, + { label: Common.clearAll }, { label: 'one', description: path.dirname(folder1.uri.fsPath), @@ -155,7 +155,7 @@ suite('Reset Interpreter Command', () => { detail: 'pythonPath', }, { - label: Interpreters.clearAtWorkspace(), + label: Interpreters.clearAtWorkspace, uri: folder1.uri, }, ]; @@ -163,7 +163,7 @@ suite('Reset Interpreter Command', () => { .setup((s) => s.showQuickPick(TypeMoq.It.isValue(expectedItems), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ - label: Interpreters.clearAtWorkspace(), + label: Interpreters.clearAtWorkspace, uri: folder1.uri, }), ) @@ -189,7 +189,7 @@ suite('Reset Interpreter Command', () => { test('Update all folders and workspace scope if `Clear all` is selected', async () => { workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); const expectedItems = [ - { label: Common.clearAll() }, + { label: Common.clearAll }, { label: 'one', description: path.dirname(folder1.uri.fsPath), @@ -203,7 +203,7 @@ suite('Reset Interpreter Command', () => { detail: 'pythonPath', }, { - label: Interpreters.clearAtWorkspace(), + label: Interpreters.clearAtWorkspace, uri: folder1.uri, }, ]; @@ -211,7 +211,7 @@ suite('Reset Interpreter Command', () => { .setup((s) => s.showQuickPick(TypeMoq.It.isValue(expectedItems), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ - label: Common.clearAll(), + label: Common.clearAll, uri: folder1.uri, }), ) @@ -260,7 +260,7 @@ suite('Reset Interpreter Command', () => { workspace.setup((w) => w.workspaceFolders).returns(() => [folder1, folder2]); const expectedItems = [ - { label: Common.clearAll() }, + { label: Common.clearAll }, { label: 'one', description: path.dirname(folder1.uri.fsPath), @@ -274,7 +274,7 @@ suite('Reset Interpreter Command', () => { detail: 'pythonPath', }, { - label: Interpreters.clearAtWorkspace(), + label: Interpreters.clearAtWorkspace, uri: folder1.uri, }, ]; diff --git a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts index da3b862cbf92..94540ab6ae70 100644 --- a/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts +++ b/src/test/configuration/interpreterSelector/commands/setInterpreter.unit.test.ts @@ -122,7 +122,7 @@ suite('Set Interpreter Command', () => { }; const defaultInterpreterPath = 'defaultInterpreterPath'; const defaultInterpreterPathSuggestion = { - label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label()}`, + label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label}`, description: defaultInterpreterPath, path: defaultInterpreterPath, alwaysShow: true, @@ -141,7 +141,7 @@ suite('Set Interpreter Command', () => { } as PythonEnvironment, }; const expectedEnterInterpreterPathSuggestion = { - label: `${Octicons.Add} ${InterpreterQuickPickList.enterPath.label()}`, + label: `${Octicons.Add} ${InterpreterQuickPickList.enterPath.label}`, alwaysShow: true, }; const currentPythonPath = 'python'; @@ -228,12 +228,12 @@ suite('Set Interpreter Command', () => { recommended, ]; const expectedParameters: IQuickPickParameters = { - placeholder: InterpreterQuickPickList.quickPickListPlaceholder().format(currentPythonPath), + placeholder: `Selected Interpreter: ${currentPythonPath}`, items: suggestions, activeItem: recommended, matchOnDetail: true, matchOnDescription: true, - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, sortByLabel: true, keepScrollPosition: true, }; @@ -343,12 +343,12 @@ suite('Set Interpreter Command', () => { interpreterItems[5], ]; const expectedParameters: IQuickPickParameters = { - placeholder: InterpreterQuickPickList.quickPickListPlaceholder().format(currentPythonPath), + placeholder: `Selected Interpreter: ${currentPythonPath}`, items: suggestions, activeItem: recommended, matchOnDetail: true, matchOnDescription: true, - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, sortByLabel: true, keepScrollPosition: true, }; @@ -418,7 +418,7 @@ suite('Set Interpreter Command', () => { const separator = { label: EnvGroups.Recommended, kind: QuickPickItemKind.Separator }; const defaultPathSuggestion = { - label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label()}`, + label: `${Octicons.Gear} ${InterpreterQuickPickList.defaultInterpreterPath.label}`, description: expandedDetail, path: expandedPath, alwaysShow: true, @@ -426,12 +426,12 @@ suite('Set Interpreter Command', () => { const suggestions = [expectedEnterInterpreterPathSuggestion, defaultPathSuggestion, separator, recommended]; const expectedParameters: IQuickPickParameters = { - placeholder: InterpreterQuickPickList.quickPickListPlaceholder().format(currentPythonPath), + placeholder: `Selected Interpreter: ${currentPythonPath}`, items: suggestions, activeItem: recommended, matchOnDetail: true, matchOnDescription: true, - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, sortByLabel: true, keepScrollPosition: true, }; @@ -549,7 +549,7 @@ suite('Set Interpreter Command', () => { const recommended = cloneDeep(refreshedItem); recommended.label = `${Octicons.Star} ${refreshedItem.label}`; - recommended.description = `${interpreterPath} - ${Common.recommended()}`; + recommended.description = `${interpreterPath} - ${Common.recommended}`; assert.deepStrictEqual( quickPick, { @@ -676,12 +676,12 @@ suite('Set Interpreter Command', () => { suite('Test method _enterOrBrowseInterpreterPath()', async () => { const items: QuickPickItem[] = [ { - label: InterpreterQuickPickList.browsePath.label(), - detail: InterpreterQuickPickList.browsePath.detail(), + label: InterpreterQuickPickList.browsePath.label, + detail: InterpreterQuickPickList.browsePath.detail, }, ]; const expectedParameters = { - placeholder: InterpreterQuickPickList.enterPath.placeholder(), + placeholder: InterpreterQuickPickList.enterPath.placeholder, items, acceptFilterBoxTextAsSelection: true, }; @@ -732,9 +732,9 @@ suite('Set Interpreter Command', () => { filtersObject[filtersKey] = ['exe']; const expectedParams = { filters: filtersObject, - openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), + openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title(), + title: InterpreterQuickPickList.browsePath.title, }; const multiStepInput = TypeMoq.Mock.ofType>(); multiStepInput.setup((i) => i.showQuickPick(TypeMoq.It.isAny())).returns(() => Promise.resolve(items[0])); @@ -753,9 +753,9 @@ suite('Set Interpreter Command', () => { const multiStepInput = TypeMoq.Mock.ofType>(); const expectedParams = { filters: undefined, - openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), + openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title(), + title: InterpreterQuickPickList.browsePath.title, }; multiStepInput.setup((i) => i.showQuickPick(TypeMoq.It.isAny())).returns(() => Promise.resolve(items[0])); appShell.setup((a) => a.showOpenDialog(expectedParams)).verifiable(TypeMoq.Times.once()); @@ -806,9 +806,9 @@ suite('Set Interpreter Command', () => { const multiStepInput = TypeMoq.Mock.ofType>(); const expectedParams = { filters: undefined, - openLabel: InterpreterQuickPickList.browsePath.openButtonLabel(), + openLabel: InterpreterQuickPickList.browsePath.openButtonLabel, canSelectMany: false, - title: InterpreterQuickPickList.browsePath.title(), + title: InterpreterQuickPickList.browsePath.title, }; multiStepInput .setup((i) => i.showQuickPick(TypeMoq.It.isAny())) @@ -1004,7 +1004,7 @@ suite('Set Interpreter Command', () => { detail: 'python', }, { - label: Interpreters.entireWorkspace(), + label: Interpreters.entireWorkspace, uri: folder1.uri, }, ]; @@ -1073,7 +1073,7 @@ suite('Set Interpreter Command', () => { detail: 'python', }, { - label: Interpreters.entireWorkspace(), + label: Interpreters.entireWorkspace, uri: folder1.uri, }, ]; @@ -1090,7 +1090,7 @@ suite('Set Interpreter Command', () => { .setup((s) => s.showQuickPick(TypeMoq.It.isValue(expectedItems), TypeMoq.It.isAny())) .returns(() => Promise.resolve({ - label: Interpreters.entireWorkspace(), + label: Interpreters.entireWorkspace, uri: folder1.uri, }), ) @@ -1134,7 +1134,7 @@ suite('Set Interpreter Command', () => { detail: 'python', }, { - label: Interpreters.entireWorkspace(), + label: Interpreters.entireWorkspace, uri: folder1.uri, }, ]; diff --git a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts index 42f37b5ad5c9..e17b80ab34f7 100644 --- a/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts +++ b/src/test/debugger/extension/adapter/outdatedDebuggerPrompt.unit.test.ts @@ -91,7 +91,7 @@ suite('Debugging - Outdated Debugger Prompt tests.', () => { }); test('Show prompt when attaching to ptvsd, more info is clicked', async () => { - when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(Common.moreInfo())); + when(appShell.showInformationMessage(anything(), anything())).thenReturn(Promise.resolve(Common.moreInfo)); const deferred = createDeferred(); when(browserService.launch(anything())).thenCall(() => deferred.resolve()); diff --git a/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts b/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts index 1c99b70f5b17..c331efbd28b2 100644 --- a/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts +++ b/src/test/debugger/extension/configuration/launch.json/completionProvider.unit.test.ts @@ -122,14 +122,14 @@ suite('Debugging - launch.json Completion Provider', () => { const expectedCompletionItem: CompletionItem = { command: { command: 'python.SelectAndInsertDebugConfiguration', - title: DebugConfigStrings.launchJsonCompletions.description(), + title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document.object, position, token], }, - documentation: DebugConfigStrings.launchJsonCompletions.description(), + documentation: DebugConfigStrings.launchJsonCompletions.description, sortText: 'AAAA', preselect: true, kind: CompletionItemKind.Enum, - label: DebugConfigStrings.launchJsonCompletions.label(), + label: DebugConfigStrings.launchJsonCompletions.label, insertText: new SnippetString(), }; diff --git a/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts index 912200638161..6423e19ad76b 100644 --- a/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/djangoLaunch.unit.test.ts @@ -131,7 +131,7 @@ suite('Debugging - Configuration Provider Django', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.django.snippet.name(), + name: DebugConfigStrings.django.snippet.name, type: DebuggerTypeName, request: 'launch', program: 'xyz.py', @@ -152,7 +152,7 @@ suite('Debugging - Configuration Provider Django', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.django.snippet.name(), + name: DebugConfigStrings.django.snippet.name, type: DebuggerTypeName, request: 'launch', program: 'hello', @@ -176,7 +176,7 @@ suite('Debugging - Configuration Provider Django', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.django.snippet.name(), + name: DebugConfigStrings.django.snippet.name, type: DebuggerTypeName, request: 'launch', program: defaultProgram, diff --git a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts index 3b86b7edcb36..35ef98ce9cf8 100644 --- a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts @@ -56,7 +56,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.fastapi.snippet.name(), + name: DebugConfigStrings.fastapi.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'uvicorn', @@ -77,7 +77,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.fastapi.snippet.name(), + name: DebugConfigStrings.fastapi.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'uvicorn', diff --git a/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts index 85321f7df7d0..c074ad33a01c 100644 --- a/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/fileLaunch.unit.test.ts @@ -22,7 +22,7 @@ suite('Debugging - Configuration Provider File', () => { await provider.buildConfiguration(undefined as any, state); const config = { - name: DebugConfigStrings.file.snippet.name(), + name: DebugConfigStrings.file.snippet.name, type: DebuggerTypeName, request: 'launch', program: '${file}', diff --git a/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts index 57da4c9b10a1..da8213bd1bd4 100644 --- a/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/flaskLaunch.unit.test.ts @@ -56,7 +56,7 @@ suite('Debugging - Configuration Provider Flask', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.flask.snippet.name(), + name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'flask', @@ -81,7 +81,7 @@ suite('Debugging - Configuration Provider Flask', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.flask.snippet.name(), + name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'flask', @@ -106,7 +106,7 @@ suite('Debugging - Configuration Provider Flask', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.flask.snippet.name(), + name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'flask', diff --git a/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts index a8d08c0449c9..c0571a1bf30f 100644 --- a/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/moduleLaunch.unit.test.ts @@ -28,10 +28,10 @@ suite('Debugging - Configuration Provider Module', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.module.snippet.name(), + name: DebugConfigStrings.module.snippet.name, type: DebuggerTypeName, request: 'launch', - module: DebugConfigStrings.module.snippet.default(), + module: DebugConfigStrings.module.snippet.default, justMyCode: true, }; @@ -47,7 +47,7 @@ suite('Debugging - Configuration Provider Module', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.module.snippet.name(), + name: DebugConfigStrings.module.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'hello', diff --git a/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts b/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts index 16b1c428a756..696179ea9a12 100644 --- a/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/pidAttach.unit.test.ts @@ -22,7 +22,7 @@ suite('Debugging - Configuration Provider File', () => { await provider.buildConfiguration(undefined as any, state); const config = { - name: DebugConfigStrings.attachPid.snippet.name(), + name: DebugConfigStrings.attachPid.snippet.name, type: DebuggerTypeName, request: 'attach', processId: '${command:pickProcess}', diff --git a/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts index 067bcc084310..04a74dfd819b 100644 --- a/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/pyramidLaunch.unit.test.ts @@ -131,7 +131,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.pyramid.snippet.name(), + name: DebugConfigStrings.pyramid.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'pyramid.scripts.pserve', @@ -153,7 +153,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.pyramid.snippet.name(), + name: DebugConfigStrings.pyramid.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'pyramid.scripts.pserve', @@ -178,7 +178,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { await provider.buildConfiguration(instance(input), state); const config = { - name: DebugConfigStrings.pyramid.snippet.name(), + name: DebugConfigStrings.pyramid.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'pyramid.scripts.pserve', diff --git a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts index c430363301da..7bf88543bdad 100644 --- a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts @@ -79,7 +79,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => { } const config = { - name: DebugConfigStrings.attach.snippet.name(), + name: DebugConfigStrings.attach.snippet.name, type: DebuggerTypeName, request: 'attach', connect: { @@ -115,7 +115,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => { } const config = { - name: DebugConfigStrings.attach.snippet.name(), + name: DebugConfigStrings.attach.snippet.name, type: DebuggerTypeName, request: 'attach', connect: { diff --git a/src/test/interpreters/display.unit.test.ts b/src/test/interpreters/display.unit.test.ts index 74cb5ec101ea..2d7254afdb6f 100644 --- a/src/test/interpreters/display.unit.test.ts +++ b/src/test/interpreters/display.unit.test.ts @@ -19,7 +19,7 @@ import { IApplicationShell, IWorkspaceService } from '../../client/common/applic import { Commands, PYTHON_LANGUAGE } from '../../client/common/constants'; import { IFileSystem } from '../../client/common/platform/types'; import { IDisposableRegistry, IPathUtils, ReadWrite } from '../../client/common/types'; -import { InterpreterQuickPickList, Interpreters } from '../../client/common/utils/localize'; +import { InterpreterQuickPickList } from '../../client/common/utils/localize'; import { Architecture } from '../../client/common/utils/platform'; import { IInterpreterDisplay, @@ -136,7 +136,7 @@ suite('Interpreters Display', () => { languageStatusItem.verify( (s) => (s.command = TypeMoq.It.isValue({ - title: InterpreterQuickPickList.browsePath.openButtonLabel(), + title: InterpreterQuickPickList.browsePath.openButtonLabel, command: Commands.Set_Interpreter, })), TypeMoq.Times.once(), @@ -211,7 +211,10 @@ suite('Interpreters Display', () => { .returns(() => Promise.resolve(activeInterpreter)); await interpreterDisplay.refresh(resource); - traceLogStub.calledOnceWithExactly(Interpreters.pythonInterpreterPath().format(activeInterpreter.path)); + traceLogStub.calledOnceWithExactly( + `Python interpreter path: ${activeInterpreter.path}`, + activeInterpreter.path, + ); }); test('If interpreter is not identified then tooltip should point to python Path', async () => { const resource = Uri.file('x'); @@ -275,7 +278,7 @@ suite('Interpreters Display', () => { statusBar.verify( (s) => (s.text = TypeMoq.It.isValue( - `$(alert) ${InterpreterQuickPickList.browsePath.openButtonLabel()}`, + `$(alert) ${InterpreterQuickPickList.browsePath.openButtonLabel}`, )), TypeMoq.Times.once(), ); diff --git a/src/test/interpreters/display/progressDisplay.unit.test.ts b/src/test/interpreters/display/progressDisplay.unit.test.ts index 66951df8c51e..433fbfe950c9 100644 --- a/src/test/interpreters/display/progressDisplay.unit.test.ts +++ b/src/test/interpreters/display/progressDisplay.unit.test.ts @@ -47,7 +47,7 @@ suite('Interpreters - Display Progress', () => { refreshingCallback(undefined); const options = capture(shell.withProgress as never).last()[0] as ProgressOptions; - expect(options.title).to.be.equal(`[${Interpreters.discovering()}](command:${Commands.Set_Interpreter})`); + expect(options.title).to.be.equal(`[${Interpreters.discovering}](command:${Commands.Set_Interpreter})`); }); test('Display refreshing message when refreshing interpreters for the second time', async () => { @@ -59,12 +59,12 @@ suite('Interpreters - Display Progress', () => { refreshingCallback(undefined); let options = capture(shell.withProgress as never).last()[0] as ProgressOptions; - expect(options.title).to.be.equal(`[${Interpreters.discovering()}](command:${Commands.Set_Interpreter})`); + expect(options.title).to.be.equal(`[${Interpreters.discovering}](command:${Commands.Set_Interpreter})`); refreshingCallback(undefined); options = capture(shell.withProgress as never).last()[0] as ProgressOptions; - expect(options.title).to.be.equal(`[${Interpreters.refreshing()}](command:${Commands.Set_Interpreter})`); + expect(options.title).to.be.equal(`[${Interpreters.refreshing}](command:${Commands.Set_Interpreter})`); }); test('Progress message is hidden when loading has completed', async () => { @@ -79,7 +79,7 @@ suite('Interpreters - Display Progress', () => { const callback = capture(shell.withProgress as never).last()[1] as ProgressTask; const promise = callback(undefined as never, undefined as never); - expect(options.title).to.be.equal(`[${Interpreters.discovering()}](command:${Commands.Set_Interpreter})`); + expect(options.title).to.be.equal(`[${Interpreters.discovering}](command:${Commands.Set_Interpreter})`); refreshDeferred.resolve(); // Promise must resolve when refreshed callback is invoked. diff --git a/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts b/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts index 5c1b803395e8..6ae070721475 100644 --- a/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts +++ b/src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts @@ -377,7 +377,7 @@ suite('Conda Inherit Env Prompt', async () => { }); suite('Method promptAndUpdate()', () => { - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.moreInfo()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.moreInfo]; setup(() => { workspaceService = TypeMoq.Mock.ofType(); appShell = TypeMoq.Mock.ofType(); @@ -409,7 +409,7 @@ suite('Conda Inherit Env Prompt', async () => { .returns(() => false) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts)) + .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts)) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.never()); await condaInheritEnvPrompt.promptAndUpdate(); @@ -424,7 +424,7 @@ suite('Conda Inherit Env Prompt', async () => { .returns(() => true) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts)) + .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts)) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); workspaceService @@ -457,8 +457,8 @@ suite('Conda Inherit Env Prompt', async () => { .returns(() => true) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts)) - .returns(() => Promise.resolve(Common.bannerLabelYes())) + .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts)) + .returns(() => Promise.resolve(Common.bannerLabelYes)) .verifiable(TypeMoq.Times.once()); workspaceService .setup((ws) => ws.getConfiguration('terminal')) @@ -490,8 +490,8 @@ suite('Conda Inherit Env Prompt', async () => { .returns(() => true) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts)) - .returns(() => Promise.resolve(Common.bannerLabelNo())) + .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts)) + .returns(() => Promise.resolve(Common.bannerLabelNo)) .verifiable(TypeMoq.Times.once()); workspaceService .setup((ws) => ws.getConfiguration('terminal')) @@ -523,8 +523,8 @@ suite('Conda Inherit Env Prompt', async () => { .returns(() => true) .verifiable(TypeMoq.Times.once()); appShell - .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage(), ...prompts)) - .returns(() => Promise.resolve(Common.moreInfo())) + .setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts)) + .returns(() => Promise.resolve(Common.moreInfo)) .verifiable(TypeMoq.Times.once()); workspaceService .setup((ws) => ws.getConfiguration('terminal')) diff --git a/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts b/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts index ef5965e3f98f..129776cc6a15 100644 --- a/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts +++ b/src/test/interpreters/virtualEnvs/virtualEnvPrompt.unit.test.ts @@ -63,7 +63,7 @@ suite('Virtual Environment Prompt', () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; const interpreter2 = { path: 'path/to/interpreter2' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(componentAdapter.getWorkspaceVirtualEnvInterpreters(resource)).thenResolve([ @@ -88,7 +88,7 @@ suite('Virtual Environment Prompt', () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; const interpreter2 = { path: 'path/to/interpreter2' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); // Return interpreters using the component adapter instead @@ -117,7 +117,7 @@ suite('Virtual Environment Prompt', () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; const interpreter2 = { path: 'path/to/interpreter2' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); // Return interpreters using the component adapter instead @@ -142,7 +142,7 @@ suite('Virtual Environment Prompt', () => { test("If user selects 'Yes', python path is updated", async () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( notificationPromptEnabled.object, @@ -177,7 +177,7 @@ suite('Virtual Environment Prompt', () => { test("If user selects 'No', no operation is performed", async () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( notificationPromptEnabled.object, @@ -217,7 +217,7 @@ suite('Virtual Environment Prompt', () => { test("If user selects 'Do not show again', prompt is disabled", async () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( notificationPromptEnabled.object, @@ -241,7 +241,7 @@ suite('Virtual Environment Prompt', () => { test('If prompt is disabled, no notification is shown', async () => { const resource = Uri.file('a'); const interpreter1 = { path: 'path/to/interpreter1' }; - const prompts = [Common.bannerLabelYes(), Common.bannerLabelNo(), Common.doNotShowAgain()]; + const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.doNotShowAgain]; const notificationPromptEnabled = TypeMoq.Mock.ofType>(); when(persistentStateFactory.createWorkspacePersistentState(anything(), true)).thenReturn( notificationPromptEnabled.object, diff --git a/src/test/languageServer/watcher.unit.test.ts b/src/test/languageServer/watcher.unit.test.ts index ca26633600a2..c9d0b930cefa 100644 --- a/src/test/languageServer/watcher.unit.test.ts +++ b/src/test/languageServer/watcher.unit.test.ts @@ -306,7 +306,7 @@ suite('Language server watcher', () => { await watcher.startLanguageServer(LanguageServerType.None); - assert.strictEqual(output, LanguageService.startingNone().format('workspace')); + assert.strictEqual(output, LanguageService.startingNone); }); test(`When starting the language server, if the language server can be started, this.languageServerType should reflect the new language server type`, async () => { diff --git a/src/test/providers/importSortProvider.unit.test.ts b/src/test/providers/importSortProvider.unit.test.ts index b6784cd1cb8c..3d9af8e02790 100644 --- a/src/test/providers/importSortProvider.unit.test.ts +++ b/src/test/providers/importSortProvider.unit.test.ts @@ -669,12 +669,12 @@ suite('Import Sort Provider', () => { shell .setup((s) => s.showWarningMessage( - Diagnostics.checkIsort5UpgradeGuide(), - Common.openOutputPanel(), - Common.doNotShowAgain(), + Diagnostics.checkIsort5UpgradeGuide, + Common.openOutputPanel, + Common.doNotShowAgain, ), ) - .returns(() => Promise.resolve(Common.openOutputPanel())); + .returns(() => Promise.resolve(Common.openOutputPanel)); commandManager.setup((c) => c.executeCommand(Commands.ViewOutput)).verifiable(TypeMoq.Times.once()); await sortProvider._showWarningAndOptionallyShowOutput(); }); @@ -695,12 +695,12 @@ suite('Import Sort Provider', () => { shell .setup((s) => s.showWarningMessage( - Diagnostics.checkIsort5UpgradeGuide(), - Common.openOutputPanel(), - Common.doNotShowAgain(), + Diagnostics.checkIsort5UpgradeGuide, + Common.openOutputPanel, + Common.doNotShowAgain, ), ) - .returns(() => Promise.resolve(Common.doNotShowAgain())) + .returns(() => Promise.resolve(Common.doNotShowAgain)) .verifiable(TypeMoq.Times.once()); await sortProvider._showWarningAndOptionallyShowOutput(); diff --git a/src/test/sourceMapSupport.test.ts b/src/test/sourceMapSupport.test.ts index 1c7de8bc4802..a591e1236619 100644 --- a/src/test/sourceMapSupport.test.ts +++ b/src/test/sourceMapSupport.test.ts @@ -44,7 +44,7 @@ suite('Source Map Support', () => { window: { showWarningMessage: () => { stubInfo.messageDisplayed = true; - return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps() : undefined); + return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps : undefined); }, }, ConfigurationTarget: ConfigurationTarget, diff --git a/src/test/sourceMapSupport.unit.test.ts b/src/test/sourceMapSupport.unit.test.ts index c5f35be23528..3ce5249eca01 100644 --- a/src/test/sourceMapSupport.unit.test.ts +++ b/src/test/sourceMapSupport.unit.test.ts @@ -46,7 +46,7 @@ suite('Source Map Support', () => { window: { showWarningMessage: () => { stubInfo.messageDisplayed = true; - return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps() : undefined); + return Promise.resolve(selectDisableButton ? Diagnostics.disableSourceMaps : undefined); }, }, ConfigurationTarget: ConfigurationTarget, diff --git a/src/test/tensorBoard/tensorBoardPrompt.unit.test.ts b/src/test/tensorBoard/tensorBoardPrompt.unit.test.ts index 0ed80553ab0e..6f096e560d70 100644 --- a/src/test/tensorBoard/tensorBoardPrompt.unit.test.ts +++ b/src/test/tensorBoard/tensorBoardPrompt.unit.test.ts @@ -46,7 +46,7 @@ suite('TensorBoard prompt', () => { }); test('Disable prompt if user selects "Do not show again"', async () => { - await setupPromptWithOptions(true, Common.doNotShowAgain()); + await setupPromptWithOptions(true, Common.doNotShowAgain); verify(persistentState.updateValue(false)).once(); }); diff --git a/src/test/tensorBoard/tensorBoardSession.test.ts b/src/test/tensorBoard/tensorBoardSession.test.ts index 447cf8d470e3..2faaf8e39611 100644 --- a/src/test/tensorBoard/tensorBoardSession.test.ts +++ b/src/test/tensorBoard/tensorBoardSession.test.ts @@ -110,7 +110,7 @@ suite('TensorBoard session creation', async () => { async function createSession() { errorMessageStub = sandbox.stub(applicationShell, 'showErrorMessage'); // Stub user selections - sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); const session = (await commandManager.executeCommand( 'python.launchTensorBoard', @@ -137,7 +137,7 @@ suite('TensorBoard session creation', async () => { }); test('When user selects file picker, display file picker', async () => { // Stub user selections - sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.selectAnotherFolder() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.selectAnotherFolder }); const filePickerStub = sandbox.stub(applicationShell, 'showOpenDialog'); // Create session @@ -150,7 +150,7 @@ suite('TensorBoard session creation', async () => { assert.ok(filePickerStub.called, 'User requests to select another folder and file picker was not shown'); }); test('When user selects remote URL, display input box', async () => { - sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.enterRemoteUrl() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.enterRemoteUrl }); const inputBoxStub = sandbox.stub(applicationShell, 'showInputBox'); // Create session @@ -168,23 +168,21 @@ suite('TensorBoard session creation', async () => { }); suite('Installation prompt message', async () => { async function createSessionAndVerifyMessage(message: string) { - sandbox - .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); await commandManager.executeCommand( 'python.launchTensorBoard', TensorBoardEntrypoint.palette, TensorBoardEntrypointTrigger.palette, ); assert.ok( - errorMessageStub.calledOnceWith(message, Common.bannerLabelYes(), Common.bannerLabelNo()), + errorMessageStub.calledOnceWith(message, Common.bannerLabelYes, Common.bannerLabelNo), 'Wrong error message shown', ); } suite('Install profiler package + upgrade tensorboard', async () => { async function runTest(expectTensorBoardUpgrade: boolean) { const installStub = sandbox.stub(installer, 'install').resolves(InstallerResponse.Installed); - await createSessionAndVerifyMessage(TensorBoard.installTensorBoardAndProfilerPluginPrompt()); + await createSessionAndVerifyMessage(TensorBoard.installTensorBoardAndProfilerPluginPrompt); assert.ok(installStub.calledTwice, `Expected 2 installs but got ${installStub.callCount} calls`); assert.ok(installStub.calledWith(Product.torchProfilerInstallName)); assert.ok( @@ -210,7 +208,7 @@ suite('TensorBoard session creation', async () => { configureStubs(true, ProductInstallStatus.Installed, ProductInstallStatus.NotInstalled, 'Yes'); sandbox .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + .resolves({ label: TensorBoard.useCurrentWorkingDirectory }); // Ensure we ask to install the profiler package and that it resolves to a cancellation sandbox .stub(installer, 'install') @@ -226,9 +224,9 @@ suite('TensorBoard session creation', async () => { assert.ok(session.panel?.visible, 'Webview panel not shown, expected successful session creation'); assert.ok( errorMessageStub.calledOnceWith( - TensorBoard.installProfilerPluginPrompt(), - Common.bannerLabelYes(), - Common.bannerLabelNo(), + TensorBoard.installProfilerPluginPrompt, + Common.bannerLabelYes, + Common.bannerLabelNo, ), 'Wrong error message shown', ); @@ -251,7 +249,7 @@ suite('TensorBoard session creation', async () => { torchProfilerInstallStatus, 'No', ); - await createSessionAndVerifyMessage(TensorBoard.installPrompt()); + await createSessionAndVerifyMessage(TensorBoard.installPrompt); }); } }); @@ -260,7 +258,7 @@ suite('TensorBoard session creation', async () => { suite('Upgrade tensorboard only', async () => { async function runTest() { const installStub = sandbox.stub(installer, 'install').resolves(InstallerResponse.Installed); - await createSessionAndVerifyMessage(TensorBoard.upgradePrompt()); + await createSessionAndVerifyMessage(TensorBoard.upgradePrompt); assert.ok(installStub.calledOnce, `Expected 1 install but got ${installStub.callCount} installs`); assert.ok(installStub.args[0][0] === Product.tensorboard, 'Did not install tensorboard'); @@ -297,7 +295,7 @@ suite('TensorBoard session creation', async () => { async function runTest() { sandbox .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + .resolves({ label: TensorBoard.useCurrentWorkingDirectory }); await commandManager.executeCommand( 'python.launchTensorBoard', TensorBoardEntrypoint.palette, @@ -331,9 +329,7 @@ suite('TensorBoard session creation', async () => { }); suite('Error messages', async () => { test('If user cancels starting TensorBoard session, do not show error', async () => { - sandbox - .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); sandbox.stub(applicationShell, 'withProgress').resolves('canceled'); errorMessageStub = sandbox.stub(applicationShell, 'showErrorMessage'); @@ -372,9 +368,9 @@ suite('TensorBoard session creation', async () => { assert.ok( errorMessageStub.calledOnceWith( - TensorBoard.installTensorBoardAndProfilerPluginPrompt(), - Common.bannerLabelYes(), - Common.bannerLabelNo(), + TensorBoard.installTensorBoardAndProfilerPluginPrompt, + Common.bannerLabelYes, + Common.bannerLabelNo, ), 'User opted not to install and error was shown', ); @@ -383,7 +379,7 @@ suite('TensorBoard session creation', async () => { sandbox.stub(experimentService, 'inExperiment').resolves(true); errorMessageStub = sandbox.stub(applicationShell, 'showErrorMessage'); // Stub user selections - sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.selectAFolder() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.selectAFolder }); sandbox.stub(applicationShell, 'showOpenDialog').resolves(undefined); // Create session @@ -396,9 +392,7 @@ suite('TensorBoard session creation', async () => { assert.ok(errorMessageStub.notCalled, 'User opted not to select a logdir and error was shown'); }); test('If starting TensorBoard times out, show error', async () => { - sandbox - .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); sandbox.stub(applicationShell, 'withProgress').resolves(60_000); errorMessageStub = sandbox.stub(applicationShell, 'showErrorMessage'); @@ -412,9 +406,7 @@ suite('TensorBoard session creation', async () => { }); test('If installing the profiler package fails, do not show error, continue to create session', async () => { configureStubs(true, ProductInstallStatus.Installed, ProductInstallStatus.NotInstalled, 'Yes'); - sandbox - .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); // Ensure we ask to install the profiler package and that it resolves to a cancellation sandbox .stub(installer, 'install') @@ -431,9 +423,7 @@ suite('TensorBoard session creation', async () => { }); test('If user opts not to install profiler package and tensorboard is already installed, continue to create session', async () => { configureStubs(true, ProductInstallStatus.Installed, ProductInstallStatus.NotInstalled, 'No'); - sandbox - .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + sandbox.stub(applicationShell, 'showQuickPick').resolves({ label: TensorBoard.useCurrentWorkingDirectory }); const session = (await commandManager.executeCommand( 'python.launchTensorBoard', TensorBoardEntrypoint.palette, @@ -445,7 +435,7 @@ suite('TensorBoard session creation', async () => { test('If python.tensorBoard.logDirectory is provided, do not prompt user to pick a log directory', async () => { const selectDirectoryStub = sandbox .stub(applicationShell, 'showQuickPick') - .resolves({ label: TensorBoard.useCurrentWorkingDirectory() }); + .resolves({ label: TensorBoard.useCurrentWorkingDirectory }); errorMessageStub = sandbox.stub(applicationShell, 'showErrorMessage'); await workspaceConfiguration.update('logDirectory', 'logs/fit', true); @@ -484,8 +474,8 @@ suite('TensorBoard session creation', async () => { const inputInstance = multiStepFactory.create(); // Create a multistep input with stubs for methods const showQuickPickStub = sandbox.stub(inputInstance, 'showQuickPick').resolves({ - label: TensorBoard.selectMissingSourceFile(), - description: TensorBoard.selectMissingSourceFileDescription(), + label: TensorBoard.selectMissingSourceFile, + description: TensorBoard.selectMissingSourceFileDescription, }); const createInputStub = sandbox .stub(multiStepFactory, 'create')