diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000000..91855cc846d --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "useTabs": true, + "printWidth": 120, + "semi": true, + "singleQuote": true +} diff --git a/.vscode/cglicenses.schema.json b/.vscode/cglicenses.schema.json index 238f4803f74..8c0ee740102 100644 --- a/.vscode/cglicenses.schema.json +++ b/.vscode/cglicenses.schema.json @@ -1,23 +1,61 @@ { "type": "array", "items": { - "type": "object", - "required": [ - "name", - "licenseDetail" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the dependency" + "oneOf": [ + { + "type": "object", + "required": [ + "name", + "prependLicenseText" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the dependency" + }, + "fullLicenseText": { + "type": "array", + "description": "The complete license text of the dependency", + "items": { + "type": "string" + } + }, + "prependLicenseText": { + "type": "array", + "description": "A piece of text to prepend to the auto-detected license text of the dependency", + "items": { + "type": "string" + } + } + } }, - "licenseDetail": { - "type": "array", - "description": "The complete license text of the dependency", - "items": { - "type": "string" + { + "type": "object", + "required": [ + "name", + "fullLicenseText" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the dependency" + }, + "fullLicenseText": { + "type": "array", + "description": "The complete license text of the dependency", + "items": { + "type": "string" + } + }, + "prependLicenseText": { + "type": "array", + "description": "A piece of text to prepend to the auto-detected license text of the dependency", + "items": { + "type": "string" + } + } } } - } + ] } -} \ No newline at end of file +} diff --git a/.yarnrc b/.yarnrc index 98712ee2b43..ff946c7a250 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,3 +1,3 @@ disturl "https://atom.io/download/electron" -target "4.2.9" +target "4.2.10" runtime "electron" diff --git a/README.md b/README.md index 035ba940a62..5743ba55e8d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## The Repository -This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Studio Code](https://code.visualstudio.com) product. Not only do we work on code and issues here, we also publish our roadmap, monthly iteration plans, and our endgame plans. The source code here is available to everyone under the standard [MIT license](https://github.com/microsoft/vscode/blob/master/LICENSE.txt). +This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Studio Code](https://code.visualstudio.com) product. Not only do we work on code and issues here, we also publish our [roadmap](https://github.com/microsoft/vscode/wiki/Roadmap), [monthly iteration plans](https://github.com/microsoft/vscode/wiki/Iteration-Plans), and our [endgame plans](https://github.com/microsoft/vscode/wiki/Running-the-Endgame). This source code is available to everyone under the standard [MIT license](https://github.com/microsoft/vscode/blob/master/LICENSE.txt). ## Visual Studio Code diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 64f72e53be0..aa56c32d53d 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -23,50 +23,51 @@ This project incorporates components from the projects listed below. The origina 16. freebroccolo/atom-language-swift (https://github.com/freebroccolo/atom-language-swift) 17. HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/) 18. Ikuyadeu/vscode-R version 0.5.5 (https://github.com/Ikuyadeu/vscode-R) -19. Ionic documentation version 1.2.4 (https://github.com/ionic-team/ionic-site) -20. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) -21. jeff-hykin/cpp-textmate-grammar version 1.12.11 (https://github.com/jeff-hykin/cpp-textmate-grammar) -22. jeff-hykin/cpp-textmate-grammar version 1.12.18 (https://github.com/jeff-hykin/cpp-textmate-grammar) -23. js-beautify version 1.6.8 (https://github.com/beautify-web/js-beautify) -24. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) -25. language-docker (https://github.com/moby/moby) -26. language-go version 0.44.3 (https://github.com/atom/language-go) -27. language-less version 0.34.2 (https://github.com/atom/language-less) -28. language-php version 0.44.1 (https://github.com/atom/language-php) -29. language-rust version 0.4.12 (https://github.com/zargony/atom-language-rust) -30. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) -31. marked version 0.6.2 (https://github.com/markedjs/marked) -32. mdn-data version 1.1.12 (https://github.com/mdn/data) -33. Microsoft/TypeScript-TmLanguage version 0.0.1 (https://github.com/Microsoft/TypeScript-TmLanguage) -34. Microsoft/vscode-JSON.tmLanguage (https://github.com/Microsoft/vscode-JSON.tmLanguage) -35. Microsoft/vscode-mssql version 1.6.0 (https://github.com/Microsoft/vscode-mssql) -36. mmims/language-batchfile version 0.7.5 (https://github.com/mmims/language-batchfile) -37. octicons version 8.3.0 (https://github.com/primer/octicons) -38. octref/language-css version 0.42.11 (https://github.com/octref/language-css) -39. PowerShell/EditorSyntax (https://github.com/powershell/editorsyntax) -40. promise-polyfill version 8.0.0 (https://github.com/taylorhakes/promise-polyfill) -41. seti-ui version 0.1.0 (https://github.com/jesseweed/seti-ui) -42. shaders-tmLanguage version 0.1.0 (https://github.com/tgjones/shaders-tmLanguage) -43. textmate/asp.vb.net.tmbundle (https://github.com/textmate/asp.vb.net.tmbundle) -44. textmate/c.tmbundle (https://github.com/textmate/c.tmbundle) -45. textmate/diff.tmbundle (https://github.com/textmate/diff.tmbundle) -46. textmate/git.tmbundle (https://github.com/textmate/git.tmbundle) -47. textmate/groovy.tmbundle (https://github.com/textmate/groovy.tmbundle) -48. textmate/html.tmbundle (https://github.com/textmate/html.tmbundle) -49. textmate/ini.tmbundle (https://github.com/textmate/ini.tmbundle) -50. textmate/javascript.tmbundle (https://github.com/textmate/javascript.tmbundle) -51. textmate/lua.tmbundle (https://github.com/textmate/lua.tmbundle) -52. textmate/markdown.tmbundle (https://github.com/textmate/markdown.tmbundle) -53. textmate/perl.tmbundle (https://github.com/textmate/perl.tmbundle) -54. textmate/ruby.tmbundle (https://github.com/textmate/ruby.tmbundle) -55. textmate/yaml.tmbundle (https://github.com/textmate/yaml.tmbundle) -56. TypeScript-TmLanguage version 0.1.8 (https://github.com/Microsoft/TypeScript-TmLanguage) -57. TypeScript-TmLanguage version 1.0.0 (https://github.com/Microsoft/TypeScript-TmLanguage) -58. Unicode version 12.0.0 (http://www.unicode.org/) -59. vscode-logfile-highlighter version 2.4.1 (https://github.com/emilast/vscode-logfile-highlighter) -60. vscode-octicons-font version 1.3.1 (https://github.com/Microsoft/vscode-octicons-font) -61. vscode-swift version 0.0.1 (https://github.com/owensd/vscode-swift) -62. Web Background Synchronization (https://github.com/WICG/BackgroundSync) +19. insane version 2.6.2 (https://github.com/bevacqua/insane) +20. Ionic documentation version 1.2.4 (https://github.com/ionic-team/ionic-site) +21. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) +22. jeff-hykin/cpp-textmate-grammar version 1.12.11 (https://github.com/jeff-hykin/cpp-textmate-grammar) +23. jeff-hykin/cpp-textmate-grammar version 1.13.2 (https://github.com/jeff-hykin/cpp-textmate-grammar) +24. js-beautify version 1.6.8 (https://github.com/beautify-web/js-beautify) +25. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) +26. language-docker (https://github.com/moby/moby) +27. language-go version 0.44.3 (https://github.com/atom/language-go) +28. language-less version 0.34.2 (https://github.com/atom/language-less) +29. language-php version 0.44.1 (https://github.com/atom/language-php) +30. language-rust version 0.4.12 (https://github.com/zargony/atom-language-rust) +31. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) +32. marked version 0.6.2 (https://github.com/markedjs/marked) +33. mdn-data version 1.1.12 (https://github.com/mdn/data) +34. Microsoft/TypeScript-TmLanguage version 0.0.1 (https://github.com/Microsoft/TypeScript-TmLanguage) +35. Microsoft/vscode-JSON.tmLanguage (https://github.com/Microsoft/vscode-JSON.tmLanguage) +36. Microsoft/vscode-mssql version 1.6.0 (https://github.com/Microsoft/vscode-mssql) +37. mmims/language-batchfile version 0.7.5 (https://github.com/mmims/language-batchfile) +38. octicons version 8.3.0 (https://github.com/primer/octicons) +39. octref/language-css version 0.42.11 (https://github.com/octref/language-css) +40. PowerShell/EditorSyntax version 1.0.0 (https://github.com/PowerShell/EditorSyntax) +41. promise-polyfill version 8.0.0 (https://github.com/taylorhakes/promise-polyfill) +42. seti-ui version 0.1.0 (https://github.com/jesseweed/seti-ui) +43. shaders-tmLanguage version 0.1.0 (https://github.com/tgjones/shaders-tmLanguage) +44. textmate/asp.vb.net.tmbundle (https://github.com/textmate/asp.vb.net.tmbundle) +45. textmate/c.tmbundle (https://github.com/textmate/c.tmbundle) +46. textmate/diff.tmbundle (https://github.com/textmate/diff.tmbundle) +47. textmate/git.tmbundle (https://github.com/textmate/git.tmbundle) +48. textmate/groovy.tmbundle (https://github.com/textmate/groovy.tmbundle) +49. textmate/html.tmbundle (https://github.com/textmate/html.tmbundle) +50. textmate/ini.tmbundle (https://github.com/textmate/ini.tmbundle) +51. textmate/javascript.tmbundle (https://github.com/textmate/javascript.tmbundle) +52. textmate/lua.tmbundle (https://github.com/textmate/lua.tmbundle) +53. textmate/markdown.tmbundle (https://github.com/textmate/markdown.tmbundle) +54. textmate/perl.tmbundle (https://github.com/textmate/perl.tmbundle) +55. textmate/ruby.tmbundle (https://github.com/textmate/ruby.tmbundle) +56. textmate/yaml.tmbundle (https://github.com/textmate/yaml.tmbundle) +57. TypeScript-TmLanguage version 0.1.8 (https://github.com/Microsoft/TypeScript-TmLanguage) +58. TypeScript-TmLanguage version 1.0.0 (https://github.com/Microsoft/TypeScript-TmLanguage) +59. Unicode version 12.0.0 (http://www.unicode.org/) +60. vscode-logfile-highlighter version 2.4.1 (https://github.com/emilast/vscode-logfile-highlighter) +61. vscode-octicons-font version 1.3.1 (https://github.com/Microsoft/vscode-octicons-font) +62. vscode-swift version 0.0.1 (https://github.com/owensd/vscode-swift) +63. Web Background Synchronization (https://github.com/WICG/BackgroundSync) %% atom/language-clojure NOTICES AND INFORMATION BEGIN HERE @@ -611,6 +612,31 @@ SOFTWARE. ========================================= END OF Ikuyadeu/vscode-R NOTICES AND INFORMATION +%% insane NOTICES AND INFORMATION BEGIN HERE +========================================= +The MIT License (MIT) + +Copyright © 2015 Nicolas Bevacqua + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +========================================= +END OF insane NOTICES AND INFORMATION + %% Ionic documentation NOTICES AND INFORMATION BEGIN HERE ========================================= Copyright Drifty Co. http://drifty.com/. diff --git a/build/.cachesalt b/build/.cachesalt index 105ce86ae3c..339d2d379fa 100644 --- a/build/.cachesalt +++ b/build/.cachesalt @@ -1 +1 @@ -2019-07-11T05:47:05.444Z +2019-08-30T20:24:23.714Z diff --git a/build/azure-pipelines/common/publish-webview.sh b/build/azure-pipelines/common/publish-webview.sh new file mode 100755 index 00000000000..77e222258fe --- /dev/null +++ b/build/azure-pipelines/common/publish-webview.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e +REPO="$(pwd)" + +# Publish webview contents +PACKAGEJSON="$REPO/package.json" +VERSION=$(node -p "require(\"$PACKAGEJSON\").version") + +node build/azure-pipelines/common/publish-webview.js "$REPO/src/vs/workbench/contrib/webview/browser/pre/" diff --git a/build/azure-pipelines/common/publish-webview.ts b/build/azure-pipelines/common/publish-webview.ts new file mode 100644 index 00000000000..143b61bb61a --- /dev/null +++ b/build/azure-pipelines/common/publish-webview.ts @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azure from 'azure-storage'; +import * as mime from 'mime'; +import * as minimist from 'minimist'; +import { basename, join } from 'path'; + +const fileNames = [ + 'fake.html', + 'host.js', + 'index.html', + 'main.js', + 'service-worker.js' +]; + +async function assertContainer(blobService: azure.BlobService, container: string): Promise { + await new Promise((c, e) => blobService.createContainerIfNotExists(container, { publicAccessLevel: 'blob' }, err => err ? e(err) : c())); +} + +async function doesBlobExist(blobService: azure.BlobService, container: string, blobName: string): Promise { + const existsResult = await new Promise((c, e) => blobService.doesBlobExist(container, blobName, (err, r) => err ? e(err) : c(r))); + return existsResult.exists; +} + +async function uploadBlob(blobService: azure.BlobService, container: string, blobName: string, file: string): Promise { + const blobOptions: azure.BlobService.CreateBlockBlobRequestOptions = { + contentSettings: { + contentType: mime.lookup(file), + cacheControl: 'max-age=31536000, public' + } + }; + + await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(container, blobName, file, blobOptions, err => err ? e(err) : c())); +} + +async function publish(commit: string, files: readonly string[]): Promise { + + console.log('Publishing...'); + console.log('Commit:', commit); + const storageAccount = process.env['AZURE_WEBVIEW_STORAGE_ACCOUNT']!; + + const blobService = azure.createBlobService(storageAccount, process.env['AZURE_WEBVIEW_STORAGE_ACCESS_KEY']!) + .withFilter(new azure.ExponentialRetryPolicyFilter(20)); + + await assertContainer(blobService, commit); + + for (const file of files) { + const blobName = basename(file); + const blobExists = await doesBlobExist(blobService, commit, blobName); + if (blobExists) { + console.log(`Blob ${commit}, ${blobName} already exists, not publishing again.`); + continue; + } + console.log('Uploading blob to Azure storage...'); + await uploadBlob(blobService, commit, blobName, file); + } + + console.log('Blobs successfully uploaded.'); +} + +function main(): void { + const commit = process.env['BUILD_SOURCEVERSION']; + + if (!commit) { + console.warn('Skipping publish due to missing BUILD_SOURCEVERSION'); + return; + } + + const opts = minimist(process.argv.slice(2)); + const [directory] = opts._; + + const files = fileNames.map(fileName => join(directory, fileName)); + + publish(commit, files).catch(err => { + console.error(err); + process.exit(1); + }); +} + +if (process.argv.length < 3) { + console.error('Usage: node publish.js '); + process.exit(-1); +} +main(); diff --git a/build/azure-pipelines/darwin/continuous-build-darwin.yml b/build/azure-pipelines/darwin/continuous-build-darwin.yml index 018719423fe..ef636f91e90 100644 --- a/build/azure-pipelines/darwin/continuous-build-darwin.yml +++ b/build/azure-pipelines/darwin/continuous-build-darwin.yml @@ -9,7 +9,7 @@ steps: vstsFeed: '$(ArtifactFeed)' - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - script: | yarn --frozen-lockfile displayName: Install Dependencies @@ -24,8 +24,11 @@ steps: yarn gulp electron-x64 displayName: Download Electron - script: | - yarn gulp hygiene + yarn gulp hygiene --skip-tslint displayName: Run Hygiene Checks +- script: | + yarn gulp tslint + displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks @@ -46,4 +49,4 @@ steps: inputs: testResultsFiles: '*-results.xml' searchFolder: '$(Build.ArtifactStagingDirectory)/test-results' - condition: succeededOrFailed() \ No newline at end of file + condition: succeededOrFailed() diff --git a/build/azure-pipelines/darwin/product-build-darwin.yml b/build/azure-pipelines/darwin/product-build-darwin.yml index 84764519f53..6bcd29db94a 100644 --- a/build/azure-pipelines/darwin/product-build-darwin.yml +++ b/build/azure-pipelines/darwin/product-build-darwin.yml @@ -25,7 +25,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' @@ -103,6 +103,9 @@ steps: - script: | set -e + APP_ROOT=$(agent.builddirectory)/VSCode-darwin + APP_NAME="`ls $APP_ROOT | head -n 1`" + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) diff --git a/build/azure-pipelines/distro-build.yml b/build/azure-pipelines/distro-build.yml index 74fddcc55a8..62ee67ad1c6 100644 --- a/build/azure-pipelines/distro-build.yml +++ b/build/azure-pipelines/distro-build.yml @@ -1,6 +1,3 @@ -pool: - vmImage: 'Ubuntu-16.04' - trigger: branches: include: ['master', 'release/*'] diff --git a/build/azure-pipelines/exploration-build.yml b/build/azure-pipelines/exploration-build.yml index 797c4b5fce0..39a8f23b262 100644 --- a/build/azure-pipelines/exploration-build.yml +++ b/build/azure-pipelines/exploration-build.yml @@ -13,18 +13,28 @@ steps: inputs: versionSpec: "10.15.1" +- task: AzureKeyVault@1 + displayName: 'Azure Key Vault: Get Secrets' + inputs: + azureSubscription: 'vscode-builds-subscription' + KeyVaultName: vscode + - script: | set -e cat << EOF > ~/.netrc + machine github.com + login vscode + password $(github-distro-mixin-password) + EOF git config user.email "vscode@microsoft.com" git config user.name "VSCode" - git checkout origin/ben/electron-test + git checkout origin/electron-6.0.x git merge origin/master # Push master branch into exploration branch - git push origin HEAD:ben/electron-test + git push origin HEAD:electron-6.0.x displayName: Sync & Merge Exploration diff --git a/build/azure-pipelines/linux/continuous-build-linux.yml b/build/azure-pipelines/linux/continuous-build-linux.yml index 8b0aaca2ad9..d71ab286b15 100644 --- a/build/azure-pipelines/linux/continuous-build-linux.yml +++ b/build/azure-pipelines/linux/continuous-build-linux.yml @@ -17,7 +17,7 @@ steps: vstsFeed: '$(ArtifactFeed)' - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - script: | yarn --frozen-lockfile displayName: Install Dependencies @@ -32,8 +32,11 @@ steps: yarn gulp electron-x64 displayName: Download Electron - script: | - yarn gulp hygiene + yarn gulp hygiene --skip-tslint displayName: Run Hygiene Checks +- script: | + yarn gulp tslint + displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks diff --git a/build/azure-pipelines/linux/product-build-linux-multiarch.yml b/build/azure-pipelines/linux/product-build-linux-multiarch.yml index d36c115be78..4f5e39dcdf0 100644 --- a/build/azure-pipelines/linux/product-build-linux-multiarch.yml +++ b/build/azure-pipelines/linux/product-build-linux-multiarch.yml @@ -25,7 +25,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index a6cc1c34965..83e40784649 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -25,7 +25,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' @@ -106,6 +106,9 @@ steps: - script: | set -e + APP_ROOT=$(agent.builddirectory)/VSCode-linux-x64 + APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName") + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests" # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-x64" displayName: Run integration tests diff --git a/build/azure-pipelines/linux/snap-build-linux.yml b/build/azure-pipelines/linux/snap-build-linux.yml index 4c3f602e8ce..047081ced04 100644 --- a/build/azure-pipelines/linux/snap-build-linux.yml +++ b/build/azure-pipelines/linux/snap-build-linux.yml @@ -5,7 +5,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' @@ -51,4 +51,4 @@ steps: # Publish snap package AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \ AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \ - node build/azure-pipelines/common/publish.js "$VSCODE_QUALITY" "linux-snap-x64" package "$SNAP_FILENAME" "$VERSION" true "$SNAP_PATH" \ No newline at end of file + node build/azure-pipelines/common/publish.js "$VSCODE_QUALITY" "linux-snap-x64" package "$SNAP_FILENAME" "$VERSION" true "$SNAP_PATH" diff --git a/build/azure-pipelines/product-build.yml b/build/azure-pipelines/product-build.yml index a2fdc9e4ec6..ecf47fa1cdd 100644 --- a/build/azure-pipelines/product-build.yml +++ b/build/azure-pipelines/product-build.yml @@ -56,7 +56,7 @@ jobs: - template: linux/snap-build-linux.yml - job: LinuxArmhf - condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ARMHF'], 'true'), ne(variables['VSCODE_QUALITY'], 'stable')) + condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ARMHF'], 'true')) pool: vmImage: 'Ubuntu-16.04' variables: @@ -78,7 +78,7 @@ jobs: - template: linux/product-build-linux-multiarch.yml - job: LinuxAlpine - condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ALPINE'], 'true'), ne(variables['VSCODE_QUALITY'], 'stable')) + condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ALPINE'], 'true')) pool: vmImage: 'Ubuntu-16.04' variables: @@ -143,8 +143,8 @@ trigger: none pr: none schedules: -- cron: "10 5 * * Mon-Fri" - displayName: Mon-Fri at 7:10 +- cron: "0 5 * * Mon-Fri" + displayName: Mon-Fri at 7:00 branches: include: - master diff --git a/build/azure-pipelines/product-compile.yml b/build/azure-pipelines/product-compile.yml index 169dfe154fb..794dd8e3b99 100644 --- a/build/azure-pipelines/product-compile.yml +++ b/build/azure-pipelines/product-compile.yml @@ -20,7 +20,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) - task: AzureKeyVault@1 @@ -87,9 +87,10 @@ steps: - script: | set -e - yarn gulp hygiene + yarn gulp hygiene --skip-tslint + yarn gulp tslint yarn monaco-compile-check - displayName: Run hygiene checks + displayName: Run hygiene, tslint and monaco compile checks condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | @@ -98,6 +99,12 @@ steps: displayName: Extract Telemetry condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) +- script: | + set -e + AZURE_WEBVIEW_STORAGE_ACCESS_KEY="$(vscode-webview-storage-key)" \ + ./build/azure-pipelines/common/publish-webview.sh + displayName: Publish Webview + - script: | set -e yarn gulp compile-build diff --git a/build/azure-pipelines/publish-types/publish-types.yml b/build/azure-pipelines/publish-types/publish-types.yml index ff03cecedb1..d377226366a 100644 --- a/build/azure-pipelines/publish-types/publish-types.yml +++ b/build/azure-pipelines/publish-types/publish-types.yml @@ -13,7 +13,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - bash: | # Install build dependencies diff --git a/build/azure-pipelines/sync-mooncake.yml b/build/azure-pipelines/sync-mooncake.yml index f3e8bc07856..1fb8ffcd886 100644 --- a/build/azure-pipelines/sync-mooncake.yml +++ b/build/azure-pipelines/sync-mooncake.yml @@ -5,7 +5,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' diff --git a/build/azure-pipelines/web/product-build-web.yml b/build/azure-pipelines/web/product-build-web.yml index fe5231dacc1..46ecb39eac3 100644 --- a/build/azure-pipelines/web/product-build-web.yml +++ b/build/azure-pipelines/web/product-build-web.yml @@ -25,7 +25,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' diff --git a/build/azure-pipelines/win32/continuous-build-win32.yml b/build/azure-pipelines/win32/continuous-build-win32.yml index 9b6d61ee974..f9b1130d244 100644 --- a/build/azure-pipelines/win32/continuous-build-win32.yml +++ b/build/azure-pipelines/win32/continuous-build-win32.yml @@ -4,7 +4,7 @@ steps: versionSpec: "10.15.1" - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: UsePythonVersion@0 inputs: versionSpec: '2.x' @@ -26,10 +26,12 @@ steps: condition: and(succeeded(), ne(variables['CacheRestored'], 'true')) - powershell: | yarn gulp electron - displayName: Download Electron -- powershell: | - yarn gulp hygiene +- script: | + yarn gulp hygiene --skip-tslint displayName: Run Hygiene Checks +- script: | + yarn gulp tslint + displayName: Run TSLint Checks - powershell: | yarn monaco-compile-check displayName: Run Monaco Editor Checks diff --git a/build/azure-pipelines/win32/product-build-win32.yml b/build/azure-pipelines/win32/product-build-win32.yml index 71a47e63d45..2c40ee3113d 100644 --- a/build/azure-pipelines/win32/product-build-win32.yml +++ b/build/azure-pipelines/win32/product-build-win32.yml @@ -25,7 +25,7 @@ steps: - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: - versionSpec: "1.10.1" + versionSpec: "1.x" - task: UsePythonVersion@0 inputs: @@ -115,8 +115,10 @@ steps: - powershell: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" - exec { yarn gulp "electron-$(VSCODE_ARCH)" } - exec { .\scripts\test-integration.bat --build --tfs "Integration Tests" } + $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)" + $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json + $AppNameShort = $AppProductJson.nameShort + exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; .\scripts\test-integration.bat --build --tfs "Integration Tests" } displayName: Run integration tests condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 664ef4bba18..daa4d3128a7 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -1,7 +1,7 @@ [ { "name": "ms-vscode.node-debug", - "version": "1.38.3", + "version": "1.38.4", "repo": "https://github.com/Microsoft/vscode-node-debug", "metadata": { "id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6", diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index aaedf0a7bc8..a1f47447c18 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -311,10 +311,13 @@ function hygiene(some) { .pipe(filter(copyrightFilter)) .pipe(copyrights); - const typescript = result + let typescript = result .pipe(filter(tslintHygieneFilter)) - .pipe(formatting) - .pipe(tsl); + .pipe(formatting); + + if (!process.argv.some(arg => arg === '--skip-tslint')) { + typescript = typescript.pipe(tsl); + } const javascript = result .pipe(filter(eslintFilter)) diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 98f776abb7e..6bb695db68c 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -50,7 +50,7 @@ const vscodeEntryPoints = _.flatten([ buildfile.entrypoint('vs/workbench/workbench.desktop.main'), buildfile.base, buildfile.serviceWorker, - buildfile.workbench, + buildfile.workbenchDesktop, buildfile.code ]); diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js index 8f63d7b7d0b..edd34cd3931 100644 --- a/build/gulpfile.vscode.web.js +++ b/build/gulpfile.vscode.web.js @@ -53,13 +53,14 @@ const vscodeWebResources = [ const buildfile = require('../src/buildfile'); -const vscodeWebEntryPoints = [ - buildfile.workbenchWeb, +const vscodeWebEntryPoints = _.flatten([ + buildfile.entrypoint('vs/workbench/workbench.web.api'), + buildfile.base, buildfile.serviceWorker, buildfile.workerExtensionHost, buildfile.keyboardMaps, - buildfile.base -]; + buildfile.workbenchWeb +]); const optimizeVSCodeWebTask = task.define('optimize-vscode-web', task.series( util.rimraf('out-vscode-web'), @@ -116,6 +117,8 @@ function packageTask(sourceFolderName, destinationFolderName) { .pipe(util.cleanNodeModules(path.join(__dirname, '.nativeignore'))); const favicon = gulp.src('resources/server/favicon.ico', { base: 'resources/server' }); + const manifest = gulp.src('resources/server/manifest.json', { base: 'resources/server' }); + const pwaicon = gulp.src('resources/server/code.png', { base: 'resources/server' }); let all = es.merge( packageJsonStream, @@ -123,7 +126,9 @@ function packageTask(sourceFolderName, destinationFolderName) { license, sources, deps, - favicon + favicon, + manifest, + pwaicon ); let result = all diff --git a/build/lib/extensions.js b/build/lib/extensions.js index a98f3b890cf..c4385655eb9 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -101,7 +101,7 @@ function fromLocalWebpack(extensionPath) { result.emit('error', compilation.warnings.join('\n')); } }; - const webpackConfig = Object.assign({}, require(webpackConfigPath), { mode: 'production' }); + const webpackConfig = Object.assign(Object.assign({}, require(webpackConfigPath)), { mode: 'production' }); const relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path); return webpackGulp(webpackConfig, webpack, webpackDone) .pipe(es.through(function (data) { diff --git a/build/lib/i18n.js b/build/lib/i18n.js index c40b2988e28..067e1e66889 100644 --- a/build/lib/i18n.js +++ b/build/lib/i18n.js @@ -176,6 +176,7 @@ class XLF { this.buffer.push(line.toString()); } } +exports.XLF = XLF; XLF.parsePseudo = function (xlfString) { return new Promise((resolve) => { let parser = new xml2js.Parser(); @@ -248,7 +249,6 @@ XLF.parse = function (xlfString) { }); }); }; -exports.XLF = XLF; class Limiter { constructor(maxDegreeOfParalellism) { this.maxDegreeOfParalellism = maxDegreeOfParalellism; diff --git a/build/lib/optimize.js b/build/lib/optimize.js index 2b59d926838..ae2e42ec65e 100644 --- a/build/lib/optimize.js +++ b/build/lib/optimize.js @@ -17,7 +17,7 @@ const fancyLog = require("fancy-log"); const ansiColors = require("ansi-colors"); const path = require("path"); const pump = require("pump"); -const uglifyes = require("uglify-es"); +const terser = require("terser"); const VinylFile = require("vinyl"); const bundle = require("./bundle"); const i18n_1 = require("./i18n"); @@ -197,11 +197,14 @@ function uglifyWithCopyrights() { return false; }; }; - const minify = composer(uglifyes); + const minify = composer(terser); const input = es.through(); const output = input .pipe(flatmap((stream, f) => { return stream.pipe(minify({ + compress: { + hoist_funs: true // required due to https://github.com/microsoft/vscode/issues/80202 + }, output: { comments: preserveComments(f), max_line_len: 1024 diff --git a/build/lib/optimize.ts b/build/lib/optimize.ts index 6bf1233c303..9380d5880a3 100644 --- a/build/lib/optimize.ts +++ b/build/lib/optimize.ts @@ -19,7 +19,7 @@ import * as ansiColors from 'ansi-colors'; import * as path from 'path'; import * as pump from 'pump'; import * as sm from 'source-map'; -import * as uglifyes from 'uglify-es'; +import * as terser from 'terser'; import * as VinylFile from 'vinyl'; import * as bundle from './bundle'; import { Language, processNlsFiles } from './i18n'; @@ -273,11 +273,14 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream { }; }; - const minify = (composer as any)(uglifyes); + const minify = (composer as any)(terser); const input = es.through(); const output = input .pipe(flatmap((stream, f) => { return stream.pipe(minify({ + compress: { + hoist_funs: true // required due to https://github.com/microsoft/vscode/issues/80202 + }, output: { comments: preserveComments(f), max_line_len: 1024 diff --git a/build/lib/tslint/noNodejsGlobalsRule.js b/build/lib/tslint/noNodejsGlobalsRule.js index 1e955a41e1b..8c36fa342c2 100644 --- a/build/lib/tslint/noNodejsGlobalsRule.js +++ b/build/lib/tslint/noNodejsGlobalsRule.js @@ -26,6 +26,7 @@ class NoNodejsGlobalsRuleWalker extends abstractGlobalsRule_1.AbstractGlobalsRul getDisallowedGlobals() { // https://nodejs.org/api/globals.html#globals_global_objects return [ + "NodeJS", "Buffer", "__dirname", "__filename", diff --git a/build/lib/tslint/noNodejsGlobalsRule.ts b/build/lib/tslint/noNodejsGlobalsRule.ts index 48b229333e9..7e5767d8570 100644 --- a/build/lib/tslint/noNodejsGlobalsRule.ts +++ b/build/lib/tslint/noNodejsGlobalsRule.ts @@ -37,6 +37,7 @@ class NoNodejsGlobalsRuleWalker extends AbstractGlobalsRuleWalker { getDisallowedGlobals(): string[] { // https://nodejs.org/api/globals.html#globals_global_objects return [ + "NodeJS", "Buffer", "__dirname", "__filename", diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 6b1159bc65c..e0d43786621 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -80,6 +80,19 @@ if (fs.existsSync(processTreeDts)) { fs.unlinkSync(processTreeDts); } +// Rewrite the @types/node typings avoid a conflict with es2018 typings. +// This is caused by our build not understanding `typesVersions` in the package.json +// +// TODO: Fix this +{ + console.log('Rewriting node_modules/@types/node to workaround lack of typesVersions support'); + const indexPath = path.join('node_modules', '@types', 'node', 'index.d.ts'); + + const contents = fs.readFileSync(indexPath).toString() + .replace(/interface IteratorResult \{ \}/, '// VSCODE EDIT — remove IteratorResult\n// interface IteratorResult { }'); + fs.writeFileSync(indexPath, contents); +} + function getInstalledVersion(packageName, cwd) { const opts = {}; if (cwd) { diff --git a/build/package.json b/build/package.json index 75629888620..a48af3c1d8f 100644 --- a/build/package.json +++ b/build/package.json @@ -24,9 +24,9 @@ "@types/pump": "^1.0.1", "@types/request": "^2.47.0", "@types/rimraf": "^2.0.2", + "@types/terser": "^3.12.0", "@types/through": "^0.0.29", "@types/through2": "^2.0.34", - "@types/uglify-es": "^3.0.0", "@types/underscore": "^1.8.9", "@types/xml2js": "0.0.33", "applicationinsights": "1.0.8", @@ -35,12 +35,14 @@ "github-releases": "^0.4.1", "gulp-bom": "^1.0.0", "gulp-sourcemaps": "^1.11.0", + "gulp-uglify": "^3.0.0", "iconv-lite": "0.4.23", "mime": "^1.3.4", "minimist": "^1.2.0", "request": "^2.85.0", + "terser": "^4.2.1", "tslint": "^5.9.1", - "typescript": "3.5.2", + "typescript": "3.6.2", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.5.4", "xml2js": "^0.4.17" diff --git a/build/yarn.lock b/build/yarn.lock index 7e4f11d8c60..223ecd968ef 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -225,6 +225,13 @@ "@types/glob" "*" "@types/node" "*" +"@types/terser@^3.12.0": + version "3.12.0" + resolved "https://registry.yarnpkg.com/@types/terser/-/terser-3.12.0.tgz#25e020fe9a7a6ae92ce46261f00ced67de6c12ac" + integrity sha512-J0Wy8A7ULEqVJftkWhrXZbH0iBk4tYuTj0gBiiveKaY9deNi6cCsxl0ApJ27ojqwYv51bvEw85lOb8Wt4ng9zA== + dependencies: + terser "*" + "@types/through2@^2.0.34": version "2.0.34" resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.34.tgz#9c2a259a238dace2a05a2f8e94b786961bc27ac4" @@ -244,20 +251,6 @@ resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.2.tgz#e0d481d8bb282ad8a8c9e100ceb72c995fb5e709" integrity sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA== -"@types/uglify-es@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/uglify-es/-/uglify-es-3.0.0.tgz#2c5e70b43c0e86643ac1c223f61df15fa0b87bc2" - integrity sha512-Oc/c7pGIQL0MVhC6g+VftWiDQethKsT4c3fQKYm6nOprkvkx9s1MLrnJprDTKlZL3ZJulMpCF9Qn7s6u3uCNxQ== - dependencies: - "@types/uglify-js" "*" - -"@types/uglify-js@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.3.tgz#801a5ca1dc642861f47c46d14b700ed2d610840b" - integrity sha512-MAT0BW2ruO0LhQKjvlipLGCF/Yx0y/cj+tT67tK3QIQDrM2+9R78HgJ54VlrE8AbfjYJJBCQCEPM5ZblPVTuww== - dependencies: - source-map "^0.6.1" - "@types/uglify-js@^2": version "2.6.31" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-2.6.31.tgz#c694755eeb6a1bb9f8f321f3ec37cc22ca4c4f6b" @@ -388,6 +381,11 @@ array-differ@^3.0.0: resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== +array-each@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" + integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -418,6 +416,11 @@ assert-plus@^0.2.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" integrity sha1-104bh+ev/A24qttwIfP+SBAasjQ= +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -547,6 +550,11 @@ buffer-crc32@~0.2.3: resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -660,6 +668,11 @@ commander@^2.12.1, commander@^2.8.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== +commander@^2.20.0, commander@~2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -878,6 +891,14 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= +extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + extend@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/extend/-/extend-1.2.1.tgz#a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c" @@ -1093,6 +1114,22 @@ gulp-sourcemaps@^1.11.0: through2 "2.X" vinyl "1.X" +gulp-uglify@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.2.tgz#5f5b2e8337f879ca9dec971feb1b82a5a87850b0" + integrity sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg== + dependencies: + array-each "^1.0.1" + extend-shallow "^3.0.2" + gulplog "^1.0.0" + has-gulplog "^0.1.0" + isobject "^3.0.1" + make-error-cause "^1.1.1" + safe-buffer "^5.1.2" + through2 "^2.0.0" + uglify-js "^3.0.5" + vinyl-sourcemaps-apply "^0.2.0" + gulp-util@^3.0.0: version "3.0.8" resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" @@ -1275,6 +1312,13 @@ is-absolute@^1.0.0: is-relative "^1.0.0" is-windows "^1.0.1" +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -1297,6 +1341,13 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + is-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" @@ -1336,6 +1387,11 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -1536,6 +1592,18 @@ lodash@^4.15.0, lodash@^4.17.10: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +make-error-cause@^1.1.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" + integrity sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0= + dependencies: + make-error "^1.2.0" + +make-error@^1.2.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + markdown-it@^8.3.1: version "8.4.2" resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54" @@ -1945,6 +2013,11 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== +safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -2005,12 +2078,25 @@ source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" +source-map-support@~0.5.12: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@^0.6.1, source-map@~0.6.0: +source-map@^0.5.1: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -2083,6 +2169,15 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +terser@*, terser@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.2.1.tgz#1052cfe17576c66e7bc70fcc7119f22b155bdac1" + integrity sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + through2@2.X, through2@^2.0.0, through2@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -2193,10 +2288,10 @@ typed-rest-client@^0.9.0: tunnel "0.0.4" underscore "1.8.3" -typescript@3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.2.tgz#a09e1dc69bc9551cadf17dba10ee42cf55e5d56c" - integrity sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA== +typescript@3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== typescript@^3.0.1: version "3.5.3" @@ -2213,6 +2308,14 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376" integrity sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg== +uglify-js@^3.0.5: + version "3.6.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" + integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg== + dependencies: + commander "~2.20.0" + source-map "~0.6.1" + unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" @@ -2272,6 +2375,13 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +vinyl-sourcemaps-apply@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" + integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= + dependencies: + source-map "^0.5.1" + vinyl@1.X: version "1.2.0" resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" diff --git a/cglicenses.json b/cglicenses.json index b7f408109bf..df57f699bd2 100644 --- a/cglicenses.json +++ b/cglicenses.json @@ -10,682 +10,32 @@ // Reason: The license at https://github.com/aadsm/jschardet/blob/master/LICENSE // does not include a clear Copyright statement and does not credit authors. "name": "jschardet", - "licenseDetail": [ + "prependLicenseText": [ "Chardet was originally ported from C++ by Mark Pilgrim. It is now maintained", " by Dan Blanchard and Ian Cordasco, and was formerly maintained by Erik Rose.", " JSChardet was ported from python to JavaScript by António Afonso ", " (https://github.com/aadsm/jschardet) and transformed into an npm package by ", - "Markus Ast (https://github.com/brainafk)", - "", - "GNU LESSER GENERAL PUBLIC LICENSE", - "\t\t Version 2.1, February 1999", - "", - " Copyright (C) 1991,", - "1999 Free Software Foundation, Inc.", - " 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA", - " Everyone is permitted to copy and distribute verbatim copies", - " of this license document, but changing it is not allowed.", - "", - "[This is the first released version of the Lesser GPL. It also counts", - " as the successor of the GNU Library Public License, version 2, hence", - " the version number 2.1.", - "]", - "", - "\t\t\t Preamble", - "", - " The licenses for most software are designed to take away your", - "freedom to share and change it. By contrast, the GNU General Public", - "Licenses are intended to guarantee your freedom to share and change", - "free software--to make sure the software is free for all its users.", - "", - " This license, the Lesser General Public License, applies to some", - "specially designated software packages--typically libraries--of the", - "Free Software Foundation and other authors who decide to use it. You", - "can use it too, but we suggest you first think carefully about whether", - "this license or the ordinary General Public License is the better", - "strategy to use in any particular case, based on the explanations below.", - "", - " When we speak of free software, we are referring to freedom of use,", - "not price. Our General Public Licenses are designed to make sure that", - "you have the freedom to distribute copies of free software (and charge", - "for this service if you wish); that you receive source code or can get", - "it if you want it; that you can change the software and use pieces of", - "it in new free programs; and that you are informed that you can do", - "these things.", - "", - " To protect your rights, we need to make restrictions that forbid", - "distributors to deny you these rights or to ask you to surrender these", - "rights. These restrictions translate to certain responsibilities for", - "you if you distribute copies of the library or if you modify it.", - "", - " For example, if you distribute copies of the library, whether gratis", - "or for a fee, you must give the recipients all the rights that we gave", - "you. You must make sure that they, too, receive or can get the source", - "code. If you link other code with the library, you must provide", - "complete object files to the recipients, so that they can relink them", - "with the library after making changes to the library and recompiling", - "it. And you must show them these terms so they know their rights.", - "", - " We protect your rights with a two-step method: (1) we copyright the", - "library, and (2) we offer you this license, which gives you legal", - "permission to copy, distribute and/or modify the library.", - "", - " To protect each distributor, we want to make it very clear that", - "there is no warranty for the free library. Also, if the library is", - "modified by someone else and passed on, the recipients should know", - "that what they have is not the original version, so that the original", - "author's reputation will not be affected by problems that might be", - "introduced by others.", - "", - " Finally, software patents pose a constant threat to the existence of", - "any free program. We wish to make sure that a company cannot", - "effectively restrict the users of a free program by obtaining a", - "restrictive license from a patent holder. Therefore, we insist that", - "any patent license obtained for a version of the library must be", - "consistent with the full freedom of use specified in this license.", - "", - " Most GNU software, including some libraries, is covered by the", - "ordinary GNU General Public License. This license, the GNU Lesser", - "General Public License, applies to certain designated libraries, and", - "is quite different from the ordinary General Public License. We use", - "this license for certain libraries in order to permit linking those", - "libraries into non-free programs.", - "", - " When a program is linked with a library, whether statically or using", - "a shared library, the combination of the two is legally speaking a", - "combined work, a derivative of the original library. The ordinary", - "General Public License therefore permits such linking only if the", - "entire combination fits its criteria of freedom. The Lesser General", - "Public License permits more lax criteria for linking other code with", - "the library.", - "", - " We call this license the \"Lesser\" General Public License because it", - "does Less to protect the user's freedom than the ordinary General", - "Public License. It also provides other free software developers Less", - "of an advantage over competing non-free programs. These disadvantages", - "are the reason we use the ordinary General Public License for many", - "libraries. However, the Lesser license provides advantages in certain", - "special circumstances.", - "", - " For example, on rare occasions, there may be a special need to", - "encourage the widest possible use of a certain library, so that it becomes", - "a de-facto standard. To achieve this, non-free programs must be", - "allowed to use the library. A more frequent case is that a free", - "library does the same job as widely used non-free libraries. In this", - "case, there is little to gain by limiting the free library to free", - "software only, so we use the Lesser General Public License.", - "", - " In other cases, permission to use a particular library in non-free", - "programs enables a greater number of people to use a large body of", - "free software. For example, permission to use the GNU C Library in", - "non-free programs enables many more people to use the whole GNU", - "operating system, as well as its variant, the GNU/Linux operating", - "system.", - "", - " Although the Lesser General Public License is Less protective of the", - "users' freedom, it does ensure that the user of a program that is", - "linked with the Library has the freedom and the wherewithal to run", - "that program using a modified version of the Library.", - "", - " The precise terms and conditions for copying, distribution and", - "modification follow. Pay close attention to the difference between a", - "\"work based on the library\" and a \"work that uses the library\". The", - "former contains code derived from the library, whereas the latter must", - "be combined with the library in order to run.", - "", - "\t\t GNU LESSER GENERAL PUBLIC LICENSE", - " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION", - "", - " 0. This License Agreement applies to any software library or other", - "program which contains a notice placed by the copyright holder or", - "other authorized party saying it may be distributed under the terms of", - "this Lesser General Public License (also called \"this License\").", - "Each licensee is addressed as \"you\".", - "", - " A \"library\" means a collection of software functions and/or data", - "prepared so as to be conveniently linked with application programs", - "(which use some of those functions and data) to form executables.", - "", - " The \"Library\", below, refers to any such software library or work", - "which has been distributed under these terms. A \"work based on the", - "Library\" means either the Library or any derivative work under", - "copyright law: that is to say, a work containing the Library or a", - "portion of it, either verbatim or with modifications and/or translated", - "straightforwardly into another language. (Hereinafter, translation is", - "included without limitation in the term \"modification\".)", - "", - " \"Source code\" for a work means the preferred form of the work for", - "making modifications to it. For a library, complete source code means", - "all the source code for all modules it contains, plus any associated", - "interface definition files, plus the scripts used to control compilation", - "and installation of the library.", - "", - " Activities other than copying, distribution and modification are not", - "covered by this License; they are outside its scope. The act of", - "running a program using the Library is not restricted, and output from", - "such a program is covered only if its contents constitute a work based", - "on the Library (independent of the use of the Library in a tool for", - "writing it). Whether that is true depends on what the Library does", - "and what the program that uses the Library does.", - "", - " 1. You may copy and distribute verbatim copies of the Library's", - "complete source code as you receive it, in any medium, provided that", - "you conspicuously and appropriately publish on each copy an", - "appropriate copyright notice and disclaimer of warranty; keep intact", - "all the notices that refer to this License and to the absence of any", - "warranty; and distribute a copy of this License along with the", - "Library.", - "", - " You may charge a fee for the physical act of transferring a copy,", - "and you may at your option offer warranty protection in exchange for a", - "fee.", - "", - " 2. You may modify your copy or copies of the Library or any portion", - "of it, thus forming a work based on the Library, and copy and", - "distribute such modifications or work under the terms of Section 1", - "above, provided that you also meet all of these conditions:", - "", - " a) The modified work must itself be a software library.", - "", - " b) You must cause the files modified to carry prominent notices", - " stating that you changed the files and the date of any change.", - "", - " c) You must cause the whole of the work to be licensed at no", - " charge to all third parties under the terms of this License.", - "", - " d) If a facility in the modified Library refers to a function or a", - " table of data to be supplied by an application program that uses", - " the facility, other than as an argument passed when the facility", - " is invoked, then you must make a good faith effort to ensure that,", - " in the event an application does not supply such function or", - " table, the facility still operates, and performs whatever part of", - " its purpose remains meaningful.", - "", - " (For example, a function in a library to compute square roots has", - " a purpose that is entirely well-defined independent of the", - " application. Therefore, Subsection 2d requires that any", - " application-supplied function or table used by this function must", - " be optional: if the application does not supply it, the square", - " root function must still compute square roots.)", - "", - "These requirements apply to the modified work as a whole. If", - "identifiable sections of that work are not derived from the Library,", - "and can be reasonably considered independent and separate works in", - "themselves, then this License, and its terms, do not apply to those", - "sections when you distribute them as separate works. But when you", - "distribute the same sections as part of a whole which is a work based", - "on the Library, the distribution of the whole must be on the terms of", - "this License, whose permissions for other licensees extend to the", - "entire whole, and thus to each and every part regardless of who wrote", - "it.", - "", - "Thus, it is not the intent of this section to claim rights or contest", - "your rights to work written entirely by you; rather, the intent is to", - "exercise the right to control the distribution of derivative or", - "collective works based on the Library.", - "", - "In addition, mere aggregation of another work not based on the Library", - "with the Library (or with a work based on the Library) on a volume of", - "a storage or distribution medium does not bring the other work under", - "the scope of this License.", - "", - " 3. You may opt to apply the terms of the ordinary GNU General Public", - "License instead of this License to a given copy of the Library. To do", - "this, you must alter all the notices that refer to this License, so", - "that they refer to the ordinary GNU General Public License, version 2,", - "instead of to this License. (If a newer version than version 2 of the", - "ordinary GNU General Public License has appeared, then you can specify", - "that version instead if you wish.) Do not make any other change in", - "these notices.", - "", - " Once this change is made in a given copy, it is irreversible for", - "that copy, so the ordinary GNU General Public License applies to all", - "subsequent copies and derivative works made from that copy.", - "", - " This option is useful when you wish to copy part of the code of", - "the Library into a program that is not a library.", - "", - " 4. You may copy and distribute the Library (or a portion or", - "derivative of it, under Section 2) in object code or executable form", - "under the terms of Sections 1 and 2 above provided that you accompany", - "it with the complete corresponding machine-readable source code, which", - "must be distributed under the terms of Sections 1 and 2 above on a", - "medium customarily used for software interchange.", - "", - " If distribution of object code is made by offering access to copy", - "from a designated place, then offering equivalent access to copy the", - "source code from the same place satisfies the requirement to", - "distribute the source code, even though third parties are not", - "compelled to copy the source along with the object code.", - "", - " 5. A program that contains no derivative of any portion of the", - "Library, but is designed to work with the Library by being compiled or", - "linked with it, is called a \"work that uses the Library\". Such a", - "work, in isolation, is not a derivative work of the Library, and", - "therefore falls outside the scope of this License.", - "", - " However, linking a \"work that uses the Library\" with the Library", - "creates an executable that is a derivative of the Library (because it", - "contains portions of the Library), rather than a \"work that uses the", - "library\". The executable is therefore covered by this License.", - "Section 6 states terms for distribution of such executables.", - "", - " When a \"work that uses the Library\" uses material from a header file", - "that is part of the Library, the object code for the work may be a", - "derivative work of the Library even though the source code is not.", - "Whether this is true is especially significant if the work can be", - "linked without the Library, or if the work is itself a library. The", - "threshold for this to be true is not precisely defined by law.", - "", - " If such an object file uses only numerical parameters, data", - "structure layouts and accessors, and small macros and small inline", - "functions (ten lines or less in length), then the use of the object", - "file is unrestricted, regardless of whether it is legally a derivative", - "work. (Executables containing this object code plus portions of the", - "Library will still fall under Section 6.)", - "", - " Otherwise, if the work is a derivative of the Library, you may", - "distribute the object code for the work under the terms of Section 6.", - "Any executables containing that work also fall under Section 6,", - "whether or not they are linked directly with the Library itself.", - "", - " 6. As an exception to the Sections above, you may also combine or", - "link a \"work that uses the Library\" with the Library to produce a", - "work containing portions of the Library, and distribute that work", - "under terms of your choice, provided that the terms permit", - "modification of the work for the customer's own use and reverse", - "engineering for debugging such modifications.", - "", - " You must give prominent notice with each copy of the work that the", - "Library is used in it and that the Library and its use are covered by", - "this License. You must supply a copy of this License. If the work", - "during execution displays copyright notices, you must include the", - "copyright notice for the Library among them, as well as a reference", - "directing the user to the copy of this License. Also, you must do one", - "of these things:", - "", - " a) Accompany the work with the complete corresponding", - " machine-readable source code for the Library including whatever", - " changes were used in the work (which must be distributed under", - " Sections 1 and 2 above); and, if the work is an executable linked", - " with the Library, with the complete machine-readable \"work that", - " uses the Library\", as object code and/or source code, so that the", - " user can modify the Library and then relink to produce a modified", - " executable containing the modified Library. (It is understood", - " that the user who changes the contents of definitions files in the", - " Library will not necessarily be able to recompile the application", - " to use the modified definitions.)", - "", - " b) Use a suitable shared library mechanism for linking with the", - " Library. A suitable mechanism is one that (1) uses at run time a", - " copy of the library already present on the user's computer system,", - " rather than copying library functions into the executable, and (2)", - " will operate properly with a modified version of the library, if", - " the user installs one, as long as the modified version is", - " interface-compatible with the version that the work was made with.", - "", - " c) Accompany the work with a written offer, valid for at", - " least three years, to give the same user the materials", - " specified in Subsection 6a, above, for a charge no more", - " than the cost of performing this distribution.", - "", - " d) If distribution of the work is made by offering access to copy", - " from a designated place, offer equivalent access to copy the above", - " specified materials from the same place.", - "", - " e) Verify that the user has already received a copy of these", - " materials or that you have already sent this user a copy.", - "", - " For an executable, the required form of the \"work that uses the", - "Library\" must include any data and utility programs needed for", - "reproducing the executable from it. However, as a special exception,", - "the materials to be distributed need not include anything that is", - "normally distributed (in either source or binary form) with the major", - "components (compiler, kernel, and so on) of the operating system on", - "which the executable runs, unless that component itself accompanies", - "the executable.", - "", - " It may happen that this requirement contradicts the license", - "restrictions of other proprietary libraries that do not normally", - "accompany the operating system. Such a contradiction means you cannot", - "use both them and the Library together in an executable that you", - "distribute.", - "", - " 7. You may place library facilities that are a work based on the", - "Library side-by-side in a single library together with other library", - "facilities not covered by this License, and distribute such a combined", - "library, provided that the separate distribution of the work based on", - "the Library and of the other library facilities is otherwise", - "permitted, and provided that you do these two things:", - "", - " a) Accompany the combined library with a copy of the same work", - " based on the Library, uncombined with any other library", - " facilities. This must be distributed under the terms of the", - " Sections above.", - "", - " b) Give prominent notice with the combined library of the fact", - " that part of it is a work based on the Library, and explaining", - " where to find the accompanying uncombined form of the same work.", - "", - " 8. You may not copy, modify, sublicense, link with, or distribute", - "the Library except as expressly provided under this License. Any", - "attempt otherwise to copy, modify, sublicense, link with, or", - "distribute the Library is void, and will automatically terminate your", - "rights under this License. However, parties who have received copies,", - "or rights, from you under this License will not have their licenses", - "terminated so long as such parties remain in full compliance.", - "", - " 9. You are not required to accept this License, since you have not", - "signed it. However, nothing else grants you permission to modify or", - "distribute the Library or its derivative works. These actions are", - "prohibited by law if you do not accept this License. Therefore, by", - "modifying or distributing the Library (or any work based on the", - "Library), you indicate your acceptance of this License to do so, and", - "all its terms and conditions for copying, distributing or modifying", - "the Library or works based on it.", - "", - " 10. Each time you redistribute the Library (or any work based on the", - "Library), the recipient automatically receives a license from the", - "original licensor to copy, distribute, link with or modify the Library", - "subject to these terms and conditions. You may not impose any further", - "restrictions on the recipients' exercise of the rights granted herein.", - "You are not responsible for enforcing compliance by third parties with", - "this License.", - "", - " 11. If, as a consequence of a court judgment or allegation of patent", - "infringement or for any other reason (not limited to patent issues),", - "conditions are imposed on you (whether by court order, agreement or", - "otherwise) that contradict the conditions of this License, they do not", - "excuse you from the conditions of this License. If you cannot", - "distribute so as to satisfy simultaneously your obligations under this", - "License and any other pertinent obligations, then as a consequence you", - "may not distribute the Library at all. For example, if a patent", - "license would not permit royalty-free redistribution of the Library by", - "all those who receive copies directly or indirectly through you, then", - "the only way you could satisfy both it and this License would be to", - "refrain entirely from distribution of the Library.", - "", - "If any portion of this section is held invalid or unenforceable under any", - "particular circumstance, the balance of the section is intended to apply,", - "and the section as a whole is intended to apply in other circumstances.", - "", - "It is not the purpose of this section to induce you to infringe any", - "patents or other property right claims or to contest validity of any", - "such claims; this section has the sole purpose of protecting the", - "integrity of the free software distribution system which is", - "implemented by public license practices. Many people have made", - "generous contributions to the wide range of software distributed", - "through that system in reliance on consistent application of that", - "system; it is up to the author/donor to decide if he or she is willing", - "to distribute software through any other system and a licensee cannot", - "impose that choice.", - "", - "This section is intended to make thoroughly clear what is believed to", - "be a consequence of the rest of this License.", - "", - " 12. If the distribution and/or use of the Library is restricted in", - "certain countries either by patents or by copyrighted interfaces, the", - "original copyright holder who places the Library under this License may add", - "an explicit geographical distribution limitation excluding those countries,", - "so that distribution is permitted only in or among countries not thus", - "excluded. In such case, this License incorporates the limitation as if", - "written in the body of this License.", - "", - " 13. The Free Software Foundation may publish revised and/or new", - "versions of the Lesser General Public License from time to time.", - "Such new versions will be similar in spirit to the present version,", - "but may differ in detail to address new problems or concerns.", - "", - "Each version is given a distinguishing version number. If the Library", - "specifies a version number of this License which applies to it and", - "\"any later version\", you have the option of following the terms and", - "conditions either of that version or of any later version published by", - "the Free Software Foundation. If the Library does not specify a", - "license version number, you may choose any version ever published by", - "the Free Software Foundation.", - "", - " 14. If you wish to incorporate parts of the Library into other free", - "programs whose distribution conditions are incompatible with these,", - "write to the author to ask for permission. For software which is", - "copyrighted by the Free Software Foundation, write to the Free", - "Software Foundation; we sometimes make exceptions for this. Our", - "decision will be guided by the two goals of preserving the free status", - "of all derivatives of our free software and of promoting the sharing", - "and reuse of software generally.", - "", - "\t\t\t NO WARRANTY", - "", - " 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO", - "WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.", - "EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR", - "OTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY", - "KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE", - "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", - "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE", - "LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME", - "THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.", - "", - " 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN", - "WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY", - "AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU", - "FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR", - "CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE", - "LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING", - "RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A", - "FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF", - "SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH", - "DAMAGES.", - "", - "\t\t END OF TERMS AND CONDITIONS", - "", - " How to Apply These Terms to Your New Libraries", - "", - " If you develop a new library, and you want it to be of the greatest", - "possible use to the public, we recommend making it free software that", - "everyone can redistribute and change. You can do so by permitting", - "redistribution under these terms (or, alternatively, under the terms of the", - "ordinary General Public License).", - "", - " To apply these terms, attach the following notices to the library. It is", - "safest to attach them to the start of each source file to most effectively", - "convey the exclusion of warranty; and each file should have at least the", - "\"copyright\" line and a pointer to where the full notice is found.", - "", - " ", - " Copyright (C) ", - "", - " This library is free software; you can redistribute it and/or", - " modify it under the terms of the GNU Lesser General Public", - " License as published by the Free Software Foundation; either", - " version 2.1 of the License, or (at your option) any later version.", - "", - " This library is distributed in the hope that it will be useful,", - " but WITHOUT ANY WARRANTY; without even the implied warranty of", - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU", - " Lesser General Public License for more details.", - "", - " You should have received a copy of the GNU Lesser General Public", - " License along with this library; if not, write to the Free Software", - " Foundation, Inc.,", - "51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA", - "", - "Also add information on how to contact you by electronic and paper mail.", - "", - "You should also get your employer (if you work as a programmer) or your", - "school, if any, to sign a \"copyright disclaimer\" for the library, if", - "necessary. Here is a sample; alter the names:", - "", - " Yoyodyne, Inc., hereby disclaims all copyright interest in the", - " library `Frob' (a library for tweaking knobs) written by James Random Hacker.", - "", - " ,", - "1 April 1990", - " Ty Coon, President of Vice", - "", - "That's all there is to it!" + "Markus Ast (https://github.com/brainafk)" ] }, { - // Added here because the module `parse5` has a dependency to it. - // The module `parse5` is shipped via the `extension-editing` built-in extension. - // The module `parse5` does not want to remove it https://github.com/inikulin/parse5/issues/225 - "name": "@types/node", - "licenseDetail": [ - "This project is licensed under the MIT license.", - "Copyrights are respective of each contributor listed at the beginning of each definition file.", - "", - "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:", - "", - "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", - "", - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." - ] - }, - { - // We override the license that gets discovered at - // https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt - // because it does not contain a Copyright statement + // Reason: The license at https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt + // does not include a clear Copyright statement. "name": "typescript", - "licenseDetail": [ - "Copyright (c) Microsoft Corporation. All rights reserved.", - "", - "Apache License", - "", - "Version 2.0, January 2004", - "", - "http://www.apache.org/licenses/", - "", - "TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION", - "", - "1. Definitions.", - "", - "\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.", - "", - "\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.", - "", - "\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.", - "", - "\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.", - "", - "\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.", - "", - "\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.", - "", - "\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).", - "", - "\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.", - "", - "\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"", - "", - "\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.", - "", - "2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.", - "", - "3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.", - "", - "4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:", - "", - "You must give any other recipients of the Work or Derivative Works a copy of this License; and", - "", - "You must cause any modified files to carry prominent notices stating that You changed the files; and", - "", - "You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and", - "", - "If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.", - "", - "5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.", - "", - "6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.", - "", - "7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.", - "", - "8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.", - "", - "9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.", - "", - "END OF TERMS AND CONDITIONS" - ] - }, - { - // This module comes in from https://github.com/Microsoft/vscode-node-debug2/blob/master/package-lock.json - "name": "@types/source-map", - "licenseDetail": [ - "This project is licensed under the MIT license.", - "Copyrights are respective of each contributor listed at the beginning of each definition file.", - "", - "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:", - "", - "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", - "", - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + "prependLicenseText": [ + "Copyright (c) Microsoft Corporation. All rights reserved." ] }, { "name": "tunnel-agent", - "licenseDetail": [ - "Copyright (c) tunnel-agent authors", - "", - "Apache License", - "", - "Version 2.0, January 2004", - "", - "http://www.apache.org/licenses/", - "", - "TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION", - "", - "1. Definitions.", - "", - "\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.", - "", - "\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.", - "", - "\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.", - "", - "\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.", - "", - "\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.", - "", - "\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.", - "", - "\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).", - "", - "\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.", - "", - "\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"", - "", - "\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.", - "", - "2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.", - "", - "3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.", - "", - "4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:", - "", - "You must give any other recipients of the Work or Derivative Works a copy of this License; and", - "", - "You must cause any modified files to carry prominent notices stating that You changed the files; and", - "", - "You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and", - "", - "If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.", - "", - "5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.", - "", - "6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.", - "", - "7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.", - "", - "8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.", - "", - "9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.", - "", - "END OF TERMS AND CONDITIONS" + "prependLicenseText": [ + "Copyright (c) tunnel-agent authors" ] }, { - // Waiting for https://github.com/segmentio/noop-logger/issues/2 + // Reason: Waiting for https://github.com/segmentio/noop-logger/issues/2 "name": "noop-logger", - "licenseDetail": [ + "fullLicenseText": [ "This project is licensed under the MIT license.", "Copyrights are respective of each contributor listed at the beginning of each definition file.", "", @@ -697,8 +47,10 @@ ] }, { + // Reason: The npm module does not contain a repository field. + // waiting for https://github.com/xtermjs/xterm.js/issues/2395 "name": "xterm-addon-search", - "licenseDetail": [ + "fullLicenseText": [ "Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)", "", "Permission is hereby granted, free of charge, to any person obtaining a copy", @@ -721,8 +73,10 @@ ] }, { + // Reason: The npm module does not contain a repository field. + // waiting for https://github.com/xtermjs/xterm.js/issues/2395 "name": "xterm-addon-web-links", - "licenseDetail": [ + "fullLicenseText": [ "Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)", "", "Permission is hereby granted, free of charge, to any person obtaining a copy", @@ -745,8 +99,10 @@ ] }, { + // Reason: The license at https://git.coolaj86.com/coolaj86/atob.js/src/branch/master/LICENSE + // cannot be found by the OSS tool automatically. "name": "atob", - "licenseDetail": [ + "fullLicenseText": [ "The MIT License (MIT)", "", "Copyright (c) 2015 AJ ONeal", @@ -769,5 +125,13 @@ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE", "SOFTWARE." ] + }, + { + // Reason: The license at https://github.com/microsoft/tslib/blob/master/LICENSE.txt + // does not include a clear Copyright statement. + "name": "tslib", + "prependLicenseText": [ + "Copyright (c) Microsoft Corporation. All rights reserved." + ] } ] diff --git a/cgmanifest.json b/cgmanifest.json index 5ba2e166267..d26f37b6204 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -60,12 +60,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "3d4d6454007f14fa9a5f0e1fa49206fb91b676cc" + "commitHash": "4e4c7527c63fcf27dffaeb58bde996b8d859c0ed" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "4.2.9" + "version": "4.2.10" }, { "component": { diff --git a/extensions/configuration-editing/schemas/devContainer.schema.json b/extensions/configuration-editing/schemas/devContainer.schema.json index 55950a9021e..c24857720e6 100644 --- a/extensions/configuration-editing/schemas/devContainer.schema.json +++ b/extensions/configuration-editing/schemas/devContainer.schema.json @@ -129,6 +129,13 @@ "type": "string", "description": "The service you want to work on." }, + "runServices": { + "type": "array", + "description": "An array of services that should be started and stopped.", + "items": { + "type": "string" + } + }, "workspaceFolder": { "type": "string", "description": "The path of the workspace folder inside the container." @@ -178,4 +185,4 @@ "$ref": "#/definitions/devContainerCommon" } ] -} \ No newline at end of file +} diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index b8eb0579838..e2001d6e6ac 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "031ef619bef4c5a1ca46e6fa69d7c913e0c32068" + "commitHash": "7e5b098736796056fa99d1ef50e1b95b6131d16c" } }, "license": "MIT", - "version": "1.13.2", + "version": "1.14.3", "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { diff --git a/extensions/cpp/package.json b/extensions/cpp/package.json index 6d8ae8b81df..e57a559e82a 100644 --- a/extensions/cpp/package.json +++ b/extensions/cpp/package.json @@ -18,7 +18,7 @@ }, { "id": "cpp", - "extensions": [ ".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx", ".h", ".i", ".ino", ".inl", ".ipp", ".hpp.in", ".h.in" ], + "extensions": [ ".cpp", ".cc", ".cxx", ".c++", ".hpp", ".hh", ".hxx", ".h", ".i", ".ino", ".inl", ".ipp", ".hpp.in", ".h.in" ], "aliases": [ "C++", "Cpp", "cpp"], "configuration": "./language-configuration.json" }], diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index fbfac34d19d..93b50e95078 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/218448eb46260864352d569db13be6cb20767e92", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/7e5b098736796056fa99d1ef50e1b95b6131d16c", "name": "C", "scopeName": "source.c", "patterns": [ @@ -749,9 +749,6 @@ "patterns": [ { "include": "#string_context" - }, - { - "include": "#string_context_c" } ] }, @@ -884,1264 +881,681 @@ "predefined_macros": { "patterns": [ { - "match": "\\b__cplusplus\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__cplusplus.c" - }, - { - "match": "\\b__DATE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__DATE__.c" - }, - { - "match": "\\b__FILE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FILE__.c" - }, - { - "match": "\\b__LINE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LINE__.c" - }, - { - "match": "\\b__STDC__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STDC__.c" - }, - { - "match": "\\b__STDC_HOSTED__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STDC_HOSTED__.c" - }, - { - "match": "\\b__STDC_NO_COMPLEX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STDC_NO_COMPLEX__.c" - }, - { - "match": "\\b__STDC_VERSION__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STDC_VERSION__.c" - }, - { - "match": "\\b__STDCPP_THREADS__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STDCPP_THREADS__.c" - }, - { - "match": "\\b__TIME__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__TIME__.c" - }, - { - "match": "\\bNDEBUG\\b", - "name": "entity.name.other.preprocessor.macro.predefined.NDEBUG.c" - }, - { - "match": "\\b__OBJC__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__OBJC__.c" - }, - { - "match": "\\b__ASSEMBLER__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ASSEMBLER__.c" - }, - { - "match": "\\b__ATOM__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ATOM__.c" - }, - { - "match": "\\b__AVX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__AVX__.c" - }, - { - "match": "\\b__AVX2__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__AVX2__.c" - }, - { - "match": "\\b_CHAR_UNSIGNED\\b", - "name": "entity.name.other.preprocessor.macro.predefined._CHAR_UNSIGNED.c" - }, - { - "match": "\\b__CLR_VER\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__CLR_VER.c" - }, - { - "match": "\\b_CONTROL_FLOW_GUARD\\b", - "name": "entity.name.other.preprocessor.macro.predefined._CONTROL_FLOW_GUARD.c" - }, - { - "match": "\\b__COUNTER__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__COUNTER__.c" - }, - { - "match": "\\b__cplusplus_cli\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__cplusplus_cli.c" - }, - { - "match": "\\b__cplusplus_winrt\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__cplusplus_winrt.c" - }, - { - "match": "\\b_CPPRTTI\\b", - "name": "entity.name.other.preprocessor.macro.predefined._CPPRTTI.c" - }, - { - "match": "\\b_CPPUNWIND\\b", - "name": "entity.name.other.preprocessor.macro.predefined._CPPUNWIND.c" - }, - { - "match": "\\b_DEBUG\\b", - "name": "entity.name.other.preprocessor.macro.predefined._DEBUG.c" - }, - { - "match": "\\b_DLL\\b", - "name": "entity.name.other.preprocessor.macro.predefined._DLL.c" - }, - { - "match": "\\b__FUNCDNAME__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FUNCDNAME__.c" - }, - { - "match": "\\b__FUNCSIG__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FUNCSIG__.c" - }, - { - "match": "\\b__FUNCTION__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FUNCTION__.c" - }, - { - "match": "\\b_INTEGRAL_MAX_BITS\\b", - "name": "entity.name.other.preprocessor.macro.predefined._INTEGRAL_MAX_BITS.c" - }, - { - "match": "\\b__INTELLISENSE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTELLISENSE__.c" - }, - { - "match": "\\b_ISO_VOLATILE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._ISO_VOLATILE.c" - }, - { - "match": "\\b_KERNEL_MODE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._KERNEL_MODE.c" - }, - { - "match": "\\b_M_AMD64\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_AMD64.c" - }, - { - "match": "\\b_M_ARM\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_ARM.c" - }, - { - "match": "\\b_M_ARM_ARMV7VE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_ARM_ARMV7VE.c" - }, - { - "match": "\\b_M_ARM_FP\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_ARM_FP.c" - }, - { - "match": "\\b_M_ARM64\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_ARM64.c" - }, - { - "match": "\\b_M_CEE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_CEE.c" - }, - { - "match": "\\b_M_CEE_PURE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_CEE_PURE.c" - }, - { - "match": "\\b_M_CEE_SAFE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_CEE_SAFE.c" - }, - { - "match": "\\b_M_FP_EXCEPT\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_FP_EXCEPT.c" - }, - { - "match": "\\b_M_FP_FAST\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_FP_FAST.c" - }, - { - "match": "\\b_M_FP_PRECISE\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_FP_PRECISE.c" - }, - { - "match": "\\b_M_FP_STRICT\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_FP_STRICT.c" - }, - { - "match": "\\b_M_IX86\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_IX86.c" - }, - { - "match": "\\b_M_IX86_FP\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_IX86_FP.c" - }, - { - "match": "\\b_M_X64\\b", - "name": "entity.name.other.preprocessor.macro.predefined._M_X64.c" - }, - { - "match": "\\b_MANAGED\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MANAGED.c" - }, - { - "match": "\\b_MSC_BUILD\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MSC_BUILD.c" - }, - { - "match": "\\b_MSC_EXTENSIONS\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MSC_EXTENSIONS.c" - }, - { - "match": "\\b_MSC_FULL_VER\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MSC_FULL_VER.c" - }, - { - "match": "\\b_MSC_VER\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MSC_VER.c" - }, - { - "match": "\\b_MSVC_LANG\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MSVC_LANG.c" - }, - { - "match": "\\b__MSVC_RUNTIME_CHECKS\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__MSVC_RUNTIME_CHECKS.c" - }, - { - "match": "\\b_MT\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MT.c" - }, - { - "match": "\\b_NATIVE_WCHAR_T_DEFINED\\b", - "name": "entity.name.other.preprocessor.macro.predefined._NATIVE_WCHAR_T_DEFINED.c" - }, - { - "match": "\\b_OPENMP\\b", - "name": "entity.name.other.preprocessor.macro.predefined._OPENMP.c" - }, - { - "match": "\\b_PREFAST\\b", - "name": "entity.name.other.preprocessor.macro.predefined._PREFAST.c" - }, - { - "match": "\\b__TIMESTAMP__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__TIMESTAMP__.c" - }, - { - "match": "\\b_VC_NO_DEFAULTLIB\\b", - "name": "entity.name.other.preprocessor.macro.predefined._VC_NO_DEFAULTLIB.c" - }, - { - "match": "\\b_WCHAR_T_DEFINED\\b", - "name": "entity.name.other.preprocessor.macro.predefined._WCHAR_T_DEFINED.c" - }, - { - "match": "\\b_WIN32\\b", - "name": "entity.name.other.preprocessor.macro.predefined._WIN32.c" - }, - { - "match": "\\b_WIN64\\b", - "name": "entity.name.other.preprocessor.macro.predefined._WIN64.c" - }, - { - "match": "\\b_WINRT_DLL\\b", - "name": "entity.name.other.preprocessor.macro.predefined._WINRT_DLL.c" - }, - { - "match": "\\b_ATL_VER\\b", - "name": "entity.name.other.preprocessor.macro.predefined._ATL_VER.c" - }, - { - "match": "\\b_MFC_VER\\b", - "name": "entity.name.other.preprocessor.macro.predefined._MFC_VER.c" - }, - { - "match": "\\b__GFORTRAN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GFORTRAN__.c" - }, - { - "match": "\\b__GNUC__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GNUC__.c" - }, - { - "match": "\\b__GNUC_MINOR__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GNUC_MINOR__.c" - }, - { - "match": "\\b__GNUC_PATCHLEVEL__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GNUC_PATCHLEVEL__.c" - }, - { - "match": "\\b__GNUG__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GNUG__.c" - }, - { - "match": "\\b__STRICT_ANSI__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__STRICT_ANSI__.c" - }, - { - "match": "\\b__BASE_FILE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__BASE_FILE__.c" - }, - { - "match": "\\b__INCLUDE_LEVEL__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INCLUDE_LEVEL__.c" - }, - { - "match": "\\b__ELF__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ELF__.c" - }, - { - "match": "\\b__VERSION__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__VERSION__.c" - }, - { - "match": "\\b__OPTIMIZE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__OPTIMIZE__.c" - }, - { - "match": "\\b__OPTIMIZE_SIZE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__OPTIMIZE_SIZE__.c" - }, - { - "match": "\\b__NO_INLINE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__NO_INLINE__.c" - }, - { - "match": "\\b__GNUC_STDC_INLINE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GNUC_STDC_INLINE__.c" - }, - { - "match": "\\b__CHAR_UNSIGNED__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__CHAR_UNSIGNED__.c" - }, - { - "match": "\\b__WCHAR_UNSIGNED__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WCHAR_UNSIGNED__.c" - }, - { - "match": "\\b__REGISTER_PREFIX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__REGISTER_PREFIX__.c" - }, - { - "match": "\\b__REGISTER_PREFIX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__REGISTER_PREFIX__.c" - }, - { - "match": "\\b__SIZE_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZE_TYPE__.c" - }, - { - "match": "\\b__PTRDIFF_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__PTRDIFF_TYPE__.c" - }, - { - "match": "\\b__WCHAR_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WCHAR_TYPE__.c" - }, - { - "match": "\\b__WINT_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WINT_TYPE__.c" - }, - { - "match": "\\b__INTMAX_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTMAX_TYPE__.c" - }, - { - "match": "\\b__UINTMAX_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINTMAX_TYPE__.c" - }, - { - "match": "\\b__SIG_ATOMIC_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIG_ATOMIC_TYPE__.c" - }, - { - "match": "\\b__INT8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT8_TYPE__.c" - }, - { - "match": "\\b__INT16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT16_TYPE__.c" - }, - { - "match": "\\b__INT32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT32_TYPE__.c" - }, - { - "match": "\\b__INT64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT64_TYPE__.c" - }, - { - "match": "\\b__UINT8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT8_TYPE__.c" - }, - { - "match": "\\b__UINT16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT16_TYPE__.c" - }, - { - "match": "\\b__UINT32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT32_TYPE__.c" - }, - { - "match": "\\b__UINT64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT64_TYPE__.c" - }, - { - "match": "\\b__INT_LEAST8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST8_TYPE__.c" - }, - { - "match": "\\b__INT_LEAST16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST16_TYPE__.c" - }, - { - "match": "\\b__INT_LEAST32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST32_TYPE__.c" - }, - { - "match": "\\b__INT_LEAST64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST64_TYPE__.c" - }, - { - "match": "\\b__UINT_LEAST8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST8_TYPE__.c" - }, - { - "match": "\\b__UINT_LEAST16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST16_TYPE__.c" - }, - { - "match": "\\b__UINT_LEAST32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST32_TYPE__.c" - }, - { - "match": "\\b__UINT_LEAST64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST64_TYPE__.c" - }, - { - "match": "\\b__INT_FAST8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST8_TYPE__.c" - }, - { - "match": "\\b__INT_FAST16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST16_TYPE__.c" - }, - { - "match": "\\b__INT_FAST32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST32_TYPE__.c" - }, - { - "match": "\\b__INT_FAST64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST64_TYPE__.c" - }, - { - "match": "\\b__UINT_FAST8_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST8_TYPE__.c" - }, - { - "match": "\\b__UINT_FAST16_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST16_TYPE__.c" - }, - { - "match": "\\b__UINT_FAST32_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST32_TYPE__.c" - }, - { - "match": "\\b__UINT_FAST64_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST64_TYPE__.c" - }, - { - "match": "\\b__INTPTR_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTPTR_TYPE__.c" - }, - { - "match": "\\b__UINTPTR_TYPE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINTPTR_TYPE__.c" - }, - { - "match": "\\b__CHAR_BIT__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__CHAR_BIT__.c" - }, - { - "match": "\\b__SCHAR_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SCHAR_MAX__.c" - }, - { - "match": "\\b__WCHAR_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WCHAR_MAX__.c" - }, - { - "match": "\\b__SHRT_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SHRT_MAX__.c" - }, - { - "match": "\\b__INT_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_MAX__.c" - }, - { - "match": "\\b__LONG_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LONG_MAX__.c" - }, - { - "match": "\\b__LONG_LONG_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LONG_LONG_MAX__.c" - }, - { - "match": "\\b__WINT_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WINT_MAX__.c" - }, - { - "match": "\\b__SIZE_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZE_MAX__.c" - }, - { - "match": "\\b__PTRDIFF_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__PTRDIFF_MAX__.c" - }, - { - "match": "\\b__INTMAX_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTMAX_MAX__.c" - }, - { - "match": "\\b__UINTMAX_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINTMAX_MAX__.c" - }, - { - "match": "\\b__SIG_ATOMIC_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIG_ATOMIC_MAX__.c" - }, - { - "match": "\\b__INT8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT8_MAX__.c" - }, - { - "match": "\\b__INT16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT16_MAX__.c" - }, - { - "match": "\\b__INT32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT32_MAX__.c" - }, - { - "match": "\\b__INT64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT64_MAX__.c" - }, - { - "match": "\\b__UINT8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT8_MAX__.c" - }, - { - "match": "\\b__UINT16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT16_MAX__.c" - }, - { - "match": "\\b__UINT32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT32_MAX__.c" - }, - { - "match": "\\b__UINT64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT64_MAX__.c" - }, - { - "match": "\\b__INT_LEAST8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST8_MAX__.c" - }, - { - "match": "\\b__INT_LEAST16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST16_MAX__.c" - }, - { - "match": "\\b__INT_LEAST32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST32_MAX__.c" - }, - { - "match": "\\b__INT_LEAST64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST64_MAX__.c" - }, - { - "match": "\\b__UINT_LEAST8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST8_MAX__.c" - }, - { - "match": "\\b__UINT_LEAST16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST16_MAX__.c" - }, - { - "match": "\\b__UINT_LEAST32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST32_MAX__.c" - }, - { - "match": "\\b__UINT_LEAST64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_LEAST64_MAX__.c" - }, - { - "match": "\\b__INT_FAST8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST8_MAX__.c" - }, - { - "match": "\\b__INT_FAST16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST16_MAX__.c" - }, - { - "match": "\\b__INT_FAST32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST32_MAX__.c" - }, - { - "match": "\\b__INT_FAST64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST64_MAX__.c" - }, - { - "match": "\\b__UINT_FAST8_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST8_MAX__.c" - }, - { - "match": "\\b__UINT_FAST16_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST16_MAX__.c" - }, - { - "match": "\\b__UINT_FAST32_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST32_MAX__.c" - }, - { - "match": "\\b__UINT_FAST64_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINT_FAST64_MAX__.c" - }, - { - "match": "\\b__INTPTR_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTPTR_MAX__.c" - }, - { - "match": "\\b__UINTPTR_MAX__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__UINTPTR_MAX__.c" - }, - { - "match": "\\b__WCHAR_MIN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WCHAR_MIN__.c" - }, - { - "match": "\\b__WINT_MIN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WINT_MIN__.c" - }, - { - "match": "\\b__SIG_ATOMIC_MIN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIG_ATOMIC_MIN__.c" - }, - { - "match": "\\b__SCHAR_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SCHAR_WIDTH__.c" - }, - { - "match": "\\b__SHRT_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SHRT_WIDTH__.c" - }, - { - "match": "\\b__INT_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_WIDTH__.c" - }, - { - "match": "\\b__LONG_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LONG_WIDTH__.c" - }, - { - "match": "\\b__LONG_LONG_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LONG_LONG_WIDTH__.c" - }, - { - "match": "\\b__PTRDIFF_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__PTRDIFF_WIDTH__.c" - }, - { - "match": "\\b__SIG_ATOMIC_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIG_ATOMIC_WIDTH__.c" - }, - { - "match": "\\b__SIZE_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZE_WIDTH__.c" - }, - { - "match": "\\b__WCHAR_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WCHAR_WIDTH__.c" - }, - { - "match": "\\b__WINT_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__WINT_WIDTH__.c" - }, - { - "match": "\\b__INT_LEAST8_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST8_WIDTH__.c" - }, - { - "match": "\\b__INT_LEAST16_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST16_WIDTH__.c" - }, - { - "match": "\\b__INT_LEAST32_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST32_WIDTH__.c" - }, - { - "match": "\\b__INT_LEAST64_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_LEAST64_WIDTH__.c" - }, - { - "match": "\\b__INT_FAST8_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST8_WIDTH__.c" - }, - { - "match": "\\b__INT_FAST16_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST16_WIDTH__.c" - }, - { - "match": "\\b__INT_FAST32_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST32_WIDTH__.c" - }, - { - "match": "\\b__INT_FAST64_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INT_FAST64_WIDTH__.c" - }, - { - "match": "\\b__INTPTR_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTPTR_WIDTH__.c" - }, - { - "match": "\\b__INTMAX_WIDTH__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__INTMAX_WIDTH__.c" - }, - { - "match": "\\b__SIZEOF_INT__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_INT__.c" - }, - { - "match": "\\b__SIZEOF_LONG__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_LONG__.c" - }, - { - "match": "\\b__SIZEOF_LONG_LONG__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_LONG_LONG__.c" - }, - { - "match": "\\b__SIZEOF_SHORT__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_SHORT__.c" - }, - { - "match": "\\b__SIZEOF_POINTER__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_POINTER__.c" - }, - { - "match": "\\b__SIZEOF_FLOAT__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_FLOAT__.c" - }, - { - "match": "\\b__SIZEOF_DOUBLE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_DOUBLE__.c" - }, - { - "match": "\\b__SIZEOF_LONG_DOUBLE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_LONG_DOUBLE__.c" - }, - { - "match": "\\b__SIZEOF_SIZE_T__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_SIZE_T__.c" - }, - { - "match": "\\b__SIZEOF_WCHAR_T__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_WCHAR_T__.c" - }, - { - "match": "\\b__SIZEOF_WINT_T__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_WINT_T__.c" - }, - { - "match": "\\b__SIZEOF_PTRDIFF_T__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SIZEOF_PTRDIFF_T__.c" - }, - { - "match": "\\b__BYTE_ORDER__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__BYTE_ORDER__.c" - }, - { - "match": "\\b__ORDER_LITTLE_ENDIAN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ORDER_LITTLE_ENDIAN__.c" - }, - { - "match": "\\b__ORDER_BIG_ENDIAN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ORDER_BIG_ENDIAN__.c" - }, - { - "match": "\\b__ORDER_PDP_ENDIAN__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__ORDER_PDP_ENDIAN__.c" - }, - { - "match": "\\b__FLOAT_WORD_ORDER__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FLOAT_WORD_ORDER__.c" - }, - { - "match": "\\b__DEPRECATED\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__DEPRECATED.c" - }, - { - "match": "\\b__EXCEPTIONS\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__EXCEPTIONS.c" - }, - { - "match": "\\b__GXX_RTTI\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GXX_RTTI.c" - }, - { - "match": "\\b__USING_SJLJ_EXCEPTIONS__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__USING_SJLJ_EXCEPTIONS__.c" - }, - { - "match": "\\b__GXX_EXPERIMENTAL_CXX0X__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GXX_EXPERIMENTAL_CXX0X__.c" - }, - { - "match": "\\b__GXX_WEAK__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GXX_WEAK__.c" - }, - { - "match": "\\b__NEXT_RUNTIME__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__NEXT_RUNTIME__.c" - }, - { - "match": "\\b__LP64__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__LP64__.c" - }, - { - "match": "\\b_LP64\\b", - "name": "entity.name.other.preprocessor.macro.predefined._LP64.c" - }, - { - "match": "\\b__SSP__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SSP__.c" - }, - { - "match": "\\b__SSP_ALL__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SSP_ALL__.c" - }, - { - "match": "\\b__SSP_STRONG__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SSP_STRONG__.c" - }, - { - "match": "\\b__SSP_EXPLICIT__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SSP_EXPLICIT__.c" - }, - { - "match": "\\b__SANITIZE_ADDRESS__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SANITIZE_ADDRESS__.c" - }, - { - "match": "\\b__SANITIZE_THREAD__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__SANITIZE_THREAD__.c" - }, - { - "match": "\\b__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1.c" - }, - { - "match": "\\b__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2.c" - }, - { - "match": "\\b__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.c" - }, - { - "match": "\\b__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.c" - }, - { - "match": "\\b__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16.c" - }, - { - "match": "\\b__HAVE_SPECULATION_SAFE_VALUE\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__HAVE_SPECULATION_SAFE_VALUE.c" - }, - { - "match": "\\b__GCC_HAVE_DWARF2_CFI_ASM\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_HAVE_DWARF2_CFI_ASM.c" - }, - { - "match": "\\b__FP_FAST_FMA\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMA.c" - }, - { - "match": "\\b__FP_FAST_FMAF\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF.c" - }, - { - "match": "\\b__FP_FAST_FMAL\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAL.c" - }, - { - "match": "\\b__FP_FAST_FMAF16\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF16.c" - }, - { - "match": "\\b__FP_FAST_FMAF32\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF32.c" - }, - { - "match": "\\b__FP_FAST_FMAF64\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF64.c" - }, - { - "match": "\\b__FP_FAST_FMAF128\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF128.c" - }, - { - "match": "\\b__FP_FAST_FMAF32X\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF32X.c" - }, - { - "match": "\\b__FP_FAST_FMAF64X\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF64X.c" - }, - { - "match": "\\b__FP_FAST_FMAF128X\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FP_FAST_FMAF128X.c" - }, - { - "match": "\\b__GCC_IEC_559\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_IEC_559.c" - }, - { - "match": "\\b__GCC_IEC_559_COMPLEX\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__GCC_IEC_559_COMPLEX.c" - }, - { - "match": "\\b__NO_MATH_ERRNO__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__NO_MATH_ERRNO__.c" - }, - { - "match": "\\b__has_builtin\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_builtin.c" - }, - { - "match": "\\b__has_feature\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_feature.c" - }, - { - "match": "\\b__has_extension\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_extension.c" - }, - { - "match": "\\b__has_cpp_attribute\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_cpp_attribute.c" - }, - { - "match": "\\b__has_c_attribute\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_c_attribute.c" - }, - { - "match": "\\b__has_attribute\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_attribute.c" - }, - { - "match": "\\b__has_declspec_attribute\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_declspec_attribute.c" - }, - { - "match": "\\b__is_identifier\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__is_identifier.c" - }, - { - "match": "\\b__has_include\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_include.c" - }, - { - "match": "\\b__has_include_next\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_include_next.c" - }, - { - "match": "\\b__has_warning\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__has_warning.c" - }, - { - "match": "\\b__BASE_FILE__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__BASE_FILE__.c" - }, - { - "match": "\\b__FILE_NAME__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__FILE_NAME__.c" - }, - { - "match": "\\b__clang__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__clang__.c" - }, - { - "match": "\\b__clang_major__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__clang_major__.c" - }, - { - "match": "\\b__clang_minor__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__clang_minor__.c" - }, - { - "match": "\\b__clang_patchlevel__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__clang_patchlevel__.c" - }, - { - "match": "\\b__clang_version__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__clang_version__.c" - }, - { - "match": "\\b__fp16\\b", - "name": "entity.name.other.preprocessor.macro.predefined.__fp16.c" - }, - { - "match": "\\b_Float16\\b", - "name": "entity.name.other.preprocessor.macro.predefined._Float16.c" - }, - { - "match": "(\\b__([A-Z_]+)__\\b)", + "match": "\\b(__cplusplus|__DATE__|__FILE__|__LINE__|__STDC__|__STDC_HOSTED__|__STDC_NO_COMPLEX__|__STDC_VERSION__|__STDCPP_THREADS__|__TIME__|NDEBUG|__OBJC__|__ASSEMBLER__|__ATOM__|__AVX__|__AVX2__|_CHAR_UNSIGNED|__CLR_VER|_CONTROL_FLOW_GUARD|__COUNTER__|__cplusplus_cli|__cplusplus_winrt|_CPPRTTI|_CPPUNWIND|_DEBUG|_DLL|__FUNCDNAME__|__FUNCSIG__|__FUNCTION__|_INTEGRAL_MAX_BITS|__INTELLISENSE__|_ISO_VOLATILE|_KERNEL_MODE|_M_AMD64|_M_ARM|_M_ARM_ARMV7VE|_M_ARM_FP|_M_ARM64|_M_CEE|_M_CEE_PURE|_M_CEE_SAFE|_M_FP_EXCEPT|_M_FP_FAST|_M_FP_PRECISE|_M_FP_STRICT|_M_IX86|_M_IX86_FP|_M_X64|_MANAGED|_MSC_BUILD|_MSC_EXTENSIONS|_MSC_FULL_VER|_MSC_VER|_MSVC_LANG|__MSVC_RUNTIME_CHECKS|_MT|_NATIVE_WCHAR_T_DEFINED|_OPENMP|_PREFAST|__TIMESTAMP__|_VC_NO_DEFAULTLIB|_WCHAR_T_DEFINED|_WIN32|_WIN64|_WINRT_DLL|_ATL_VER|_MFC_VER|__GFORTRAN__|__GNUC__|__GNUC_MINOR__|__GNUC_PATCHLEVEL__|__GNUG__|__STRICT_ANSI__|__BASE_FILE__|__INCLUDE_LEVEL__|__ELF__|__VERSION__|__OPTIMIZE__|__OPTIMIZE_SIZE__|__NO_INLINE__|__GNUC_STDC_INLINE__|__CHAR_UNSIGNED__|__WCHAR_UNSIGNED__|__REGISTER_PREFIX__|__REGISTER_PREFIX__|__SIZE_TYPE__|__PTRDIFF_TYPE__|__WCHAR_TYPE__|__WINT_TYPE__|__INTMAX_TYPE__|__UINTMAX_TYPE__|__SIG_ATOMIC_TYPE__|__INT8_TYPE__|__INT16_TYPE__|__INT32_TYPE__|__INT64_TYPE__|__UINT8_TYPE__|__UINT16_TYPE__|__UINT32_TYPE__|__UINT64_TYPE__|__INT_LEAST8_TYPE__|__INT_LEAST16_TYPE__|__INT_LEAST32_TYPE__|__INT_LEAST64_TYPE__|__UINT_LEAST8_TYPE__|__UINT_LEAST16_TYPE__|__UINT_LEAST32_TYPE__|__UINT_LEAST64_TYPE__|__INT_FAST8_TYPE__|__INT_FAST16_TYPE__|__INT_FAST32_TYPE__|__INT_FAST64_TYPE__|__UINT_FAST8_TYPE__|__UINT_FAST16_TYPE__|__UINT_FAST32_TYPE__|__UINT_FAST64_TYPE__|__INTPTR_TYPE__|__UINTPTR_TYPE__|__CHAR_BIT__|__SCHAR_MAX__|__WCHAR_MAX__|__SHRT_MAX__|__INT_MAX__|__LONG_MAX__|__LONG_LONG_MAX__|__WINT_MAX__|__SIZE_MAX__|__PTRDIFF_MAX__|__INTMAX_MAX__|__UINTMAX_MAX__|__SIG_ATOMIC_MAX__|__INT8_MAX__|__INT16_MAX__|__INT32_MAX__|__INT64_MAX__|__UINT8_MAX__|__UINT16_MAX__|__UINT32_MAX__|__UINT64_MAX__|__INT_LEAST8_MAX__|__INT_LEAST16_MAX__|__INT_LEAST32_MAX__|__INT_LEAST64_MAX__|__UINT_LEAST8_MAX__|__UINT_LEAST16_MAX__|__UINT_LEAST32_MAX__|__UINT_LEAST64_MAX__|__INT_FAST8_MAX__|__INT_FAST16_MAX__|__INT_FAST32_MAX__|__INT_FAST64_MAX__|__UINT_FAST8_MAX__|__UINT_FAST16_MAX__|__UINT_FAST32_MAX__|__UINT_FAST64_MAX__|__INTPTR_MAX__|__UINTPTR_MAX__|__WCHAR_MIN__|__WINT_MIN__|__SIG_ATOMIC_MIN__|__SCHAR_WIDTH__|__SHRT_WIDTH__|__INT_WIDTH__|__LONG_WIDTH__|__LONG_LONG_WIDTH__|__PTRDIFF_WIDTH__|__SIG_ATOMIC_WIDTH__|__SIZE_WIDTH__|__WCHAR_WIDTH__|__WINT_WIDTH__|__INT_LEAST8_WIDTH__|__INT_LEAST16_WIDTH__|__INT_LEAST32_WIDTH__|__INT_LEAST64_WIDTH__|__INT_FAST8_WIDTH__|__INT_FAST16_WIDTH__|__INT_FAST32_WIDTH__|__INT_FAST64_WIDTH__|__INTPTR_WIDTH__|__INTMAX_WIDTH__|__SIZEOF_INT__|__SIZEOF_LONG__|__SIZEOF_LONG_LONG__|__SIZEOF_SHORT__|__SIZEOF_POINTER__|__SIZEOF_FLOAT__|__SIZEOF_DOUBLE__|__SIZEOF_LONG_DOUBLE__|__SIZEOF_SIZE_T__|__SIZEOF_WCHAR_T__|__SIZEOF_WINT_T__|__SIZEOF_PTRDIFF_T__|__BYTE_ORDER__|__ORDER_LITTLE_ENDIAN__|__ORDER_BIG_ENDIAN__|__ORDER_PDP_ENDIAN__|__FLOAT_WORD_ORDER__|__DEPRECATED|__EXCEPTIONS|__GXX_RTTI|__USING_SJLJ_EXCEPTIONS__|__GXX_EXPERIMENTAL_CXX0X__|__GXX_WEAK__|__NEXT_RUNTIME__|__LP64__|_LP64|__SSP__|__SSP_ALL__|__SSP_STRONG__|__SSP_EXPLICIT__|__SANITIZE_ADDRESS__|__SANITIZE_THREAD__|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16|__HAVE_SPECULATION_SAFE_VALUE|__GCC_HAVE_DWARF2_CFI_ASM|__FP_FAST_FMA|__FP_FAST_FMAF|__FP_FAST_FMAL|__FP_FAST_FMAF16|__FP_FAST_FMAF32|__FP_FAST_FMAF64|__FP_FAST_FMAF128|__FP_FAST_FMAF32X|__FP_FAST_FMAF64X|__FP_FAST_FMAF128X|__GCC_IEC_559|__GCC_IEC_559_COMPLEX|__NO_MATH_ERRNO__|__has_builtin|__has_feature|__has_extension|__has_cpp_attribute|__has_c_attribute|__has_attribute|__has_declspec_attribute|__is_identifier|__has_include|__has_include_next|__has_warning|__BASE_FILE__|__FILE_NAME__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__fp16|_Float16)\\b", "captures": { "1": { - "name": "entity.name.other.preprocessor.macro.predefined.probably.$2.c" + "name": "entity.name.other.preprocessor.macro.predefined.$1.c" } } + }, + { + "match": "\\b__([A-Z_]+)__\\b", + "name": "entity.name.other.preprocessor.macro.predefined.probably.$1.c" } ] }, "numbers": { - "begin": "(?\\s*)(\\/\\/[!\\/]+))", + "whileCaptures": { + "1": { + "name": "punctuation.definition.comment.continuation.documentation.c" + } + }, + "begin": "(\\/\\/[!\\/]+)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.documentation.c" + } + }, + "patterns": [ + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.italic.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.bold.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.inline.raw.string.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "variable.parameter.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?:\\b[A-Z]+:|@[a-z_]+:)", + "name": "storage.type.class.gtkdoc" + }, + { + "match": "[\\\\@]\\S++(?!(?:\\n|$))", + "name": "invalid.unknown.documentation.command.c" + } + ] + }, + { + "match": "(\\/\\*[!*]+(?=\\s))(.+)([!*]*\\*\\/)", "captures": { "1": { - "name": "keyword.other.unit.hexadecimal.c" + "name": "punctuation.definition.comment.begin.documentation.c" }, "2": { - "name": "constant.numeric.hexadecimal.c", "patterns": [ { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric" + "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.italic.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.bold.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.inline.raw.string.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "variable.parameter.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?:\\b[A-Z]+:|@[a-z_]+:)", + "name": "storage.type.class.gtkdoc" + }, + { + "match": "[\\\\@]\\S++(?!(?:\\n|$))", + "name": "invalid.unknown.documentation.command.c" } ] }, "3": { - "name": "punctuation.separator.constant.numeric" - }, - "4": { - "name": "constant.numeric.hexadecimal.c" - }, - "5": { - "name": "constant.numeric.hexadecimal.c", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric" - } - ] - }, - "6": { - "name": "punctuation.separator.constant.numeric" - }, - "8": { - "name": "keyword.other.unit.exponent.hexadecimal.c" - }, - "9": { - "name": "keyword.operator.plus.exponent.hexadecimal.c" - }, - "10": { - "name": "keyword.operator.minus.exponent.hexadecimal.c" - }, - "11": { - "name": "constant.numeric.exponent.hexadecimal.c", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric" - } - ] - }, - "12": { - "name": "keyword.other.unit.suffix.floating-point.c" + "name": "punctuation.definition.comment.end.documentation.c" } - } + }, + "name": "comment.block.documentation.c" }, { - "match": "(\\G(?=[0-9.])(?!0[xXbB]))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?\\s*)(?![!*]*\\*\\/)((?>\\**)))", + "whileCaptures": { + "1": { + "name": "punctuation.definition.comment.continuation.documentation.c" + } + }, + "begin": "\\G", + "patterns": [ + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.italic.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.bold.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.inline.raw.string.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "variable.parameter.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?:\\b[A-Z]+:|@[a-z_]+:)", + "name": "storage.type.class.gtkdoc" + }, + { + "match": "[\\\\@]\\S++(?!(?:\\n|$))", + "name": "invalid.unknown.documentation.command.c" + } + ] + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.italic.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.bold.doxygen.c" + } + } + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "markup.inline.raw.string.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:a|anchor|b|c|cite|copybrief|copydetail|copydoc|def|dir|dontinclude|e|em|emoji|enum|example|extends|file|idlexcept|implements|include|includedoc|includelineno|latexinclude|link|memberof|namespace|p|package|ref|refitem|related|relates|relatedalso|relatesalso|verbinclude)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:addindex|addtogroup|category|class|defgroup|diafile|dotfile|elseif|fn|headerfile|if|ifnot|image|ingroup|interface|line|mainpage|mscfile|name|overload|page|property|protocol|section|skip|skipline|snippet|snippetdoc|snippetlineno|struct|subpage|subsection|subsubsection|typedef|union|until|vhdlflow|weakgroup)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "captures": { + "1": { + "name": "storage.type.class.doxygen.c" + }, + "2": { + "name": "variable.parameter.c" + } + } + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:arg|attention|author|authors|brief|bug|copyright|date|deprecated|details|exception|invariant|li|note|par|paragraph|param|post|pre|remark|remarks|result|return|returns|retval|sa|see|short|since|test|throw|todo|tparam|version|warning|xrefitem)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?<=[\\s*!\\/])[\\\\@](?:code|cond|docbookonly|dot|htmlonly|internal|latexonly|link|manonly|msc|parblock|rtfonly|secreflist|uml|verbatim|xmlonly|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|enduml|endverbatim|endxmlonly)\\b(?:\\{[^}]*\\})?", + "name": "storage.type.class.doxygen.c" + }, + { + "match": "(?:\\b[A-Z]+:|@[a-z_]+:)", + "name": "storage.type.class.gtkdoc" + }, + { + "match": "[\\\\@]\\S++(?!(?:\\n|$))", + "name": "invalid.unknown.documentation.command.c" + } + ] }, { - "match": "(\\G0[bB])([01](?:[01]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?(?!(?:(?:[0-9a-zA-Z_\\.]|')|(?<=[eEpP])[+-]))", + "match": "^\\/\\* =(\\s*.*?)\\s*= \\*\\/$\\n?", "captures": { "1": { - "name": "keyword.other.unit.binary.c" - }, - "2": { - "name": "constant.numeric.binary.c", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric" - } - ] - }, - "3": { - "name": "punctuation.separator.constant.numeric" - }, - "4": { - "name": "keyword.other.unit.suffix.integer.c" + "name": "meta.toc-list.banner.block.c" + } + }, + "name": "comment.block.banner.c" + }, + { + "name": "comment.block.c", + "begin": "(\\/\\*)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.begin.c" + } + }, + "end": "(\\*\\/)", + "endCaptures": { + "1": { + "name": "punctuation.definition.comment.end.c" } } }, { - "match": "(\\G0)((?:[0-7]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))+)((?:(?:(?:(?:(?:[uU]|[uU]ll?)|[uU]LL?)|ll?[uU]?)|LL?[uU]?)|[fF])(?!\\w))?(?!(?:(?:[0-9a-zA-Z_\\.]|')|(?<=[eEpP])[+-]))", + "match": "^\\/\\/ =(\\s*.*?)\\s*=$\\n?", "captures": { "1": { - "name": "keyword.other.unit.octal.c" - }, - "2": { - "name": "constant.numeric.octal.c", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric" - } - ] - }, - "3": { - "name": "punctuation.separator.constant.numeric" - }, - "4": { - "name": "keyword.other.unit.suffix.integer.c" + "name": "meta.toc-list.banner.line.c" } - } + }, + "name": "comment.line.banner.c" }, { - "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\s+mark)\\s+(.*)", @@ -952,7 +961,6 @@ "name": "variable.other.macro.argument.cpp" }, "preprocessor_conditional_range": { - "while": "(?-mix:(?:^)(?!\\s*+#\\s*(?:else|endif)))", "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:(?:ifndef|ifdef)|if)))", "beginCaptures": { "1": { @@ -987,6 +995,7 @@ "name": "punctuation.definition.directive.cpp" } }, + "end": "(?:^)(?!\\s*+#\\s*(?:else|endif))", "patterns": [ { "name": "meta.preprocessor.conditional.cpp", @@ -1244,9 +1253,6 @@ { "include": "#number_literal" }, - { - "include": "#string_context_c" - }, { "include": "#method_access" }, @@ -1511,266 +1517,275 @@ ] }, "number_literal": { - "begin": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.variadic.cpp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.variadic.cpp" + } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, "ternary_operator": { "applyEndPatternLast": true, "begin": "(\\?)", @@ -9155,9 +8218,6 @@ { "include": "#number_literal" }, - { - "include": "#string_context_c" - }, { "include": "#method_access" }, @@ -9258,7 +8318,7 @@ "include": "#number_literal" }, { - "include": "#string_context_c" + "include": "#string_context" }, { "include": "#comma" @@ -9610,7 +8670,7 @@ "include": "#number_literal" }, { - "include": "#string_context_c" + "include": "#string_context" }, { "include": "#comma" @@ -9971,7 +9031,7 @@ "include": "#number_literal" }, { - "include": "#string_context_c" + "include": "#string_context" }, { "include": "#comma" @@ -12092,7 +11152,7 @@ "include": "#number_literal" }, { - "include": "#string_context_c" + "include": "#string_context" }, { "include": "#comma" @@ -16524,7 +15584,7 @@ }, { "name": "string.quoted.double.raw.sql.cpp", - "begin": "(((?:[uUL]8?)?R)\\\"(?:[pP]?(?:sql|SQL|)|d[dm]l)\\()", + "begin": "(((?:[uUL]8?)?R)\\\"(?:[pP]?(?:sql|SQL)|d[dm]l)\\()", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.cpp" @@ -16533,7 +15593,7 @@ "name": "meta.encoding.cpp" } }, - "end": "(\\)(?:[pP]?(?:sql|SQL|)|d[dm]l)\\\")", + "end": "(\\)(?:[pP]?(?:sql|SQL)|d[dm]l)\\\")", "endCaptures": { "1": { "name": "punctuation.definition.string.end.cpp" @@ -16624,56 +15684,6 @@ } ] }, - "string_context_c": { - "patterns": [ - { - "begin": "\"", - "beginCaptures": { - "0": { - "name": "punctuation.definition.string.begin.cpp" - } - }, - "end": "\"", - "endCaptures": { - "0": { - "name": "punctuation.definition.string.end.cpp" - } - }, - "name": "string.quoted.double.cpp", - "patterns": [ - { - "include": "#string_escapes_context_c" - }, - { - "include": "#line_continuation_character" - } - ] - }, - { - "begin": "(?-mix:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", - "beginCaptures": { - "1": { - "name": "meta.head.function.definition.special.constructor.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "::", - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.constructor.cpp" - }, - { - "match": "(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" - } - } - } - ] - }, - { - "include": "#functional_specifiers_pre_parameters" - }, - { - "begin": "(:)", - "beginCaptures": { - "1": { - "name": "punctuation.separator.initializers.cpp" - } - }, - "end": "(?=\\{)", - "patterns": [ - { - "contentName": "meta.parameter.initialization.cpp", - "begin": "((?(?:(?>[^<>]*)\\g<3>?)+)>)\\s*)?(\\()", - "beginCaptures": { - "1": { - "name": "entity.name.function.call.initializer.cpp" - }, - "2": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "4": { - "name": "punctuation.section.arguments.begin.bracket.round.function.call.initializer.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.function.call.initializer.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - { - "contentName": "meta.parameter.initialization.cpp", - "begin": "((?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.function.definition.special.constructor.cpp" - } - }, - "patterns": [ - { - "include": "#function_body_context" - } - ] - }, - { - "name": "meta.tail.function.definition.special.constructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_destructor_root": { - "name": "meta.function.definition.special.member.destructor.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))~\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", - "beginCaptures": { - "1": { - "name": "meta.head.function.definition.special.member.destructor.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "::", - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.destructor.cpp" - }, - { - "match": "(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" - } - } - } - ] - }, - { - "contentName": "meta.function.definition.parameters.special.member.destructor.cpp", - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parameters.begin.bracket.round.special.member.destructor.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parameters.end.bracket.round.special.member.destructor.cpp" - } - } - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.body.function.definition.special.member.destructor.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.function.definition.special.member.destructor.cpp" - } - }, - "patterns": [ - { - "include": "#function_body_context" - } - ] - }, - { - "name": "meta.tail.function.definition.special.member.destructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_function_definition": { - "name": "meta.function.definition.cpp", - "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:short|signed|unsigned|long)|(?:class|struct|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<69>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<69>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|NULL|true|false|nullptr|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|final|override|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized|audit|axiom|transaction_safe|transaction_safe_dynamic)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<69>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((::)?(?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<69>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\())", - "beginCaptures": { - "1": { - "name": "meta.head.function.definition.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "storage.type.template.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "name": "storage.modifier.$11.cpp" - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "44": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "45": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "46": { - "name": "comment.block.cpp" - }, - "47": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "48": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "49": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "50": { - "name": "comment.block.cpp" - }, - "51": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "52": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "53": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "54": { - "name": "comment.block.cpp" - }, - "55": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "56": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "57": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "58": { - "name": "comment.block.cpp" - }, - "59": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "60": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "61": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "62": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "63": { - "name": "comment.block.cpp" - }, - "64": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "65": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_inner_generated" - } - ] - }, - "66": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - }, - "68": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "70": { - "name": "entity.name.function.definition.cpp" - }, - "71": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "72": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "73": { - "name": "comment.block.cpp" - }, - "74": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.function.definition.cpp" - } - }, - "patterns": [ - { - "include": "#function_body_context" - } - ] - }, - { - "name": "meta.tail.function.definition.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_operator_overload": { - "name": "meta.function.definition.special.operator-overload.cpp", - "begin": "((?:(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:short|signed|unsigned|long)|(?:class|struct|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|NULL|true|false|nullptr|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|final|override|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized|audit|axiom|transaction_safe|transaction_safe_dynamic)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|new|new\\[\\]|delete|delete\\[\\]|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,))|((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\<|\\())", - "beginCaptures": { - "1": { - "name": "meta.head.function.definition.special.operator-overload.cpp" - }, - "2": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "30": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "31": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "32": { - "name": "comment.block.cpp" - }, - "33": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "34": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "35": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "36": { - "name": "comment.block.cpp" - }, - "37": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "38": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "39": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "40": { - "name": "comment.block.cpp" - }, - "41": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "42": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "43": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "44": { - "name": "comment.block.cpp" - }, - "45": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "46": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "47": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "48": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "49": { - "name": "comment.block.cpp" - }, - "50": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "51": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "52": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "53": { - "name": "comment.block.cpp" - }, - "54": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "55": { - "patterns": [ - { - "match": "::", - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.operator.cpp" - }, - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "entity.name.operator.type.reference.cpp" - } - ] - }, - "71": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "72": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "73": { - "name": "comment.block.cpp" - }, - "74": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "75": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "76": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "77": { - "name": "comment.block.cpp" - }, - "78": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "79": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "80": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "81": { - "name": "comment.block.cpp" - }, - "82": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "83": { - "name": "entity.name.operator.type.array.cpp" - }, - "84": { - "name": "entity.name.operator.custom-literal.cpp" - }, - "85": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "86": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "87": { - "name": "comment.block.cpp" - }, - "88": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "89": { - "name": "entity.name.operator.custom-literal.cpp" - }, - "90": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "91": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "92": { - "name": "comment.block.cpp" - }, - "93": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.function.definition.special.operator-overload.cpp" - } - }, - "patterns": [ - { - "include": "#function_body_context" - } - ] - }, - { - "name": "meta.tail.function.definition.special.operator-overload.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_using_namespace": { - "name": "meta.using-namespace.cpp", - "begin": "(?(?:(?>[^<>]*)\\g<7>?)+)>)\\s*)?::)*\\s*+)?((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?(?:(?>[^<>]*)\\g<5>?)+)>)\\s*)?::)*\\s*+)\\s*((?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.namespace.cpp" - } - }, - "patterns": [ - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.namespace.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_extern_block": { - "name": "meta.block.extern.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(extern)(?=\\s*\\\"))", - "beginCaptures": { - "1": { - "name": "meta.head.extern.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "storage.type.extern.cpp" - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.extern.cpp" - } - }, - "patterns": [ - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.extern.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - }, - { - "include": "$self" - } - ] - }, - "macro_safe_typedef_class": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.class.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", - "endCaptures": { - "1": { - "name": "punctuation.terminator.statement.cpp" - }, - "2": { - "name": "punctuation.terminator.statement.cpp" - } - }, - "patterns": [ - { - "name": "meta.head.class.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.class.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#inheritance_context" - }, - { - "include": "#template_call_range" - } - ] - }, - { - "name": "meta.body.class.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.class.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.class.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "11": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "12": { - "name": "comment.block.cpp" - }, - "13": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "14": { - "name": "entity.name.type.alias.cpp" - } - } - }, - { - "match": "," - } - ] - } - ] - } - ] - }, - "macro_safe_typedef_struct": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.struct.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", - "endCaptures": { - "1": { - "name": "punctuation.terminator.statement.cpp" - }, - "2": { - "name": "punctuation.terminator.statement.cpp" - } - }, - "patterns": [ - { - "name": "meta.head.struct.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.struct.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#inheritance_context" - }, - { - "include": "#template_call_range" - } - ] - }, - { - "name": "meta.body.struct.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.struct.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.struct.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "11": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "12": { - "name": "comment.block.cpp" - }, - "13": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "14": { - "name": "entity.name.type.alias.cpp" - } - } - }, - { - "match": "," - } - ] - } - ] - } - ] - }, - "macro_safe_typedef_union": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.union.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", - "endCaptures": { - "1": { - "name": "punctuation.terminator.statement.cpp" - }, - "2": { - "name": "punctuation.terminator.statement.cpp" - } - }, - "patterns": [ - { - "name": "meta.head.union.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.union.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#inheritance_context" - }, - { - "include": "#template_call_range" - } - ] - }, - { - "name": "meta.body.union.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.union.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.union.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "11": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "12": { - "name": "comment.block.cpp" - }, - "13": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "14": { - "name": "entity.name.type.alias.cpp" - } - } - }, - { - "match": "," - } - ] - } - ] - } - ] - }, - "macro_safe_class_block": { - "name": "meta.block.class.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.class.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.class.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.class.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_struct_block": { - "name": "meta.block.struct.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.struct.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.struct.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.struct.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_union_block": { - "name": "meta.block.union.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.union.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.union.cpp" - } - }, - "patterns": [ - { - "include": "#function_pointer" - }, - { - "include": "#static_assert" - }, - { - "include": "#constructor_inline" - }, - { - "include": "#destructor_inline" - }, - { - "include": "$self" - } - ] - }, - { - "name": "meta.tail.union.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_enum_block": { - "name": "meta.block.enum.cpp", - "begin": "(((?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?(::))?\\s*((?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.enum.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#enumerator_list" - }, - { - "include": "#comments" - }, - { - "include": "#comma" - }, - { - "include": "#semicolon" - } - ] - }, - { - "name": "meta.tail.enum.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "macro_safe_template_definition": { - "name": "meta.template.definition.cpp", - "begin": "(?)|(?)", - "endCaptures": { - "1": { - "name": "punctuation.section.angle-brackets.begin.template.call.cpp" - } - }, - "patterns": [ - { - "include": "#template_call_context" - } - ] - }, - { - "include": "#template_definition_context" - } - ] - }, - "macro_safe_block": { - "name": "meta.block.cpp", - "begin": "({)", - "beginCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.cpp" - } - }, - "end": "(}|(?=\\s*#\\s*(?:elif|else|endif)\\b))|(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "keyword.other.static_assert.cpp" - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "name": "punctuation.section.arguments.begin.bracket.round.static_assert.cpp" - } - }, - "end": "(\\))|(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:short|signed|unsigned|long)|(?:class|struct|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|class|struct|union|enum|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|NULL|true|false|nullptr|const|static|volatile|register|restrict|extern|inline|constexpr|mutable|friend|explicit|virtual|final|override|volatile|const|noexcept|constexpr|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|concept|requires|export|thread_local|atomic_cancel|atomic_commit|atomic_noexcept|co_await|co_return|co_yield|import|module|reflexpr|synchronized|audit|axiom|transaction_safe|transaction_safe_dynamic)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", - "beginCaptures": { - "1": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "38": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "39": { - "name": "comment.block.cpp" - }, - "40": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "41": { - "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" - }, - "42": { - "name": "punctuation.definition.function.pointer.dereference.cpp" - }, - "43": { - "name": "variable.other.definition.pointer.function.cpp" - }, - "44": { - "name": "punctuation.definition.begin.bracket.square.cpp" - }, - "45": { - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - "46": { - "name": "punctuation.definition.end.bracket.square.cpp" - }, - "47": { - "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" - }, - "48": { - "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" - } - }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(? 0) puts("\n*************************************************"); return 0; -} \ No newline at end of file +} diff --git a/extensions/cpp/test/colorize-results/test_cpp.json b/extensions/cpp/test/colorize-results/test_cpp.json index f84d916afa3..61f84a15bee 100644 --- a/extensions/cpp/test/colorize-results/test_cpp.json +++ b/extensions/cpp/test/colorize-results/test_cpp.json @@ -198,8 +198,8 @@ } }, { - "c": " ", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp", + "c": " extern \"C\"", + "t": "source.cpp meta.preprocessor.macro.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -208,61 +208,6 @@ "hc_black": "meta.preprocessor: #569CD6" } }, - { - "c": "extern", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp storage.type.extern.cpp", - "r": { - "dark_plus": "storage.type: #569CD6", - "light_plus": "storage.type: #0000FF", - "dark_vs": "storage.type: #569CD6", - "light_vs": "storage.type: #0000FF", - "hc_black": "storage.type: #569CD6" - } - }, - { - "c": " ", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp", - "r": { - "dark_plus": "meta.preprocessor: #569CD6", - "light_plus": "meta.preprocessor: #0000FF", - "dark_vs": "meta.preprocessor: #569CD6", - "light_vs": "meta.preprocessor: #0000FF", - "hc_black": "meta.preprocessor: #569CD6" - } - }, - { - "c": "\"", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "C", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "\"", - "t": "source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, { "c": "class", "t": "source.cpp meta.block.class.cpp meta.head.class.cpp storage.type.class.cpp", diff --git a/extensions/css-language-features/client/src/cssMain.ts b/extensions/css-language-features/client/src/cssMain.ts index ee8c9973d3a..778b9086fd5 100644 --- a/extensions/css-language-features/client/src/cssMain.ts +++ b/extensions/css-language-features/client/src/cssMain.ts @@ -9,9 +9,10 @@ import * as fs from 'fs'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { languages, window, commands, ExtensionContext, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString, workspace } from 'vscode'; +import { languages, window, commands, ExtensionContext, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString, workspace, CompletionItemTag } from 'vscode'; import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Disposable } from 'vscode-languageclient'; import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData'; +import { isArray } from 'util'; // this method is called when vs code is activated export function activate(context: ExtensionContext) { @@ -44,6 +45,32 @@ export function activate(context: ExtensionContext) { }, initializationOptions: { dataPaths + }, + middleware: { + async provideCompletionItem(document, position, context, token, next) { + const result = await next(document, position, context, token); + if (result) { + if (isArray(result)) { + return result.map(r => { + return { + ...r, + tags: (r as any).deprecated ? [CompletionItemTag.Deprecated] : undefined + }; + }); + } else { + return { + isIncomplete: result.isIncomplete, + items: result.items.map(r => { + return { + ...r, + tags: (r as any).deprecated ? [CompletionItemTag.Deprecated] : undefined + }; + }) + }; + } + } + return result; + } } }; diff --git a/extensions/css-language-features/client/src/customData.ts b/extensions/css-language-features/client/src/customData.ts index b812b133ddc..e5fbd4fc9cc 100644 --- a/extensions/css-language-features/client/src/customData.ts +++ b/extensions/css-language-features/client/src/customData.ts @@ -7,6 +7,7 @@ import * as path from 'path'; import { workspace, WorkspaceFolder, extensions } from 'vscode'; interface ExperimentalConfig { + customData?: string[]; experimental?: { customData?: string[]; }; @@ -19,6 +20,21 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol return dataPaths; } + workspaceFolders.forEach(wf => { + const allCssConfig = workspace.getConfiguration(undefined, wf.uri); + const wfCSSConfig = allCssConfig.inspect('css'); + if (wfCSSConfig && wfCSSConfig.workspaceFolderValue && wfCSSConfig.workspaceFolderValue.customData) { + const customData = wfCSSConfig.workspaceFolderValue.customData; + if (Array.isArray(customData)) { + customData.forEach(t => { + if (typeof t === 'string') { + dataPaths.push(path.resolve(wf.uri.fsPath, t)); + } + }); + } + } + }); + workspaceFolders.forEach(wf => { const allCssConfig = workspace.getConfiguration(undefined, wf.uri); const wfCSSConfig = allCssConfig.inspect('css'); @@ -48,7 +64,20 @@ export function getCustomDataPathsFromAllExtensions(): string[] { for (const extension of extensions.all) { const contributes = extension.packageJSON && extension.packageJSON.contributes; - if (contributes && contributes.css && contributes.css.experimental.customData && Array.isArray(contributes.css.experimental.customData)) { + if (contributes && contributes.css && contributes.css.customData && Array.isArray(contributes.css.customData)) { + const relativePaths: string[] = contributes.css.customData; + relativePaths.forEach(rp => { + dataPaths.push(path.resolve(extension.extensionPath, rp)); + }); + } + + if ( + contributes && + contributes.css && + contributes.experimental && + contributes.css.experimental.customData && + Array.isArray(contributes.css.experimental.customData) + ) { const relativePaths: string[] = contributes.css.experimental.customData; relativePaths.forEach(rp => { dataPaths.push(path.resolve(extension.extensionPath, rp)); diff --git a/extensions/css-language-features/package.json b/extensions/css-language-features/package.json index be663d36b7b..3b68a1713ed 100644 --- a/extensions/css-language-features/package.json +++ b/extensions/css-language-features/package.json @@ -34,6 +34,15 @@ "id": "css", "title": "%css.title%", "properties": { + "css.customData": { + "type": "array", + "markdownDescription": "%css.customData.desc%", + "default": [], + "items": { + "type": "string" + }, + "scope": "resource" + }, "css.experimental.customData": { "type": "array", "description": "A list of JSON file paths that define custom CSS data that loads custom properties, at directives, pseudo classes / elements.", @@ -41,7 +50,8 @@ "items": { "type": "string" }, - "scope": "resource" + "scope": "resource", + "deprecationMessage": "This setting is no longe experimental. Use `css.customData` instead." }, "css.completion.triggerPropertyValueCompletion": { "type": "boolean", diff --git a/extensions/css-language-features/package.nls.json b/extensions/css-language-features/package.nls.json index 3e890bfd9bd..afff6cbb234 100644 --- a/extensions/css-language-features/package.nls.json +++ b/extensions/css-language-features/package.nls.json @@ -2,6 +2,7 @@ "displayName": "CSS Language Features", "description": "Provides rich language support for CSS, LESS and SCSS files.", "css.title": "CSS", + "css.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "css.completion.triggerPropertyValueCompletion.desc": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.", "css.lint.argumentsInColorFunction.desc": "Invalid number of parameters.", "css.lint.boxModel.desc": "Do not use `width` or `height` when using `padding` or `border`.", diff --git a/extensions/css-language-features/server/package.json b/extensions/css-language-features/server/package.json index b27fb14aef7..f822ba7c454 100644 --- a/extensions/css-language-features/server/package.json +++ b/extensions/css-language-features/server/package.json @@ -9,7 +9,7 @@ }, "main": "./out/cssServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.3", + "vscode-css-languageservice": "^4.0.3-next.6", "vscode-languageserver": "^5.3.0-next.8" }, "devDependencies": { diff --git a/extensions/css-language-features/server/yarn.lock b/extensions/css-language-features/server/yarn.lock index 1f3a45c0844..d13849f0e64 100644 --- a/extensions/css-language-features/server/yarn.lock +++ b/extensions/css-language-features/server/yarn.lock @@ -781,10 +781,10 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.3: - version "4.0.3-next.3" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.3.tgz#eb7f642f2785d388d74a1a98fd14f7736a11e316" - integrity sha512-6j/y9ccecrq7/APLPEijx+uWHsEdTFH5ZQHG4ZMKjZx6euny27B1wvLCjpxKnZCWcHgmi7cMDLWpUdElvHjjPQ== +vscode-css-languageservice@^4.0.3-next.6: + version "4.0.3-next.6" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.6.tgz#c9b70ae6dc7418d080188ba9772bf47343b929e7" + integrity sha512-Ip9EzhgZmwYEmmTw4oIN8oaZ1gUEJqVDrfcvPJ/bfc9lcYeSxexQ+9O5TiF106nX2g5f93sWYX/rDiAhxSgf4A== dependencies: vscode-languageserver-types "^3.15.0-next.2" vscode-nls "^4.1.1" diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts index 509ca805a98..590caa70822 100644 --- a/extensions/emmet/src/defaultCompletionProvider.ts +++ b/extensions/emmet/src/defaultCompletionProvider.ts @@ -113,21 +113,23 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi const scanner = this.htmlLS.createScanner(document.getText(), node.start); let tokenType = scanner.scan(); let prevAttr = undefined; + let styleAttrValueRange: [number, number] | undefined = undefined; while (tokenType !== TokenType.EOS && (scanner.getTokenEnd() <= positionOffset)) { tokenType = scanner.scan(); if (tokenType === TokenType.AttributeName) { prevAttr = scanner.getTokenText(); } + else if (tokenType === TokenType.AttributeValue && prevAttr === 'style') { + styleAttrValueRange = [scanner.getTokenOffset(), scanner.getTokenEnd()]; + } } - if (prevAttr === 'style') { + if (prevAttr === 'style' && styleAttrValueRange && positionOffset > styleAttrValueRange[0] && positionOffset < styleAttrValueRange[1]) { syntax = 'css'; validateLocation = false; } } } } - - } const extractAbbreviationResults = helper.extractAbbreviation(document, position, !isStyleSheet(syntax)); diff --git a/extensions/emmet/src/test/completion.test.ts b/extensions/emmet/src/test/completion.test.ts new file mode 100644 index 00000000000..1ac7ac1ba80 --- /dev/null +++ b/extensions/emmet/src/test/completion.test.ts @@ -0,0 +1,80 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import 'mocha'; +import { CancellationTokenSource, CompletionTriggerKind, Selection } from 'vscode'; +import { DefaultCompletionItemProvider } from '../defaultCompletionProvider'; +import { closeAllEditors, withRandomFileEditor } from './testUtils'; + +const completionProvider = new DefaultCompletionItemProvider(); + +suite('Tests for completion in CSS embedded in HTML', () => { + teardown(() => { + // close all editors + return closeAllEditors; + }); + + test('style attribute & attribute value in html', async () => { + await testHtmlCompletionProvider('
{ + await testHtmlCompletionProvider(`
di|
`, [ + { label: 'div', documentation: `
|
` } + ]); + }); +}); + +interface TestCompletionItem { + label: string; + + documentation?: string; +} + +function testHtmlCompletionProvider(contents: string, expectedItems: TestCompletionItem[]): Thenable { + const cursorPos = contents.indexOf('|'); + const htmlContents = contents.slice(0, cursorPos) + contents.slice(cursorPos + 1); + + return withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => { + const selection = new Selection(editor.document.positionAt(cursorPos), editor.document.positionAt(cursorPos)); + editor.selection = selection; + const cancelSrc = new CancellationTokenSource(); + const completionPromise = completionProvider.provideCompletionItems( + editor.document, + editor.selection.active, + cancelSrc.token, + { triggerKind: CompletionTriggerKind.Invoke } + ); + if (!completionPromise) { + return Promise.resolve(); + } + + const completionList = await completionPromise; + if (!completionList || !completionList.items || !completionList.items.length) { + return Promise.resolve(); + } + + expectedItems.forEach(eItem => { + const matches = completionList.items.filter(i => i.label === eItem.label); + const match = matches && matches.length > 0 ? matches[0] : undefined; + assert.ok(match, `Didn't find completion item with label ${eItem.label}`); + + if (match) { + assert.equal(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`); + + if (eItem.documentation) { + assert.equal(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`); + } + } + }); + + return Promise.resolve(); + }); +} diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 7d90b4b15f2..b4cbdad0986 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -73,7 +73,7 @@ "config.autofetch": "When enabled, commits will automatically be fetched from the default remote of the current Git repository.", "config.autofetchPeriod": "Duration in seconds between each automatic git fetch, when `git.autofetch` is enabled.", "config.confirmSync": "Confirm before synchronizing git repositories.", - "config.countBadge": "Controls the git badge counter.", + "config.countBadge": "Controls the Git count badge.", "config.countBadge.all": "Count all changes.", "config.countBadge.tracked": "Count only tracked changes.", "config.countBadge.off": "Turn off counter.", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 9aa8d292255..dfc7bb75fb9 100755 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -1260,7 +1260,7 @@ export class CommandCenter { if (documents.length > 0) { const message = documents.length === 1 - ? localize('unsaved files single', "The following file is unsaved and will not be included in the commit if you proceed: {0}.\n\nWould you like to save it before committing?", path.basename(documents[0].uri.fsPath)) + ? localize('unsaved files single', "The following file has unsaved changes which won't be included in the commit if you proceed: {0}.\n\nWould you like to save it before committing?", path.basename(documents[0].uri.fsPath)) : localize('unsaved files', "There are {0} unsaved files.\n\nWould you like to save them before committing?", documents.length); const saveAndCommit = localize('save and commit', "Save All & Commit"); const commit = localize('commit', "Commit Anyway"); diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 412cc5df92f..8208ca6623e 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1628,7 +1628,7 @@ export class Repository { const args = ['for-each-ref', '--format', '%(refname) %(objectname)']; if (opts && opts.sort && opts.sort !== 'alphabetically') { - args.push('--sort', opts.sort); + args.push('--sort', `-${opts.sort}`); } const result = await this.run(args); diff --git a/extensions/grunt/src/main.ts b/extensions/grunt/src/main.ts index 22b6e9e41cd..3756d7522e3 100644 --- a/extensions/grunt/src/main.ts +++ b/extensions/grunt/src/main.ts @@ -127,8 +127,8 @@ class FolderDetector { let options: vscode.ShellExecutionOptions = { cwd: this.workspaceFolder.uri.fsPath }; let source = 'grunt'; let task = gruntTask.indexOf(' ') === -1 - ? new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} ${name}`, options)) - : new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} "${name}"`, options)); + ? new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} ${gruntTask.name}`, options)) + : new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} "${gruntTask.name}"`, options)); return task; } return undefined; @@ -362,4 +362,4 @@ export function activate(_context: vscode.ExtensionContext): void { export function deactivate(): void { detector.dispose(); -} \ No newline at end of file +} diff --git a/extensions/html-language-features/client/src/customData.ts b/extensions/html-language-features/client/src/customData.ts index d716c0ae347..4c89d719539 100644 --- a/extensions/html-language-features/client/src/customData.ts +++ b/extensions/html-language-features/client/src/customData.ts @@ -7,6 +7,7 @@ import * as path from 'path'; import { workspace, WorkspaceFolder, extensions } from 'vscode'; interface ExperimentalConfig { + customData?: string[]; experimental?: { customData?: string[]; }; @@ -23,6 +24,17 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol const allHtmlConfig = workspace.getConfiguration(undefined, wf.uri); const wfHtmlConfig = allHtmlConfig.inspect('html'); + if (wfHtmlConfig && wfHtmlConfig.workspaceFolderValue && wfHtmlConfig.workspaceFolderValue.customData) { + const customData = wfHtmlConfig.workspaceFolderValue.customData; + if (Array.isArray(customData)) { + customData.forEach(t => { + if (typeof t === 'string') { + dataPaths.push(path.resolve(wf.uri.fsPath, t)); + } + }); + } + } + if ( wfHtmlConfig && wfHtmlConfig.workspaceFolderValue && @@ -52,6 +64,19 @@ export function getCustomDataPathsFromAllExtensions(): string[] { if ( contributes && contributes.html && + contributes.html.customData && + Array.isArray(contributes.html.customData) + ) { + const relativePaths: string[] = contributes.html.customData; + relativePaths.forEach(rp => { + dataPaths.push(path.resolve(extension.extensionPath, rp)); + }); + } + + if ( + contributes && + contributes.html && + contributes.html.experimental && contributes.html.experimental.customData && Array.isArray(contributes.html.experimental.customData) ) { diff --git a/extensions/html-language-features/package.json b/extensions/html-language-features/package.json index 3985c07b972..c19eec0cf34 100644 --- a/extensions/html-language-features/package.json +++ b/extensions/html-language-features/package.json @@ -32,6 +32,15 @@ "type": "object", "title": "HTML", "properties": { + "html.customData": { + "type": "array", + "markdownDescription": "%html.customData.desc%", + "default": [], + "items": { + "type": "string" + }, + "scope": "resource" + }, "html.experimental.customData": { "type": "array", "description": "A list of JSON file paths that define custom tags, properties and other HTML syntax constructs. Only workspace folder setting will be read.", @@ -39,7 +48,8 @@ "items": { "type": "string" }, - "scope": "resource" + "scope": "resource", + "deprecationMessage": "This setting is no longe experimental. Use `html.customData` instead." }, "html.format.enable": { "type": "boolean", diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 6a436fa5cb3..2cb7e3d1697 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -1,6 +1,7 @@ { "displayName": "HTML Language Features", "description": "Provides rich language support for HTML and Handlebar files", + "html.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "html.format.enable.desc": "Enable/disable default HTML formatter.", "html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).", "html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.", @@ -24,4 +25,4 @@ "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.", "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.", "html.autoClosingTags": "Enable/disable autoclosing of HTML tags." -} \ No newline at end of file +} diff --git a/extensions/html-language-features/server/package.json b/extensions/html-language-features/server/package.json index 9b26165edbd..ca358e22b9b 100644 --- a/extensions/html-language-features/server/package.json +++ b/extensions/html-language-features/server/package.json @@ -9,8 +9,8 @@ }, "main": "./out/htmlServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.3", - "vscode-html-languageservice": "^3.0.4-next.0", + "vscode-css-languageservice": "^4.0.3-next.6", + "vscode-html-languageservice": "^3.0.4-next.2", "vscode-languageserver": "^5.3.0-next.8", "vscode-languageserver-types": "3.15.0-next.2", "vscode-nls": "^4.1.1", diff --git a/extensions/html-language-features/server/yarn.lock b/extensions/html-language-features/server/yarn.lock index f8687c97f63..4ac895b439c 100644 --- a/extensions/html-language-features/server/yarn.lock +++ b/extensions/html-language-features/server/yarn.lock @@ -229,19 +229,19 @@ supports-color@5.4.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.3: - version "4.0.3-next.3" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.3.tgz#eb7f642f2785d388d74a1a98fd14f7736a11e316" - integrity sha512-6j/y9ccecrq7/APLPEijx+uWHsEdTFH5ZQHG4ZMKjZx6euny27B1wvLCjpxKnZCWcHgmi7cMDLWpUdElvHjjPQ== +vscode-css-languageservice@^4.0.3-next.6: + version "4.0.3-next.6" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.6.tgz#c9b70ae6dc7418d080188ba9772bf47343b929e7" + integrity sha512-Ip9EzhgZmwYEmmTw4oIN8oaZ1gUEJqVDrfcvPJ/bfc9lcYeSxexQ+9O5TiF106nX2g5f93sWYX/rDiAhxSgf4A== dependencies: vscode-languageserver-types "^3.15.0-next.2" vscode-nls "^4.1.1" vscode-uri "^2.0.3" -vscode-html-languageservice@^3.0.4-next.0: - version "3.0.4-next.0" - resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.0.tgz#d4f5a103b94753a19b374158212fe734dbe670e8" - integrity sha512-5Z5ITtokWt/zuPKemKEXfC+4XHoQryBAZVAcTwpAel2qqueUwGqjd5ZrVy/2x5GZAdZAipl0BvsTTMkOBS1BFQ== +vscode-html-languageservice@^3.0.4-next.2: + version "3.0.4-next.2" + resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.2.tgz#afdbe2781daa0a72613afac77068593925bd2e07" + integrity sha512-tlyiflBm/k/PoTwGzg4LL0cwq6wS7mnKxDVYSlY2Iw21dONWINaS0MynYCn6Zs4PzIpgueCSMuTBQTey4d+BBQ== dependencies: vscode-languageserver-types "^3.15.0-next.2" vscode-nls "^4.1.1" diff --git a/extensions/java/cgmanifest.json b/extensions/java/cgmanifest.json index 9a5b5fab2b5..0bf644ce0cf 100644 --- a/extensions/java/cgmanifest.json +++ b/extensions/java/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "atom/language-java", "repositoryUrl": "https://github.com/atom/language-java", - "commitHash": "759a0ac02dc091018a112b25a5a6d894918a0aa8" + "commitHash": "ed8ad7451b4d0454374885a102dbe63befdea509" } }, "license": "MIT", diff --git a/extensions/java/syntaxes/java.tmLanguage.json b/extensions/java/syntaxes/java.tmLanguage.json index 6b4233c8eb3..76044a9cc7d 100644 --- a/extensions/java/syntaxes/java.tmLanguage.json +++ b/extensions/java/syntaxes/java.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-java/commit/759a0ac02dc091018a112b25a5a6d894918a0aa8", + "version": "https://github.com/atom/language-java/commit/ed8ad7451b4d0454374885a102dbe63befdea509", "name": "Java", "scopeName": "source.java", "patterns": [ @@ -379,10 +379,10 @@ "include": "#annotations" }, { - "include": "#member-variables" + "include": "#storage-modifiers" }, { - "include": "#storage-modifiers" + "include": "#member-variables" }, { "include": "#code" diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json index ed16712a061..64493d1483f 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/84238ef0fa1c7e4e2c9fe77875d832dab9f57e5d", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/ce3979047399920f77d79272b3af45b4d86006ac", "name": "JavaScript (with React support)", "scopeName": "source.js", "patterns": [ @@ -2763,7 +2763,7 @@ ] }, "ternary-expression": { - "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)", + "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)", "beginCaptures": { "1": { "name": "keyword.operator.ternary.js" @@ -3153,7 +3153,7 @@ }, { "name": "keyword.operator.logical.js", - "match": "\\!|&&|\\|\\|" + "match": "\\!|&&|\\|\\||\\?\\?" }, { "name": "keyword.operator.bitwise.js", diff --git a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json index ee685716166..ff601095125 100644 --- a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/84238ef0fa1c7e4e2c9fe77875d832dab9f57e5d", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/ce3979047399920f77d79272b3af45b4d86006ac", "name": "JavaScript (with React support)", "scopeName": "source.js.jsx", "patterns": [ @@ -2763,7 +2763,7 @@ ] }, "ternary-expression": { - "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)", + "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)", "beginCaptures": { "1": { "name": "keyword.operator.ternary.js.jsx" @@ -3153,7 +3153,7 @@ }, { "name": "keyword.operator.logical.js.jsx", - "match": "\\!|&&|\\|\\|" + "match": "\\!|&&|\\|\\||\\?\\?" }, { "name": "keyword.operator.bitwise.js.jsx", diff --git a/extensions/json-language-features/server/package.json b/extensions/json-language-features/server/package.json index bf76da32dba..6d99b5f84a4 100644 --- a/extensions/json-language-features/server/package.json +++ b/extensions/json-language-features/server/package.json @@ -14,7 +14,7 @@ "dependencies": { "jsonc-parser": "^2.1.1", "request-light": "^0.2.4", - "vscode-json-languageservice": "^3.3.1", + "vscode-json-languageservice": "^3.3.3", "vscode-languageserver": "^5.3.0-next.8", "vscode-nls": "^4.1.1", "vscode-uri": "^2.0.3" diff --git a/extensions/json-language-features/server/src/jsonServerMain.ts b/extensions/json-language-features/server/src/jsonServerMain.ts index ba1c7a18518..c741c03e3ea 100644 --- a/extensions/json-language-features/server/src/jsonServerMain.ts +++ b/extensions/json-language-features/server/src/jsonServerMain.ts @@ -312,7 +312,7 @@ function validateTextDocument(textDocument: TextDocument, callback?: (diagnostic const jsonDocument = getJSONDocument(textDocument); const version = textDocument.version; - const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' }; + const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' }; languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => { setTimeout(() => { const currDocument = documents.get(textDocument.uri); diff --git a/extensions/json-language-features/server/yarn.lock b/extensions/json-language-features/server/yarn.lock index 3c176e12603..12e39de96af 100644 --- a/extensions/json-language-features/server/yarn.lock +++ b/extensions/json-language-features/server/yarn.lock @@ -54,11 +54,6 @@ https-proxy-agent@^2.2.1: agent-base "^4.1.0" debug "^3.1.0" -jsonc-parser@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.0.tgz#eb0d0c7a3c33048524ce3574c57c7278fb2f1bf3" - integrity sha512-n9GrT8rrr2fhvBbANa1g+xFmgGK5X91KFeDwlKQ3+SJfmH5+tKv/M/kahx/TXOMflfWHKGKqKyfHQaLKTNzJ6w== - jsonc-parser@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" @@ -78,12 +73,12 @@ request-light@^0.2.4: https-proxy-agent "^2.2.1" vscode-nls "^4.0.0" -vscode-json-languageservice@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.1.tgz#4ad2c82db849a7bbe54fcbf5c9b3a2ed26dc8fee" - integrity sha512-Qyvlrftexu1acvwbMt+CDehVrDZtFV1GAJrKdOCHQL9bWNhzI06KEiSd4iXR0NUOuAdroG/uU4wBkH6e5CcTXg== +vscode-json-languageservice@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.3.3.tgz#f7e512a2cd5e82fecbebf507d6fceaea47661297" + integrity sha512-5vL3OXTUuQpn6+tGd47dopio+7WwbtIZ07zfYMzAUX8eVWPZjfEsLeSWmQk5Xw+vwgu+j5zC4koz5UofLDGGRA== dependencies: - jsonc-parser "^2.1.0" + jsonc-parser "^2.1.1" vscode-languageserver-types "^3.15.0-next.2" vscode-nls "^4.1.1" vscode-uri "^2.0.3" diff --git a/extensions/json/package.json b/extensions/json/package.json index e23e86b14a6..6ef4b971691 100644 --- a/extensions/json/package.json +++ b/extensions/json/package.json @@ -50,8 +50,7 @@ ".babelrc", ".jsonc", ".eslintrc", - ".eslintrc.json", - "tslint.json" + ".eslintrc.json" ], "configuration": "./language-configuration.json" } diff --git a/extensions/make/cgmanifest.json b/extensions/make/cgmanifest.json index c5a402aa39e..5407e8b07c6 100644 --- a/extensions/make/cgmanifest.json +++ b/extensions/make/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "fadeevab/make.tmbundle", "repositoryUrl": "https://github.com/fadeevab/make.tmbundle", - "commitHash": "1b05209b483f81f42270bdda5514590e013e4896" + "commitHash": "fa280d2f20b0b63dc7c11b6001e9257e2c67f826" } }, "licenseDetail": [ diff --git a/extensions/make/syntaxes/make.tmLanguage.json b/extensions/make/syntaxes/make.tmLanguage.json index bdb08837c26..fd184ee1d48 100644 --- a/extensions/make/syntaxes/make.tmLanguage.json +++ b/extensions/make/syntaxes/make.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/fadeevab/make.tmbundle/commit/1b05209b483f81f42270bdda5514590e013e4896", + "version": "https://github.com/fadeevab/make.tmbundle/commit/fa280d2f20b0b63dc7c11b6001e9257e2c67f826", "name": "Makefile", "scopeName": "source.makefile", "patterns": [ diff --git a/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json b/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json index 3fe94d8cf7e..61b975b7015 100644 --- a/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json +++ b/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/eb3898715b50d7911377a650e383a768a3a21f25", + "version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/00b05ebe6850083664d92d0eba6e5ee8f153baa6", "name": "Markdown", "scopeName": "text.html.markdown", "patterns": [ @@ -70,11 +70,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -103,11 +103,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -136,11 +136,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -169,11 +169,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -202,11 +202,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -235,11 +235,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -268,11 +268,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -294,18 +294,18 @@ ] }, "fenced_code_block_r": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(R|r|s|S|Rprofile)(\\s+[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(R|r|s|S|Rprofile|\\{\\.r.+?\\})(\\s+[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -334,11 +334,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -367,11 +367,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -403,11 +403,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -436,11 +436,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -469,11 +469,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -502,11 +502,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -535,11 +535,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -568,11 +568,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -601,11 +601,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -634,11 +634,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -667,11 +667,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -700,11 +700,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -716,7 +716,7 @@ { "begin": "(^|\\G)(\\s*)(.*)", "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", - "contentName": "meta.embedded.block.cpp", + "contentName": "meta.embedded.block.cpp source.cpp", "patterns": [ { "include": "source.cpp" @@ -733,11 +733,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -766,11 +766,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -799,11 +799,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -832,11 +832,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -865,11 +865,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -898,11 +898,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -931,11 +931,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -957,18 +957,18 @@ ] }, "fenced_code_block_js": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs)(\\s+[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs|\\{\\.js.+?\\})(\\s+[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -997,11 +997,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1030,11 +1030,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1063,11 +1063,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1096,11 +1096,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1129,11 +1129,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1162,11 +1162,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1195,11 +1195,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1228,11 +1228,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1261,11 +1261,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1287,18 +1287,18 @@ ] }, "fenced_code_block_python": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\\s+[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi|\\{\\.python.+?\\})(\\s+[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1327,11 +1327,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1353,18 +1353,18 @@ ] }, "fenced_code_block_rust": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(rust|rs)(\\s+[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(rust|rs|\\{\\.rust.+?\\})(\\s+[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1393,11 +1393,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1419,18 +1419,18 @@ ] }, "fenced_code_block_shell": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\\s+[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\{\\.bash.+?\\})(\\s+[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1459,11 +1459,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1492,11 +1492,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1525,11 +1525,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1558,11 +1558,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1591,11 +1591,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1624,11 +1624,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { @@ -1657,11 +1657,11 @@ "3": { "name": "punctuation.definition.markdown" }, - "5": { - "name": "fenced_code.block.language" + "4": { + "name": "fenced_code.block.language.markdown" }, - "6": { - "name": "fenced_code.block.language.attributes" + "5": { + "name": "fenced_code.block.language.attributes.markdown" } }, "endCaptures": { diff --git a/extensions/markdown-language-features/src/features/preview.ts b/extensions/markdown-language-features/src/features/preview.ts index 3ee4d26f4f2..e3de041cf58 100644 --- a/extensions/markdown-language-features/src/features/preview.ts +++ b/extensions/markdown-language-features/src/features/preview.ts @@ -140,9 +140,9 @@ export class MarkdownPreview extends Disposable { MarkdownPreview.viewType, MarkdownPreview.getPreviewTitle(resource, locked), previewColumn, { - enableFindWidget: true, - ...MarkdownPreview.getWebviewOptions(resource, contributionProvider.contributions) - }); + enableFindWidget: true, + ...MarkdownPreview.getWebviewOptions(resource, contributionProvider.contributions) + }); return new MarkdownPreview( webview, @@ -271,7 +271,6 @@ export class MarkdownPreview extends Disposable { } public dispose() { - super.dispose(); if (this._disposed) { return; } @@ -282,6 +281,7 @@ export class MarkdownPreview extends Disposable { this._onDidChangeViewStateEmitter.dispose(); this.editor.dispose(); + super.dispose(); } public update(resource: vscode.Uri) { diff --git a/extensions/markdown-language-features/src/security.ts b/extensions/markdown-language-features/src/security.ts index 89a9667e134..7eeab6added 100644 --- a/extensions/markdown-language-features/src/security.ts +++ b/extensions/markdown-language-features/src/security.ts @@ -134,10 +134,10 @@ export class PreviewSecuritySelector { description: localize('toggleSecurityWarning.description', 'Does not affect the content security level') }, ], { - placeHolder: localize( - 'preview.showPreviewSecuritySelector.title', - 'Select security settings for Markdown previews in this workspace'), - }); + placeHolder: localize( + 'preview.showPreviewSecuritySelector.title', + 'Select security settings for Markdown previews in this workspace'), + }); if (!selection) { return; } diff --git a/extensions/npm/package.nls.json b/extensions/npm/package.nls.json index 4a33bcc0bc3..40121b8fa8d 100644 --- a/extensions/npm/package.nls.json +++ b/extensions/npm/package.nls.json @@ -5,7 +5,7 @@ "config.npm.runSilent": "Run npm commands with the `--silent` option.", "config.npm.packageManager": "The package manager used to run scripts.", "config.npm.exclude": "Configure glob patterns for folders that should be excluded from automatic script detection.", - "config.npm.enableScriptExplorer": "Enable an explorer view for npm scripts.", + "config.npm.enableScriptExplorer": "Enable an explorer view for npm scripts when there is no top-level 'package.json' file.", "config.npm.scriptExplorerAction": "The default click action used in the scripts explorer: `open` or `run`, the default is `open`.", "config.npm.fetchOnlinePackageInfo": "Fetch data from https://registry.npmjs/org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.", "npm.parseError": "Npm task detection: failed to parse the file {0}", diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts index 9bcd272a958..f01e8121719 100644 --- a/extensions/npm/src/npmView.ts +++ b/extensions/npm/src/npmView.ts @@ -145,25 +145,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { subscriptions.push(commands.registerCommand('npm.runInstall', this.runInstall, this)); } - private scriptIsValid(scripts: any, task: Task): boolean { - for (const script in scripts) { - let label = getTaskName(script, task.definition.path); - if (task.name === label) { - return true; - } - } - return false; - } - private async runScript(script: NpmScript) { - let task = script.task; - let uri = getPackageJsonUriFromTask(task); - let scripts = await getScripts(uri!); - - if (!this.scriptIsValid(scripts, task)) { - this.scriptNotValid(task); - return; - } tasks.executeTask(script.task); } @@ -176,11 +158,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { let uri = getPackageJsonUriFromTask(task); let scripts = await getScripts(uri!); - if (!this.scriptIsValid(scripts, task)) { - this.scriptNotValid(task); - return; - } - let debugArg = this.extractDebugArg(scripts, task); if (!debugArg) { let message = localize('noDebugOptions', 'Could not launch "{0}" for debugging because the scripts lacks a node debug option, e.g. "--inspect-brk".', task.name); @@ -195,11 +172,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { startDebugging(task.name, debugArg[0], debugArg[1], script.getFolder()); } - private scriptNotValid(task: Task) { - let message = localize('scriptInvalid', 'Could not find the script "{0}". Try to refresh the view.', task.name); - window.showErrorMessage(message); - } - private findScript(document: TextDocument, script?: NpmScript): number { let scriptOffset = 0; let inScripts = false; @@ -258,7 +230,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { let document: TextDocument = await workspace.openTextDocument(uri); let offset = this.findScript(document, selection instanceof NpmScript ? selection : undefined); let position = document.positionAt(offset); - await window.showTextDocument(document, { selection: new Selection(position, position) }); + await window.showTextDocument(document, { preserveFocus: true, selection: new Selection(position, position) }); } public refresh() { @@ -353,4 +325,4 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { } return [...folders.values()]; } -} \ No newline at end of file +} diff --git a/extensions/objective-c/cgmanifest.json b/extensions/objective-c/cgmanifest.json index f33f55aad69..5f9ee15e2c1 100644 --- a/extensions/objective-c/cgmanifest.json +++ b/extensions/objective-c/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "9c4f4b3291538d9f5144f02d3b6af877b84f2cb2" + "commitHash": "218448eb46260864352d569db13be6cb20767e92" } }, "license": "MIT", diff --git a/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json b/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json index d9d1cfa5584..cbfc86907a2 100644 --- a/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json +++ b/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/9c4f4b3291538d9f5144f02d3b6af877b84f2cb2", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/218448eb46260864352d569db13be6cb20767e92", "name": "Objective-C++", "scopeName": "source.objcpp", "patterns": [ diff --git a/extensions/objective-c/syntaxes/objective-c.tmLanguage.json b/extensions/objective-c/syntaxes/objective-c.tmLanguage.json index e08731bb134..389300da8aa 100644 --- a/extensions/objective-c/syntaxes/objective-c.tmLanguage.json +++ b/extensions/objective-c/syntaxes/objective-c.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/9c4f4b3291538d9f5144f02d3b6af877b84f2cb2", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/218448eb46260864352d569db13be6cb20767e92", "name": "Objective-C", "scopeName": "source.objc", "patterns": [ diff --git a/extensions/package.json b/extensions/package.json index 5c73fcbd3d7..ed5fcecf4cb 100644 --- a/extensions/package.json +++ b/extensions/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "Dependencies shared by all extensions", "dependencies": { - "typescript": "3.6.1-rc" + "typescript": "3.6.2" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/powershell/cgmanifest.json b/extensions/powershell/cgmanifest.json index c8dcfd7cc80..04444f36174 100644 --- a/extensions/powershell/cgmanifest.json +++ b/extensions/powershell/cgmanifest.json @@ -14,4 +14,4 @@ } ], "version": 1 -} +} \ No newline at end of file diff --git a/extensions/swift/syntaxes/swift.tmLanguage.json b/extensions/swift/syntaxes/swift.tmLanguage.json index 2e2148073db..2d67b7a13e1 100644 --- a/extensions/swift/syntaxes/swift.tmLanguage.json +++ b/extensions/swift/syntaxes/swift.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/textmate/swift.tmbundle/commit/bdc8ae07562060a566b33da3f62601bb5aababd1", + "version": "https://github.com/textmate/swift.tmbundle/commit/3f582e9acc1613745b06a56be55ba2a032c458eb", "name": "Swift", "scopeName": "source.swift", "comment": "See swift.tmbundle/grammar-test.swift for test cases.", @@ -2759,10 +2759,13 @@ } }, "comment": "SE-0168: Multi-Line String Literals", - "end": "\"\"\"", + "end": "\"\"\"(#*)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" } }, "name": "string.quoted.double.block.swift", @@ -2785,6 +2788,66 @@ } ] }, + { + "begin": "#\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.swift" + } + }, + "end": "\"\"\"#(#*)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "name": "string.quoted.double.block.raw.swift", + "patterns": [ + { + "match": "\\G.+(?=\"\"\")|\\G.+", + "name": "invalid.illegal.content-after-opening-delimiter.swift" + }, + { + "match": "\\\\#\\s*\\n", + "name": "constant.character.escape.newline.swift" + }, + { + "include": "#raw-string-guts" + }, + { + "comment": "Allow \\(\"\"\"...\"\"\") to appear inside a block string", + "match": "\\S((?!\\\\#\\().)*(?=\"\"\")", + "name": "invalid.illegal.content-before-closing-delimiter.swift" + } + ] + }, + { + "begin": "(##+)\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.swift" + } + }, + "end": "\"\"\"\\1(#*)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "name": "string.quoted.double.block.raw.swift", + "patterns": [ + { + "match": "\\G.+(?=\"\"\")|\\G.+", + "name": "invalid.illegal.content-after-opening-delimiter.swift" + } + ] + }, { "begin": "\"", "beginCaptures": { @@ -2792,10 +2855,13 @@ "name": "punctuation.definition.string.begin.swift" } }, - "end": "\"", + "end": "\"(#*)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" } }, "name": "string.quoted.double.single-line.swift", @@ -2808,9 +2874,108 @@ "include": "#string-guts" } ] + }, + { + "begin": "(##+)\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.raw.swift" + } + }, + "comment": "SE-0168: raw string literals (more than one #, grammar limitations prevent us from supporting escapes)", + "end": "\"\\1(#*)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.raw.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "name": "string.quoted.double.single-line.raw.swift", + "patterns": [ + { + "match": "\\r|\\n", + "name": "invalid.illegal.returns-not-allowed.swift" + } + ] + }, + { + "begin": "#\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.raw.swift" + } + }, + "comment": "SE-0168: raw string literals (one #, escapes supported)", + "end": "\"#(#*)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.raw.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "name": "string.quoted.double.single-line.raw.swift", + "patterns": [ + { + "match": "\\r|\\n", + "name": "invalid.illegal.returns-not-allowed.swift" + }, + { + "include": "#raw-string-guts" + } + ] } ], "repository": { + "raw-string-guts": { + "comment": "the same as #string-guts but with # in escapes", + "patterns": [ + { + "match": "\\\\#[0\\\\tnr\"']", + "name": "constant.character.escape.swift" + }, + { + "match": "\\\\#u\\{[0-9a-fA-F]{1,8}\\}", + "name": "constant.character.escape.unicode.swift" + }, + { + "begin": "\\\\#\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.swift" + } + }, + "contentName": "source.swift", + "end": "(\\))", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.swift" + }, + "1": { + "name": "source.swift" + } + }, + "name": "meta.embedded.line.swift", + "patterns": [ + { + "include": "$self" + }, + { + "begin": "\\(", + "comment": "Nested parens", + "end": "\\)" + } + ] + }, + { + "match": "\\\\#.", + "name": "invalid.illegal.escape-not-recognized" + } + ] + }, "string-guts": { "patterns": [ { diff --git a/extensions/typescript-basics/cgmanifest.json b/extensions/typescript-basics/cgmanifest.json index 077f5f0424e..692891f15c2 100644 --- a/extensions/typescript-basics/cgmanifest.json +++ b/extensions/typescript-basics/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "TypeScript-TmLanguage", "repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage", - "commitHash": "84238ef0fa1c7e4e2c9fe77875d832dab9f57e5d" + "commitHash": "ce3979047399920f77d79272b3af45b4d86006ac" } }, "license": "MIT", diff --git a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json index 3d1b37da01e..20833396bac 100644 --- a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/84238ef0fa1c7e4e2c9fe77875d832dab9f57e5d", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/ce3979047399920f77d79272b3af45b4d86006ac", "name": "TypeScript", "scopeName": "source.ts", "patterns": [ @@ -2760,7 +2760,7 @@ ] }, "ternary-expression": { - "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)", + "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)", "beginCaptures": { "1": { "name": "keyword.operator.ternary.ts" @@ -3202,7 +3202,7 @@ }, { "name": "keyword.operator.logical.ts", - "match": "\\!|&&|\\|\\|" + "match": "\\!|&&|\\|\\||\\?\\?" }, { "name": "keyword.operator.bitwise.ts", diff --git a/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json index d50da9102c9..7e225582e1e 100644 --- a/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/84238ef0fa1c7e4e2c9fe77875d832dab9f57e5d", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/ce3979047399920f77d79272b3af45b4d86006ac", "name": "TypeScriptReact", "scopeName": "source.tsx", "patterns": [ @@ -2763,7 +2763,7 @@ ] }, "ternary-expression": { - "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)", + "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)", "beginCaptures": { "1": { "name": "keyword.operator.ternary.tsx" @@ -3153,7 +3153,7 @@ }, { "name": "keyword.operator.logical.tsx", - "match": "\\!|&&|\\|\\|" + "match": "\\!|&&|\\|\\||\\?\\?" }, { "name": "keyword.operator.bitwise.tsx", diff --git a/extensions/typescript-basics/test/colorize-results/test-jsdoc-markdown_ts.json b/extensions/typescript-basics/test/colorize-results/test-jsdoc-markdown_ts.json index eea45a645eb..22ccb1e8972 100644 --- a/extensions/typescript-basics/test/colorize-results/test-jsdoc-markdown_ts.json +++ b/extensions/typescript-basics/test/colorize-results/test-jsdoc-markdown_ts.json @@ -89,7 +89,7 @@ }, { "c": "js", - "t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown", + "t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown fenced_code.block.language.markdown", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", diff --git a/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts b/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts index 9273683ba4c..dbc10ea2e26 100644 --- a/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts +++ b/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts @@ -102,15 +102,15 @@ async function goToProjectConfig( ? localize('typescript.noTypeScriptProjectConfig', 'File is not part of a TypeScript project. Click [here]({0}) to learn more.', 'https://go.microsoft.com/fwlink/?linkid=841896') : localize('typescript.noJavaScriptProjectConfig', 'File is not part of a JavaScript project Click [here]({0}) to learn more.', 'https://go.microsoft.com/fwlink/?linkid=759670') ), { - title: isTypeScriptProject - ? localize('typescript.configureTsconfigQuickPick', 'Configure tsconfig.json') - : localize('typescript.configureJsconfigQuickPick', 'Configure jsconfig.json'), - id: ProjectConfigAction.CreateConfig, - }); + title: isTypeScriptProject + ? localize('typescript.configureTsconfigQuickPick', 'Configure tsconfig.json') + : localize('typescript.configureJsconfigQuickPick', 'Configure jsconfig.json'), + id: ProjectConfigAction.CreateConfig, + }); switch (selected && selected.id) { case ProjectConfigAction.CreateConfig: openOrCreateConfigFile(isTypeScriptProject, rootPath, client.configuration); return; } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/features/completions.ts b/extensions/typescript-language-features/src/features/completions.ts index fdfabd4365f..0f5aa0560d9 100644 --- a/extensions/typescript-language-features/src/features/completions.ts +++ b/extensions/typescript-language-features/src/features/completions.ts @@ -280,8 +280,8 @@ class ApplyCompletionCodeActionCommand implements Command { description: '', index: i })), { - placeHolder: localize('selectCodeAction', 'Select code action to apply') - } + placeHolder: localize('selectCodeAction', 'Select code action to apply') + } ); if (!selection) { diff --git a/extensions/typescript-language-features/src/features/refactor.ts b/extensions/typescript-language-features/src/features/refactor.ts index 6b0d33a2bb9..9b7bd258280 100644 --- a/extensions/typescript-language-features/src/features/refactor.ts +++ b/extensions/typescript-language-features/src/features/refactor.ts @@ -14,7 +14,7 @@ import { VersionDependentRegistration } from '../utils/dependentRegistration'; import TelemetryReporter from '../utils/telemetry'; import * as typeConverters from '../utils/typeConverters'; import FormattingOptionsManager from './fileConfigurationManager'; -import { file } from '../utils/fileSchemes'; +import * as fileSchemes from '../utils/fileSchemes'; const localize = nls.loadMessageBundle(); @@ -30,11 +30,15 @@ class ApplyRefactoringCommand implements Command { public async execute( document: vscode.TextDocument, - file: string, refactor: string, action: string, range: vscode.Range ): Promise { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return false; + } + /* __GDPR__ "refactor.execute" : { "action" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, @@ -81,7 +85,7 @@ class ApplyRefactoringCommand implements Command { const workspaceEdit = new vscode.WorkspaceEdit(); for (const edit of body.edits) { const resource = this.client.toResource(edit.fileName); - if (resource.scheme === file) { + if (resource.scheme === fileSchemes.file) { workspaceEdit.createFile(resource, { ignoreIfExists: true }); } } @@ -95,15 +99,19 @@ class SelectRefactorCommand implements Command { public readonly id = SelectRefactorCommand.ID; constructor( + private readonly client: ITypeScriptServiceClient, private readonly doRefactoring: ApplyRefactoringCommand ) { } public async execute( document: vscode.TextDocument, - file: string, info: Proto.ApplicableRefactorInfo, range: vscode.Range ): Promise { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return false; + } const selected = await vscode.window.showQuickPick(info.actions.map((action): vscode.QuickPickItem => ({ label: action.name, description: action.description, @@ -111,7 +119,7 @@ class SelectRefactorCommand implements Command { if (!selected) { return false; } - return this.doRefactoring.execute(document, file, info.name, selected.label, range); + return this.doRefactoring.execute(document, info.name, selected.label, range); } } @@ -130,7 +138,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { telemetryReporter: TelemetryReporter ) { const doRefactoringCommand = commandManager.register(new ApplyRefactoringCommand(this.client, telemetryReporter)); - commandManager.register(new SelectRefactorCommand(doRefactoringCommand)); + commandManager.register(new SelectRefactorCommand(this.client, doRefactoringCommand)); } public static readonly metadata: vscode.CodeActionProviderMetadata = { @@ -146,29 +154,30 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { if (!this.shouldTrigger(rangeOrSelection, context)) { return undefined; } - - const file = this.client.toOpenedFilePath(document); - if (!file) { + if (!this.client.toOpenedFilePath(document)) { return undefined; } - const args: Proto.GetApplicableRefactorsRequestArgs = typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection); const response = await this.client.interruptGetErr(() => { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return undefined; + } this.formattingOptionsManager.ensureConfigurationForDocument(document, token); + const args: Proto.GetApplicableRefactorsRequestArgs = typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection); return this.client.execute('getApplicableRefactors', args, token); }); - if (response.type !== 'response' || !response.body) { + if (!response || response.type !== 'response' || !response.body) { return undefined; } - return this.convertApplicableRefactors(response.body, document, file, rangeOrSelection); + return this.convertApplicableRefactors(response.body, document, rangeOrSelection); } private convertApplicableRefactors( body: Proto.ApplicableRefactorInfo[], document: vscode.TextDocument, - file: string, rangeOrSelection: vscode.Range | vscode.Selection ) { const actions: vscode.CodeAction[] = []; @@ -178,12 +187,12 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { codeAction.command = { title: info.description, command: SelectRefactorCommand.ID, - arguments: [document, file, info, rangeOrSelection] + arguments: [document, info, rangeOrSelection] }; actions.push(codeAction); } else { for (const action of info.actions) { - actions.push(this.refactorActionToCodeAction(action, document, file, info, rangeOrSelection)); + actions.push(this.refactorActionToCodeAction(action, document, info, rangeOrSelection)); } } } @@ -193,7 +202,6 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { private refactorActionToCodeAction( action: Proto.RefactorActionInfo, document: vscode.TextDocument, - file: string, info: Proto.ApplicableRefactorInfo, rangeOrSelection: vscode.Range | vscode.Selection ) { @@ -201,7 +209,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { codeAction.command = { title: action.description, command: ApplyRefactoringCommand.ID, - arguments: [document, file, info.name, action.name, rangeOrSelection], + arguments: [document, info.name, action.name, rangeOrSelection], }; codeAction.isPreferred = TypeScriptRefactorProvider.isPreferred(action); return codeAction; diff --git a/extensions/typescript-language-features/src/features/signatureHelp.ts b/extensions/typescript-language-features/src/features/signatureHelp.ts index 189185a37fc..f7ad9ad7ee9 100644 --- a/extensions/typescript-language-features/src/features/signatureHelp.ts +++ b/extensions/typescript-language-features/src/features/signatureHelp.ts @@ -112,7 +112,7 @@ export function register( ) { return vscode.languages.registerSignatureHelpProvider(selector, new TypeScriptSignatureHelpProvider(client), { - triggerCharacters: TypeScriptSignatureHelpProvider.triggerCharacters, - retriggerCharacters: TypeScriptSignatureHelpProvider.retriggerCharacters - }); -} \ No newline at end of file + triggerCharacters: TypeScriptSignatureHelpProvider.triggerCharacters, + retriggerCharacters: TypeScriptSignatureHelpProvider.retriggerCharacters + }); +} diff --git a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts index 102658ecf01..9333e6f75c0 100644 --- a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts +++ b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts @@ -141,21 +141,21 @@ class UpdateImportsOnFileRenameHandler extends Disposable { const response = await vscode.window.showInformationMessage( localize('prompt', "Update imports for moved file: '{0}'?", path.basename(newResource.fsPath)), { - modal: true, - }, { - title: localize('reject.title', "No"), - choice: Choice.Reject, - isCloseAffordance: true, - }, { - title: localize('accept.title', "Yes"), - choice: Choice.Accept, - }, { - title: localize('always.title', "Always automatically update imports"), - choice: Choice.Always, - }, { - title: localize('never.title', "Never automatically update imports"), - choice: Choice.Never, - }); + modal: true, + }, { + title: localize('reject.title', "No"), + choice: Choice.Reject, + isCloseAffordance: true, + }, { + title: localize('accept.title', "Yes"), + choice: Choice.Accept, + }, { + title: localize('always.title', "Always automatically update imports"), + choice: Choice.Always, + }, { + title: localize('never.title', "Never automatically update imports"), + choice: Choice.Never, + }); if (!response) { return false; diff --git a/extensions/typescript-language-features/src/utils/previewer.ts b/extensions/typescript-language-features/src/utils/previewer.ts index f4a17274960..2b2108ccd57 100644 --- a/extensions/typescript-language-features/src/utils/previewer.ts +++ b/extensions/typescript-language-features/src/utils/previewer.ts @@ -11,14 +11,26 @@ function getTagBodyText(tag: Proto.JSDocTagInfo): string | undefined { return undefined; } + // Convert to markdown code block if it is not already one + function makeCodeblock(text: string): string { + if (text.match(/^\s*[~`]{3}/g)) { + return text; + } + return '```\n' + text + '\n```'; + } + switch (tag.name) { case 'example': - case 'default': - // Convert to markdown code block if it is not already one - if (tag.text.match(/^\s*[~`]{3}/g)) { - return tag.text; + // check for caption tags, fix for #79704 + const captionTagMatches = tag.text.match(/(.*?)<\/caption>\s*(\r\n|\n)/); + if (captionTagMatches && captionTagMatches.index === 0) { + return captionTagMatches[1] + '\n\n' + makeCodeblock(tag.text.substr(captionTagMatches[0].length)); + } else { + return makeCodeblock(tag.text); } - return '```\n' + tag.text + '\n```'; + + case 'default': + return makeCodeblock(tag.text); } return tag.text; diff --git a/extensions/typescript-language-features/src/utils/surveyor.ts b/extensions/typescript-language-features/src/utils/surveyor.ts index 2af183be12e..a98e84f7c33 100644 --- a/extensions/typescript-language-features/src/utils/surveyor.ts +++ b/extensions/typescript-language-features/src/utils/surveyor.ts @@ -165,12 +165,12 @@ export class Surveyor extends Disposable { title: localize('takeShortSurvey', "Take Short Survey"), choice: Choice.GoToSurvey }, { - title: localize('remindLater', "Remind Me Later"), - choice: Choice.RemindLater - }, { - title: localize('neverAgain', "Disable JS/TS Surveys"), - choice: Choice.NeverAgain - }); + title: localize('remindLater', "Remind Me Later"), + choice: Choice.RemindLater + }, { + title: localize('neverAgain', "Disable JS/TS Surveys"), + choice: Choice.NeverAgain + }); switch (response && response.choice) { case Choice.GoToSurvey: @@ -211,4 +211,4 @@ export class Surveyor extends Disposable { const config = vscode.workspace.getConfiguration('typescript'); config.update('surveys.enabled', false); } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/utils/typingsStatus.ts b/extensions/typescript-language-features/src/utils/typingsStatus.ts index 066fda960df..70418b736a6 100644 --- a/extensions/typescript-language-features/src/utils/typingsStatus.ts +++ b/extensions/typescript-language-features/src/utils/typingsStatus.ts @@ -111,9 +111,9 @@ export class AtaProgressReporter { "Could not install typings files for JavaScript language features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings. Click [here]({0}) to learn more.", 'https://go.microsoft.com/fwlink/?linkid=847635' ), { - title: localize('typesInstallerInitializationFailed.doNotCheckAgain', "Don't Show Again"), - id: 1 - } + title: localize('typesInstallerInitializationFailed.doNotCheckAgain', "Don't Show Again"), + id: 1 + } ).then(selected => { if (!selected) { return; diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/env.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/env.test.ts index 112c76139b7..b0dfa3e1145 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/env.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/env.test.ts @@ -28,20 +28,20 @@ suite('env-namespace', () => { test('env.remoteName', function () { const remoteName = env.remoteName; - const apiTestExtension = extensions.getExtension('vscode.vscode-api-tests'); - const testResolverExtension = extensions.getExtension('vscode.vscode-test-resolver'); + const knownWorkspaceExtension = extensions.getExtension('vscode.git'); + const knownUiExtension = extensions.getExtension('vscode.git-ui'); if (typeof remoteName === 'undefined') { - assert.ok(apiTestExtension); - assert.ok(testResolverExtension); - assert.equal(ExtensionKind.UI, apiTestExtension!.extensionKind); - assert.equal(ExtensionKind.UI, testResolverExtension!.extensionKind); + // not running in remote, so we expect both extensions + assert.ok(knownWorkspaceExtension); + assert.ok(knownUiExtension); + assert.equal(ExtensionKind.UI, knownUiExtension!.extensionKind); } else if (typeof remoteName === 'string') { - assert.ok(apiTestExtension); - assert.ok(!testResolverExtension); // we currently can only access extensions that run on same host - assert.equal(ExtensionKind.Workspace, apiTestExtension!.extensionKind); + // running in remote, so we only expect workspace extensions + assert.ok(knownWorkspaceExtension); + assert.ok(!knownUiExtension); // we currently can only access extensions that run on same host + assert.equal(ExtensionKind.Workspace, knownWorkspaceExtension!.extensionKind); } else { assert.fail(); } }); - }); diff --git a/extensions/vscode-test-resolver/src/extension.ts b/extensions/vscode-test-resolver/src/extension.ts index 0520edcff4e..6ac9f34c186 100644 --- a/extensions/vscode-test-resolver/src/extension.ts +++ b/extensions/vscode-test-resolver/src/extension.ts @@ -85,7 +85,7 @@ export function activate(context: vscode.ExtensionContext) { env['VSCODE_AGENT_FOLDER'] = remoteDataDir; outputChannel.appendLine(`Using data folder at ${remoteDataDir}`); - if (!commit) { // dev mode + if (!commit || env['TEST_RESOLVER_USE_SERVER_FROM_SOURCES']) { // dev mode const vscodePath = path.resolve(path.join(context.extensionPath, '..', '..')); const serverCommandPath = path.join(vscodePath, 'resources', 'server', 'bin-dev', serverCommand); extHostProcess = cp.spawn(serverCommandPath, commandArgs, { env, cwd: vscodePath }); diff --git a/extensions/yarn.lock b/extensions/yarn.lock index 26979cdf9d6..5368726a68d 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@3.6.1-rc: - version "3.6.1-rc" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.1-rc.tgz#9db650b25d8ef033d9e25b3057bdd1e102bb434b" - integrity sha512-u6AQN9AoocZKYSz8zcc1Qh/V/mbAO+BHc73fTiKlIdjzU60A8TesrK9/7kg3GM8o2RxNyCeOFpcevEtnfUyaLg== +typescript@3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== diff --git a/package.json b/package.json index e6a1abf6fcb..36e90f66160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", - "version": "1.38.0", - "distro": "97a3da8fc0166ace25ffb8f21585fd58ba3305c8", + "version": "1.39.0", + "distro": "323c0a11187dcde94de3a5d913cd44437e85369a", "author": { "name": "Microsoft Corporation" }, @@ -52,7 +52,7 @@ "vscode-ripgrep": "^1.5.6", "vscode-sqlite3": "4.0.8", "vscode-textmate": "^4.2.2", - "xterm": "3.15.0-beta99", + "xterm": "3.15.0-beta101", "xterm-addon-search": "0.2.0-beta5", "xterm-addon-web-links": "0.1.0-beta10", "yauzl": "^2.9.2", @@ -76,8 +76,6 @@ "cson-parser": "^1.3.3", "debounce": "^1.0.0", "documentdb": "^1.5.1", - "electron-mksnapshot": "~2.0.0", - "eslint": "^4.18.2", "event-stream": "3.3.4", "express": "^4.13.1", "fancy-log": "^1.3.3", @@ -101,11 +99,8 @@ "gulp-shell": "^0.6.5", "gulp-tsb": "2.0.7", "gulp-tslint": "^8.1.3", - "gulp-uglify": "^3.0.0", "gulp-untar": "^0.0.7", "gulp-vinyl-zip": "^2.1.2", - "http-server": "^0.11.1", - "husky": "^0.13.1", "innosetup": "5.6.1", "is": "^3.1.0", "istanbul-lib-coverage": "^2.0.5", @@ -121,7 +116,7 @@ "mkdirp": "^0.5.0", "mocha": "^2.2.5", "mocha-junit-reporter": "^1.17.0", - "opn": "^5.4.0", + "opn": "^6.0.0", "optimist": "0.3.5", "p-all": "^1.0.0", "pump": "^1.0.1", @@ -133,17 +128,15 @@ "source-map": "^0.4.4", "ts-loader": "^4.4.2", "tslint": "^5.16.0", - "typescript": "3.5.2", + "typescript": "3.6", "typescript-formatter": "7.1.0", - "uglify-es": "^3.0.18", "underscore": "^1.8.2", "vinyl": "^2.0.0", "vinyl-fs": "^3.0.0", "vsce": "1.48.0", - "vscode-debugprotocol": "1.36.0-pre.0", + "vscode-debugprotocol": "1.36.0", "vscode-nls-dev": "^3.3.1", "webpack": "^4.16.5", - "webpack-cli": "^3.1.0", "webpack-stream": "^5.1.1" }, "repository": { diff --git a/remote/package.json b/remote/package.json index 2e8ceed0809..bb43760e610 100644 --- a/remote/package.json +++ b/remote/package.json @@ -4,7 +4,7 @@ "dependencies": { "@microsoft/applicationinsights-web": "^2.1.1", "applicationinsights": "1.0.8", - "getmac": "1.4.1", + "cookie": "^0.4.0", "graceful-fs": "4.1.11", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^2.2.1", @@ -21,7 +21,7 @@ "vscode-proxy-agent": "0.4.0", "vscode-ripgrep": "^1.5.6", "vscode-textmate": "^4.2.2", - "xterm": "3.15.0-beta99", + "xterm": "3.15.0-beta101", "xterm-addon-search": "0.2.0-beta5", "xterm-addon-web-links": "0.1.0-beta10", "yauzl": "^2.9.2", diff --git a/remote/web/package.json b/remote/web/package.json index f54afe1a3e6..675b6f9c5a3 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -2,12 +2,12 @@ "name": "vscode-web", "version": "0.0.0", "dependencies": { - "@microsoft/applicationinsights-web": "^2.1.1", - "onigasm-umd": "^2.2.2", - "vscode-textmate": "^4.1.1", - "xterm": "3.15.0-beta67", - "xterm-addon-search": "0.2.0-beta2", - "xterm-addon-web-links": "0.1.0-beta10", - "semver-umd": "^5.5.3" + "@microsoft/applicationinsights-web": "^2.1.1", + "onigasm-umd": "^2.2.2", + "semver-umd": "^5.5.3", + "vscode-textmate": "^4.2.2", + "xterm": "3.15.0-beta101", + "xterm-addon-search": "0.2.0-beta5", + "xterm-addon-web-links": "0.1.0-beta10" } - } \ No newline at end of file +} diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 23ad784a554..c8ee2cb5da7 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -92,24 +92,24 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -vscode-textmate@^4.1.1: +vscode-textmate@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.2.2.tgz#0b4dabc69a6fba79a065cb6b615f66eac07c8f4c" integrity sha512-1U4ih0E/KP1zNK/EbpUqyYtI7PY+Ccd2nDGTtiMR/UalLFnmaYkwoWhN1oI7B91ptBN8NdVwWuvyUnvJAulCUw== dependencies: oniguruma "^7.2.0" -xterm-addon-search@0.2.0-beta2: - version "0.2.0-beta2" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.2.0-beta2.tgz#c3173f0a6f207ee9f1848849174ee5d6b6ce8262" - integrity sha512-XEcwi2TeFGk2MuIFjiI/OpVXSNO5dGQBvHH3o+9KzqG3ooVqhhDqzwxs092QGNcNCGh8hGn/PWZiczaBBnKm/g== +xterm-addon-search@0.2.0-beta5: + version "0.2.0-beta5" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.2.0-beta5.tgz#258d7cb1511d9060cd4520f0f82e408000fd4f53" + integrity sha512-Tg+d8scch0rYOVmzBbX35Y1GXtq+eu/YlzbXznmTo/yD83j3BQlXOhgECu/Yv8EX5JwFmzbfVRWC+JWnfigwGg== xterm-addon-web-links@0.1.0-beta10: version "0.1.0-beta10" resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23" integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg== -xterm@3.15.0-beta67: - version "3.15.0-beta67" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta67.tgz#71973e174bdc08df620945eecd3f87912f1ac550" - integrity sha512-qLfo9GHVlu/IxgDI3vRGObWZM7UL4eLhMfjZhprx2aXNMpzmrOW6l3JDRsCjUWm93EoVavbULtnDhGSiTlKitQ== +xterm@3.15.0-beta101: + version "3.15.0-beta101" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta101.tgz#38ffa0df5a3e9bdcb1818e74fe59b2f98b0fff69" + integrity sha512-HRa7+FDqQ8iWBTvb1Ni+uMGILnu6k9mF7JHMHRHfWxFoQlSoGYCyfdyXlJjk68YN8GsEQREmrII6cPLiQizdEQ== diff --git a/remote/yarn.lock b/remote/yarn.lock index dca0e2501f0..2919e2342b2 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -207,6 +207,11 @@ component-emitter@^1.2.1: resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== +cookie@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" + integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== + copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" @@ -270,34 +275,6 @@ diagnostic-channel@0.2.0: dependencies: semver "^5.3.0" -eachr@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eachr/-/eachr-3.2.0.tgz#2c35e43ea086516f7997cf80b7aa64d55a4a4484" - integrity sha1-LDXkPqCGUW95l8+At6pk1VpKRIQ= - dependencies: - editions "^1.1.1" - typechecker "^4.3.0" - -editions@^1.1.1, editions@^1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/editions/-/editions-1.3.4.tgz#3662cb592347c3168eb8e498a0ff73271d67f50b" - integrity sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg== - -editions@^2.1.0, editions@^2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/editions/-/editions-2.1.3.tgz#727ccf3ec2c7b12dcc652c71000f16c4824d6f7d" - integrity sha512-xDZyVm0A4nLgMNWVVLJvcwMjI80ShiH/27RyLiCnW1L273TcJIA25C4pwJ33AWV01OX6UriP35Xu+lH4S7HWQw== - dependencies: - errlop "^1.1.1" - semver "^5.6.0" - -errlop@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.1.1.tgz#d9ae4c76c3e64956c5d79e6e035d6343bfd62250" - integrity sha512-WX7QjiPHhsny7/PQvrhS5VMizXXKoKCS3udaBp8gjlARdbn+XmK300eKBAAN0hGyRaTCtRpOaxK+xFVPUJ3zkw== - dependencies: - editions "^2.1.2" - es6-promise@^4.0.3: version "4.2.4" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29" @@ -352,15 +329,6 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-opts@^3.2.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/extract-opts/-/extract-opts-3.3.1.tgz#5abbedc98c0d5202e3278727f9192d7e086c6be1" - integrity sha1-WrvtyYwNUgLjJ4cn+Rktfghsa+E= - dependencies: - eachr "^3.2.0" - editions "^1.1.1" - typechecker "^4.3.0" - fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -409,14 +377,6 @@ get-value@^2.0.3, get-value@^2.0.6: resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= -getmac@1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/getmac/-/getmac-1.4.1.tgz#cfefcb3ee7d7a73cba5292129cb100c19afbe17a" - integrity sha512-mQp+8D+grQX0gG8EJn6VfH0PxE56ZKNsTguOMxPShAiVk9lvH8Ey36eXepG705Ac1HCsvaSrQ/6bPHZ0++F/Mg== - dependencies: - editions "^1.3.4" - extract-opts "^3.2.0" - glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" @@ -944,11 +904,6 @@ semver@^5.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== -semver@^5.6.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" - integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== - set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" @@ -1092,13 +1047,6 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -typechecker@^4.3.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-4.7.0.tgz#5249f427358f45b7250c4924fd4d01ed9ba435e9" - integrity sha512-4LHc1KMNJ6NDGO+dSM/yNfZQRtp8NN7psYrPHUblD62Dvkwsp3VShsbM78kOgpcmMkRTgvwdKOTjctS+uMllgQ== - dependencies: - editions "^2.1.0" - union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -1225,10 +1173,10 @@ xterm-addon-web-links@0.1.0-beta10: resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23" integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg== -xterm@3.15.0-beta99: - version "3.15.0-beta99" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta99.tgz#0010a7ea5d56cbb08a1e3a525b353c96a158e7a0" - integrity sha512-Vm0ZWToWwO4uk/28Kqvqt9L92h5EU2z4WR9I6xcQaPIBmkJPINIARU4LWQnvaOfgFhRbpwBMveTfh8/jM97lPg== +xterm@3.15.0-beta101: + version "3.15.0-beta101" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta101.tgz#38ffa0df5a3e9bdcb1818e74fe59b2f98b0fff69" + integrity sha512-HRa7+FDqQ8iWBTvb1Ni+uMGILnu6k9mF7JHMHRHfWxFoQlSoGYCyfdyXlJjk68YN8GsEQREmrII6cPLiQizdEQ== yauzl@^2.9.2: version "2.10.0" diff --git a/resources/win32/bin/code.sh b/resources/win32/bin/code.sh index 4bc4677e1e4..745f2adb7aa 100644 --- a/resources/win32/bin/code.sh +++ b/resources/win32/bin/code.sh @@ -11,14 +11,9 @@ VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")" ELECTRON="$VSCODE_PATH/$NAME.exe" if grep -qi Microsoft /proc/version; then # in a wsl shell - if [ "$WSL_DISTRO_NAME" ]; then - # $WSL_DISTRO_NAME is available since WSL builds 18362, also for WSL2 - WSL_BUILD=18362 - else - WSL_BUILD=$(uname -r | sed -E 's/^.+-([0-9]+)-Microsoft/\1/') - if [ -z "$WSL_BUILD" ]; then - WSL_BUILD=0 - fi + WSL_BUILD=$(uname -r | sed -E 's/^[0-9.]+-([0-9]+)-Microsoft|([0-9]+).([0-9]+).([0-9]+)-microsoft-standard|.*/\1\2\3\4/') + if [ -z "$WSL_BUILD" ]; then + WSL_BUILD=0 fi if [ $WSL_BUILD -ge 17063 ]; then @@ -30,7 +25,18 @@ if grep -qi Microsoft /proc/version; then # use the Remote WSL extension if installed WSL_EXT_ID="ms-vscode-remote.remote-wsl" - WSL_EXT_WLOC=$(ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID) + + if [ $WSL_BUILD -ge 41955 ]; then + # WSL2 in workaround for https://github.com/microsoft/WSL/issues/4337 + CWD="$(pwd)" + cd "$VSCODE_PATH" + cmd.exe /C ".\\bin\\$APP_NAME.cmd --locate-extension $WSL_EXT_ID >remote-wsl-loc.txt" + WSL_EXT_WLOC="$(cat ./remote-wsl-loc.txt)" + rm remote-wsl-loc.txt + cd "$CWD" + else + WSL_EXT_WLOC=$(ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID) + fi if [ -n "$WSL_EXT_WLOC" ]; then # replace \r\n with \n in WSL_EXT_WLOC WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode.sh diff --git a/scripts/code.sh b/scripts/code.sh index 542efab5237..a074797ce0f 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -5,10 +5,6 @@ set -e if [[ "$OSTYPE" == "darwin"* ]]; then realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } ROOT=$(dirname "$(dirname "$(realpath "$0")")") - - # On Linux with Electron 2.0.x running out of a VM causes - # a freeze so we only enable this flag on macOS - export ELECTRON_ENABLE_LOGGING=1 else ROOT=$(dirname "$(dirname "$(readlink -f $0)")") if grep -qi Microsoft /proc/version; then @@ -50,6 +46,7 @@ function code() { export VSCODE_DEV=1 export VSCODE_CLI=1 export ELECTRON_ENABLE_STACK_DUMPING=1 + export ELECTRON_ENABLE_LOGGING=1 # Launch Code exec "$CODE" . "$@" diff --git a/scripts/test-release.bat b/scripts/test-documentation.bat similarity index 66% rename from scripts/test-release.bat rename to scripts/test-documentation.bat index cb9c3b205c6..c6990f8f3f0 100644 --- a/scripts/test-release.bat +++ b/scripts/test-documentation.bat @@ -1,6 +1,8 @@ @echo off setlocal +echo Runs tests against the current documentation in https://github.com/microsoft/vscode-docs/tree/vnext + pushd %~dp0\.. :: Endgame tests in AMD diff --git a/scripts/test-release.sh b/scripts/test-documentation.sh similarity index 79% rename from scripts/test-release.sh rename to scripts/test-documentation.sh index f7a0800dc91..54a0672945a 100755 --- a/scripts/test-release.sh +++ b/scripts/test-documentation.sh @@ -12,6 +12,8 @@ fi cd $ROOT +echo "Runs tests against the current documentation in https://github.com/microsoft/vscode-docs/tree/vnext" + # Tests in AMD ./scripts/test.sh --runGlob **/*.releaseTest.js "$@" diff --git a/scripts/test-integration.bat b/scripts/test-integration.bat index 20567bc77cf..280bc476ebe 100644 --- a/scripts/test-integration.bat +++ b/scripts/test-integration.bat @@ -5,21 +5,37 @@ pushd %~dp0\.. set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5% +if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" ( + :: code.bat makes sure Test Extensions are compiled + set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat +) else ( + :: Compile Test Extensions + call yarn gulp compile-extension:vscode-api-tests + call yarn gulp compile-extension:vscode-colorize-tests + call yarn gulp compile-extension:markdown-language-features + call yarn gulp compile-extension:emmet + call yarn gulp compile-extension:css-language-features-server + call yarn gulp compile-extension:html-language-features-server + call yarn gulp compile-extension:json-language-features-server + + echo "Using %INTEGRATION_TEST_ELECTRON_PATH% as Electron path" +) + :: Integration & performance tests in AMD call .\scripts\test.bat --runGlob **\*.integrationTest.js %* if %errorlevel% neq 0 exit /b %errorlevel% :: Tests in the extension host -call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testWorkspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% +call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% if %errorlevel% neq 0 exit /b %errorlevel% -call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% +call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% if %errorlevel% neq 0 exit /b %errorlevel% -call .\scripts\code.bat %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% +call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% if %errorlevel% neq 0 exit /b %errorlevel% -call .\scripts\code.bat $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% . +call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --disable-inspect --user-data-dir=%VSCODEUSERDATADIR% . if %errorlevel% neq 0 exit /b %errorlevel% :: Tests in commonJS (HTML, CSS, JSON language server tests...) diff --git a/scripts/test-integration.sh b/scripts/test-integration.sh index 45595a5f0a3..0bcbcee72f7 100755 --- a/scripts/test-integration.sh +++ b/scripts/test-integration.sh @@ -12,19 +12,38 @@ fi cd $ROOT +# Figure out which Electron to use for running tests +if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ] +then + # code.sh makes sure Test Extensions are compiled + INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh" +else + # Compile Test Extensions + yarn gulp compile-extension:vscode-api-tests + yarn gulp compile-extension:vscode-colorize-tests + yarn gulp compile-extension:markdown-language-features + yarn gulp compile-extension:emmet + yarn gulp compile-extension:css-language-features-server + yarn gulp compile-extension:html-language-features-server + yarn gulp compile-extension:json-language-features-server + + echo "Using $INTEGRATION_TEST_ELECTRON_PATH as Electron path" +fi + # Integration tests in AMD ./scripts/test.sh --runGlob **/*.integrationTest.js "$@" # Tests in the extension host -./scripts/code.sh $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR -./scripts/code.sh $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR -./scripts/code.sh $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR -./scripts/code.sh $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR +"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR +"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR +"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR +"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR mkdir -p $ROOT/extensions/emmet/test-fixtures -./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR +"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR rm -rf $ROOT/extensions/emmet/test-fixtures +# Remote Integration Tests if [ -f ./resources/server/test/test-remote-integration.sh ]; then ./resources/server/test/test-remote-integration.sh fi diff --git a/scripts/test.bat b/scripts/test.bat index 7f5f5f8df8e..0d1350a79ec 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -16,6 +16,7 @@ node build\lib\electron.js if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron :: Run tests +set ELECTRON_ENABLE_LOGGING=1 %CODE% .\test\electron\index.js %* popd diff --git a/scripts/test.sh b/scripts/test.sh index ac96627846f..e1ed5aa65c7 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -4,10 +4,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } ROOT=$(dirname $(dirname $(realpath "$0"))) - - # On Linux with Electron 2.0.x running out of a VM causes - # a freeze so we only enable this flag on macOS - export ELECTRON_ENABLE_LOGGING=1 else ROOT=$(dirname $(dirname $(readlink -f $0))) fi @@ -31,10 +27,12 @@ node build/lib/electron.js || ./node_modules/.bin/gulp electron # Unit Tests if [[ "$OSTYPE" == "darwin"* ]]; then cd $ROOT ; ulimit -n 4096 ; \ + ELECTRON_ENABLE_LOGGING=1 \ "$CODE" \ test/electron/index.js "$@" else cd $ROOT ; \ + ELECTRON_ENABLE_LOGGING=1 \ "$CODE" \ test/electron/index.js "$@" fi diff --git a/src/bootstrap.js b/src/bootstrap.js index bb29caa6e82..3aeaa72e3b1 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -203,7 +203,7 @@ exports.setupNLS = function () { const bundles = Object.create(null); nlsConfig.loadBundle = function (bundle, language, cb) { - let result = bundles[bundle]; + const result = bundles[bundle]; if (result) { cb(undefined, result); @@ -212,7 +212,7 @@ exports.setupNLS = function () { const bundleFile = path.join(nlsConfig._resolvedLanguagePackCoreLocation, bundle.replace(/\//g, '!') + '.nls.json'); exports.readFile(bundleFile).then(function (content) { - let json = JSON.parse(content); + const json = JSON.parse(content); bundles[bundle] = json; cb(undefined, json); @@ -301,4 +301,4 @@ exports.avoidMonkeyPatchFromAppInsights = function () { process.env['APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL'] = true; // Skip monkey patching of 3rd party modules by appinsights global['diagnosticsSource'] = {}; // Prevents diagnostic channel (which patches "require") from initializing entirely }; -//#endregion \ No newline at end of file +//#endregion diff --git a/src/buildfile.js b/src/buildfile.js index 746975249ed..684954a3219 100644 --- a/src/buildfile.js +++ b/src/buildfile.js @@ -25,8 +25,8 @@ exports.serviceWorker = [{ exports.workerExtensionHost = [entrypoint('vs/workbench/services/extensions/worker/extensionHostWorker')]; -exports.workbench = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.desktop.main']); -exports.workbenchWeb = entrypoint('vs/workbench/workbench.web.api'); +exports.workbenchDesktop = require('./vs/workbench/buildfile.desktop').collectModules(); +exports.workbenchWeb = require('./vs/workbench/buildfile.web').collectModules(); exports.keyboardMaps = [ entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux'), diff --git a/src/tsconfig.base.json b/src/tsconfig.base.json index 79d754c01f5..907c210b530 100644 --- a/src/tsconfig.base.json +++ b/src/tsconfig.base.json @@ -3,7 +3,6 @@ "module": "amd", "moduleResolution": "node", "noImplicitAny": true, - "target": "es5", "experimentalDecorators": true, "noImplicitReturns": true, "noUnusedLocals": true, @@ -17,13 +16,6 @@ "vs/*": [ "./vs/*" ] - }, - "types": [ - "keytar", - "mocha", - "semver", - "sinon", - "winreg" - ] + } } } diff --git a/src/tsconfig.json b/src/tsconfig.json index 7fbb44c3ec5..dcff5cff53f 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -5,12 +5,18 @@ "preserveConstEnums": true, "sourceMap": false, "outDir": "../out", - "target": "es6", + "target": "es2017", "lib": [ "dom", "es5", - "es2015.iterable", - "webworker" + "es2015.iterable" + ], + "types": [ + "keytar", + "mocha", + "semver", + "sinon", + "winreg" ] }, "include": [ diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts index cc80376a765..6f44785756c 100644 --- a/src/typings/electron.d.ts +++ b/src/typings/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 4.2.9 +// Type definitions for Electron 4.2.10 // Project: http://electronjs.org/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -9861,4 +9861,4 @@ declare namespace NodeJS { electron: string; chrome: string; } -} \ No newline at end of file +} diff --git a/src/typings/xterm.d.ts b/src/typings/xterm.d.ts index 663b997022b..df7f20e233e 100644 --- a/src/typings/xterm.d.ts +++ b/src/typings/xterm.d.ts @@ -207,47 +207,47 @@ declare module 'xterm' { */ export interface ITheme { /** The default foreground color */ - foreground?: string, + foreground?: string; /** The default background color */ - background?: string, + background?: string; /** The cursor color */ - cursor?: string, + cursor?: string; /** The accent color of the cursor (fg color for a block cursor) */ - cursorAccent?: string, + cursorAccent?: string; /** The selection background color (can be transparent) */ - selection?: string, + selection?: string; /** ANSI black (eg. `\x1b[30m`) */ - black?: string, + black?: string; /** ANSI red (eg. `\x1b[31m`) */ - red?: string, + red?: string; /** ANSI green (eg. `\x1b[32m`) */ - green?: string, + green?: string; /** ANSI yellow (eg. `\x1b[33m`) */ - yellow?: string, + yellow?: string; /** ANSI blue (eg. `\x1b[34m`) */ - blue?: string, + blue?: string; /** ANSI magenta (eg. `\x1b[35m`) */ - magenta?: string, + magenta?: string; /** ANSI cyan (eg. `\x1b[36m`) */ - cyan?: string, + cyan?: string; /** ANSI white (eg. `\x1b[37m`) */ - white?: string, + white?: string; /** ANSI bright black (eg. `\x1b[1;30m`) */ - brightBlack?: string, + brightBlack?: string; /** ANSI bright red (eg. `\x1b[1;31m`) */ - brightRed?: string, + brightRed?: string; /** ANSI bright green (eg. `\x1b[1;32m`) */ - brightGreen?: string, + brightGreen?: string; /** ANSI bright yellow (eg. `\x1b[1;33m`) */ - brightYellow?: string, + brightYellow?: string; /** ANSI bright blue (eg. `\x1b[1;34m`) */ - brightBlue?: string, + brightBlue?: string; /** ANSI bright magenta (eg. `\x1b[1;35m`) */ - brightMagenta?: string, + brightMagenta?: string; /** ANSI bright cyan (eg. `\x1b[1;36m`) */ - brightCyan?: string, + brightCyan?: string; /** ANSI bright white (eg. `\x1b[1;37m`) */ - brightWhite?: string + brightWhite?: string; } /** @@ -386,6 +386,12 @@ declare module 'xterm' { */ readonly markers: ReadonlyArray; + /** + * (EXPERIMENTAL) Get the parser interface to register + * custom escape sequence handlers. + */ + readonly parser: IParser; + /** * Natural language strings that can be localized. */ @@ -500,32 +506,6 @@ declare module 'xterm' { */ attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void; - /** - * (EXPERIMENTAL) Adds a handler for CSI escape sequences. - * @param flag The flag should be one-character string, which specifies the - * final character (e.g "m" for SGR) of the CSI sequence. - * @param callback The function to handle the escape sequence. The callback - * is called with the numerical params, as well as the special characters - * (e.g. "$" for DECSCPP). If the sequence has subparams the array will - * contain subarrays with their numercial values. - * Return true if the sequence was handled; false if - * we should try a previous handler (set by addCsiHandler or setCsiHandler). - * The most recently-added handler is tried first. - * @return An IDisposable you can call to remove this handler. - */ - addCsiHandler(flag: string, callback: (params: (number | number[])[], collect: string) => boolean): IDisposable; - - /** - * (EXPERIMENTAL) Adds a handler for OSC escape sequences. - * @param ident The number (first parameter) of the sequence. - * @param callback The function to handle the escape sequence. The callback - * is called with OSC data string. Return true if the sequence was handled; - * false if we should try a previous handler (set by addOscHandler or - * setOscHandler). The most recently-added handler is tried first. - * @return An IDisposable you can call to remove this handler. - */ - addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable; - /** * (EXPERIMENTAL) Registers a link matcher, allowing custom link patterns to * be matched and handled. @@ -689,6 +669,12 @@ declare module 'xterm' { */ writeUtf8(data: Uint8Array): void; + /** + * Writes text to the terminal, performing the necessary transformations for pasted text. + * @param data The text to write to the terminal. + */ + paste(data: string): void; + /** * Retrieves an option's value from the terminal. * @param key The option key. @@ -804,18 +790,10 @@ declare module 'xterm' { /** * Perform a full reset (RIS, aka '\x1bc'). */ - reset(): void + reset(): void; /** - * Applies an addon to the Terminal prototype, making it available to all - * newly created Terminals. - * @param addon The addon to apply. - * @deprecated Use the new loadAddon API/addon format. - */ - static applyAddon(addon: any): void; - - /** - * (EXPERIMENTAL) Loads an addon into this instance of xterm.js. + * Loads an addon into this instance of xterm.js. * @param addon The addon to load. */ loadAddon(addon: ITerminalAddon): void; @@ -951,6 +929,119 @@ declare module 'xterm' { */ readonly width: number; } + + /** + * (EXPERIMENTAL) Data type to register a CSI, DCS or ESC callback in the parser + * in the form: + * ESC I..I F + * CSI Prefix P..P I..I F + * DCS Prefix P..P I..I F data_bytes ST + * + * with these rules/restrictions: + * - prefix can only be used with CSI and DCS + * - only one leading prefix byte is recognized by the parser + * before any other parameter bytes (P..P) + * - intermediate bytes are recognized up to 2 + * + * For custom sequences make sure to read ECMA-48 and the resources at + * vt100.net to not clash with existing sequences or reserved address space. + * General recommendations: + * - use private address space (see ECMA-48) + * - use max one intermediate byte (technically not limited by the spec, + * in practice there are no sequences with more than one intermediate byte, + * thus parsers might get confused with more intermediates) + * - test against other common emulators to check whether they escape/ignore + * the sequence correctly + * + * Notes: OSC command registration is handled differently (see addOscHandler) + * APC, PM or SOS is currently not supported. + */ + export interface IFunctionIdentifier { + /** + * Optional prefix byte, must be in range \x3c .. \x3f. + * Usable in CSI and DCS. + */ + prefix?: string; + /** + * Optional intermediate bytes, must be in range \x20 .. \x2f. + * Usable in CSI, DCS and ESC. + */ + intermediates?: string; + /** + * Final byte, must be in range \x40 .. \x7e for CSI and DCS, + * \x30 .. \x7e for ESC. + */ + final: string; + } + + /** + * (EXPERIMENTAL) Parser interface. + */ + export interface IParser { + /** + * Adds a handler for CSI escape sequences. + * @param id Specifies the function identifier under which the callback + * gets registered, e.g. {final: 'm'} for SGR. + * @param callback The function to handle the sequence. The callback is + * called with the numerical params. If the sequence has subparams the + * array will contain subarrays with their numercial values. + * Return true if the sequence was handled; false if we should try + * a previous handler (set by addCsiHandler or setCsiHandler). + * The most recently-added handler is tried first. + * @return An IDisposable you can call to remove this handler. + */ + addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable; + + /** + * Adds a handler for DCS escape sequences. + * @param id Specifies the function identifier under which the callback + * gets registered, e.g. {intermediates: '$' final: 'q'} for DECRQSS. + * @param callback The function to handle the sequence. Note that the + * function will only be called once if the sequence finished sucessfully. + * There is currently no way to intercept smaller data chunks, data chunks + * will be stored up until the sequence is finished. Since DCS sequences + * are not limited by the amount of data this might impose a problem for + * big payloads. Currently xterm.js limits DCS payload to 10 MB + * which should give enough room for most use cases. + * The function gets the payload and numerical parameters as arguments. + * Return true if the sequence was handled; false if we should try + * a previous handler (set by addDcsHandler or setDcsHandler). + * The most recently-added handler is tried first. + * @return An IDisposable you can call to remove this handler. + */ + addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable; + + /** + * Adds a handler for ESC escape sequences. + * @param id Specifies the function identifier under which the callback + * gets registered, e.g. {intermediates: '%' final: 'G'} for + * default charset selection. + * @param callback The function to handle the sequence. + * Return true if the sequence was handled; false if we should try + * a previous handler (set by addEscHandler or setEscHandler). + * The most recently-added handler is tried first. + * @return An IDisposable you can call to remove this handler. + */ + addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable; + + /** + * Adds a handler for OSC escape sequences. + * @param ident The number (first parameter) of the sequence. + * @param callback The function to handle the sequence. Note that the + * function will only be called once if the sequence finished sucessfully. + * There is currently no way to intercept smaller data chunks, data chunks + * will be stored up until the sequence is finished. Since OSC sequences + * are not limited by the amount of data this might impose a problem for + * big payloads. Currently xterm.js limits OSC payload to 10 MB + * which should give enough room for most use cases. + * The callback is called with OSC data string. + * Return true if the sequence was handled; false if we should try + * a previous handler (set by addOscHandler or setOscHandler). + * The most recently-added handler is tried first. + * @return An IDisposable you can call to remove this handler. + */ + addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable; + } } @@ -987,4 +1078,4 @@ declare module 'xterm' { interface Terminal { _core: TerminalCore; } -} \ No newline at end of file +} diff --git a/src/vs/base/browser/dnd.ts b/src/vs/base/browser/dnd.ts index 1a5d28e802e..642b0827420 100644 --- a/src/vs/base/browser/dnd.ts +++ b/src/vs/base/browser/dnd.ts @@ -111,4 +111,4 @@ export interface IStaticDND { export const StaticDND: IStaticDND = { CurrentDragAndDropData: undefined -}; \ No newline at end of file +}; diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index fa6956fdac0..31d645fe271 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -172,7 +172,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende renderer }; - const allowedSchemes = ['http', 'https', 'mailto']; + const allowedSchemes = ['http', 'https', 'mailto', 'data']; if (markdown.isTrusted) { allowedSchemes.push('command'); } diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts index f6b707d975d..a15f94dab8c 100644 --- a/src/vs/base/browser/ui/dialog/dialog.ts +++ b/src/vs/base/browser/ui/dialog/dialog.ts @@ -55,13 +55,17 @@ export class Dialog extends Disposable { private buttonGroup: ButtonGroup | undefined; private styles: IDialogStyles | undefined; private focusToReturn: HTMLElement | undefined; + private checkboxHasFocus: boolean = false; + private buttons: string[]; - constructor(private container: HTMLElement, private message: string, private buttons: string[], private options: IDialogOptions) { + constructor(private container: HTMLElement, private message: string, buttons: string[], private options: IDialogOptions) { super(); this.modal = this.container.appendChild($(`.dialog-modal-block${options.type === 'pending' ? '.dimmed' : ''}`)); this.element = this.modal.appendChild($('.dialog-box')); hide(this.element); + // If no button is provided, default to OK + this.buttons = buttons.length ? buttons : [nls.localize('ok', "OK")]; const buttonsRowElement = this.element.appendChild($('.dialog-buttons-row')); this.buttonsContainer = buttonsRowElement.appendChild($('.dialog-buttons')); @@ -109,13 +113,6 @@ export class Dialog extends Disposable { return; } - if (this.modal) { - this._register(domEvent(this.modal, 'mousedown')(e => { - // Used to stop focusing of modal with mouse - EventHelper.stop(e, true); - })); - } - clearNode(this.buttonsContainer); let focusedButton = 0; @@ -146,14 +143,27 @@ export class Dialog extends Disposable { let eventHandled = false; if (evt.equals(KeyMod.Shift | KeyCode.Tab) || evt.equals(KeyCode.LeftArrow)) { - focusedButton = focusedButton + buttonGroup.buttons.length - 1; - focusedButton = focusedButton % buttonGroup.buttons.length; - buttonGroup.buttons[focusedButton].focus(); + if (!this.checkboxHasFocus && focusedButton === 0) { + this.checkbox!.domNode.focus(); + this.checkboxHasFocus = true; + } else { + focusedButton = (this.checkboxHasFocus ? 0 : focusedButton) + buttonGroup.buttons.length - 1; + focusedButton = focusedButton % buttonGroup.buttons.length; + buttonGroup.buttons[focusedButton].focus(); + this.checkboxHasFocus = false; + } + eventHandled = true; } else if (evt.equals(KeyCode.Tab) || evt.equals(KeyCode.RightArrow)) { - focusedButton++; - focusedButton = focusedButton % buttonGroup.buttons.length; - buttonGroup.buttons[focusedButton].focus(); + if (!this.checkboxHasFocus && focusedButton === buttonGroup.buttons.length - 1) { + this.checkbox!.domNode.focus(); + this.checkboxHasFocus = true; + } else { + focusedButton = this.checkboxHasFocus ? 0 : focusedButton + 1; + focusedButton = focusedButton % buttonGroup.buttons.length; + buttonGroup.buttons[focusedButton].focus(); + this.checkboxHasFocus = false; + } eventHandled = true; } diff --git a/src/vs/base/browser/ui/grid/grid.ts b/src/vs/base/browser/ui/grid/grid.ts index 4586d752d0b..28b184f76d9 100644 --- a/src/vs/base/browser/ui/grid/grid.ts +++ b/src/vs/base/browser/ui/grid/grid.ts @@ -7,7 +7,7 @@ import 'vs/css!./gridview'; import { Orientation } from 'vs/base/browser/ui/sash/sash'; import { Disposable } from 'vs/base/common/lifecycle'; import { tail2 as tail, equals } from 'vs/base/common/arrays'; -import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, LayoutController, IGridViewOptions } from './gridview'; +import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions } from './gridview'; import { Event } from 'vs/base/common/event'; import { InvisibleSizing } from 'vs/base/browser/ui/splitview/splitview'; @@ -217,9 +217,17 @@ export class Grid extends Disposable { private didLayout = false; - constructor(view: T, options: IGridOptions = {}) { + constructor(gridview: GridView, options?: IGridOptions); + constructor(view: T, options?: IGridOptions); + constructor(view: T | GridView, options: IGridOptions = {}) { super(); - this.gridview = new GridView(options); + + if (view instanceof GridView) { + this.gridview = view; + this.gridview.getViewMap(this.views); + } else { + this.gridview = new GridView(options); + } this._register(this.gridview); this._register(this.gridview.onDidSashReset(this.onDidSashReset, this)); @@ -228,7 +236,9 @@ export class Grid extends Disposable { ? GridViewSizing.Invisible(options.firstViewVisibleCachedSize) : 0; - this._addView(view, size, [0]); + if (!(view instanceof GridView)) { + this._addView(view, size, [0]); + } } style(styles: IGridStyles): void { @@ -469,12 +479,6 @@ export interface IViewDeserializer { fromJSON(json: any): T; } -interface InitialLayoutContext { - width: number; - height: number; - root: GridBranchNode; -} - export interface ISerializedLeafNode { type: 'leaf'; data: any; @@ -567,31 +571,9 @@ export class SerializableGrid extends Grid { throw new Error('Invalid JSON: \'height\' property must be a number.'); } - const orientation = json.orientation; - const width = json.width; - const height = json.height; - const box: Box = { top: 0, left: 0, width, height }; + const gridview = GridView.deserialize(json, deserializer, options); + const result = new SerializableGrid(gridview, options); - const root = SerializableGrid.deserializeNode(json.root, orientation, box, deserializer) as GridBranchNode; - const firstLeaf = SerializableGrid.getFirstLeaf(root); - - if (!firstLeaf) { - throw new Error('Invalid serialized state, first leaf not found'); - } - - const layoutController = new LayoutController(false); - options = { ...options, layoutController }; - - if (typeof firstLeaf.cachedVisibleSize === 'number') { - options = { ...options, firstViewVisibleCachedSize: firstLeaf.cachedVisibleSize }; - } - - const result = new SerializableGrid(firstLeaf.view, options); - result.orientation = orientation; - result.restoreViews(firstLeaf.view, orientation, root); - result.initialLayoutContext = { width, height, root }; - - layoutController.isLayoutEnabled = true; return result; } @@ -599,7 +581,7 @@ export class SerializableGrid extends Grid { * Useful information in order to proportionally restore view sizes * upon the very first layout call. */ - private initialLayoutContext: InitialLayoutContext | undefined; + private initialLayoutContext: boolean = true; serialize(): ISerializedGrid { return { @@ -614,67 +596,10 @@ export class SerializableGrid extends Grid { super.layout(width, height); if (this.initialLayoutContext) { - const widthScale = width / this.initialLayoutContext.width; - const heightScale = height / this.initialLayoutContext.height; - - this.restoreViewsSize([], this.initialLayoutContext.root, this.orientation, widthScale, heightScale); - this.initialLayoutContext = undefined; - + this.initialLayoutContext = false; this.gridview.trySet2x2(); } } - - /** - * Recursively restores views which were just deserialized. - */ - private restoreViews(referenceView: T, orientation: Orientation, node: GridNode): void { - if (!isGridBranchNode(node)) { - return; - } - - const direction = orientation === Orientation.VERTICAL ? Direction.Down : Direction.Right; - const firstLeaves = node.children.map(c => SerializableGrid.getFirstLeaf(c)); - - for (let i = 1; i < firstLeaves.length; i++) { - const node = firstLeaves[i]; - const size: number | InvisibleSizing = typeof node.cachedVisibleSize === 'number' - ? GridViewSizing.Invisible(node.cachedVisibleSize) - : (orientation === Orientation.VERTICAL ? node.box.height : node.box.width); - this.addView(node.view, size, referenceView, direction); - referenceView = node.view; - } - - for (let i = 0; i < node.children.length; i++) { - this.restoreViews(firstLeaves[i].view, orthogonal(orientation), node.children[i]); - } - } - - /** - * Recursively restores view sizes. - * This should be called only after the very first layout call. - */ - private restoreViewsSize(location: number[], node: GridNode, orientation: Orientation, widthScale: number, heightScale: number): void { - if (!isGridBranchNode(node)) { - return; - } - - const scale = orientation === Orientation.VERTICAL ? heightScale : widthScale; - - for (let i = 0; i < node.children.length; i++) { - const child = node.children[i]; - const childLocation = [...location, i]; - - if (i < node.children.length - 1) { - const size = orientation === Orientation.VERTICAL - ? { height: Math.floor(child.box.height * scale) } - : { width: Math.floor(child.box.width * scale) }; - - this.gridview.resizeView(childLocation, size); - } - - this.restoreViewsSize(childLocation, child, orthogonal(orientation), widthScale, heightScale); - } - } } export type GridNodeDescriptor = { size?: number, groups?: GridNodeDescriptor[] }; diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index 934601cf17c..26e01ee7089 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -34,6 +34,36 @@ export interface IView { setVisible?(visible: boolean): void; } +export interface ISerializableView extends IView { + toJSON(): object; +} + +export interface IViewDeserializer { + fromJSON(json: any): T; +} + +export interface ISerializedLeafNode { + type: 'leaf'; + data: any; + size: number; + visible?: boolean; +} + +export interface ISerializedBranchNode { + type: 'branch'; + data: ISerializedNode[]; + size: number; +} + +export type ISerializedNode = ISerializedLeafNode | ISerializedBranchNode; + +export interface ISerializedGridView { + root: ISerializedNode; + orientation: Orientation; + width: number; + height: number; +} + export function orthogonal(orientation: Orientation): Orientation { return orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; } @@ -179,18 +209,52 @@ class BranchNode implements ISplitView, IDisposable { styles: IGridViewStyles, readonly proportionalLayout: boolean, size: number = 0, - orthogonalSize: number = 0 + orthogonalSize: number = 0, + childDescriptors?: INodeDescriptor[] ) { this._styles = styles; this._size = size; this._orthogonalSize = orthogonalSize; this.element = $('.monaco-grid-branch-node'); - this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout }); - this.splitview.layout(size, orthogonalSize); + + if (!childDescriptors) { + // Normal behavior, we have no children yet, just set up the splitview + this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout }); + this.splitview.layout(size, orthogonalSize); + } else { + // Reconstruction behavior, we want to reconstruct a splitview + const descriptor = { + views: childDescriptors.map(childDescriptor => { + return { + view: childDescriptor.node, + size: childDescriptor.node.size, + visible: childDescriptor.node instanceof LeafNode && childDescriptor.visible !== undefined ? childDescriptor.visible : true + }; + }), + size: this.orthogonalSize + }; + + const options = { proportionalLayout, orientation, styles }; + + this.children = childDescriptors.map(c => c.node); + this.splitview = new SplitView(this.element, { ...options, descriptor }); + + this.children.forEach((node, index) => { + // Set up orthogonal sashes for children + node.orthogonalStartSash = this.splitview.sashes[index - 1]; + node.orthogonalEndSash = this.splitview.sashes[index]; + }); + } const onDidSashReset = Event.map(this.splitview.onDidSashReset, i => [i]); this.splitviewSashResetDisposable = onDidSashReset(this._onDidSashReset.fire, this._onDidSashReset); + + const onDidChildrenChange = Event.map(Event.any(...this.children.map(c => c.onDidChange)), () => undefined); + this.childrenChangeDisposable = onDidChildrenChange(this._onDidChange.fire, this._onDidChange); + + const onDidChildrenSashReset = Event.any(...this.children.map((c, i) => Event.map(c.onDidSashReset, location => [i, ...location]))); + this.childrenSashResetDisposable = onDidChildrenSashReset(this._onDidSashReset.fire, this._onDidSashReset); } style(styles: IGridViewStyles): void { @@ -226,7 +290,7 @@ class BranchNode implements ISplitView, IDisposable { } } - addChild(node: Node, size: number | Sizing, index: number): void { + addChild(node: Node, size: number | Sizing, index: number, skipLayout?: boolean): void { if (index < 0 || index > this.children.length) { throw new Error('Invalid index'); } @@ -361,7 +425,6 @@ class BranchNode implements ISplitView, IDisposable { } this.splitview.setViewVisible(index, visible); - this._onDidChange.fire(undefined); } getChildCachedVisibleSize(index: number): number | undefined { @@ -484,9 +547,11 @@ class LeafNode implements ISplitView, IDisposable { readonly view: IView, readonly orientation: Orientation, readonly layoutController: ILayoutController, - orthogonalSize: number + orthogonalSize: number, + size: number = 0 ) { this._orthogonalSize = orthogonalSize; + this._size = size; this._onDidViewChange = Event.map(this.view.onDidChange, e => e && (this.orientation === Orientation.VERTICAL ? e.width : e.height)); this.onDidChange = Event.any(this._onDidViewChange, this._onDidSetLinkedNode.event, this._onDidLinkedWidthNodeChange.event, this._onDidLinkedHeightNodeChange.event); @@ -577,6 +642,11 @@ class LeafNode implements ISplitView, IDisposable { type Node = BranchNode | LeafNode; +export interface INodeDescriptor { + node: Node; + visible?: boolean; +} + function flipNode(node: T, size: number, orthogonalSize: number): T { if (node instanceof BranchNode) { const result = new BranchNode(orthogonal(node.orientation), node.layoutController, node.styles, node.proportionalLayout, size, orthogonalSize); @@ -680,6 +750,18 @@ export class GridView implements IDisposable { this.root = new BranchNode(Orientation.VERTICAL, this.layoutController, this.styles, this.proportionalLayout); } + getViewMap(map: Map, node?: Node): void { + if (!node) { + node = this.root; + } + + if (node instanceof BranchNode) { + node.children.forEach(child => this.getViewMap(map, child)); + } else { + map.set(node.view, node.element); + } + } + style(styles: IGridViewStyles): void { this.styles = styles; this.root.style(styles); @@ -953,6 +1035,47 @@ export class GridView implements IDisposable { return this._getViews(node, this.orientation, { top: 0, left: 0, width: this.width, height: this.height }); } + static deserialize(json: ISerializedGridView, deserializer: IViewDeserializer, options: IGridViewOptions = {}): GridView { + if (typeof json.orientation !== 'number') { + throw new Error('Invalid JSON: \'orientation\' property must be a number.'); + } else if (typeof json.width !== 'number') { + throw new Error('Invalid JSON: \'width\' property must be a number.'); + } else if (typeof json.height !== 'number') { + throw new Error('Invalid JSON: \'height\' property must be a number.'); + } + + const orientation = json.orientation; + const height = json.height; + + const result = new GridView(options); + result._deserialize(json.root as ISerializedBranchNode, orientation, deserializer, height); + + return result; + } + + private _deserialize(root: ISerializedBranchNode, orientation: Orientation, deserializer: IViewDeserializer, orthogonalSize: number): void { + this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize) as BranchNode; + } + + private _deserializeNode(node: ISerializedNode, orientation: Orientation, deserializer: IViewDeserializer, orthogonalSize: number): Node { + let result: Node; + if (node.type === 'branch') { + const serializedChildren = node.data as ISerializedNode[]; + const children = serializedChildren.map(serializedChild => { + return { + node: this._deserializeNode(serializedChild, orthogonal(orientation), deserializer, node.size), + visible: (serializedChild as { visible?: boolean }).visible + } as INodeDescriptor; + }); + + result = new BranchNode(orientation, this.layoutController, this.styles, this.proportionalLayout, node.size, orthogonalSize, children); + } else { + result = new LeafNode(deserializer.fromJSON(node.data), orientation, this.layoutController, orthogonalSize, node.size); + } + + return result; + } + private _getViews(node: Node, orientation: Orientation, box: Box, cachedVisibleSize?: number): GridNode { if (node instanceof LeafNode) { return { view: node.view, box, cachedVisibleSize }; diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index ec4a3c2f6de..b9fc4154234 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -27,11 +27,11 @@ export interface IIconLabelValueOptions { } class FastLabelNode { - private disposed: boolean; - private _textContent: string; - private _className: string; - private _title: string; - private _empty: boolean; + private disposed: boolean | undefined; + private _textContent: string | undefined; + private _className: string | undefined; + private _title: string | undefined; + private _empty: boolean | undefined; constructor(private _element: HTMLElement) { } @@ -89,7 +89,7 @@ export class IconLabel extends Disposable { private domNode: FastLabelNode; private labelDescriptionContainer: FastLabelNode; private labelNode: FastLabelNode | HighlightedLabel; - private descriptionNode: FastLabelNode | HighlightedLabel; + private descriptionNode: FastLabelNode | HighlightedLabel | undefined; private descriptionNodeFactory: () => FastLabelNode | HighlightedLabel; constructor(container: HTMLElement, options?: IIconLabelCreationOptions) { diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 430f250ce38..48026fe503b 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -220,13 +220,7 @@ export class InputBox extends Widget { }); } - setTimeout(() => { - if (!this.input) { - return; - } - - this.updateMirror(); - }, 0); + setTimeout(() => this.updateMirror(), 0); // Support actions if (this.options.actions) { @@ -246,21 +240,17 @@ export class InputBox extends Widget { } public setPlaceHolder(placeHolder: string): void { - if (this.input) { - this.input.setAttribute('placeholder', placeHolder); - this.input.title = placeHolder; - } + this.input.setAttribute('placeholder', placeHolder); + this.input.title = placeHolder; } public setAriaLabel(label: string): void { this.ariaLabel = label; - if (this.input) { - if (label) { - this.input.setAttribute('aria-label', this.ariaLabel); - } else { - this.input.removeAttribute('aria-label'); - } + if (label) { + this.input.setAttribute('aria-label', this.ariaLabel); + } else { + this.input.removeAttribute('aria-label'); } } @@ -560,20 +550,18 @@ export class InputBox extends Widget { } protected applyStyles(): void { - if (this.element) { - const background = this.inputBackground ? this.inputBackground.toString() : null; - const foreground = this.inputForeground ? this.inputForeground.toString() : null; - const border = this.inputBorder ? this.inputBorder.toString() : null; + const background = this.inputBackground ? this.inputBackground.toString() : null; + const foreground = this.inputForeground ? this.inputForeground.toString() : null; + const border = this.inputBorder ? this.inputBorder.toString() : null; - this.element.style.backgroundColor = background; - this.element.style.color = foreground; - this.input.style.backgroundColor = background; - this.input.style.color = foreground; + this.element.style.backgroundColor = background; + this.element.style.color = foreground; + this.input.style.backgroundColor = background; + this.input.style.color = foreground; - this.element.style.borderWidth = border ? '1px' : null; - this.element.style.borderStyle = border ? 'solid' : null; - this.element.style.borderColor = border; - } + this.element.style.borderWidth = border ? '1px' : null; + this.element.style.borderStyle = border ? 'solid' : null; + this.element.style.borderColor = border; } public layout(): void { @@ -594,13 +582,11 @@ export class InputBox extends Widget { public dispose(): void { this._hideMessage(); - this.element = null!; // StrictNullOverride: nulling out ok in dispose - this.input = null!; // StrictNullOverride: nulling out ok in dispose - this.contextViewProvider = undefined; this.message = null; - this.validation = undefined; - this.state = null!; // StrictNullOverride: nulling out ok in dispose - this.actionbar = undefined; + + if (this.actionbar) { + this.actionbar.dispose(); + } super.dispose(); } diff --git a/src/vs/base/browser/ui/list/list.ts b/src/vs/base/browser/ui/list/list.ts index 2536dd0f270..ad6f5eee08c 100644 --- a/src/vs/base/browser/ui/list/list.ts +++ b/src/vs/base/browser/ui/list/list.ts @@ -105,3 +105,10 @@ export interface IListDragAndDrop { onDragOver(data: IDragAndDropData, targetElement: T | undefined, targetIndex: number | undefined, originalEvent: DragEvent): boolean | IListDragOverReaction; drop(data: IDragAndDropData, targetElement: T | undefined, targetIndex: number | undefined, originalEvent: DragEvent): void; } + +export class ListError extends Error { + + constructor(user: string, message: string) { + super(`ListError [${user}] ${message}`); + } +} diff --git a/src/vs/base/browser/ui/list/listPaging.ts b/src/vs/base/browser/ui/list/listPaging.ts index 788c0045f2d..cc6ff3a92bb 100644 --- a/src/vs/base/browser/ui/list/listPaging.ts +++ b/src/vs/base/browser/ui/list/listPaging.ts @@ -76,13 +76,14 @@ export class PagedList implements IDisposable { private _model!: IPagedModel; constructor( + user: string, container: HTMLElement, virtualDelegate: IListVirtualDelegate, renderers: IPagedRenderer[], options: IListOptions = {} ) { const pagedRenderers = renderers.map(r => new PagedRenderer>(r, () => this.model)); - this.list = new List(container, virtualDelegate, pagedRenderers, options); + this.list = new List(user, container, virtualDelegate, pagedRenderers, options); } getHTMLElement(): HTMLElement { diff --git a/src/vs/base/browser/ui/list/listView.ts b/src/vs/base/browser/ui/list/listView.ts index 8ae8867bf64..87d2ffad2db 100644 --- a/src/vs/base/browser/ui/list/listView.ts +++ b/src/vs/base/browser/ui/list/listView.ts @@ -248,7 +248,7 @@ export class ListView implements ISpliceable, IDisposable { this.domNode.appendChild(this.scrollableElement.getDomNode()); container.appendChild(this.domNode); - this.disposables = [this.rangeMap, this.scrollableElement, this.cache]; + this.disposables = [this.scrollableElement, this.cache]; this.scrollableElement.onScroll(this.onScroll, this, this.disposables); domEvent(this.rowsContainer, TouchEventType.Change)(this.onTouchChange, this, this.disposables); diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index 15b21e3b9b0..3bd172ff318 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { Event, Emitter, EventBufferer } from 'vs/base/common/event'; import { domEvent } from 'vs/base/browser/event'; -import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole } from './list'; +import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole, ListError } from './list'; import { ListView, IListViewOptions, IListViewDragAndDrop, IAriaProvider } from './listView'; import { Color } from 'vs/base/common/color'; import { mixin } from 'vs/base/common/objects'; @@ -1170,6 +1170,7 @@ export class List implements ISpliceable, IDisposable { readonly onDidDispose: Event = this._onDidDispose.event; constructor( + private user: string, container: HTMLElement, virtualDelegate: IListVirtualDelegate, renderers: IListRenderer[], @@ -1261,11 +1262,11 @@ export class List implements ISpliceable, IDisposable { splice(start: number, deleteCount: number, elements: T[] = []): void { if (start < 0 || start > this.view.length) { - throw new Error(`Invalid start index: ${start}`); + throw new ListError(this.user, `Invalid start index: ${start}`); } if (deleteCount < 0) { - throw new Error(`Invalid delete count: ${deleteCount}`); + throw new ListError(this.user, `Invalid delete count: ${deleteCount}`); } if (deleteCount === 0 && elements.length === 0) { @@ -1348,7 +1349,7 @@ export class List implements ISpliceable, IDisposable { setSelection(indexes: number[], browserEvent?: UIEvent): void { for (const index of indexes) { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } } @@ -1366,7 +1367,7 @@ export class List implements ISpliceable, IDisposable { setFocus(indexes: number[], browserEvent?: UIEvent): void { for (const index of indexes) { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } } @@ -1518,7 +1519,7 @@ export class List implements ISpliceable, IDisposable { reveal(index: number, relativeTop?: number): void { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } const scrollTop = this.view.getScrollTop(); @@ -1547,7 +1548,7 @@ export class List implements ISpliceable, IDisposable { */ getRelativeTop(index: number): number | null { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } const scrollTop = this.view.getScrollTop(); @@ -1574,7 +1575,7 @@ export class List implements ISpliceable, IDisposable { open(indexes: number[], browserEvent?: UIEvent): void { for (const index of indexes) { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } } @@ -1584,7 +1585,7 @@ export class List implements ISpliceable, IDisposable { pin(indexes: number[]): void { for (const index of indexes) { if (index < 0 || index >= this.length) { - throw new Error(`Invalid index ${index}`); + throw new ListError(this.user, `Invalid index ${index}`); } } diff --git a/src/vs/base/browser/ui/list/rangeMap.ts b/src/vs/base/browser/ui/list/rangeMap.ts index 1bf7217d0af..8a732eb4460 100644 --- a/src/vs/base/browser/ui/list/rangeMap.ts +++ b/src/vs/base/browser/ui/list/rangeMap.ts @@ -186,8 +186,4 @@ export class RangeMap { return -1; } - - dispose() { - this.groups = null!; // StrictNullOverride: nulling out ok in dispose - } } diff --git a/src/vs/base/browser/ui/list/rowCache.ts b/src/vs/base/browser/ui/list/rowCache.ts index dd54c73a0a7..25eb321997b 100644 --- a/src/vs/base/browser/ui/list/rowCache.ts +++ b/src/vs/base/browser/ui/list/rowCache.ts @@ -79,11 +79,7 @@ export class RowCache implements IDisposable { return result; } - private garbageCollect(): void { - if (!this.renderers) { - return; - } - + dispose(): void { this.cache.forEach((cachedRows, templateId) => { for (const cachedRow of cachedRows) { const renderer = this.getRenderer(templateId); @@ -96,12 +92,6 @@ export class RowCache implements IDisposable { this.cache.clear(); } - dispose(): void { - this.garbageCollect(); - this.cache.clear(); - this.renderers = null!; // StrictNullOverride: nulling out ok in dispose - } - private getRenderer(templateId: string): IListRenderer { const renderer = this.renderers.get(templateId); if (!renderer) { @@ -109,4 +99,4 @@ export class RowCache implements IDisposable { } return renderer; } -} \ No newline at end of file +} diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts index c6644247b2b..960dc57e267 100644 --- a/src/vs/base/browser/ui/menu/menubar.ts +++ b/src/vs/base/browser/ui/menu/menubar.ts @@ -758,7 +758,7 @@ export class MenuBar extends Disposable { if (menuBarMenu.titleElement.children.length) { let child = menuBarMenu.titleElement.children.item(0) as HTMLElement; if (child) { - child.style.textDecoration = (this.options.alwaysOnMnemonics || visible) ? 'underline' : null; + child.style.textDecoration = (this.options.alwaysOnMnemonics || visible) ? 'underline' : ''; } } }); diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css index 29ed93db1b1..d9cc1b7a4fa 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css @@ -1,7 +1,7 @@ @font-face { font-family: "octicons"; - src: url("./octicons.ttf?dda6b6d46f87b1fa91a76fc0389eeb1d") format("truetype"), -url("./octicons.svg?dda6b6d46f87b1fa91a76fc0389eeb1d#octicons") format("svg"); + src: url("./octicons.ttf?1b0f2a9535896866c74dd24eedeb4374") format("truetype"), +url("./octicons.svg?1b0f2a9535896866c74dd24eedeb4374#octicons") format("svg"); } .octicon, .mega-octicon { @@ -169,7 +169,7 @@ url("./octicons.svg?dda6b6d46f87b1fa91a76fc0389eeb1d#octicons") format("svg"); .octicon-person-outline:before { content: "\f018" } .octicon-pin:before { content: "\f041" } .octicon-plug:before { content: "\f0d4" } -.octicon-plus-small:before { content: "\f05d" } +.octicon-plus-small:before { content: "\f28a" } .octicon-plus:before { content: "\f05d" } .octicon-primitive-dot:before { content: "\f052" } .octicon-primitive-square:before { content: "\f053" } @@ -233,19 +233,16 @@ url("./octicons.svg?dda6b6d46f87b1fa91a76fc0389eeb1d#octicons") format("svg"); .octicon-watch:before { content: "\f0e0" } .octicon-x:before { content: "\f081" } .octicon-zap:before { content: "\26a1" } -.octicon-error:before { content: "\26a2" } -.octicon-eye-closed:before { content: "\26a3" } -.octicon-fold-down:before { content: "\26a4" } -.octicon-fold-up:before { content: "\26a5" } -.octicon-github-action:before { content: "\26a6" } -.octicon-info-outline:before { content: "\26a7" } -.octicon-play:before { content: "\26a8" } -.octicon-remote:before { content: "\26a9" } -.octicon-request-changes:before { content: "\26aa" } -.octicon-smiley-outline:before { content: "\f27d" } -.octicon-warning:before { content: "\f02d" } -.octicon-controls:before { content: "\26ad" } -.octicon-event:before { content: "\26ae" } -.octicon-record-keys:before { content: "\26af" } .octicon-archive:before { content: "\f101" } .octicon-arrow-both:before { content: "\f102" } +.octicon-error:before { content: "\f103" } +.octicon-eye-closed:before { content: "\f104" } +.octicon-fold-down:before { content: "\f105" } +.octicon-fold-up:before { content: "\f106" } +.octicon-github-action:before { content: "\f107" } +.octicon-info-outline:before { content: "\f108" } +.octicon-play:before { content: "\f109" } +.octicon-remote:before { content: "\f10a" } +.octicon-request-changes:before { content: "\f10b" } +.octicon-smiley-outline:before { content: "\f10c" } +.octicon-warning:before { content: "\f10d" } diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg index 48f7d1b2220..3f4ab4f1807 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg @@ -167,10 +167,10 @@ unicode="" horiz-adv-x="750" d=" M687.5 507.5H62.5C28.125 507.5 0 479.375 0 445V195C0 160.625 28.125 132.5 62.5 132.5H687.5C721.875 132.5 750 160.625 750 195V445C750 479.375 721.875 507.5 687.5 507.5zM250 257.5H125V382.5H250V257.5zM437.5 257.5H312.5V382.5H437.5V257.5zM625 257.5H500V382.5H625V257.5z" /> = this.el.clientHeight - 4) { - orthogonalSash = this.orthogonalEndSash; - } - } else { - if (e.offsetX <= 4) { - orthogonalSash = this.orthogonalStartSash; - } else if (e.offsetX >= this.el.clientWidth - 4) { - orthogonalSash = this.orthogonalEndSash; - } - } + const orthogonalSash = this.getOrthogonalSash(e); if (orthogonalSash) { isMultisashResize = true; @@ -208,6 +189,11 @@ export class Sash extends Disposable { } } + if (this.linkedSash && !(e as any).__linkedSashEvent) { + (e as any).__linkedSashEvent = true; + this.linkedSash.onMouseDown(e); + } + if (!this.state) { return; } @@ -295,7 +281,17 @@ export class Sash extends Disposable { domEvent(window, 'mouseup')(onMouseUp, null, disposables); } - private onMouseDoubleClick(event: MouseEvent): void { + private onMouseDoubleClick(e: MouseEvent): void { + const orthogonalSash = this.getOrthogonalSash(e); + + if (orthogonalSash) { + orthogonalSash._onDidReset.fire(); + } + + if (this.linkedSash) { + this.linkedSash._onDidReset.fire(); + } + this._onDidReset.fire(); } @@ -386,13 +382,26 @@ export class Sash extends Disposable { toggleClass(this.el, 'orthogonal-end', state !== SashState.Disabled); } - dispose(): void { - super.dispose(); - - if (this.el && this.el.parentElement) { - this.el.parentElement.removeChild(this.el); + private getOrthogonalSash(e: MouseEvent): Sash | undefined { + if (this.orientation === Orientation.VERTICAL) { + if (e.offsetY <= 4) { + return this.orthogonalStartSash; + } else if (e.offsetY >= this.el.clientHeight - 4) { + return this.orthogonalEndSash; + } + } else { + if (e.offsetX <= 4) { + return this.orthogonalStartSash; + } else if (e.offsetX >= this.el.clientWidth - 4) { + return this.orthogonalEndSash; + } } - this.el = null!; // StrictNullOverride: nulling out ok in dispose + return undefined; + } + + dispose(): void { + super.dispose(); + this.el.remove(); } } diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index d144eb63050..366e1bfa0b4 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -721,7 +721,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi this.listRenderer = new SelectListRenderer(); - this.selectList = new List(this.selectDropDownListContainer, this, [this.listRenderer], { + this.selectList = new List('SelectBoxCustom', this.selectDropDownListContainer, this, [this.listRenderer], { ariaLabel: this.selectBoxOptions.ariaLabel, useShadows: false, verticalScrollMode: ScrollbarVisibility.Visible, diff --git a/src/vs/base/browser/ui/splitview/splitview.css b/src/vs/base/browser/ui/splitview/splitview.css index 2988cfef8eb..6fb8f1c61d0 100644 --- a/src/vs/base/browser/ui/splitview/splitview.css +++ b/src/vs/base/browser/ui/splitview/splitview.css @@ -72,4 +72,4 @@ .monaco-split-view2.separator-border.vertical > .split-view-container > .split-view-view:not(:first-child)::before { height: 1px; width: 100%; -} +} \ No newline at end of file diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 81090f39c2c..5e5e54dcf61 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -29,7 +29,8 @@ export interface ISplitViewOptions { readonly orthogonalStartSash?: Sash; readonly orthogonalEndSash?: Sash; readonly inverseAltBehavior?: boolean; - readonly proportionalLayout?: boolean; // default true + readonly proportionalLayout?: boolean; // default true, + readonly descriptor?: ISplitViewDescriptor; } /** @@ -124,12 +125,7 @@ abstract class ViewItem { } } - layout(_orthogonalSize: number | undefined): void { - this.container.scrollTop = 0; - this.container.scrollLeft = 0; - } - - layoutView(orthogonalSize: number | undefined): void { + layout(orthogonalSize: number | undefined): void { this.view.layout(this.size, orthogonalSize); } @@ -144,7 +140,6 @@ class VerticalViewItem extends ViewItem { layout(orthogonalSize: number | undefined): void { super.layout(orthogonalSize); this.container.style.height = `${this.size}px`; - this.layoutView(orthogonalSize); } } @@ -153,7 +148,6 @@ class HorizontalViewItem extends ViewItem { layout(orthogonalSize: number | undefined): void { super.layout(orthogonalSize); this.container.style.width = `${this.size}px`; - this.layoutView(orthogonalSize); } } @@ -197,6 +191,15 @@ export namespace Sizing { export function Invisible(cachedVisibleSize: number): InvisibleSizing { return { type: 'invisible', cachedVisibleSize }; } } +export interface ISplitViewDescriptor { + size: number; + views: { + visible?: boolean; + size: number; + view: IView; + }[]; +} + export class SplitView extends Disposable { readonly orientation: Orientation; @@ -272,6 +275,21 @@ export class SplitView extends Disposable { this.viewContainer = dom.append(this.el, dom.$('.split-view-container')); this.style(options.styles || defaultStyles); + + // We have an existing set of view, add them now + if (options.descriptor) { + this.size = options.descriptor.size; + options.descriptor.views.forEach((viewDescriptor, index) => { + const sizing = types.isUndefined(viewDescriptor.visible) || viewDescriptor.visible ? viewDescriptor.size : { type: 'invisible', cachedVisibleSize: viewDescriptor.size } as InvisibleSizing; + + const view = viewDescriptor.view; + this.doAddView(view, sizing, index, true); + }); + + // Initialize content size and proportions for first layout + this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + this.saveProportions(); + } } style(styles: ISplitViewStyles): void { @@ -285,102 +303,7 @@ export class SplitView extends Disposable { } addView(view: IView, size: number | Sizing, index = this.viewItems.length): void { - if (this.state !== State.Idle) { - throw new Error('Cant modify splitview'); - } - - this.state = State.Busy; - - // Add view - const container = dom.$('.split-view-view'); - - if (index === this.viewItems.length) { - this.viewContainer.appendChild(container); - } else { - this.viewContainer.insertBefore(container, this.viewContainer.children.item(index)); - } - - const onChangeDisposable = view.onDidChange(size => this.onViewChange(item, size)); - const containerDisposable = toDisposable(() => this.viewContainer.removeChild(container)); - const disposable = combinedDisposable(onChangeDisposable, containerDisposable); - - let viewSize: ViewItemSize; - - if (typeof size === 'number') { - viewSize = size; - } else if (size.type === 'split') { - viewSize = this.getViewSize(size.index) / 2; - } else if (size.type === 'invisible') { - viewSize = { cachedVisibleSize: size.cachedVisibleSize }; - } else { - viewSize = view.minimumSize; - } - - const item = this.orientation === Orientation.VERTICAL - ? new VerticalViewItem(container, view, viewSize, disposable) - : new HorizontalViewItem(container, view, viewSize, disposable); - - this.viewItems.splice(index, 0, item); - - // Add sash - if (this.viewItems.length > 1) { - const orientation = this.orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; - const layoutProvider = this.orientation === Orientation.VERTICAL ? { getHorizontalSashTop: (sash: Sash) => this.getSashPosition(sash) } : { getVerticalSashLeft: (sash: Sash) => this.getSashPosition(sash) }; - const sash = new Sash(this.sashContainer, layoutProvider, { - orientation, - orthogonalStartSash: this.orthogonalStartSash, - orthogonalEndSash: this.orthogonalEndSash - }); - - const sashEventMapper = this.orientation === Orientation.VERTICAL - ? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) - : (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey }); - - const onStart = Event.map(sash.onDidStart, sashEventMapper); - const onStartDisposable = onStart(this.onSashStart, this); - const onChange = Event.map(sash.onDidChange, sashEventMapper); - const onChangeDisposable = onChange(this.onSashChange, this); - const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash)); - const onEndDisposable = onEnd(this.onSashEnd, this); - - const onDidResetDisposable = sash.onDidReset(() => { - const index = firstIndex(this.sashItems, item => item.sash === sash); - const upIndexes = range(index, -1); - const downIndexes = range(index + 1, this.viewItems.length); - const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); - const snapAfterIndex = this.findFirstSnapIndex(downIndexes); - - if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { - return; - } - - if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { - return; - } - - this._onDidSashReset.fire(index); - }); - - const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash); - const sashItem: ISashItem = { sash, disposable }; - - this.sashItems.splice(index - 1, 0, sashItem); - } - - container.appendChild(view.element); - - let highPriorityIndexes: number[] | undefined; - - if (typeof size !== 'number' && size.type === 'split') { - highPriorityIndexes = [size.index]; - } - - this.relayout([index], highPriorityIndexes); - this.state = State.Idle; - - if (typeof size !== 'number' && size.type === 'distribute') { - this.distributeViewSizes(); - } + this.doAddView(view, size, index, false); } removeView(index: number, sizing?: Sizing): IView { @@ -689,6 +612,108 @@ export class SplitView extends Disposable { return this.viewItems[index].size; } + private doAddView(view: IView, size: number | Sizing, index = this.viewItems.length, skipLayout?: boolean): void { + if (this.state !== State.Idle) { + throw new Error('Cant modify splitview'); + } + + this.state = State.Busy; + + // Add view + const container = dom.$('.split-view-view'); + + if (index === this.viewItems.length) { + this.viewContainer.appendChild(container); + } else { + this.viewContainer.insertBefore(container, this.viewContainer.children.item(index)); + } + + const onChangeDisposable = view.onDidChange(size => this.onViewChange(item, size)); + const containerDisposable = toDisposable(() => this.viewContainer.removeChild(container)); + const disposable = combinedDisposable(onChangeDisposable, containerDisposable); + + let viewSize: ViewItemSize; + + if (typeof size === 'number') { + viewSize = size; + } else if (size.type === 'split') { + viewSize = this.getViewSize(size.index) / 2; + } else if (size.type === 'invisible') { + viewSize = { cachedVisibleSize: size.cachedVisibleSize }; + } else { + viewSize = view.minimumSize; + } + + const item = this.orientation === Orientation.VERTICAL + ? new VerticalViewItem(container, view, viewSize, disposable) + : new HorizontalViewItem(container, view, viewSize, disposable); + + this.viewItems.splice(index, 0, item); + + // Add sash + if (this.viewItems.length > 1) { + const orientation = this.orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; + const layoutProvider = this.orientation === Orientation.VERTICAL ? { getHorizontalSashTop: (sash: Sash) => this.getSashPosition(sash) } : { getVerticalSashLeft: (sash: Sash) => this.getSashPosition(sash) }; + const sash = new Sash(this.sashContainer, layoutProvider, { + orientation, + orthogonalStartSash: this.orthogonalStartSash, + orthogonalEndSash: this.orthogonalEndSash + }); + + const sashEventMapper = this.orientation === Orientation.VERTICAL + ? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) + : (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey }); + + const onStart = Event.map(sash.onDidStart, sashEventMapper); + const onStartDisposable = onStart(this.onSashStart, this); + const onChange = Event.map(sash.onDidChange, sashEventMapper); + const onChangeDisposable = onChange(this.onSashChange, this); + const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash)); + const onEndDisposable = onEnd(this.onSashEnd, this); + + const onDidResetDisposable = sash.onDidReset(() => { + const index = firstIndex(this.sashItems, item => item.sash === sash); + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); + const snapAfterIndex = this.findFirstSnapIndex(downIndexes); + + if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { + return; + } + + if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { + return; + } + + this._onDidSashReset.fire(index); + }); + + const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash); + const sashItem: ISashItem = { sash, disposable }; + + this.sashItems.splice(index - 1, 0, sashItem); + } + + container.appendChild(view.element); + + let highPriorityIndexes: number[] | undefined; + + if (typeof size !== 'number' && size.type === 'split') { + highPriorityIndexes = [size.index]; + } + + if (!skipLayout) { + this.relayout([index], highPriorityIndexes); + } + + this.state = State.Idle; + + if (!skipLayout && typeof size !== 'number' && size.type === 'distribute') { + this.distributeViewSizes(); + } + } + private relayout(lowPriorityIndexes?: number[], highPriorityIndexes?: number[]): void { const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); @@ -850,9 +875,12 @@ export class SplitView extends Disposable { const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); const snapAfterIndex = this.findFirstSnapIndex(downIndexes); - if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { + const snappedBefore = typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible; + const snappedAfter = typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible; + + if (snappedBefore && collapsesUp[index]) { sash.state = SashState.Minimum; - } else if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { + } else if (snappedAfter && collapsesDown[index]) { sash.state = SashState.Maximum; } else { sash.state = SashState.Disabled; diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 1aa9c5363e2..410368f5f49 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -1087,6 +1087,7 @@ interface ITreeNodeListOptions extends IListOptions extends List> { constructor( + user: string, container: HTMLElement, virtualDelegate: IListVirtualDelegate>, renderers: IListRenderer[], @@ -1094,7 +1095,7 @@ class TreeNodeList extends List> private selectionTrait: Trait, options: ITreeNodeListOptions ) { - super(container, virtualDelegate, renderers, options); + super(user, container, virtualDelegate, renderers, options); } protected createMouseController(options: ITreeNodeListOptions): MouseController> { @@ -1195,6 +1196,7 @@ export abstract class AbstractTree implements IDisposable get onDidDispose(): Event { return this.view.onDidDispose; } constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], @@ -1220,9 +1222,9 @@ export abstract class AbstractTree implements IDisposable this.focus = new Trait(_options.identityProvider); this.selection = new Trait(_options.identityProvider); - this.view = new TreeNodeList(container, treeDelegate, this.renderers, this.focus, this.selection, { ...asListOptions(() => this.model, _options), tree: this }); + this.view = new TreeNodeList(user, container, treeDelegate, this.renderers, this.focus, this.selection, { ...asListOptions(() => this.model, _options), tree: this }); - this.model = this.createModel(this.view, _options); + this.model = this.createModel(user, this.view, _options); onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState; this.model.onDidSplice(e => { @@ -1586,7 +1588,7 @@ export abstract class AbstractTree implements IDisposable this.model.setCollapsed(location, undefined, recursive); } - protected abstract createModel(view: ISpliceable>, options: IAbstractTreeOptions): ITreeModel; + protected abstract createModel(user: string, view: ISpliceable>, options: IAbstractTreeOptions): ITreeModel; navigate(start?: TRef): ITreeNavigator { return new TreeNavigator(this.view, this.model, start); diff --git a/src/vs/base/browser/ui/tree/asyncDataTree.ts b/src/vs/base/browser/ui/tree/asyncDataTree.ts index 9c6bea61a41..a8dca1e311a 100644 --- a/src/vs/base/browser/ui/tree/asyncDataTree.ts +++ b/src/vs/base/browser/ui/tree/asyncDataTree.ts @@ -6,7 +6,7 @@ import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate } from 'vs/base/browser/ui/tree/abstractTree'; import { ObjectTree, IObjectTreeOptions } from 'vs/base/browser/ui/tree/objectTree'; import { IListVirtualDelegate, IIdentityProvider, IListDragAndDrop, IListDragOverReaction } from 'vs/base/browser/ui/list/list'; -import { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop } from 'vs/base/browser/ui/tree/tree'; +import { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop, TreeError } from 'vs/base/browser/ui/tree/tree'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { Emitter, Event } from 'vs/base/common/event'; import { timeout, CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; @@ -339,6 +339,7 @@ export class AsyncDataTree implements IDisposable get onDidDispose(): Event { return this.tree.onDidDispose; } constructor( + private user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], @@ -354,7 +355,7 @@ export class AsyncDataTree implements IDisposable const objectTreeRenderers = renderers.map(r => new DataTreeRenderer(r, this._onDidChangeNodeSlowState.event)); const objectTreeOptions = asObjectTreeOptions(options) || {}; - this.tree = new ObjectTree(container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions); + this.tree = new ObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions); this.root = createAsyncDataTreeNode({ element: undefined!, @@ -464,7 +465,7 @@ export class AsyncDataTree implements IDisposable async updateChildren(element: TInput | T = this.root.element, recursive = true, viewStateContext?: IAsyncDataTreeViewStateContext): Promise { if (typeof this.root.element === 'undefined') { - throw new Error('Tree input not set'); + throw new TreeError(this.user, 'Tree input not set'); } if (this.root.loading) { @@ -515,7 +516,7 @@ export class AsyncDataTree implements IDisposable async expand(element: T, recursive: boolean = false): Promise { if (typeof this.root.element === 'undefined') { - throw new Error('Tree input not set'); + throw new TreeError(this.user, 'Tree input not set'); } if (this.root.loading) { @@ -643,7 +644,7 @@ export class AsyncDataTree implements IDisposable const node: IAsyncDataTreeNode | undefined = this.nodes.get((element === this.root.element ? null : element) as T); if (!node) { - throw new Error(`Data tree node not found: ${element}`); + throw new TreeError(this.user, `Data tree node not found: ${element}`); } return node; @@ -875,7 +876,7 @@ export class AsyncDataTree implements IDisposable getViewState(): IAsyncDataTreeViewState { if (!this.identityProvider) { - throw new Error('Can\'t get tree view state without an identity provider'); + throw new TreeError(this.user, 'Can\'t get tree view state without an identity provider'); } const getId = (element: T) => this.identityProvider!.getId(element).toString(); diff --git a/src/vs/base/browser/ui/tree/compressedObjectTree.ts b/src/vs/base/browser/ui/tree/compressedObjectTree.ts index dd98e865909..beba028a923 100644 --- a/src/vs/base/browser/ui/tree/compressedObjectTree.ts +++ b/src/vs/base/browser/ui/tree/compressedObjectTree.ts @@ -22,12 +22,13 @@ export class CompressedObjectTree, TFilterData = void get onDidChangeCollapseState(): Event | null, TFilterData>> { return this.model.onDidChangeCollapseState; } constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate>, renderers: ITreeRenderer, TFilterData, any>[], options: IObjectTreeOptions, TFilterData> = {} ) { - super(container, delegate, renderers, options); + super(user, container, delegate, renderers, options); } setChildren( @@ -50,7 +51,7 @@ export class CompressedObjectTree, TFilterData = void this.model.resort(element, recursive); } - protected createModel(view: ISpliceable, TFilterData>>, options: IObjectTreeOptions, TFilterData>): ITreeModel | null, TFilterData, T | null> { - return new CompressedTreeModel(view, options); + protected createModel(user: string, view: ISpliceable, TFilterData>>, options: IObjectTreeOptions, TFilterData>): ITreeModel | null, TFilterData, T | null> { + return new CompressedTreeModel(user, view, options); } } diff --git a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts index 339dfdbbe9e..81cae3bcd0c 100644 --- a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts +++ b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts @@ -6,7 +6,7 @@ import { ISpliceable } from 'vs/base/common/sequence'; import { Iterator, ISequence } from 'vs/base/common/iterator'; import { Event } from 'vs/base/common/event'; -import { ITreeModel, ITreeNode, ITreeElement, ICollapseStateChangeEvent, ITreeModelSpliceEvent } from 'vs/base/browser/ui/tree/tree'; +import { ITreeModel, ITreeNode, ITreeElement, ICollapseStateChangeEvent, ITreeModelSpliceEvent, TreeError } from 'vs/base/browser/ui/tree/tree'; import { IObjectTreeModelOptions, ObjectTreeModel, IObjectTreeModel } from 'vs/base/browser/ui/tree/objectTreeModel'; export interface ICompressedTreeElement extends ITreeElement { @@ -95,8 +95,12 @@ export class CompressedTreeModel, TFilterData extends get size(): number { return this.nodes.size; } - constructor(list: ISpliceable, TFilterData>>, options: ICompressedTreeModelOptions = {}) { - this.model = new ObjectTreeModel(list, options); + constructor( + private user: string, + list: ISpliceable, TFilterData>>, + options: ICompressedTreeModelOptions = {} + ) { + this.model = new ObjectTreeModel(user, list, options); } setChildren( @@ -264,7 +268,7 @@ export class CompressedTreeModel, TFilterData extends const node = this.nodes.get(element); if (!node) { - throw new Error(`Tree element not found: ${element}`); + throw new TreeError(this.user, `Tree element not found: ${element}`); } return node; @@ -320,12 +324,13 @@ export class CompressedObjectTreeModel, TFilterData e private model: CompressedTreeModel; constructor( + user: string, list: ISpliceable, TFilterData>>, options: ICompressedObjectTreeModelOptions = {} ) { this.mapElement = options.elementMapper || DefaultElementMapper; this.mapNode = createNodeMapper(this.mapElement); - this.model = new CompressedTreeModel(list, options); + this.model = new CompressedTreeModel(user, list, options); } setChildren( @@ -415,4 +420,4 @@ export class CompressedObjectTreeModel, TFilterData e resort(element: T | null = null, recursive = true): void { return this.model.resort(element, recursive); } -} \ No newline at end of file +} diff --git a/src/vs/base/browser/ui/tree/dataTree.ts b/src/vs/base/browser/ui/tree/dataTree.ts index 9a67a381edb..f9f8263655e 100644 --- a/src/vs/base/browser/ui/tree/dataTree.ts +++ b/src/vs/base/browser/ui/tree/dataTree.ts @@ -5,7 +5,7 @@ import { AbstractTree, IAbstractTreeOptions } from 'vs/base/browser/ui/tree/abstractTree'; import { ISpliceable } from 'vs/base/common/sequence'; -import { ITreeNode, ITreeModel, ITreeElement, ITreeRenderer, ITreeSorter, IDataSource } from 'vs/base/browser/ui/tree/tree'; +import { ITreeNode, ITreeModel, ITreeElement, ITreeRenderer, ITreeSorter, IDataSource, TreeError } from 'vs/base/browser/ui/tree/tree'; import { ObjectTreeModel } from 'vs/base/browser/ui/tree/objectTreeModel'; import { IListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list'; import { Iterator } from 'vs/base/common/iterator'; @@ -30,13 +30,14 @@ export class DataTree extends AbstractTree>(); constructor( + private user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], private dataSource: IDataSource, options: IDataTreeOptions = {} ) { - super(container, delegate, renderers, options); + super(user, container, delegate, renderers, options); this.identityProvider = options.identityProvider; } @@ -48,7 +49,7 @@ export class DataTree extends AbstractTree extends AbstractTree boolean | undefined) | undefined; @@ -169,15 +170,15 @@ export class DataTree extends AbstractTree>, options: IDataTreeOptions): ITreeModel { - return new ObjectTreeModel(view, options); + protected createModel(user: string, view: ISpliceable>, options: IDataTreeOptions): ITreeModel { + return new ObjectTreeModel(user, view, options); } // view state getViewState(): IDataTreeViewState { if (!this.identityProvider) { - throw new Error('Can\'t get tree view state without an identity provider'); + throw new TreeError(this.user, 'Can\'t get tree view state without an identity provider'); } const getId = (element: T) => this.identityProvider!.getId(element).toString(); diff --git a/src/vs/base/browser/ui/tree/indexTree.ts b/src/vs/base/browser/ui/tree/indexTree.ts index b0b86e0a6f9..fcb9e60c4b2 100644 --- a/src/vs/base/browser/ui/tree/indexTree.ts +++ b/src/vs/base/browser/ui/tree/indexTree.ts @@ -18,13 +18,14 @@ export class IndexTree extends AbstractTree; constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], private rootElement: T, options: IIndexTreeOptions = {} ) { - super(container, delegate, renderers, options); + super(user, container, delegate, renderers, options); } splice(location: number[], deleteCount: number, toInsert: ISequence> = Iterator.empty()): Iterator> { @@ -40,7 +41,7 @@ export class IndexTree extends AbstractTree>, options: IIndexTreeOptions): ITreeModel { - return new IndexTreeModel(view, this.rootElement, options); + protected createModel(user: string, view: ISpliceable>, options: IIndexTreeOptions): ITreeModel { + return new IndexTreeModel(user, view, this.rootElement, options); } } diff --git a/src/vs/base/browser/ui/tree/indexTreeModel.ts b/src/vs/base/browser/ui/tree/indexTreeModel.ts index bdf19be09f5..022d612c0a3 100644 --- a/src/vs/base/browser/ui/tree/indexTreeModel.ts +++ b/src/vs/base/browser/ui/tree/indexTreeModel.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ICollapseStateChangeEvent, ITreeElement, ITreeFilter, ITreeFilterDataResult, ITreeModel, ITreeNode, TreeVisibility, ITreeModelSpliceEvent } from 'vs/base/browser/ui/tree/tree'; +import { ICollapseStateChangeEvent, ITreeElement, ITreeFilter, ITreeFilterDataResult, ITreeModel, ITreeNode, TreeVisibility, ITreeModelSpliceEvent, TreeError } from 'vs/base/browser/ui/tree/tree'; import { tail2 } from 'vs/base/common/arrays'; import { Emitter, Event, EventBufferer } from 'vs/base/common/event'; import { ISequence, Iterator } from 'vs/base/common/iterator'; @@ -66,7 +66,12 @@ export class IndexTreeModel, TFilterData = voi private _onDidSplice = new Emitter>(); readonly onDidSplice = this._onDidSplice.event; - constructor(private list: ISpliceable>, rootElement: T, options: IIndexTreeModelOptions = {}) { + constructor( + private user: string, + private list: ISpliceable>, + rootElement: T, + options: IIndexTreeModelOptions = {} + ) { this.collapseByDefault = typeof options.collapseByDefault === 'undefined' ? false : options.collapseByDefault; this.filter = options.filter; this.autoExpandSingleChildren = typeof options.autoExpandSingleChildren === 'undefined' ? false : options.autoExpandSingleChildren; @@ -94,7 +99,7 @@ export class IndexTreeModel, TFilterData = voi onDidDeleteNode?: (node: ITreeNode) => void ): Iterator> { if (location.length === 0) { - throw new Error('Invalid tree location'); + throw new TreeError(this.user, 'Invalid tree location'); } const { parentNode, listIndex, revealed, visible } = this.getParentNodeWithListIndex(location); @@ -177,7 +182,7 @@ export class IndexTreeModel, TFilterData = voi rerender(location: number[]): void { if (location.length === 0) { - throw new Error('Invalid tree location'); + throw new TreeError(this.user, 'Invalid tree location'); } const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location); @@ -492,7 +497,7 @@ export class IndexTreeModel, TFilterData = voi const [index, ...rest] = location; if (index < 0 || index > node.children.length) { - throw new Error('Invalid tree location'); + throw new TreeError(this.user, 'Invalid tree location'); } return this.getTreeNode(rest, node.children[index]); @@ -508,7 +513,7 @@ export class IndexTreeModel, TFilterData = voi const index = location[location.length - 1]; if (index < 0 || index > parentNode.children.length) { - throw new Error('Invalid tree location'); + throw new TreeError(this.user, 'Invalid tree location'); } const node = parentNode.children[index]; @@ -520,7 +525,7 @@ export class IndexTreeModel, TFilterData = voi const [index, ...rest] = location; if (index < 0 || index > node.children.length) { - throw new Error('Invalid tree location'); + throw new TreeError(this.user, 'Invalid tree location'); } // TODO@joao perf! diff --git a/src/vs/base/browser/ui/tree/objectTree.ts b/src/vs/base/browser/ui/tree/objectTree.ts index 25397807106..d64062f1b13 100644 --- a/src/vs/base/browser/ui/tree/objectTree.ts +++ b/src/vs/base/browser/ui/tree/objectTree.ts @@ -22,12 +22,13 @@ export class ObjectTree, TFilterData = void> extends get onDidChangeCollapseState(): Event> { return this.model.onDidChangeCollapseState; } constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], options: IObjectTreeOptions = {} ) { - super(container, delegate, renderers, options); + super(user, container, delegate, renderers, options); } setChildren( @@ -50,7 +51,7 @@ export class ObjectTree, TFilterData = void> extends this.model.resort(element, recursive); } - protected createModel(view: ISpliceable>, options: IObjectTreeOptions): ITreeModel { - return new ObjectTreeModel(view, options); + protected createModel(user: string, view: ISpliceable>, options: IObjectTreeOptions): ITreeModel { + return new ObjectTreeModel(user, view, options); } } diff --git a/src/vs/base/browser/ui/tree/objectTreeModel.ts b/src/vs/base/browser/ui/tree/objectTreeModel.ts index 626d1264daa..df4dabcdbc6 100644 --- a/src/vs/base/browser/ui/tree/objectTreeModel.ts +++ b/src/vs/base/browser/ui/tree/objectTreeModel.ts @@ -7,7 +7,7 @@ import { ISpliceable } from 'vs/base/common/sequence'; import { Iterator, ISequence, getSequenceIterator } from 'vs/base/common/iterator'; import { IndexTreeModel, IIndexTreeModelOptions } from 'vs/base/browser/ui/tree/indexTreeModel'; import { Event } from 'vs/base/common/event'; -import { ITreeModel, ITreeNode, ITreeElement, ITreeSorter, ICollapseStateChangeEvent, ITreeModelSpliceEvent } from 'vs/base/browser/ui/tree/tree'; +import { ITreeModel, ITreeNode, ITreeElement, ITreeSorter, ICollapseStateChangeEvent, ITreeModelSpliceEvent, TreeError } from 'vs/base/browser/ui/tree/tree'; import { IIdentityProvider } from 'vs/base/browser/ui/list/list'; export type ITreeNodeCallback = (node: ITreeNode) => void; @@ -38,8 +38,12 @@ export class ObjectTreeModel, TFilterData extends Non get size(): number { return this.nodes.size; } - constructor(list: ISpliceable>, options: IObjectTreeModelOptions = {}) { - this.model = new IndexTreeModel(list, null, options); + constructor( + private user: string, + list: ISpliceable>, + options: IObjectTreeModelOptions = {} + ) { + this.model = new IndexTreeModel(user, list, null, options); this.onDidSplice = this.model.onDidSplice; this.onDidChangeCollapseState = this.model.onDidChangeCollapseState as Event>; this.onDidChangeRenderNodeCount = this.model.onDidChangeRenderNodeCount as Event>; @@ -239,7 +243,7 @@ export class ObjectTreeModel, TFilterData extends Non const node = this.nodes.get(element); if (!node) { - throw new Error(`Tree element not found: ${element}`); + throw new TreeError(this.user, `Tree element not found: ${element}`); } return node; @@ -251,13 +255,13 @@ export class ObjectTreeModel, TFilterData extends Non getParentNodeLocation(element: T | null): T | null { if (element === null) { - throw new Error(`Invalid getParentNodeLocation call`); + throw new TreeError(this.user, `Invalid getParentNodeLocation call`); } const node = this.nodes.get(element); if (!node) { - throw new Error(`Tree element not found: ${element}`); + throw new TreeError(this.user, `Tree element not found: ${element}`); } return node.parent!.element; @@ -271,7 +275,7 @@ export class ObjectTreeModel, TFilterData extends Non const node = this.nodes.get(element); if (!node) { - throw new Error(`Tree element not found: ${element}`); + throw new TreeError(this.user, `Tree element not found: ${element}`); } return this.model.getNodeLocation(node); diff --git a/src/vs/base/browser/ui/tree/tree.ts b/src/vs/base/browser/ui/tree/tree.ts index 5f9f2e14d69..930e76634bb 100644 --- a/src/vs/base/browser/ui/tree/tree.ts +++ b/src/vs/base/browser/ui/tree/tree.ts @@ -194,3 +194,10 @@ export const TreeDragOverReactions = { export interface ITreeDragAndDrop extends IListDragAndDrop { onDragOver(data: IDragAndDropData, targetElement: T | undefined, targetIndex: number | undefined, originalEvent: DragEvent): boolean | ITreeDragOverReaction; } + +export class TreeError extends Error { + + constructor(user: string, message: string) { + super(`TreeError [${user}] ${message}`); + } +} diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index fe233f874bf..5e3150d3308 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -455,6 +455,14 @@ function printTable(table: number[][], pattern: string, patternLen: number, word return ret; } +function printTables(pattern: string, patternStart: number, word: string, wordStart: number): void { + pattern = pattern.substr(patternStart); + word = word.substr(wordStart); + console.log(printTable(_table, pattern, pattern.length, word, word.length)); + console.log(printTable(_arrows, pattern, pattern.length, word, word.length)); + console.log(printTable(_scores, pattern, pattern.length, word, word.length)); +} + function isSeparatorAtPos(value: string, index: number): boolean { if (index < 0 || index >= value.length) { return false; @@ -530,124 +538,127 @@ export interface FuzzyScorer { (pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined; } -export function fuzzyScore(pattern: string, patternLow: string, patternPos: number, word: string, wordLow: string, wordPos: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined { +export function fuzzyScore(pattern: string, patternLow: string, patternStart: number, word: string, wordLow: string, wordStart: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined { const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length; const wordLen = word.length > _maxLen ? _maxLen : word.length; - if (patternPos >= patternLen || wordPos >= wordLen || patternLen > wordLen) { + if (patternStart >= patternLen || wordStart >= wordLen || patternLen > wordLen) { return undefined; } // Run a simple check if the characters of pattern occur // (in order) at all in word. If that isn't the case we // stop because no match will be possible - if (!isPatternInWord(patternLow, patternPos, patternLen, wordLow, wordPos, wordLen)) { + if (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen)) { return undefined; } - const patternStartPos = patternPos; - const wordStartPos = wordPos; + let row: number = 1; + let column: number = 1; + let patternPos = patternStart; + let wordPos = wordStart; // There will be a match, fill in tables - for (patternPos = patternStartPos + 1; patternPos <= patternLen; patternPos++) { + for (row = 1, patternPos = patternStart; patternPos < patternLen; row++ , patternPos++) { - for (wordPos = 1; wordPos <= wordLen; wordPos++) { + for (column = 1, wordPos = wordStart; wordPos < wordLen; column++ , wordPos++) { - let score = -1; - if (patternLow[patternPos - 1] === wordLow[wordPos - 1]) { + const score = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos); - if (wordPos === (patternPos - patternStartPos)) { - // common prefix: `foobar <-> foobaz` - // ^^^^^ - if (pattern[patternPos - 1] === word[wordPos - 1]) { - score = 7; - } else { - score = 5; - } - } else if (isUpperCaseAtPos(wordPos - 1, word, wordLow) && (wordPos === 1 || !isUpperCaseAtPos(wordPos - 2, word, wordLow))) { - // hitting upper-case: `foo <-> forOthers` - // ^^ ^ - if (pattern[patternPos - 1] === word[wordPos - 1]) { - score = 7; - } else { - score = 5; - } - } else if (isSeparatorAtPos(wordLow, wordPos - 1) && (wordPos === 1 || !isSeparatorAtPos(wordLow, wordPos - 2))) { - // hitting a separator: `. <-> foo.bar` - // ^ - score = 5; + _scores[row][column] = score; - } else if (isSeparatorAtPos(wordLow, wordPos - 2) || isWhitespaceAtPos(wordLow, wordPos - 2)) { - // post separator: `foo <-> bar_foo` - // ^^^ - score = 5; - - } else { - score = 1; - } - } - - _scores[patternPos][wordPos] = score; - - const diag = _table[patternPos - 1][wordPos - 1] + (score > 1 ? 1 : score); - const top = _table[patternPos - 1][wordPos] + -1; - const left = _table[patternPos][wordPos - 1] + -1; + const diag = _table[row - 1][column - 1] + (score > 1 ? 1 : score); + const top = _table[row - 1][column] + -1; + const left = _table[row][column - 1] + -1; if (left >= top) { // left or diag if (left > diag) { - _table[patternPos][wordPos] = left; - _arrows[patternPos][wordPos] = Arrow.Left; + _table[row][column] = left; + _arrows[row][column] = Arrow.Left; } else if (left === diag) { - _table[patternPos][wordPos] = left; - _arrows[patternPos][wordPos] = Arrow.Left | Arrow.Diag; + _table[row][column] = left; + _arrows[row][column] = Arrow.Left | Arrow.Diag; } else { - _table[patternPos][wordPos] = diag; - _arrows[patternPos][wordPos] = Arrow.Diag; + _table[row][column] = diag; + _arrows[row][column] = Arrow.Diag; } } else { // top or diag if (top > diag) { - _table[patternPos][wordPos] = top; - _arrows[patternPos][wordPos] = Arrow.Top; + _table[row][column] = top; + _arrows[row][column] = Arrow.Top; } else if (top === diag) { - _table[patternPos][wordPos] = top; - _arrows[patternPos][wordPos] = Arrow.Top | Arrow.Diag; + _table[row][column] = top; + _arrows[row][column] = Arrow.Top | Arrow.Diag; } else { - _table[patternPos][wordPos] = diag; - _arrows[patternPos][wordPos] = Arrow.Diag; + _table[row][column] = diag; + _arrows[row][column] = Arrow.Diag; } } } } if (_debug) { - console.log(printTable(_table, pattern, patternLen, word, wordLen)); - console.log(printTable(_arrows, pattern, patternLen, word, wordLen)); - console.log(printTable(_scores, pattern, patternLen, word, wordLen)); + printTables(pattern, patternStart, word, wordStart); } _matchesCount = 0; _topScore = -100; - _patternStartPos = patternStartPos; + _wordStart = wordStart; _firstMatchCanBeWeak = firstMatchCanBeWeak; - _findAllMatches2(patternLen, wordLen, patternLen === wordLen ? 1 : 0, 0, false); + + _findAllMatches2(row - 1, column - 1, patternLen === wordLen ? 1 : 0, 0, false); if (_matchesCount === 0) { return undefined; } - return [_topScore, _topMatch2, wordStartPos]; + return [_topScore, _topMatch2, wordStart]; } +function _doScore(pattern: string, patternLow: string, patternPos: number, patternStart: number, word: string, wordLow: string, wordPos: number) { + if (patternLow[patternPos] !== wordLow[wordPos]) { + return -1; + } + if (wordPos === (patternPos - patternStart)) { + // common prefix: `foobar <-> foobaz` + // ^^^^^ + if (pattern[patternPos] === word[wordPos]) { + return 7; + } else { + return 5; + } + } else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) { + // hitting upper-case: `foo <-> forOthers` + // ^^ ^ + if (pattern[patternPos] === word[wordPos]) { + return 7; + } else { + return 5; + } + } else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) { + // hitting a separator: `. <-> foo.bar` + // ^ + return 5; + + } else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) { + // post separator: `foo <-> bar_foo` + // ^^^ + return 5; + + } else { + return 1; + } +} let _matchesCount: number = 0; let _topMatch2: number = 0; let _topScore: number = 0; -let _patternStartPos: number = 0; +let _wordStart: number = 0; let _firstMatchCanBeWeak: boolean = false; -function _findAllMatches2(patternPos: number, wordPos: number, total: number, matches: number, lastMatched: boolean): void { +function _findAllMatches2(row: number, column: number, total: number, matches: number, lastMatched: boolean): void { if (_matchesCount >= 10 || total < -25) { // stop when having already 10 results, or @@ -657,14 +668,14 @@ function _findAllMatches2(patternPos: number, wordPos: number, total: number, ma let simpleMatchCount = 0; - while (patternPos > _patternStartPos && wordPos > 0) { + while (row > 0 && column > 0) { - const score = _scores[patternPos][wordPos]; - const arrow = _arrows[patternPos][wordPos]; + const score = _scores[row][column]; + const arrow = _arrows[row][column]; if (arrow === Arrow.Left) { // left -> no match, skip a word character - wordPos -= 1; + column -= 1; if (lastMatched) { total -= 5; // new gap penalty } else if (matches !== 0) { @@ -678,8 +689,8 @@ function _findAllMatches2(patternPos: number, wordPos: number, total: number, ma if (arrow & Arrow.Left) { // left _findAllMatches2( - patternPos, - wordPos - 1, + row, + column - 1, matches !== 0 ? total - 1 : total, // gap penalty after first match matches, lastMatched @@ -688,12 +699,12 @@ function _findAllMatches2(patternPos: number, wordPos: number, total: number, ma // diag total += score; - patternPos -= 1; - wordPos -= 1; + row -= 1; + column -= 1; lastMatched = true; // match -> set a 1 at the word pos - matches += 2 ** wordPos; + matches += 2 ** (column + _wordStart); // count simple matches and boost a row of // simple matches when they yield in a @@ -701,7 +712,7 @@ function _findAllMatches2(patternPos: number, wordPos: number, total: number, ma if (score === 1) { simpleMatchCount += 1; - if (patternPos === _patternStartPos && !_firstMatchCanBeWeak) { + if (row === 0 && !_firstMatchCanBeWeak) { // when the first match is a weak // match we discard it return undefined; @@ -718,7 +729,7 @@ function _findAllMatches2(patternPos: number, wordPos: number, total: number, ma } } - total -= wordPos >= 3 ? 9 : wordPos * 3; // late start penalty + total -= column >= 3 ? 9 : column * 3; // late start penalty // dynamically keep track of the current top score // and insert the current best score at head, the rest at tail diff --git a/src/vs/base/common/jsonSchema.ts b/src/vs/base/common/jsonSchema.ts index 8014969d958..380b4be97b4 100644 --- a/src/vs/base/common/jsonSchema.ts +++ b/src/vs/base/common/jsonSchema.ts @@ -61,6 +61,7 @@ export interface IJSONSchema { markdownDescription?: string; // VSCode extension doNotSuggest?: boolean; // VSCode extension allowComments?: boolean; // VSCode extension + allowsTrailingCommas?: boolean; // VSCode extension } export interface IJSONSchemaMap { diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts index 39effeb6fdf..e866c720bc1 100644 --- a/src/vs/base/common/labels.ts +++ b/src/vs/base/common/labels.ts @@ -283,7 +283,7 @@ interface ISegment { * @param value string to which templating is applied * @param values the values of the templates to use */ -export function template(template: string, values: { [key: string]: string | ISeparator | null } = Object.create(null)): string { +export function template(template: string, values: { [key: string]: string | ISeparator | undefined | null } = Object.create(null)): string { const segments: ISegment[] = []; let inVariable = false; diff --git a/src/vs/base/common/map.ts b/src/vs/base/common/map.ts index eee70e82684..277ab50bb88 100644 --- a/src/vs/base/common/map.ts +++ b/src/vs/base/common/map.ts @@ -8,14 +8,6 @@ import { CharCode } from 'vs/base/common/charCode'; import { Iterator, IteratorResult, FIN } from './iterator'; -export function fromArray(array: readonly T[]): Set { - const result = new Set(); - for (const element of array) { - result.add(element); - } - return result; -} - export function values(set: Set): V[]; export function values(map: Map): V[]; export function values(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] { diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts index 07759dffe59..a657f4a4d9c 100644 --- a/src/vs/base/common/platform.ts +++ b/src/vs/base/common/platform.ts @@ -156,20 +156,21 @@ export const translationsConfigFile = _translationsConfigFile; const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any); export const globals: any = _globals; -let _setImmediate: ((callback: (...args: any[]) => void) => number) | null = null; -export function setImmediate(callback: (...args: any[]) => void): number { - if (_setImmediate === null) { - if (globals.setImmediate) { - _setImmediate = globals.setImmediate.bind(globals); - } else if (typeof process !== 'undefined' && typeof process.nextTick === 'function') { - _setImmediate = process.nextTick.bind(process); - } else { - _setImmediate = globals.setTimeout.bind(globals); - } - } - return _setImmediate!(callback); +interface ISetImmediate { + (callback: (...args: any[]) => void): void; } +export const setImmediate: ISetImmediate = (function defineSetImmediate() { + if (globals.setImmediate) { + return globals.setImmediate.bind(globals); + } + if (typeof process !== 'undefined' && typeof process.nextTick === 'function') { + return process.nextTick.bind(process); + } + const _promise = Promise.resolve(); + return (callback: (...args: any[]) => void) => _promise.then(callback); +})(); + export const enum OperatingSystem { Windows = 1, Macintosh = 2, diff --git a/src/vs/base/common/process.ts b/src/vs/base/common/process.ts index 7b9edd30963..bd23d743d3e 100644 --- a/src/vs/base/common/process.ts +++ b/src/vs/base/common/process.ts @@ -10,7 +10,7 @@ interface IProcess { env: IProcessEnvironment; cwd(): string; - nextTick(callback: (...args: any[]) => void): number; + nextTick(callback: (...args: any[]) => void): void; } declare const process: IProcess; @@ -18,7 +18,7 @@ const safeProcess: IProcess = (typeof process === 'undefined') ? { cwd(): string { return '/'; }, env: Object.create(null), get platform(): string { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; }, - nextTick(callback: (...args: any[]) => void): number { return setImmediate(callback); } + nextTick(callback: (...args: any[]) => void): void { return setImmediate(callback); } } : process; export const cwd = safeProcess.cwd; diff --git a/src/vs/base/common/search.ts b/src/vs/base/common/search.ts index c18233d61b9..743967964b6 100644 --- a/src/vs/base/common/search.ts +++ b/src/vs/base/common/search.ts @@ -12,7 +12,11 @@ export function buildReplaceStringWithCasePreserved(matches: string[] | null, pa } else if (matches[0].toLowerCase() === matches[0]) { return pattern.toLowerCase(); } else if (strings.containsUppercaseCharacter(matches[0][0])) { - return pattern[0].toUpperCase() + pattern.substr(1); + if (validateSpecificSpecialCharacter(matches, pattern, '-')) { + return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '-'); + } else { + return pattern[0].toUpperCase() + pattern.substr(1); + } } else { // we don't understand its pattern yet. return pattern; @@ -21,3 +25,19 @@ export function buildReplaceStringWithCasePreserved(matches: string[] | null, pa return pattern; } } + +function validateSpecificSpecialCharacter(matches: string[], pattern: string, specialCharacter: string): boolean { + const doesConatinSpecialCharacter = matches[0].indexOf(specialCharacter) !== -1 && pattern.indexOf(specialCharacter) !== -1; + return doesConatinSpecialCharacter && matches[0].split(specialCharacter).length === pattern.split(specialCharacter).length; +} + +function buildReplaceStringForSpecificSpecialCharacter(matches: string[], pattern: string, specialCharacter: string): string { + const splitPatternAtSpecialCharacter = pattern.split(specialCharacter); + const splitMatchAtSpecialCharacter = matches[0].split(specialCharacter); + let replaceString: string = ''; + splitPatternAtSpecialCharacter.forEach((splitValue, index) => { + replaceString += buildReplaceStringWithCasePreserved([splitMatchAtSpecialCharacter[index]], splitValue) + specialCharacter; + }); + + return replaceString.slice(0, -1); +} diff --git a/src/vs/base/node/config.ts b/src/vs/base/node/config.ts index 4e12fd565ea..6fac5849f96 100644 --- a/src/vs/base/node/config.ts +++ b/src/vs/base/node/config.ts @@ -42,11 +42,11 @@ export interface IConfigOptions { * - configurable defaults */ export class ConfigWatcher extends Disposable implements IConfigWatcher { - private cache: T; - private parseErrors: json.ParseError[]; - private disposed: boolean; - private loaded: boolean; - private timeoutHandle: NodeJS.Timer | null; + private cache: T | undefined; + private parseErrors: json.ParseError[] | undefined; + private disposed: boolean | undefined; + private loaded: boolean | undefined; + private timeoutHandle: NodeJS.Timer | null | undefined; private readonly _onDidUpdateConfiguration: Emitter>; constructor(private _path: string, private options: IConfigOptions = { defaultConfig: Object.create(null), onError: error => console.error(error) }) { @@ -62,7 +62,7 @@ export class ConfigWatcher extends Disposable implements IConfigWatcher { } get hasParseErrors(): boolean { - return this.parseErrors && this.parseErrors.length > 0; + return !!this.parseErrors && this.parseErrors.length > 0; } get onDidUpdateConfiguration(): Event> { @@ -161,7 +161,7 @@ export class ConfigWatcher extends Disposable implements IConfigWatcher { if (!objects.equals(currentConfig, this.cache)) { this.updateCache(currentConfig); - this._onDidUpdateConfiguration.fire({ config: this.cache }); + this._onDidUpdateConfiguration.fire({ config: currentConfig }); } if (callback) { @@ -173,7 +173,7 @@ export class ConfigWatcher extends Disposable implements IConfigWatcher { getConfig(): T { this.ensureLoaded(); - return this.cache; + return this.cache!; } private ensureLoaded(): void { @@ -186,4 +186,4 @@ export class ConfigWatcher extends Disposable implements IConfigWatcher { this.disposed = true; super.dispose(); } -} \ No newline at end of file +} diff --git a/src/vs/base/node/languagePacks.js b/src/vs/base/node/languagePacks.js index 445a6c5f7b3..3ae24454cb7 100644 --- a/src/vs/base/node/languagePacks.js +++ b/src/vs/base/node/languagePacks.js @@ -268,10 +268,10 @@ function factory(nodeRequire, path, fs, perf) { const packData = JSON.parse(values[1]).contents; const bundles = Object.keys(metadata.bundles); const writes = []; - for (let bundle of bundles) { + for (const bundle of bundles) { const modules = metadata.bundles[bundle]; const target = Object.create(null); - for (let module of modules) { + for (const module of modules) { const keys = metadata.keys[module]; const defaultMessages = metadata.messages[module]; const translations = packData[module]; @@ -329,4 +329,4 @@ if (typeof define === 'function') { module.exports = factory(require, path, fs, perf); } else { throw new Error('Unknown context'); -} \ No newline at end of file +} diff --git a/src/vs/base/parts/ipc/common/ipc.net.ts b/src/vs/base/parts/ipc/common/ipc.net.ts index 207fceb65b9..71ffef3a0ad 100644 --- a/src/vs/base/parts/ipc/common/ipc.net.ts +++ b/src/vs/base/parts/ipc/common/ipc.net.ts @@ -405,42 +405,57 @@ export class Client extends IPCClient { /** * Will ensure no messages are lost if there are no event listeners. */ -export function createBufferedEvent(source: Event): Event { - let emitter: Emitter; - let hasListeners = false; - let isDeliveringMessages = false; - let bufferedMessages: T[] = []; +export class BufferedEmitter { + private _emitter: Emitter; + public readonly event: Event; - const deliverMessages = () => { - if (isDeliveringMessages) { + private _hasListeners = false; + private _isDeliveringMessages = false; + private _bufferedMessages: T[] = []; + + constructor() { + this._emitter = new Emitter({ + onFirstListenerAdd: () => { + this._hasListeners = true; + // it is important to deliver these messages after this call, but before + // other messages have a chance to be received (to guarantee in order delivery) + // that's why we're using here nextTick and not other types of timeouts + process.nextTick(() => this._deliverMessages()); + }, + onLastListenerRemove: () => { + this._hasListeners = false; + } + }); + + this.event = this._emitter.event; + } + + private _deliverMessages(): void { + if (this._isDeliveringMessages) { return; } - isDeliveringMessages = true; - while (hasListeners && bufferedMessages.length > 0) { - emitter.fire(bufferedMessages.shift()!); + this._isDeliveringMessages = true; + while (this._hasListeners && this._bufferedMessages.length > 0) { + this._emitter.fire(this._bufferedMessages.shift()!); } - isDeliveringMessages = false; - }; + this._isDeliveringMessages = false; + } - source((e: T) => { - bufferedMessages.push(e); - deliverMessages(); - }); - - emitter = new Emitter({ - onFirstListenerAdd: () => { - hasListeners = true; - // it is important to deliver these messages after this call, but before - // other messages have a chance to be received (to guarantee in order delivery) - // that's why we're using here nextTick and not other types of timeouts - process.nextTick(deliverMessages); - }, - onLastListenerRemove: () => { - hasListeners = false; + public fire(event: T): void { + if (this._hasListeners) { + if (this._bufferedMessages.length > 0) { + this._bufferedMessages.push(event); + } else { + this._emitter.fire(event); + } + } else { + this._bufferedMessages.push(event); } - }); + } - return emitter.event; + public flushBuffer(): void { + this._bufferedMessages = []; + } } class QueueElement { @@ -530,20 +545,20 @@ export class PersistentProtocol implements IMessagePassingProtocol { private _socketReader: ProtocolReader; private _socketDisposables: IDisposable[]; - private _onControlMessage = new Emitter(); - readonly onControlMessage: Event = createBufferedEvent(this._onControlMessage.event); + private readonly _onControlMessage = new BufferedEmitter(); + readonly onControlMessage: Event = this._onControlMessage.event; - private _onMessage = new Emitter(); - readonly onMessage: Event = createBufferedEvent(this._onMessage.event); + private readonly _onMessage = new BufferedEmitter(); + readonly onMessage: Event = this._onMessage.event; - private _onClose = new Emitter(); - readonly onClose: Event = createBufferedEvent(this._onClose.event); + private readonly _onClose = new BufferedEmitter(); + readonly onClose: Event = this._onClose.event; - private _onSocketClose = new Emitter(); - readonly onSocketClose: Event = createBufferedEvent(this._onSocketClose.event); + private readonly _onSocketClose = new BufferedEmitter(); + readonly onSocketClose: Event = this._onSocketClose.event; - private _onSocketTimeout = new Emitter(); - readonly onSocketTimeout: Event = createBufferedEvent(this._onSocketTimeout.event); + private readonly _onSocketTimeout = new BufferedEmitter(); + readonly onSocketTimeout: Event = this._onSocketTimeout.event; public get unacknowledgedCount(): number { return this._outgoingMsgId - this._outgoingAckId; @@ -656,6 +671,10 @@ export class PersistentProtocol implements IMessagePassingProtocol { this._isReconnecting = true; this._socketDisposables = dispose(this._socketDisposables); + this._onControlMessage.flushBuffer(); + this._onSocketClose.flushBuffer(); + this._onSocketTimeout.flushBuffer(); + this._socket.dispose(); this._socket = socket; this._socketWriter = new ProtocolWriter(this._socket); diff --git a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts index bb9dec75605..fdd8bcbf06b 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts @@ -10,7 +10,6 @@ import { ITree, IActionProvider } from 'vs/base/parts/tree/browser/tree'; import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { IQuickNavigateConfiguration, IModel, IDataSource, IFilter, IAccessiblityProvider, IRenderer, IRunner, Mode, IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen'; import { IAction, IActionRunner } from 'vs/base/common/actions'; -import { compareAnything } from 'vs/base/common/comparers'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel'; import * as DOM from 'vs/base/browser/dom'; @@ -576,37 +575,3 @@ export class QuickOpenModel implements return entry.run(mode, context); } } - -/** - * A good default sort implementation for quick open entries respecting highlight information - * as well as associated resources. - */ -export function compareEntries(elementA: QuickOpenEntry, elementB: QuickOpenEntry, lookFor: string): number { - - // Give matches with label highlights higher priority over - // those with only description highlights - const labelHighlightsA = elementA.getHighlights()[0] || []; - const labelHighlightsB = elementB.getHighlights()[0] || []; - if (labelHighlightsA.length && !labelHighlightsB.length) { - return -1; - } - - if (!labelHighlightsA.length && labelHighlightsB.length) { - return 1; - } - - // Fallback to the full path if labels are identical and we have associated resources - let nameA = elementA.getLabel()!; - let nameB = elementB.getLabel()!; - if (nameA === nameB) { - const resourceA = elementA.getResource(); - const resourceB = elementB.getResource(); - - if (resourceA && resourceB) { - nameA = resourceA.fsPath; - nameB = resourceB.fsPath; - } - } - - return compareAnything(nameA, nameB, lookFor); -} diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts index 74148e4a0fd..68be9fba510 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts @@ -258,15 +258,15 @@ export class QuickOpenWidget extends Disposable implements IModelProvider { filter: new Filter(this), accessibilityProvider: new AccessibilityProvider(this) }, { - twistiePixels: 11, - indentPixels: 0, - alwaysFocused: true, - verticalScrollMode: ScrollbarVisibility.Visible, - horizontalScrollMode: ScrollbarVisibility.Hidden, - ariaLabel: nls.localize('treeAriaLabel', "Quick Picker"), - keyboardSupport: this.options.keyboardSupport, - preventRootFocus: false - })); + twistiePixels: 11, + indentPixels: 0, + alwaysFocused: true, + verticalScrollMode: ScrollbarVisibility.Visible, + horizontalScrollMode: ScrollbarVisibility.Hidden, + ariaLabel: nls.localize('treeAriaLabel', "Quick Picker"), + keyboardSupport: this.options.keyboardSupport, + preventRootFocus: false + })); this.treeElement = this.tree.getHTMLElement(); diff --git a/src/vs/base/parts/request/browser/request.ts b/src/vs/base/parts/request/browser/request.ts new file mode 100644 index 00000000000..f8532bbe608 --- /dev/null +++ b/src/vs/base/parts/request/browser/request.ts @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { CancellationToken } from 'vs/base/common/cancellation'; +import { canceled } from 'vs/base/common/errors'; +import { assign } from 'vs/base/common/objects'; +import { VSBuffer, bufferToStream } from 'vs/base/common/buffer'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; + +export function request(options: IRequestOptions, token: CancellationToken): Promise { + if (options.proxyAuthorization) { + options.headers = assign(options.headers || {}, { 'Proxy-Authorization': options.proxyAuthorization }); + } + + const xhr = new XMLHttpRequest(); + return new Promise((resolve, reject) => { + + xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); + setRequestHeaders(xhr, options); + + xhr.responseType = 'arraybuffer'; + xhr.onerror = e => reject(new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText))); + xhr.onload = (e) => { + resolve({ + res: { + statusCode: xhr.status, + headers: getResponseHeaders(xhr) + }, + stream: bufferToStream(VSBuffer.wrap(new Uint8Array(xhr.response))) + }); + }; + xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`)); + + if (options.timeout) { + xhr.timeout = options.timeout; + } + + xhr.send(options.data); + + // cancel + token.onCancellationRequested(() => { + xhr.abort(); + reject(canceled()); + }); + }); +} + +function setRequestHeaders(xhr: XMLHttpRequest, options: IRequestOptions): void { + if (options.headers) { + outer: for (let k in options.headers) { + switch (k) { + case 'User-Agent': + case 'Accept-Encoding': + case 'Content-Length': + // unsafe headers + continue outer; + } + xhr.setRequestHeader(k, options.headers[k]); + } + } +} + +function getResponseHeaders(xhr: XMLHttpRequest): { [name: string]: string } { + const headers: { [name: string]: string } = Object.create(null); + for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { + if (line) { + const idx = line.indexOf(':'); + headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim(); + } + } + return headers; +} diff --git a/src/vs/base/parts/request/common/request.ts b/src/vs/base/parts/request/common/request.ts new file mode 100644 index 00000000000..b8f75d72cf6 --- /dev/null +++ b/src/vs/base/parts/request/common/request.ts @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { VSBufferReadableStream } from 'vs/base/common/buffer'; + +export interface IHeaders { + [header: string]: string; +} + +export interface IRequestOptions { + type?: string; + url?: string; + user?: string; + password?: string; + headers?: IHeaders; + timeout?: number; + data?: string; + followRedirects?: number; + proxyAuthorization?: string; +} + +export interface IRequestContext { + res: { + headers: IHeaders; + statusCode?: number; + }; + stream: VSBufferReadableStream; +} diff --git a/src/vs/base/parts/storage/node/storage.ts b/src/vs/base/parts/storage/node/storage.ts index edf313654aa..85a3ef2d9ac 100644 --- a/src/vs/base/parts/storage/node/storage.ts +++ b/src/vs/base/parts/storage/node/storage.ts @@ -420,8 +420,8 @@ export class SQLiteStorageDatabase implements IStorageDatabase { } class SQLiteStorageDatabaseLogger { - private readonly logTrace: (msg: string) => void; - private readonly logError: (error: string | Error) => void; + private readonly logTrace: ((msg: string) => void) | undefined; + private readonly logError: ((error: string | Error) => void) | undefined; constructor(options?: ISQLiteStorageDatabaseLoggingOptions) { if (options && typeof options.logTrace === 'function') { diff --git a/src/vs/base/parts/tree/browser/treeImpl.ts b/src/vs/base/parts/tree/browser/treeImpl.ts index 3f30ea46037..aa3e07acf8e 100644 --- a/src/vs/base/parts/tree/browser/treeImpl.ts +++ b/src/vs/base/parts/tree/browser/treeImpl.ts @@ -110,15 +110,15 @@ export class Tree implements _.ITree { } get onDidFocus(): Event { - return this.view && this.view.onDOMFocus; + return this.view.onDOMFocus; } get onDidBlur(): Event { - return this.view && this.view.onDOMBlur; + return this.view.onDOMBlur; } get onDidScroll(): Event { - return this.view && this.view.onDidScroll; + return this.view.onDidScroll; } public getHTMLElement(): HTMLElement { @@ -263,16 +263,8 @@ export class Tree implements _.ITree { public dispose(): void { this._onDispose.fire(); - - if (this.model !== null) { - this.model.dispose(); - this.model = null!; // StrictNullOverride Nulling out ok in dispose - } - if (this.view !== null) { - this.view.dispose(); - this.view = null!; // StrictNullOverride Nulling out ok in dispose - } - + this.model.dispose(); + this.view.dispose(); this._onDidChangeFocus.dispose(); this._onDidChangeSelection.dispose(); this._onHighlightChange.dispose(); diff --git a/src/vs/base/parts/tree/browser/treeModel.ts b/src/vs/base/parts/tree/browser/treeModel.ts index 6f157d62e05..ba1b0d77836 100644 --- a/src/vs/base/parts/tree/browser/treeModel.ts +++ b/src/vs/base/parts/tree/browser/treeModel.ts @@ -5,7 +5,7 @@ import * as Assert from 'vs/base/common/assert'; import { onUnexpectedError } from 'vs/base/common/errors'; -import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle'; +import { IDisposable, combinedDisposable, Disposable } from 'vs/base/common/lifecycle'; import { INavigator } from 'vs/base/common/iterator'; import * as _ from './tree'; import { Event, Emitter, EventMultiplexer, Relay } from 'vs/base/common/event'; @@ -192,7 +192,7 @@ export class ItemRegistry { } public dispose(): void { - this.items = null!; // StrictNullOverride: nulling out ok in dispose + this.items = {}; this._onDidRevealItem.dispose(); this._onExpandItem.dispose(); @@ -864,8 +864,8 @@ export class TreeModel { private context: _.ITreeContext; private lock!: Lock; private input: Item | null; - private registry!: ItemRegistry; - private registryDisposable!: IDisposable; + private registry: ItemRegistry = new ItemRegistry(); + private registryDisposable: IDisposable = Disposable.None; private traitsToItems: ITraitMap; private _onSetInput = new Emitter(); @@ -1471,11 +1471,7 @@ export class TreeModel { } public dispose(): void { - if (this.registry) { - this.registry.dispose(); - this.registry = null!; // StrictNullOverride: nulling out ok in dispose - } - + this.registry.dispose(); this._onSetInput.dispose(); this._onDidSetInput.dispose(); this._onRefresh.dispose(); diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 71f583acc26..e24324e6d8c 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -927,9 +927,9 @@ export class TreeView extends HeightMap { getLength: () => previousChildrenIds.length, getElementAtIndex: (i: number) => previousChildrenIds[i] }, { - getLength: () => afterModelItems.length, - getElementAtIndex: (i: number) => afterModelItems[i].id - }, + getLength: () => afterModelItems.length, + getElementAtIndex: (i: number) => afterModelItems[i].id + }, null ); diff --git a/src/vs/base/test/browser/ui/grid/grid.test.ts b/src/vs/base/test/browser/ui/grid/grid.test.ts index d8dbad25721..a228eafffd8 100644 --- a/src/vs/base/test/browser/ui/grid/grid.test.ts +++ b/src/vs/base/test/browser/ui/grid/grid.test.ts @@ -23,10 +23,10 @@ import { deepClone } from 'vs/base/common/objects'; // | +-4 // | +-2 // +-H -// | +-V -// | +-1 -// | +-5 -// +-3 +// +-V +// | +-1 +// | +-5 +// +-3 suite('Grid', function () { let container: HTMLElement; @@ -688,10 +688,10 @@ suite('SerializableGrid', function () { grid2.layout(400, 800); // [/2, *4/3] assert.deepEqual(view1Copy.size, [300, 400]); - assert.deepEqual(view2Copy.size, [300, 266]); - assert.deepEqual(view3Copy.size, [100, 534]); - assert.deepEqual(view4Copy.size, [100, 266]); - assert.deepEqual(view5Copy.size, [300, 134]); + assert.deepEqual(view2Copy.size, [300, 267]); + assert.deepEqual(view3Copy.size, [100, 533]); + assert.deepEqual(view4Copy.size, [100, 267]); + assert.deepEqual(view5Copy.size, [300, 133]); }); test('deserialize 4 view layout (ben issue #2)', function () { diff --git a/src/vs/base/test/browser/ui/list/rangeMap.test.ts b/src/vs/base/test/browser/ui/list/rangeMap.test.ts index 819bd312bab..c92612c1454 100644 --- a/src/vs/base/test/browser/ui/list/rangeMap.test.ts +++ b/src/vs/base/test/browser/ui/list/rangeMap.test.ts @@ -14,10 +14,6 @@ suite('RangeMap', () => { rangeMap = new RangeMap(); }); - teardown(() => { - rangeMap.dispose(); - }); - test('intersection', () => { assert.deepEqual(Range.intersect({ start: 0, end: 0 }, { start: 0, end: 0 }), { start: 0, end: 0 }); assert.deepEqual(Range.intersect({ start: 0, end: 0 }, { start: 5, end: 5 }), { start: 0, end: 0 }); @@ -346,4 +342,4 @@ suite('RangeMap', () => { assert.equal(rangeMap.positionAt(4), -1); }); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts b/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts index 0e93e4bb377..1aa1c6fa550 100644 --- a/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts +++ b/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts @@ -75,7 +75,7 @@ suite('AsyncDataTree', function () { const _: (id: string) => Element = find.bind(null, root.children); - const tree = new AsyncDataTree(container, delegate, [renderer], dataSource, { identityProvider }); + const tree = new AsyncDataTree('test', container, delegate, [renderer], dataSource, { identityProvider }); tree.layout(200); assert.equal(container.querySelectorAll('.monaco-list-row').length, 0); @@ -151,7 +151,7 @@ suite('AsyncDataTree', function () { const _: (id: string) => Element = find.bind(null, root.children); - const tree = new AsyncDataTree(container, delegate, [renderer], dataSource, { identityProvider }); + const tree = new AsyncDataTree('test', container, delegate, [renderer], dataSource, { identityProvider }); tree.layout(200); await tree.setInput(root); @@ -239,7 +239,7 @@ suite('AsyncDataTree', function () { const _: (id: string) => Element = find.bind(null, root.children); - const tree = new AsyncDataTree(container, delegate, [renderer], dataSource, { identityProvider }); + const tree = new AsyncDataTree('test', container, delegate, [renderer], dataSource, { identityProvider }); tree.layout(200); await tree.setInput(root); @@ -306,7 +306,7 @@ suite('AsyncDataTree', function () { const _: (id: string) => Element = find.bind(null, root.children); - const tree = new AsyncDataTree(container, delegate, [renderer], dataSource, { identityProvider }); + const tree = new AsyncDataTree('test', container, delegate, [renderer], dataSource, { identityProvider }); tree.layout(200); await tree.setInput(root); @@ -370,7 +370,7 @@ suite('AsyncDataTree', function () { const _: (id: string) => Element = find.bind(null, root.children); - const tree = new AsyncDataTree(container, delegate, [renderer], dataSource, { + const tree = new AsyncDataTree('test', container, delegate, [renderer], dataSource, { collapseByDefault: el => el.id !== 'a' }); tree.layout(200); @@ -379,4 +379,4 @@ suite('AsyncDataTree', function () { assert(!tree.getNode(_('a')).collapsed); assert.deepStrictEqual(getChildrenCalls, ['root', 'a']); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/compressedObjectTreeModel.test.ts b/src/vs/base/test/browser/ui/tree/compressedObjectTreeModel.test.ts index 4d03b49a0a8..73f78e9b855 100644 --- a/src/vs/base/test/browser/ui/tree/compressedObjectTreeModel.test.ts +++ b/src/vs/base/test/browser/ui/tree/compressedObjectTreeModel.test.ts @@ -305,7 +305,7 @@ suite('CompressedObjectTree', function () { test('ctor', () => { const list: ITreeNode>[] = []; - const model = new CompressedTreeModel(toSpliceable(list)); + const model = new CompressedTreeModel('test', toSpliceable(list)); assert(model); assert.equal(list.length, 0); assert.equal(model.size, 0); @@ -313,7 +313,7 @@ suite('CompressedObjectTree', function () { test('flat', () => { const list: ITreeNode>[] = []; - const model = new CompressedTreeModel(toSpliceable(list)); + const model = new CompressedTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { element: 0 }, @@ -340,7 +340,7 @@ suite('CompressedObjectTree', function () { test('nested', () => { const list: ITreeNode>[] = []; - const model = new CompressedTreeModel(toSpliceable(list)); + const model = new CompressedTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { @@ -376,7 +376,7 @@ suite('CompressedObjectTree', function () { test('compressed', () => { const list: ITreeNode>[] = []; - const model = new CompressedTreeModel(toSpliceable(list)); + const model = new CompressedTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { @@ -427,4 +427,4 @@ suite('CompressedObjectTree', function () { assert.equal(model.size, 8); }); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/dataTree.test.ts b/src/vs/base/test/browser/ui/tree/dataTree.test.ts index fee529b745e..015a6783171 100644 --- a/src/vs/base/test/browser/ui/tree/dataTree.test.ts +++ b/src/vs/base/test/browser/ui/tree/dataTree.test.ts @@ -63,7 +63,7 @@ suite('DataTree', function () { } }; - tree = new DataTree(container, delegate, [renderer], dataSource, { + tree = new DataTree('test', container, delegate, [renderer], dataSource, { identityProvider }); tree.layout(200); @@ -145,4 +145,4 @@ suite('DataTree', function () { assert.deepEqual(tree.getSelection(), [root.children![1]]); assert.deepEqual(tree.getFocus(), [root.children![2]]); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts b/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts index 25e84a34f4c..de92f9b2732 100644 --- a/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts +++ b/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts @@ -25,14 +25,14 @@ suite('IndexTreeModel', function () { test('ctor', () => { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); assert(model); assert.equal(list.length, 0); }); test('insert', () => { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { element: 0 }, @@ -54,7 +54,7 @@ suite('IndexTreeModel', function () { test('deep insert', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -91,7 +91,7 @@ suite('IndexTreeModel', function () { test('deep insert collapsed', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -119,7 +119,7 @@ suite('IndexTreeModel', function () { test('delete', () => { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { element: 0 }, @@ -144,7 +144,7 @@ suite('IndexTreeModel', function () { test('nested delete', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -178,7 +178,7 @@ suite('IndexTreeModel', function () { test('deep delete', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -206,7 +206,7 @@ suite('IndexTreeModel', function () { test('hidden delete', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -231,7 +231,7 @@ suite('IndexTreeModel', function () { test('collapse', () => { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -262,7 +262,7 @@ suite('IndexTreeModel', function () { test('expand', () => { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -302,7 +302,7 @@ suite('IndexTreeModel', function () { test('collapse should recursively adjust visible count', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -341,7 +341,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), -1, { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), -1, { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -375,7 +375,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), -1, { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), -1, { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -398,7 +398,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), -1, { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), -1, { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -437,7 +437,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), 'root', { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), 'root', { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -483,7 +483,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), 'root', { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), 'root', { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -529,7 +529,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), 'root', { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), 'root', { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -577,7 +577,7 @@ suite('IndexTreeModel', function () { test('simple', function () { const list: ITreeNode[] = []; - const model = new IndexTreeModel(toSpliceable(list), -1); + const model = new IndexTreeModel('test', toSpliceable(list), -1); model.splice([0], 0, Iterator.fromArray([ { @@ -607,7 +607,7 @@ suite('IndexTreeModel', function () { } }; - const model = new IndexTreeModel(toSpliceable(list), -1, { filter }); + const model = new IndexTreeModel('test', toSpliceable(list), -1, { filter }); model.splice([0], 0, Iterator.fromArray([ { @@ -629,4 +629,4 @@ suite('IndexTreeModel', function () { assert.deepEqual(model.getNodeLocation(list[3]), [0, 5]); }); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/objectTree.test.ts b/src/vs/base/test/browser/ui/tree/objectTree.test.ts index 46e03f8884d..bcd9086b7c6 100644 --- a/src/vs/base/test/browser/ui/tree/objectTree.test.ts +++ b/src/vs/base/test/browser/ui/tree/objectTree.test.ts @@ -35,7 +35,7 @@ suite('ObjectTree', function () { disposeTemplate(): void { } }; - tree = new ObjectTree(container, delegate, [renderer], { filter: { filter: (el) => filter(el) } }); + tree = new ObjectTree('test', container, delegate, [renderer], { filter: { filter: (el) => filter(el) } }); tree.layout(200); }); @@ -214,7 +214,7 @@ suite('ObjectTree', function () { } }; - const tree = new ObjectTree(container, delegate, [renderer], { identityProvider }); + const tree = new ObjectTree('test', container, delegate, [renderer], { identityProvider }); tree.layout(200); tree.setChildren(null, [{ element: 0 }, { element: 1 }, { element: 2 }, { element: 3 }]); @@ -224,4 +224,4 @@ suite('ObjectTree', function () { tree.setChildren(null, [{ element: 100 }, { element: 101 }, { element: 102 }, { element: 103 }]); assert.deepStrictEqual(tree.getFocus(), [101]); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/tree/objectTreeModel.test.ts b/src/vs/base/test/browser/ui/tree/objectTreeModel.test.ts index 6a5ec8713c5..66ecd17238f 100644 --- a/src/vs/base/test/browser/ui/tree/objectTreeModel.test.ts +++ b/src/vs/base/test/browser/ui/tree/objectTreeModel.test.ts @@ -25,7 +25,7 @@ suite('ObjectTreeModel', function () { test('ctor', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list)); + const model = new ObjectTreeModel('test', toSpliceable(list)); assert(model); assert.equal(list.length, 0); assert.equal(model.size, 0); @@ -33,7 +33,7 @@ suite('ObjectTreeModel', function () { test('flat', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list)); + const model = new ObjectTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { element: 0 }, @@ -60,7 +60,7 @@ suite('ObjectTreeModel', function () { test('nested', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list)); + const model = new ObjectTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { @@ -96,7 +96,7 @@ suite('ObjectTreeModel', function () { test('setChildren on collapsed node', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list)); + const model = new ObjectTreeModel('test', toSpliceable(list)); model.setChildren(null, Iterator.fromArray([ { element: 0, collapsed: true } @@ -117,7 +117,7 @@ suite('ObjectTreeModel', function () { test('setChildren on expanded, unrevealed node', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list)); + const model = new ObjectTreeModel('test', toSpliceable(list)); model.setChildren(null, [ { @@ -143,7 +143,7 @@ suite('ObjectTreeModel', function () { test('collapse state is preserved with strict identity', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list), { collapseByDefault: true }); + const model = new ObjectTreeModel('test', toSpliceable(list), { collapseByDefault: true }); const data = [{ element: 'father', children: [{ element: 'child' }] }]; model.setChildren(null, data); @@ -173,7 +173,7 @@ suite('ObjectTreeModel', function () { let compare: (a: string, b: string) => number = (a, b) => a < b ? -1 : 1; const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list), { sorter: { compare(a, b) { return compare(a, b); } } }); + const model = new ObjectTreeModel('test', toSpliceable(list), { sorter: { compare(a, b) { return compare(a, b); } } }); const data = [ { element: 'cars', children: [{ element: 'sedan' }, { element: 'convertible' }, { element: 'compact' }] }, { element: 'airplanes', children: [{ element: 'passenger' }, { element: 'jet' }] }, @@ -188,7 +188,7 @@ suite('ObjectTreeModel', function () { let compare: (a: string, b: string) => number = () => 0; const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list), { sorter: { compare(a, b) { return compare(a, b); } } }); + const model = new ObjectTreeModel('test', toSpliceable(list), { sorter: { compare(a, b) { return compare(a, b); } } }); const data = [ { element: 'cars', children: [{ element: 'sedan' }, { element: 'convertible' }, { element: 'compact' }] }, { element: 'airplanes', children: [{ element: 'passenger' }, { element: 'jet' }] }, @@ -223,7 +223,7 @@ suite('ObjectTreeModel', function () { test('expandTo', () => { const list: ITreeNode[] = []; - const model = new ObjectTreeModel(toSpliceable(list), { collapseByDefault: true }); + const model = new ObjectTreeModel('test', toSpliceable(list), { collapseByDefault: true }); model.setChildren(null, [ { @@ -241,4 +241,4 @@ suite('ObjectTreeModel', function () { model.expandTo(1000); assert.deepEqual(toArray(list), [0, 10, 100, 1000, 11, 12, 1, 2]); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/common/filters.test.ts b/src/vs/base/test/common/filters.test.ts index 42b74143661..6f96e22f47e 100644 --- a/src/vs/base/test/common/filters.test.ts +++ b/src/vs/base/test/common/filters.test.ts @@ -389,6 +389,15 @@ suite('Filters', () => { assertMatches('g', 'zzGroup', 'zz^Group', fuzzyScore); }); + test('patternPos isn\'t working correctly #79815', function () { + assertMatches(':p'.substr(1), 'prop', '^prop', fuzzyScore, { patternPos: 0 }); + assertMatches(':p', 'prop', '^prop', fuzzyScore, { patternPos: 1 }); + assertMatches(':p', 'prop', undefined, fuzzyScore, { patternPos: 2 }); + assertMatches(':p', 'proP', 'pro^P', fuzzyScore, { patternPos: 1, wordPos: 1 }); + assertMatches(':p', 'aprop', 'a^prop', fuzzyScore, { patternPos: 1, firstMatchCanBeWeak: true }); + assertMatches(':p', 'aprop', undefined, fuzzyScore, { patternPos: 1, firstMatchCanBeWeak: false }); + }); + function assertTopScore(filter: typeof fuzzyScore, pattern: string, expected: number, ...words: string[]) { let topScore = -(100 * 10); let topIdx = 0; diff --git a/src/vs/base/test/node/glob.test.ts b/src/vs/base/test/node/glob.test.ts index 53170961b90..f2610a7ee5f 100644 --- a/src/vs/base/test/node/glob.test.ts +++ b/src/vs/base/test/node/glob.test.ts @@ -812,10 +812,10 @@ suite('Glob', () => { '{**/bar/**,**/baz/**}': true, '**/bulb/**': false }, ['foo', 'bar', 'baz'], [ - ['bar/foo', '**/foo/**'], - ['foo/bar', '{**/bar/**,**/baz/**}'], - ['bar/nope', null!] - ]); + ['bar/foo', '**/foo/**'], + ['foo/bar', '{**/bar/**,**/baz/**}'], + ['bar/nope', null!] + ]); const siblings = ['baz', 'baz.zip', 'nope']; const hasSibling = (name: string) => siblings.indexOf(name) !== -1; @@ -823,15 +823,15 @@ suite('Glob', () => { '**/foo/**': { when: '$(basename).zip' }, '**/bar/**': true }, ['bar'], [ - ['bar/foo', null!], - ['bar/foo/baz', null!], - ['bar/foo/nope', null!], - ['foo/bar', '**/bar/**'], - ], [ - null!, - hasSibling, - hasSibling - ]); + ['bar/foo', null!], + ['bar/foo/baz', null!], + ['bar/foo/nope', null!], + ['foo/bar', '**/bar/**'], + ], [ + null!, + hasSibling, + hasSibling + ]); }); function testOptimizationForBasenames(pattern: string | glob.IExpression, basenameTerms: string[], matches: [string, string | boolean][], siblingsFns: ((name: string) => boolean)[] = []) { @@ -917,11 +917,11 @@ suite('Glob', () => { // '{**/bar/bar/**,**/baz/bar/**}': true, '**/bulb/bar/**': false }, ['*/foo/bar'], [ - [nativeSep('bar/foo/bar'), '**/foo/bar/**'], - // Not supported - // [nativeSep('foo/bar/bar'), '{**/bar/bar/**,**/baz/bar/**}'], - [nativeSep('/foo/bar/nope'), null!] - ]); + [nativeSep('bar/foo/bar'), '**/foo/bar/**'], + // Not supported + // [nativeSep('foo/bar/bar'), '{**/bar/bar/**,**/baz/bar/**}'], + [nativeSep('/foo/bar/nope'), null!] + ]); const siblings = ['baz', 'baz.zip', 'nope']; let hasSibling = (name: string) => siblings.indexOf(name) !== -1; @@ -929,15 +929,15 @@ suite('Glob', () => { '**/foo/123/**': { when: '$(basename).zip' }, '**/bar/123/**': true }, ['*/bar/123'], [ - [nativeSep('bar/foo/123'), null!], - [nativeSep('bar/foo/123/baz'), null!], - [nativeSep('bar/foo/123/nope'), null!], - [nativeSep('foo/bar/123'), '**/bar/123/**'], - ], [ - null!, - hasSibling, - hasSibling - ]); + [nativeSep('bar/foo/123'), null!], + [nativeSep('bar/foo/123/baz'), null!], + [nativeSep('bar/foo/123/nope'), null!], + [nativeSep('foo/bar/123'), '**/bar/123/**'], + ], [ + null!, + hasSibling, + hasSibling + ]); }); function testOptimizationForPaths(pattern: string | glob.IExpression, pathTerms: string[], matches: [string, string | boolean][], siblingsFns: ((name: string) => boolean)[] = []) { diff --git a/src/vs/base/test/node/keytar.test.ts b/src/vs/base/test/node/keytar.test.ts index 96ca335e940..53f1c31a1a6 100644 --- a/src/vs/base/test/node/keytar.test.ts +++ b/src/vs/base/test/node/keytar.test.ts @@ -18,6 +18,8 @@ suite('Keytar', () => { const name = `VSCode Test ${Math.floor(Math.random() * 1e9)}`; try { await keytar.setPassword(name, 'foo', 'bar'); + assert.equal(await keytar.findPassword(name), 'bar'); + assert.equal((await keytar.findCredentials(name)).length, 1); assert.equal(await keytar.getPassword(name, 'foo'), 'bar'); await keytar.deletePassword(name, 'foo'); assert.equal(await keytar.getPassword(name, 'foo'), undefined); diff --git a/src/vs/base/worker/workerMain.ts b/src/vs/base/worker/workerMain.ts index 8d51252951a..22bc88f1c00 100644 --- a/src/vs/base/worker/workerMain.ts +++ b/src/vs/base/worker/workerMain.ts @@ -24,7 +24,7 @@ (self).postMessage(msg, transfer); }, null); - self.onmessage = (e) => messageHandler.onmessage(e.data); + self.onmessage = (e: MessageEvent) => messageHandler.onmessage(e.data); while (beforeReadyMessages.length > 0) { self.onmessage(beforeReadyMessages.shift()!); } @@ -34,7 +34,7 @@ let isFirstMessage = true; let beforeReadyMessages: MessageEvent[] = []; - self.onmessage = (message) => { + self.onmessage = (message: MessageEvent) => { if (!isFirstMessage) { beforeReadyMessages.push(message); return; diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html index 9bf87281e2c..1d9a0b8308d 100644 --- a/src/vs/code/browser/workbench/workbench.html +++ b/src/vs/code/browser/workbench/workbench.html @@ -4,29 +4,42 @@ - - - + + + - + - - + + + + - + - - + diff --git a/src/vs/code/browser/workbench/workbench.js b/src/vs/code/browser/workbench/workbench.js index 5050cb4e5b4..2f09f53e43a 100644 --- a/src/vs/code/browser/workbench/workbench.js +++ b/src/vs/code/browser/workbench/workbench.js @@ -3,11 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +//@ts-check 'use strict'; (function () { - require.config({ + /** @type any */ + const amdLoader = require; + + amdLoader.config({ baseUrl: `${window.location.origin}/static/out`, paths: { 'vscode-textmate': `${window.location.origin}/static/node_modules/vscode-textmate/release/main`, @@ -20,9 +24,8 @@ } }); - require(['vs/workbench/workbench.web.api'], function (api) { + amdLoader(['vs/workbench/workbench.web.api'], function (api) { const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings')); - api.create(document.body, options); }); })(); diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts index 591cbed96f3..55d0e6099a4 100644 --- a/src/vs/code/electron-browser/issue/issueReporterMain.ts +++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts @@ -311,7 +311,7 @@ export class IssueReporter extends Disposable { if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) { const channel = getDelayedChannel(sharedProcess.then(c => c.getChannel('telemetryAppender'))); const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService)); - const commonProperties = resolveCommonProperties(product.commit || 'Commit unknown', pkg.version, configuration.machineId, this.environmentService.installSourcePath); + const commonProperties = resolveCommonProperties(product.commit || 'Commit unknown', pkg.version, configuration.machineId, product.msftInternalDomains, this.environmentService.installSourcePath); const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot]; const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths }; diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index c5514f4eff7..21898d5dfb4 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -27,7 +27,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper import { TelemetryAppenderChannel } from 'vs/platform/telemetry/node/telemetryIpc'; import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService'; import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender'; -import { IWindowsService, ActiveWindowManager } from 'vs/platform/windows/common/windows'; +import { IWindowsService } from 'vs/platform/windows/common/windows'; import { WindowsService } from 'vs/platform/windows/electron-browser/windowsService'; import { ipcRenderer } from 'electron'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; @@ -35,8 +35,6 @@ import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log import { LocalizationsService } from 'vs/platform/localizations/node/localizations'; import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; import { LocalizationsChannel } from 'vs/platform/localizations/node/localizationsIpc'; -import { DialogChannelClient } from 'vs/platform/dialogs/node/dialogIpc'; -import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { combinedDisposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; import { DownloadService } from 'vs/platform/download/common/downloadService'; import { IDownloadService } from 'vs/platform/download/common/download'; @@ -46,7 +44,6 @@ import { LanguagePackCachedDataCleaner } from 'vs/code/electron-browser/sharedPr import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner'; import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { SpdLogService } from 'vs/platform/log/node/spdlogService'; import { DiagnosticsService, IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; import { DiagnosticsChannel } from 'vs/platform/diagnostics/node/diagnosticsIpc'; @@ -75,7 +72,7 @@ const eventPrefix = 'monacoworkbench'; class MainProcessService implements IMainProcessService { constructor(private server: Server, private mainRouter: StaticRouter) { } - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; getChannel(channelName: string): IChannel { return this.server.getChannel(channelName, this.mainRouter); @@ -121,11 +118,6 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat const windowsService = new WindowsService(mainProcessService); services.set(IWindowsService, windowsService); - const activeWindowManager = new ActiveWindowManager(windowsService); - const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id)); - const dialogChannel = server.getChannel('dialog', activeWindowRouter); - services.set(IDialogService, new DialogChannelClient(dialogChannel)); - // Files const fileService = new FileService(logService); services.set(IFileService, fileService); @@ -156,7 +148,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat } const config: ITelemetryServiceConfig = { appender: combinedAppender(appInsightsAppender, new LogAppender(logService)), - commonProperties: resolveCommonProperties(product.commit, pkg.version, configuration.machineId, installSourcePath), + commonProperties: resolveCommonProperties(product.commit, pkg.version, configuration.machineId, product.msftInternalDomains, installSourcePath), piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot] }; diff --git a/src/vs/code/electron-browser/workbench/workbench.js b/src/vs/code/electron-browser/workbench/workbench.js index 98e67927fe1..22d5dbe329c 100644 --- a/src/vs/code/electron-browser/workbench/workbench.js +++ b/src/vs/code/electron-browser/workbench/workbench.js @@ -14,7 +14,10 @@ const bootstrapWindow = require('../../../../bootstrap-window'); // Setup shell environment process['lazyEnv'] = getLazyEnv(); -// Load workbench main +// Load workbench main JS, CSS and NLS all in parallel. This is an +// optimization to prevent a waterfall of loading to happen, because +// we know for a fact that workbench.desktop.main will depend on +// the related CSS and NLS counterparts. bootstrapWindow.load([ 'vs/workbench/workbench.desktop.main', 'vs/nls!vs/workbench/workbench.desktop.main', diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 66c0baf0401..cf63cbaf3e2 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -474,7 +474,7 @@ export class CodeApplication extends Disposable { if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) { const channel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('telemetryAppender'))); const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService)); - const commonProperties = resolveCommonProperties(product.commit, pkg.version, machineId, this.environmentService.installSourcePath); + const commonProperties = resolveCommonProperties(product.commit, pkg.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath); const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot]; const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, trueMachineId }; diff --git a/src/vs/code/electron-main/auth.ts b/src/vs/code/electron-main/auth.ts index 6fbd3fcce46..0d39ddd71ff 100644 --- a/src/vs/code/electron-main/auth.ts +++ b/src/vs/code/electron-main/auth.ts @@ -24,7 +24,7 @@ type Credentials = { export class ProxyAuthHandler { - _serviceBrand: any; + _serviceBrand: undefined; private retryCount = 0; private disposables: IDisposable[] = []; diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index d4defa1962e..c7cdbd794e0 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -157,7 +157,7 @@ interface IWorkspacePathToOpen { export class WindowsManager extends Disposable implements IWindowsMainService { - _serviceBrand: any; + _serviceBrand: undefined; private static readonly windowsStateStorageKey = 'windowsState'; @@ -309,7 +309,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { if (!currentWindowsState.lastActiveWindow) { let activeWindow = this.getLastActiveWindow(); if (!activeWindow || activeWindow.isExtensionDevelopmentHost) { - activeWindow = WindowsManager.WINDOWS.filter(w => !w.isExtensionDevelopmentHost)[0]; + activeWindow = WindowsManager.WINDOWS.filter(window => !window.isExtensionDevelopmentHost)[0]; } if (activeWindow) { @@ -318,7 +318,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { } // 2.) Find extension host window - const extensionHostWindow = WindowsManager.WINDOWS.filter(w => w.isExtensionDevelopmentHost && !w.isExtensionTestHost)[0]; + const extensionHostWindow = WindowsManager.WINDOWS.filter(window => window.isExtensionDevelopmentHost && !window.isExtensionTestHost)[0]; if (extensionHostWindow) { currentWindowsState.lastPluginDevelopmentHostWindow = this.toWindowState(extensionHostWindow); } @@ -329,7 +329,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { // so if we ever want to persist the UI state of the last closed window (window count === 1), it has // to come from the stored lastClosedWindowState on Win/Linux at least if (this.getWindowCount() > 1) { - currentWindowsState.openedWindows = WindowsManager.WINDOWS.filter(w => !w.isExtensionDevelopmentHost).map(w => this.toWindowState(w)); + currentWindowsState.openedWindows = WindowsManager.WINDOWS.filter(window => !window.isExtensionDevelopmentHost).map(window => this.toWindowState(window)); } // Persist @@ -456,7 +456,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { // 1.) focus last active window if we are not instructed to open any paths if (focusLastActive) { - const lastActiveWindow = usedWindows.filter(w => w.backupPath === this.windowsState.lastActiveWindow!.backupPath); + const lastActiveWindow = usedWindows.filter(window => window.backupPath === this.windowsState.lastActiveWindow!.backupPath); if (lastActiveWindow.length) { lastActiveWindow[0].focus(); focusLastOpened = false; @@ -490,7 +490,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { // Remember in recent document list (unless this opens for extension development) // Also do not add paths when files are opened for diffing, only if opened individually - if (!usedWindows.some(w => w.isExtensionDevelopmentHost) && !openConfig.diffMode && !openConfig.noRecentEntry) { + if (!usedWindows.some(window => window.isExtensionDevelopmentHost) && !openConfig.diffMode && !openConfig.noRecentEntry) { const recents: IRecent[] = []; for (let pathToOpen of pathsToOpen) { if (pathToOpen.workspace) { @@ -556,7 +556,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { const fileToCheck = fileInputs.filesToOpenOrCreate[0] || fileInputs.filesToDiff[0]; // only look at the windows with correct authority - const windows = WindowsManager.WINDOWS.filter(w => w.remoteAuthority === fileInputs!.remoteAuthority); + const windows = WindowsManager.WINDOWS.filter(window => window.remoteAuthority === fileInputs!.remoteAuthority); const bestWindowOrFolder = findBestWindowOrFolderForFile({ windows, @@ -1599,7 +1599,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { } getLastActiveWindowForAuthority(remoteAuthority: string | undefined): ICodeWindow | undefined { - return getLastActiveWindow(WindowsManager.WINDOWS.filter(w => w.remoteAuthority === remoteAuthority)); + return getLastActiveWindow(WindowsManager.WINDOWS.filter(window => window.remoteAuthority === remoteAuthority)); } openNewWindow(context: OpenContext, options?: INewWindowOptions): ICodeWindow[] { @@ -1642,13 +1642,13 @@ export class WindowsManager extends Disposable implements IWindowsMainService { } sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void { - WindowsManager.WINDOWS.forEach(w => { - if (windowIdsToIgnore && windowIdsToIgnore.indexOf(w.id) >= 0) { - return; // do not send if we are instructed to ignore it + for (const window of WindowsManager.WINDOWS) { + if (windowIdsToIgnore && windowIdsToIgnore.indexOf(window.id) >= 0) { + continue; // do not send if we are instructed to ignore it } - w.sendWhenReady(channel, payload); - }); + window.sendWhenReady(channel, payload); + } } getFocusedWindow(): ICodeWindow | undefined { @@ -1661,7 +1661,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { } getWindowById(windowId: number): ICodeWindow | undefined { - const res = WindowsManager.WINDOWS.filter(w => w.id === windowId); + const res = WindowsManager.WINDOWS.filter(window => window.id === windowId); if (res && res.length === 1) { return res[0]; } diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 32005dd153e..ee828c29374 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -359,7 +359,7 @@ export async function main(argv: ParsedArgs): Promise { const config: ITelemetryServiceConfig = { appender: combinedAppender(...appenders), - commonProperties: resolveCommonProperties(product.commit, pkg.version, stateService.getItem('telemetry.machineId'), installSourcePath), + commonProperties: resolveCommonProperties(product.commit, pkg.version, stateService.getItem('telemetry.machineId'), product.msftInternalDomains, installSourcePath), piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot] }; diff --git a/src/vs/editor/browser/config/charWidthReader.ts b/src/vs/editor/browser/config/charWidthReader.ts index a578ce29186..601a8ae8ad7 100644 --- a/src/vs/editor/browser/config/charWidthReader.ts +++ b/src/vs/editor/browser/config/charWidthReader.ts @@ -93,8 +93,7 @@ class DomCharWidthReader { container.appendChild(italicDomNode); const testElements: HTMLSpanElement[] = []; - for (let i = 0, len = this._requests.length; i < len; i++) { - const request = this._requests[i]; + for (const request of this._requests) { let parent: HTMLElement; if (request.type === CharWidthRequestType.Regular) { @@ -113,7 +112,7 @@ class DomCharWidthReader { DomCharWidthReader._render(testElement, request); parent!.appendChild(testElement); - testElements[i] = testElement; + testElements.push(testElement); } this._container = container; diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index 86e226d86c9..bfb885aa6b5 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -54,6 +54,11 @@ const enum TextAreaInputEventType { blur } +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; +} + /** * Writes screen reader content to the textarea and is able to analyze its input events to generate: * - onCut diff --git a/src/vs/editor/browser/core/keybindingCancellation.ts b/src/vs/editor/browser/core/keybindingCancellation.ts index 54ed2852a96..df5795ffe28 100644 --- a/src/vs/editor/browser/core/keybindingCancellation.ts +++ b/src/vs/editor/browser/core/keybindingCancellation.ts @@ -17,7 +17,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; const IEditorCancellationTokens = createDecorator('IEditorCancelService'); interface IEditorCancellationTokens { - _serviceBrand: any; + _serviceBrand: undefined; add(editor: ICodeEditor, cts: CancellationTokenSource): () => void; cancel(editor: ICodeEditor): void; } @@ -26,7 +26,7 @@ const ctxCancellableOperation = new RawContextKey('cancellableOperation', false) registerSingleton(IEditorCancellationTokens, class implements IEditorCancellationTokens { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _tokens = new WeakMap, tokens: LinkedList }>(); diff --git a/src/vs/editor/browser/services/abstractCodeEditorService.ts b/src/vs/editor/browser/services/abstractCodeEditorService.ts index c4a4be40d46..53c5bac6f28 100644 --- a/src/vs/editor/browser/services/abstractCodeEditorService.ts +++ b/src/vs/editor/browser/services/abstractCodeEditorService.ts @@ -13,7 +13,7 @@ import { IResourceInput } from 'vs/platform/editor/common/editor'; export abstract class AbstractCodeEditorService extends Disposable implements ICodeEditorService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onCodeEditorAdd: Emitter = this._register(new Emitter()); public readonly onCodeEditorAdd: Event = this._onCodeEditorAdd.event; diff --git a/src/vs/editor/browser/services/bulkEditService.ts b/src/vs/editor/browser/services/bulkEditService.ts index 1bbda5bf6ef..ada4ed7b23d 100644 --- a/src/vs/editor/browser/services/bulkEditService.ts +++ b/src/vs/editor/browser/services/bulkEditService.ts @@ -21,7 +21,7 @@ export interface IBulkEditResult { } export interface IBulkEditService { - _serviceBrand: any; + _serviceBrand: undefined; apply(edit: WorkspaceEdit, options?: IBulkEditOptions): Promise; } diff --git a/src/vs/editor/browser/services/codeEditorService.ts b/src/vs/editor/browser/services/codeEditorService.ts index 68f4c24fc6e..c85aaae1a29 100644 --- a/src/vs/editor/browser/services/codeEditorService.ts +++ b/src/vs/editor/browser/services/codeEditorService.ts @@ -13,7 +13,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const ICodeEditorService = createDecorator('codeEditorService'); export interface ICodeEditorService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onCodeEditorAdd: Event; readonly onCodeEditorRemove: Event; diff --git a/src/vs/editor/browser/services/openerService.ts b/src/vs/editor/browser/services/openerService.ts index 07056377d38..c42f82fdb26 100644 --- a/src/vs/editor/browser/services/openerService.ts +++ b/src/vs/editor/browser/services/openerService.ts @@ -13,12 +13,11 @@ import { equalsIgnoreCase } from 'vs/base/common/strings'; import { URI } from 'vs/base/common/uri'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IOpener, IOpenerService, IValidator } from 'vs/platform/opener/common/opener'; export class OpenerService extends Disposable implements IOpenerService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _openers = new LinkedList(); private readonly _validators = new LinkedList(); diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index ee32431b77a..fa0e688d696 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -40,6 +40,9 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle import { INotificationService } from 'vs/platform/notification/common/notification'; import { defaultInsertColor, defaultRemoveColor, diffBorder, diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, scrollbarShadow } from 'vs/platform/theme/common/colorRegistry'; import { ITheme, IThemeService, getThemeTypeSelector, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { IDiffLinesChange, InlineDiffMargin } from 'vs/editor/browser/widget/inlineDiffMargin'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; interface IEditorDiffDecorations { decorations: IModelDeltaDecoration[]; @@ -47,7 +50,7 @@ interface IEditorDiffDecorations { } interface IEditorDiffDecorationsWithZones extends IEditorDiffDecorations { - zones: editorBrowser.IViewZone[]; + zones: IMyViewZone[]; } interface IEditorsDiffDecorationsWithZones { @@ -56,8 +59,8 @@ interface IEditorsDiffDecorationsWithZones { } interface IEditorsZones { - original: editorBrowser.IViewZone[]; - modified: editorBrowser.IViewZone[]; + original: IMyViewZone[]; + modified: IMyViewZone[]; } interface IDiffEditorWidgetStyle { @@ -70,11 +73,16 @@ interface IDiffEditorWidgetStyle { class VisualEditorState { private _zones: string[]; + private inlineDiffMargins: InlineDiffMargin[]; private _zonesMap: { [zoneId: string]: boolean; }; private _decorations: string[]; - constructor() { + constructor( + private _contextMenuService: IContextMenuService, + private _clipboardService: IClipboardService + ) { this._zones = []; + this.inlineDiffMargins = []; this._zonesMap = {}; this._decorations = []; } @@ -108,13 +116,22 @@ class VisualEditorState { for (let i = 0, length = this._zones.length; i < length; i++) { viewChangeAccessor.removeZone(this._zones[i]); } + for (let i = 0, length = this.inlineDiffMargins.length; i < length; i++) { + this.inlineDiffMargins[i].dispose(); + } this._zones = []; this._zonesMap = {}; + this.inlineDiffMargins = []; for (let i = 0, length = newDecorations.zones.length; i < length; i++) { - newDecorations.zones[i].suppressMouseDown = true; - let zoneId = viewChangeAccessor.addZone(newDecorations.zones[i]); + const viewZone = newDecorations.zones[i]; + viewZone.suppressMouseDown = false; + let zoneId = viewChangeAccessor.addZone(viewZone); this._zones.push(zoneId); this._zonesMap[String(zoneId)] = true; + + if (newDecorations.zones[i].diff && viewZone.marginDomNode) { + this.inlineDiffMargins.push(new InlineDiffMargin(zoneId, viewZone.marginDomNode, editor, newDecorations.zones[i].diff!, this._contextMenuService, this._clipboardService)); + } } }); @@ -202,7 +219,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE @IInstantiationService instantiationService: IInstantiationService, @ICodeEditorService codeEditorService: ICodeEditorService, @IThemeService themeService: IThemeService, - @INotificationService notificationService: INotificationService + @INotificationService notificationService: INotificationService, + @IContextMenuService contextMenuService: IContextMenuService, + @IClipboardService clipboardService: IClipboardService ) { super(); @@ -282,8 +301,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._currentlyChangingViewZones = false; this._diffComputationToken = 0; - this._originalEditorState = new VisualEditorState(); - this._modifiedEditorState = new VisualEditorState(); + this._originalEditorState = new VisualEditorState(contextMenuService, clipboardService); + this._modifiedEditorState = new VisualEditorState(contextMenuService, clipboardService); this._isVisible = true; this._isHandlingScrollEvent = false; @@ -1258,6 +1277,7 @@ interface IMyViewZone { minWidthInPx?: number; domNode: HTMLElement | null; marginDomNode?: HTMLElement | null; + diff?: IDiffLinesChange; } class ForeignViewZonesIterator { @@ -1469,12 +1489,12 @@ abstract class ViewZonesComputer { }; } - private static _ensureDomNodes(zones: IMyViewZone[]): editorBrowser.IViewZone[] { + private static _ensureDomNodes(zones: IMyViewZone[]): IMyViewZone[] { return zones.map((z) => { if (!z.domNode) { z.domNode = createFakeLinesDiv(); } - return z; + return z; }); } @@ -1977,8 +1997,10 @@ class InlineViewZonesComputer extends ViewZonesComputer { let lineHeight = this.modifiedEditorConfiguration.lineHeight; const typicalHalfwidthCharacterWidth = this.modifiedEditorConfiguration.fontInfo.typicalHalfwidthCharacterWidth; let maxCharsPerLine = 0; + const originalContent: string[] = []; for (let lineNumber = lineChange.originalStartLineNumber; lineNumber <= lineChange.originalEndLineNumber; lineNumber++) { maxCharsPerLine = Math.max(maxCharsPerLine, this._renderOriginalLine(lineNumber - lineChange.originalStartLineNumber, this.originalModel, this.modifiedEditorConfiguration, this.modifiedEditorTabSize, lineNumber, decorations, sb)); + originalContent.push(this.originalModel.getLineContent(lineNumber)); if (this.renderIndicators) { let index = lineNumber - lineChange.originalStartLineNumber; @@ -2005,7 +2027,14 @@ class InlineViewZonesComputer extends ViewZonesComputer { heightInLines: lineChangeOriginalLength, minWidthInPx: (maxCharsPerLine * typicalHalfwidthCharacterWidth), domNode: domNode, - marginDomNode: marginDomNode + marginDomNode: marginDomNode, + diff: { + originalStartLineNumber: lineChange.originalStartLineNumber, + originalEndLineNumber: lineChange.originalEndLineNumber, + modifiedStartLineNumber: lineChange.modifiedStartLineNumber, + modifiedEndLineNumber: lineChange.modifiedEndLineNumber, + originalContent: originalContent + } }; } diff --git a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts index 1c6f251a3ed..2f36d8e9765 100644 --- a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts +++ b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts @@ -16,6 +16,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { INotificationService } from 'vs/platform/notification/common/notification'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; export class EmbeddedCodeEditorWidget extends CodeEditorWidget { @@ -74,9 +76,11 @@ export class EmbeddedDiffEditorWidget extends DiffEditorWidget { @IInstantiationService instantiationService: IInstantiationService, @ICodeEditorService codeEditorService: ICodeEditorService, @IThemeService themeService: IThemeService, - @INotificationService notificationService: INotificationService + @INotificationService notificationService: INotificationService, + @IContextMenuService contextMenuService: IContextMenuService, + @IClipboardService clipboardService: IClipboardService ) { - super(domElement, parentEditor.getRawConfiguration(), editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService); + super(domElement, parentEditor.getRawConfiguration(), editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, clipboardService); this._parentEditor = parentEditor; this._overwriteOptions = options; diff --git a/src/vs/editor/browser/widget/inlineDiffMargin.ts b/src/vs/editor/browser/widget/inlineDiffMargin.ts new file mode 100644 index 00000000000..7933869ab4f --- /dev/null +++ b/src/vs/editor/browser/widget/inlineDiffMargin.ts @@ -0,0 +1,170 @@ +/*--------------------------------------------------------------------------------------------- + * 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 'vs/nls'; +import * as dom from 'vs/base/browser/dom'; +import { Action } from 'vs/base/common/actions'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { Range } from 'vs/editor/common/core/range'; +import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; + +export interface IDiffLinesChange { + readonly originalStartLineNumber: number; + readonly originalEndLineNumber: number; + readonly modifiedStartLineNumber: number; + readonly modifiedEndLineNumber: number; + readonly originalContent: string[]; +} + +export class InlineDiffMargin extends Disposable { + private readonly _diffActions: HTMLElement; + + private _visibility: boolean = false; + + get visibility(): boolean { + return this._visibility; + } + + set visibility(_visibility: boolean) { + if (this._visibility !== _visibility) { + this._visibility = _visibility; + + if (_visibility) { + this._diffActions.style.visibility = 'visible'; + } else { + this._diffActions.style.visibility = 'hidden'; + } + } + } + + constructor( + private _viewZoneId: string, + private _marginDomNode: HTMLElement, + public editor: CodeEditorWidget, + public diff: IDiffLinesChange, + private _contextMenuService: IContextMenuService, + private _clipboardService: IClipboardService + ) { + super(); + + // make sure the diff margin shows above overlay. + this._marginDomNode.style.zIndex = '10'; + + this._diffActions = document.createElement('div'); + this._diffActions.className = 'lightbulb-glyph'; + this._diffActions.style.position = 'absolute'; + const lineHeight = editor.getConfiguration().lineHeight; + const lineFeed = editor.getModel()!.getEOL(); + this._diffActions.style.right = '0px'; + this._diffActions.style.visibility = 'hidden'; + this._diffActions.style.height = `${lineHeight}px`; + this._diffActions.style.lineHeight = `${lineHeight}px`; + this._marginDomNode.appendChild(this._diffActions); + + const actions: Action[] = []; + + // default action + actions.push(new Action( + 'diff.clipboard.copyDeletedContent', + diff.originalEndLineNumber > diff.modifiedStartLineNumber + ? nls.localize('diff.clipboard.copyDeletedLinesContent.label', "Copy deleted lines") + : nls.localize('diff.clipboard.copyDeletedLinesContent.single.label', "Copy deleted line"), + undefined, + true, + async () => { + await this._clipboardService.writeText(diff.originalContent.join(lineFeed) + lineFeed); + } + )); + + let currentLineNumberOffset = 0; + let copyLineAction: Action | undefined = undefined; + if (diff.originalEndLineNumber > diff.modifiedStartLineNumber) { + copyLineAction = new Action( + 'diff.clipboard.copyDeletedLineContent', + nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line ({0})", diff.originalStartLineNumber), + undefined, + true, + async () => { + await this._clipboardService.writeText(diff.originalContent[currentLineNumberOffset]); + } + ); + + actions.push(copyLineAction); + } + + const readOnly = editor.getConfiguration().readOnly; + if (!readOnly) { + actions.push(new Action('diff.inline.revertChange', nls.localize('diff.inline.revertChange.label', "Revert this change"), undefined, true, async () => { + if (diff.modifiedEndLineNumber === 0) { + // deletion only + const column = editor.getModel()!.getLineMaxColumn(diff.modifiedStartLineNumber); + editor.executeEdits('diffEditor', [ + { + range: new Range(diff.modifiedStartLineNumber, column, diff.modifiedStartLineNumber, column), + text: lineFeed + diff.originalContent.join(lineFeed) + } + ]); + } else { + const column = editor.getModel()!.getLineMaxColumn(diff.modifiedEndLineNumber); + editor.executeEdits('diffEditor', [ + { + range: new Range(diff.modifiedStartLineNumber, 1, diff.modifiedEndLineNumber, column), + text: diff.originalContent.join(lineFeed) + } + ]); + } + + })); + } + + this._register(dom.addStandardDisposableListener(this._diffActions, 'mousedown', e => { + const { top, height } = dom.getDomNodePagePosition(this._diffActions); + let pad = Math.floor(lineHeight / 3); + e.preventDefault(); + this._contextMenuService.showContextMenu({ + getAnchor: () => { + return { + x: e.posx, + y: top + height + pad + }; + }, + getActions: () => { + if (copyLineAction) { + copyLineAction.label = nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line ({0})", diff.originalStartLineNumber + currentLineNumberOffset); + } + return actions; + }, + autoSelectFirstItem: true + }); + })); + + this._register(editor.onMouseMove((e: editorBrowser.IEditorMouseEvent) => { + if (e.target.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) { + const viewZoneId = e.target.detail.viewZoneId; + + if (viewZoneId === this._viewZoneId) { + this.visibility = true; + currentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight); + } else { + this.visibility = false; + } + } else { + this.visibility = false; + } + })); + } + + private _updateLightBulbPosition(marginDomNode: HTMLElement, y: number, lineHeight: number): number { + const { top } = dom.getDomNodePagePosition(marginDomNode); + const offset = y - top; + const lineNumberOffset = Math.floor(offset / lineHeight); + const newTop = lineNumberOffset * lineHeight; + this._diffActions.style.top = `${newTop}px`; + return lineNumberOffset; + } +} diff --git a/src/vs/editor/browser/widget/media/diffEditor.css b/src/vs/editor/browser/widget/media/diffEditor.css index d70b8b88043..d1d0e48f366 100644 --- a/src/vs/editor/browser/widget/media/diffEditor.css +++ b/src/vs/editor/browser/widget/media/diffEditor.css @@ -93,3 +93,16 @@ .monaco-editor .view-zones .view-lines .view-line span { display: inline-block; } + +.monaco-editor .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { + background: url('lightbulb-light.svg') center center no-repeat; +} + +.monaco-editor.vs-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph, +.monaco-editor.hc-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { + background: url('lightbulb-dark.svg') center center no-repeat; +} + +.monaco-editor .margin-view-zones .lightbulb-glyph:hover { + cursor: pointer; +} diff --git a/src/vs/editor/browser/widget/media/lightbulb-dark.svg b/src/vs/editor/browser/widget/media/lightbulb-dark.svg new file mode 100644 index 00000000000..5fe8931a815 --- /dev/null +++ b/src/vs/editor/browser/widget/media/lightbulb-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/editor/browser/widget/media/lightbulb-light.svg b/src/vs/editor/browser/widget/media/lightbulb-light.svg new file mode 100644 index 00000000000..191c566fd2c --- /dev/null +++ b/src/vs/editor/browser/widget/media/lightbulb-light.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 65f579a296e..1fd0db269f4 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -558,6 +558,17 @@ const editorConfiguration: IConfigurationNode = { 'default': EDITOR_DEFAULTS.autoClosingQuotes, 'description': nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.") }, + 'editor.autoClosingOvertype': { + type: 'string', + enum: ['always', 'auto', 'never'], + enumDescriptions: [ + nls.localize('editor.autoClosingOvertype.always', "Always type over closing quotes or brackets."), + nls.localize('editor.autoClosingOvertype.auto', "Type over closing quotes or brackets only if they were automatically inserted."), + nls.localize('editor.autoClosingOvertype.never', "Never type over closing quotes or brackets."), + ], + 'default': EDITOR_DEFAULTS.autoClosingOvertype, + 'description': nls.localize('autoClosingOvertype', "Controls whether the editor should type over closing quotes or brackets.") + }, 'editor.autoSurround': { type: 'string', enum: ['languageDefined', 'brackets', 'quotes', 'never'], diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 71b0cbb8843..43c568a191f 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -108,6 +108,11 @@ export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWh */ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; +/** + * Configuration options for typing over closing quotes or brackets + */ +export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; + /** * Configuration options for editor minimap */ @@ -544,6 +549,10 @@ export interface IEditorOptions { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -1073,6 +1082,7 @@ export interface IValidatedEditorOptions { readonly wordWrapBreakObtrusiveCharacters: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly dragAndDrop: boolean; @@ -1111,6 +1121,7 @@ export class InternalEditorOptions { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -1141,6 +1152,7 @@ export class InternalEditorOptions { wordSeparators: string; autoClosingBrackets: EditorAutoClosingStrategy; autoClosingQuotes: EditorAutoClosingStrategy; + autoClosingOvertype: EditorAutoClosingOvertypeStrategy; autoSurround: EditorAutoSurroundStrategy; autoIndent: boolean; useTabStops: boolean; @@ -1166,6 +1178,7 @@ export class InternalEditorOptions { this.wordSeparators = source.wordSeparators; this.autoClosingBrackets = source.autoClosingBrackets; this.autoClosingQuotes = source.autoClosingQuotes; + this.autoClosingOvertype = source.autoClosingOvertype; this.autoSurround = source.autoSurround; this.autoIndent = source.autoIndent; this.useTabStops = source.useTabStops; @@ -1197,6 +1210,7 @@ export class InternalEditorOptions { && this.wordSeparators === other.wordSeparators && this.autoClosingBrackets === other.autoClosingBrackets && this.autoClosingQuotes === other.autoClosingQuotes + && this.autoClosingOvertype === other.autoClosingOvertype && this.autoSurround === other.autoSurround && this.autoIndent === other.autoIndent && this.useTabStops === other.useTabStops @@ -1229,6 +1243,7 @@ export class InternalEditorOptions { wordSeparators: (this.wordSeparators !== newOpts.wordSeparators), autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets), autoClosingQuotes: (this.autoClosingQuotes !== newOpts.autoClosingQuotes), + autoClosingOvertype: (this.autoClosingOvertype !== newOpts.autoClosingOvertype), autoSurround: (this.autoSurround !== newOpts.autoSurround), autoIndent: (this.autoIndent !== newOpts.autoIndent), useTabStops: (this.useTabStops !== newOpts.useTabStops), @@ -1634,6 +1649,7 @@ export interface IConfigurationChangedEvent { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -1846,6 +1862,7 @@ export class EditorOptionsValidator { wordWrapBreakObtrusiveCharacters: _string(opts.wordWrapBreakObtrusiveCharacters, defaults.wordWrapBreakObtrusiveCharacters), autoClosingBrackets, autoClosingQuotes, + autoClosingOvertype: _stringSet(opts.autoClosingOvertype, defaults.autoClosingOvertype, ['always', 'auto', 'never']), autoSurround, autoIndent: _boolean(opts.autoIndent, defaults.autoIndent), dragAndDrop: _boolean(opts.dragAndDrop, defaults.dragAndDrop), @@ -2142,7 +2159,6 @@ export class EditorOptionsValidator { export class InternalEditorOptionsFactory { private static _tweakValidatedOptions(opts: IValidatedEditorOptions, accessibilitySupport: AccessibilitySupport): IValidatedEditorOptions { - const accessibilityIsOn = (accessibilitySupport === AccessibilitySupport.Enabled); const accessibilityIsOff = (accessibilitySupport === AccessibilitySupport.Disabled); return { inDiffEditor: opts.inDiffEditor, @@ -2162,6 +2178,7 @@ export class InternalEditorOptionsFactory { wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, + autoClosingOvertype: opts.autoClosingOvertype, autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, dragAndDrop: opts.dragAndDrop, @@ -2185,7 +2202,7 @@ export class InternalEditorOptionsFactory { selectOnLineNumbers: opts.viewInfo.selectOnLineNumbers, glyphMargin: opts.viewInfo.glyphMargin, revealHorizontalRightPadding: opts.viewInfo.revealHorizontalRightPadding, - roundedSelection: (accessibilityIsOn ? false : opts.viewInfo.roundedSelection), // DISABLED WHEN SCREEN READER IS ATTACHED + roundedSelection: opts.viewInfo.roundedSelection, overviewRulerLanes: opts.viewInfo.overviewRulerLanes, overviewRulerBorder: opts.viewInfo.overviewRulerBorder, cursorBlinking: opts.viewInfo.cursorBlinking, @@ -2198,15 +2215,15 @@ export class InternalEditorOptionsFactory { scrollBeyondLastColumn: opts.viewInfo.scrollBeyondLastColumn, smoothScrolling: opts.viewInfo.smoothScrolling, stopRenderingLineAfter: opts.viewInfo.stopRenderingLineAfter, - renderWhitespace: (accessibilityIsOn ? 'none' : opts.viewInfo.renderWhitespace), // DISABLED WHEN SCREEN READER IS ATTACHED - renderControlCharacters: (accessibilityIsOn ? false : opts.viewInfo.renderControlCharacters), // DISABLED WHEN SCREEN READER IS ATTACHED + renderWhitespace: opts.viewInfo.renderWhitespace, + renderControlCharacters: opts.viewInfo.renderControlCharacters, fontLigatures: opts.viewInfo.fontLigatures, - renderIndentGuides: (accessibilityIsOn ? false : opts.viewInfo.renderIndentGuides), // DISABLED WHEN SCREEN READER IS ATTACHED + renderIndentGuides: opts.viewInfo.renderIndentGuides, highlightActiveIndentGuide: opts.viewInfo.highlightActiveIndentGuide, renderLineHighlight: opts.viewInfo.renderLineHighlight, scrollbar: opts.viewInfo.scrollbar, minimap: { - enabled: (accessibilityIsOn ? false : opts.viewInfo.minimap.enabled), // DISABLED WHEN SCREEN READER IS ATTACHED + enabled: opts.viewInfo.minimap.enabled, side: opts.viewInfo.minimap.side, renderCharacters: opts.viewInfo.minimap.renderCharacters, showSlider: opts.viewInfo.minimap.showSlider, @@ -2218,7 +2235,7 @@ export class InternalEditorOptionsFactory { contribInfo: { selectionClipboard: opts.contribInfo.selectionClipboard, hover: opts.contribInfo.hover, - links: (accessibilityIsOn ? false : opts.contribInfo.links), // DISABLED WHEN SCREEN READER IS ATTACHED + links: opts.contribInfo.links, contextmenu: opts.contribInfo.contextmenu, quickSuggestions: opts.contribInfo.quickSuggestions, quickSuggestionsDelay: opts.contribInfo.quickSuggestionsDelay, @@ -2235,13 +2252,13 @@ export class InternalEditorOptionsFactory { tabCompletion: opts.contribInfo.tabCompletion, suggest: opts.contribInfo.suggest, gotoLocation: opts.contribInfo.gotoLocation, - selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED - occurrencesHighlight: (accessibilityIsOn ? false : opts.contribInfo.occurrencesHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED - codeLens: (accessibilityIsOn ? false : opts.contribInfo.codeLens), // DISABLED WHEN SCREEN READER IS ATTACHED - folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED + selectionHighlight: opts.contribInfo.selectionHighlight, + occurrencesHighlight: opts.contribInfo.occurrencesHighlight, + codeLens: opts.contribInfo.codeLens, + folding: opts.contribInfo.folding, foldingStrategy: opts.contribInfo.foldingStrategy, showFoldingControls: opts.contribInfo.showFoldingControls, - matchBrackets: (accessibilityIsOn ? false : opts.contribInfo.matchBrackets), // DISABLED WHEN SCREEN READER IS ATTACHED + matchBrackets: opts.contribInfo.matchBrackets, find: opts.contribInfo.find, colorDecorators: opts.contribInfo.colorDecorators, lightbulbEnabled: opts.contribInfo.lightbulbEnabled, @@ -2390,6 +2407,7 @@ export class InternalEditorOptionsFactory { wordSeparators: opts.wordSeparators, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, + autoClosingOvertype: opts.autoClosingOvertype, autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, useTabStops: opts.useTabStops, @@ -2627,6 +2645,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { wordWrapBreakObtrusiveCharacters: '.', autoClosingBrackets: 'languageDefined', autoClosingQuotes: 'languageDefined', + autoClosingOvertype: 'auto', autoSurround: 'languageDefined', autoIndent: true, dragAndDrop: true, diff --git a/src/vs/editor/common/controller/cursor.ts b/src/vs/editor/common/controller/cursor.ts index 1b448239065..b76218fe99b 100644 --- a/src/vs/editor/common/controller/cursor.ts +++ b/src/vs/editor/common/controller/cursor.ts @@ -643,9 +643,17 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { autoClosedEnclosingRanges.push(new Range(lineNumber, openCharIndex + 1, lineNumber, closeCharIndex + 2)); } } - return cursorStateComputer(undoEdits); + const selections = cursorStateComputer(undoEdits); + if (selections) { + // Don't recover the selection from markers because + // we know what it should be. + this._isHandling = true; + } + + return selections; }); if (selections) { + this._isHandling = false; this.setSelections(source, selections); } if (autoClosedCharactersRanges.length > 0) { diff --git a/src/vs/editor/common/controller/cursorCommon.ts b/src/vs/editor/common/controller/cursorCommon.ts index f459e61735f..87c3878b61c 100644 --- a/src/vs/editor/common/controller/cursorCommon.ts +++ b/src/vs/editor/common/controller/cursorCommon.ts @@ -6,7 +6,7 @@ import { CharCode } from 'vs/base/common/charCode'; import { onUnexpectedError } from 'vs/base/common/errors'; import * as strings from 'vs/base/common/strings'; -import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions'; +import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, IConfigurationChangedEvent, EditorAutoClosingOvertypeStrategy } from 'vs/editor/common/config/editorOptions'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -99,6 +99,7 @@ export class CursorConfiguration { public readonly multiCursorMergeOverlapping: boolean; public readonly autoClosingBrackets: EditorAutoClosingStrategy; public readonly autoClosingQuotes: EditorAutoClosingStrategy; + public readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; public readonly autoSurround: EditorAutoSurroundStrategy; public readonly autoIndent: boolean; public readonly autoClosingPairsOpen2: Map; @@ -117,6 +118,7 @@ export class CursorConfiguration { || e.multiCursorMergeOverlapping || e.autoClosingBrackets || e.autoClosingQuotes + || e.autoClosingOvertype || e.autoSurround || e.useTabStops || e.lineHeight @@ -146,6 +148,7 @@ export class CursorConfiguration { this.multiCursorMergeOverlapping = c.multiCursorMergeOverlapping; this.autoClosingBrackets = c.autoClosingBrackets; this.autoClosingQuotes = c.autoClosingQuotes; + this.autoClosingOvertype = c.autoClosingOvertype; this.autoSurround = c.autoSurround; this.autoIndent = c.autoIndent; diff --git a/src/vs/editor/common/controller/cursorTypeOperations.ts b/src/vs/editor/common/controller/cursorTypeOperations.ts index aa6b5747420..bcf4d3ef83a 100644 --- a/src/vs/editor/common/controller/cursorTypeOperations.ts +++ b/src/vs/editor/common/controller/cursorTypeOperations.ts @@ -431,10 +431,8 @@ export class TypeOperations { return null; } - private static _isAutoClosingCloseCharType(config: CursorConfiguration, model: ITextModel, selections: Selection[], autoClosedCharacters: Range[], ch: string): boolean { - const autoCloseConfig = isQuote(ch) ? config.autoClosingQuotes : config.autoClosingBrackets; - - if (autoCloseConfig === 'never') { + private static _isAutoClosingOvertype(config: CursorConfiguration, model: ITextModel, selections: Selection[], autoClosedCharacters: Range[], ch: string): boolean { + if (config.autoClosingOvertype === 'never') { return false; } @@ -458,23 +456,25 @@ export class TypeOperations { } // Must over-type a closing character typed by the editor - let found = false; - for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) { - const autoClosedCharacter = autoClosedCharacters[j]; - if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) { - found = true; - break; + if (config.autoClosingOvertype === 'auto') { + let found = false; + for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) { + const autoClosedCharacter = autoClosedCharacters[j]; + if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) { + found = true; + break; + } + } + if (!found) { + return false; } - } - if (!found) { - return false; } } return true; } - private static _runAutoClosingCloseCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITextModel, selections: Selection[], ch: string): EditOperationResult { + private static _runAutoClosingOvertype(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITextModel, selections: Selection[], ch: string): EditOperationResult { let commands: ICommand[] = []; for (let i = 0, len = selections.length; i < len; i++) { const selection = selections[i]; @@ -765,7 +765,7 @@ export class TypeOperations { return null; } - if (this._isAutoClosingCloseCharType(config, model, selections, autoClosedCharacters, ch)) { + if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) { // Unfortunately, the close character is at this point "doubled", so we need to delete it... const commands = selections.map(s => new ReplaceCommand(new Range(s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), '', false)); return new EditOperationResult(EditOperationType.Typing, commands, { @@ -813,8 +813,8 @@ export class TypeOperations { } } - if (this._isAutoClosingCloseCharType(config, model, selections, autoClosedCharacters, ch)) { - return this._runAutoClosingCloseCharType(prevEditOperationType, config, model, selections, ch); + if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) { + return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch); } const autoClosingPairOpenCharType = this._isAutoClosingOpenCharType(config, model, selections, ch, true); diff --git a/src/vs/editor/common/controller/cursorWordOperations.ts b/src/vs/editor/common/controller/cursorWordOperations.ts index 1939996a242..300174e613a 100644 --- a/src/vs/editor/common/controller/cursorWordOperations.ts +++ b/src/vs/editor/common/controller/cursorWordOperations.ts @@ -39,7 +39,8 @@ const enum WordType { export const enum WordNavigationType { WordStart = 0, WordStartFast = 1, - WordEnd = 2 + WordEnd = 2, + WordAccessibility = 3 // Respect chrome defintion of a word } export class WordOperations { @@ -202,6 +203,18 @@ export class WordOperations { return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1); } + if (wordNavigationType === WordNavigationType.WordAccessibility) { + while ( + prevWordOnLine + && prevWordOnLine.wordType === WordType.Separator + ) { + // Skip over words made up of only separators + prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1)); + } + + return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1); + } + // We are stopping at the ending of words if (prevWordOnLine && column <= prevWordOnLine.end + 1) { @@ -270,6 +283,21 @@ export class WordOperations { nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1)); } } + if (nextWordOnLine) { + column = nextWordOnLine.end + 1; + } else { + column = model.getLineMaxColumn(lineNumber); + } + } else if (wordNavigationType === WordNavigationType.WordAccessibility) { + + while ( + nextWordOnLine + && nextWordOnLine.wordType === WordType.Separator + ) { + // Skip over a word made up of one single separator + nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1)); + } + if (nextWordOnLine) { column = nextWordOnLine.end + 1; } else { @@ -617,4 +645,4 @@ export class WordPartOperations extends WordOperations { function enforceDefined(arr: Array): T[] { return arr.filter(el => Boolean(el)); -} \ No newline at end of file +} diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 78610e6c004..cc2adefb59e 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -367,7 +367,7 @@ export let completionKindFromString: { }; })(); -export const enum CompletionItemKindModifier { +export const enum CompletionItemTag { Deprecated = 1 } @@ -404,7 +404,7 @@ export interface CompletionItem { * A modifier to the `kind` which affect how the item * is rendered, e.g. Deprecated is rendered with a strikeout */ - kindModifier?: Set; + tags?: ReadonlyArray; /** * A human-readable string with additional information * about this item, like type or symbol information. @@ -867,6 +867,9 @@ export const enum SymbolKind { TypeParameter = 25 } +export const enum SymbolTag { + Deprecated = 1, +} /** * @internal @@ -910,6 +913,7 @@ export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + tags: ReadonlyArray; containerName?: string; range: IRange; selectionRange: IRange; diff --git a/src/vs/editor/common/modes/textToHtmlTokenizer.ts b/src/vs/editor/common/modes/textToHtmlTokenizer.ts index 4b1afa955ea..af5a682bc37 100644 --- a/src/vs/editor/common/modes/textToHtmlTokenizer.ts +++ b/src/vs/editor/common/modes/textToHtmlTokenizer.ts @@ -78,7 +78,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens break; case CharCode.Space: - partContent += ' '; + partContent += ' '; break; default: diff --git a/src/vs/editor/common/services/editorWorkerService.ts b/src/vs/editor/common/services/editorWorkerService.ts index 28dcae74ce6..bd217b1944d 100644 --- a/src/vs/editor/common/services/editorWorkerService.ts +++ b/src/vs/editor/common/services/editorWorkerService.ts @@ -18,7 +18,7 @@ export interface IDiffComputationResult { } export interface IEditorWorkerService { - _serviceBrand: any; + _serviceBrand: undefined; canComputeDiff(original: URI, modified: URI): boolean; computeDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean): Promise; diff --git a/src/vs/editor/common/services/editorWorkerServiceImpl.ts b/src/vs/editor/common/services/editorWorkerServiceImpl.ts index 74ff7b7fbfa..34001e40608 100644 --- a/src/vs/editor/common/services/editorWorkerServiceImpl.ts +++ b/src/vs/editor/common/services/editorWorkerServiceImpl.ts @@ -46,7 +46,7 @@ function canSyncModel(modelService: IModelService, resource: URI): boolean { } export class EditorWorkerServiceImpl extends Disposable implements IEditorWorkerService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _modelService: IModelService; private readonly _workerManager: WorkerManager; diff --git a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts index 3da62fed16f..c2140eff46d 100644 --- a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts +++ b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts @@ -61,7 +61,7 @@ class MarkerDecorations extends Disposable { export class MarkerDecorationsService extends Disposable implements IMarkerDecorationsService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidChangeMarker = this._register(new Emitter()); readonly onDidChangeMarker: Event = this._onDidChangeMarker.event; diff --git a/src/vs/editor/common/services/markersDecorationService.ts b/src/vs/editor/common/services/markersDecorationService.ts index 44aa7ca2463..cd1c541cbc0 100644 --- a/src/vs/editor/common/services/markersDecorationService.ts +++ b/src/vs/editor/common/services/markersDecorationService.ts @@ -12,7 +12,7 @@ import { Range } from 'vs/editor/common/core/range'; export const IMarkerDecorationsService = createDecorator('markerDecorationsService'); export interface IMarkerDecorationsService { - _serviceBrand: any; + _serviceBrand: undefined; onDidChangeMarker: Event; diff --git a/src/vs/editor/common/services/modeService.ts b/src/vs/editor/common/services/modeService.ts index fd01515a97e..a6d2a6bc9e2 100644 --- a/src/vs/editor/common/services/modeService.ts +++ b/src/vs/editor/common/services/modeService.ts @@ -28,7 +28,7 @@ export interface ILanguageSelection extends IDisposable { } export interface IModeService { - _serviceBrand: any; + _serviceBrand: undefined; onDidCreateMode: Event; diff --git a/src/vs/editor/common/services/modeServiceImpl.ts b/src/vs/editor/common/services/modeServiceImpl.ts index 30ac27d4979..9ea8b4b204c 100644 --- a/src/vs/editor/common/services/modeServiceImpl.ts +++ b/src/vs/editor/common/services/modeServiceImpl.ts @@ -40,7 +40,7 @@ class LanguageSelection extends Disposable implements ILanguageSelection { } export class ModeServiceImpl implements IModeService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _instantiatedModes: { [modeId: string]: IMode; }; private readonly _registry: LanguagesRegistry; diff --git a/src/vs/editor/common/services/modelService.ts b/src/vs/editor/common/services/modelService.ts index 83f065c96ab..1c4a4514404 100644 --- a/src/vs/editor/common/services/modelService.ts +++ b/src/vs/editor/common/services/modelService.ts @@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const IModelService = createDecorator('modelService'); export interface IModelService { - _serviceBrand: any; + _serviceBrand: undefined; createModel(value: string | ITextBufferFactory, languageSelection: ILanguageSelection | null, resource?: URI, isForSimpleWidget?: boolean): ITextModel; diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 00a95b42c78..1c9d7a274a9 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -88,7 +88,7 @@ interface IRawConfig { const DEFAULT_EOL = (platform.isLinux || platform.isMacintosh) ? DefaultEndOfLine.LF : DefaultEndOfLine.CRLF; export class ModelServiceImpl extends Disposable implements IModelService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _configurationService: IConfigurationService; private readonly _configurationServiceSubscription: IDisposable; diff --git a/src/vs/editor/common/services/resolverService.ts b/src/vs/editor/common/services/resolverService.ts index 958469e16f1..b425ebb8fde 100644 --- a/src/vs/editor/common/services/resolverService.ts +++ b/src/vs/editor/common/services/resolverService.ts @@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const ITextModelService = createDecorator('textModelService'); export interface ITextModelService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Provided a resource URI, it will return a model reference diff --git a/src/vs/editor/common/services/resourceConfiguration.ts b/src/vs/editor/common/services/resourceConfiguration.ts index 311556df882..0e122347e34 100644 --- a/src/vs/editor/common/services/resourceConfiguration.ts +++ b/src/vs/editor/common/services/resourceConfiguration.ts @@ -13,7 +13,7 @@ export const ITextResourceConfigurationService = createDecorator = this._register(new Emitter()); public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index 76ee0d96933..a705c132478 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -581,7 +581,7 @@ export enum CompletionItemKind { Snippet = 25 } -export enum CompletionItemKindModifier { +export enum CompletionItemTag { Deprecated = 1 } @@ -660,4 +660,8 @@ export enum SymbolKind { Event = 23, Operator = 24, TypeParameter = 25 +} + +export enum SymbolTag { + Deprecated = 1 } \ No newline at end of file diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index f706070a89b..2efdfb5dc12 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -143,6 +143,6 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor, { type: 'manual', filter: { includeSourceActions: true, kind: kind && kind.value ? new CodeActionKind(kind.value) : undefined } }, CancellationToken.None); - setTimeout(() => codeActionSet.dispose(), 0); + setTimeout(() => codeActionSet.dispose(), 100); return codeActionSet.actions; }); diff --git a/src/vs/editor/contrib/codelens/codeLensCache.ts b/src/vs/editor/contrib/codelens/codeLensCache.ts index 9bddbb1d355..2bff6506f43 100644 --- a/src/vs/editor/contrib/codelens/codeLensCache.ts +++ b/src/vs/editor/contrib/codelens/codeLensCache.ts @@ -17,7 +17,7 @@ import { once } from 'vs/base/common/functional'; export const ICodeLensCache = createDecorator('ICodeLensCache'); export interface ICodeLensCache { - _serviceBrand: any; + _serviceBrand: undefined; put(model: ITextModel, data: CodeLensModel): void; get(model: ITextModel): CodeLensModel | undefined; delete(model: ITextModel): void; @@ -38,7 +38,7 @@ class CacheItem { export class CodeLensCache implements ICodeLensCache { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _fakeProvider = new class implements CodeLensProvider { provideCodeLenses(): CodeLensList { diff --git a/src/vs/editor/contrib/codelens/codelens.ts b/src/vs/editor/contrib/codelens/codelens.ts index 96ccedce7ee..76c9cd84fd7 100644 --- a/src/vs/editor/contrib/codelens/codelens.ts +++ b/src/vs/editor/contrib/codelens/codelens.ts @@ -22,14 +22,14 @@ export class CodeLensModel { lenses: CodeLensItem[] = []; - private readonly _dispoables = new DisposableStore(); + private readonly _disposables = new DisposableStore(); dispose(): void { - this._dispoables.dispose(); + this._disposables.dispose(); } add(list: CodeLensList, provider: CodeLensProvider): void { - this._dispoables.add(list); + this._disposables.add(list); for (const symbol of list.lenses) { this.lenses.push({ symbol, provider }); } @@ -89,8 +89,10 @@ registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) { } const result: CodeLens[] = []; + const disposables = new DisposableStore(); return getCodeLensData(model, CancellationToken.None).then(value => { + disposables.add(value); let resolve: Promise[] = []; for (const item of value.lenses) { @@ -101,9 +103,13 @@ registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) { } } - return Promise.all(resolve).finally(() => setTimeout(() => value.dispose(), 0)); + return Promise.all(resolve); }).then(() => { return result; + }).finally(() => { + // make sure to return results, then (on next tick) + // dispose the results + setTimeout(() => disposables.dispose(), 100); }); }); diff --git a/src/vs/editor/contrib/codelens/codelensController.ts b/src/vs/editor/contrib/codelens/codelensController.ts index 1aed8453777..726133c3f7f 100644 --- a/src/vs/editor/contrib/codelens/codelensController.ts +++ b/src/vs/editor/contrib/codelens/codelensController.ts @@ -32,7 +32,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { private _currentCodeLensModel: CodeLensModel | undefined; private _modelChangeCounter: number = 0; private _currentResolveCodeLensSymbolsPromise: CancelablePromise | undefined; - private _detectVisibleLenses!: RunOnceScheduler; + private _detectVisibleLenses: RunOnceScheduler | undefined; constructor( private readonly _editor: editorBrowser.ICodeEditor, @@ -121,9 +121,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { } } - this._detectVisibleLenses = new RunOnceScheduler(() => { - this._onViewportChanged(); - }, 250); + const detectVisibleLenses = this._detectVisibleLenses = new RunOnceScheduler(() => this._onViewportChanged(), 250); const scheduler = new RunOnceScheduler(() => { const counterValue = ++this._modelChangeCounter; @@ -145,12 +143,12 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { // render lenses this._renderCodeLensSymbols(result); - this._detectVisibleLenses.schedule(); + detectVisibleLenses.schedule(); } }, onUnexpectedError); }, 250); this._localToDispose.add(scheduler); - this._localToDispose.add(this._detectVisibleLenses); + this._localToDispose.add(detectVisibleLenses); this._localToDispose.add(this._editor.onDidChangeModelContent(() => { this._editor.changeDecorations(decorationsAccessor => { this._editor.changeViewZones(viewZonesAccessor => { @@ -179,17 +177,17 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { }); // Compute new `visible` code lenses - this._detectVisibleLenses.schedule(); + detectVisibleLenses.schedule(); // Ask for all references again scheduler.schedule(); })); this._localToDispose.add(this._editor.onDidScrollChange(e => { if (e.scrollTopChanged && this._lenses.length > 0) { - this._detectVisibleLenses.schedule(); + detectVisibleLenses.schedule(); } })); this._localToDispose.add(this._editor.onDidLayoutChange(() => { - this._detectVisibleLenses.schedule(); + detectVisibleLenses.schedule(); })); this._localToDispose.add(toDisposable(() => { if (this._editor.getModel()) { @@ -281,7 +279,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { groupsIndex++; codeLensIndex++; } else { - this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses.schedule())); + this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); codeLensIndex++; groupsIndex++; } @@ -295,7 +293,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { // Create extra symbols while (groupsIndex < groups.length) { - this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses.schedule())); + this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); groupsIndex++; } diff --git a/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css b/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css index 4e312f7dfe6..0504a233a63 100644 --- a/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css +++ b/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css @@ -3,6 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +.monaco-workbench .monaco-icon-label.deprecated { + text-decoration: line-through; + opacity: 0.66; +} + .monaco-workbench .symbol-icon.inline { background-position: left center; padding-left: 20px; diff --git a/src/vs/editor/contrib/documentSymbols/outlineTree.ts b/src/vs/editor/contrib/documentSymbols/outlineTree.ts index 365b3e45c13..84ac8bb704c 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineTree.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineTree.ts @@ -12,7 +12,7 @@ import { createMatches, FuzzyScore } from 'vs/base/common/filters'; import 'vs/css!./media/outlineTree'; import 'vs/css!./media/symbol-icons'; import { Range } from 'vs/editor/common/core/range'; -import { SymbolKind, symbolKindToCssClass } from 'vs/editor/common/modes'; +import { SymbolKind, symbolKindToCssClass, SymbolTag } from 'vs/editor/common/modes'; import { OutlineElement, OutlineGroup, OutlineModel } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { localize } from 'vs/nls'; import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel'; @@ -127,6 +127,10 @@ export class OutlineElementRenderer implements ITreeRenderer= 0) { + options.extraClasses.push(`deprecated`); + options.matches = []; + } template.iconLabel.setLabel(element.symbol.name, element.symbol.detail, options); this._renderMarkerInfo(element, template); } diff --git a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts index b15a1451072..b41a7f8dd8f 100644 --- a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts +++ b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts @@ -76,6 +76,7 @@ suite('OutlineModel', function () { name, detail: 'fake', kind: SymbolKind.Boolean, + tags: [], selectionRange: range, range: range }; diff --git a/src/vs/editor/contrib/find/findWidget.css b/src/vs/editor/contrib/find/findWidget.css index 693157f51f6..20d486d1000 100644 --- a/src/vs/editor/contrib/find/findWidget.css +++ b/src/vs/editor/contrib/find/findWidget.css @@ -38,6 +38,7 @@ line-height: 19px; transition: top 200ms linear; padding: 0 4px; + box-sizing: border-box; } .monaco-editor .find-widget.hiddenEditor { diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index 2bfbe8388d3..383f158c1de 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -57,7 +57,7 @@ const NLS_MATCHES_COUNT_LIMIT_TITLE = nls.localize('title.matchesCountLimit', "O const NLS_MATCHES_LOCATION = nls.localize('label.matchesLocation', "{0} of {1}"); const NLS_NO_RESULTS = nls.localize('label.noResults', "No Results"); -const FIND_WIDGET_INITIAL_WIDTH = 411; +const FIND_WIDGET_INITIAL_WIDTH = 419; const PART_WIDTH = 275; const FIND_INPUT_AREA_WIDTH = PART_WIDTH - 54; @@ -111,7 +111,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas private readonly _notificationService: INotificationService; private _domNode!: HTMLElement; - private _cachedHeight: number | null; + private _cachedHeight: number | null = null; private _findInput!: FindInput; private _replaceInput!: ReplaceInput; @@ -781,7 +781,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas const end = inputElement.selectionEnd; const content = inputElement.value; - if (start && end) { + if (start !== null && end !== null) { const value = content.substr(0, start) + '\n' + content.substr(end); this._findInput.inputBox.value = value; inputElement.setSelectionRange(start + 1, start + 1); @@ -1172,6 +1172,39 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas this._findInput.inputBox.layout(); this._tryUpdateHeight(); })); + + this._register(this._resizeSash.onDidReset(() => { + // users double click on the sash + const currentWidth = dom.getTotalWidth(this._domNode); + + if (currentWidth < FIND_WIDGET_INITIAL_WIDTH) { + // The editor is narrow and the width of the find widget is controlled fully by CSS. + return; + } + + let width = FIND_WIDGET_INITIAL_WIDTH; + + if (!this._resized || currentWidth === FIND_WIDGET_INITIAL_WIDTH) { + // 1. never resized before, double click should maximizes it + // 2. users resized it already but its width is the same as default + width = this._codeEditor.getConfiguration().layoutInfo.width - 28 - this._codeEditor.getConfiguration().layoutInfo.minimapWidth - 15; + this._resized = true; + } else { + /** + * no op, the find widget should be shrinked to its default size. + */ + } + + const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; + + this._domNode.style.width = `${width}px`; + this._findInput.inputBox.width = inputBoxWidth; + if (this._isReplaceVisible) { + this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); + } + + this._findInput.inputBox.layout(); + })); } private updateAccessibilitySupport(): void { diff --git a/src/vs/editor/contrib/find/test/replacePattern.test.ts b/src/vs/editor/contrib/find/test/replacePattern.test.ts index e4c78422b8f..8a651279a6d 100644 --- a/src/vs/editor/contrib/find/test/replacePattern.test.ts +++ b/src/vs/editor/contrib/find/test/replacePattern.test.ts @@ -176,6 +176,13 @@ suite('Replace Pattern test', () => { assert.equal(buildReplaceStringWithCasePreserved(actual, replacePattern), 'Def'); actual = ['aBC']; assert.equal(buildReplaceStringWithCasePreserved(actual, replacePattern), 'Def'); + + actual = ['Foo-Bar']; + assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar'), 'Newfoo-Newbar'); + actual = ['Foo-Bar-Abc']; + assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar-newabc'), 'Newfoo-Newbar-Newabc'); + actual = ['Foo-Bar-abc']; + assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar'), 'Newfoo-newbar'); }); test('preserve case', () => { @@ -198,5 +205,17 @@ suite('Replace Pattern test', () => { assert.equal(actual, 'Def'); actual = replacePattern.buildReplaceString(['aBC'], true); assert.equal(actual, 'Def'); + + replacePattern = parseReplaceString('newfoo-newbar'); + actual = replacePattern.buildReplaceString(['Foo-Bar'], true); + assert.equal(actual, 'Newfoo-Newbar'); + + replacePattern = parseReplaceString('newfoo-newbar-newabc'); + actual = replacePattern.buildReplaceString(['Foo-Bar-Abc'], true); + assert.equal(actual, 'Newfoo-Newbar-Newabc'); + + replacePattern = parseReplaceString('newfoo-newbar'); + actual = replacePattern.buildReplaceString(['Foo-Bar-abc'], true); + assert.equal(actual, 'Newfoo-newbar'); }); }); diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionResultsNavigation.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionResultsNavigation.ts index cb35c72173e..e52bc043383 100644 --- a/src/vs/editor/contrib/goToDefinition/goToDefinitionResultsNavigation.ts +++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionResultsNavigation.ts @@ -24,7 +24,7 @@ export const ctxHasSymbols = new RawContextKey('hasSymbols', false); export const ISymbolNavigationService = createDecorator('ISymbolNavigationService'); export interface ISymbolNavigationService { - _serviceBrand: any; + _serviceBrand: undefined; reset(): void; put(anchor: OneReference): void; revealNext(source: ICodeEditor): Promise; @@ -32,7 +32,7 @@ export interface ISymbolNavigationService { class SymbolNavigationService implements ISymbolNavigationService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _ctxHasSymbols: IContextKey; diff --git a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts index 74068f74cf9..4e3fb3beabe 100644 --- a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts +++ b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts @@ -60,7 +60,7 @@ suite('Multicursor selection', () => { let queryState: { [key: string]: any; } = {}; let serviceCollection = new ServiceCollection(); serviceCollection.set(IStorageService, { - _serviceBrand: undefined as any, + _serviceBrand: undefined, onDidChangeStorage: Event.None, onWillSaveState: Event.None, get: (key: string) => queryState[key], diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index eb846502b63..04011709292 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { dispose } from 'vs/base/common/lifecycle'; +import { Disposable } from 'vs/base/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; @@ -18,7 +18,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import * as modes from 'vs/editor/common/modes'; import { TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel'; -class ParameterHintsController implements IEditorContribution { +class ParameterHintsController extends Disposable implements IEditorContribution { private static readonly ID = 'editor.controller.parameterHints'; @@ -30,8 +30,9 @@ class ParameterHintsController implements IEditorContribution { private readonly widget: ParameterHintsWidget; constructor(editor: ICodeEditor, @IInstantiationService instantiationService: IInstantiationService) { + super(); this.editor = editor; - this.widget = instantiationService.createInstance(ParameterHintsWidget, this.editor); + this.widget = this._register(instantiationService.createInstance(ParameterHintsWidget, this.editor)); } getId(): string { @@ -53,10 +54,6 @@ class ParameterHintsController implements IEditorContribution { trigger(context: TriggerContext): void { this.widget.trigger(context); } - - dispose(): void { - dispose(this.widget); - } } export class TriggerParameterHintsAction extends EditorAction { @@ -76,7 +73,7 @@ export class TriggerParameterHintsAction extends EditorAction { } public run(accessor: ServicesAccessor, editor: ICodeEditor): void { - let controller = ParameterHintsController.get(editor); + const controller = ParameterHintsController.get(editor); if (controller) { controller.trigger({ triggerKind: modes.SignatureHelpTriggerKind.Invoke diff --git a/src/vs/editor/contrib/quickOpen/quickOpen.ts b/src/vs/editor/contrib/quickOpen/quickOpen.ts index dba67c40b01..2730114175b 100644 --- a/src/vs/editor/contrib/quickOpen/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/quickOpen.ts @@ -3,44 +3,41 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { illegalArgument, onUnexpectedExternalError } from 'vs/base/common/errors'; +import { illegalArgument } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions'; -import { DocumentSymbol, DocumentSymbolProviderRegistry } from 'vs/editor/common/modes'; +import { DocumentSymbol } from 'vs/editor/common/modes'; import { IModelService } from 'vs/editor/common/services/modelService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; +import { OutlineModel, OutlineElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; +import { values } from 'vs/base/common/collections'; -export function getDocumentSymbols(model: ITextModel, flat: boolean, token: CancellationToken): Promise { +export async function getDocumentSymbols(document: ITextModel, flat: boolean, token: CancellationToken): Promise { - let roots: DocumentSymbol[] = []; - - let promises = DocumentSymbolProviderRegistry.all(model).map(support => { - - return Promise.resolve(support.provideDocumentSymbols(model, token)).then(result => { - if (Array.isArray(result)) { - roots.push(...result); - } - }, err => { - onUnexpectedExternalError(err); - }); - }); - - return Promise.all(promises).then(() => { - let flatEntries: DocumentSymbol[] = []; - if (token.isCancellationRequested) { - return flatEntries; - } - if (flat) { - flatten(flatEntries, roots, ''); + const model = await OutlineModel.create(document, token); + const roots: DocumentSymbol[] = []; + for (const child of values(model.children)) { + if (child instanceof OutlineElement) { + roots.push(child.symbol); } else { - flatEntries = roots; + roots.push(...values(child.children).map(child => child.symbol)); } - flatEntries.sort(compareEntriesUsingStart); + } + + let flatEntries: DocumentSymbol[] = []; + if (token.isCancellationRequested) { return flatEntries; - }); + } + if (flat) { + flatten(flatEntries, roots, ''); + } else { + flatEntries = roots; + } + + return flatEntries.sort(compareEntriesUsingStart); } function compareEntriesUsingStart(a: DocumentSymbol, b: DocumentSymbol): number { @@ -51,6 +48,7 @@ function flatten(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideCo for (let entry of entries) { bucket.push({ kind: entry.kind, + tags: entry.tags, name: entry.name, detail: entry.detail, containerName: entry.containerName || overrideContainerLabel, diff --git a/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts b/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts index 4dd63cadd03..0ef1a5253c6 100644 --- a/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts @@ -25,12 +25,12 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export const IPeekViewService = createDecorator('IPeekViewService'); export interface IPeekViewService { - _serviceBrand: any; + _serviceBrand: undefined; addExclusiveWidget(editor: ICodeEditor, widget: PeekViewWidget): void; } registerSingleton(IPeekViewService, class implements IPeekViewService { - _serviceBrand: any; + _serviceBrand: undefined; private _widgets = new Map(); @@ -80,7 +80,7 @@ const defaultOptions: IPeekViewOptions = { export abstract class PeekViewWidget extends ZoneWidget { - public _serviceBrand: any; + public _serviceBrand: undefined; private _onDidClose = new Emitter(); diff --git a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts index 67c49b7cdc1..cc6b12bca84 100644 --- a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts @@ -311,8 +311,9 @@ export class ReferenceWidget extends PeekViewWidget { keyboardNavigationLabelProvider: this._instantiationService.createInstance(StringRepresentationProvider), identityProvider: new IdentityProvider() }; - this._tree = this._instantiationService.createInstance, ITreeRenderer[], IAsyncDataSource, IAsyncDataTreeOptions, WorkbenchAsyncDataTree>( + this._tree = this._instantiationService.createInstance, ITreeRenderer[], IAsyncDataSource, IAsyncDataTreeOptions, WorkbenchAsyncDataTree>( WorkbenchAsyncDataTree, + 'ReferencesWidget', this._treeContainer, new Delegate(), [ diff --git a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts index 4263a1b4ac9..b918921b059 100644 --- a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts +++ b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts @@ -22,7 +22,7 @@ import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSe class TestTextResourcePropertiesService implements ITextResourcePropertiesService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IConfigurationService private readonly configurationService: IConfigurationService, @@ -96,21 +96,21 @@ suite('SmartSelect', () => { '\t}', '}' ], 3, 20, [ - new Range(1, 1, 5, 2), // all - new Range(1, 21, 5, 2), // {} outside - new Range(1, 22, 5, 1), // {} inside - new Range(2, 1, 4, 3), // block - new Range(2, 1, 4, 3), - new Range(2, 2, 4, 3), - new Range(2, 11, 4, 3), - new Range(2, 12, 4, 2), - new Range(3, 1, 3, 27), // line w/ triva - new Range(3, 3, 3, 27), // line w/o triva - new Range(3, 10, 3, 27), // () outside - new Range(3, 11, 3, 26), // () inside - new Range(3, 17, 3, 26), // () outside - new Range(3, 18, 3, 25), // () inside - ]); + new Range(1, 1, 5, 2), // all + new Range(1, 21, 5, 2), // {} outside + new Range(1, 22, 5, 1), // {} inside + new Range(2, 1, 4, 3), // block + new Range(2, 1, 4, 3), + new Range(2, 2, 4, 3), + new Range(2, 11, 4, 3), + new Range(2, 12, 4, 2), + new Range(3, 1, 3, 27), // line w/ triva + new Range(3, 3, 3, 27), // line w/o triva + new Range(3, 10, 3, 27), // () outside + new Range(3, 11, 3, 26), // () inside + new Range(3, 17, 3, 26), // () outside + new Range(3, 18, 3, 25), // () inside + ]); }); test('getRangesToPosition #56886. Skip empty lines correctly.', () => { @@ -122,15 +122,15 @@ suite('SmartSelect', () => { '\t}', '}' ], 3, 1, [ - new Range(1, 1, 5, 2), - new Range(1, 21, 5, 2), - new Range(1, 22, 5, 1), - new Range(2, 1, 4, 3), - new Range(2, 1, 4, 3), - new Range(2, 2, 4, 3), - new Range(2, 11, 4, 3), - new Range(2, 12, 4, 2), - ]); + new Range(1, 1, 5, 2), + new Range(1, 21, 5, 2), + new Range(1, 22, 5, 1), + new Range(2, 1, 4, 3), + new Range(2, 1, 4, 3), + new Range(2, 2, 4, 3), + new Range(2, 11, 4, 3), + new Range(2, 12, 4, 2), + ]); }); test('getRangesToPosition #56886. Do not skip lines with only whitespaces.', () => { @@ -142,17 +142,17 @@ suite('SmartSelect', () => { '\t}', '}' ], 3, 1, [ - new Range(1, 1, 5, 2), // all - new Range(1, 21, 5, 2), // {} outside - new Range(1, 22, 5, 1), // {} inside - new Range(2, 1, 4, 3), - new Range(2, 1, 4, 3), - new Range(2, 2, 4, 3), - new Range(2, 11, 4, 3), - new Range(2, 12, 4, 2), - new Range(3, 1, 3, 2), // block - new Range(3, 1, 3, 2) // empty line - ]); + new Range(1, 1, 5, 2), // all + new Range(1, 21, 5, 2), // {} outside + new Range(1, 22, 5, 1), // {} inside + new Range(2, 1, 4, 3), + new Range(2, 1, 4, 3), + new Range(2, 2, 4, 3), + new Range(2, 11, 4, 3), + new Range(2, 12, 4, 2), + new Range(3, 1, 3, 2), // block + new Range(3, 1, 3, 2) // empty line + ]); }); test('getRangesToPosition #40658. Cursor at first position inside brackets should select line inside.', () => { @@ -162,11 +162,11 @@ suite('SmartSelect', () => { ' { } ', '( ) ' ], 2, 3, [ - new Range(1, 1, 3, 5), - new Range(2, 1, 2, 6), // line w/ triava - new Range(2, 2, 2, 5), // {} inside, line w/o triva - new Range(2, 3, 2, 4) // {} inside - ]); + new Range(1, 1, 3, 5), + new Range(2, 1, 2, 6), // line w/ triava + new Range(2, 2, 2, 5), // {} inside, line w/o triva + new Range(2, 3, 2, 4) // {} inside + ]); }); test('getRangesToPosition #40658. Cursor in empty brackets should reveal brackets first.', () => { @@ -176,11 +176,11 @@ suite('SmartSelect', () => { ' { } ', ' ( ) ' ], 1, 3, [ - new Range(1, 1, 3, 7), // all - new Range(1, 1, 1, 5), // line w/ trival - new Range(1, 2, 1, 4), // [] outside, line w/o trival - new Range(1, 3, 1, 3), // [] inside - ]); + new Range(1, 1, 3, 7), // all + new Range(1, 1, 1, 5), // line w/ trival + new Range(1, 2, 1, 4), // [] outside, line w/o trival + new Range(1, 3, 1, 3), // [] inside + ]); }); test('getRangesToPosition #40658. Tokens before bracket will be revealed first.', () => { @@ -190,11 +190,11 @@ suite('SmartSelect', () => { ' { } ', 'selectthis( ) ' ], 3, 11, [ - new Range(1, 1, 3, 15), // all - new Range(3, 1, 3, 15), // line w/ trivia - new Range(3, 1, 3, 14), // line w/o trivia - new Range(3, 1, 3, 11) // word - ]); + new Range(1, 1, 3, 15), // all + new Range(3, 1, 3, 15), // line w/ trivia + new Range(3, 1, 3, 14), // line w/o trivia + new Range(3, 1, 3, 11) // word + ]); }); // -- bracket selections diff --git a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts index b4412f1d130..b7d5c40b8bf 100644 --- a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts @@ -299,7 +299,7 @@ suite('Snippet Variables Resolver', function () { let workspace: IWorkspace; let resolver: VariableResolver; const workspaceService = new class implements IWorkspaceContextService { - _serviceBrand: any; + _serviceBrand: undefined; _throw = () => { throw new Error(); }; onDidChangeWorkbenchState = this._throw; onDidChangeWorkspaceName = this._throw; diff --git a/src/vs/editor/contrib/suggest/media/suggest.css b/src/vs/editor/contrib/suggest/media/suggest.css index 12cb09f4acd..a0115bd5528 100644 --- a/src/vs/editor/contrib/suggest/media/suggest.css +++ b/src/vs/editor/contrib/suggest/media/suggest.css @@ -45,6 +45,11 @@ float: right; } +/* Details Layout */ +.monaco-editor .suggest-widget > .details ul { + padding-left: 20px; +} + /* Styles for Message element for when widget is loading or is empty */ .monaco-editor .suggest-widget > .message { @@ -158,6 +163,7 @@ .monaco-editor .suggest-widget .monaco-list .monaco-list-row .monaco-icon-label.deprecated { opacity: 0.66; + text-decoration: unset; } .monaco-editor .suggest-widget .monaco-list .monaco-list-row .monaco-icon-label.deprecated > .monaco-icon-label-description-container { text-decoration: line-through; diff --git a/src/vs/editor/contrib/suggest/suggest.ts b/src/vs/editor/contrib/suggest/suggest.ts index d63e47c8811..d905bdb1a01 100644 --- a/src/vs/editor/contrib/suggest/suggest.ts +++ b/src/vs/editor/contrib/suggest/suggest.ts @@ -278,7 +278,7 @@ registerDefaultLanguageCommand('_executeCompletionItemProvider', async (model, p await Promise.all(resolving); return result; } finally { - setTimeout(() => disposables.dispose(), 0); + setTimeout(() => disposables.dispose(), 100); } }); diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index 7fd1f0f8497..a86c5148d2c 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -7,7 +7,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { isNonEmptyArray } from 'vs/base/common/arrays'; import { onUnexpectedError } from 'vs/base/common/errors'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { dispose, IDisposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; +import { dispose, IDisposable, DisposableStore, toDisposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction, EditorCommand, registerEditorAction, registerEditorCommand, registerEditorContribution, ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { EditOperation } from 'vs/editor/common/core/editOperation'; @@ -33,9 +33,53 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerServ import { IdleValue } from 'vs/base/common/async'; import { isObject } from 'vs/base/common/types'; import { CommitCharacterController } from './suggestCommitCharacters'; +import { IPosition } from 'vs/editor/common/core/position'; +import { TrackedRangeStickiness, ITextModel } from 'vs/editor/common/model'; const _sticky = false; // for development purposes only +class LineSuffix { + + private readonly _marker: string[] | undefined; + + constructor(private readonly _model: ITextModel, private readonly _position: IPosition) { + // spy on what's happening right of the cursor. two cases: + // 1. end of line -> check that it's still end of line + // 2. mid of line -> add a marker and compute the delta + const maxColumn = _model.getLineMaxColumn(_position.lineNumber); + if (maxColumn !== _position.column) { + const offset = _model.getOffsetAt(_position); + const end = _model.getPositionAt(offset + 1); + this._marker = _model.deltaDecorations([], [{ + range: Range.fromPositions(_position, end), + options: { stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } + }]); + } + } + + dispose(): void { + if (this._marker && !this._model.isDisposed()) { + this._model.deltaDecorations(this._marker, []); + } + } + + delta(position: IPosition): number { + if (this._model.isDisposed() || this._position.lineNumber !== position.lineNumber) { + // bail out early if things seems fishy + return 0; + } + // read the marker (in case suggest was triggered at line end) or compare + // the cursor to the line end. + if (this._marker) { + const range = this._model.getDecorationRange(this._marker[0]); + const end = this._model.getOffsetAt(range!.getStartPosition()); + return end - this._model.getOffsetAt(position); + } else { + return this._model.getLineMaxColumn(position.lineNumber) - position.column; + } + } +} + export class SuggestController implements IEditorContribution { private static readonly ID: string = 'editor.contrib.suggestController'; @@ -47,9 +91,9 @@ export class SuggestController implements IEditorContribution { private readonly _model: SuggestModel; private readonly _widget: IdleValue; private readonly _alternatives: IdleValue; + private readonly _lineSuffix = new MutableDisposable(); private readonly _toDispose = new DisposableStore(); - constructor( private _editor: ICodeEditor, @IEditorWorkerService editorWorker: IEditorWorkerService, @@ -115,6 +159,7 @@ export class SuggestController implements IEditorContribution { this._toDispose.add(this._model.onDidTrigger(e => { this._widget.getValue().showTriggered(e.auto, e.shy ? 250 : 50); + this._lineSuffix.value = new LineSuffix(this._editor.getModel()!, e.position); })); this._toDispose.add(this._model.onDidSuggest(e => { if (!e.shy) { @@ -123,7 +168,7 @@ export class SuggestController implements IEditorContribution { } })); this._toDispose.add(this._model.onDidCancel(e => { - if (this._widget && !e.retrigger) { + if (!e.retrigger) { this._widget.getValue().hideWidget(); } })); @@ -154,6 +199,7 @@ export class SuggestController implements IEditorContribution { this._toDispose.dispose(); this._widget.dispose(); this._model.dispose(); + this._lineSuffix.dispose(); } protected _insertSuggestion(event: ISelectedSuggestion | undefined, keepAlternativeSuggestions: boolean, undoStops: boolean): void { @@ -193,10 +239,11 @@ export class SuggestController implements IEditorContribution { const overwriteBefore = position.column - suggestion.range.startColumn; const overwriteAfter = suggestion.range.endColumn - position.column; + const suffixDelta = this._lineSuffix.value ? this._lineSuffix.value.delta(this._editor.getPosition()) : 0; SnippetController2.get(this._editor).insert(insertText, { overwriteBefore: overwriteBefore + columnDelta, - overwriteAfter, + overwriteAfter: overwriteAfter + suffixDelta, undoStopBefore: false, undoStopAfter: false, adjustWhitespace: !(suggestion.insertTextRules! & CompletionItemInsertTextRule.KeepWhitespace) diff --git a/src/vs/editor/contrib/suggest/suggestMemory.ts b/src/vs/editor/contrib/suggest/suggestMemory.ts index d08685206be..20f3b4b352d 100644 --- a/src/vs/editor/contrib/suggest/suggestMemory.ts +++ b/src/vs/editor/contrib/suggest/suggestMemory.ts @@ -208,7 +208,7 @@ export type MemMode = 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'; export class SuggestMemoryService extends Disposable implements ISuggestMemoryService { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _storagePrefix = 'suggest/memories'; @@ -292,7 +292,7 @@ export class SuggestMemoryService extends Disposable implements ISuggestMemorySe export const ISuggestMemoryService = createDecorator('ISuggestMemories'); export interface ISuggestMemoryService { - _serviceBrand: any; + _serviceBrand: undefined; memorize(model: ITextModel, pos: IPosition, item: CompletionItem): void; select(model: ITextModel, pos: IPosition, items: CompletionItem[]): number; } diff --git a/src/vs/editor/contrib/suggest/suggestModel.ts b/src/vs/editor/contrib/suggest/suggestModel.ts index cabf449d896..d34f911cea8 100644 --- a/src/vs/editor/contrib/suggest/suggestModel.ts +++ b/src/vs/editor/contrib/suggest/suggestModel.ts @@ -10,7 +10,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IDisposable, dispose, DisposableStore, isDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CursorChangeReason, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; -import { Position } from 'vs/editor/common/core/position'; +import { Position, IPosition } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; import { ITextModel, IWordAtPosition } from 'vs/editor/common/model'; import { CompletionItemProvider, StandardTokenType, CompletionContext, CompletionProviderRegistry, CompletionTriggerKind, CompletionItemKind, completionKindFromString } from 'vs/editor/common/modes'; @@ -28,6 +28,7 @@ export interface ICancelEvent { export interface ITriggerEvent { readonly auto: boolean; readonly shy: boolean; + readonly position: IPosition; } export interface ISuggestEvent { @@ -365,7 +366,7 @@ export class SuggestModel implements IDisposable { // Cancel previous requests, change state & update UI this.cancel(retrigger); this._state = auto ? State.Auto : State.Manual; - this._onDidTrigger.fire({ auto, shy: context.shy }); + this._onDidTrigger.fire({ auto, shy: context.shy, position: this._editor.getPosition() }); // Capture context when request was sent this._context = ctx; diff --git a/src/vs/editor/contrib/suggest/suggestWidget.ts b/src/vs/editor/contrib/suggest/suggestWidget.ts index cdad5fdb234..4bb095d5d41 100644 --- a/src/vs/editor/contrib/suggest/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/suggestWidget.ts @@ -30,7 +30,7 @@ import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { TimeoutTimer, CancelablePromise, createCancelablePromise, disposableTimeout } from 'vs/base/common/async'; -import { CompletionItemKind, completionKindToCssClass, CompletionItemKindModifier } from 'vs/editor/common/modes'; +import { CompletionItemKind, completionKindToCssClass, CompletionItemTag } from 'vs/editor/common/modes'; import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { getIconClasses } from 'vs/editor/common/services/getIconClasses'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -193,7 +193,7 @@ class Renderer implements IListRenderer ]; } - if (suggestion.kindModifier && suggestion.kindModifier.has(CompletionItemKindModifier.Deprecated)) { + if (suggestion.tags && suggestion.tags.indexOf(CompletionItemTag.Deprecated) >= 0) { labelOptions.extraClasses = (labelOptions.extraClasses || []).concat(['deprecated']); labelOptions.matches = []; } @@ -505,7 +505,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate false }, mouseSupport: false diff --git a/src/vs/editor/contrib/suggest/test/completionModel.test.ts b/src/vs/editor/contrib/suggest/test/completionModel.test.ts index 6066e808b28..6ae7849b821 100644 --- a/src/vs/editor/contrib/suggest/test/completionModel.test.ts +++ b/src/vs/editor/contrib/suggest/test/completionModel.test.ts @@ -42,9 +42,9 @@ suite('CompletionModel', function () { createSuggestItem('Foo', 3), createSuggestItem('foo', 2), ], 1, { - leadingLineContent: 'foo', - characterCountDelta: 0 - }, WordDistance.None); + leadingLineContent: 'foo', + characterCountDelta: 0 + }, WordDistance.None); }); test('filtering - cached', function () { @@ -73,9 +73,9 @@ suite('CompletionModel', function () { createSuggestItem('foo', 3, undefined, true), createSuggestItem('foo', 2), ], 1, { - leadingLineContent: 'foo', - characterCountDelta: 0 - }, WordDistance.None); + leadingLineContent: 'foo', + characterCountDelta: 0 + }, WordDistance.None); assert.equal(incompleteModel.incomplete.size, 1); }); @@ -135,9 +135,9 @@ suite('CompletionModel', function () { createSuggestItem(' { @@ -26,6 +26,10 @@ suite('WordOperations', () => { const _cursorWordStartRightSelect = new CursorWordStartRightSelect(); const _cursorWordEndRightSelect = new CursorWordEndRightSelect(); const _cursorWordRightSelect = new CursorWordRightSelect(); + const _cursorWordAccessibilityLeft = new CursorWordAccessibilityLeft(); + const _cursorWordAccessibilityLeftSelect = new CursorWordAccessibilityLeftSelect(); + const _cursorWordAccessibilityRight = new CursorWordAccessibilityRight(); + const _cursorWordAccessibilityRightSelect = new CursorWordAccessibilityRightSelect(); const _deleteWordLeft = new DeleteWordLeft(); const _deleteWordStartLeft = new DeleteWordStartLeft(); const _deleteWordEndLeft = new DeleteWordEndLeft(); @@ -39,6 +43,12 @@ suite('WordOperations', () => { function cursorWordLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { runEditorCommand(editor, inSelectionMode ? _cursorWordLeftSelect : _cursorWordLeft); } + function cursorWordAccessibilityLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { + runEditorCommand(editor, inSelectionMode ? _cursorWordAccessibilityLeft : _cursorWordAccessibilityLeftSelect); + } + function cursorWordAccessibilityRight(editor: ICodeEditor, inSelectionMode: boolean = false): void { + runEditorCommand(editor, inSelectionMode ? _cursorWordAccessibilityRightSelect : _cursorWordAccessibilityRight); + } function cursorWordStartLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { runEditorCommand(editor, inSelectionMode ? _cursorWordStartLeftSelect : _cursorWordStartLeft); } @@ -326,6 +336,34 @@ suite('WordOperations', () => { assert.deepEqual(actual, EXPECTED); }); + test('cursorWordAccessibilityLeft', () => { + const EXPECTED = ['| /* |Just |some |more |text |a+= |3 +|5-|3 + |7 */ '].join('\n'); + const [text,] = deserializePipePositions(EXPECTED); + const actualStops = testRepeatedActionAndExtractPositions( + text, + new Position(1000, 1000), + ed => cursorWordAccessibilityLeft(ed), + ed => ed.getPosition()!, + ed => ed.getPosition()!.equals(new Position(1, 1)) + ); + const actual = serializePipePositions(text, actualStops); + assert.deepEqual(actual, EXPECTED); + }); + + test('cursorWordAccessibilityRight', () => { + const EXPECTED = [' /* Just| some| more| text| a|+= 3| +5|-3| + 7| */ |'].join('\n'); + const [text,] = deserializePipePositions(EXPECTED); + const actualStops = testRepeatedActionAndExtractPositions( + text, + new Position(1, 1), + ed => cursorWordAccessibilityRight(ed), + ed => ed.getPosition()!, + ed => ed.getPosition()!.equals(new Position(1, 50)) + ); + const actual = serializePipePositions(text, actualStops); + assert.deepEqual(actual, EXPECTED); + }); + test('deleteWordLeft for non-empty selection', () => { withTestCodeEditor([ ' \tMy First Line\t ', diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts index dc4e111f962..a0e5e226cdd 100644 --- a/src/vs/editor/contrib/wordOperations/wordOperations.ts +++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts @@ -18,6 +18,9 @@ import { ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ITextModel } from 'vs/editor/common/model'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; +import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { EDITOR_DEFAULTS } from 'vs/editor/common/config/editorOptions'; export interface MoveWordOptions extends ICommandOptions { inSelectionMode: boolean; @@ -170,6 +173,48 @@ export class CursorWordLeftSelect extends WordLeftCommand { } } +export class CursorWordAccessibilityLeft extends WordLeftCommand { + constructor() { + super({ + inSelectionMode: false, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityLeft', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyCode.LeftArrow, + mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + +export class CursorWordAccessibilityLeftSelect extends WordLeftCommand { + constructor() { + super({ + inSelectionMode: true, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityLeftSelect', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow, + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + export class CursorWordStartRight extends WordRightCommand { constructor() { super({ @@ -248,6 +293,48 @@ export class CursorWordRightSelect extends WordRightCommand { } } +export class CursorWordAccessibilityRight extends WordRightCommand { + constructor() { + super({ + inSelectionMode: false, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityRight', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyCode.RightArrow, + mac: { primary: KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + +export class CursorWordAccessibilityRightSelect extends WordRightCommand { + constructor() { + super({ + inSelectionMode: true, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityRightSelect', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow, + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + export interface DeleteWordOptions extends ICommandOptions { whitespaceHeuristics: boolean; wordNavigationType: WordNavigationType; @@ -397,6 +484,10 @@ registerEditorCommand(new CursorWordRight()); registerEditorCommand(new CursorWordStartRightSelect()); registerEditorCommand(new CursorWordEndRightSelect()); registerEditorCommand(new CursorWordRightSelect()); +registerEditorCommand(new CursorWordAccessibilityLeft()); +registerEditorCommand(new CursorWordAccessibilityLeftSelect()); +registerEditorCommand(new CursorWordAccessibilityRight()); +registerEditorCommand(new CursorWordAccessibilityRightSelect()); registerEditorCommand(new DeleteWordStartLeft()); registerEditorCommand(new DeleteWordEndLeft()); registerEditorCommand(new DeleteWordLeft()); diff --git a/src/vs/editor/editor.worker.ts b/src/vs/editor/editor.worker.ts index 4586cafab31..3d42a6b4d95 100644 --- a/src/vs/editor/editor.worker.ts +++ b/src/vs/editor/editor.worker.ts @@ -19,12 +19,12 @@ export function initialize(foreignModule: any) { (self).postMessage(msg); }, (host: EditorWorkerHost) => new EditorSimpleWorker(host, foreignModule)); - self.onmessage = (e) => { + self.onmessage = (e: MessageEvent) => { simpleWorker.onmessage(e.data); }; } -self.onmessage = (e) => { +self.onmessage = (e: MessageEvent) => { // Ignore first message in this case and initialize if not yet initialized if (!initialized) { initialize(null); diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOpenEditorWidget.ts b/src/vs/editor/standalone/browser/quickOpen/quickOpenEditorWidget.ts index d97591fd2ec..e2c2323b450 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickOpenEditorWidget.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickOpenEditorWidget.ts @@ -45,10 +45,10 @@ export class QuickOpenEditorWidget implements IOverlayWidget { onCancel: onCancel, onType: onType }, { - inputPlaceHolder: undefined, - inputAriaLabel: configuration.inputAriaLabel, - keyboardSupport: true - } + inputPlaceHolder: undefined, + inputAriaLabel: configuration.inputAriaLabel, + keyboardSupport: true + } ); this.styler = attachQuickOpenStyler(this.quickOpenWidget, this.themeService, { pickerGroupForeground: foreground diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index 54804eb3c0f..24106003124 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -45,6 +45,7 @@ import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platf import { ILayoutService, IDimension } from 'vs/platform/layout/browser/layoutService'; import { SimpleServicesNLS } from 'vs/editor/common/standaloneStrings'; import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings'; +import { basename } from 'vs/base/common/resources'; export class SimpleModel implements IResolvedTextEditorModel { @@ -96,7 +97,7 @@ function withTypedEditor(widget: editorCommon.IEditor, codeEditorCallback: (e } export class SimpleEditorModelResolverService implements ITextModelService { - public _serviceBrand: any; + public _serviceBrand: undefined; private editor?: editorCommon.IEditor; @@ -141,7 +142,7 @@ export class SimpleEditorModelResolverService implements ITextModelService { } export class SimpleEditorProgressService implements IEditorProgressService { - _serviceBrand: any; + _serviceBrand: undefined; private static NULL_PROGRESS_RUNNER: IProgressRunner = { done: () => { }, @@ -162,7 +163,7 @@ export class SimpleEditorProgressService implements IEditorProgressService { export class SimpleDialogService implements IDialogService { - public _serviceBrand: any; + public _serviceBrand: undefined; public confirm(confirmation: IConfirmation): Promise { return this.doConfirm(confirmation).then(confirmed => { @@ -189,7 +190,7 @@ export class SimpleDialogService implements IDialogService { export class SimpleNotificationService implements INotificationService { - public _serviceBrand: any; + public _serviceBrand: undefined; private static readonly NO_OP: INotificationHandle = new NoOpNotification(); @@ -231,7 +232,7 @@ export class SimpleNotificationService implements INotificationService { } export class StandaloneCommandService implements ICommandService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _instantiationService: IInstantiationService; private readonly _dynamicCommands: { [id: string]: ICommand; }; @@ -413,7 +414,7 @@ function isConfigurationOverrides(thing: any): thing is IConfigurationOverrides export class SimpleConfigurationService implements IConfigurationService { - _serviceBrand: any; + _serviceBrand: undefined; private _onDidChangeConfiguration = new Emitter(); public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; @@ -478,7 +479,7 @@ export class SimpleConfigurationService implements IConfigurationService { export class SimpleResourceConfigurationService implements ITextResourceConfigurationService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidChangeConfiguration = new Emitter(); public readonly onDidChangeConfiguration = this._onDidChangeConfiguration.event; @@ -503,7 +504,7 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur export class SimpleResourcePropertiesService implements ITextResourcePropertiesService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IConfigurationService private readonly configurationService: IConfigurationService, @@ -522,7 +523,7 @@ export class SimpleResourcePropertiesService implements ITextResourcePropertiesS } export class StandaloneTelemetryService implements ITelemetryService { - _serviceBrand: void = undefined; + _serviceBrand: undefined; public isOptedIn = false; @@ -544,7 +545,7 @@ export class StandaloneTelemetryService implements ITelemetryService { export class SimpleWorkspaceContextService implements IWorkspaceContextService { - public _serviceBrand: any; + public _serviceBrand: undefined; private static SCHEME = 'inmemory'; @@ -613,7 +614,7 @@ export function applyConfigurationValues(configurationService: IConfigurationSer } export class SimpleBulkEditService implements IBulkEditService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private readonly _modelService: IModelService) { // @@ -656,7 +657,8 @@ export class SimpleBulkEditService implements IBulkEditService { } export class SimpleUriLabelService implements ILabelService { - _serviceBrand: any; + + _serviceBrand: undefined; private readonly _onDidRegisterFormatter = new Emitter(); public readonly onDidChangeFormatters: Event = this._onDidRegisterFormatter.event; @@ -668,6 +670,10 @@ export class SimpleUriLabelService implements ILabelService { return resource.path; } + getUriBasenameLabel(resource: URI): string { + return basename(resource); + } + public getWorkspaceLabel(workspace: IWorkspaceIdentifier | URI | IWorkspace, options?: { verbose: boolean; }): string { return ''; } @@ -686,7 +692,7 @@ export class SimpleUriLabelService implements ILabelService { } export class SimpleLayoutService implements ILayoutService { - _serviceBrand: any; + _serviceBrand: undefined; public onLayout = Event.None; diff --git a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts index 31a3f56b704..d64e0e6e2af 100644 --- a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts @@ -21,7 +21,7 @@ import { IMenuItem, MenuId, MenuRegistry } from 'vs/platform/actions/common/acti import { CommandsRegistry, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; +import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; @@ -29,6 +29,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { StandaloneCodeEditorNLS } from 'vs/editor/common/standaloneStrings'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; /** * Description of an action contribution @@ -373,7 +374,9 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon @ICodeEditorService codeEditorService: ICodeEditorService, @IStandaloneThemeService themeService: IStandaloneThemeService, @INotificationService notificationService: INotificationService, - @IConfigurationService configurationService: IConfigurationService + @IConfigurationService configurationService: IConfigurationService, + @IContextMenuService contextMenuService: IContextMenuService, + @IClipboardService clipboardService: IClipboardService ) { applyConfigurationValues(configurationService, options, true); options = options || {}; @@ -381,7 +384,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon options.theme = themeService.setTheme(options.theme); } - super(domElement, options, editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService); + super(domElement, options, editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, clipboardService); this._contextViewService = contextViewService; this._configurationService = configurationService; diff --git a/src/vs/editor/standalone/browser/standaloneEditor.ts b/src/vs/editor/standalone/browser/standaloneEditor.ts index 8750db8f943..280e00cbdf7 100644 --- a/src/vs/editor/standalone/browser/standaloneEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneEditor.ts @@ -30,7 +30,7 @@ import { IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standal import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; +import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers'; @@ -38,6 +38,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { clearAllFontInfos } from 'vs/editor/browser/config/configuration'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; type Omit = Pick>; @@ -119,6 +120,8 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC services.get(IStandaloneThemeService), services.get(INotificationService), services.get(IConfigurationService), + services.get(IContextMenuService), + services.get(IClipboardService) ); }); } diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index 30209af005c..1818394dfdc 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -562,9 +562,10 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages { // enums DocumentHighlightKind: standaloneEnums.DocumentHighlightKind, CompletionItemKind: standaloneEnums.CompletionItemKind, - CompletionItemKindModifier: standaloneEnums.CompletionItemKindModifier, + CompletionItemTag: standaloneEnums.CompletionItemTag, CompletionItemInsertTextRule: standaloneEnums.CompletionItemInsertTextRule, SymbolKind: standaloneEnums.SymbolKind, + SymbolTag: standaloneEnums.SymbolTag, IndentAction: standaloneEnums.IndentAction, CompletionTriggerKind: standaloneEnums.CompletionTriggerKind, SignatureHelpTriggerKind: standaloneEnums.SignatureHelpTriggerKind, diff --git a/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts b/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts index 2a47cc6113b..613ec87b2de 100644 --- a/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts +++ b/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts @@ -156,7 +156,7 @@ function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme { export class StandaloneThemeServiceImpl implements IStandaloneThemeService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _knownThemes: Map; private readonly _styleElement: HTMLStyleElement; diff --git a/src/vs/editor/standalone/common/standaloneThemeService.ts b/src/vs/editor/standalone/common/standaloneThemeService.ts index cfbd291da9e..0fca97422c1 100644 --- a/src/vs/editor/standalone/common/standaloneThemeService.ts +++ b/src/vs/editor/standalone/common/standaloneThemeService.ts @@ -26,7 +26,7 @@ export interface IStandaloneTheme extends ITheme { } export interface IStandaloneThemeService extends IThemeService { - _serviceBrand: any; + _serviceBrand: undefined; setTheme(themeName: string): string; diff --git a/src/vs/editor/standalone/test/browser/standaloneLanguages.test.ts b/src/vs/editor/standalone/test/browser/standaloneLanguages.test.ts index 395c611acf2..b35c23cc03a 100644 --- a/src/vs/editor/standalone/test/browser/standaloneLanguages.test.ts +++ b/src/vs/editor/standalone/test/browser/standaloneLanguages.test.ts @@ -33,7 +33,7 @@ suite('TokenizationSupport2Adapter', () => { } class MockThemeService implements IStandaloneThemeService { - _serviceBrand = null; + _serviceBrand: undefined; public setTheme(themeName: string): string { throw new Error('Not implemented'); } @@ -184,4 +184,4 @@ suite('TokenizationSupport2Adapter', () => { ); }); -}); \ No newline at end of file +}); diff --git a/src/vs/editor/test/browser/commands/trimTrailingWhitespaceCommand.test.ts b/src/vs/editor/test/browser/commands/trimTrailingWhitespaceCommand.test.ts index d2282e46f14..bf414fa1503 100644 --- a/src/vs/editor/test/browser/commands/trimTrailingWhitespaceCommand.test.ts +++ b/src/vs/editor/test/browser/commands/trimTrailingWhitespaceCommand.test.ts @@ -63,11 +63,11 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => { 'even more text ', 'and some mixed\t \t' ], [ - createSingleEditOp(null, 1, 10, 1, 11), - createSingleEditOp(null, 3, 1, 3, 4), - createSingleEditOp(null, 4, 15, 4, 17), - createSingleEditOp(null, 5, 15, 5, 20) - ]); + createSingleEditOp(null, 1, 10, 1, 11), + createSingleEditOp(null, 3, 1, 3, 4), + createSingleEditOp(null, 4, 15, 4, 17), + createSingleEditOp(null, 5, 15, 5, 20) + ]); assertTrimTrailingWhitespace(['text '], [new Position(1, 1), new Position(1, 2), new Position(1, 3)], [createInsertDeleteSingleEditOp(null, 1, 5, 1, 8)]); @@ -80,11 +80,11 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => { 'even more text ', 'and some mixed\t \t' ], [], [ - createInsertDeleteSingleEditOp(null, 1, 10, 1, 11), - createInsertDeleteSingleEditOp(null, 3, 1, 3, 4), - createInsertDeleteSingleEditOp(null, 4, 15, 4, 17), - createInsertDeleteSingleEditOp(null, 5, 15, 5, 20) - ]); + createInsertDeleteSingleEditOp(null, 1, 10, 1, 11), + createInsertDeleteSingleEditOp(null, 3, 1, 3, 4), + createInsertDeleteSingleEditOp(null, 4, 15, 4, 17), + createInsertDeleteSingleEditOp(null, 5, 15, 5, 20) + ]); assertTrimTrailingWhitespace([ 'some text\t', 'some more text', @@ -92,10 +92,10 @@ suite('Editor Commands - Trim Trailing Whitespace Command', () => { 'even more text ', 'and some mixed\t \t' ], [new Position(1, 11), new Position(3, 2), new Position(5, 1), new Position(4, 1), new Position(5, 10)], [ - createInsertDeleteSingleEditOp(null, 3, 2, 3, 4), - createInsertDeleteSingleEditOp(null, 4, 15, 4, 17), - createInsertDeleteSingleEditOp(null, 5, 15, 5, 20) - ]); + createInsertDeleteSingleEditOp(null, 3, 2, 3, 4), + createInsertDeleteSingleEditOp(null, 4, 15, 4, 17), + createInsertDeleteSingleEditOp(null, 5, 15, 5, 20) + ]); }); }); diff --git a/src/vs/editor/test/browser/controller/cursor.test.ts b/src/vs/editor/test/browser/controller/cursor.test.ts index 59e221a8c2f..eff8a24373f 100644 --- a/src/vs/editor/test/browser/controller/cursor.test.ts +++ b/src/vs/editor/test/browser/controller/cursor.test.ts @@ -4740,6 +4740,37 @@ suite('autoClosingPairs', () => { mode.dispose(); }); + test('issue #78833 - Add config to use old brackets/quotes overtyping', () => { + let mode = new AutoClosingMode(); + usingCursor({ + text: [ + '', + 'y=();' + ], + languageIdentifier: mode.getLanguageIdentifier(), + editorOpts: { + autoClosingOvertype: 'always' + } + }, (model, cursor) => { + assertCursor(cursor, new Position(1, 1)); + + cursorCommand(cursor, H.Type, { text: 'x=(' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursor.setSelections('test', [new Selection(1, 4, 1, 4)]); + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursor.setSelections('test', [new Selection(2, 4, 2, 4)]); + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(2), 'y=();'); + }); + mode.dispose(); + }); + test('issue #15825: accents on mac US intl keyboard', () => { let mode = new AutoClosingMode(); usingCursor({ diff --git a/src/vs/editor/test/browser/controller/cursorMoveCommand.test.ts b/src/vs/editor/test/browser/controller/cursorMoveCommand.test.ts index 92aedce2452..a58db2d6c3f 100644 --- a/src/vs/editor/test/browser/controller/cursorMoveCommand.test.ts +++ b/src/vs/editor/test/browser/controller/cursorMoveCommand.test.ts @@ -483,11 +483,11 @@ function selectionEqual(selection: Selection, posLineNumber: number, posColumn: positionLineNumber: selection.positionLineNumber, positionColumn: selection.positionColumn }, { - selectionStartLineNumber: selLineNumber, - selectionStartColumn: selColumn, - positionLineNumber: posLineNumber, - positionColumn: posColumn - }, 'selection equal'); + selectionStartLineNumber: selLineNumber, + selectionStartColumn: selColumn, + positionLineNumber: posLineNumber, + positionColumn: posColumn + }, 'selection equal'); } function moveTo(cursor: Cursor, lineNumber: number, column: number, inSelectionMode: boolean = false) { diff --git a/src/vs/editor/test/browser/editorTestServices.ts b/src/vs/editor/test/browser/editorTestServices.ts index f896360acf4..f70b534d96e 100644 --- a/src/vs/editor/test/browser/editorTestServices.ts +++ b/src/vs/editor/test/browser/editorTestServices.ts @@ -25,7 +25,7 @@ export class TestCodeEditorService extends AbstractCodeEditorService { } export class TestCommandService implements ICommandService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _instantiationService: IInstantiationService; diff --git a/src/vs/editor/test/browser/services/openerService.test.ts b/src/vs/editor/test/browser/services/openerService.test.ts index 6824acf4d84..6c50fcb5294 100644 --- a/src/vs/editor/test/browser/services/openerService.test.ts +++ b/src/vs/editor/test/browser/services/openerService.test.ts @@ -14,7 +14,7 @@ suite('OpenerService', function () { let lastCommand: { id: string; args: any[] } | undefined; const commandService = new (class implements ICommandService { - _serviceBrand: any; + _serviceBrand: undefined; onWillExecuteCommand = () => ({ dispose: () => { } }); onDidExecuteCommand = () => ({ dispose: () => { } }); executeCommand(id: string, ...args: any[]): Promise { diff --git a/src/vs/editor/test/common/model/linesTextBuffer/linesTextBuffer.test.ts b/src/vs/editor/test/common/model/linesTextBuffer/linesTextBuffer.test.ts index c69b3b95dcb..5e18c394433 100644 --- a/src/vs/editor/test/common/model/linesTextBuffer/linesTextBuffer.test.ts +++ b/src/vs/editor/test/common/model/linesTextBuffer/linesTextBuffer.test.ts @@ -306,10 +306,10 @@ suite('PieceTreeTextBuffer._toSingleEditOperation', () => { '', '1' ], [ - editOp(1, 1, 1, 3, 0, 2, ['Your']), - editOp(1, 4, 1, 4, 3, 0, ['Interesting ']), - editOp(2, 3, 2, 6, 16, 3, null) - ], + editOp(1, 1, 1, 3, 0, 2, ['Your']), + editOp(1, 4, 1, 4, 3, 0, ['Interesting ']), + editOp(2, 3, 2, 6, 16, 3, null) + ], editOp(1, 1, 2, 6, 0, 19, [ 'Your Interesting First Line', '\t\t' diff --git a/src/vs/editor/test/common/model/modelDecorations.test.ts b/src/vs/editor/test/common/model/modelDecorations.test.ts index f116b01ef5d..afe58fd37d7 100644 --- a/src/vs/editor/test/common/model/modelDecorations.test.ts +++ b/src/vs/editor/test/common/model/modelDecorations.test.ts @@ -1312,8 +1312,8 @@ suite('deltaDecorations', () => { endLineNumber: 1, endColumn: 1 }, { - stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges - } + stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges + } ); }); model.changeDecorations((changeAccessor) => { diff --git a/src/vs/editor/test/common/model/textModelWithTokens.test.ts b/src/vs/editor/test/common/model/textModelWithTokens.test.ts index 74d93190439..ea2fc18c606 100644 --- a/src/vs/editor/test/common/model/textModelWithTokens.test.ts +++ b/src/vs/editor/test/common/model/textModelWithTokens.test.ts @@ -138,10 +138,10 @@ suite('TextModelWithTokens', () => { testBrackets([ 'if (a == 3) { return (7 * (a + 5)); }' ], [ - ['{', '}'], - ['[', ']'], - ['(', ')'] - ]); + ['{', '}'], + ['[', ']'], + ['(', ')'] + ]); }); }); diff --git a/src/vs/editor/test/common/modes/supports/tokenization.test.ts b/src/vs/editor/test/common/modes/supports/tokenization.test.ts index 4a0c09f5a79..9f2bd1b99b3 100644 --- a/src/vs/editor/test/common/modes/supports/tokenization.test.ts +++ b/src/vs/editor/test/common/modes/supports/tokenization.test.ts @@ -334,8 +334,8 @@ suite('Token theme resolving', () => { let actual = TokenTheme.createFromParsedTokenTheme([ new ParsedTokenThemeRule('var', -1, FontStyle.NotSet, 'F8F8F2', null) ], [ - '000000', 'FFFFFF', '0F0F0F' - ]); + '000000', 'FFFFFF', '0F0F0F' + ]); let colorMap = new ColorMap(); colorMap.getId('000000'); colorMap.getId('FFFFFF'); diff --git a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts index 56dda979b62..a8c5071cb9e 100644 --- a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts +++ b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts @@ -109,9 +109,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', 'world!', '
' ].join('') @@ -122,9 +122,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', 'w', '
' ].join('') @@ -135,9 +135,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -147,9 +147,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'iao', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -158,9 +158,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 4, 11, 4), [ '
', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -170,7 +170,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -241,11 +241,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 21, 4), [ '
', - '  ', + '  ', 'Ciao', - '   ', + '   ', 'hello', - ' ', + ' ', 'world!', '
' ].join('') @@ -255,11 +255,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 17, 4), [ '
', - '  ', + '  ', 'Ciao', - '   ', + '   ', 'hello', - ' ', + ' ', 'wo', '
' ].join('') @@ -269,7 +269,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 3, 4), [ '
', - '  ', + '  ', 'C', '
' ].join('') diff --git a/src/vs/editor/test/common/services/modelService.test.ts b/src/vs/editor/test/common/services/modelService.test.ts index 5bd0289ad83..20d3b7d3312 100644 --- a/src/vs/editor/test/common/services/modelService.test.ts +++ b/src/vs/editor/test/common/services/modelService.test.ts @@ -367,7 +367,7 @@ assertComputeEdits(file1, file2); class TestTextResourcePropertiesService implements ITextResourcePropertiesService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IConfigurationService private readonly configurationService: IConfigurationService, diff --git a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts index e35df432fcd..f88e9e1e875 100644 --- a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts +++ b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts @@ -35,40 +35,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 1000, + width: 1000, + height: 800, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 10, + contentWidth: 990, + contentHeight: 800, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 98, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 10, - contentWidth: 990, - contentHeight: 800, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 98, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 1.1', () => { @@ -93,40 +93,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 1000, - height: 800, + width: 1000, + height: 800, - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, - contentLeft: 10, - contentWidth: 990, - contentHeight: 800, + contentLeft: 10, + contentWidth: 990, + contentHeight: 800, - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 97, + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 97, - verticalScrollbarWidth: 11, - horizontalScrollbarHeight: 12, + verticalScrollbarWidth: 11, + horizontalScrollbarHeight: 12, - overviewRuler: { - top: 13, - width: 11, - height: (800 - 2 * 13), - right: 0 - } - }); + overviewRuler: { + top: 13, + width: 11, + height: (800 - 2 * 13), + right: 0 + } + }); }); test('EditorLayoutProvider 2', () => { @@ -151,40 +151,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 800, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 10, + contentWidth: 890, + contentHeight: 800, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 88, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 10, - contentWidth: 890, - contentHeight: 800, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 88, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 3', () => { @@ -209,40 +209,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 900, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 10, + contentWidth: 890, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 88, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 900, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 10, - contentWidth: 890, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 88, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 4', () => { @@ -267,40 +267,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 900, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 10, + contentWidth: 890, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 88, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 900, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 10, - contentWidth: 890, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 88, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 5', () => { @@ -325,40 +325,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 50, + lineNumbersHeight: 900, + + decorationsLeft: 50, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 60, + contentWidth: 840, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 83, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 50, - lineNumbersHeight: 900, - - decorationsLeft: 50, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 60, - contentWidth: 840, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 83, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 6', () => { @@ -383,40 +383,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 50, + lineNumbersHeight: 900, + + decorationsLeft: 50, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 60, + contentWidth: 840, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 83, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 50, - lineNumbersHeight: 900, - - decorationsLeft: 50, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 60, - contentWidth: 840, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 83, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 7', () => { @@ -441,40 +441,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 60, + lineNumbersHeight: 900, + + decorationsLeft: 60, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 70, + contentWidth: 830, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 82, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 60, - lineNumbersHeight: 900, - - decorationsLeft: 60, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 70, - contentWidth: 830, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 82, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 8', () => { @@ -499,40 +499,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 30, + lineNumbersHeight: 900, + + decorationsLeft: 30, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 40, + contentWidth: 860, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 171, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 30, - lineNumbersHeight: 900, - - decorationsLeft: 30, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 40, - contentWidth: 860, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 171, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 8 - rounds floats', () => { @@ -557,40 +557,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 900, + width: 900, + height: 900, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 900, + + lineNumbersLeft: 0, + lineNumbersWidth: 30, + lineNumbersHeight: 900, + + decorationsLeft: 30, + decorationsWidth: 10, + decorationsHeight: 900, + + contentLeft: 40, + contentWidth: 860, + contentHeight: 900, + + renderMinimap: RenderMinimap.None, + minimapLeft: 0, + minimapWidth: 0, + viewportColumn: 169, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 900, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 900, - - lineNumbersLeft: 0, - lineNumbersWidth: 30, - lineNumbersHeight: 900, - - decorationsLeft: 30, - decorationsWidth: 10, - decorationsHeight: 900, - - contentLeft: 40, - contentWidth: 860, - contentHeight: 900, - - renderMinimap: RenderMinimap.None, - minimapLeft: 0, - minimapWidth: 0, - viewportColumn: 169, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 900, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 9 - render minimap', () => { @@ -615,40 +615,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 1, }, { - width: 1000, + width: 1000, + height: 800, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 10, + contentWidth: 901, + contentHeight: 800, + + renderMinimap: RenderMinimap.Small, + minimapLeft: 911, + minimapWidth: 89, + viewportColumn: 89, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 10, - contentWidth: 901, - contentHeight: 800, - - renderMinimap: RenderMinimap.Small, - minimapLeft: 911, - minimapWidth: 89, - viewportColumn: 89, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 9 - render minimap with pixelRatio = 2', () => { @@ -673,40 +673,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 2, }, { - width: 1000, + width: 1000, + height: 800, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 10, + contentWidth: 901, + contentHeight: 800, + + renderMinimap: RenderMinimap.Large, + minimapLeft: 911, + minimapWidth: 89, + viewportColumn: 89, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 10, - contentWidth: 901, - contentHeight: 800, - - renderMinimap: RenderMinimap.Large, - minimapLeft: 911, - minimapWidth: 89, - viewportColumn: 89, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 9 - render minimap with pixelRatio = 4', () => { @@ -731,40 +731,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 4, }, { - width: 1000, + width: 1000, + height: 800, + + glyphMarginLeft: 0, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 0, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 0, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 10, + contentWidth: 943, + contentHeight: 800, + + renderMinimap: RenderMinimap.Large, + minimapLeft: 953, + minimapWidth: 47, + viewportColumn: 94, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 0, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 0, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 0, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 10, - contentWidth: 943, - contentHeight: 800, - - renderMinimap: RenderMinimap.Large, - minimapLeft: 953, - minimapWidth: 47, - viewportColumn: 94, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('EditorLayoutProvider 10 - render minimap to left', () => { @@ -789,40 +789,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 150, pixelRatio: 4, }, { - width: 1000, + width: 1000, + height: 800, + + glyphMarginLeft: 47, + glyphMarginWidth: 0, + glyphMarginHeight: 800, + + lineNumbersLeft: 47, + lineNumbersWidth: 0, + lineNumbersHeight: 800, + + decorationsLeft: 47, + decorationsWidth: 10, + decorationsHeight: 800, + + contentLeft: 57, + contentWidth: 943, + contentHeight: 800, + + renderMinimap: RenderMinimap.Large, + minimapLeft: 0, + minimapWidth: 47, + viewportColumn: 94, + + verticalScrollbarWidth: 0, + horizontalScrollbarHeight: 0, + + overviewRuler: { + top: 0, + width: 0, height: 800, - - glyphMarginLeft: 47, - glyphMarginWidth: 0, - glyphMarginHeight: 800, - - lineNumbersLeft: 47, - lineNumbersWidth: 0, - lineNumbersHeight: 800, - - decorationsLeft: 47, - decorationsWidth: 10, - decorationsHeight: 800, - - contentLeft: 57, - contentWidth: 943, - contentHeight: 800, - - renderMinimap: RenderMinimap.Large, - minimapLeft: 0, - minimapWidth: 47, - viewportColumn: 94, - - verticalScrollbarWidth: 0, - horizontalScrollbarHeight: 0, - - overviewRuler: { - top: 0, - width: 0, - height: 800, - right: 0 - } - }); + right: 0 + } + }); }); test('issue #31312: When wrapping, leave 2px for the cursor', () => { @@ -847,40 +847,40 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { minimapMaxColumn: 120, pixelRatio: 2 }, { - width: 1201, + width: 1201, + height: 422, + + glyphMarginLeft: 0, + glyphMarginWidth: 30, + glyphMarginHeight: 422, + + lineNumbersLeft: 30, + lineNumbersWidth: 36, + lineNumbersHeight: 422, + + decorationsLeft: 66, + decorationsWidth: 26, + decorationsHeight: 422, + + contentLeft: 92, + contentWidth: 1026, + contentHeight: 422, + + renderMinimap: RenderMinimap.Large, + minimapLeft: 1104, + minimapWidth: 83, + viewportColumn: 83, + + verticalScrollbarWidth: 14, + horizontalScrollbarHeight: 10, + + overviewRuler: { + top: 0, + width: 14, height: 422, - - glyphMarginLeft: 0, - glyphMarginWidth: 30, - glyphMarginHeight: 422, - - lineNumbersLeft: 30, - lineNumbersWidth: 36, - lineNumbersHeight: 422, - - decorationsLeft: 66, - decorationsWidth: 26, - decorationsHeight: 422, - - contentLeft: 92, - contentWidth: 1026, - contentHeight: 422, - - renderMinimap: RenderMinimap.Large, - minimapLeft: 1104, - minimapWidth: 83, - viewportColumn: 83, - - verticalScrollbarWidth: 14, - horizontalScrollbarHeight: 10, - - overviewRuler: { - top: 0, - width: 14, - height: 422, - right: 0 - } - }); + right: 0 + } + }); }); }); diff --git a/src/vs/editor/test/common/viewLayout/lineDecorations.test.ts b/src/vs/editor/test/common/viewLayout/lineDecorations.test.ts index d40db3db77a..bcedab0795d 100644 --- a/src/vs/editor/test/common/viewLayout/lineDecorations.test.ts +++ b/src/vs/editor/test/common/viewLayout/lineDecorations.test.ts @@ -66,34 +66,34 @@ suite('Editor ViewLayout - ViewLineParts', () => { new LineDecoration(1, 2, 'c1', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 0, 'c1'), - new DecorationSegment(2, 2, 'c2') - ]); + new DecorationSegment(0, 0, 'c1'), + new DecorationSegment(2, 2, 'c2') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 3, 'c1', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1'), - new DecorationSegment(2, 2, 'c2') - ]); + new DecorationSegment(0, 1, 'c1'), + new DecorationSegment(2, 2, 'c2') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1'), - new DecorationSegment(2, 2, 'c1 c2') - ]); + new DecorationSegment(0, 1, 'c1'), + new DecorationSegment(2, 2, 'c1 c2') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular), new LineDecoration(1, 4, 'c1*', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1 c1*'), - new DecorationSegment(2, 2, 'c1 c1* c2') - ]); + new DecorationSegment(0, 1, 'c1 c1*'), + new DecorationSegment(2, 2, 'c1 c1* c2') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular), @@ -101,9 +101,9 @@ suite('Editor ViewLayout - ViewLineParts', () => { new LineDecoration(1, 4, 'c1**', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1 c1* c1**'), - new DecorationSegment(2, 2, 'c1 c1* c1** c2') - ]); + new DecorationSegment(0, 1, 'c1 c1* c1**'), + new DecorationSegment(2, 2, 'c1 c1* c1** c2') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular), @@ -112,9 +112,9 @@ suite('Editor ViewLayout - ViewLineParts', () => { new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular), new LineDecoration(3, 4, 'c2*', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1 c1* c1**'), - new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*') - ]); + new DecorationSegment(0, 1, 'c1 c1* c1**'), + new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*') + ]); assert.deepEqual(LineDecorationsNormalizer.normalize('abcabcabcabcabcabcabcabcabcabc', [ new LineDecoration(1, 4, 'c1', InlineDecorationType.Regular), @@ -123,9 +123,9 @@ suite('Editor ViewLayout - ViewLineParts', () => { new LineDecoration(3, 4, 'c2', InlineDecorationType.Regular), new LineDecoration(3, 5, 'c2*', InlineDecorationType.Regular) ]), [ - new DecorationSegment(0, 1, 'c1 c1* c1**'), - new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'), - new DecorationSegment(3, 3, 'c2*') - ]); + new DecorationSegment(0, 1, 'c1 c1* c1**'), + new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'), + new DecorationSegment(3, 3, 'c2*') + ]); }); }); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 5cab18f9cff..6e0b1286ef0 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2494,6 +2494,11 @@ declare namespace monaco.editor { */ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; + /** + * Configuration options for typing over closing quotes or brackets + */ + export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; + /** * Configuration options for editor minimap */ @@ -2922,6 +2927,10 @@ declare namespace monaco.editor { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -3385,6 +3394,7 @@ declare namespace monaco.editor { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3526,6 +3536,7 @@ declare namespace monaco.editor { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -4786,7 +4797,7 @@ declare namespace monaco.languages { Snippet = 25 } - export enum CompletionItemKindModifier { + export enum CompletionItemTag { Deprecated = 1 } @@ -4822,7 +4833,7 @@ declare namespace monaco.languages { * A modifier to the `kind` which affect how the item * is rendered, e.g. Deprecated is rendered with a strikeout */ - kindModifier?: Set; + tags?: ReadonlyArray; /** * A human-readable string with additional information * about this item, like type or symbol information. @@ -5232,10 +5243,15 @@ declare namespace monaco.languages { TypeParameter = 25 } + export enum SymbolTag { + Deprecated = 1 + } + export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + tags: ReadonlyArray; containerName?: string; range: IRange; selectionRange: IRange; diff --git a/src/vs/platform/accessibility/common/abstractAccessibilityService.ts b/src/vs/platform/accessibility/common/abstractAccessibilityService.ts index 00710ed605c..814e9fd0bf0 100644 --- a/src/vs/platform/accessibility/common/abstractAccessibilityService.ts +++ b/src/vs/platform/accessibility/common/abstractAccessibilityService.ts @@ -10,7 +10,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export abstract class AbstractAccessibilityService extends Disposable implements IAccessibilityService { - _serviceBrand: any; + _serviceBrand: undefined; private _accessibilityModeEnabledContext: IContextKey; protected readonly _onDidChangeAccessibilitySupport = new Emitter(); diff --git a/src/vs/platform/accessibility/common/accessibility.ts b/src/vs/platform/accessibility/common/accessibility.ts index 4e695b039f9..825ff4e20ec 100644 --- a/src/vs/platform/accessibility/common/accessibility.ts +++ b/src/vs/platform/accessibility/common/accessibility.ts @@ -10,7 +10,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; export const IAccessibilityService = createDecorator('accessibilityService'); export interface IAccessibilityService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidChangeAccessibilitySupport: Event; diff --git a/src/vs/platform/accessibility/common/accessibilityService.ts b/src/vs/platform/accessibility/common/accessibilityService.ts index b06cb7eb421..2f1d30ec3de 100644 --- a/src/vs/platform/accessibility/common/accessibilityService.ts +++ b/src/vs/platform/accessibility/common/accessibilityService.ts @@ -10,7 +10,7 @@ import { AbstractAccessibilityService } from 'vs/platform/accessibility/common/a export class BrowserAccessibilityService extends AbstractAccessibilityService implements IAccessibilityService { - _serviceBrand: any; + _serviceBrand: undefined; private _accessibilitySupport = AccessibilitySupport.Unknown; diff --git a/src/vs/platform/actions/common/actions.ts b/src/vs/platform/actions/common/actions.ts index 046c46b157f..7a409b98a5e 100644 --- a/src/vs/platform/actions/common/actions.ts +++ b/src/vs/platform/actions/common/actions.ts @@ -116,7 +116,7 @@ export const IMenuService = createDecorator('menuService'); export interface IMenuService { - _serviceBrand: any; + _serviceBrand: undefined; createMenu(id: MenuId, scopedKeybindingService: IContextKeyService): IMenu; } diff --git a/src/vs/platform/actions/common/menuService.ts b/src/vs/platform/actions/common/menuService.ts index 352a1ed945f..651e6fe27f4 100644 --- a/src/vs/platform/actions/common/menuService.ts +++ b/src/vs/platform/actions/common/menuService.ts @@ -11,7 +11,7 @@ import { ContextKeyExpr, IContextKeyService, IContextKeyChangeEvent } from 'vs/p export class MenuService implements IMenuService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @ICommandService private readonly _commandService: ICommandService diff --git a/src/vs/platform/backup/common/backup.ts b/src/vs/platform/backup/common/backup.ts index 9a6cc9bdf0e..eafe3e2ed5f 100644 --- a/src/vs/platform/backup/common/backup.ts +++ b/src/vs/platform/backup/common/backup.ts @@ -33,7 +33,7 @@ export interface IWorkspaceBackupInfo { } export interface IBackupMainService { - _serviceBrand: any; + _serviceBrand: undefined; isHotExitEnabled(): boolean; diff --git a/src/vs/platform/backup/electron-main/backupMainService.ts b/src/vs/platform/backup/electron-main/backupMainService.ts index 9e2875d928a..66ca2b6c3db 100644 --- a/src/vs/platform/backup/electron-main/backupMainService.ts +++ b/src/vs/platform/backup/electron-main/backupMainService.ts @@ -22,7 +22,7 @@ import { Schemas } from 'vs/base/common/network'; export class BackupMainService implements IBackupMainService { - _serviceBrand: any; + _serviceBrand: undefined; protected backupHome: string; protected workspacesJsonPath: string; @@ -138,7 +138,7 @@ export class BackupMainService implements IBackupMainService { } registerWorkspaceBackupSync(workspaceInfo: IWorkspaceBackupInfo, migrateFrom?: string): string { - if (!this.rootWorkspaces.some(w => workspaceInfo.workspace.id === w.workspace.id)) { + if (!this.rootWorkspaces.some(window => workspaceInfo.workspace.id === window.workspace.id)) { this.rootWorkspaces.push(workspaceInfo); this.saveSync(); } @@ -219,7 +219,7 @@ export class BackupMainService implements IBackupMainService { backupFolder = this.getRandomEmptyWindowId(); } - if (!this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, backupFolder!, !platform.isLinux))) { + if (!this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, backupFolder!, !platform.isLinux))) { this.emptyWorkspaces.push({ backupFolder, remoteAuthority }); this.saveSync(); } @@ -353,7 +353,7 @@ export class BackupMainService implements IBackupMainService { // New empty window backup let newBackupFolder = this.getRandomEmptyWindowId(); - while (this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, newBackupFolder, platform.isLinux))) { + while (this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, newBackupFolder, platform.isLinux))) { newBackupFolder = this.getRandomEmptyWindowId(); } @@ -374,7 +374,7 @@ export class BackupMainService implements IBackupMainService { // New empty window backup let newBackupFolder = this.getRandomEmptyWindowId(); - while (this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, newBackupFolder, platform.isLinux))) { + while (this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, newBackupFolder, platform.isLinux))) { newBackupFolder = this.getRandomEmptyWindowId(); } @@ -457,4 +457,4 @@ export class BackupMainService implements IBackupMainService { protected getLegacyFolderHash(folderPath: string): string { return crypto.createHash('md5').update(platform.isLinux ? folderPath : folderPath.toLowerCase()).digest('hex'); } -} \ No newline at end of file +} diff --git a/src/vs/platform/backup/test/electron-main/backupMainService.test.ts b/src/vs/platform/backup/test/electron-main/backupMainService.test.ts index f648c9ce6d0..384fbaf9a7d 100644 --- a/src/vs/platform/backup/test/electron-main/backupMainService.test.ts +++ b/src/vs/platform/backup/test/electron-main/backupMainService.test.ts @@ -322,7 +322,7 @@ suite('BackupMainService', () => { assert.deepEqual(json.folderURIWorkspaces, [URI.file(folderPath).toString()]); assert.deepEqual(json.rootURIWorkspaces, [{ id: workspace.id, configURIPath: URI.file(workspacePath).toString() }]); - assertEqualUris(service.getWorkspaceBackups().map(w => w.workspace.configPath), [workspace.configPath]); + assertEqualUris(service.getWorkspaceBackups().map(window => window.workspace.configPath), [workspace.configPath]); }); }); @@ -731,4 +731,4 @@ suite('BackupMainService', () => { } }); }); -}); \ No newline at end of file +}); diff --git a/src/vs/platform/clipboard/browser/clipboardService.ts b/src/vs/platform/clipboard/browser/clipboardService.ts index c5e8a2676d2..d1a6d6c0d91 100644 --- a/src/vs/platform/clipboard/browser/clipboardService.ts +++ b/src/vs/platform/clipboard/browser/clipboardService.ts @@ -6,11 +6,10 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { URI } from 'vs/base/common/uri'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class BrowserClipboardService implements IClipboardService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _internalResourcesClipboard: URI[] | undefined; diff --git a/src/vs/platform/clipboard/common/clipboardService.ts b/src/vs/platform/clipboard/common/clipboardService.ts index 84018111136..11bf563393a 100644 --- a/src/vs/platform/clipboard/common/clipboardService.ts +++ b/src/vs/platform/clipboard/common/clipboardService.ts @@ -10,7 +10,7 @@ export const IClipboardService = createDecorator('clipboardSe export interface IClipboardService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Writes text to the system clipboard. diff --git a/src/vs/platform/clipboard/electron-browser/clipboardService.ts b/src/vs/platform/clipboard/electron-browser/clipboardService.ts index 4150430af7b..3b269b200fc 100644 --- a/src/vs/platform/clipboard/electron-browser/clipboardService.ts +++ b/src/vs/platform/clipboard/electron-browser/clipboardService.ts @@ -12,7 +12,7 @@ export class ClipboardService implements IClipboardService { private static FILE_FORMAT = 'code/file-list'; // Clipboard format for files - _serviceBrand: any; + _serviceBrand: undefined; async writeText(text: string, type?: 'selection' | 'clipboard'): Promise { clipboard.writeText(text, type); diff --git a/src/vs/platform/commands/common/commands.ts b/src/vs/platform/commands/common/commands.ts index 06c33cf281e..e2e05318487 100644 --- a/src/vs/platform/commands/common/commands.ts +++ b/src/vs/platform/commands/common/commands.ts @@ -19,7 +19,7 @@ export interface ICommandEvent { } export interface ICommandService { - _serviceBrand: any; + _serviceBrand: undefined; onWillExecuteCommand: Event; onDidExecuteCommand: Event; executeCommand(commandId: string, ...args: any[]): Promise; diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 7249d295d87..78839c2d608 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -63,7 +63,7 @@ export interface IConfigurationChangeEvent { } export interface IConfigurationService { - _serviceBrand: any; + _serviceBrand: undefined; onDidChangeConfiguration: Event; diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 373a2e1b086..c4749186815 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -441,7 +441,7 @@ export class Configuration { return this._defaultConfiguration; } - private _userConfiguration: ConfigurationModel | null; + private _userConfiguration: ConfigurationModel | null = null; get userConfiguration(): ConfigurationModel { if (!this._userConfiguration) { this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration); diff --git a/src/vs/platform/configuration/common/configurationRegistry.ts b/src/vs/platform/configuration/common/configurationRegistry.ts index 329276d4e46..dcec2f72663 100644 --- a/src/vs/platform/configuration/common/configurationRegistry.ts +++ b/src/vs/platform/configuration/common/configurationRegistry.ts @@ -140,6 +140,7 @@ type SettingProperties = { [key: string]: any }; export const allSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; export const applicationSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; export const machineSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; +export const machineOverridableSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; export const windowSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; export const resourceSettings: { properties: SettingProperties, patternProperties: SettingProperties } = { properties: {}, patternProperties: {} }; @@ -169,7 +170,7 @@ class ConfigurationRegistry implements IConfigurationRegistry { properties: {} }; this.configurationContributors = [this.defaultOverridesConfigurationNode]; - this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting' }; + this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowsTrailingCommas: true, allowComments: true }; this.configurationProperties = {}; this.excludedConfigurationProperties = {}; this.computeOverridePropertyPattern(); @@ -213,6 +214,9 @@ class ConfigurationRegistry implements IConfigurationRegistry { case ConfigurationScope.MACHINE: delete machineSettings.properties[key]; break; + case ConfigurationScope.MACHINE_OVERRIDABLE: + delete machineOverridableSettings.properties[key]; + break; case ConfigurationScope.WINDOW: delete windowSettings.properties[key]; break; @@ -364,6 +368,9 @@ class ConfigurationRegistry implements IConfigurationRegistry { case ConfigurationScope.MACHINE: machineSettings.properties[key] = properties[key]; break; + case ConfigurationScope.MACHINE_OVERRIDABLE: + machineOverridableSettings.properties[key] = properties[key]; + break; case ConfigurationScope.WINDOW: windowSettings.properties[key] = properties[key]; break; @@ -402,6 +409,7 @@ class ConfigurationRegistry implements IConfigurationRegistry { delete allSettings.patternProperties[this.overridePropertyPattern]; delete applicationSettings.patternProperties[this.overridePropertyPattern]; delete machineSettings.patternProperties[this.overridePropertyPattern]; + delete machineOverridableSettings.patternProperties[this.overridePropertyPattern]; delete windowSettings.patternProperties[this.overridePropertyPattern]; delete resourceSettings.patternProperties[this.overridePropertyPattern]; @@ -410,6 +418,7 @@ class ConfigurationRegistry implements IConfigurationRegistry { allSettings.patternProperties[this.overridePropertyPattern] = patternProperties; applicationSettings.patternProperties[this.overridePropertyPattern] = patternProperties; machineSettings.patternProperties[this.overridePropertyPattern] = patternProperties; + machineOverridableSettings.patternProperties[this.overridePropertyPattern] = patternProperties; windowSettings.patternProperties[this.overridePropertyPattern] = patternProperties; resourceSettings.patternProperties[this.overridePropertyPattern] = patternProperties; diff --git a/src/vs/platform/configuration/node/configurationService.ts b/src/vs/platform/configuration/node/configurationService.ts index d3e4dfe09b1..9dcd0267e77 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -17,7 +17,7 @@ import { Schemas } from 'vs/base/common/network'; export class ConfigurationService extends Disposable implements IConfigurationService, IDisposable { - _serviceBrand: any; + _serviceBrand: undefined; private configuration: Configuration; private userConfigModelWatcher: ConfigWatcher | undefined; diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index 9bb4c8e2208..df01e1a8a4b 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri'; import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, getConfigurationValue, isConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; export class TestConfigurationService implements IConfigurationService { - public _serviceBrand: any; + public _serviceBrand: undefined; private configuration = Object.create(null); diff --git a/src/vs/platform/contextkey/browser/contextKeyService.ts b/src/vs/platform/contextkey/browser/contextKeyService.ts index 7b23bc6e6f5..8efe90bd137 100644 --- a/src/vs/platform/contextkey/browser/contextKeyService.ts +++ b/src/vs/platform/contextkey/browser/contextKeyService.ts @@ -225,7 +225,7 @@ class CompositeContextKeyChangeEvent implements IContextKeyChangeEvent { } export abstract class AbstractContextKeyService implements IContextKeyService { - public _serviceBrand: any; + public _serviceBrand: undefined; protected _isDisposed: boolean; protected _onDidChangeContext = new PauseableEmitter({ merge: input => new CompositeContextKeyChangeEvent(input) }); diff --git a/src/vs/platform/contextkey/common/contextkey.ts b/src/vs/platform/contextkey/common/contextkey.ts index 64025a4249f..16e79df476f 100644 --- a/src/vs/platform/contextkey/common/contextkey.ts +++ b/src/vs/platform/contextkey/common/contextkey.ts @@ -827,7 +827,7 @@ export interface IContextKeyChangeEvent { } export interface IContextKeyService { - _serviceBrand: any; + _serviceBrand: undefined; dispose(): void; onDidChangeContext: Event; diff --git a/src/vs/platform/contextview/browser/contextMenuHandler.ts b/src/vs/platform/contextview/browser/contextMenuHandler.ts index 8ab9ccc2d82..921a5f810a5 100644 --- a/src/vs/platform/contextview/browser/contextMenuHandler.ts +++ b/src/vs/platform/contextview/browser/contextMenuHandler.ts @@ -24,8 +24,8 @@ export interface IContextMenuHandlerOptions { } export class ContextMenuHandler { - private focusToReturn: HTMLElement; - private block: HTMLElement | null; + private focusToReturn: HTMLElement | null = null; + private block: HTMLElement | null = null; private options: IContextMenuHandlerOptions = { blockMouse: true }; constructor( diff --git a/src/vs/platform/contextview/browser/contextMenuService.ts b/src/vs/platform/contextview/browser/contextMenuService.ts index bb76d44886a..539b819e643 100644 --- a/src/vs/platform/contextview/browser/contextMenuService.ts +++ b/src/vs/platform/contextview/browser/contextMenuService.ts @@ -14,7 +14,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { Disposable } from 'vs/base/common/lifecycle'; export class ContextMenuService extends Disposable implements IContextMenuService { - _serviceBrand: any; + _serviceBrand: undefined; private _onDidContextMenu = this._register(new Emitter()); readonly onDidContextMenu: Event = this._onDidContextMenu.event; diff --git a/src/vs/platform/contextview/browser/contextView.ts b/src/vs/platform/contextview/browser/contextView.ts index df51bcf7d29..f5d1e81a569 100644 --- a/src/vs/platform/contextview/browser/contextView.ts +++ b/src/vs/platform/contextview/browser/contextView.ts @@ -13,7 +13,7 @@ export const IContextViewService = createDecorator('context export interface IContextViewService { - _serviceBrand: any; + _serviceBrand: undefined; showContextView(delegate: IContextViewDelegate): void; hideContextView(data?: any): void; @@ -37,7 +37,7 @@ export const IContextMenuService = createDecorator('context export interface IContextMenuService { - _serviceBrand: any; + _serviceBrand: undefined; showContextMenu(delegate: IContextMenuDelegate): void; onDidContextMenu: Event; // TODO@isidor these event should be removed once we get async context menus diff --git a/src/vs/platform/contextview/browser/contextViewService.ts b/src/vs/platform/contextview/browser/contextViewService.ts index c0acf0ea176..1cbd4908c2d 100644 --- a/src/vs/platform/contextview/browser/contextViewService.ts +++ b/src/vs/platform/contextview/browser/contextViewService.ts @@ -9,7 +9,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; export class ContextViewService extends Disposable implements IContextViewService { - _serviceBrand: any; + _serviceBrand: undefined; private contextView: ContextView; diff --git a/src/vs/platform/debug/common/extensionHostDebug.ts b/src/vs/platform/debug/common/extensionHostDebug.ts index 08d14adc775..3386e62b25d 100644 --- a/src/vs/platform/debug/common/extensionHostDebug.ts +++ b/src/vs/platform/debug/common/extensionHostDebug.ts @@ -34,7 +34,7 @@ export interface ICloseSessionEvent { } export interface IExtensionHostDebugService { - _serviceBrand: any; + _serviceBrand: undefined; reload(sessionId: string): void; onReload: Event; diff --git a/src/vs/platform/debug/common/extensionHostDebugIpc.ts b/src/vs/platform/debug/common/extensionHostDebugIpc.ts index 1304d5cd669..3511be94950 100644 --- a/src/vs/platform/debug/common/extensionHostDebugIpc.ts +++ b/src/vs/platform/debug/common/extensionHostDebugIpc.ts @@ -54,7 +54,7 @@ export class ExtensionHostDebugBroadcastChannel implements IServerChan export class ExtensionHostDebugChannelClient extends Disposable implements IExtensionHostDebugService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { super(); diff --git a/src/vs/platform/diagnostics/node/diagnosticsIpc.ts b/src/vs/platform/diagnostics/node/diagnosticsIpc.ts index 76af1758163..d159c07d8ca 100644 --- a/src/vs/platform/diagnostics/node/diagnosticsIpc.ts +++ b/src/vs/platform/diagnostics/node/diagnosticsIpc.ts @@ -7,7 +7,6 @@ import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc'; import { IRemoteDiagnosticInfo, IRemoteDiagnosticError, SystemInfo, PerformanceInfo } from 'vs/platform/diagnostics/common/diagnostics'; import { IDiagnosticsService } from './diagnosticsService'; import { Event } from 'vs/base/common/event'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IMainProcessInfo } from 'vs/platform/launch/common/launchService'; import { IWorkspace } from 'vs/platform/workspace/common/workspace'; @@ -37,7 +36,7 @@ export class DiagnosticsChannel implements IServerChannel { export class DiagnosticsService implements IDiagnosticsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; constructor(private channel: IChannel) { } diff --git a/src/vs/platform/diagnostics/node/diagnosticsService.ts b/src/vs/platform/diagnostics/node/diagnosticsService.ts index 1f5326fd136..54254637913 100644 --- a/src/vs/platform/diagnostics/node/diagnosticsService.ts +++ b/src/vs/platform/diagnostics/node/diagnosticsService.ts @@ -23,7 +23,7 @@ export const ID = 'diagnosticsService'; export const IDiagnosticsService = createDecorator(ID); export interface IDiagnosticsService { - _serviceBrand: any; + _serviceBrand: undefined; getPerformanceInfo(mainProcessInfo: IMainProcessInfo, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise; getSystemInfo(mainProcessInfo: IMainProcessInfo, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise; @@ -248,7 +248,7 @@ export function collectLaunchConfigs(folder: string): Promise { - type WorkspaceStatItemClassification = { - name: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; - count: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; - }; type WorkspaceStatsClassification = { 'workspace.id': { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; - fileTypes: WorkspaceStatItemClassification; - configTypes: WorkspaceStatItemClassification; - launchConfigs: WorkspaceStatItemClassification; + fileTypes: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; + configTypes: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; + launchConfigs: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; }; type WorkspaceStatsEvent = { 'workspace.id': string | undefined; diff --git a/src/vs/platform/dialogs/browser/dialogService.ts b/src/vs/platform/dialogs/browser/dialogService.ts index 347e242dd6d..0f1ef2dbcfb 100644 --- a/src/vs/platform/dialogs/browser/dialogService.ts +++ b/src/vs/platform/dialogs/browser/dialogService.ts @@ -14,14 +14,18 @@ import { attachDialogStyler } from 'vs/platform/theme/common/styler'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { EventHelper } from 'vs/base/browser/dom'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; export class DialogService implements IDialogService { - _serviceBrand: any; + _serviceBrand: undefined; + + private allowableCommands = ['copy', 'cut']; constructor( @ILogService private readonly logService: ILogService, @ILayoutService private readonly layoutService: ILayoutService, - @IThemeService private readonly themeService: IThemeService + @IThemeService private readonly themeService: IThemeService, + @IKeybindingService private readonly keybindingService: IKeybindingService ) { } async confirm(confirmation: IConfirmation): Promise { @@ -50,7 +54,12 @@ export class DialogService implements IDialogService { cancelId: 1, type: confirmation.type, keyEventProcessor: (event: StandardKeyboardEvent) => { - EventHelper.stop(event, true); + const resolved = this.keybindingService.softDispatch(event, this.layoutService.container); + if (resolved && resolved.commandId) { + if (this.allowableCommands.indexOf(resolved.commandId) === -1) { + EventHelper.stop(event, true); + } + } }, checkboxChecked: confirmation.checkbox ? confirmation.checkbox.checked : undefined, checkboxLabel: confirmation.checkbox ? confirmation.checkbox.label : undefined @@ -82,7 +91,12 @@ export class DialogService implements IDialogService { cancelId: options ? options.cancelId : undefined, type: this.getDialogType(severity), keyEventProcessor: (event: StandardKeyboardEvent) => { - EventHelper.stop(event, true); + const resolved = this.keybindingService.softDispatch(event, this.layoutService.container); + if (resolved && resolved.commandId) { + if (this.allowableCommands.indexOf(resolved.commandId) === -1) { + EventHelper.stop(event, true); + } + } } }); diff --git a/src/vs/platform/dialogs/common/dialogs.ts b/src/vs/platform/dialogs/common/dialogs.ts index 6999633d9f0..f72f2276330 100644 --- a/src/vs/platform/dialogs/common/dialogs.ts +++ b/src/vs/platform/dialogs/common/dialogs.ts @@ -139,7 +139,7 @@ export interface IDialogOptions { */ export interface IDialogService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Ask the user for confirmation with a modal dialog. @@ -163,7 +163,7 @@ export const IFileDialogService = createDecorator('fileDialo */ export interface IFileDialogService { - _serviceBrand: any; + _serviceBrand: undefined; /** * The default path for a new file based on previously used files. diff --git a/src/vs/platform/dialogs/node/dialogIpc.ts b/src/vs/platform/dialogs/node/dialogIpc.ts index d4a0563a171..30ee7ebd25c 100644 --- a/src/vs/platform/dialogs/node/dialogIpc.ts +++ b/src/vs/platform/dialogs/node/dialogIpc.ts @@ -27,7 +27,7 @@ export class DialogChannel implements IServerChannel { export class DialogChannelClient implements IDialogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { } diff --git a/src/vs/platform/download/common/download.ts b/src/vs/platform/download/common/download.ts index a012358875d..95f1d0ad66e 100644 --- a/src/vs/platform/download/common/download.ts +++ b/src/vs/platform/download/common/download.ts @@ -11,7 +11,7 @@ export const IDownloadService = createDecorator('downloadServi export interface IDownloadService { - _serviceBrand: any; + _serviceBrand: undefined; download(uri: URI, to: URI, cancellationToken?: CancellationToken): Promise; diff --git a/src/vs/platform/download/common/downloadIpc.ts b/src/vs/platform/download/common/downloadIpc.ts index d2d00dd8ccc..0876dfbc3d7 100644 --- a/src/vs/platform/download/common/downloadIpc.ts +++ b/src/vs/platform/download/common/downloadIpc.ts @@ -27,7 +27,7 @@ export class DownloadServiceChannel implements IServerChannel { export class DownloadServiceChannelClient implements IDownloadService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel, private getUriTransformer: () => IURITransformer | null) { } diff --git a/src/vs/platform/download/common/downloadService.ts b/src/vs/platform/download/common/downloadService.ts index 54d2f1a9835..08593aa5d27 100644 --- a/src/vs/platform/download/common/downloadService.ts +++ b/src/vs/platform/download/common/downloadService.ts @@ -12,7 +12,7 @@ import { Schemas } from 'vs/base/common/network'; export class DownloadService implements IDownloadService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IRequestService private readonly requestService: IRequestService, diff --git a/src/vs/platform/driver/common/driver.ts b/src/vs/platform/driver/common/driver.ts index 29fde875994..c93106ce99f 100644 --- a/src/vs/platform/driver/common/driver.ts +++ b/src/vs/platform/driver/common/driver.ts @@ -19,7 +19,7 @@ export interface IElement { } export interface IDriver { - _serviceBrand: any; + _serviceBrand: undefined; getWindowIds(): Promise; capturePage(windowId: number): Promise; diff --git a/src/vs/platform/driver/electron-main/driver.ts b/src/vs/platform/driver/electron-main/driver.ts index 8096b8f6abd..49404125de3 100644 --- a/src/vs/platform/driver/electron-main/driver.ts +++ b/src/vs/platform/driver/electron-main/driver.ts @@ -25,7 +25,7 @@ function isSilentKeyCode(keyCode: KeyCode) { export class Driver implements IDriver, IWindowDriverRegistry { - _serviceBrand: any; + _serviceBrand: undefined; private registeredWindowIds = new Set(); private reloadingWindowIds = new Set(); diff --git a/src/vs/platform/driver/node/driver.ts b/src/vs/platform/driver/node/driver.ts index 2c525c0e694..f0713a37181 100644 --- a/src/vs/platform/driver/node/driver.ts +++ b/src/vs/platform/driver/node/driver.ts @@ -42,7 +42,7 @@ export class DriverChannel implements IServerChannel { export class DriverChannelClient implements IDriver { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { } @@ -136,7 +136,7 @@ export class WindowDriverRegistryChannel implements IServerChannel { export class WindowDriverRegistryChannelClient implements IWindowDriverRegistry { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { } @@ -177,7 +177,7 @@ export class WindowDriverChannel implements IServerChannel { export class WindowDriverChannelClient implements IWindowDriver { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { } diff --git a/src/vs/platform/editor/common/editor.ts b/src/vs/platform/editor/common/editor.ts index c061f0eea6a..65e7ec7713c 100644 --- a/src/vs/platform/editor/common/editor.ts +++ b/src/vs/platform/editor/common/editor.ts @@ -79,14 +79,53 @@ export interface IResourceInput extends IBaseResourceInput { readonly mode?: string; } +export enum EditorActivation { + + /** + * Activate the editor after it opened. This will automatically restore + * the editor if it is minimized. + */ + ACTIVATE, + + /** + * Only restore the editor if it is minimized but do not activate it. + * + * Note: will only work in combination with the `preserveFocus: true` option. + * Otherwise, if focus moves into the editor, it will activate and restore + * automatically. + */ + RESTORE, + + /** + * Preserve the current active editor. + * + * Note: will only work in combination with the `preserveFocus: true` option. + * Otherwise, if focus moves into the editor, it will activate and restore + * automatically. + */ + PRESERVE +} + export interface IEditorOptions { /** - * Tells the editor to not receive keyboard focus when the editor is being opened. By default, - * the editor will receive keyboard focus on open. + * Tells the editor to not receive keyboard focus when the editor is being opened. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ readonly preserveFocus?: boolean; + /** + * This option is only relevant if an editor is opened into a group that is not active + * already and allows to control if the inactive group should become active, restored + * or preserved. + * + * By default, the editor group will become active unless `preserveFocus` or `inactive` + * is specified. + */ + readonly activation?: EditorActivation; + /** * Tells the editor to reload the editor input in the editor even if it is identical to the one * already showing. By default, the editor will not reload the input if it is identical to the @@ -123,7 +162,10 @@ export interface IEditorOptions { /** * An active editor that is opened will show its contents directly. Set to true to open an editor - * in the background. + * in the background without loading its contents. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ readonly inactive?: boolean; diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index b13a82f4447..cfb931c013e 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { URI } from 'vs/base/common/uri'; export interface ParsedArgs { @@ -99,7 +99,7 @@ export const BACKUPS = 'Backups'; export interface IEnvironmentService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; args: ParsedArgs; @@ -140,24 +140,15 @@ export interface IEnvironmentService { extensionTestsLocationURI?: URI; debugExtensionHost: IExtensionHostDebugParams; - debugSearch: IDebugParams; - - logExtensionHostCommunication: boolean; isBuilt: boolean; wait: boolean; status: boolean; - // logging log?: string; logsPath: string; verbose: boolean; - skipGettingStarted: boolean | undefined; - skipReleaseNotes: boolean | undefined; - - skipAddToRecentlyOpened: boolean; - mainIPCHandle: string; sharedIPCHandle: string; @@ -170,9 +161,5 @@ export interface IEnvironmentService { driverHandle?: string; driverVerbose: boolean; - webviewEndpoint?: string; - readonly webviewResourceRoot: string; - readonly webviewCspSource: string; - - readonly galleryMachineIdResource?: URI; + galleryMachineIdResource?: URI; } diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index c5c4e66272c..3eb487a5c44 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -16,7 +16,6 @@ import { toLocalISOString } from 'vs/base/common/date'; import { isWindows, isLinux } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; import { URI } from 'vs/base/common/uri'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; // Read this before there's any chance it is overwritten // Related to https://github.com/Microsoft/vscode/issues/30624 @@ -77,7 +76,7 @@ function getCLIPath(execPath: string, appRoot: string, isBuilt: boolean): string export class EnvironmentService implements IEnvironmentService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; get args(): ParsedArgs { return this._args; } @@ -236,26 +235,15 @@ export class EnvironmentService implements IEnvironmentService { return false; } - get skipGettingStarted(): boolean { return !!this._args['skip-getting-started']; } - - get skipReleaseNotes(): boolean { return !!this._args['skip-release-notes']; } - - get skipAddToRecentlyOpened(): boolean { return !!this._args['skip-add-to-recently-opened']; } - @memoize get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); } - @memoize - get debugSearch(): IDebugParams { return parseSearchPort(this._args, this.isBuilt); } - get isBuilt(): boolean { return !process.env['VSCODE_DEV']; } get verbose(): boolean { return !!this._args.verbose; } get log(): string | undefined { return this._args.log; } get wait(): boolean { return !!this._args.wait; } - get logExtensionHostCommunication(): boolean { return !!this._args.logExtensionHostCommunication; } - get status(): boolean { return !!this._args.status; } @memoize @@ -276,9 +264,6 @@ export class EnvironmentService implements IEnvironmentService { get driverHandle(): string | undefined { return this._args['driver']; } get driverVerbose(): boolean { return !!this._args['driver-verbose']; } - readonly webviewResourceRoot = 'vscode-resource:{{resource}}'; - readonly webviewCspSource = 'vscode-resource:'; - constructor(private _args: ParsedArgs, private _execPath: string) { if (!process.env['VSCODE_LOGS']) { const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, ''); diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts index 2d39c512975..7a3af7f1f57 100644 --- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts +++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts @@ -9,7 +9,8 @@ import { getGalleryExtensionId, getGalleryExtensionTelemetryData, adoptToGallery import { assign, getOrDefault } from 'vs/base/common/objects'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IPager } from 'vs/base/common/paging'; -import { IRequestService, IRequestOptions, IRequestContext, asJson, asText, IHeaders } from 'vs/platform/request/common/request'; +import { IRequestService, asJson, asText } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext, IHeaders } from 'vs/base/parts/request/common/request'; import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { generateUuid, isUUID } from 'vs/base/common/uuid'; @@ -326,7 +327,7 @@ interface IRawExtensionsReport { export class ExtensionGalleryService implements IExtensionGalleryService { - _serviceBrand: any; + _serviceBrand: undefined; private extensionsGalleryUrl: string | undefined; private extensionsControlUrl: string | undefined; diff --git a/src/vs/platform/extensionManagement/common/extensionManagement.ts b/src/vs/platform/extensionManagement/common/extensionManagement.ts index dd19996782d..277b8e3b208 100644 --- a/src/vs/platform/extensionManagement/common/extensionManagement.ts +++ b/src/vs/platform/extensionManagement/common/extensionManagement.ts @@ -146,7 +146,7 @@ export interface ITranslation { } export interface IExtensionGalleryService { - _serviceBrand: any; + _serviceBrand: undefined; isEnabled(): boolean; query(token: CancellationToken): Promise>; query(options: IQueryOptions, token: CancellationToken): Promise>; @@ -186,7 +186,7 @@ export const INSTALL_ERROR_MALICIOUS = 'malicious'; export const INSTALL_ERROR_INCOMPATIBLE = 'incompatible'; export interface IExtensionManagementService { - _serviceBrand: any; + _serviceBrand: undefined; onInstallExtension: Event; onDidInstallExtension: Event; diff --git a/src/vs/platform/extensionManagement/common/extensionManagementIpc.ts b/src/vs/platform/extensionManagement/common/extensionManagementIpc.ts index 349223b9210..035559f7ec6 100644 --- a/src/vs/platform/extensionManagement/common/extensionManagementIpc.ts +++ b/src/vs/platform/extensionManagement/common/extensionManagementIpc.ts @@ -77,7 +77,7 @@ export class ExtensionManagementChannel implements IServerChannel { export class ExtensionManagementChannelClient implements IExtensionManagementService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( private readonly channel: IChannel, diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index 7d0b568fc7f..bab2df5a3f8 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -101,7 +101,7 @@ interface InstallableExtension { export class ExtensionManagementService extends Disposable implements IExtensionManagementService { - _serviceBrand: any; + _serviceBrand: undefined; private systemExtensionsPath: string; private extensionsPath: string; diff --git a/src/vs/platform/files/common/fileService.ts b/src/vs/platform/files/common/fileService.ts index 34a6974e03c..8efc34437f0 100644 --- a/src/vs/platform/files/common/fileService.ts +++ b/src/vs/platform/files/common/fileService.ts @@ -7,7 +7,6 @@ import { Disposable, IDisposable, toDisposable, dispose, DisposableStore } from import { IFileService, IResolveFileOptions, FileChangesEvent, FileOperationEvent, IFileSystemProviderRegistrationEvent, IFileSystemProvider, IFileStat, IResolveFileResult, ICreateFileOptions, IFileSystemProviderActivationEvent, FileOperationError, FileOperationResult, FileOperation, FileSystemProviderCapabilities, FileType, toFileSystemProviderErrorCode, FileSystemProviderErrorCode, IStat, IFileStatWithMetadata, IResolveMetadataFileOptions, etag, hasReadWriteCapability, hasFileFolderCopyCapability, hasOpenReadWriteCloseCapability, toFileOperationResult, IFileSystemProviderWithOpenReadWriteCloseCapability, IFileSystemProviderWithFileReadWriteCapability, IResolveFileResultWithMetadata, IWatchOptions, IWriteFileOptions, IReadFileOptions, IFileStreamContent, IFileContent, ETAG_DISABLED } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import { Event, Emitter } from 'vs/base/common/event'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { isAbsolutePath, dirname, basename, joinPath, isEqual, isEqualOrParent } from 'vs/base/common/resources'; import { localize } from 'vs/nls'; import { TernarySearchTree } from 'vs/base/common/map'; @@ -21,7 +20,7 @@ import { Schemas } from 'vs/base/common/network'; export class FileService extends Disposable implements IFileService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly BUFFER_SIZE = 64 * 1024; diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 40d21fce9de..ad80919e113 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -6,7 +6,7 @@ import { sep } from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; import * as glob from 'vs/base/common/glob'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event } from 'vs/base/common/event'; import { startsWithIgnoreCase } from 'vs/base/common/strings'; import { IDisposable } from 'vs/base/common/lifecycle'; @@ -18,7 +18,7 @@ export const IFileService = createDecorator('fileService'); export interface IFileService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * An event that is fired when a file system provider is added or removed diff --git a/src/vs/platform/files/node/diskFileSystemProvider.ts b/src/vs/platform/files/node/diskFileSystemProvider.ts index 12d5847389d..d66ef03839c 100644 --- a/src/vs/platform/files/node/diskFileSystemProvider.ts +++ b/src/vs/platform/files/node/diskFileSystemProvider.ts @@ -38,7 +38,7 @@ export class DiskFileSystemProvider extends Disposable implements IFileSystemPro onDidChangeCapabilities: Event = Event.None; - protected _capabilities: FileSystemProviderCapabilities; + protected _capabilities: FileSystemProviderCapabilities | undefined; get capabilities(): FileSystemProviderCapabilities { if (!this._capabilities) { this._capabilities = diff --git a/src/vs/platform/files/node/watcher/nodejs/watcherService.ts b/src/vs/platform/files/node/watcher/nodejs/watcherService.ts index 58c4a327734..b2bf3498400 100644 --- a/src/vs/platform/files/node/watcher/nodejs/watcherService.ts +++ b/src/vs/platform/files/node/watcher/nodejs/watcherService.ts @@ -13,7 +13,7 @@ import { ThrottledDelayer } from 'vs/base/common/async'; import { join, basename } from 'vs/base/common/path'; export class FileWatcher extends Disposable { - private isDisposed: boolean; + private isDisposed: boolean | undefined; private fileChangesDelayer: ThrottledDelayer = this._register(new ThrottledDelayer(CHANGE_BUFFER_DELAY * 2 /* sync on delay from underlying library */)); private fileChangesBuffer: IDiskFileChange[] = []; @@ -125,4 +125,4 @@ export class FileWatcher extends Disposable { super.dispose(); } -} \ No newline at end of file +} diff --git a/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts b/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts index a9db893575b..916a0492077 100644 --- a/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts +++ b/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts @@ -36,8 +36,8 @@ export class NsfwWatcherService implements IWatcherService { private static readonly FS_EVENT_DELAY = 50; // aggregate and only emit events when changes have stopped for this duration (in ms) private _pathWatchers: { [watchPath: string]: IPathWatcher } = {}; - private _verboseLogging: boolean; - private enospcErrorLogged: boolean; + private _verboseLogging: boolean | undefined; + private enospcErrorLogged: boolean | undefined; private _onWatchEvent = new Emitter(); readonly onWatchEvent = this._onWatchEvent.event; diff --git a/src/vs/platform/files/node/watcher/nsfw/watcherService.ts b/src/vs/platform/files/node/watcher/nsfw/watcherService.ts index 8b4673d1934..7a32b3e04b1 100644 --- a/src/vs/platform/files/node/watcher/nsfw/watcherService.ts +++ b/src/vs/platform/files/node/watcher/nsfw/watcherService.ts @@ -12,9 +12,10 @@ import { IWatcherRequest } from 'vs/platform/files/node/watcher/nsfw/watcher'; import { getPathFromAmdModule } from 'vs/base/common/amd'; export class FileWatcher extends Disposable { + private static readonly MAX_RESTARTS = 5; - private service: WatcherChannelClient; + private service: WatcherChannelClient | undefined; private isDisposed: boolean; private restartCounter: number; @@ -77,7 +78,7 @@ export class FileWatcher extends Disposable { setVerboseLogging(verboseLogging: boolean): void { this.verboseLogging = verboseLogging; - if (!this.isDisposed) { + if (!this.isDisposed && this.service) { this.service.setVerboseLogging(verboseLogging); } } @@ -89,7 +90,9 @@ export class FileWatcher extends Disposable { setFolders(folders: IWatcherRequest[]): void { this.folders = folders; - this.service.setRoots(folders); + if (this.service) { + this.service.setRoots(folders); + } } dispose(): void { diff --git a/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts b/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts index a03e76ba178..5976158610b 100644 --- a/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts +++ b/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts @@ -37,11 +37,11 @@ export class ChokidarWatcherService implements IWatcherService { private _pollingInterval?: number; private _usePolling?: boolean; - private _verboseLogging: boolean; + private _verboseLogging: boolean | undefined; - private spamCheckStartTime: number; - private spamWarningLogged: boolean; - private enospcErrorLogged: boolean; + private spamCheckStartTime: number | undefined; + private spamWarningLogged: boolean | undefined; + private enospcErrorLogged: boolean | undefined; private _onWatchEvent = new Emitter(); readonly onWatchEvent = this._onWatchEvent.event; @@ -231,7 +231,7 @@ export class ChokidarWatcherService implements IWatcherService { if (undeliveredFileEvents.length === 0) { this.spamWarningLogged = false; this.spamCheckStartTime = now; - } else if (!this.spamWarningLogged && this.spamCheckStartTime + ChokidarWatcherService.EVENT_SPAM_WARNING_THRESHOLD < now) { + } else if (!this.spamWarningLogged && typeof this.spamCheckStartTime === 'number' && this.spamCheckStartTime + ChokidarWatcherService.EVENT_SPAM_WARNING_THRESHOLD < now) { this.spamWarningLogged = true; this.warn(`Watcher is busy catching up with ${undeliveredFileEvents.length} file changes in 60 seconds. Latest changed path is "${event.path}"`); } diff --git a/src/vs/platform/files/node/watcher/unix/watcherService.ts b/src/vs/platform/files/node/watcher/unix/watcherService.ts index 18d55aec1d8..5fd8d4e39aa 100644 --- a/src/vs/platform/files/node/watcher/unix/watcherService.ts +++ b/src/vs/platform/files/node/watcher/unix/watcherService.ts @@ -16,7 +16,7 @@ export class FileWatcher extends Disposable { private isDisposed: boolean; private restartCounter: number; - private service: WatcherChannelClient; + private service: WatcherChannelClient | undefined; constructor( private folders: IWatcherRequest[], @@ -81,13 +81,18 @@ export class FileWatcher extends Disposable { setVerboseLogging(verboseLogging: boolean): void { this.verboseLogging = verboseLogging; - this.service.setVerboseLogging(verboseLogging); + + if (this.service) { + this.service.setVerboseLogging(verboseLogging); + } } setFolders(folders: IWatcherRequest[]): void { this.folders = folders; - this.service.setRoots(folders); + if (this.service) { + this.service.setRoots(folders); + } } dispose(): void { diff --git a/src/vs/platform/history/common/history.ts b/src/vs/platform/history/common/history.ts index d2ea48abad1..2813f2fa9cb 100644 --- a/src/vs/platform/history/common/history.ts +++ b/src/vs/platform/history/common/history.ts @@ -47,7 +47,7 @@ export function isRecentFile(curr: IRecent): curr is IRecentFile { export interface IHistoryMainService { - _serviceBrand: any; + _serviceBrand: undefined; onRecentlyOpenedChange: CommonEvent; diff --git a/src/vs/platform/history/electron-main/historyMainService.ts b/src/vs/platform/history/electron-main/historyMainService.ts index 01e9cd3f4d8..1febed0c265 100644 --- a/src/vs/platform/history/electron-main/historyMainService.ts +++ b/src/vs/platform/history/electron-main/historyMainService.ts @@ -22,7 +22,6 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { getSimpleWorkspaceLabel } from 'vs/platform/label/common/label'; import { toStoreData, restoreRecentlyOpened, RecentlyOpenedStorageData } from 'vs/platform/history/common/historyStorage'; import { exists } from 'vs/base/node/pfs'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { ILifecycleService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMain'; export class HistoryMainService implements IHistoryMainService { @@ -40,7 +39,7 @@ export class HistoryMainService implements IHistoryMainService { private static readonly recentlyOpenedStorageKey = 'openedPathsList'; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _onRecentlyOpenedChange = new Emitter(); readonly onRecentlyOpenedChange: CommonEvent = this._onRecentlyOpenedChange.event; diff --git a/src/vs/platform/instantiation/common/instantiation.ts b/src/vs/platform/instantiation/common/instantiation.ts index 06ff2870345..735c035934c 100644 --- a/src/vs/platform/instantiation/common/instantiation.ts +++ b/src/vs/platform/instantiation/common/instantiation.ts @@ -23,39 +23,39 @@ export namespace _util { // --- interfaces ------ export interface IConstructorSignature0 { - new(...services: { _serviceBrand: any; }[]): T; + new(...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature1 { - new(first: A1, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature2 { - new(first: A1, second: A2, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature3 { - new(first: A1, second: A2, third: A3, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature4 { - new(first: A1, second: A2, third: A3, fourth: A4, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature5 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature6 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature7 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: { _serviceBrand: undefined; }[]): T; } export interface IConstructorSignature8 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: { _serviceBrand: any; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: { _serviceBrand: undefined; }[]): T; } export interface ServicesAccessor { @@ -67,7 +67,7 @@ export const IInstantiationService = createDecorator('ins export interface IInstantiationService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Synchronously creates an instance that is denoted by diff --git a/src/vs/platform/instantiation/common/instantiationService.ts b/src/vs/platform/instantiation/common/instantiationService.ts index 06c2c8ba0f4..c817c55f700 100644 --- a/src/vs/platform/instantiation/common/instantiationService.ts +++ b/src/vs/platform/instantiation/common/instantiationService.ts @@ -28,7 +28,7 @@ class CyclicDependencyError extends Error { export class InstantiationService implements IInstantiationService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _services: ServiceCollection; private readonly _strict: boolean; diff --git a/src/vs/platform/instantiation/test/common/instantiationService.test.ts b/src/vs/platform/instantiation/test/common/instantiationService.test.ts index b93c495abe4..2b30f7d3ee1 100644 --- a/src/vs/platform/instantiation/test/common/instantiationService.test.ts +++ b/src/vs/platform/instantiation/test/common/instantiationService.test.ts @@ -12,48 +12,48 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; let IService1 = createDecorator('service1'); interface IService1 { - _serviceBrand: any; + _serviceBrand: undefined; c: number; } class Service1 implements IService1 { - _serviceBrand: any; + _serviceBrand: undefined; c = 1; } let IService2 = createDecorator('service2'); interface IService2 { - _serviceBrand: any; + _serviceBrand: undefined; d: boolean; } class Service2 implements IService2 { - _serviceBrand: any; + _serviceBrand: undefined; d = true; } let IService3 = createDecorator('service3'); interface IService3 { - _serviceBrand: any; + _serviceBrand: undefined; s: string; } class Service3 implements IService3 { - _serviceBrand: any; + _serviceBrand: undefined; s = 'farboo'; } let IDependentService = createDecorator('dependentService'); interface IDependentService { - _serviceBrand: any; + _serviceBrand: undefined; name: string; } class DependentService implements IDependentService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(@IService1 service: IService1) { assert.equal(service.c, 1); } @@ -116,7 +116,7 @@ class DependentServiceTarget2 { class ServiceLoop1 implements IService1 { - _serviceBrand: any; + _serviceBrand: undefined; c = 1; constructor(@IService2 s: IService2) { @@ -125,7 +125,7 @@ class ServiceLoop1 implements IService1 { } class ServiceLoop2 implements IService2 { - _serviceBrand: any; + _serviceBrand: undefined; d = true; constructor(@IService1 s: IService1) { @@ -364,7 +364,7 @@ suite('Instantiation Service', () => { let serviceInstanceCount = 0; const CtorCounter = class implements Service1 { - _serviceBrand: any; + _serviceBrand: undefined; c = 1; constructor() { serviceInstanceCount += 1; diff --git a/src/vs/platform/ipc/electron-browser/mainProcessService.ts b/src/vs/platform/ipc/electron-browser/mainProcessService.ts index e2f756cc803..c72b1c703d3 100644 --- a/src/vs/platform/ipc/electron-browser/mainProcessService.ts +++ b/src/vs/platform/ipc/electron-browser/mainProcessService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -12,7 +12,7 @@ export const IMainProcessService = createDecorator('mainPro export interface IMainProcessService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; getChannel(channelName: string): IChannel; @@ -21,7 +21,7 @@ export interface IMainProcessService { export class MainProcessService extends Disposable implements IMainProcessService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private mainProcessConnection: Client; diff --git a/src/vs/platform/ipc/electron-browser/sharedProcessService.ts b/src/vs/platform/ipc/electron-browser/sharedProcessService.ts index f01e3f0b5de..dc78e224701 100644 --- a/src/vs/platform/ipc/electron-browser/sharedProcessService.ts +++ b/src/vs/platform/ipc/electron-browser/sharedProcessService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Client } from 'vs/base/parts/ipc/common/ipc.net'; import { connect } from 'vs/base/parts/ipc/node/ipc.net'; import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows'; @@ -14,7 +14,7 @@ export const ISharedProcessService = createDecorator('sha export interface ISharedProcessService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; getChannel(channelName: string): IChannel; @@ -23,7 +23,7 @@ export interface ISharedProcessService { export class SharedProcessService implements ISharedProcessService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private withSharedProcessConnection: Promise>; diff --git a/src/vs/platform/issue/electron-browser/issueService.ts b/src/vs/platform/issue/electron-browser/issueService.ts index 6228ef33671..56068fab19e 100644 --- a/src/vs/platform/issue/electron-browser/issueService.ts +++ b/src/vs/platform/issue/electron-browser/issueService.ts @@ -6,11 +6,10 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { IIssueService, IssueReporterData, ProcessExplorerData } from 'vs/platform/issue/node/issue'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class IssueService implements IIssueService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private channel: IChannel; diff --git a/src/vs/platform/issue/electron-main/issueService.ts b/src/vs/platform/issue/electron-main/issueService.ts index aa31eb1913a..5bea35cbefc 100644 --- a/src/vs/platform/issue/electron-main/issueService.ts +++ b/src/vs/platform/issue/electron-main/issueService.ts @@ -21,7 +21,7 @@ import { listProcesses } from 'vs/base/node/ps'; const DEFAULT_BACKGROUND_COLOR = '#1E1E1E'; export class IssueService implements IIssueService { - _serviceBrand: any; + _serviceBrand: undefined; _issueWindow: BrowserWindow | null = null; _issueParentWindow: BrowserWindow | null = null; _processExplorerWindow: BrowserWindow | null = null; diff --git a/src/vs/platform/issue/node/issue.ts b/src/vs/platform/issue/node/issue.ts index d9d0e1c4492..99b9a3b8565 100644 --- a/src/vs/platform/issue/node/issue.ts +++ b/src/vs/platform/issue/node/issue.ts @@ -87,7 +87,7 @@ export interface ProcessExplorerData extends WindowData { } export interface IIssueService { - _serviceBrand: any; + _serviceBrand: undefined; openReporter(data: IssueReporterData): Promise; openProcessExplorer(data: ProcessExplorerData): Promise; getSystemStatus(): Promise; diff --git a/src/vs/platform/keybinding/common/abstractKeybindingService.ts b/src/vs/platform/keybinding/common/abstractKeybindingService.ts index 0a138fd3639..e3b2a7e7d3b 100644 --- a/src/vs/platform/keybinding/common/abstractKeybindingService.ts +++ b/src/vs/platform/keybinding/common/abstractKeybindingService.ts @@ -24,7 +24,7 @@ interface CurrentChord { } export abstract class AbstractKeybindingService extends Disposable implements IKeybindingService { - public _serviceBrand: any; + public _serviceBrand: undefined; protected readonly _onDidUpdateKeybindings: Emitter = this._register(new Emitter()); get onDidUpdateKeybindings(): Event { diff --git a/src/vs/platform/keybinding/common/keybinding.ts b/src/vs/platform/keybinding/common/keybinding.ts index 57b2f701fce..5ed822fc4dc 100644 --- a/src/vs/platform/keybinding/common/keybinding.ts +++ b/src/vs/platform/keybinding/common/keybinding.ts @@ -41,7 +41,7 @@ export interface IKeyboardEvent { export const IKeybindingService = createDecorator('keybindingService'); export interface IKeybindingService { - _serviceBrand: any; + _serviceBrand: undefined; onDidUpdateKeybindings: Event; diff --git a/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts b/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts index ec4a46372a6..e139fb775c6 100644 --- a/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts +++ b/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts @@ -15,7 +15,6 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding'; import { INotification, INotificationService, IPromptChoice, IPromptOptions, NoOpNotification, IStatusMessageOptions } from 'vs/platform/notification/common/notification'; import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; function createContext(ctx: any) { return { @@ -132,7 +131,7 @@ suite('AbstractKeybindingService', () => { }; let notificationService: INotificationService = { - _serviceBrand: {} as ServiceIdentifier, + _serviceBrand: undefined, notify: (notification: INotification) => { showMessageCalls.push({ sev: notification.severity, message: notification.message }); return new NoOpNotification(); diff --git a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts index 6a318210521..184106d30f7 100644 --- a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts +++ b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts @@ -36,7 +36,7 @@ class MockKeybindingContextKey implements IContextKey { export class MockContextKeyService implements IContextKeyService { - public _serviceBrand: any; + public _serviceBrand: undefined; private _keys = new Map>(); public dispose(): void { @@ -69,7 +69,7 @@ export class MockContextKeyService implements IContextKeyService { } export class MockKeybindingService implements IKeybindingService { - public _serviceBrand: any; + public _serviceBrand: undefined; public get onDidUpdateKeybindings(): Event { return Event.None; diff --git a/src/vs/platform/label/common/label.ts b/src/vs/platform/label/common/label.ts index ffc20e10abb..b2422cfa473 100644 --- a/src/vs/platform/label/common/label.ts +++ b/src/vs/platform/label/common/label.ts @@ -14,13 +14,14 @@ import { isEqualOrParent, basename } from 'vs/base/common/resources'; import { endsWith } from 'vs/base/common/strings'; export interface ILabelService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Gets the human readable label for a uri. * If relative is passed returns a label relative to the workspace root that the uri belongs to. * If noPrefix is passed does not tildify the label and also does not prepand the root name for relative labels in a multi root scenario. */ getUriLabel(resource: URI, options?: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean }): string; + getUriBasenameLabel(resource: URI): string; getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string; getHostLabel(scheme: string, authority?: string): string; getSeparator(scheme: string, authority?: string): '/' | '\\'; diff --git a/src/vs/platform/launch/electron-main/launchService.ts b/src/vs/platform/launch/electron-main/launchService.ts index c9924cf39d5..19e396d6052 100644 --- a/src/vs/platform/launch/electron-main/launchService.ts +++ b/src/vs/platform/launch/electron-main/launchService.ts @@ -8,7 +8,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IURLService } from 'vs/platform/url/common/url'; import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform'; import { ParsedArgs, IEnvironmentService } from 'vs/platform/environment/common/environment'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { OpenContext, IWindowSettings } from 'vs/platform/windows/common/windows'; import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows'; import { whenDeleted } from 'vs/base/node/pfs'; @@ -53,7 +53,7 @@ function parseOpenUrl(args: ParsedArgs): URI[] { } export interface ILaunchService { - _serviceBrand: any; + _serviceBrand: undefined; start(args: ParsedArgs, userEnv: IProcessEnvironment): Promise; getMainProcessId(): Promise; getMainProcessInfo(): Promise; @@ -94,7 +94,7 @@ export class LaunchChannel implements IServerChannel { export class LaunchChannelClient implements ILaunchService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; constructor(private channel: IChannel) { } @@ -121,7 +121,7 @@ export class LaunchChannelClient implements ILaunchService { export class LaunchService implements ILaunchService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; constructor( @ILogService private readonly logService: ILogService, diff --git a/src/vs/platform/layout/browser/layoutService.ts b/src/vs/platform/layout/browser/layoutService.ts index a54ef23a7bb..5b0e5b35b95 100644 --- a/src/vs/platform/layout/browser/layoutService.ts +++ b/src/vs/platform/layout/browser/layoutService.ts @@ -15,7 +15,7 @@ export interface IDimension { export interface ILayoutService { - _serviceBrand: any; + _serviceBrand: undefined; /** * The dimensions of the container. diff --git a/src/vs/platform/lifecycle/browser/lifecycleService.ts b/src/vs/platform/lifecycle/browser/lifecycleService.ts index 79301acb261..22ed39ba7ab 100644 --- a/src/vs/platform/lifecycle/browser/lifecycleService.ts +++ b/src/vs/platform/lifecycle/browser/lifecycleService.ts @@ -3,16 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ShutdownReason, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; +import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle'; import { ILogService } from 'vs/platform/log/common/log'; import { AbstractLifecycleService } from 'vs/platform/lifecycle/common/lifecycleService'; import { localize } from 'vs/nls'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; -import { addDisposableListener, EventType } from 'vs/base/browser/dom'; export class BrowserLifecycleService extends AbstractLifecycleService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; constructor( @ILogService readonly logService: ILogService @@ -23,7 +21,9 @@ export class BrowserLifecycleService extends AbstractLifecycleService { } private registerListeners(): void { - addDisposableListener(window, EventType.BEFORE_UNLOAD, () => this.onBeforeUnload()); + // Note: we cannot change this to window.addEventListener('beforeUnload') + // because it seems that mechanism does not allow for preventing the unload + window.onbeforeunload = () => this.onBeforeUnload(); } private onBeforeUnload(): string | null { diff --git a/src/vs/platform/lifecycle/common/lifecycle.ts b/src/vs/platform/lifecycle/common/lifecycle.ts index afd461859d0..cae9c857fb3 100644 --- a/src/vs/platform/lifecycle/common/lifecycle.ts +++ b/src/vs/platform/lifecycle/common/lifecycle.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Event } from 'vs/base/common/event'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { isThenable } from 'vs/base/common/async'; export const ILifecycleService = createDecorator('lifecycleService'); @@ -123,7 +123,7 @@ export function LifecyclePhaseToString(phase: LifecyclePhase) { */ export interface ILifecycleService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Value indicates how this window got loaded. @@ -167,7 +167,7 @@ export interface ILifecycleService { export const NullLifecycleService: ILifecycleService = { - _serviceBrand: null as any, + _serviceBrand: undefined, onBeforeShutdown: Event.None, onWillShutdown: Event.None, diff --git a/src/vs/platform/lifecycle/common/lifecycleService.ts b/src/vs/platform/lifecycle/common/lifecycleService.ts index 326a1b371b9..ea8b52b2492 100644 --- a/src/vs/platform/lifecycle/common/lifecycleService.ts +++ b/src/vs/platform/lifecycle/common/lifecycleService.ts @@ -9,11 +9,10 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { ILifecycleService, BeforeShutdownEvent, WillShutdownEvent, StartupKind, LifecyclePhase, LifecyclePhaseToString } from 'vs/platform/lifecycle/common/lifecycle'; import { ILogService } from 'vs/platform/log/common/log'; import { mark } from 'vs/base/common/performance'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export abstract class AbstractLifecycleService extends Disposable implements ILifecycleService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; protected readonly _onBeforeShutdown = this._register(new Emitter()); readonly onBeforeShutdown: Event = this._onBeforeShutdown.event; diff --git a/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts b/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts index 7e4fd29a3a6..0146a3b60ac 100644 --- a/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts +++ b/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { toErrorMessage } from 'vs/base/common/errorMessage'; -import { ShutdownReason, StartupKind, handleVetos, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; +import { ShutdownReason, StartupKind, handleVetos } from 'vs/platform/lifecycle/common/lifecycle'; import { IStorageService, StorageScope, WillSaveStateReason } from 'vs/platform/storage/common/storage'; import { ipcRenderer as ipc } from 'electron'; import { IWindowService } from 'vs/platform/windows/common/windows'; @@ -12,13 +12,12 @@ import { ILogService } from 'vs/platform/log/common/log'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { onUnexpectedError } from 'vs/base/common/errors'; import { AbstractLifecycleService } from 'vs/platform/lifecycle/common/lifecycleService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class LifecycleService extends AbstractLifecycleService { private static readonly LAST_SHUTDOWN_REASON_KEY = 'lifecyle.lastShutdownReason'; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private shutdownReason: ShutdownReason; diff --git a/src/vs/platform/lifecycle/electron-main/lifecycleMain.ts b/src/vs/platform/lifecycle/electron-main/lifecycleMain.ts index c44298bc61e..72f2d7c124f 100644 --- a/src/vs/platform/lifecycle/electron-main/lifecycleMain.ts +++ b/src/vs/platform/lifecycle/electron-main/lifecycleMain.ts @@ -7,7 +7,7 @@ import { ipcMain as ipc, app } from 'electron'; import { ILogService } from 'vs/platform/log/common/log'; import { IStateService } from 'vs/platform/state/common/state'; import { Event, Emitter } from 'vs/base/common/event'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ICodeWindow } from 'vs/platform/windows/electron-main/windows'; import { handleVetos } from 'vs/platform/lifecycle/common/lifecycle'; import { isMacintosh, isWindows } from 'vs/base/common/platform'; @@ -40,7 +40,7 @@ export interface ShutdownEvent { export interface ILifecycleService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Will be true if the program was restarted (e.g. due to explicit request or update). @@ -131,7 +131,7 @@ export const enum LifecycleMainPhase { export class LifecycleService extends Disposable implements ILifecycleService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private static readonly QUIT_FROM_RESTART_MARKER = 'quit.from.restart'; // use a marker to find out if the session was restarted @@ -139,10 +139,10 @@ export class LifecycleService extends Disposable implements ILifecycleService { private oneTimeListenerTokenGenerator = 0; private windowCounter = 0; - private pendingQuitPromise: Promise | null; - private pendingQuitPromiseResolve: { (veto: boolean): void } | null; + private pendingQuitPromise: Promise | null = null; + private pendingQuitPromiseResolve: { (veto: boolean): void } | null = null; - private pendingWillShutdownPromise: Promise | null; + private pendingWillShutdownPromise: Promise | null = null; private _quitRequested = false; get quitRequested(): boolean { return this._quitRequested; } diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index 6c5ac488c5f..6dd301cdc5f 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -38,7 +38,7 @@ export const IListService = createDecorator('listService'); export interface IListService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Returns the currently focused list widget if any. @@ -53,7 +53,7 @@ interface IRegisteredList { export class ListService implements IListService { - _serviceBrand: any; + _serviceBrand: undefined; private lists: IRegisteredList[] = []; private _lastFocusedWidget: ListWidget | undefined = undefined; @@ -245,6 +245,7 @@ export class WorkbenchList extends List { private _useAltAsMultipleSelectionModifier: boolean; constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: IListRenderer[], @@ -258,7 +259,7 @@ export class WorkbenchList extends List { const horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : getHorizontalScrollingSetting(configurationService); const [workbenchListOptions, workbenchListOptionsDisposable] = toWorkbenchListOptions(options, configurationService, keybindingService); - super(container, delegate, renderers, + super(user, container, delegate, renderers, { keyboardSupport: false, styleController: new DefaultStyleController(getSharedListStyleSheet()), @@ -326,6 +327,7 @@ export class WorkbenchPagedList extends PagedList { private _useAltAsMultipleSelectionModifier: boolean; constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: IPagedRenderer[], @@ -338,7 +340,7 @@ export class WorkbenchPagedList extends PagedList { ) { const horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : getHorizontalScrollingSetting(configurationService); const [workbenchListOptions, workbenchListOptionsDisposable] = toWorkbenchListOptions(options, configurationService, keybindingService); - super(container, delegate, renderers, + super(user, container, delegate, renderers, { keyboardSupport: false, styleController: new DefaultStyleController(getSharedListStyleSheet()), @@ -785,6 +787,7 @@ export class WorkbenchObjectTree, TFilterData = void> get useAltAsMultipleSelectionModifier(): boolean { return this.internals.useAltAsMultipleSelectionModifier; } constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], @@ -797,7 +800,7 @@ export class WorkbenchObjectTree, TFilterData = void> @IAccessibilityService accessibilityService: IAccessibilityService ) { const { options: treeOptions, getAutomaticKeyboardNavigation, disposable } = workbenchTreeDataPreamble(container, options, contextKeyService, themeService, configurationService, keybindingService, accessibilityService); - super(container, delegate, renderers, treeOptions); + super(user, container, delegate, renderers, treeOptions); this.disposables.push(disposable); this.internals = new WorkbenchTreeInternals(this, treeOptions, getAutomaticKeyboardNavigation, contextKeyService, listService, themeService, configurationService, accessibilityService); this.disposables.push(this.internals); @@ -811,6 +814,7 @@ export class WorkbenchDataTree extends DataTree, renderers: ITreeRenderer[], @@ -824,7 +828,7 @@ export class WorkbenchDataTree extends DataTree extends Async get useAltAsMultipleSelectionModifier(): boolean { return this.internals.useAltAsMultipleSelectionModifier; } constructor( + user: string, container: HTMLElement, delegate: IListVirtualDelegate, renderers: ITreeRenderer[], @@ -851,7 +856,7 @@ export class WorkbenchAsyncDataTree extends Async @IAccessibilityService accessibilityService: IAccessibilityService ) { const { options: treeOptions, getAutomaticKeyboardNavigation, disposable } = workbenchTreeDataPreamble(container, options, contextKeyService, themeService, configurationService, keybindingService, accessibilityService); - super(container, delegate, renderers, dataSource, treeOptions); + super(user, container, delegate, renderers, dataSource, treeOptions); this.disposables.push(disposable); this.internals = new WorkbenchTreeInternals(this, treeOptions, getAutomaticKeyboardNavigation, contextKeyService, listService, themeService, configurationService, accessibilityService); this.disposables.push(this.internals); diff --git a/src/vs/platform/localizations/common/localizations.ts b/src/vs/platform/localizations/common/localizations.ts index 2f70e80f400..4323324d681 100644 --- a/src/vs/platform/localizations/common/localizations.ts +++ b/src/vs/platform/localizations/common/localizations.ts @@ -26,7 +26,7 @@ export const enum LanguageType { export const ILocalizationsService = createDecorator('localizationsService'); export interface ILocalizationsService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidLanguagesChange: Event; getLanguageIds(type?: LanguageType): Promise; diff --git a/src/vs/platform/localizations/electron-browser/localizationsService.ts b/src/vs/platform/localizations/electron-browser/localizationsService.ts index add4dfb2fcf..57e62509c57 100644 --- a/src/vs/platform/localizations/electron-browser/localizationsService.ts +++ b/src/vs/platform/localizations/electron-browser/localizationsService.ts @@ -7,11 +7,10 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { Event } from 'vs/base/common/event'; import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class LocalizationsService implements ILocalizationsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private channel: IChannel; diff --git a/src/vs/platform/localizations/node/localizations.ts b/src/vs/platform/localizations/node/localizations.ts index 2311778a2fa..7f174270880 100644 --- a/src/vs/platform/localizations/node/localizations.ts +++ b/src/vs/platform/localizations/node/localizations.ts @@ -34,7 +34,7 @@ if (product.quality !== 'stable') { export class LocalizationsService extends Disposable implements ILocalizationsService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly cache: LanguagePacksCache; diff --git a/src/vs/platform/log/common/bufferLog.ts b/src/vs/platform/log/common/bufferLog.ts index 67e90d28c2b..bdf382bd1e1 100644 --- a/src/vs/platform/log/common/bufferLog.ts +++ b/src/vs/platform/log/common/bufferLog.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ILogService, LogLevel, AbstractLogService } from 'vs/platform/log/common/log'; +import { ILogService, LogLevel, AbstractLogService, DEFAULT_LOG_LEVEL } from 'vs/platform/log/common/log'; interface ILog { level: LogLevel; @@ -24,12 +24,13 @@ function getLogFunction(logger: ILogService, level: LogLevel): Function { export class BufferLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; private buffer: ILog[] = []; private _logger: ILogService | undefined = undefined; - constructor() { + constructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL) { super(); + this.setLevel(logLevel); this._register(this.onDidChangeLogLevel(level => { if (this._logger) { this._logger.setLevel(level); @@ -86,4 +87,4 @@ export class BufferLogService extends AbstractLogService implements ILogService this._logger.dispose(); } } -} \ No newline at end of file +} diff --git a/src/vs/platform/log/common/fileLogService.ts b/src/vs/platform/log/common/fileLogService.ts index 01859d4f7b2..f9b600063bf 100644 --- a/src/vs/platform/log/common/fileLogService.ts +++ b/src/vs/platform/log/common/fileLogService.ts @@ -8,12 +8,16 @@ import { URI } from 'vs/base/common/uri'; import { IFileService } from 'vs/platform/files/common/files'; import { Queue } from 'vs/base/common/async'; import { VSBuffer } from 'vs/base/common/buffer'; +import { dirname, joinPath, basename } from 'vs/base/common/resources'; + +const MAX_FILE_SIZE = 1024 * 1024 * 5; export class FileLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly queue: Queue; + private backupIndex: number = 1; constructor( private readonly name: string, @@ -81,6 +85,10 @@ export class FileLogService extends AbstractLogService implements ILogService { private _log(level: LogLevel, message: string): void { this.queue.queue(async () => { let content = await this.loadContent(); + if (content.length > MAX_FILE_SIZE) { + await this.fileService.writeFile(this.getBackupResource(), VSBuffer.fromString(content)); + content = ''; + } content += `[${this.getCurrentTimestamp()}] [${this.name}] [${this.stringifyLogLevel(level)}] ${message}\n`; await this.fileService.writeFile(this.resource, VSBuffer.fromString(content)); }); @@ -93,6 +101,11 @@ export class FileLogService extends AbstractLogService implements ILogService { return `${currentTime.getFullYear()}-${toTwoDigits(currentTime.getMonth() + 1)}-${toTwoDigits(currentTime.getDate())} ${toTwoDigits(currentTime.getHours())}:${toTwoDigits(currentTime.getMinutes())}:${toTwoDigits(currentTime.getSeconds())}.${toThreeDigits(currentTime.getMilliseconds())}`; } + private getBackupResource(): URI { + this.backupIndex = this.backupIndex > 5 ? 1 : this.backupIndex; + return joinPath(dirname(this.resource), `${basename(this.resource)}_${this.backupIndex++}`); + } + private async loadContent(): Promise { try { const content = await this.fileService.readFile(this.resource); diff --git a/src/vs/platform/log/common/log.ts b/src/vs/platform/log/common/log.ts index 8b9fea5e257..5e6b7300c49 100644 --- a/src/vs/platform/log/common/log.ts +++ b/src/vs/platform/log/common/log.ts @@ -28,7 +28,7 @@ export enum LogLevel { export const DEFAULT_LOG_LEVEL: LogLevel = LogLevel.Info; export interface ILogService extends IDisposable { - _serviceBrand: any; + _serviceBrand: undefined; onDidChangeLogLevel: Event; getLevel(): LogLevel; @@ -61,7 +61,7 @@ export abstract class AbstractLogService extends Disposable { export class ConsoleLogMainService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; private useColors: boolean; constructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL) { @@ -137,7 +137,7 @@ export class ConsoleLogMainService extends AbstractLogService implements ILogSer export class ConsoleLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL) { super(); @@ -184,7 +184,7 @@ export class ConsoleLogService extends AbstractLogService implements ILogService } export class MultiplexLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private readonly logServices: ReadonlyArray) { super(); @@ -244,7 +244,7 @@ export class MultiplexLogService extends AbstractLogService implements ILogServi } export class DelegatedLogService extends Disposable implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private logService: ILogService) { super(); @@ -289,7 +289,7 @@ export class DelegatedLogService extends Disposable implements ILogService { } export class NullLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidChangeLogLevel: Event = new Emitter().event; setLevel(level: LogLevel): void { } getLevel(): LogLevel { return LogLevel.Info; } diff --git a/src/vs/platform/log/common/logIpc.ts b/src/vs/platform/log/common/logIpc.ts index 9f68b645b66..5f631b8b9d1 100644 --- a/src/vs/platform/log/common/logIpc.ts +++ b/src/vs/platform/log/common/logIpc.ts @@ -46,7 +46,7 @@ export class LogLevelSetterChannelClient { } export class FollowerLogService extends DelegatedLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private master: LogLevelSetterChannelClient, logService: ILogService) { super(logService); diff --git a/src/vs/platform/log/node/spdlogService.ts b/src/vs/platform/log/node/spdlogService.ts index 9ad9cc4dd86..cd482c70a83 100644 --- a/src/vs/platform/log/node/spdlogService.ts +++ b/src/vs/platform/log/node/spdlogService.ts @@ -44,7 +44,7 @@ function log(logger: spdlog.RotatingLogger, level: LogLevel, message: string): v export class SpdLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; private buffer: ILog[] = []; private _loggerCreationPromise: Promise | undefined = undefined; diff --git a/src/vs/platform/markers/common/markerService.ts b/src/vs/platform/markers/common/markerService.ts index 57e55246949..3959296f926 100644 --- a/src/vs/platform/markers/common/markerService.ts +++ b/src/vs/platform/markers/common/markerService.ts @@ -121,7 +121,7 @@ class MarkerStats implements MarkerStatistics { export class MarkerService implements IMarkerService { - _serviceBrand: any; + _serviceBrand: undefined; private _onMarkerChanged = new Emitter(); private _onMarkerChangedEvent: Event = Event.debounce(this._onMarkerChanged.event, MarkerService._debouncer, 0); diff --git a/src/vs/platform/markers/common/markers.ts b/src/vs/platform/markers/common/markers.ts index 26d05bc8c2e..e0bfe097ef9 100644 --- a/src/vs/platform/markers/common/markers.ts +++ b/src/vs/platform/markers/common/markers.ts @@ -10,7 +10,7 @@ import { localize } from 'vs/nls'; import Severity from 'vs/base/common/severity'; export interface IMarkerService { - _serviceBrand: any; + _serviceBrand: undefined; getStatistics(): MarkerStatistics; diff --git a/src/vs/platform/menubar/electron-browser/menubarService.ts b/src/vs/platform/menubar/electron-browser/menubarService.ts index 336330d1e6d..212649c4ca1 100644 --- a/src/vs/platform/menubar/electron-browser/menubarService.ts +++ b/src/vs/platform/menubar/electron-browser/menubarService.ts @@ -6,11 +6,10 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { IMenubarService, IMenubarData } from 'vs/platform/menubar/node/menubar'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class MenubarService implements IMenubarService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private channel: IChannel; diff --git a/src/vs/platform/menubar/electron-main/menubar.ts b/src/vs/platform/menubar/electron-main/menubar.ts index ff9d06a636b..af656b24009 100644 --- a/src/vs/platform/menubar/electron-main/menubar.ts +++ b/src/vs/platform/menubar/electron-main/menubar.ts @@ -13,7 +13,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IUpdateService, StateType } from 'vs/platform/update/common/update'; import product from 'vs/platform/product/node/product'; import { RunOnceScheduler } from 'vs/base/common/async'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { ILogService } from 'vs/platform/log/common/log'; import { mnemonicMenuLabel as baseMnemonicLabel } from 'vs/base/common/labels'; import { IWindowsMainService, IWindowsCountChangedEvent } from 'vs/platform/windows/electron-main/windows'; import { IHistoryMainService } from 'vs/platform/history/common/history'; @@ -62,14 +62,14 @@ export class Menubar { constructor( @IUpdateService private readonly updateService: IUpdateService, - @IInstantiationService instantiationService: IInstantiationService, @IConfigurationService private readonly configurationService: IConfigurationService, @IWindowsMainService private readonly windowsMainService: IWindowsMainService, @IEnvironmentService private readonly environmentService: IEnvironmentService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IHistoryMainService private readonly historyMainService: IHistoryMainService, @IStateService private readonly stateService: IStateService, - @ILifecycleService private readonly lifecycleService: ILifecycleService + @ILifecycleService private readonly lifecycleService: ILifecycleService, + @ILogService private readonly logService: ILogService ) { this.menuUpdater = new RunOnceScheduler(() => this.doUpdateMenu(), 0); @@ -714,6 +714,8 @@ export class Menubar { } if (activeWindow) { + this.logService.trace('menubar#runActionInRenderer', invocation); + if (isMacintosh && !this.environmentService.isBuilt && !activeWindow.isReady) { if ((invocation.type === 'commandId' && invocation.commandId === 'workbench.action.toggleDevTools') || (invocation.type !== 'commandId' && invocation.userSettingsLabel === 'alt+cmd+i')) { // prevent this action from running twice on macOS (https://github.com/Microsoft/vscode/issues/62719) @@ -724,10 +726,12 @@ export class Menubar { } if (invocation.type === 'commandId') { - this.windowsMainService.sendToFocused('vscode:runAction', { id: invocation.commandId, from: 'menu' } as IRunActionInWindowRequest); + activeWindow.sendWhenReady('vscode:runAction', { id: invocation.commandId, from: 'menu' } as IRunActionInWindowRequest); } else { - this.windowsMainService.sendToFocused('vscode:runKeybinding', { userSettingsLabel: invocation.userSettingsLabel } as IRunKeybindingInWindowRequest); + activeWindow.sendWhenReady('vscode:runKeybinding', { userSettingsLabel: invocation.userSettingsLabel } as IRunKeybindingInWindowRequest); } + } else { + this.logService.trace('menubar#runActionInRenderer: no active window found', invocation); } } diff --git a/src/vs/platform/menubar/electron-main/menubarService.ts b/src/vs/platform/menubar/electron-main/menubarService.ts index f7abf2ee9f2..8763b9d2330 100644 --- a/src/vs/platform/menubar/electron-main/menubarService.ts +++ b/src/vs/platform/menubar/electron-main/menubarService.ts @@ -9,7 +9,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; export class MenubarService implements IMenubarService { - _serviceBrand: any; + _serviceBrand: undefined; private _menubar: Menubar; diff --git a/src/vs/platform/menubar/node/menubar.ts b/src/vs/platform/menubar/node/menubar.ts index 27294cbb3aa..db246d1b487 100644 --- a/src/vs/platform/menubar/node/menubar.ts +++ b/src/vs/platform/menubar/node/menubar.ts @@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri'; export const IMenubarService = createDecorator('menubarService'); export interface IMenubarService { - _serviceBrand: any; + _serviceBrand: undefined; updateMenubar(windowId: number, menuData: IMenubarData): Promise; } diff --git a/src/vs/platform/notification/common/notification.ts b/src/vs/platform/notification/common/notification.ts index 23b14135edb..b16fe281725 100644 --- a/src/vs/platform/notification/common/notification.ts +++ b/src/vs/platform/notification/common/notification.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import BaseSeverity from 'vs/base/common/severity'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IAction } from 'vs/base/common/actions'; import { Event, Emitter } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; @@ -234,7 +234,7 @@ export interface IStatusMessageOptions { */ export interface INotificationService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Show the provided notification to the user. The returned `INotificationHandle` diff --git a/src/vs/platform/notification/test/common/testNotificationService.ts b/src/vs/platform/notification/test/common/testNotificationService.ts index 933469987ed..b4c4d4000fd 100644 --- a/src/vs/platform/notification/test/common/testNotificationService.ts +++ b/src/vs/platform/notification/test/common/testNotificationService.ts @@ -8,7 +8,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; export class TestNotificationService implements INotificationService { - _serviceBrand: any; + _serviceBrand: undefined; private static readonly NO_OP: INotificationHandle = new NoOpNotification(); diff --git a/src/vs/platform/opener/common/opener.ts b/src/vs/platform/opener/common/opener.ts index 8c92cb2d1bd..8563f3fa2af 100644 --- a/src/vs/platform/opener/common/opener.ts +++ b/src/vs/platform/opener/common/opener.ts @@ -20,7 +20,7 @@ export interface IValidator { export interface IOpenerService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Register a participant that can handle the open() call. diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index 0a3b1f75c89..8041912d93f 100644 --- a/src/vs/platform/product/common/product.ts +++ b/src/vs/platform/product/common/product.ts @@ -85,9 +85,10 @@ export interface IProductConfiguration { readonly 'linux-x64': string; readonly 'darwin': string; }; - readonly logUploaderUrl: string; readonly portable?: string; readonly uiExtensions?: readonly string[]; + readonly msftInternalDomains?: string[]; + readonly linkProtectionTrustedDomains?: readonly string[]; } export interface IExeBasedExtensionTip { diff --git a/src/vs/platform/progress/common/progress.ts b/src/vs/platform/progress/common/progress.ts index 4308c72ce89..b629e2fe837 100644 --- a/src/vs/platform/progress/common/progress.ts +++ b/src/vs/platform/progress/common/progress.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; import { toDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle'; import { IAction } from 'vs/base/common/actions'; @@ -15,7 +15,7 @@ export const IProgressService = createDecorator('progressServi */ export interface IProgressService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; withProgress(options: IProgressOptions | IProgressNotificationOptions | IProgressCompositeOptions, task: (progress: IProgress) => Promise, onDidCancel?: () => void): Promise; } @@ -50,6 +50,7 @@ export interface IProgressOptions { source?: string; total?: number; cancellable?: boolean; + buttons?: string[]; } export interface IProgressNotificationOptions extends IProgressOptions { @@ -173,5 +174,5 @@ export const IEditorProgressService = createDecorator('e */ export interface IEditorProgressService extends IProgressIndicator { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; } diff --git a/src/vs/platform/quickOpen/common/quickOpen.ts b/src/vs/platform/quickOpen/common/quickOpen.ts index a5232810f36..056f1b6e00d 100644 --- a/src/vs/platform/quickOpen/common/quickOpen.ts +++ b/src/vs/platform/quickOpen/common/quickOpen.ts @@ -17,7 +17,7 @@ export const IQuickOpenService = createDecorator('quickOpenSe export interface IQuickOpenService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Asks the container to show the quick open control with the optional prefix set. If the optional parameter diff --git a/src/vs/platform/quickinput/common/quickInput.ts b/src/vs/platform/quickinput/common/quickInput.ts index c7ec82def00..80cad64b5dc 100644 --- a/src/vs/platform/quickinput/common/quickInput.ts +++ b/src/vs/platform/quickinput/common/quickInput.ts @@ -257,7 +257,7 @@ export type QuickPickInput = T | IQuickPickSeparator; export interface IQuickInputService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Opens the quick input box for selecting items and returns a promise with the user selected item(s) if any. diff --git a/src/vs/platform/remote/browser/remoteAuthorityResolverService.ts b/src/vs/platform/remote/browser/remoteAuthorityResolverService.ts index 3f8958b7235..17bded22f29 100644 --- a/src/vs/platform/remote/browser/remoteAuthorityResolverService.ts +++ b/src/vs/platform/remote/browser/remoteAuthorityResolverService.ts @@ -8,7 +8,7 @@ import { RemoteAuthorities } from 'vs/base/common/network'; export class RemoteAuthorityResolverService implements IRemoteAuthorityResolverService { - _serviceBrand: any; + _serviceBrand: undefined; constructor() { } diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts index 5653a6912b2..b526d149fa3 100644 --- a/src/vs/platform/remote/common/remoteAgentConnection.ts +++ b/src/vs/platform/remote/common/remoteAgentConnection.ts @@ -10,8 +10,10 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { VSBuffer } from 'vs/base/common/buffer'; import { Emitter } from 'vs/base/common/event'; import { RemoteAuthorityResolverError } from 'vs/platform/remote/common/remoteAuthorityResolver'; -import { isPromiseCanceledError } from 'vs/base/common/errors'; +import { isPromiseCanceledError, onUnexpectedError } from 'vs/base/common/errors'; import { ISignService } from 'vs/platform/sign/common/sign'; +import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; +import { ILogService } from 'vs/platform/log/common/log'; export const enum ConnectionType { Management = 1, @@ -19,6 +21,17 @@ export const enum ConnectionType { Tunnel = 3, } +function connectionTypeToString(connectionType: ConnectionType): string { + switch (connectionType) { + case ConnectionType.Management: + return 'Management'; + case ConnectionType.ExtensionHost: + return 'ExtensionHost'; + case ConnectionType.Tunnel: + return 'Tunnel'; + } +} + export interface AuthRequest { type: 'auth'; auth: string; @@ -57,6 +70,7 @@ interface ISimpleConnectionOptions { reconnectionProtocol: PersistentProtocol | null; socketFactory: ISocketFactory; signService: ISignService; + logService: ILogService; } export interface IConnectCallback { @@ -67,29 +81,46 @@ export interface ISocketFactory { connect(host: string, port: number, query: string, callback: IConnectCallback): void; } -async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptions, connectionType: ConnectionType, args: any | undefined): Promise { - const protocol = await new Promise((c, e) => { +async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptions, connectionType: ConnectionType, args: any | undefined): Promise<{ protocol: PersistentProtocol; ownsProtocol: boolean; }> { + const logPrefix = connectLogPrefix(options, connectionType); + const { protocol, ownsProtocol } = await new Promise<{ protocol: PersistentProtocol; ownsProtocol: boolean; }>((c, e) => { + options.logService.trace(`${logPrefix} 1/6. invoking socketFactory.connect().`); options.socketFactory.connect( options.host, options.port, `reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, (err: any, socket: ISocket) => { if (err) { + options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`); + options.logService.error(err); e(err); return; } + options.logService.trace(`${logPrefix} 2/6. socketFactory.connect() was successful.`); if (options.reconnectionProtocol) { options.reconnectionProtocol.beginAcceptReconnection(socket, null); - c(options.reconnectionProtocol); + c({ protocol: options.reconnectionProtocol, ownsProtocol: false }); } else { - c(new PersistentProtocol(socket, null)); + c({ protocol: new PersistentProtocol(socket, null), ownsProtocol: true }); } } ); }); - return new Promise((c, e) => { + return new Promise<{ protocol: PersistentProtocol; ownsProtocol: boolean; }>((c, e) => { + + const errorTimeoutToken = setTimeout(() => { + const error: any = new Error('handshake timeout'); + error.code = 'ETIMEDOUT'; + error.syscall = 'connect'; + options.logService.error(`${logPrefix} the handshake took longer than 10 seconds. Error:`); + options.logService.error(error); + if (ownsProtocol) { + safeDisposeProtocolAndSocket(protocol); + } + e(error); + }, 10000); const messageRegistration = protocol.onControlMessage(async raw => { const msg = JSON.parse(raw.toString()); @@ -98,11 +129,16 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio const error = getErrorFromMessage(msg); if (error) { + options.logService.error(`${logPrefix} received error control message when negotiating connection. Error:`); + options.logService.error(error); + if (ownsProtocol) { + safeDisposeProtocolAndSocket(protocol); + } return e(error); } if (msg.type === 'sign') { - + options.logService.trace(`${logPrefix} 4/6. received SignRequest control message.`); const signed = await options.signService.sign(msg.data); const connTypeRequest: ConnectionTypeRequest = { type: 'connectionType', @@ -113,17 +149,22 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio if (args) { connTypeRequest.args = args; } + options.logService.trace(`${logPrefix} 5/6. sending ConnectionTypeRequest control message.`); protocol.sendControl(VSBuffer.fromString(JSON.stringify(connTypeRequest))); - c(protocol); + clearTimeout(errorTimeoutToken); + c({ protocol, ownsProtocol }); } else { - e(new Error('handshake error')); + const error = new Error('handshake error'); + options.logService.error(`${logPrefix} received unexpected control message. Error:`); + options.logService.error(error); + if (ownsProtocol) { + safeDisposeProtocolAndSocket(protocol); + } + e(error); } }); - setTimeout(() => { - e(new Error('handshake timeout')); - }, 2000); - + options.logService.trace(`${logPrefix} 3/6. sending AuthRequest control message.`); // TODO@vs-remote: use real nonce here const authRequest: AuthRequest = { type: 'auth', @@ -137,24 +178,37 @@ interface IManagementConnectionResult { protocol: PersistentProtocol; } -async function doConnectRemoteAgentManagement(options: ISimpleConnectionOptions): Promise { - const protocol = await connectToRemoteExtensionHostAgent(options, ConnectionType.Management, undefined); - return new Promise((c, e) => { +async function connectToRemoteExtensionHostAgentAndReadOneMessage(options: ISimpleConnectionOptions, connectionType: ConnectionType, args: any | undefined): Promise<{ protocol: PersistentProtocol; firstMessage: any }> { + const startTime = Date.now(); + const logPrefix = connectLogPrefix(options, connectionType); + const { protocol, ownsProtocol } = await connectToRemoteExtensionHostAgent(options, connectionType, args); + return new Promise<{ protocol: PersistentProtocol; firstMessage: any }>((c, e) => { const registration = protocol.onControlMessage(raw => { registration.dispose(); const msg = JSON.parse(raw.toString()); const error = getErrorFromMessage(msg); if (error) { + options.logService.error(`${logPrefix} received error control message when negotiating connection. Error:`); + options.logService.error(error); + if (ownsProtocol) { + safeDisposeProtocolAndSocket(protocol); + } return e(error); } if (options.reconnectionProtocol) { options.reconnectionProtocol.endAcceptReconnection(); } - c({ protocol }); + options.logService.trace(`${logPrefix} 6/6. handshake finished, connection is up and running after ${logElapsed(startTime)}!`); + c({ protocol, firstMessage: msg }); }); }); } +async function doConnectRemoteAgentManagement(options: ISimpleConnectionOptions): Promise { + const { protocol } = await connectToRemoteExtensionHostAgentAndReadOneMessage(options, ConnectionType.Management, undefined); + return { protocol }; +} + export interface IRemoteExtensionHostStartParams { language: string; debugId?: string; @@ -169,22 +223,9 @@ interface IExtensionHostConnectionResult { } async function doConnectRemoteAgentExtensionHost(options: ISimpleConnectionOptions, startArguments: IRemoteExtensionHostStartParams): Promise { - const protocol = await connectToRemoteExtensionHostAgent(options, ConnectionType.ExtensionHost, startArguments); - return new Promise((c, e) => { - const registration = protocol.onControlMessage(raw => { - registration.dispose(); - const msg = JSON.parse(raw.toString()); - const error = getErrorFromMessage(msg); - if (error) { - return e(error); - } - const debugPort = msg && msg.debugPort; - if (options.reconnectionProtocol) { - options.reconnectionProtocol.endAcceptReconnection(); - } - c({ protocol, debugPort }); - }); - }); + const { protocol, firstMessage } = await connectToRemoteExtensionHostAgentAndReadOneMessage(options, ConnectionType.ExtensionHost, startArguments); + const debugPort = firstMessage && firstMessage.debugPort; + return { protocol, debugPort }; } export interface ITunnelConnectionStartParams { @@ -192,7 +233,10 @@ export interface ITunnelConnectionStartParams { } async function doConnectRemoteAgentTunnel(options: ISimpleConnectionOptions, startParams: ITunnelConnectionStartParams): Promise { - const protocol = await connectToRemoteExtensionHostAgent(options, ConnectionType.Tunnel, startParams); + const startTime = Date.now(); + const logPrefix = connectLogPrefix(options, ConnectionType.Tunnel); + const { protocol } = await connectToRemoteExtensionHostAgent(options, ConnectionType.Tunnel, startParams); + options.logService.trace(`${logPrefix} 6/6. handshake finished, connection is up and running after ${logElapsed(startTime)}!`); return protocol; } @@ -201,6 +245,7 @@ export interface IConnectionOptions { socketFactory: ISocketFactory; addressProvider: IAddressProvider; signService: ISignService; + logService: ILogService; } async function resolveConnectionOptions(options: IConnectionOptions, reconnectionToken: string, reconnectionProtocol: PersistentProtocol | null): Promise { @@ -212,7 +257,8 @@ async function resolveConnectionOptions(options: IConnectionOptions, reconnectio reconnectionToken: reconnectionToken, reconnectionProtocol: reconnectionProtocol, socketFactory: options.socketFactory, - signService: options.signService + signService: options.signService, + logService: options.logService }; } @@ -226,28 +272,48 @@ export interface IAddressProvider { } export async function connectRemoteAgentManagement(options: IConnectionOptions, remoteAuthority: string, clientId: string): Promise { - const reconnectionToken = generateUuid(); - const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null); - const { protocol } = await doConnectRemoteAgentManagement(simpleOptions); - return new ManagementPersistentConnection(options, remoteAuthority, clientId, reconnectionToken, protocol); + try { + const reconnectionToken = generateUuid(); + const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null); + const { protocol } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentManagement(simpleOptions), 30 * 1000 /*30s*/); + return new ManagementPersistentConnection(options, remoteAuthority, clientId, reconnectionToken, protocol); + } catch (err) { + options.logService.error(`[remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:`); + options.logService.error(err); + PersistentConnection.triggerPermanentFailure(); + throw err; + } } export async function connectRemoteAgentExtensionHost(options: IConnectionOptions, startArguments: IRemoteExtensionHostStartParams): Promise { - const reconnectionToken = generateUuid(); - const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null); - const { protocol, debugPort } = await doConnectRemoteAgentExtensionHost(simpleOptions, startArguments); - return new ExtensionHostPersistentConnection(options, startArguments, reconnectionToken, protocol, debugPort); + try { + const reconnectionToken = generateUuid(); + const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null); + const { protocol, debugPort } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentExtensionHost(simpleOptions, startArguments), 30 * 1000 /*30s*/); + return new ExtensionHostPersistentConnection(options, startArguments, reconnectionToken, protocol, debugPort); + } catch (err) { + options.logService.error(`[remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:`); + options.logService.error(err); + PersistentConnection.triggerPermanentFailure(); + throw err; + } } export async function connectRemoteAgentTunnel(options: IConnectionOptions, tunnelRemotePort: number): Promise { const simpleOptions = await resolveConnectionOptions(options, generateUuid(), null); - const protocol = await doConnectRemoteAgentTunnel(simpleOptions, { port: tunnelRemotePort }); + const protocol = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentTunnel(simpleOptions, { port: tunnelRemotePort }), 30 * 1000 /*30s*/); return protocol; } -function sleep(seconds: number): Promise { - return new Promise((resolve, reject) => { - setTimeout(resolve, seconds * 1000); +function sleep(seconds: number): CancelablePromise { + return createCancelablePromise(token => { + return new Promise((resolve, reject) => { + const timeout = setTimeout(resolve, seconds * 1000); + token.onCancellationRequested(() => { + clearTimeout(timeout); + resolve(); + }); + }); }); } @@ -264,8 +330,13 @@ export class ConnectionLostEvent { export class ReconnectionWaitEvent { public readonly type = PersistentConnectionEventType.ReconnectionWait; constructor( - public readonly durationSeconds: number + public readonly durationSeconds: number, + private readonly cancellableTimer: CancelablePromise ) { } + + public skipWait(): void { + this.cancellableTimer.cancel(); + } } export class ReconnectionRunningEvent { public readonly type = PersistentConnectionEventType.ReconnectionRunning; @@ -280,6 +351,13 @@ export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent abstract class PersistentConnection extends Disposable { + public static triggerPermanentFailure(): void { + this._permanentFailure = true; + this._instances.forEach(instance => instance._gotoPermanentFailure()); + } + private static _permanentFailure: boolean = false; + private static _instances: PersistentConnection[] = []; + private readonly _onDidStateChange = this._register(new Emitter()); public readonly onDidStateChange = this._onDidStateChange.event; @@ -288,20 +366,24 @@ abstract class PersistentConnection extends Disposable { public readonly protocol: PersistentProtocol; private _isReconnecting: boolean; - private _permanentFailure: boolean; - constructor(options: IConnectionOptions, reconnectionToken: string, protocol: PersistentProtocol) { + constructor(private readonly _connectionType: ConnectionType, options: IConnectionOptions, reconnectionToken: string, protocol: PersistentProtocol) { super(); this._options = options; this.reconnectionToken = reconnectionToken; this.protocol = protocol; this._isReconnecting = false; - this._permanentFailure = false; this._onDidStateChange.fire(new ConnectionGainEvent()); this._register(protocol.onSocketClose(() => this._beginReconnecting())); this._register(protocol.onSocketTimeout(() => this._beginReconnecting())); + + PersistentConnection._instances.push(this); + + if (PersistentConnection._permanentFailure) { + this._gotoPermanentFailure(); + } } private async _beginReconnecting(): Promise { @@ -318,10 +400,12 @@ abstract class PersistentConnection extends Disposable { } private async _runReconnectingLoop(): Promise { - if (this._permanentFailure) { + if (PersistentConnection._permanentFailure) { // no more attempts! return; } + const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true); + this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`); this._onDidStateChange.fire(new ConnectionLostEvent()); const TIMES = [5, 5, 10, 10, 10, 10, 10, 30]; const disconnectStartTime = Date.now(); @@ -330,58 +414,71 @@ abstract class PersistentConnection extends Disposable { attempt++; const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]); try { - this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime)); - await sleep(waitTime); + const sleepPromise = sleep(waitTime); + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise)); + + this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`); + try { + await sleepPromise; + } catch { } // User canceled timer + + if (PersistentConnection._permanentFailure) { + this._options.logService.error(`${logPrefix} permanent failure occurred while running the reconnecting loop.`); + break; + } // connection was lost, let's try to re-establish it this._onDidStateChange.fire(new ReconnectionRunningEvent()); + this._options.logService.info(`${logPrefix} resolving connection...`); const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol); - await connectWithTimeLimit(this._reconnect(simpleOptions), 30 * 1000 /*30s*/); + this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`); + await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), 30 * 1000 /*30s*/); + this._options.logService.info(`${logPrefix} reconnected!`); this._onDidStateChange.fire(new ConnectionGainEvent()); break; } catch (err) { if (err.code === 'VSCODE_CONNECTION_ERROR') { - console.error(`A permanent connection error occurred`); - console.error(err); - this._permanentFailure = true; - this._onDidStateChange.fire(new ReconnectionPermanentFailureEvent()); - this.protocol.acceptDisconnect(); + this._options.logService.error(`${logPrefix} A permanent error occurred in the reconnecting loop! Will give up now! Error:`); + this._options.logService.error(err); + PersistentConnection.triggerPermanentFailure(); break; } if (Date.now() - disconnectStartTime > ProtocolConstants.ReconnectionGraceTime) { - console.error(`Giving up after reconnection grace time has expired!`); - this._permanentFailure = true; - this._onDidStateChange.fire(new ReconnectionPermanentFailureEvent()); - this.protocol.acceptDisconnect(); + this._options.logService.error(`${logPrefix} An error occurred while reconnecting, but it will be treated as a permanent error because the reconnection grace time has expired! Will give up now! Error:`); + this._options.logService.error(err); + PersistentConnection.triggerPermanentFailure(); break; } if (RemoteAuthorityResolverError.isTemporarilyNotAvailable(err)) { - console.warn(`A temporarily not available error occured while trying to reconnect:`); - console.warn(err); + this._options.logService.info(`${logPrefix} A temporarily not available error occured while trying to reconnect, will try again...`); + this._options.logService.trace(err); // try again! continue; } if ((err.code === 'ETIMEDOUT' || err.code === 'ENETUNREACH' || err.code === 'ECONNREFUSED' || err.code === 'ECONNRESET') && err.syscall === 'connect') { - console.warn(`A connect error occured while trying to reconnect:`); - console.warn(err); + this._options.logService.info(`${logPrefix} A network error occured while trying to reconnect, will try again...`); + this._options.logService.trace(err); // try again! continue; } if (isPromiseCanceledError(err)) { - console.warn(`A cancel error occured while trying to reconnect:`); - console.warn(err); + this._options.logService.info(`${logPrefix} A promise cancelation error occured while trying to reconnect, will try again...`); + this._options.logService.trace(err); // try again! continue; } - console.error(`An error occured while trying to reconnect:`); - console.error(err); - this._permanentFailure = true; - this._onDidStateChange.fire(new ReconnectionPermanentFailureEvent()); - this.protocol.acceptDisconnect(); + this._options.logService.error(`${logPrefix} An unknown error occured while trying to reconnect, since this is an unknown case, it will be treated as a permanent error! Will give up now! Error:`); + this._options.logService.error(err); + PersistentConnection.triggerPermanentFailure(); break; } - } while (!this._permanentFailure); + } while (!PersistentConnection._permanentFailure); + } + + private _gotoPermanentFailure(): void { + this._onDidStateChange.fire(new ReconnectionPermanentFailureEvent()); + safeDisposeProtocolAndSocket(this.protocol); } protected abstract _reconnect(options: ISimpleConnectionOptions): Promise; @@ -392,7 +489,7 @@ export class ManagementPersistentConnection extends PersistentConnection { public readonly client: Client; constructor(options: IConnectionOptions, remoteAuthority: string, clientId: string, reconnectionToken: string, protocol: PersistentProtocol) { - super(options, reconnectionToken, protocol); + super(ConnectionType.Management, options, reconnectionToken, protocol); this.client = this._register(new Client(protocol, { remoteAuthority: remoteAuthority, clientId: clientId @@ -410,7 +507,7 @@ export class ExtensionHostPersistentConnection extends PersistentConnection { public readonly debugPort: number | undefined; constructor(options: IConnectionOptions, startArguments: IRemoteExtensionHostStartParams, reconnectionToken: string, protocol: PersistentProtocol, debugPort: number | undefined) { - super(options, reconnectionToken, protocol); + super(ConnectionType.ExtensionHost, options, reconnectionToken, protocol); this._startArguments = startArguments; this.debugPort = debugPort; } @@ -420,17 +517,19 @@ export class ExtensionHostPersistentConnection extends PersistentConnection { } } -function connectWithTimeLimit(p: Promise, timeLimit: number): Promise { - return new Promise((resolve, reject) => { +function connectWithTimeLimit(logService: ILogService, p: Promise, timeLimit: number): Promise { + return new Promise((resolve, reject) => { let timeout = setTimeout(() => { const err: any = new Error('Time limit reached'); err.code = 'ETIMEDOUT'; err.syscall = 'connect'; + logService.error(`[remote-connection] The time limit has been reached for a connection. Error:`); + logService.error(err); reject(err); }, timeLimit); - p.then(() => { + p.then((value) => { clearTimeout(timeout); - resolve(); + resolve(value); }, (err) => { clearTimeout(timeout); reject(err); @@ -438,6 +537,17 @@ function connectWithTimeLimit(p: Promise, timeLimit: number): Promise; diff --git a/src/vs/platform/remote/common/tunnel.ts b/src/vs/platform/remote/common/tunnel.ts index d92f3e45d91..9fdba618115 100644 --- a/src/vs/platform/remote/common/tunnel.ts +++ b/src/vs/platform/remote/common/tunnel.ts @@ -15,7 +15,7 @@ export interface RemoteTunnel { } export interface ITunnelService { - _serviceBrand: any; + _serviceBrand: undefined; openTunnel(remotePort: number): Promise | undefined; } diff --git a/src/vs/platform/remote/electron-browser/remoteAuthorityResolverService.ts b/src/vs/platform/remote/electron-browser/remoteAuthorityResolverService.ts index 45ad072f2eb..006ce16ca33 100644 --- a/src/vs/platform/remote/electron-browser/remoteAuthorityResolverService.ts +++ b/src/vs/platform/remote/electron-browser/remoteAuthorityResolverService.ts @@ -18,7 +18,7 @@ class PendingResolveAuthorityRequest { export class RemoteAuthorityResolverService implements IRemoteAuthorityResolverService { - _serviceBrand: any; + _serviceBrand: undefined; private _resolveAuthorityRequests: { [authority: string]: PendingResolveAuthorityRequest; }; diff --git a/src/vs/platform/remote/node/tunnelService.ts b/src/vs/platform/remote/node/tunnelService.ts index 2b1e8a1a04f..f9126aa719d 100644 --- a/src/vs/platform/remote/node/tunnelService.ts +++ b/src/vs/platform/remote/node/tunnelService.ts @@ -7,7 +7,7 @@ import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class TunnelService implements ITunnelService { - _serviceBrand: any; + _serviceBrand: undefined; public constructor( ) { diff --git a/src/vs/platform/request/browser/requestService.ts b/src/vs/platform/request/browser/requestService.ts index 1cae6c03b31..75c01b89111 100644 --- a/src/vs/platform/request/browser/requestService.ts +++ b/src/vs/platform/request/browser/requestService.ts @@ -3,13 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { canceled } from 'vs/base/common/errors'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; -import { assign } from 'vs/base/common/objects'; -import { VSBuffer, bufferToStream } from 'vs/base/common/buffer'; +import { request } from 'vs/base/parts/request/browser/request'; /** * This service exposes the `request` API, while using the global @@ -17,7 +15,7 @@ import { VSBuffer, bufferToStream } from 'vs/base/common/buffer'; */ export class RequestService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IConfigurationService private readonly configurationService: IConfigurationService, @@ -28,69 +26,10 @@ export class RequestService { request(options: IRequestOptions, token: CancellationToken): Promise { this.logService.trace('RequestService#request', options.url); - const authorization = this.configurationService.getValue('http.proxyAuthorization'); - if (authorization) { - options.headers = assign(options.headers || {}, { 'Proxy-Authorization': authorization }); + if (!options.proxyAuthorization) { + options.proxyAuthorization = this.configurationService.getValue('http.proxyAuthorization'); } - const xhr = new XMLHttpRequest(); - return new Promise((resolve, reject) => { - - xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); - this.setRequestHeaders(xhr, options); - - xhr.responseType = 'arraybuffer'; - xhr.onerror = e => reject(new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText))); - xhr.onload = (e) => { - resolve({ - res: { - statusCode: xhr.status, - headers: this.getResponseHeaders(xhr) - }, - stream: bufferToStream(VSBuffer.wrap(new Uint8Array(xhr.response))) - }); - }; - xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`)); - - if (options.timeout) { - xhr.timeout = options.timeout; - } - - xhr.send(options.data); - - // cancel - token.onCancellationRequested(() => { - xhr.abort(); - reject(canceled()); - }); - }); + return request(options, token); } - - private setRequestHeaders(xhr: XMLHttpRequest, options: IRequestOptions): void { - if (options.headers) { - outer: for (let k in options.headers) { - switch (k) { - case 'User-Agent': - case 'Accept-Encoding': - case 'Content-Length': - // unsafe headers - continue outer; - } - xhr.setRequestHeader(k, options.headers[k]); - - } - } - } - - private getResponseHeaders(xhr: XMLHttpRequest): { [name: string]: string } { - const headers: { [name: string]: string } = Object.create(null); - for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { - if (line) { - const idx = line.indexOf(':'); - headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim(); - } - } - return headers; - } - -} \ No newline at end of file +} diff --git a/src/vs/platform/request/common/request.ts b/src/vs/platform/request/common/request.ts index 31e3c314242..2735ab1a20f 100644 --- a/src/vs/platform/request/common/request.ts +++ b/src/vs/platform/request/common/request.ts @@ -8,35 +8,13 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; -import { VSBufferReadableStream, streamToBuffer } from 'vs/base/common/buffer'; +import { streamToBuffer } from 'vs/base/common/buffer'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; export const IRequestService = createDecorator('requestService'); -export interface IHeaders { - [header: string]: string; -} - -export interface IRequestOptions { - type?: string; - url?: string; - user?: string; - password?: string; - headers?: IHeaders; - timeout?: number; - data?: string; - followRedirects?: number; -} - -export interface IRequestContext { - res: { - headers: IHeaders; - statusCode?: number; - }; - stream: VSBufferReadableStream; -} - export interface IRequestService { - _serviceBrand: any; + _serviceBrand: undefined; request(options: IRequestOptions, token: CancellationToken): Promise; } diff --git a/src/vs/platform/request/common/requestIpc.ts b/src/vs/platform/request/common/requestIpc.ts index 8f553261707..e5e300da2ca 100644 --- a/src/vs/platform/request/common/requestIpc.ts +++ b/src/vs/platform/request/common/requestIpc.ts @@ -5,7 +5,8 @@ import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; import { Event } from 'vs/base/common/event'; -import { IRequestService, IRequestOptions, IRequestContext, IHeaders } from 'vs/platform/request/common/request'; +import { IRequestService } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext, IHeaders } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; import { VSBuffer, bufferToStream, streamToBuffer } from 'vs/base/common/buffer'; @@ -39,7 +40,7 @@ export class RequestChannel implements IServerChannel { export class RequestChannelClient { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private readonly channel: IChannel) { } diff --git a/src/vs/platform/request/electron-main/requestService.ts b/src/vs/platform/request/electron-main/requestService.ts index cd27b9fbf5d..de9eacfd447 100644 --- a/src/vs/platform/request/electron-main/requestService.ts +++ b/src/vs/platform/request/electron-main/requestService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { RequestService as NodeRequestService, IRawRequestFunction } from 'vs/platform/request/node/requestService'; import { assign } from 'vs/base/common/objects'; import { net } from 'electron'; diff --git a/src/vs/platform/request/node/requestService.ts b/src/vs/platform/request/node/requestService.ts index 8ca875f6fa9..549f5033754 100644 --- a/src/vs/platform/request/node/requestService.ts +++ b/src/vs/platform/request/node/requestService.ts @@ -13,7 +13,8 @@ import { assign } from 'vs/base/common/objects'; import { isBoolean, isNumber } from 'vs/base/common/types'; import { canceled } from 'vs/base/common/errors'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { IRequestOptions, IRequestContext, IRequestService, IHTTPConfiguration } from 'vs/platform/request/common/request'; +import { IRequestService, IHTTPConfiguration } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { getProxyAgent, Agent } from 'vs/platform/request/node/proxy'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; @@ -35,7 +36,7 @@ export interface NodeRequestOptions extends IRequestOptions { */ export class RequestService extends Disposable implements IRequestService { - _serviceBrand: any; + _serviceBrand: undefined; private proxyUrl?: string; private strictSSL: boolean | undefined; diff --git a/src/vs/platform/sign/browser/signService.ts b/src/vs/platform/sign/browser/signService.ts index 75951fab3dc..7de2c3d6a11 100644 --- a/src/vs/platform/sign/browser/signService.ts +++ b/src/vs/platform/sign/browser/signService.ts @@ -4,11 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { ISignService } from 'vs/platform/sign/common/sign'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class SignService implements ISignService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _tkn: string | null; diff --git a/src/vs/platform/sign/common/sign.ts b/src/vs/platform/sign/common/sign.ts index 026c8580d73..f3a766e760b 100644 --- a/src/vs/platform/sign/common/sign.ts +++ b/src/vs/platform/sign/common/sign.ts @@ -9,7 +9,7 @@ export const SIGN_SERVICE_ID = 'signService'; export const ISignService = createDecorator(SIGN_SERVICE_ID); export interface ISignService { - _serviceBrand: any; + _serviceBrand: undefined; sign(value: string): Promise; } diff --git a/src/vs/platform/sign/node/signService.ts b/src/vs/platform/sign/node/signService.ts index cf5a0703ea8..ba9b9641e06 100644 --- a/src/vs/platform/sign/node/signService.ts +++ b/src/vs/platform/sign/node/signService.ts @@ -6,7 +6,7 @@ import { ISignService } from 'vs/platform/sign/common/sign'; export class SignService implements ISignService { - _serviceBrand: any; + _serviceBrand: undefined; private vsda(): Promise { return import('vsda'); diff --git a/src/vs/platform/state/common/state.ts b/src/vs/platform/state/common/state.ts index 973f255fa73..356ffffdf58 100644 --- a/src/vs/platform/state/common/state.ts +++ b/src/vs/platform/state/common/state.ts @@ -8,7 +8,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const IStateService = createDecorator('stateService'); export interface IStateService { - _serviceBrand: any; + _serviceBrand: undefined; getItem(key: string, defaultValue: T): T; getItem(key: string, defaultValue?: T): T | undefined; diff --git a/src/vs/platform/state/node/stateService.ts b/src/vs/platform/state/node/stateService.ts index be587a9fb09..967cce50be3 100644 --- a/src/vs/platform/state/node/stateService.ts +++ b/src/vs/platform/state/node/stateService.ts @@ -125,7 +125,7 @@ export class FileStorage { export class StateService implements IStateService { - _serviceBrand: any; + _serviceBrand: undefined; private static STATE_FILE = 'storage.json'; diff --git a/src/vs/platform/statusbar/common/statusbar.ts b/src/vs/platform/statusbar/common/statusbar.ts index 42c1d6cb180..2c5ba10591c 100644 --- a/src/vs/platform/statusbar/common/statusbar.ts +++ b/src/vs/platform/statusbar/common/statusbar.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable } from 'vs/base/common/lifecycle'; import { ThemeColor } from 'vs/platform/theme/common/themeService'; @@ -59,7 +59,7 @@ export interface IStatusbarEntry { export interface IStatusbarService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Adds an entry to the statusbar with the given alignment and priority. Use the returned accessor @@ -85,4 +85,4 @@ export interface IStatusbarEntryAccessor extends IDisposable { * Allows to update an existing status bar entry. */ update(properties: IStatusbarEntry): void; -} \ No newline at end of file +} diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts index 5648772339f..c307e34f92c 100644 --- a/src/vs/platform/storage/browser/storageService.ts +++ b/src/vs/platform/storage/browser/storageService.ts @@ -8,7 +8,6 @@ import { Event, Emitter } from 'vs/base/common/event'; import { IWorkspaceStorageChangeEvent, IStorageService, StorageScope, IWillSaveStateEvent, WillSaveStateReason, logStorage } from 'vs/platform/storage/common/storage'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IFileService, FileChangeType } from 'vs/platform/files/common/files'; import { IStorage, Storage, IStorageDatabase, IStorageItemsChangeEvent, IUpdateRequest } from 'vs/base/parts/storage/common/storage'; import { URI } from 'vs/base/common/uri'; @@ -19,7 +18,7 @@ import { VSBuffer } from 'vs/base/common/buffer'; export class BrowserStorageService extends Disposable implements IStorageService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _onDidChangeStorage: Emitter = this._register(new Emitter()); readonly onDidChangeStorage: Event = this._onDidChangeStorage.event; diff --git a/src/vs/platform/storage/common/storage.ts b/src/vs/platform/storage/common/storage.ts index 8860535a54a..5e23d0c095f 100644 --- a/src/vs/platform/storage/common/storage.ts +++ b/src/vs/platform/storage/common/storage.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event, Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { isUndefinedOrNull } from 'vs/base/common/types'; @@ -21,7 +21,7 @@ export interface IWillSaveStateEvent { export interface IStorageService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Emitted whenever data is updated or deleted. @@ -118,7 +118,7 @@ export interface IWorkspaceStorageChangeEvent { export class InMemoryStorageService extends Disposable implements IStorageService { - _serviceBrand = null as any; + _serviceBrand: undefined; private readonly _onDidChangeStorage: Emitter = this._register(new Emitter()); readonly onDidChangeStorage: Event = this._onDidChangeStorage.event; diff --git a/src/vs/platform/storage/node/storageIpc.ts b/src/vs/platform/storage/node/storageIpc.ts index 8ed04953e41..f74005b5ed4 100644 --- a/src/vs/platform/storage/node/storageIpc.ts +++ b/src/vs/platform/storage/node/storageIpc.ts @@ -147,12 +147,12 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC export class GlobalStorageDatabaseChannelClient extends Disposable implements IStorageDatabase { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidChangeItemsExternal: Emitter = this._register(new Emitter()); readonly onDidChangeItemsExternal: Event = this._onDidChangeItemsExternal.event; - private onDidChangeItemsOnMainListener: IDisposable; + private onDidChangeItemsOnMainListener: IDisposable | undefined; constructor(private channel: IChannel) { super(); diff --git a/src/vs/platform/storage/node/storageMainService.ts b/src/vs/platform/storage/node/storageMainService.ts index 2f2dd9e3bd2..70cdeef730d 100644 --- a/src/vs/platform/storage/node/storageMainService.ts +++ b/src/vs/platform/storage/node/storageMainService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event, Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; @@ -16,7 +16,7 @@ export const IStorageMainService = createDecorator('storage export interface IStorageMainService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Emitted whenever data is updated or deleted. @@ -85,7 +85,7 @@ export interface IStorageChangeEvent { export class StorageMainService extends Disposable implements IStorageMainService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private static STORAGE_NAME = 'state.vscdb'; @@ -99,7 +99,7 @@ export class StorageMainService extends Disposable implements IStorageMainServic private storage: IStorage; - private initializePromise: Promise; + private initializePromise: Promise | undefined; constructor( @ILogService private readonly logService: ILogService, diff --git a/src/vs/platform/storage/node/storageService.ts b/src/vs/platform/storage/node/storageService.ts index ca09cbc9cc9..33e3cac1c81 100644 --- a/src/vs/platform/storage/node/storageService.ts +++ b/src/vs/platform/storage/node/storageService.ts @@ -15,11 +15,10 @@ import { copy, exists, mkdirp, writeFile } from 'vs/base/node/pfs'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IWorkspaceInitializationPayload, isWorkspaceIdentifier, isSingleFolderWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces'; import { onUnexpectedError } from 'vs/base/common/errors'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class StorageService extends Disposable implements IStorageService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private static WORKSPACE_STORAGE_NAME = 'state.vscdb'; private static WORKSPACE_META_NAME = 'workspace.json'; diff --git a/src/vs/platform/telemetry/common/telemetry.ts b/src/vs/platform/telemetry/common/telemetry.ts index 847f4856a55..d1125e0ffb3 100644 --- a/src/vs/platform/telemetry/common/telemetry.ts +++ b/src/vs/platform/telemetry/common/telemetry.ts @@ -12,6 +12,7 @@ export interface ITelemetryInfo { sessionId: string; machineId: string; instanceId: string; + msftInternal?: boolean; } export interface ITelemetryData { @@ -22,7 +23,7 @@ export interface ITelemetryData { export interface ITelemetryService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Sends a telemetry event that has been privacy approved. @@ -43,4 +44,4 @@ export interface ITelemetryService { export const instanceStorageKey = 'telemetry.instanceId'; export const currentSessionDateStorageKey = 'telemetry.currentSessionDate'; export const firstSessionDateStorageKey = 'telemetry.firstSessionDate'; -export const lastSessionDateStorageKey = 'telemetry.lastSessionDate'; \ No newline at end of file +export const lastSessionDateStorageKey = 'telemetry.lastSessionDate'; diff --git a/src/vs/platform/telemetry/common/telemetryService.ts b/src/vs/platform/telemetry/common/telemetryService.ts index 576a337237e..1e468a2018d 100644 --- a/src/vs/platform/telemetry/common/telemetryService.ts +++ b/src/vs/platform/telemetry/common/telemetryService.ts @@ -27,7 +27,7 @@ export class TelemetryService implements ITelemetryService { static IDLE_START_EVENT_NAME = 'UserIdleStart'; static IDLE_STOP_EVENT_NAME = 'UserIdleStop'; - _serviceBrand: any; + _serviceBrand: undefined; private _appender: ITelemetryAppender; private _commonProperties: Promise<{ [name: string]: any; }>; @@ -104,8 +104,9 @@ export class TelemetryService implements ITelemetryService { let sessionId = values['sessionID']; let instanceId = values['common.instanceId']; let machineId = values['common.machineId']; + let msftInternal = values['common.msftInternal']; - return { sessionId, instanceId, machineId }; + return { sessionId, instanceId, machineId, msftInternal }; } dispose(): void { diff --git a/src/vs/platform/telemetry/node/commonProperties.ts b/src/vs/platform/telemetry/node/commonProperties.ts index 204a229e777..1e943ade588 100644 --- a/src/vs/platform/telemetry/node/commonProperties.ts +++ b/src/vs/platform/telemetry/node/commonProperties.ts @@ -8,8 +8,8 @@ import * as os from 'os'; import * as uuid from 'vs/base/common/uuid'; import { readFile } from 'vs/base/node/pfs'; -export async function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, installSourcePath: string, product?: string): Promise<{ [name: string]: string | undefined; }> { - const result: { [name: string]: string | undefined; } = Object.create(null); +export async function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, msftInternalDomains: string[] | undefined, installSourcePath: string, product?: string): Promise<{ [name: string]: string | boolean | undefined; }> { + const result: { [name: string]: string | boolean | undefined; } = Object.create(null); // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" } result['common.machineId'] = machineId; @@ -30,6 +30,12 @@ export async function resolveCommonProperties(commit: string | undefined, versio // __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } result['common.product'] = product || 'desktop'; + const msftInternal = verifyMicrosoftInternalDomain(msftInternalDomains || []); + if (msftInternal) { + // __GDPR__COMMON__ "common.msftInternal" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + result['common.msftInternal'] = msftInternal; + } + // dynamic properties which value differs on each call let seq = 0; const startTime = Date.now(); @@ -67,3 +73,18 @@ export async function resolveCommonProperties(commit: string | undefined, versio return result; } + +function verifyMicrosoftInternalDomain(domainList: string[]): boolean { + if (!process || !process.env || !process.env['USERDNSDOMAIN']) { + return false; + } + + const domain = process.env['USERDNSDOMAIN']!.toLowerCase(); + for (let msftDomain of domainList) { + if (domain === msftDomain) { + return true; + } + } + + return false; +} diff --git a/src/vs/platform/telemetry/node/workbenchCommonProperties.ts b/src/vs/platform/telemetry/node/workbenchCommonProperties.ts index 81d6a4d3d22..cf6f57836fe 100644 --- a/src/vs/platform/telemetry/node/workbenchCommonProperties.ts +++ b/src/vs/platform/telemetry/node/workbenchCommonProperties.ts @@ -8,8 +8,8 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry'; import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils'; -export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> { - const result = await resolveCommonProperties(commit, version, machineId, installSourcePath); +export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, msftInternalDomains: string[] | undefined, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | boolean | undefined }> { + const result = await resolveCommonProperties(commit, version, machineId, msftInternalDomains, installSourcePath); const instanceId = storageService.get(instanceStorageKey, StorageScope.GLOBAL)!; const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!; const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!; diff --git a/src/vs/platform/telemetry/test/electron-browser/appInsightsAppender.test.ts b/src/vs/platform/telemetry/test/electron-browser/appInsightsAppender.test.ts index 92f9d63b15e..9376104b9c0 100644 --- a/src/vs/platform/telemetry/test/electron-browser/appInsightsAppender.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/appInsightsAppender.test.ts @@ -24,7 +24,7 @@ class AppInsightsMock implements ITelemetryClient { } class TestableLogService extends AbstractLogService implements ILogService { - _serviceBrand: any; + _serviceBrand: undefined; public logs: string[] = []; diff --git a/src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts b/src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts index ff7f3977f0c..ee49c04ba3f 100644 --- a/src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts @@ -31,7 +31,7 @@ suite('Telemetry - common properties', function () { test('default', async function () { await mkdirp(parentDir); fs.writeFileSync(installSource, 'my.install.source'); - const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', installSource); + const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource); assert.ok('commitHash' in props); assert.ok('sessionID' in props); assert.ok('timestamp' in props); @@ -52,7 +52,7 @@ suite('Telemetry - common properties', function () { assert.ok('common.instanceId' in props, 'instanceId'); assert.ok('common.machineId' in props, 'machineId'); fs.unlinkSync(installSource); - const props_1 = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', installSource); + const props_1 = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource); assert.ok(!('common.source' in props_1)); }); @@ -60,14 +60,14 @@ suite('Telemetry - common properties', function () { testStorageService.store('telemetry.lastSessionDate', new Date().toUTCString(), StorageScope.GLOBAL); - const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', installSource); + const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource); assert.ok('common.lastSessionDate' in props); // conditional, see below assert.ok('common.isNewSession' in props); assert.equal(props['common.isNewSession'], 0); }); test('values chance on ask', async function () { - const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', installSource); + const props = await resolveWorkbenchCommonProperties(testStorageService, commit, version, 'someMachineId', undefined, installSource); let value1 = props['common.sequence']; let value2 = props['common.sequence']; assert.ok(value1 !== value2, 'seq'); diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts index 86a5f5203ed..8ccbcc4d9f6 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -768,29 +768,29 @@ suite('TelemetryService', () => { let service = new TelemetryService({ appender: testAppender }, { - _serviceBrand: undefined, - getValue() { - return { - enableTelemetry: enableTelemetry - } as any; - }, - updateValue(): Promise { - return null!; - }, - inspect(key: string) { - return { - value: getConfigurationValue(this.getValue(), key), - default: getConfigurationValue(this.getValue(), key), - user: getConfigurationValue(this.getValue(), key), - workspace: null!, - workspaceFolder: null! - }; - }, - keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; }, - onDidChangeConfiguration: emitter.event, - reloadConfiguration(): Promise { return null!; }, - getConfigurationData() { return null; } - }); + _serviceBrand: undefined, + getValue() { + return { + enableTelemetry: enableTelemetry + } as any; + }, + updateValue(): Promise { + return null!; + }, + inspect(key: string) { + return { + value: getConfigurationValue(this.getValue(), key), + default: getConfigurationValue(this.getValue(), key), + user: getConfigurationValue(this.getValue(), key), + workspace: null!, + workspaceFolder: null! + }; + }, + keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; }, + onDidChangeConfiguration: emitter.event, + reloadConfiguration(): Promise { return null!; }, + getConfigurationData() { return null; } + }); assert.equal(service.isOptedIn, false); diff --git a/src/vs/platform/theme/common/themeService.ts b/src/vs/platform/theme/common/themeService.ts index 9b6ea499582..42e93300a85 100644 --- a/src/vs/platform/theme/common/themeService.ts +++ b/src/vs/platform/theme/common/themeService.ts @@ -76,7 +76,7 @@ export interface IThemingParticipant { } export interface IThemeService { - _serviceBrand: any; + _serviceBrand: undefined; getTheme(): ITheme; diff --git a/src/vs/platform/theme/electron-main/themeMainService.ts b/src/vs/platform/theme/electron-main/themeMainService.ts index 8dfe54bca5e..d44f8bed3dd 100644 --- a/src/vs/platform/theme/electron-main/themeMainService.ts +++ b/src/vs/platform/theme/electron-main/themeMainService.ts @@ -18,14 +18,14 @@ const THEME_BG_STORAGE_KEY = 'themeBackground'; export const IThemeMainService = createDecorator('themeMainService'); export interface IThemeMainService { - _serviceBrand: any; + _serviceBrand: undefined; getBackgroundColor(): string; } export class ThemeMainService implements IThemeMainService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(@IStateService private stateService: IStateService) { ipc.on('vscode:changeColorTheme', (e: Event, windowId: number, broadcast: string) => { diff --git a/src/vs/platform/theme/test/common/testThemeService.ts b/src/vs/platform/theme/test/common/testThemeService.ts index e29bfc636f5..fd49d393a34 100644 --- a/src/vs/platform/theme/test/common/testThemeService.ts +++ b/src/vs/platform/theme/test/common/testThemeService.ts @@ -33,7 +33,7 @@ export class TestIconTheme implements IIconTheme { export class TestThemeService implements IThemeService { - _serviceBrand: any; + _serviceBrand: undefined; _theme: ITheme; _iconTheme: IIconTheme; _onThemeChange = new Emitter(); diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts index 205d961cece..9c5404c4297 100644 --- a/src/vs/platform/update/common/update.ts +++ b/src/vs/platform/update/common/update.ts @@ -83,7 +83,7 @@ export interface IAutoUpdater extends Event.NodeEventEmitter { export const IUpdateService = createDecorator('updateService'); export interface IUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onStateChange: Event; readonly state: State; diff --git a/src/vs/platform/update/electron-browser/updateService.ts b/src/vs/platform/update/electron-browser/updateService.ts index bd8fa6cc185..fe6e5be934a 100644 --- a/src/vs/platform/update/electron-browser/updateService.ts +++ b/src/vs/platform/update/electron-browser/updateService.ts @@ -7,11 +7,10 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { Event, Emitter } from 'vs/base/common/event'; import { IUpdateService, State } from 'vs/platform/update/common/update'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class UpdateService implements IUpdateService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _onStateChange = new Emitter(); readonly onStateChange: Event = this._onStateChange.event; diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts index d789bf4e09b..7ae90deb9b7 100644 --- a/src/vs/platform/update/electron-main/abstractUpdateService.ts +++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts @@ -24,7 +24,7 @@ export type UpdateNotAvailableClassification = { export abstract class AbstractUpdateService implements IUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; protected readonly url: string | undefined; diff --git a/src/vs/platform/update/electron-main/updateService.darwin.ts b/src/vs/platform/update/electron-main/updateService.darwin.ts index da534803b83..4ea14a0cb82 100644 --- a/src/vs/platform/update/electron-main/updateService.darwin.ts +++ b/src/vs/platform/update/electron-main/updateService.darwin.ts @@ -18,7 +18,7 @@ import { IRequestService } from 'vs/platform/request/common/request'; export class DarwinUpdateService extends AbstractUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; private disposables: IDisposable[] = []; diff --git a/src/vs/platform/update/electron-main/updateService.linux.ts b/src/vs/platform/update/electron-main/updateService.linux.ts index 07eaf22cb09..3faff10a567 100644 --- a/src/vs/platform/update/electron-main/updateService.linux.ts +++ b/src/vs/platform/update/electron-main/updateService.linux.ts @@ -17,7 +17,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; export class LinuxUpdateService extends AbstractUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @ILifecycleService lifecycleService: ILifecycleService, diff --git a/src/vs/platform/update/electron-main/updateService.snap.ts b/src/vs/platform/update/electron-main/updateService.snap.ts index 54f63ca59e4..3861dc0b392 100644 --- a/src/vs/platform/update/electron-main/updateService.snap.ts +++ b/src/vs/platform/update/electron-main/updateService.snap.ts @@ -17,7 +17,7 @@ import { UpdateNotAvailableClassification } from 'vs/platform/update/electron-ma abstract class AbstractUpdateService2 implements IUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; private _state: State = State.Uninitialized; @@ -134,7 +134,7 @@ abstract class AbstractUpdateService2 implements IUpdateService { export class SnapUpdateService extends AbstractUpdateService2 { - _serviceBrand: any; + _serviceBrand: undefined; constructor( private snap: string, diff --git a/src/vs/platform/update/electron-main/updateService.win32.ts b/src/vs/platform/update/electron-main/updateService.win32.ts index bd7a3d35f7c..1355a331d7a 100644 --- a/src/vs/platform/update/electron-main/updateService.win32.ts +++ b/src/vs/platform/update/electron-main/updateService.win32.ts @@ -49,7 +49,7 @@ function getUpdateType(): UpdateType { export class Win32UpdateService extends AbstractUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; private availableUpdate: IAvailableUpdate | undefined; diff --git a/src/vs/platform/url/common/url.ts b/src/vs/platform/url/common/url.ts index 87a5a8fbeec..479bc0bca73 100644 --- a/src/vs/platform/url/common/url.ts +++ b/src/vs/platform/url/common/url.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI, UriComponents } from 'vs/base/common/uri'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable } from 'vs/base/common/lifecycle'; export const IURLService = createDecorator('urlService'); @@ -15,7 +15,7 @@ export interface IURLHandler { export interface IURLService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Create a URL that can be called to trigger IURLhandlers. diff --git a/src/vs/platform/url/common/urlService.ts b/src/vs/platform/url/common/urlService.ts index eb216a6b335..322929c723d 100644 --- a/src/vs/platform/url/common/urlService.ts +++ b/src/vs/platform/url/common/urlService.ts @@ -8,11 +8,10 @@ import { URI, UriComponents } from 'vs/base/common/uri'; import { values } from 'vs/base/common/map'; import { first } from 'vs/base/common/async'; import { toDisposable, IDisposable, Disposable } from 'vs/base/common/lifecycle'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export abstract class AbstractURLService extends Disposable implements IURLService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private handlers = new Set(); diff --git a/src/vs/platform/url/node/urlIpc.ts b/src/vs/platform/url/node/urlIpc.ts index 0e70e9c6534..74e482f9817 100644 --- a/src/vs/platform/url/node/urlIpc.ts +++ b/src/vs/platform/url/node/urlIpc.ts @@ -28,7 +28,7 @@ export class URLServiceChannel implements IServerChannel { export class URLServiceChannelClient implements IURLService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private channel: IChannel) { } diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index bca1181e591..57ffdc63bc0 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -94,7 +94,7 @@ export interface IDevToolsOptions { export interface IWindowsService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onWindowOpen: Event; readonly onWindowFocus: Event; @@ -221,7 +221,7 @@ export function isFileToOpen(uriToOpen: IURIToOpen): uriToOpen is IFileToOpen { export interface IWindowService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidChangeFocus: Event; readonly onDidChangeMaximize: Event; diff --git a/src/vs/platform/windows/electron-browser/windowsService.ts b/src/vs/platform/windows/electron-browser/windowsService.ts index 57bd96143af..9321a89c8a6 100644 --- a/src/vs/platform/windows/electron-browser/windowsService.ts +++ b/src/vs/platform/windows/electron-browser/windowsService.ts @@ -13,11 +13,10 @@ import { URI } from 'vs/base/common/uri'; import { ParsedArgs } from 'vs/platform/environment/common/environment'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; import { IProcessEnvironment } from 'vs/base/common/platform'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class WindowsService implements IWindowsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private channel: IChannel; diff --git a/src/vs/platform/windows/electron-main/windows.ts b/src/vs/platform/windows/electron-main/windows.ts index 3e64f5f5d0b..71479f9009e 100644 --- a/src/vs/platform/windows/electron-main/windows.ts +++ b/src/vs/platform/windows/electron-main/windows.ts @@ -84,7 +84,7 @@ export interface IWindowsCountChangedEvent { } export interface IWindowsMainService { - _serviceBrand: any; + _serviceBrand: undefined; // events readonly onWindowReady: Event; diff --git a/src/vs/platform/windows/electron-main/windowsService.ts b/src/vs/platform/windows/electron-main/windowsService.ts index 00af7fe6715..b02f54433d2 100644 --- a/src/vs/platform/windows/electron-main/windowsService.ts +++ b/src/vs/platform/windows/electron-main/windowsService.ts @@ -23,11 +23,10 @@ import { Schemas } from 'vs/base/common/network'; import { mnemonicButtonLabel } from 'vs/base/common/labels'; import { isMacintosh, isLinux, IProcessEnvironment } from 'vs/base/common/platform'; import { ILogService } from 'vs/platform/log/common/log'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class WindowsService extends Disposable implements IWindowsService, IURLHandler { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly disposables = this._register(new DisposableStore()); @@ -323,9 +322,14 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH this.logService.trace('windowsService#getWindows'); const windows = this.windowsMainService.getWindows(); - const result = windows.map(w => ({ id: w.id, workspace: w.openedWorkspace, folderUri: w.openedFolderUri, title: w.win.getTitle(), filename: w.getRepresentedFilename() })); - return result; + return windows.map(window => ({ + id: window.id, + workspace: window.openedWorkspace, + folderUri: window.openedFolderUri, + title: window.win.getTitle(), + filename: window.getRepresentedFilename() + })); } async getWindowCount(): Promise { diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index 5353a0eb7e7..07cf7b30212 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -25,7 +25,7 @@ export interface IWorkspaceFoldersChangeEvent { } export interface IWorkspaceContextService { - _serviceBrand: any; + _serviceBrand: undefined; /** * An event which fires on workbench state changes. diff --git a/src/vs/platform/workspaces/common/workspaces.ts b/src/vs/platform/workspaces/common/workspaces.ts index fa8fae57ec8..a1b5c0aadb3 100644 --- a/src/vs/platform/workspaces/common/workspaces.ts +++ b/src/vs/platform/workspaces/common/workspaces.ts @@ -96,7 +96,7 @@ export interface IUntitledWorkspaceInfo { } export interface IWorkspacesMainService extends IWorkspacesService { - _serviceBrand: any; + _serviceBrand: undefined; onUntitledWorkspaceDeleted: Event; @@ -112,7 +112,7 @@ export interface IWorkspacesMainService extends IWorkspacesService { } export interface IWorkspacesService { - _serviceBrand: any; + _serviceBrand: undefined; createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[], remoteAuthority?: string): Promise; diff --git a/src/vs/platform/workspaces/electron-browser/workspacesService.ts b/src/vs/platform/workspaces/electron-browser/workspacesService.ts index 1e0df308123..6c7f5fb824e 100644 --- a/src/vs/platform/workspaces/electron-browser/workspacesService.ts +++ b/src/vs/platform/workspaces/electron-browser/workspacesService.ts @@ -6,12 +6,11 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc'; import { IWorkspacesService, IWorkspaceIdentifier, IWorkspaceFolderCreationData, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { URI } from 'vs/base/common/uri'; export class WorkspacesService implements IWorkspacesService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; private channel: IChannel; diff --git a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts index 54d6757842a..e23da4f94ac 100644 --- a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts +++ b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts @@ -26,7 +26,7 @@ export interface IStoredWorkspace { export class WorkspacesMainService extends Disposable implements IWorkspacesMainService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly untitledWorkspacesHome: URI; // local URI that contains all untitled workspaces diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index e047c9c2d95..32533758bb5 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5912,22 +5912,27 @@ declare module 'vscode' { /** * Fired when the webview content posts a message. + * + * Webview content can post strings or json serilizable objects back to a VS Code extension. They cannot + * post `Blob`, `File`, `ImageData` and other DOM specific objects since the extension that receives the + * message does not run in a browser environment. */ readonly onDidReceiveMessage: Event; /** * Post a message to the webview content. * - * Messages are only delivered if the webview is visible. + * Messages are only delivered if the webview is live (either visible or in the + * background with `retainContextWhenHidden`). * - * @param message Body of the message. + * @param message Body of the message. This must be a string or other json serilizable object. */ postMessage(message: any): Thenable; /** * Convert a uri for the local file system to one that can be used inside webviews. * - * Webviews cannot directly load resoruces from the workspace or local file system using `file:` uris. The + * Webviews cannot directly load resources from the workspace or local file system using `file:` uris. The * `asWebviewUri` function takes a local `file:` uri and converts it into a uri that can be used inside of * a webview to load the same resource: * @@ -6886,7 +6891,7 @@ declare module 'vscode' { /** * Whether the tree supports multi-select. When the tree supports multi-select and a command is executed from the tree, * the first argument to the command is the tree item that the command was executed on and the second argument is an - * array containing the other selected tree items. + * array containing all selected tree items. */ canSelectMany?: boolean; } @@ -8090,8 +8095,7 @@ declare module 'vscode' { export const onDidChangeDiagnostics: Event; /** - * Get all diagnostics for a given resource. *Note* that this includes diagnostics from - * all extensions but *not yet* from the task framework. + * Get all diagnostics for a given resource. * * @param resource A resource * @returns An array of [diagnostics](#Diagnostic) objects or an empty array. @@ -8099,8 +8103,7 @@ declare module 'vscode' { export function getDiagnostics(resource: Uri): Diagnostic[]; /** - * Get all diagnostics. *Note* that this includes diagnostics from - * all extensions but *not yet* from the task framework. + * Get all diagnostics. * * @returns An array of uri-diagnostics tuples or an empty array. */ diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 0e11ee84911..89d9ed41980 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -16,17 +16,6 @@ declare module 'vscode' { - //#region Joh - ExecutionContext - // THIS is a deprecated proposal - export enum ExtensionExecutionContext { - Local = 1, - Remote = 2 - } - export interface ExtensionContext { - executionContext: ExtensionExecutionContext; - } - //#endregion - //#region Joh - call hierarchy export enum CallHierarchyDirection { @@ -881,6 +870,11 @@ declare module 'vscode' { /** * An event that when fired will signal that the pty is closed and dispose of the terminal. * + * A number can be used to provide an exit code for the terminal. Exit codes must be + * positive and a non-zero exit codes signals failure which shows a notification for a + * regular terminal and allows dependent tasks to proceed when used with the + * `CustomExecution2` API. + * * **Example:** Exit the terminal when "y" is pressed, otherwise show a notification. * ```typescript * const writeEmitter = new vscode.EventEmitter(); @@ -899,7 +893,7 @@ declare module 'vscode' { * }; * vscode.window.createTerminal({ name: 'Exit example', pty }); */ - onDidClose?: Event; + onDidClose?: Event; /** * Implement to handle when the pty is open and ready to start firing events. @@ -1133,9 +1127,27 @@ declare module 'vscode' { //#endregion - //#region Joh - CompletionItemKindModifier, https://github.com/microsoft/vscode/issues/23927 + //#region Joh - CompletionItemTag, https://github.com/microsoft/vscode/issues/23927 - export enum CompletionItemKindModifier { + export enum SymbolTag { + Deprecated = 1 + } + + export interface SymbolInformation { + /** + * + */ + tags?: ReadonlyArray; + } + + export interface DocumentSymbol { + /** + * + */ + tags?: ReadonlyArray; + } + + export enum CompletionItemTag { Deprecated = 1 } @@ -1144,22 +1156,22 @@ declare module 'vscode' { /** * */ - kind2?: CompletionItemKind | { base: CompletionItemKind, modifier: ReadonlyArray }; + tags?: ReadonlyArray; } //#endregion // #region Ben - extension auth flow (desktop+web) - export namespace env { + export interface AppUriOptions { + payload?: { + path?: string; + query?: string; + fragment?: string; + }; + } - export interface AppUriOptions { - payload?: { - path?: string; - query?: string; - fragment?: string; - }; - } + export namespace env { /** * Creates a Uri that - if opened in a browser - will result in a diff --git a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts index 053217cda52..859e9b337e8 100644 --- a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts +++ b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts @@ -92,9 +92,9 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape { enableFindWidget: false, extension: { id: extensionId, location: URI.revive(extensionLocation) } }, { - allowScripts: options.enableScripts, - localResourceRoots: options.localResourceRoots ? options.localResourceRoots.map(uri => URI.revive(uri)) : undefined - }); + allowScripts: options.enableScripts, + localResourceRoots: options.localResourceRoots ? options.localResourceRoots.map(uri => URI.revive(uri)) : undefined + }); const webviewZone = new EditorWebviewZone(editor, line, height, webview); diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 2f0f5283bfd..fc830d3ddc2 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -21,7 +21,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb private readonly _proxy: ExtHostDebugServiceShape; private readonly _toDispose = new DisposableStore(); - private _breakpointEventsActive: boolean; + private _breakpointEventsActive: boolean | undefined; private readonly _debugAdapters: Map; private _debugAdaptersHandleCounter = 1; private readonly _debugConfigurationProviders: Map; diff --git a/src/vs/workbench/api/browser/mainThreadEditors.ts b/src/vs/workbench/api/browser/mainThreadEditors.ts index 76334b577b1..c4658d50a69 100644 --- a/src/vs/workbench/api/browser/mainThreadEditors.ts +++ b/src/vs/workbench/api/browser/mainThreadEditors.ts @@ -15,7 +15,7 @@ import { ISelection } from 'vs/editor/common/core/selection'; import { IDecorationOptions, IDecorationRenderOptions, ILineChange } from 'vs/editor/common/editorCommon'; import { ISingleEditOperation } from 'vs/editor/common/model'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; -import { IEditorOptions, ITextEditorOptions, IResourceInput } from 'vs/platform/editor/common/editor'; +import { IEditorOptions, ITextEditorOptions, IResourceInput, EditorActivation } from 'vs/platform/editor/common/editor'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { MainThreadDocumentsAndEditors } from 'vs/workbench/api/browser/mainThreadDocumentsAndEditors'; @@ -118,7 +118,10 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape { const editorOptions: ITextEditorOptions = { preserveFocus: options.preserveFocus, pinned: options.pinned, - selection: options.selection + selection: options.selection, + // preserve pre 1.38 behaviour to not make group active when preserveFocus: true + // but make sure to restore the editor to fix https://github.com/microsoft/vscode/issues/79633 + activation: options.preserveFocus ? EditorActivation.RESTORE : undefined }; const input: IResourceInput = { diff --git a/src/vs/workbench/api/browser/mainThreadKeytar.ts b/src/vs/workbench/api/browser/mainThreadKeytar.ts index f07b7688801..ddcf676a10c 100644 --- a/src/vs/workbench/api/browser/mainThreadKeytar.ts +++ b/src/vs/workbench/api/browser/mainThreadKeytar.ts @@ -31,6 +31,10 @@ export class MainThreadKeytar implements MainThreadKeytarShape { return this._credentialsService.findPassword(service); } + async $findCredentials(service: string): Promise> { + return this._credentialsService.findCredentials(service); + } + dispose(): void { // } diff --git a/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts index 0feaf4b3599..966a740a4f1 100644 --- a/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts @@ -21,7 +21,6 @@ import { Selection } from 'vs/editor/common/core/selection'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy'; import { mixin } from 'vs/base/common/objects'; -import { fromArray } from 'vs/base/common/map'; @extHostNamedCustomer(MainContext.MainThreadLanguageFeatures) export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape { @@ -331,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha return { label: data.a, kind: data.b, - kindModifier: data.n && fromArray(data.n), + tags: data.n, detail: data.c, documentation: data.d, sortText: data.e, diff --git a/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts b/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts index 9376f6d1bbb..1bd75108c5a 100644 --- a/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts @@ -124,16 +124,12 @@ export class FinalNewLineParticipant implements ISaveParticipantParticipant { return; } - let prevSelection: Selection[] = []; + const edits = [EditOperation.insert(new Position(lineCount, model.getLineMaxColumn(lineCount)), model.getEOL())]; const editor = findEditor(model, this.codeEditorService); if (editor) { - prevSelection = editor.getSelections(); - } - - model.pushEditOperations(prevSelection, [EditOperation.insert(new Position(lineCount, model.getLineMaxColumn(lineCount)), model.getEOL())], edits => prevSelection); - - if (editor) { - editor.setSelections(prevSelection); + editor.executeEdits('insertFinalNewLine', edits, editor.getSelections()); + } else { + model.pushEditOperations([], edits, () => null); } } } diff --git a/src/vs/workbench/api/browser/mainThreadTreeViews.ts b/src/vs/workbench/api/browser/mainThreadTreeViews.ts index 3c2e1c70801..db7d95f0d22 100644 --- a/src/vs/workbench/api/browser/mainThreadTreeViews.ts +++ b/src/vs/workbench/api/browser/mainThreadTreeViews.ts @@ -35,9 +35,11 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie this._dataProviders.set(treeViewId, dataProvider); const viewer = this.getTreeView(treeViewId); if (viewer) { - viewer.dataProvider = dataProvider; + // Order is important here. The internal tree isn't created until the dataProvider is set. + // Set all other properties first! viewer.showCollapseAllAction = !!options.showCollapseAll; viewer.canSelectMany = !!options.canSelectMany; + viewer.dataProvider = dataProvider; this.registerListeners(treeViewId, viewer); this._proxy.$setVisible(treeViewId, viewer.visible); } else { diff --git a/src/vs/workbench/api/browser/mainThreadUrls.ts b/src/vs/workbench/api/browser/mainThreadUrls.ts index 75fdde3e495..397b831894d 100644 --- a/src/vs/workbench/api/browser/mainThreadUrls.ts +++ b/src/vs/workbench/api/browser/mainThreadUrls.ts @@ -8,7 +8,7 @@ import { extHostNamedCustomer } from '../common/extHostCustomers'; import { IURLService, IURLHandler } from 'vs/platform/url/common/url'; import { URI, UriComponents } from 'vs/base/common/uri'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { IExtensionUrlHandler } from 'vs/workbench/services/extensions/common/inactiveExtensionUrlHandler'; +import { IExtensionUrlHandler } from 'vs/workbench/services/extensions/common/extensionUrlHandler'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; class ExtensionUrlHandler implements IURLHandler { @@ -37,7 +37,7 @@ export class MainThreadUrls implements MainThreadUrlsShape { constructor( context: IExtHostContext, @IURLService private readonly urlService: IURLService, - @IExtensionUrlHandler private readonly inactiveExtensionUrlHandler: IExtensionUrlHandler + @IExtensionUrlHandler private readonly extensionUrlHandler: IExtensionUrlHandler ) { this.proxy = context.getProxy(ExtHostContext.ExtHostUrls); } @@ -47,7 +47,7 @@ export class MainThreadUrls implements MainThreadUrlsShape { const disposable = this.urlService.registerHandler(handler); this.handlers.set(handle, { extensionId, disposable }); - this.inactiveExtensionUrlHandler.registerExtensionHandler(extensionId, handler); + this.extensionUrlHandler.registerExtensionHandler(extensionId, handler); return Promise.resolve(undefined); } @@ -61,7 +61,7 @@ export class MainThreadUrls implements MainThreadUrlsShape { const { extensionId, disposable } = tuple; - this.inactiveExtensionUrlHandler.unregisterExtensionHandler(extensionId); + this.extensionUrlHandler.unregisterExtensionHandler(extensionId); this.handlers.delete(handle); disposable.dispose(); diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index d657e9d0d96..18e94e7f297 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -5,6 +5,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; +import { isWeb } from 'vs/base/common/platform'; import { startsWith } from 'vs/base/common/strings'; import { URI, UriComponents } from 'vs/base/common/uri'; import * as modes from 'vs/editor/common/modes'; @@ -270,6 +271,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews } webview.webview.state = newState; }); + input.webview.onMissingCsp((extension: ExtensionIdentifier) => this._proxy.$onMissingCsp(handle, extension.value)); } private updateWebviewViewStates() { @@ -314,7 +316,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews if (MainThreadWebviews.standardSupportedLinkSchemes.has(link.scheme)) { return true; } - if (this._productService.urlProtocol === link.scheme) { + if (!isWeb && this._productService.urlProtocol === link.scheme) { return true; } return !!webview.webview.contentOptions.enableCommandUris && link.scheme === 'command'; diff --git a/src/vs/workbench/api/common/configurationExtensionPoint.ts b/src/vs/workbench/api/common/configurationExtensionPoint.ts index d36d498330d..cd1670427df 100644 --- a/src/vs/workbench/api/common/configurationExtensionPoint.ts +++ b/src/vs/workbench/api/common/configurationExtensionPoint.ts @@ -48,7 +48,7 @@ const configurationEntrySchema: IJSONSchema = { nls.localize('scope.resource.description', "Configuration that can be configured in the user, remote, workspace or folder settings."), nls.localize('scope.machine-overridable.description', "Machine configuration that can be configured also in workspace or folder settings.") ], - description: nls.localize('scope.description', "Scope in which the configuration is applicable. Available scopes are `application`, `machine`, `window` and `resource`.") + description: nls.localize('scope.description', "Scope in which the configuration is applicable. Available scopes are `application`, `machine`, `window`, `resource` and `machine-overridable`.") }, enumDescriptions: { type: 'array', @@ -238,6 +238,7 @@ function validateProperties(configuration: IConfigurationNode, extension: IExten const jsonRegistry = Registry.as(JSONExtensions.JSONContribution); jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', { allowComments: true, + allowsTrailingCommas: true, default: { folders: [ { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index cafd0e18e9a..d812af3e784 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -74,14 +74,6 @@ export interface IExtensionApiFactory { (extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode; } -function proposedApiFunction(extension: IExtensionDescription, fn: T): T { - if (extension.enableProposedApi) { - return fn; - } else { - return throwProposedApiError.bind(null, extension) as any as T; - } -} - /** * This method instantiates and returns the extension API surface */ @@ -208,7 +200,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I }); }); }, - registerDiffInformationCommand: proposedApiFunction(extension, (id: string, callback: (diff: vscode.LineChange[], ...args: any[]) => any, thisArg?: any): vscode.Disposable => { + registerDiffInformationCommand: (id: string, callback: (diff: vscode.LineChange[], ...args: any[]) => any, thisArg?: any): vscode.Disposable => { + checkProposedApiEnabled(extension); return extHostCommands.registerCommand(true, id, async (...args: any[]): Promise => { const activeTextEditor = extHostEditors.getActiveTextEditor(); if (!activeTextEditor) { @@ -219,7 +212,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I const diff = await extHostEditors.getDiffInformation(activeTextEditor.id); callback.apply(thisArg, [diff, ...args]); }); - }), + }, executeCommand(id: string, ...args: any[]): Thenable { return extHostCommands.executeCommand(id, ...args); }, @@ -532,9 +525,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => { return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer); }, - registerDecorationProvider: proposedApiFunction(extension, (provider: vscode.DecorationProvider) => { + registerDecorationProvider(provider: vscode.DecorationProvider) { + checkProposedApiEnabled(extension); return extHostDecorations.registerDecorationProvider(provider, extension.identifier); - }), + }, registerUriHandler(handler: vscode.UriHandler) { return extHostUrls.registerUriHandler(extension.identifier, handler); }, @@ -553,8 +547,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I }; // namespace: workspace + let warnedRootPathDeprecated = false; const workspace: typeof vscode.workspace = { get rootPath() { + if (extension.isUnderDevelopment && !warnedRootPathDeprecated) { + warnedRootPathDeprecated = true; + console.warn(`[Deprecation Warning] 'workspace.rootPath' is deprecated and should no longer be used. Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath`); + } + return extHostWorkspace.getPath(); }, set rootPath(value) { @@ -675,24 +675,30 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I get fs() { return extHostFileSystem.fileSystem; }, - registerFileSearchProvider: proposedApiFunction(extension, (scheme: string, provider: vscode.FileSearchProvider) => { + registerFileSearchProvider: (scheme: string, provider: vscode.FileSearchProvider) => { + checkProposedApiEnabled(extension); return extHostSearch.registerFileSearchProvider(scheme, provider); - }), - registerTextSearchProvider: proposedApiFunction(extension, (scheme: string, provider: vscode.TextSearchProvider) => { + }, + registerTextSearchProvider: (scheme: string, provider: vscode.TextSearchProvider) => { + checkProposedApiEnabled(extension); return extHostSearch.registerTextSearchProvider(scheme, provider); - }), - registerRemoteAuthorityResolver: proposedApiFunction(extension, (authorityPrefix: string, resolver: vscode.RemoteAuthorityResolver) => { + }, + registerRemoteAuthorityResolver: (authorityPrefix: string, resolver: vscode.RemoteAuthorityResolver) => { + checkProposedApiEnabled(extension); return extensionService.registerRemoteAuthorityResolver(authorityPrefix, resolver); - }), - registerResourceLabelFormatter: proposedApiFunction(extension, (formatter: vscode.ResourceLabelFormatter) => { + }, + registerResourceLabelFormatter: (formatter: vscode.ResourceLabelFormatter) => { + checkProposedApiEnabled(extension); return extHostLabelService.$registerResourceLabelFormatter(formatter); - }), - onDidRenameFile: proposedApiFunction(extension, (listener: (e: vscode.FileRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { + }, + onDidRenameFile: (listener: (e: vscode.FileRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { + checkProposedApiEnabled(extension); return extHostFileSystemEvent.onDidRenameFile(listener, thisArg, disposables); - }), - onWillRenameFile: proposedApiFunction(extension, (listener: (e: vscode.FileWillRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { + }, + onWillRenameFile: (listener: (e: vscode.FileWillRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { + checkProposedApiEnabled(extension); return extHostFileSystemEvent.getOnWillRenameFileEvent(extension)(listener, thisArg, disposables); - }) + } }; // namespace: scm @@ -815,7 +821,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I CommentMode: extHostTypes.CommentMode, CompletionItem: extHostTypes.CompletionItem, CompletionItemKind: extHostTypes.CompletionItemKind, - CompletionItemKindModifier: extHostTypes.CompletionItemKindModifier, + CompletionItemTag: extHostTypes.CompletionItemTag, CompletionList: extHostTypes.CompletionList, CompletionTriggerKind: extHostTypes.CompletionTriggerKind, ConfigurationTarget: extHostTypes.ConfigurationTarget, @@ -833,7 +839,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I DocumentSymbol: extHostTypes.DocumentSymbol, EndOfLine: extHostTypes.EndOfLine, EventEmitter: Emitter, - ExtensionExecutionContext: extHostTypes.ExtensionExecutionContext, ExtensionKind: extHostTypes.ExtensionKind, CustomExecution2: extHostTypes.CustomExecution2, FileChangeType: extHostTypes.FileChangeType, @@ -870,6 +875,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I StatusBarAlignment: extHostTypes.StatusBarAlignment, SymbolInformation: extHostTypes.SymbolInformation, SymbolKind: extHostTypes.SymbolKind, + SymbolTag: extHostTypes.SymbolTag, Task: extHostTypes.Task, Task2: extHostTypes.Task, TaskGroup: extHostTypes.TaskGroup, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 60cbdb012f4..33f114445a1 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -270,6 +270,7 @@ export interface MainThreadKeytarShape extends IDisposable { $setPassword(service: string, account: string, password: string): Promise; $deletePassword(service: string, account: string): Promise; $findPassword(service: string): Promise; + $findCredentials(service: string): Promise>; } export interface IRegExpDto { @@ -566,6 +567,7 @@ export interface WebviewPanelViewStateData { export interface ExtHostWebviewsShape { $onMessage(handle: WebviewPanelHandle, message: any): void; + $onMissingCsp(handle: WebviewPanelHandle, extensionId: string): void; $onDidChangeWebviewPanelViewStates(newState: WebviewPanelViewStateData): void; $onDidDisposeWebviewPanel(handle: WebviewPanelHandle): Promise; $deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: modes.IWebviewOptions & modes.IWebviewPanelOptions): Promise; @@ -947,7 +949,7 @@ export interface ISuggestDataDto { k/* commitCharacters */?: string[]; l/* additionalTextEdits */?: ISingleEditOperation[]; m/* command */?: modes.Command; - n/* kindModifier */?: modes.CompletionItemKindModifier[]; + n/* kindModifier */?: modes.CompletionItemTag[]; // not-standard x?: ChainedCacheId; } diff --git a/src/vs/workbench/api/common/extHostCommands.ts b/src/vs/workbench/api/common/extHostCommands.ts index 8111a7687cf..819119a0f72 100644 --- a/src/vs/workbench/api/common/extHostCommands.ts +++ b/src/vs/workbench/api/common/extHostCommands.ts @@ -33,7 +33,7 @@ export interface ArgumentProcessor { export class ExtHostCommands implements ExtHostCommandsShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _commands = new Map(); private readonly _proxy: MainThreadCommandsShape; diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 99402c46057..44b064059fa 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -42,7 +42,7 @@ type ConfigurationInspect = { export class ExtHostConfiguration implements ExtHostConfigurationShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _proxy: MainThreadConfigurationShape; private readonly _extHostWorkspace: ExtHostWorkspace; diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index 02b3c423f87..3e0f21ec8e1 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -13,7 +13,7 @@ export const IExtHostDebugService = createDecorator('IExtH export interface IExtHostDebugService extends ExtHostDebugServiceShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; onDidStartDebugSession: Event; onDidTerminateDebugSession: Event; diff --git a/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts b/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts index e80289ecb5f..8518289b6c3 100644 --- a/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts +++ b/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts @@ -17,7 +17,7 @@ import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private _disposables: Disposable[] = []; diff --git a/src/vs/workbench/api/common/extHostExtensionActivator.ts b/src/vs/workbench/api/common/extHostExtensionActivator.ts index 5a9f96f9230..5a3646ac4b0 100644 --- a/src/vs/workbench/api/common/extHostExtensionActivator.ts +++ b/src/vs/workbench/api/common/extHostExtensionActivator.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; +import * as vscode from 'vscode'; import { IDisposable } from 'vs/base/common/lifecycle'; import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; @@ -11,29 +12,11 @@ import { ExtensionActivationError, MissingDependencyError } from 'vs/workbench/s const NO_OP_VOID_PROMISE = Promise.resolve(undefined); -export interface IExtensionMemento { - get(key: string): T | undefined; - get(key: string, defaultValue: T): T; - update(key: string, value: any): Promise; -} - -export interface IExtensionContext { - subscriptions: IDisposable[]; - workspaceState: IExtensionMemento; - globalState: IExtensionMemento; - extensionPath: string; - storagePath: string; - globalStoragePath: string; - asAbsolutePath(relativePath: string): string; - readonly logPath: string; - executionContext: number; -} - /** * Represents the source code (module) of an extension. */ export interface IExtensionModule { - activate?(ctx: IExtensionContext): Promise; + activate?(ctx: vscode.ExtensionContext): Promise; deactivate?(): void; } diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts index 8c903a6027c..dab30a87016 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -13,7 +13,7 @@ import { URI } from 'vs/base/common/uri'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostExtensionServiceShape, IInitData, MainContext, MainThreadExtensionServiceShape, MainThreadTelemetryShape, MainThreadWorkspaceShape, IResolveAuthorityResult } from 'vs/workbench/api/common/extHost.protocol'; import { ExtHostConfiguration, IExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration'; -import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionContext, IExtensionModule, HostExtension, ExtensionActivationTimesFragment } from 'vs/workbench/api/common/extHostExtensionActivator'; +import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionModule, HostExtension, ExtensionActivationTimesFragment } from 'vs/workbench/api/common/extHostExtensionActivator'; import { ExtHostStorage, IExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions'; @@ -25,7 +25,7 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio import { Schemas } from 'vs/base/common/network'; import { VSBuffer } from 'vs/base/common/buffer'; import { ExtensionMemento } from 'vs/workbench/api/common/extHostMemento'; -import { RemoteAuthorityResolverError, ExtensionExecutionContext } from 'vs/workbench/api/common/extHostTypes'; +import { RemoteAuthorityResolverError } from 'vs/workbench/api/common/extHostTypes'; import { ResolvedAuthority, ResolvedOptions } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; @@ -64,7 +64,7 @@ type TelemetryActivationEventFragment = { export abstract class AbstractExtHostExtensionService implements ExtHostExtensionServiceShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private static readonly WORKSPACE_CONTAINS_TIMEOUT = 7000; @@ -331,11 +331,11 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio this._logService.info(`ExtensionService#_doActivateExtension ${extensionDescription.identifier.value} ${JSON.stringify(reason)}`); const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup); - return Promise.all([ - this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder), + return Promise.all([ + this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder), this._loadExtensionContext(extensionDescription) ]).then(values => { - return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder); + return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder); }); } @@ -353,7 +353,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio this._storagePath.whenReady ]).then(() => { const that = this; - return Object.freeze({ + return Object.freeze({ globalState, workspaceState, subscriptions: [], @@ -361,13 +361,12 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio get storagePath() { return that._storagePath.workspaceValue(extensionDescription); }, get globalStoragePath() { return that._storagePath.globalValue(extensionDescription); }, asAbsolutePath: (relativePath: string) => { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); }, - get logPath() { return path.join(that._initData.logsLocation.fsPath, extensionDescription.identifier.value); }, - executionContext: this._initData.remote.isRemote ? ExtensionExecutionContext.Remote : ExtensionExecutionContext.Local, + get logPath() { return path.join(that._initData.logsLocation.fsPath, extensionDescription.identifier.value); } }); }); } - private static _callActivate(logService: ILogService, extensionId: ExtensionIdentifier, extensionModule: IExtensionModule, context: IExtensionContext, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + private static _callActivate(logService: ILogService, extensionId: ExtensionIdentifier, extensionModule: IExtensionModule, context: vscode.ExtensionContext, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { // Make sure the extension's surface is not undefined extensionModule = extensionModule || { activate: undefined, @@ -379,7 +378,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio }); } - private static _callActivateOptional(logService: ILogService, extensionId: ExtensionIdentifier, extensionModule: IExtensionModule, context: IExtensionContext, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { + private static _callActivateOptional(logService: ILogService, extensionId: ExtensionIdentifier, extensionModule: IExtensionModule, context: vscode.ExtensionContext, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { if (typeof extensionModule.activate === 'function') { try { activationTimesBuilder.activateCallStart(); @@ -767,7 +766,7 @@ function getTelemetryActivationEvent(extensionDescription: IExtensionDescription export const IExtHostExtensionService = createDecorator('IExtHostExtensionService'); export interface IExtHostExtensionService extends AbstractExtHostExtensionService { - _serviceBrand: any; + _serviceBrand: undefined; initialize(): Promise; isActivated(extensionId: ExtensionIdentifier): boolean; activateByIdWithErrors(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise; diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 3954141c90a..d60f8d24cd7 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -67,10 +67,11 @@ class DocumentSymbolAdapter { const res: modes.DocumentSymbol[] = []; const parentStack: modes.DocumentSymbol[] = []; for (const info of infos) { - const element = { + const element: modes.DocumentSymbol = { name: info.name || '!!MISSING: name!!', kind: typeConvert.SymbolKind.from(info.kind), - detail: undefined!, // Strict null override — avoid changing behavior + tags: info.tags ? info.tags.map(typeConvert.SymbolTag.from) : [], + detail: '', containerName: info.containerName, range: typeConvert.Range.from(info.location.range), selectionRange: typeConvert.Range.from(info.location.range), @@ -727,6 +728,7 @@ class SuggestAdapter { // a: item.label, b: typeConvert.CompletionItemKind.from(item.kind), + n: item.tags && item.tags.map(typeConvert.CompletionItemTag.from), c: item.detail, d: typeof item.documentation === 'undefined' ? undefined : typeConvert.MarkdownString.fromStrict(item.documentation), e: item.sortText, @@ -738,12 +740,6 @@ class SuggestAdapter { m: this._commands.toInternal(item.command, disposables), }; - // kind2 - if (typeof item.kind2 === 'object') { - result.b = typeConvert.CompletionItemKind.from(item.kind2.base); - result.n = item.kind2.modifier.map(typeConvert.CompletionItemKindModifier.from); - } - // 'insertText'-logic if (item.textEdit) { result.h = item.textEdit.newText; diff --git a/src/vs/workbench/api/common/extHostMemento.ts b/src/vs/workbench/api/common/extHostMemento.ts index d0e68010a17..103b8f6a785 100644 --- a/src/vs/workbench/api/common/extHostMemento.ts +++ b/src/vs/workbench/api/common/extHostMemento.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as vscode from 'vscode'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { IExtensionMemento } from 'vs/workbench/api/common/extHostExtensionActivator'; import { ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; -export class ExtensionMemento implements IExtensionMemento { +export class ExtensionMemento implements vscode.Memento { private readonly _id: string; private readonly _shared: boolean; diff --git a/src/vs/workbench/api/common/extHostOutput.ts b/src/vs/workbench/api/common/extHostOutput.ts index 69fa1b36861..aeae1a0aef4 100644 --- a/src/vs/workbench/api/common/extHostOutput.ts +++ b/src/vs/workbench/api/common/extHostOutput.ts @@ -7,7 +7,7 @@ import { MainContext, MainThreadOutputServiceShape, ExtHostOutputServiceShape } import * as vscode from 'vscode'; import { URI } from 'vs/base/common/uri'; import { Event, Emitter } from 'vs/base/common/event'; -import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; +import { Disposable } from 'vs/base/common/lifecycle'; import { VSBuffer } from 'vs/base/common/buffer'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; @@ -137,23 +137,15 @@ export class LazyOutputChannel implements vscode.OutputChannel { export class ExtHostOutputService implements ExtHostOutputServiceShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; protected readonly _proxy: MainThreadOutputServiceShape; - protected readonly _channels: Map = new Map(); - protected readonly _visibleChannelDisposable = new MutableDisposable(); constructor(@IExtHostRpcService extHostRpc: IExtHostRpcService) { this._proxy = extHostRpc.getProxy(MainContext.MainThreadOutputService); } $setVisibleChannel(channelId: string): void { - if (channelId) { - const channel = this._channels.get(channelId); - if (channel) { - this._visibleChannelDisposable.value = channel.onDidAppend(() => channel.update()); - } - } } createOutputChannel(name: string): vscode.OutputChannel { diff --git a/src/vs/workbench/api/common/extHostRequireInterceptor.ts b/src/vs/workbench/api/common/extHostRequireInterceptor.ts index 46866f7db08..9e4cdb09361 100644 --- a/src/vs/workbench/api/common/extHostRequireInterceptor.ts +++ b/src/vs/workbench/api/common/extHostRequireInterceptor.ts @@ -129,6 +129,7 @@ interface IKeytarModule { setPassword(service: string, account: string, password: string): Promise; deletePassword(service: string, account: string): Promise; findPassword(service: string): Promise; + findCredentials(service: string): Promise>; } class KeytarNodeModuleFactory implements INodeModuleFactory { @@ -169,6 +170,9 @@ class KeytarNodeModuleFactory implements INodeModuleFactory { }, findPassword: (service: string): Promise => { return mainThreadKeytar.$findPassword(service); + }, + findCredentials(service: string): Promise> { + return mainThreadKeytar.$findCredentials(service); } }; } diff --git a/src/vs/workbench/api/common/extHostRpcService.ts b/src/vs/workbench/api/common/extHostRpcService.ts index 5524e6f2ebd..3cbdcf31165 100644 --- a/src/vs/workbench/api/common/extHostRpcService.ts +++ b/src/vs/workbench/api/common/extHostRpcService.ts @@ -9,11 +9,11 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const IExtHostRpcService = createDecorator('IExtHostRpcService'); export interface IExtHostRpcService extends IRPCProtocol { - _serviceBrand: any; + _serviceBrand: undefined; } export class ExtHostRpcService implements IExtHostRpcService { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; readonly getProxy: (identifier: ProxyIdentifier) => T; readonly set: (identifier: ProxyIdentifier, instance: R) => R; diff --git a/src/vs/workbench/api/common/extHostStorage.ts b/src/vs/workbench/api/common/extHostStorage.ts index efa42fa2142..71bb81ef6c8 100644 --- a/src/vs/workbench/api/common/extHostStorage.ts +++ b/src/vs/workbench/api/common/extHostStorage.ts @@ -16,7 +16,7 @@ export interface IStorageChangeEvent { export class ExtHostStorage implements ExtHostStorageShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private _proxy: MainThreadStorageShape; diff --git a/src/vs/workbench/api/common/extHostStoragePaths.ts b/src/vs/workbench/api/common/extHostStoragePaths.ts index 0dcaba0f791..cd73bf5563b 100644 --- a/src/vs/workbench/api/common/extHostStoragePaths.ts +++ b/src/vs/workbench/api/common/extHostStoragePaths.ts @@ -9,7 +9,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const IExtensionStoragePaths = createDecorator('IExtensionStoragePaths'); export interface IExtensionStoragePaths { - _serviceBrand: any; + _serviceBrand: undefined; whenReady: Promise; workspaceValue(extension: IExtensionDescription): string | undefined; globalValue(extension: IExtensionDescription): string; diff --git a/src/vs/workbench/api/common/extHostTask.ts b/src/vs/workbench/api/common/extHostTask.ts index e6233ae01a6..8820dbc8c92 100644 --- a/src/vs/workbench/api/common/extHostTask.ts +++ b/src/vs/workbench/api/common/extHostTask.ts @@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export interface IExtHostTask extends ExtHostTaskShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; taskExecutions: vscode.TaskExecution[]; onDidStartTask: Event; diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index fcd283b560c..ee870c3abf6 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -11,7 +11,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export interface IExtHostTerminalService extends ExtHostTerminalServiceShape { - _serviceBrand: any; + _serviceBrand: undefined; activeTerminal: vscode.Terminal | undefined; terminals: vscode.Terminal[]; diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 1fdc6fef86f..6a050937ddb 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -28,7 +28,7 @@ import * as marked from 'vs/base/common/marked/marked'; import { parse } from 'vs/base/common/marshalling'; import { cloneAndChange } from 'vs/base/common/objects'; import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log'; -import { coalesce } from 'vs/base/common/arrays'; +import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays'; import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions'; export interface PositionLike { @@ -556,22 +556,40 @@ export namespace SymbolKind { } } +export namespace SymbolTag { + + export function from(kind: types.SymbolTag): modes.SymbolTag { + switch (kind) { + case types.SymbolTag.Deprecated: return modes.SymbolTag.Deprecated; + } + } + + export function to(kind: modes.SymbolTag): types.SymbolTag { + switch (kind) { + case modes.SymbolTag.Deprecated: return types.SymbolTag.Deprecated; + } + } +} + export namespace WorkspaceSymbol { export function from(info: vscode.SymbolInformation): search.IWorkspaceSymbol { return { name: info.name, kind: SymbolKind.from(info.kind), + tags: info.tags && info.tags.map(SymbolTag.from), containerName: info.containerName, location: location.from(info.location) }; } export function to(info: search.IWorkspaceSymbol): types.SymbolInformation { - return new types.SymbolInformation( + const result = new types.SymbolInformation( info.name, SymbolKind.to(info.kind), info.containerName, location.to(info.location) ); + result.tags = info.tags && info.tags.map(SymbolTag.to); + return result; } } @@ -582,7 +600,8 @@ export namespace DocumentSymbol { detail: info.detail, range: Range.from(info.range), selectionRange: Range.from(info.selectionRange), - kind: SymbolKind.from(info.kind) + kind: SymbolKind.from(info.kind), + tags: info.tags ? info.tags.map(SymbolTag.from) : [] }; if (info.children) { result.children = info.children.map(from); @@ -597,6 +616,9 @@ export namespace DocumentSymbol { Range.to(info.range), Range.to(info.selectionRange), ); + if (isNonEmptyArray(info.tags)) { + result.tags = info.tags.map(SymbolTag.to); + } if (info.children) { result.children = info.children.map(to) as any; } @@ -681,17 +703,17 @@ export namespace CompletionContext { } } -export namespace CompletionItemKindModifier { +export namespace CompletionItemTag { - export function from(kind: types.CompletionItemKindModifier): modes.CompletionItemKindModifier { + export function from(kind: types.CompletionItemTag): modes.CompletionItemTag { switch (kind) { - case types.CompletionItemKindModifier.Deprecated: return modes.CompletionItemKindModifier.Deprecated; + case types.CompletionItemTag.Deprecated: return modes.CompletionItemTag.Deprecated; } } - export function to(kind: modes.CompletionItemKindModifier): types.CompletionItemKindModifier { + export function to(kind: modes.CompletionItemTag): types.CompletionItemTag { switch (kind) { - case modes.CompletionItemKindModifier.Deprecated: return types.CompletionItemKindModifier.Deprecated; + case modes.CompletionItemTag.Deprecated: return types.CompletionItemTag.Deprecated; } } } @@ -767,6 +789,7 @@ export namespace CompletionItem { const result = new types.CompletionItem(suggestion.label); result.insertText = suggestion.insertText; result.kind = CompletionItemKind.to(suggestion.kind); + result.tags = suggestion.tags && suggestion.tags.map(CompletionItemTag.to); result.detail = suggestion.detail; result.documentation = htmlContent.isMarkdownString(suggestion.documentation) ? MarkdownString.to(suggestion.documentation) : suggestion.documentation; result.sortText = suggestion.sortText; diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 53031ca7ca1..d7b513afd22 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -979,6 +979,10 @@ export enum SymbolKind { TypeParameter = 25 } +export enum SymbolTag { + Deprecated = 1, +} + @es5ClassCompat export class SymbolInformation { @@ -991,6 +995,7 @@ export class SymbolInformation { name: string; location!: Location; kind: SymbolKind; + tags?: SymbolTag[]; containerName: string | undefined; constructor(name: string, kind: SymbolKind, containerName: string | undefined, location: Location); @@ -1041,6 +1046,7 @@ export class DocumentSymbol { name: string; detail: string; kind: SymbolKind; + tags?: SymbolTag[]; range: Range; selectionRange: Range; children: DocumentSymbol[]; @@ -1308,7 +1314,7 @@ export enum CompletionItemKind { TypeParameter = 24 } -export enum CompletionItemKindModifier { +export enum CompletionItemTag { Deprecated = 1, } @@ -1317,7 +1323,7 @@ export class CompletionItem implements vscode.CompletionItem { label: string; kind?: CompletionItemKind; - kind2?: CompletionItemKind | { base: CompletionItemKind, modifier: CompletionItemKindModifier[] }; + tags?: CompletionItemTag[]; detail?: string; documentation?: string | MarkdownString; sortText?: string; @@ -2339,11 +2345,6 @@ export class QuickInputButtons { private constructor() { } } -export enum ExtensionExecutionContext { - Local = 1, - Remote = 2 -} - export enum ExtensionKind { UI = 1, Workspace = 2 diff --git a/src/vs/workbench/api/common/extHostUriTransformerService.ts b/src/vs/workbench/api/common/extHostUriTransformerService.ts index e9acd9bc5d6..97b00f23806 100644 --- a/src/vs/workbench/api/common/extHostUriTransformerService.ts +++ b/src/vs/workbench/api/common/extHostUriTransformerService.ts @@ -8,13 +8,13 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' import { URI, UriComponents } from 'vs/base/common/uri'; export interface IURITransformerService extends IURITransformer { - _serviceBrand: any; + _serviceBrand: undefined; } export const IURITransformerService = createDecorator('IURITransformerService'); export class URITransformerService implements IURITransformerService { - _serviceBrand: any; + _serviceBrand: undefined; transformIncoming: (uri: UriComponents) => UriComponents; transformOutgoing: (uri: UriComponents) => UriComponents; diff --git a/src/vs/workbench/api/common/extHostUrls.ts b/src/vs/workbench/api/common/extHostUrls.ts index 28647224848..6b6f8081ae5 100644 --- a/src/vs/workbench/api/common/extHostUrls.ts +++ b/src/vs/workbench/api/common/extHostUrls.ts @@ -56,7 +56,7 @@ export class ExtHostUrls implements ExtHostUrlsShape { return Promise.resolve(undefined); } - async createAppUri(extensionId: ExtensionIdentifier, options?: vscode.env.AppUriOptions): Promise { + async createAppUri(extensionId: ExtensionIdentifier, options?: vscode.AppUriOptions): Promise { return URI.revive(await this._proxy.$createAppUri(extensionId, options)); } } diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index d0eea9511b9..d4b554e00cc 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -298,8 +298,32 @@ export class ExtHostWebviews implements ExtHostWebviewsShape { } } + public $onMissingCsp( + _handle: WebviewPanelHandle, + extensionId: string + ): void { + console.warn(`${extensionId} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`); + } + public $onDidChangeWebviewPanelViewStates(newStates: WebviewPanelViewStateData): void { - for (const handle of Object.keys(newStates)) { + const handles = Object.keys(newStates); + // Notify webviews of state changes in the following order: + // - Non-visible + // - Visible + // - Active + handles.sort((a, b) => { + const stateA = newStates[a]; + const stateB = newStates[b]; + if (stateA.active) { + return 1; + } + if (stateB.active) { + return -1; + } + return (+stateA.visible) - (+stateB.visible); + }); + + for (const handle of handles) { const panel = this.getWebviewPanel(handle); if (!panel || panel._isDisposed) { continue; diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index d217d63b4d6..f8f7db908dc 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -156,7 +156,7 @@ class ExtHostWorkspaceImpl extends Workspace { export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspaceProvider { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _onDidChangeWorkspace = new Emitter(); readonly onDidChangeWorkspace: Event = this._onDidChangeWorkspace.event; diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index c82f788a370..82c653c9c37 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -41,7 +41,7 @@ import { IExtHostDebugService } from 'vs/workbench/api/common/extHostDebugServic export class ExtHostDebugService implements IExtHostDebugService, ExtHostDebugServiceShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private _configProviderHandleCounter: number; private _configProviders: ConfigProviderTuple[]; diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index 3a69496d989..fd194124907 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -13,6 +13,7 @@ import { dirExists, mkdirp } from 'vs/base/node/pfs'; import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputService, LazyOutputChannel } from 'vs/workbench/api/common/extHostOutput'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; +import { MutableDisposable } from 'vs/base/common/lifecycle'; export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel { @@ -49,6 +50,8 @@ export class ExtHostOutputService2 extends ExtHostOutputService { private _logsLocation: URI; private _namePool: number = 1; + private readonly _channels: Map = new Map(); + private readonly _visibleChannelDisposable = new MutableDisposable(); constructor( @IExtHostRpcService extHostRpc: IExtHostRpcService, @@ -58,12 +61,23 @@ export class ExtHostOutputService2 extends ExtHostOutputService { this._logsLocation = initData.logsLocation; } + $setVisibleChannel(channelId: string): void { + if (channelId) { + const channel = this._channels.get(channelId); + if (channel) { + this._visibleChannelDisposable.value = channel.onDidAppend(() => channel.update()); + } + } + } + createOutputChannel(name: string): vscode.OutputChannel { name = name.trim(); if (!name) { throw new Error('illegal argument `name`. must not be falsy'); } - return new LazyOutputChannel(name, this._doCreateOutChannel(name)); + const extHostOutputChannel = this._doCreateOutChannel(name); + extHostOutputChannel.then(channel => channel._id.then(id => this._channels.set(id, channel))); + return new LazyOutputChannel(name, extHostOutputChannel); } private async _doCreateOutChannel(name: string): Promise { diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index cf9b522ef11..2e194117598 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -357,7 +357,7 @@ interface HandlerData { export class ExtHostTask implements ExtHostTaskShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _proxy: MainThreadTaskShape; private readonly _workspaceProvider: IExtHostWorkspaceProvider; diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index 5c5d76564f8..345e2c5b312 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -199,7 +199,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi export class ExtHostTerminalService implements IExtHostTerminalService, ExtHostTerminalServiceShape { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private _proxy: MainThreadTerminalServiceShape; private _activeTerminal: ExtHostTerminal | undefined; @@ -738,7 +738,7 @@ class ExtHostPseudoterminal implements ITerminalChildProcess { // Attach the listeners this._pty.onDidWrite(e => this._onProcessData.fire(e)); if (this._pty.onDidClose) { - this._pty.onDidClose(e => this._onProcessExit.fire(0)); + this._pty.onDidClose(e => this._onProcessExit.fire(e || 0)); } if (this._pty.onDidOverrideDimensions) { this._pty.onDidOverrideDimensions(e => this._onProcessOverrideDimensions.fire(e ? { cols: e.columns, rows: e.rows } : e)); diff --git a/src/vs/workbench/api/worker/extHostLogService.ts b/src/vs/workbench/api/worker/extHostLogService.ts index d29f41ec939..a69842324a6 100644 --- a/src/vs/workbench/api/worker/extHostLogService.ts +++ b/src/vs/workbench/api/worker/extHostLogService.ts @@ -15,7 +15,7 @@ import { localize } from 'vs/nls'; export class ExtHostLogService extends AbstractLogService implements ILogService, ExtHostLogServiceShape { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _proxy: MainThreadLogShape; private readonly _logFile: UriComponents; diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 51962ccc1b8..59b4771c906 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -234,8 +234,7 @@ export class ToggleEditorVisibilityAction extends Action { } run(): Promise { - const hideEditor = this.layoutService.isVisible(Parts.EDITOR_PART); - this.layoutService.setEditorHidden(hideEditor); + this.layoutService.toggleMaximizedPanel(); return Promise.resolve(); } diff --git a/src/vs/workbench/browser/composite.ts b/src/vs/workbench/browser/composite.ts index bab3dcfb849..1c8f30a8f20 100644 --- a/src/vs/workbench/browser/composite.ts +++ b/src/vs/workbench/browser/composite.ts @@ -84,8 +84,8 @@ export abstract class Composite extends Component implements IComposite { this.visible = false; } - getTitle(): string | null { - return null; + getTitle(): string | undefined { + return undefined; } protected get telemetryService(): ITelemetryService { diff --git a/src/vs/workbench/browser/contextkeys.ts b/src/vs/workbench/browser/contextkeys.ts index 10bb2639e9e..8dd9b550273 100644 --- a/src/vs/workbench/browser/contextkeys.ts +++ b/src/vs/workbench/browser/contextkeys.ts @@ -209,7 +209,7 @@ export class WorkbenchContextKeysHandler extends Disposable { this.multipleEditorGroupsContext.reset(); } - this.activeEditorGroupIndex.set(activeGroup.index); + this.activeEditorGroupIndex.set(activeGroup.index + 1); // not zero-indexed this.activeEditorGroupLast.set(activeGroup.index === groupCount - 1); if (activeControl) { diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 92ef4ff66f8..80ae6faffc3 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -21,7 +21,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { ITitleService } from 'vs/workbench/services/title/common/titleService'; -import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { LifecyclePhase, StartupKind, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IWindowService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -60,6 +60,8 @@ enum Storage { PANEL_SIZE = 'workbench.panel.size', PANEL_SIZE_BEFORE_MAXIMIZED = 'workbench.panel.sizeBeforeMaximized', + EDITOR_HIDDEN = 'workbench.editor.hidden', + ZEN_MODE_ENABLED = 'workbench.zenmode.active', CENTERED_LAYOUT_ENABLED = 'workbench.centerededitorlayout.active', @@ -78,7 +80,7 @@ enum Classes { export abstract class Layout extends Disposable implements IWorkbenchLayoutService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _onTitleBarVisibilityChange: Emitter = this._register(new Emitter()); readonly onTitleBarVisibilityChange: Event = this._onTitleBarVisibilityChange.event; @@ -220,8 +222,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi private registerLayoutListeners(): void { // Restore editor if hidden and it changes - this._register(this.editorService.onDidVisibleEditorsChange(() => this.setEditorHidden(false))); - this._register(this.editorGroupService.onDidActivateGroup(() => this.setEditorHidden(false))); + const showEditorIfHidden = () => { + if (this.state.editor.hidden) { + this.toggleMaximizedPanel(); + } + }; + + + this._register(this.editorService.onDidVisibleEditorsChange(showEditorIfHidden)); + this._register(this.editorGroupService.onDidActivateGroup(showEditorIfHidden)); // Configuration changes this._register(this.configurationService.onDidChangeConfiguration(() => this.doUpdateLayoutConfiguration())); @@ -601,6 +610,23 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi return offset; } + getMaximumEditorDimensions(): Dimension { + const takenWidth = + (this.isVisible(Parts.ACTIVITYBAR_PART) ? this.activityBarPartView.minimumWidth : 0) + + (this.isVisible(Parts.SIDEBAR_PART) ? this.sideBarPartView.minimumWidth : 0) + + (this.isVisible(Parts.PANEL_PART) && this.state.panel.position === Position.RIGHT ? this.panelPartView.minimumWidth : 0); + + const takenHeight = + (this.isVisible(Parts.TITLEBAR_PART) ? this.titleBarPartView.minimumHeight : 0) + + (this.isVisible(Parts.STATUSBAR_PART) ? this.statusBarPartView.minimumHeight : 0) + + (this.isVisible(Parts.PANEL_PART) && this.state.panel.position === Position.BOTTOM ? this.panelPartView.minimumHeight : 0); + + const availableWidth = this.dimension.width - takenWidth; + const availableHeight = this.dimension.height - takenHeight; + + return { width: availableWidth, height: availableHeight }; + } + getWorkbenchContainer(): HTMLElement { return this.parent; } @@ -617,7 +643,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi // To properly reset line numbers we need to read the configuration for each editor respecting it's uri. if (!lineNumbers && isCodeEditor(editor) && editor.hasModel()) { const model = editor.getModel(); - lineNumbers = this.configurationService.getValue('editor.lineNumbers', { resource: model.uri }); + lineNumbers = this.configurationService.getValue('editor.lineNumbers', { resource: model.uri, overrideIdentifier: model.getModeId() }); } if (!lineNumbers) { lineNumbers = this.configurationService.getValue('editor.lineNumbers'); @@ -769,16 +795,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi const sideBar = this.getPart(Parts.SIDEBAR_PART); const statusBar = this.getPart(Parts.STATUSBAR_PART); + // View references for all parts + this.titleBarPartView = titleBar; + this.sideBarPartView = sideBar; + this.activityBarPartView = activityBar; + this.editorPartView = editorPart; + this.panelPartView = panelPart; + this.statusBarPartView = statusBar; + if (this.configurationService.getValue('workbench.useExperimentalGridLayout')) { - - // View references for all parts - this.titleBarPartView = titleBar; - this.sideBarPartView = sideBar; - this.activityBarPartView = activityBar; - this.editorPartView = editorPart; - this.panelPartView = panelPart; - this.statusBarPartView = statusBar; - const viewMap = { [Parts.ACTIVITYBAR_PART]: this.activityBarPartView, [Parts.TITLEBAR_PART]: this.titleBarPartView, @@ -985,6 +1010,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi // Propagate to grid this.workbenchGrid.setViewVisible(this.editorPartView, !hidden); + // Remember in settings + if (hidden) { + this.storageService.store(Storage.EDITOR_HIDDEN, true, StorageScope.WORKSPACE); + } else { + this.storageService.remove(Storage.EDITOR_HIDDEN, StorageScope.WORKSPACE); + } + // The editor and panel cannot be hidden at the same time if (hidden && this.state.panel.hidden) { this.setPanelHidden(false, true); @@ -1110,7 +1142,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi if (this.workbenchGrid instanceof Grid) { const size = this.workbenchGrid.getViewSize(this.panelPartView); if (!this.isPanelMaximized()) { - this.state.panel.sizeBeforeMaximize = this.state.panel.position === Position.BOTTOM ? size.height : size.width; + if (this.state.panel.hidden) { + this.state.panel.sizeBeforeMaximize = this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView) || this.panelPartView.minimumHeight; + } else { + this.state.panel.sizeBeforeMaximize = this.state.panel.position === Position.BOTTOM ? size.height : size.width; + } + this.storageService.store(Storage.PANEL_SIZE_BEFORE_MAXIMIZED, this.state.panel.sizeBeforeMaximize, StorageScope.GLOBAL); this.setEditorHidden(true); } else { @@ -1215,6 +1252,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi // At some point, we will not fall back to old keys from legacy layout, but for now, let's migrate the keys const sideBarSize = this.storageService.getNumber(Storage.SIDEBAR_SIZE, StorageScope.GLOBAL, this.storageService.getNumber('workbench.sidebar.width', StorageScope.GLOBAL, Math.min(workbenchDimensions.width / 4, 300))!); const panelSize = this.storageService.getNumber(Storage.PANEL_SIZE, StorageScope.GLOBAL, this.storageService.getNumber(this.state.panel.position === Position.BOTTOM ? 'workbench.panel.height' : 'workbench.panel.width', StorageScope.GLOBAL, workbenchDimensions.height / 3)); + const wasEditorHidden = this.storageService.getBoolean(Storage.EDITOR_HIDDEN, StorageScope.WORKSPACE, false); const titleBarHeight = this.titleBarPartView.minimumHeight; const statusBarHeight = this.statusBarPartView.minimumHeight; @@ -1239,13 +1277,14 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi const editorNode: ISerializedLeafNode = { type: 'leaf', data: { type: Parts.EDITOR_PART }, - size: this.state.panel.position === Position.BOTTOM ? middleSectionHeight - (this.state.panel.hidden ? 0 : panelSize) : editorSectionWidth - (this.state.panel.hidden ? 0 : panelSize) + size: this.state.panel.position === Position.BOTTOM ? middleSectionHeight - (this.state.panel.hidden ? 0 : panelSize) : editorSectionWidth - (this.state.panel.hidden ? 0 : panelSize), + visible: true }; const panelNode: ISerializedLeafNode = { type: 'leaf', data: { type: Parts.PANEL_PART }, - size: panelSize, + size: wasEditorHidden ? this.state.panel.sizeBeforeMaximize : panelSize, visible: !this.state.panel.hidden }; diff --git a/src/vs/workbench/browser/part.ts b/src/vs/workbench/browser/part.ts index c78ad168cb7..da759cd76e1 100644 --- a/src/vs/workbench/browser/part.ts +++ b/src/vs/workbench/browser/part.ts @@ -33,8 +33,8 @@ export abstract class Part extends Component implements ISerializableView { get dimension(): Dimension { return this._dimension; } private parent: HTMLElement; - private titleArea: HTMLElement | null; - private contentArea: HTMLElement | null; + private titleArea: HTMLElement | null = null; + private contentArea: HTMLElement | null = null; private partLayout: PartLayout; constructor( diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index f2d8631a6c3..5d56b84987b 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -14,7 +14,7 @@ import { GlobalActivityActionViewItem, ViewletActivityAction, ToggleViewletActio import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IBadge } from 'vs/workbench/services/activity/common/activity'; import { IWorkbenchLayoutService, Parts, Position as SideBarPosition } from 'vs/workbench/services/layout/browser/layoutService'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/layoutActions'; import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService'; @@ -48,7 +48,7 @@ interface ICachedViewlet { export class ActivitybarPart extends Part implements IActivityBarService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private static readonly ACTION_HEIGHT = 48; private static readonly PINNED_VIEWLETS = 'workbench.activity.pinnedViewlets'; diff --git a/src/vs/workbench/browser/parts/compositePart.ts b/src/vs/workbench/browser/parts/compositePart.ts index 95c15731550..adac882f1d3 100644 --- a/src/vs/workbench/browser/parts/compositePart.ts +++ b/src/vs/workbench/browser/parts/compositePart.ts @@ -32,7 +32,6 @@ import { attachProgressBarStyler } from 'vs/platform/theme/common/styler'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { Dimension, append, $, addClass, hide, show, addClasses } from 'vs/base/browser/dom'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; -import { withNullAsUndefined } from 'vs/base/common/types'; export interface ICompositeTitleLabel { @@ -240,7 +239,7 @@ export abstract class CompositePart extends Part { // Update title with composite title if it differs from descriptor const descriptor = this.registry.getComposite(composite.getId()); if (descriptor && descriptor.name !== composite.getTitle()) { - this.updateTitle(composite.getId(), withNullAsUndefined(composite.getTitle())); + this.updateTitle(composite.getId(), composite.getTitle()); } // Handle Composite Actions diff --git a/src/vs/workbench/browser/parts/editor/baseEditor.ts b/src/vs/workbench/browser/parts/editor/baseEditor.ts index 53f5fa55ce7..a830603ce58 100644 --- a/src/vs/workbench/browser/parts/editor/baseEditor.ts +++ b/src/vs/workbench/browser/parts/editor/baseEditor.ts @@ -41,8 +41,8 @@ export abstract class BaseEditor extends Panel implements IEditor { readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; } | undefined> = Event.None; - protected _input: EditorInput | null; - protected _options: EditorOptions | null; + protected _input: EditorInput | undefined; + protected _options: EditorOptions | undefined; private _group?: IEditorGroup; @@ -55,11 +55,11 @@ export abstract class BaseEditor extends Panel implements IEditor { super(id, telemetryService, themeService, storageService); } - get input(): EditorInput | null { + get input(): EditorInput | undefined { return this._input; } - get options(): EditorOptions | null { + get options(): EditorOptions | undefined { return this._options; } @@ -78,7 +78,7 @@ export abstract class BaseEditor extends Panel implements IEditor { * The provided cancellation token should be used to test if the operation * was cancelled. */ - setInput(input: EditorInput, options: EditorOptions | null, token: CancellationToken): Promise { + setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { this._input = input; this._options = options; @@ -90,8 +90,8 @@ export abstract class BaseEditor extends Panel implements IEditor { * resources associated with the input should be freed. */ clearInput(): void { - this._input = null; - this._options = null; + this._input = undefined; + this._options = undefined; } /** @@ -101,7 +101,7 @@ export abstract class BaseEditor extends Panel implements IEditor { * Sets the given options to the editor. Clients should apply the options * to the current input. */ - setOptions(options: EditorOptions | null): void { + setOptions(options: EditorOptions | undefined): void { this._options = options; } @@ -160,8 +160,8 @@ export abstract class BaseEditor extends Panel implements IEditor { } dispose(): void { - this._input = null; - this._options = null; + this._input = undefined; + this._options = undefined; super.dispose(); } @@ -172,7 +172,7 @@ interface MapGroupToMemento { } export class EditorMemento implements IEditorMemento { - private cache: LRUCache>; + private cache: LRUCache> | undefined; private cleanedUp = false; constructor( diff --git a/src/vs/workbench/browser/parts/editor/binaryEditor.ts b/src/vs/workbench/browser/parts/editor/binaryEditor.ts index 81a6096128b..9445929501c 100644 --- a/src/vs/workbench/browser/parts/editor/binaryEditor.ts +++ b/src/vs/workbench/browser/parts/editor/binaryEditor.ts @@ -23,7 +23,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; export interface IOpenCallbacks { - openInternal: (input: EditorInput, options: EditorOptions) => Promise; + openInternal: (input: EditorInput, options: EditorOptions | undefined) => Promise; openExternal: (uri: URI) => void; } @@ -76,7 +76,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { parent.appendChild(this.scrollbar.getDomNode()); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { await super.setInput(input, options, token); const model = await input.resolve(); @@ -102,7 +102,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { }, this.instantiationService); } - private async handleOpenInternalCallback(input: EditorInput, options: EditorOptions): Promise { + private async handleOpenInternalCallback(input: EditorInput, options: EditorOptions | undefined): Promise { await this.callbacks.openInternal(input, options); // Signal to listeners that the binary editor has been opened in-place diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts index 0bd6c69fbdc..96a35f5a192 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts @@ -11,7 +11,7 @@ import { localize } from 'vs/nls'; import { IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Registry } from 'vs/platform/registry/common/platform'; import { GroupIdentifier } from 'vs/workbench/common/editor'; @@ -19,7 +19,7 @@ export const IBreadcrumbsService = createDecorator('IEditor export interface IBreadcrumbsService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; register(group: GroupIdentifier, widget: BreadcrumbsWidget): IDisposable; @@ -29,7 +29,7 @@ export interface IBreadcrumbsService { export class BreadcrumbsService implements IBreadcrumbsService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _map = new Map(); diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 16a20027c9e..b34cd439d03 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -374,7 +374,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { const labels = this._instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER /* TODO@Jo visibility propagation */); this._disposables.add(labels); - return this._instantiationService.createInstance(WorkbenchAsyncDataTree, container, new FileVirtualDelegate(), [this._instantiationService.createInstance(FileRenderer, labels)], this._instantiationService.createInstance(FileDataSource), { + return this._instantiationService.createInstance(WorkbenchAsyncDataTree, 'BreadcrumbsFilePicker', container, new FileVirtualDelegate(), [this._instantiationService.createInstance(FileRenderer, labels)], this._instantiationService.createInstance(FileDataSource), { multipleSelectionSupport: false, sorter: new FileSorter(), filter: this._instantiationService.createInstance(FileFilter), @@ -440,6 +440,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { protected _createTree(container: HTMLElement) { return this._instantiationService.createInstance( WorkbenchDataTree, + 'BreadcrumbsOutlinePicker', container, new OutlineVirtualDelegate(), [new OutlineGroupRenderer(), this._instantiationService.createInstance(OutlineElementRenderer)], diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 31daf2483f5..915c264daea 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -229,7 +229,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeEOLAction, Chang registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeEncodingAction, ChangeEncodingAction.ID, ChangeEncodingAction.LABEL), 'Change File Encoding'); export class QuickOpenActionContributor extends ActionBarContributor { - private openToSideActionInstance: OpenToSideFromQuickOpenAction; + private openToSideActionInstance: OpenToSideFromQuickOpenAction | undefined; constructor(@IInstantiationService private readonly instantiationService: IInstantiationService) { super(); @@ -442,7 +442,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '5_split', order: 40 }); // Editor Title Menu -MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleSideBySideView', "Toggle Side By Side View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') }); +MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleInlineView', "Toggle Inline View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.SHOW_EDITORS_IN_GROUP, title: nls.localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '5_close', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 634812bfa84..b2e46d001d6 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -94,6 +94,7 @@ export interface IEditorGroupsAccessor { getGroups(order: GroupsOrder): IEditorGroupView[]; activateGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView; + restoreGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView; addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView; mergeGroup(group: IEditorGroupView | GroupIdentifier, target: IEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroupView; diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index 0464d3131be..7b4cab33ed8 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -618,12 +618,24 @@ export abstract class BaseCloseAllAction extends Action { async run(): Promise { - // Just close all if there are no or one dirty editor - if (this.textFileService.getDirty().length < 2) { + // Just close all if there are no dirty editors + if (!this.textFileService.isDirty()) { return this.doCloseAll(); } - // Otherwise ask for combined confirmation + // Otherwise ask for combined confirmation and make sure + // to bring each dirty editor to the front so that the user + // can review if the files should be changed or not. + await Promise.all(this.groupsToClose.map(async groupToClose => { + for (const editor of groupToClose.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE)) { + if (editor.isDirty()) { + return groupToClose.openEditor(editor); + } + } + + return undefined; + })); + const confirm = await this.textFileService.confirmSave(); if (confirm === ConfirmResult.CANCEL) { return; diff --git a/src/vs/workbench/browser/parts/editor/editorCommands.ts b/src/vs/workbench/browser/parts/editor/editorCommands.ts index 638c44e147e..654a9c96650 100644 --- a/src/vs/workbench/browser/parts/editor/editorCommands.ts +++ b/src/vs/workbench/browser/parts/editor/editorCommands.ts @@ -263,7 +263,10 @@ function registerDiffEditorCommands(): void { const candidates = [editorService.activeControl, ...editorService.visibleControls].filter(e => e instanceof TextDiffEditor); if (candidates.length > 0) { - next ? (candidates[0]).getDiffNavigator().next() : (candidates[0]).getDiffNavigator().previous(); + const navigator = (candidates[0]).getDiffNavigator(); + if (navigator) { + next ? navigator.next() : navigator.previous(); + } } } diff --git a/src/vs/workbench/browser/parts/editor/editorControl.ts b/src/vs/workbench/browser/parts/editor/editorControl.ts index 70d57bba5ad..898d7339fef 100644 --- a/src/vs/workbench/browser/parts/editor/editorControl.ts +++ b/src/vs/workbench/browser/parts/editor/editorControl.ts @@ -15,7 +15,6 @@ import { IEditorProgressService, LongRunningOperation } from 'vs/platform/progre import { IEditorGroupView, DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor'; import { Event, Emitter } from 'vs/base/common/event'; import { IVisibleEditor } from 'vs/workbench/services/editor/common/editorService'; -import { withUndefinedAsNull } from 'vs/base/common/types'; export interface IOpenEditorResult { readonly control: BaseEditor; @@ -35,11 +34,11 @@ export class EditorControl extends Disposable { private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; } | undefined>()); get onDidSizeConstraintsChange(): Event<{ width: number; height: number; } | undefined> { return this._onDidSizeConstraintsChange.event; } - private _activeControl: BaseEditor | null; + private _activeControl: BaseEditor | null = null; private controls: BaseEditor[] = []; private readonly activeControlDisposables = this._register(new DisposableStore()); - private dimension: Dimension; + private dimension: Dimension | undefined; private editorOperation: LongRunningOperation; constructor( @@ -68,7 +67,7 @@ export class EditorControl extends Disposable { const control = this.doShowEditorControl(descriptor); // Set input - const editorChanged = await this.doSetInput(control, editor, withUndefinedAsNull(options)); + const editorChanged = await this.doSetInput(control, editor, options); return { control, editorChanged }; } @@ -112,7 +111,7 @@ export class EditorControl extends Disposable { if (!control.getContainer()) { const controlInstanceContainer = document.createElement('div'); addClass(controlInstanceContainer, 'editor-instance'); - controlInstanceContainer.id = descriptor.getId(); + controlInstanceContainer.setAttribute('data-editor-id', descriptor.getId()); control.create(controlInstanceContainer); } @@ -151,7 +150,7 @@ export class EditorControl extends Disposable { this._onDidSizeConstraintsChange.fire(undefined); } - private async doSetInput(control: BaseEditor, editor: EditorInput, options: EditorOptions | null): Promise { + private async doSetInput(control: BaseEditor, editor: EditorInput, options: EditorOptions | undefined): Promise { // If the input did not change, return early and only apply the options // unless the options instruct us to force open it even if it is the same diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts index 97cabc264b6..2113a4e7c50 100644 --- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts +++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts @@ -25,11 +25,11 @@ class DropOverlay extends Themable { private static OVERLAY_ID = 'monaco-workbench-editor-drop-overlay'; - private container: HTMLElement; - private overlay: HTMLElement; + private container!: HTMLElement; + private overlay!: HTMLElement; - private currentDropOperation?: IDropOperation; - private _disposed: boolean; + private currentDropOperation: IDropOperation | undefined; + private _disposed: boolean | undefined; private cleanupOverlayScheduler: RunOnceScheduler; @@ -50,7 +50,7 @@ class DropOverlay extends Themable { } get disposed(): boolean { - return this._disposed; + return !!this._disposed; } private create(): void { diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index dcfc2b8e358..dda9116bc9a 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -49,6 +49,7 @@ import { hash } from 'vs/base/common/hash'; import { guessMimeTypes } from 'vs/base/common/mime'; import { extname } from 'vs/base/common/resources'; import { Schemas } from 'vs/base/common/network'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; export class EditorGroupView extends Themable implements IEditorGroupView { @@ -481,7 +482,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView { private onDidEditorOpen(editor: EditorInput): void { - // Telemetry /* __GDPR__ "editorOpened" : { "${include}": [ @@ -520,14 +520,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView { } }); - // Telemetry /* __GDPR__ - "editorClosed" : { - "${include}": [ - "${EditorTelemetryDescriptor}" - ] - } - */ + "editorClosed" : { + "${include}": [ + "${EditorTelemetryDescriptor}" + ] + } + */ this.telemetryService.publicLog('editorClosed', this.toEditorTelemetryDescriptor(event.editor)); // Update container @@ -833,12 +832,35 @@ export class EditorGroupView extends Themable implements IEditorGroupView { openEditorOptions.active = true; } - // Set group active unless we open inactive or preserve focus + let activateGroup = false; + let restoreGroup = false; + + if (options && options.activation === EditorActivation.ACTIVATE) { + // Respect option to force activate an editor group. + activateGroup = true; + } else if (options && options.activation === EditorActivation.RESTORE) { + // Respect option to force restore an editor group. + restoreGroup = true; + } else if (options && options.activation === EditorActivation.PRESERVE) { + // Respect option to preserve active editor group. + activateGroup = false; + restoreGroup = false; + } else if (openEditorOptions.active) { + // Finally, we only activate/restore an editor which is + // opening as active editor. + // If preserveFocus is enabled, we only restore but never + // activate the group. + activateGroup = !options || !options.preserveFocus; + restoreGroup = !activateGroup; + } + // Do this before we open the editor in the group to prevent a false // active editor change event before the editor is loaded // (see https://github.com/Microsoft/vscode/issues/51679) - if (openEditorOptions.active && (!options || !options.preserveFocus)) { + if (activateGroup) { this.accessor.activateGroup(this); + } else if (restoreGroup) { + this.accessor.restoreGroup(this); } // Actually move the editor if a specific index is provided and we figure diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 8bb14cc38a3..a3dec299bc6 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -10,7 +10,7 @@ import { Dimension, isAncestor, toggleClass, addClass, $ } from 'vs/base/browser import { Event, Emitter, Relay } from 'vs/base/common/event'; import { contrastBorder, editorBackground } from 'vs/platform/theme/common/colorRegistry'; import { GroupDirection, IAddGroupOptions, GroupsArrangement, GroupOrientation, IMergeGroupOptions, MergeGroupMode, ICopyEditorOptions, GroupsOrder, GroupChangeKind, GroupLocation, IFindGroupScope, EditorGroupLayout, GroupLayoutArgument, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IView, orthogonal, LayoutPriority, IViewSize, Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid'; import { GroupIdentifier, IWorkbenchEditorConfiguration, IEditorPartOptions } from 'vs/workbench/common/editor'; import { values } from 'vs/base/common/map'; @@ -81,7 +81,7 @@ class GridWidgetView implements IView { export class EditorPart extends Part implements IEditorGroupsService, IEditorGroupsAccessor { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private static readonly EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.state'; private static readonly EDITOR_PART_CENTERED_VIEW_STORAGE_KEY = 'editorpart.centeredview'; @@ -140,7 +140,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro @IThemeService themeService: IThemeService, @IConfigurationService private readonly configurationService: IConfigurationService, @IStorageService storageService: IStorageService, - @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService + @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService ) { super(Parts.EDITOR_PART, { hasTitle: false }, themeService, storageService, layoutService); @@ -325,6 +325,13 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro return groupView; } + restoreGroup(group: IEditorGroupView | GroupIdentifier): IEditorGroupView { + const groupView = this.assertGroupView(group); + this.doRestoreGroup(groupView); + + return groupView; + } + getSize(group: IEditorGroupView | GroupIdentifier): { width: number, height: number } { const groupView = this.assertGroupView(group); @@ -337,7 +344,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro this.gridWidget.resizeView(groupView, size); } - arrangeGroups(arrangement: GroupsArrangement): void { + arrangeGroups(arrangement: GroupsArrangement, target = this.activeGroup): void { if (this.count < 2) { return; // require at least 2 groups to show } @@ -351,10 +358,10 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro this.gridWidget.distributeViewSizes(); break; case GroupsArrangement.MINIMIZE_OTHERS: - this.gridWidget.maximizeViewSize(this.activeGroup); + this.gridWidget.maximizeViewSize(target); break; case GroupsArrangement.TOGGLE: - if (this.isGroupMaximized(this.activeGroup)) { + if (this.isGroupMaximized(target)) { this.arrangeGroups(GroupsArrangement.EVEN); } else { this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); @@ -576,17 +583,21 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro group.setActive(true); // Maximize the group if it is currently minimized - if (this.gridWidget) { - const viewSize = this.gridWidget.getViewSize(group); - if (viewSize.width === group.minimumWidth || viewSize.height === group.minimumHeight) { - this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); - } - } + this.doRestoreGroup(group); // Event this._onDidActiveGroupChange.fire(group); } + private doRestoreGroup(group: IEditorGroupView): void { + if (this.gridWidget) { + const viewSize = this.gridWidget.getViewSize(group); + if (viewSize.width === group.minimumWidth || viewSize.height === group.minimumHeight) { + this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS, group); + } + } + } + private doUpdateMostRecentActive(group: IEditorGroupView, makeMostRecentlyActive?: boolean): void { const index = this.mostRecentActiveGroups.indexOf(group.id); @@ -769,14 +780,15 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro //#region Part - get minimumWidth(): number { return this.centeredLayoutWidget.minimumWidth; } + // TODO @sbatten @joao find something better to prevent editor taking over #79897 + get minimumWidth(): number { return Math.min(this.centeredLayoutWidget.minimumWidth, this.layoutService.getMaximumEditorDimensions().width); } get maximumWidth(): number { return this.centeredLayoutWidget.maximumWidth; } - get minimumHeight(): number { return this.centeredLayoutWidget.minimumHeight; } + get minimumHeight(): number { return Math.min(this.centeredLayoutWidget.minimumHeight, this.layoutService.getMaximumEditorDimensions().height); } get maximumHeight(): number { return this.centeredLayoutWidget.maximumHeight; } readonly snap = true; - get onDidChange(): Event { return this.centeredLayoutWidget.onDidChange; } + get onDidChange(): Event { return Event.any(this.centeredLayoutWidget.onDidChange, this.onDidSetGridWidget.event); } readonly priority: LayoutPriority = LayoutPriority.High; private get gridSeparatorBorder(): Color { diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index e1a7d9d0fec..ed5bbacdd3e 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -325,7 +325,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution { if (!this.screenReaderNotification) { this.screenReaderNotification = this.notificationService.prompt( Severity.Info, - nls.localize('screenReaderDetectedExplanation.question', "Are you using a screen reader to operate VS Code? (Certain features like folding, minimap or word wrap are disabled when using a screen reader)"), + nls.localize('screenReaderDetectedExplanation.question', "Are you using a screen reader to operate VS Code? (Certain features like word wrap are disabled when using a screen reader)"), [{ label: nls.localize('screenReaderDetectedExplanation.answerYes', "Yes"), run: () => { @@ -990,7 +990,7 @@ export class ChangeModeAction extends Action { private configureFileAssociation(resource: URI): void { const extension = extname(resource); const base = basename(resource); - const currentAssociation = this.modeService.getModeIdByFilepathOrFirstLine(resource.with({ path: base })); + const currentAssociation = this.modeService.getModeIdByFilepathOrFirstLine(URI.file(base)); const languages = this.modeService.getRegisteredLanguageNames(); const picks: IQuickPickItem[] = languages.sort().map((lang, index) => { @@ -1160,7 +1160,7 @@ export class ChangeEncodingAction extends Action { let guessedEncoding: string | undefined = undefined; if (this.fileService.canHandleResource(resource)) { - const content = await this.textFileService.read(resource, { autoGuessEncoding: true, acceptTextOnly: true }); + const content = await this.textFileService.read(resource, { autoGuessEncoding: true }); guessedEncoding = content.encoding; } diff --git a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts index 9f5ab59d16b..b05cb17d70f 100644 --- a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts +++ b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts @@ -93,20 +93,20 @@ export class SideBySideEditor extends BaseEditor { this.updateStyles(); } - async setInput(newInput: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(newInput: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { const oldInput = this.input as SideBySideEditorInput; await super.setInput(newInput, options, token); return this.updateInput(oldInput, (newInput as SideBySideEditorInput), options, token); } - setOptions(options: EditorOptions): void { + setOptions(options: EditorOptions | undefined): void { if (this.masterEditor) { this.masterEditor.setOptions(options); } } - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { + protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { if (this.masterEditor) { this.masterEditor.setVisible(visible, group); } @@ -159,7 +159,7 @@ export class SideBySideEditor extends BaseEditor { return this.detailsEditor; } - private async updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise { + private async updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { if (!newInput.matches(oldInput)) { if (oldInput) { this.disposeEditors(); @@ -173,12 +173,12 @@ export class SideBySideEditor extends BaseEditor { } await Promise.all([ - this.detailsEditor.setInput(newInput.details, null, token), + this.detailsEditor.setInput(newInput.details, undefined, token), this.masterEditor.setInput(newInput.master, options, token) ]); } - private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise { + private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { const detailsEditor = this.doCreateEditor(newInput.details, this.detailsEditorContainer); const masterEditor = this.doCreateEditor(newInput.master, this.masterEditorContainer); @@ -198,7 +198,7 @@ export class SideBySideEditor extends BaseEditor { return editor; } - private async onEditorsCreated(details: BaseEditor, master: BaseEditor, detailsInput: EditorInput, masterInput: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + private async onEditorsCreated(details: BaseEditor, master: BaseEditor, detailsInput: EditorInput, masterInput: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { this.detailsEditor = details; this.masterEditor = master; @@ -210,7 +210,7 @@ export class SideBySideEditor extends BaseEditor { this.onDidCreateEditors.fire(undefined); await Promise.all([ - this.detailsEditor.setInput(detailsInput, null, token), + this.detailsEditor.setInput(detailsInput, undefined, token), this.masterEditor.setInput(masterInput, options, token)] ); } diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index ac833ec7818..0fb181af83a 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import * as objects from 'vs/base/common/objects'; -import * as types from 'vs/base/common/types'; +import { isFunction, isObject, isArray } from 'vs/base/common/types'; import { IDiffEditor } from 'vs/editor/browser/editorBrowser'; import { IDiffEditorOptions, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/config/editorOptions'; import { BaseTextEditor, IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor'; @@ -31,6 +31,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { CancellationToken } from 'vs/base/common/cancellation'; import { EditorMemento } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IWindowService } from 'vs/platform/windows/common/windows'; +import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/editor'; /** * The text editor that leverages the diff text editor for the editing experience. @@ -39,7 +40,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { static readonly ID = TEXT_DIFF_EDITOR_ID; - private diffNavigator: DiffNavigator; + private diffNavigator: DiffNavigator | undefined; private readonly diffNavigatorDisposables = this._register(new DisposableStore()); constructor( @@ -60,7 +61,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as diff editors are never persisted } - getTitle(): string | null { + getTitle(): string | undefined { if (this.input) { return this.input.getName(); } @@ -72,7 +73,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { return this.instantiationService.createInstance(DiffEditorWidget, parent, configuration); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { // Dispose previous diff navigator this.diffNavigatorDisposables.clear(); @@ -103,7 +104,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { // Apply Options from TextOptions let optionsGotApplied = false; - if (options && types.isFunction((options).apply)) { + if (options && isFunction((options).apply)) { optionsGotApplied = (options).apply(diffEditor, ScrollType.Immediate); } @@ -132,9 +133,9 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { } } - setOptions(options: EditorOptions): void { + setOptions(options: EditorOptions | undefined): void { const textOptions = options; - if (textOptions && types.isFunction(textOptions.apply)) { + if (textOptions && isFunction(textOptions.apply)) { textOptions.apply(this.getControl(), ScrollType.Smooth); } } @@ -155,7 +156,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { return false; } - private openAsBinary(input: EditorInput, options: EditorOptions): boolean { + private openAsBinary(input: EditorInput, options: EditorOptions | undefined): boolean { if (input instanceof DiffEditorInput) { const originalInput = input.originalInput; const modifiedInput = input.modifiedInput; @@ -172,6 +173,17 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { modifiedInput.setForceOpenAsBinary(); } + // Make sure to not steal away the currently active group + // because we are triggering another openEditor() call + // and do not control the initial intent that resulted + // in us now opening as binary. + const preservingOptions: IEditorOptions = { activation: EditorActivation.PRESERVE }; + if (options) { + options.overwrite(preservingOptions); + } else { + options = EditorOptions.create(preservingOptions); + } + this.editorService.openEditor(binaryDiffInput, options, this.group); return true; @@ -184,7 +196,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { const editorConfiguration = super.computeConfiguration(configuration); // Handle diff editor specially by merging in diffEditor configuration - if (types.isObject(configuration.diffEditor)) { + if (isObject(configuration.diffEditor)) { objects.mixin(editorConfiguration, configuration.diffEditor); } @@ -226,7 +238,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { private isFileBinaryError(error: Error[]): boolean; private isFileBinaryError(error: Error): boolean; private isFileBinaryError(error: Error | Error[]): boolean { - if (types.isArray(error)) { + if (isArray(error)) { const errors = error; return errors.some(e => this.isFileBinaryError(e)); @@ -250,7 +262,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { super.clearInput(); } - getDiffNavigator(): DiffNavigator { + getDiffNavigator(): DiffNavigator | undefined { return this.diffNavigator; } @@ -262,7 +274,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { return super.loadTextEditorViewState(resource) as IDiffEditorViewState; // overridden for text diff editor support } - private saveTextDiffEditorViewState(input: EditorInput | null): void { + private saveTextDiffEditorViewState(input: EditorInput | undefined): void { if (!(input instanceof DiffEditorInput)) { return; // only supported for diff editor inputs } diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts index 55229cb7201..796770b762e 100644 --- a/src/vs/workbench/browser/parts/editor/textEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textEditor.ts @@ -39,7 +39,7 @@ export interface IEditorConfiguration { export abstract class BaseTextEditor extends BaseEditor implements ITextEditor { private editorControl: IEditor; private _editorContainer: HTMLElement; - private hasPendingConfigurationChange: boolean; + private hasPendingConfigurationChange: boolean | undefined; private lastAppliedEditorOptions?: IEditorOptions; private editorMemento: IEditorMemento; @@ -191,7 +191,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor { return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {}); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { await super.setInput(input, options, token); // Update editor options after having set the input. We do this because there can be @@ -200,7 +200,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor { this._editorContainer.setAttribute('aria-label', this.computeAriaLabel()); } - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { + protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { // Pass on to Editor if (visible) { diff --git a/src/vs/workbench/browser/parts/editor/textResourceEditor.ts b/src/vs/workbench/browser/parts/editor/textResourceEditor.ts index d4b3e4adef9..7f7035c56c6 100644 --- a/src/vs/workbench/browser/parts/editor/textResourceEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textResourceEditor.ts @@ -46,7 +46,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor { super(id, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, windowService); } - getTitle(): string | null { + getTitle(): string | undefined { if (this.input) { return this.input.getName(); } @@ -54,7 +54,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor { return nls.localize('textEditor', "Text Editor"); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { // Remember view settings if input changes this.saveTextResourceEditorViewState(this.input); @@ -100,7 +100,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor { } } - setOptions(options: EditorOptions): void { + setOptions(options: EditorOptions | undefined): void { const textOptions = options; if (textOptions && types.isFunction(textOptions.apply)) { textOptions.apply(this.getControl(), ScrollType.Smooth); @@ -164,7 +164,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor { super.saveState(); } - private saveTextResourceEditorViewState(input: EditorInput | null): void { + private saveTextResourceEditorViewState(input: EditorInput | undefined): void { if (!(input instanceof UntitledEditorInput) && !(input instanceof ResourceEditorInput)) { return; // only enabled for untitled and resource inputs } diff --git a/src/vs/workbench/browser/parts/editor/titleControl.ts b/src/vs/workbench/browser/parts/editor/titleControl.ts index 967a587184f..089bbbc8875 100644 --- a/src/vs/workbench/browser/parts/editor/titleControl.ts +++ b/src/vs/workbench/browser/parts/editor/titleControl.ts @@ -57,7 +57,7 @@ export abstract class TitleControl extends Themable { private currentPrimaryEditorActionIds: string[] = []; private currentSecondaryEditorActionIds: string[] = []; - protected editorActionsToolbar: ToolBar; + private editorActionsToolbar: ToolBar; private resourceContext: ResourceContextKey; private editorPinnedContext: IContextKey; @@ -274,7 +274,7 @@ export abstract class TitleControl extends Themable { label = localize('draggedEditorGroup', "{0} (+{1})", label, this.group.count - 1); } - applyDragImage(e, label, 'monaco-editor-group-drag-image'); + applyDragImage(e, withUndefinedAsNull(label), 'monaco-editor-group-drag-image'); } })); diff --git a/src/vs/workbench/browser/parts/notifications/notificationsList.ts b/src/vs/workbench/browser/parts/notifications/notificationsList.ts index 03fd18b705d..677922e74a2 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsList.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsList.ts @@ -21,7 +21,7 @@ export class NotificationsList extends Themable { private listContainer: HTMLElement; private list: WorkbenchList; private viewModel: INotificationViewItem[]; - private isVisible: boolean; + private isVisible: boolean | undefined; constructor( private container: HTMLElement, @@ -72,6 +72,7 @@ export class NotificationsList extends Themable { // List this.list = this._register(this.instantiationService.createInstance( WorkbenchList, + 'NotificationsList', this.listContainer, new NotificationsListDelegate(this.listContainer), [renderer], diff --git a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts index f2db74fd89b..7f410544c6a 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts @@ -54,7 +54,7 @@ export class NotificationsToasts extends Themable { private notificationsToastsContainer: HTMLElement; private workbenchDimensions: Dimension; - private isNotificationsCenterVisible: boolean; + private isNotificationsCenterVisible: boolean | undefined; private mapNotificationToToast: Map; private notificationsToastsVisibleContextKey: IContextKey; diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index b864241fdea..103e0075498 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -17,7 +17,7 @@ import { IStorageService, StorageScope, IWorkspaceStorageChangeEvent } from 'vs/ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ClosePanelAction, TogglePanelPositionAction, PanelActivityAction, ToggleMaximizedPanelAction, TogglePanelAction } from 'vs/workbench/browser/parts/panel/panelActions'; import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { PANEL_BACKGROUND, PANEL_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND, PANEL_INACTIVE_TITLE_FOREGROUND, PANEL_ACTIVE_TITLE_BORDER, PANEL_DRAG_AND_DROP_BACKGROUND, PANEL_INPUT_BORDER } from 'vs/workbench/common/theme'; @@ -48,7 +48,7 @@ export class PanelPart extends CompositePart implements IPanelService { private static readonly PINNED_PANELS = 'workbench.panel.pinnedPanels'; private static readonly MIN_COMPOSITE_BAR_WIDTH = 50; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; //#region IView diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.ts index 437bd45dfc6..5a65a51a76d 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.ts @@ -8,7 +8,7 @@ import { Component } from 'vs/workbench/common/component'; import { IQuickInputService, IQuickPickItem, IPickOptions, IInputOptions, IQuickNavigateConfiguration, IQuickPick, IQuickInput, IQuickInputButton, IInputBox, IQuickPickItemButtonEvent, QuickPickInput, IQuickPickSeparator, IKeyMods } from 'vs/platform/quickinput/common/quickInput'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import * as dom from 'vs/base/browser/dom'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry'; import { QUICK_INPUT_BACKGROUND, QUICK_INPUT_FOREGROUND } from 'vs/workbench/common/theme'; @@ -880,7 +880,7 @@ class InputBox extends QuickInput implements IInputBox { export class QuickInputService extends Component implements IQuickInputService { - public _serviceBrand!: ServiceIdentifier; + public _serviceBrand: undefined; private static readonly ID = 'workbench.component.quickinput'; private static readonly MAX_WIDTH = 600; // Max total width of quick open widget diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts b/src/vs/workbench/browser/parts/quickinput/quickInputList.ts index b685f8ccabc..c5b9c04fb5d 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInputList.ts @@ -246,7 +246,7 @@ export class QuickInputList { this.id = id; this.container = dom.append(this.parent, $('.quick-input-list')); const delegate = new ListElementDelegate(); - this.list = this.instantiationService.createInstance(WorkbenchList, this.container, delegate, [new ListElementRenderer()], { + this.list = this.instantiationService.createInstance(WorkbenchList, 'QuickInput', this.container, delegate, [new ListElementRenderer()], { identityProvider: { getId: element => element.saneLabel }, openController: { shouldOpen: () => false }, // Workaround #58124 setRowLineHeight: false, diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index feaa519ab1b..6db4dd3c4f8 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -30,7 +30,7 @@ import { QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Exten import * as errors from 'vs/base/common/errors'; import { IQuickOpenService, IShowOptions } from 'vs/platform/quickOpen/common/quickOpen'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { IThemeService } from 'vs/platform/theme/common/themeService'; @@ -61,7 +61,7 @@ export class QuickOpenController extends Component implements IQuickOpenService private static readonly MAX_SHORT_RESPONSE_TIME = 500; private static readonly ID = 'workbench.component.quickopen'; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _onShow: Emitter = this._register(new Emitter()); readonly onShow: Event = this._onShow.event; @@ -183,10 +183,10 @@ export class QuickOpenController extends Component implements IQuickOpenService onHide: (reason) => this.handleOnHide(reason), onFocusLost: () => !this.closeOnFocusLost }, { - inputPlaceHolder: this.hasHandler(HELP_PREFIX) ? nls.localize('quickOpenInput', "Type '?' to get help on the actions you can take from here") : '', - keyboardSupport: false, - treeCreator: (container, config, opts) => this.instantiationService.createInstance(WorkbenchTree, container, config, opts) - } + inputPlaceHolder: this.hasHandler(HELP_PREFIX) ? nls.localize('quickOpenInput', "Type '?' to get help on the actions you can take from here") : '', + keyboardSupport: false, + treeCreator: (container, config, opts) => this.instantiationService.createInstance(WorkbenchTree, container, config, opts) + } )); this._register(attachQuickOpenStyler(this.quickOpenWidget, this.themeService, { background: QUICK_INPUT_BACKGROUND, foreground: QUICK_INPUT_FOREGROUND })); diff --git a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts index 9e17bf39cc4..c3b76e31974 100644 --- a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts +++ b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts @@ -19,7 +19,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { Event, Emitter } from 'vs/base/common/event'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { contrastBorder } from 'vs/platform/theme/common/colorRegistry'; @@ -35,7 +35,7 @@ import { LayoutPriority } from 'vs/base/browser/ui/grid/grid'; export class SidebarPart extends CompositePart implements IViewletService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; static readonly activeViewletSettingsKey = 'workbench.sidebar.activeviewletid'; diff --git a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css index ad1d1498654..1037fb4808f 100644 --- a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css +++ b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css @@ -12,6 +12,16 @@ display: flex; } +.monaco-workbench .part.statusbar.status-border-top::after { + content: ''; + position: absolute; + top: 0; + left: 0; + z-index: 5; + pointer-events: none; + background-color: var(--status-border-top-color); +} + .monaco-workbench .part.statusbar > .left-items, .monaco-workbench .part.statusbar > .right-items { display: flex; diff --git a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts index 6813f378920..4d1f1025aa0 100644 --- a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts +++ b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts @@ -11,7 +11,7 @@ import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { Part } from 'vs/workbench/browser/part'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { StatusbarAlignment, IStatusbarService, IStatusbarEntry, IStatusbarEntryAccessor } from 'vs/platform/statusbar/common/statusbar'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; @@ -57,7 +57,7 @@ class StatusbarViewModel extends Disposable { private readonly _entries: IStatusbarViewModelEntry[] = []; get entries(): IStatusbarViewModelEntry[] { return this._entries; } - private hidden: Set; + private hidden!: Set; constructor(private storageService: IStorageService) { super(); @@ -323,7 +323,7 @@ class HideStatusbarEntryAction extends Action { export class StatusbarPart extends Part implements IStatusbarService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; //#region IView @@ -334,14 +334,14 @@ export class StatusbarPart extends Part implements IStatusbarService { //#endregion - private styleElement: HTMLStyleElement; + private styleElement!: HTMLStyleElement; private pendingEntries: IPendingStatusbarEntry[] = []; private readonly viewModel: StatusbarViewModel; - private leftItemsContainer: HTMLElement; - private rightItemsContainer: HTMLElement; + private leftItemsContainer!: HTMLElement; + private rightItemsContainer!: HTMLElement; constructor( @IInstantiationService private readonly instantiationService: IInstantiationService, @@ -580,9 +580,13 @@ export class StatusbarPart extends Part implements IStatusbarService { // Border color const borderColor = this.getColor(this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY ? STATUS_BAR_BORDER : STATUS_BAR_NO_FOLDER_BORDER) || this.getColor(contrastBorder); - container.style.borderTopWidth = borderColor ? '1px' : null; - container.style.borderTopStyle = borderColor ? 'solid' : null; - container.style.borderTopColor = borderColor; + if (borderColor) { + addClass(container, 'status-border-top'); + container.style.setProperty('--status-border-top-color', borderColor.toString()); + } else { + removeClass(container, 'status-border-top'); + container.style.removeProperty('--status-border-top-color'); + } // Notification Beak if (!this.styleElement) { @@ -623,10 +627,10 @@ export class StatusbarPart extends Part implements IStatusbarService { } class StatusbarEntryItem extends Disposable { - private entry: IStatusbarEntry; + private entry!: IStatusbarEntry; - private labelContainer: HTMLElement; - private label: OcticonLabel; + private labelContainer!: HTMLElement; + private label!: OcticonLabel; private readonly foregroundListener = this._register(new MutableDisposable()); private readonly backgroundListener = this._register(new MutableDisposable()); diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 0a45e07062e..a518a4443dd 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -468,11 +468,11 @@ export class CustomMenubarControl extends MenubarControl { if (firstTime) { this.menubar = this._register(new MenuBar( this.container, { - enableMnemonics: this.currentEnableMenuBarMnemonics, - disableAltFocus: this.currentDisableMenuBarAltFocus, - visibility: this.currentMenubarVisibility, - getKeybinding: (action) => this.keybindingService.lookupKeybinding(action.id), - } + enableMnemonics: this.currentEnableMenuBarMnemonics, + disableAltFocus: this.currentDisableMenuBarAltFocus, + visibility: this.currentMenubarVisibility, + getKeybinding: (action) => this.keybindingService.lookupKeybinding(action.id), + } )); this.accessibilityService.alwaysUnderlineAccessKeys().then(val => { diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index fbf3423014f..a934e456352 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -28,7 +28,7 @@ import { Color } from 'vs/base/common/color'; import { trim } from 'vs/base/common/strings'; import { EventType, EventHelper, Dimension, isAncestor, hide, show, removeClass, addClass, append, $, addDisposableListener, runAtThisOrScheduleAtNextAnimationFrame } from 'vs/base/browser/dom'; import { CustomMenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { template, getBaseLabel } from 'vs/base/common/labels'; import { ILabelService } from 'vs/platform/label/common/label'; import { Event, Emitter } from 'vs/base/common/event'; @@ -58,7 +58,7 @@ export class TitlebarPart extends Part implements ITitleService { private _onMenubarVisibilityChange = this._register(new Emitter()); readonly onMenubarVisibilityChange: Event = this._onMenubarVisibilityChange.event; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private title: HTMLElement; private dragRegion: HTMLElement; @@ -554,7 +554,7 @@ export class TitlebarPart extends Part implements ITitleService { rightMarker < (this.element.clientWidth + this.title.clientWidth) / 2) { this.title.style.position = null; this.title.style.left = null; - this.title.style.transform = null; + this.title.style.transform = ''; return; } } diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 2fcbf196e0d..4b9b68f9ccc 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -201,7 +201,8 @@ export class CustomTreeView extends Disposable implements ITreeView { @IConfigurationService private readonly configurationService: IConfigurationService, @IProgressService private readonly progressService: IProgressService, @IContextMenuService private readonly contextMenuService: IContextMenuService, - @IKeybindingService private readonly keybindingService: IKeybindingService + @IKeybindingService private readonly keybindingService: IKeybindingService, + @INotificationService private readonly notificationService: INotificationService ) { super(); this.root = new Root(); @@ -228,6 +229,10 @@ export class CustomTreeView extends Disposable implements ITreeView { } set dataProvider(dataProvider: ITreeViewDataProvider | undefined) { + if (this.tree === undefined) { + this.createTree(); + } + if (dataProvider) { this._dataProvider = new class implements ITreeViewDataProvider { async getChildren(node: ITreeItem): Promise { @@ -366,28 +371,28 @@ export class CustomTreeView extends Disposable implements ITreeView { const aligner = new Aligner(this.themeService); const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, treeMenus, this.treeLabels, actionViewItemProvider, aligner); - this.tree = this._register(this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new CustomTreeDelegate(), [renderer], + this.tree = this._register(this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'CustomView', this.treeContainer, new CustomTreeDelegate(), [renderer], dataSource, { - identityProvider: new CustomViewIdentityProvider(), - accessibilityProvider: { - getAriaLabel(element: ITreeItem): string { - return element.label ? element.label.label : ''; - } - }, - ariaLabel: this.title, - keyboardNavigationLabelProvider: { - getKeyboardNavigationLabel: (item: ITreeItem) => { - return item.label ? item.label.label : (item.resourceUri ? basename(URI.revive(item.resourceUri)) : undefined); - } - }, - expandOnlyOnTwistieClick: (e: ITreeItem) => !!e.command, - collapseByDefault: (e: ITreeItem): boolean => { - return e.collapsibleState !== TreeItemCollapsibleState.Expanded; - }, - multipleSelectionSupport: this.canSelectMany, - }) as WorkbenchAsyncDataTree); + identityProvider: new CustomViewIdentityProvider(), + accessibilityProvider: { + getAriaLabel(element: ITreeItem): string { + return element.tooltip ? element.tooltip : element.label ? element.label.label : ''; + } + }, + ariaLabel: this.title, + keyboardNavigationLabelProvider: { + getKeyboardNavigationLabel: (item: ITreeItem) => { + return item.label ? item.label.label : (item.resourceUri ? basename(URI.revive(item.resourceUri)) : undefined); + } + }, + expandOnlyOnTwistieClick: (e: ITreeItem) => !!e.command, + collapseByDefault: (e: ITreeItem): boolean => { + return e.collapsibleState !== TreeItemCollapsibleState.Expanded; + }, + multipleSelectionSupport: this.canSelectMany, + }) as WorkbenchAsyncDataTree); aligner.tree = this.tree; - const actionRunner = new MultipleSelectionActionRunner(() => this.tree!.getSelection()); + const actionRunner = new MultipleSelectionActionRunner(this.notificationService, () => this.tree!.getSelection()); renderer.actionRunner = actionRunner; this.tree.contextKeyService.createKey(this.id, true); @@ -578,7 +583,6 @@ export class CustomTreeView extends Disposable implements ITreeView { private activate() { if (!this.activated) { - this.createTree(); this.progressService.withProgress({ location: this.viewContainer.id }, () => this.extensionService.activateByEvent(`onView:${this.id}`)) .then(() => timeout(2000)) .then(() => { @@ -845,22 +849,32 @@ class Aligner extends Disposable { class MultipleSelectionActionRunner extends ActionRunner { - constructor(private getSelectedResources: (() => ITreeItem[])) { + constructor(notificationService: INotificationService, private getSelectedResources: (() => ITreeItem[])) { super(); + this._register(this.onDidRun(e => { + if (e.error) { + notificationService.error(localize('command-error', 'Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.', e.error.message, e.action.id)); + } + })); } runAction(action: IAction, context: TreeViewItemHandleArg): Promise { const selection = this.getSelectedResources(); let selectionHandleArgs: TreeViewItemHandleArg[] | undefined = undefined; + let actionInSelected: boolean = false; if (selection.length > 1) { - selectionHandleArgs = []; - selection.forEach(selected => { - if (selected.handle !== context.$treeItemHandle) { - selectionHandleArgs!.push({ $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle }); + selectionHandleArgs = selection.map(selected => { + if (selected.handle === context.$treeItemHandle) { + actionInSelected = true; } + return { $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle }; }); } + if (!actionInSelected) { + selectionHandleArgs = undefined; + } + return action.run(...[context, selectionHandleArgs]); } } diff --git a/src/vs/workbench/browser/parts/views/views.ts b/src/vs/workbench/browser/parts/views/views.ts index 23accec76fa..87c08909cff 100644 --- a/src/vs/workbench/browser/parts/views/views.ts +++ b/src/vs/workbench/browser/parts/views/views.ts @@ -20,7 +20,6 @@ import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/co import { values } from 'vs/base/common/map'; import { IFileIconTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { toggleClass, addClass } from 'vs/base/browser/dom'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; function filterViewRegisterEvent(container: ViewContainer, event: Event<{ viewContainer: ViewContainer, views: IViewDescriptor[] }>): Event { @@ -382,7 +381,7 @@ export class ContributableViewsModel extends Disposable { return 0; } - return (this.getViewOrder(a) - this.getViewOrder(b)) || this.getGroupOrderResult(a, b) || (a.id < b.id ? -1 : 1); + return (this.getViewOrder(a) - this.getViewOrder(b)) || this.getGroupOrderResult(a, b); } private getGroupOrderResult(a: IViewDescriptor, b: IViewDescriptor) { @@ -434,7 +433,7 @@ export class ContributableViewsModel extends Disposable { const splices = sortedDiff( this.viewDescriptors, viewDescriptors, - this.compareViewDescriptors.bind(this) + (a, b) => a.id === b.id ? 0 : a.id < b.id ? -1 : 1 ).reverse(); const toRemove: { index: number, viewDescriptor: IViewDescriptor }[] = []; @@ -522,9 +521,7 @@ export class PersistentContributableViewsModel extends ContributableViewsModel { } private saveWorkspaceViewsStates(): void { - const storedViewsStates: { [id: string]: IStoredWorkspaceViewState } = {}; - - let hasState = false; + const storedViewsStates: { [id: string]: IStoredWorkspaceViewState } = JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId, StorageScope.WORKSPACE, '{}')); for (const viewDescriptor of this.viewDescriptors) { const viewState = this.viewStates.get(viewDescriptor.id); if (viewState) { @@ -534,11 +531,10 @@ export class PersistentContributableViewsModel extends ContributableViewsModel { size: viewState.size, order: viewDescriptor.workspace && viewState ? viewState.order : undefined }; - hasState = true; } } - if (hasState) { + if (Object.keys(storedViewsStates).length > 0) { this.storageService.store(this.workspaceViewsStateStorageId, JSON.stringify(storedViewsStates), StorageScope.WORKSPACE); } else { this.storageService.remove(this.workspaceViewsStateStorageId, StorageScope.WORKSPACE); @@ -638,7 +634,7 @@ export class PersistentContributableViewsModel extends ContributableViewsModel { export class ViewsService extends Disposable implements IViewsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly viewDescriptorCollections: Map; private readonly viewDisposable: Map; diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index 3100093436c..6413ac3173f 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -39,7 +39,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView private readonly viewletState: MementoObject; private didLayout = false; - private dimension: DOM.Dimension; + private dimension: DOM.Dimension | undefined; private areExtensionsReady: boolean = false; private readonly visibleViewsCountFromCache: number | undefined; diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index 57192e3e1c8..2ef453c6882 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -18,7 +18,7 @@ import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteA import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { IFileService, IFileSystemProvider } from 'vs/platform/files/common/files'; +import { IFileService } from 'vs/platform/files/common/files'; import { FileService } from 'vs/platform/files/common/fileService'; import { Schemas } from 'vs/base/common/network'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -40,7 +40,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage'; import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService'; import { InMemoryUserDataProvider } from 'vs/workbench/services/userData/common/inMemoryUserDataProvider'; import { registerWindowDriver } from 'vs/platform/driver/browser/driver'; -import { StaticExtensionsService, IStaticExtensionsService } from 'vs/workbench/services/extensions/common/staticExtensions'; import { BufferLogService } from 'vs/platform/log/common/bufferLog'; import { FileLogService } from 'vs/platform/log/common/fileLogService'; import { toLocalISOString } from 'vs/base/common/date'; @@ -90,7 +89,7 @@ class CodeRendererMain extends Disposable { // Driver if (this.configuration.driver) { - registerWindowDriver().then(d => this._register(d)); + (async () => this._register(await registerWindowDriver()))(); } // Startup @@ -122,10 +121,10 @@ class CodeRendererMain extends Disposable { // Log const logsPath = URI.file(toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')).with({ scheme: 'vscode-log' }); - const logService = new BufferLogService(); + const logService = new BufferLogService(this.configuration.logLevel); serviceCollection.set(ILogService, logService); - const payload = await this.resolveWorkspaceInitializationPayload(); + const payload = this.resolveWorkspaceInitializationPayload(); // Environment const environmentService = new BrowserWorkbenchEnvironmentService({ workspaceId: payload.id, logsPath, ...this.configuration }); @@ -144,55 +143,15 @@ class CodeRendererMain extends Disposable { serviceCollection.set(ISignService, signService); // Remote Agent - const remoteAgentService = this._register(new RemoteAgentService(this.configuration.webSocketFactory, environmentService, productService, remoteAuthorityResolverService, signService)); + const remoteAgentService = this._register(new RemoteAgentService(this.configuration.webSocketFactory, environmentService, productService, remoteAuthorityResolverService, signService, logService)); serviceCollection.set(IRemoteAgentService, remoteAgentService); // Files const fileService = this._register(new FileService(logService)); serviceCollection.set(IFileService, fileService); + this.registerFileSystemProviders(environmentService, fileService, remoteAgentService, logService, logsPath); - // Logger - const indexedDBLogProvider = new IndexedDBLogProvider(logsPath.scheme); - indexedDBLogProvider.database.then( - () => fileService.registerProvider(logsPath.scheme, indexedDBLogProvider), - e => { - (logService).info('Error while creating indexedDB log provider. Falling back to in-memory log provider.'); - (logService).error(e); - fileService.registerProvider(logsPath.scheme, new InMemoryLogProvider(logsPath.scheme)); - } - ).then(() => { - const consoleLogService = new ConsoleLogService(logService.getLevel()); - const fileLogService = new FileLogService('window', environmentService.logFile, logService.getLevel(), fileService); - logService.logger = new MultiplexLogService([consoleLogService, fileLogService]); - }); - - // Static Extensions - const staticExtensions = new StaticExtensionsService(this.configuration.staticExtensions || []); - serviceCollection.set(IStaticExtensionsService, staticExtensions); - - let userDataProvider: IFileSystemProvider | undefined = this.configuration.userDataProvider; - const connection = remoteAgentService.getConnection(); - if (connection) { - const channel = connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME); - const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment())); - - fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider); - - if (!userDataProvider) { - const remoteUserDataUri = this.getRemoteUserDataUri(); - if (remoteUserDataUri) { - userDataProvider = this._register(new FileUserDataProvider(remoteUserDataUri, joinPath(remoteUserDataUri, BACKUPS), remoteFileSystemProvider, environmentService)); - } - } - } - - if (!userDataProvider) { - userDataProvider = this._register(new InMemoryUserDataProvider()); - } - - // User Data Provider - fileService.registerProvider(Schemas.userData, userDataProvider); - + // Long running services (workspace, config, storage) const services = await Promise.all([ this.createWorkspaceService(payload, environmentService, fileService, remoteAgentService, logService).then(service => { @@ -217,15 +176,59 @@ class CodeRendererMain extends Disposable { return { serviceCollection, logService, storageService: services[1] }; } + private registerFileSystemProviders(environmentService: IWorkbenchEnvironmentService, fileService: IFileService, remoteAgentService: IRemoteAgentService, logService: BufferLogService, logsPath: URI): void { + + // Logger + const indexedDBLogProvider = new IndexedDBLogProvider(logsPath.scheme); + (async () => { + try { + await indexedDBLogProvider.database; + + fileService.registerProvider(logsPath.scheme, indexedDBLogProvider); + } catch (error) { + (logService).info('Error while creating indexedDB log provider. Falling back to in-memory log provider.'); + (logService).error(error); + + fileService.registerProvider(logsPath.scheme, new InMemoryLogProvider(logsPath.scheme)); + } + + const consoleLogService = new ConsoleLogService(logService.getLevel()); + const fileLogService = new FileLogService('window', environmentService.logFile, logService.getLevel(), fileService); + logService.logger = new MultiplexLogService([consoleLogService, fileLogService]); + })(); + + const connection = remoteAgentService.getConnection(); + if (connection) { + + // Remote file system + const channel = connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME); + const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment())); + fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider); + + if (!this.configuration.userDataProvider) { + const remoteUserDataUri = this.getRemoteUserDataUri(); + if (remoteUserDataUri) { + this.configuration.userDataProvider = this._register(new FileUserDataProvider(remoteUserDataUri, joinPath(remoteUserDataUri, BACKUPS), remoteFileSystemProvider, environmentService)); + } + } + } + + // User data + if (!this.configuration.userDataProvider) { + this.configuration.userDataProvider = this._register(new InMemoryUserDataProvider()); + } + fileService.registerProvider(Schemas.userData, this.configuration.userDataProvider); + } + private createProductService(): IProductService { - const element = document.getElementById('vscode-remote-product-configuration'); - const productConfiguration: IProductConfiguration = { - ...element ? JSON.parse(element.getAttribute('data-settings')!) : { + const productConfiguration = { + ...this.configuration.productConfiguration ? this.configuration.productConfiguration : { version: '1.38.0-unknown', nameLong: 'Unknown', extensionAllowedProposedApi: [], }, ...{ urlProtocol: '' } - }; + } as IProductConfiguration; + return { _serviceBrand: undefined, ...productConfiguration }; } @@ -282,6 +285,7 @@ class CodeRendererMain extends Disposable { return joinPath(URI.revive(JSON.parse(remoteUserDataPath)), 'User'); } } + return null; } } diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts index 895a8a0393f..caf44465e73 100644 --- a/src/vs/workbench/browser/web.simpleservices.ts +++ b/src/vs/workbench/browser/web.simpleservices.ts @@ -38,10 +38,10 @@ import { IWorkspaceStatsService, Tags } from 'vs/workbench/contrib/stats/common/ export class SimpleUpdateService implements IUpdateService { - _serviceBrand: any; + _serviceBrand: undefined; onStateChange = Event.None; - state: State; + state!: State; checkForUpdates(context: any): Promise { return Promise.resolve(undefined); @@ -72,7 +72,7 @@ registerSingleton(IUpdateService, SimpleUpdateService); export class SimpleWindowService extends Disposable implements IWindowService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidChangeFocus: Event = Event.None; readonly onDidChangeMaximize: Event = Event.None; @@ -360,7 +360,7 @@ registerSingleton(IWindowService, SimpleWindowService); //#region Window export class SimpleWindowsService implements IWindowsService { - _serviceBrand: any; + _serviceBrand: undefined; windowCount = 1; @@ -670,7 +670,7 @@ registerSingleton(IWindowsService, SimpleWindowsService); export class SimpleWorkspaceEditingService implements IWorkspaceEditingService { - _serviceBrand: any; + _serviceBrand: undefined; addFolders(folders: IWorkspaceFolderCreationData[], donotNotifyError?: boolean): Promise { return Promise.resolve(undefined); @@ -714,7 +714,7 @@ registerSingleton(IWorkspaceEditingService, SimpleWorkspaceEditingService, true) export class SimpleWorkspacesService implements IWorkspacesService { - _serviceBrand: any; + _serviceBrand: undefined; createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[], remoteAuthority?: string): Promise { // @ts-ignore @@ -738,7 +738,7 @@ registerSingleton(IWorkspacesService, SimpleWorkspacesService); //#region remote class SimpleTunnelService implements ITunnelService { - _serviceBrand: any; + _serviceBrand: undefined; openTunnel(remotePort: number) { return undefined; } @@ -752,7 +752,7 @@ registerSingleton(ITunnelService, SimpleTunnelService); class SimpleWorkspaceStatsService implements IWorkspaceStatsService { - _serviceBrand: any; + _serviceBrand: undefined; getTags(): Promise { return Promise.resolve({}); diff --git a/src/vs/workbench/buildfile.js b/src/vs/workbench/buildfile.desktop.js similarity index 100% rename from src/vs/workbench/buildfile.js rename to src/vs/workbench/buildfile.desktop.js diff --git a/src/vs/workbench/buildfile.web.js b/src/vs/workbench/buildfile.web.js new file mode 100644 index 00000000000..47a84533025 --- /dev/null +++ b/src/vs/workbench/buildfile.web.js @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +function createModuleDescription(name, exclude) { + const result = {}; + + let excludes = ['vs/css', 'vs/nls']; + result.name = name; + if (Array.isArray(exclude) && exclude.length > 0) { + excludes = excludes.concat(exclude); + } + result.exclude = excludes; + + return result; +} + +exports.collectModules = function () { + return [ + createModuleDescription('vs/workbench/contrib/output/common/outputLinkComputer', ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']), + ]; +}; diff --git a/src/vs/workbench/common/composite.ts b/src/vs/workbench/common/composite.ts index 21499990aa2..b6ea6f2ca73 100644 --- a/src/vs/workbench/common/composite.ts +++ b/src/vs/workbench/common/composite.ts @@ -15,7 +15,7 @@ export interface IComposite { /** * Returns the name of this composite to show in the title area. */ - getTitle(): string | null; + getTitle(): string | undefined; /** * Returns the primary actions of the composite. diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 97f5aa1e79d..0a4df5dc9b3 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -9,7 +9,7 @@ import { isUndefinedOrNull } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon'; -import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput } from 'vs/platform/editor/common/editor'; +import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation } from 'vs/platform/editor/common/editor'; import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -30,7 +30,7 @@ export const NoEditorsVisibleContext: ContextKeyExpr = EditorsVisibleContext.toN export const TextCompareEditorVisibleContext = new RawContextKey('textCompareEditorVisible', false); export const TextCompareEditorActiveContext = new RawContextKey('textCompareEditorActive', false); export const ActiveEditorGroupEmptyContext = new RawContextKey('activeEditorGroupEmpty', false); -export const ActiveEditorGroupIndexContext = new RawContextKey('activeEditorGroupIndex', -1); +export const ActiveEditorGroupIndexContext = new RawContextKey('activeEditorGroupIndex', 0); export const ActiveEditorGroupLastContext = new RawContextKey('activeEditorGroupLast', false); export const MultipleEditorGroupsContext = new RawContextKey('multipleEditorGroups', false); export const SingleEditorGroupsContext = MultipleEditorGroupsContext.toNegated(); @@ -53,12 +53,12 @@ export interface IEditor { /** * The assigned input of this editor. */ - input: IEditorInput | null; + input: IEditorInput | undefined; /** * The assigned options of this editor. */ - options: IEditorOptions | null; + options: IEditorOptions | undefined; /** * The assigned group this editor is showing in. @@ -292,7 +292,7 @@ export interface IEditorInput extends IDisposable { /** * Returns the display name of this input. */ - getName(): string | null; + getName(): string | undefined; /** * Returns the display description of this input. @@ -302,7 +302,7 @@ export interface IEditorInput extends IDisposable { /** * Returns the display title of this input. */ - getTitle(verbosity?: Verbosity): string | null; + getTitle(verbosity?: Verbosity): string | undefined; /** * Resolves the input. @@ -358,8 +358,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput { * Returns the name of this input that can be shown to the user. Examples include showing the name of the input * above the editor area when the input is shown. */ - getName(): string | null { - return null; + getName(): string | undefined { + return undefined; } /** @@ -374,7 +374,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput { * Returns the title of this input that can be shown to the user. Examples include showing the title of * the input above the editor area as hover over the input label. */ - getTitle(verbosity?: Verbosity): string | null { + getTitle(verbosity?: Verbosity): string | undefined { return this.getName(); } @@ -707,25 +707,29 @@ export class EditorOptions implements IEditorOptions { */ static create(settings: IEditorOptions): EditorOptions { const options = new EditorOptions(); - - options.preserveFocus = settings.preserveFocus; - options.forceReload = settings.forceReload; - options.revealIfVisible = settings.revealIfVisible; - options.revealIfOpened = settings.revealIfOpened; - options.pinned = settings.pinned; - options.index = settings.index; - options.inactive = settings.inactive; - options.ignoreError = settings.ignoreError; + options.overwrite(settings); return options; } /** - * Tells the editor to not receive keyboard focus when the editor is being opened. By default, - * the editor will receive keyboard focus on open. + * Tells the editor to not receive keyboard focus when the editor is being opened. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ preserveFocus: boolean | undefined; + /** + * This option is only relevant if an editor is opened into a group that is not active + * already and allows to control if the inactive group should become active, restored + * or preserved. + * + * By default, the editor group will become active unless `preserveFocus` or `inactive` + * is specified. + */ + activation: EditorActivation | undefined; + /** * Tells the editor to reload the editor input in the editor even if it is identical to the one * already showing. By default, the editor will not reload the input if it is identical to the @@ -756,7 +760,10 @@ export class EditorOptions implements IEditorOptions { /** * An active editor that is opened will show its contents directly. Set to true to open an editor - * in the background. + * in the background without loading its contents. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ inactive: boolean | undefined; @@ -765,6 +772,49 @@ export class EditorOptions implements IEditorOptions { * message as needed. By default, an error will be presented as notification if opening was not possible. */ ignoreError: boolean | undefined; + + /** + * Overwrites option values from the provided bag. + */ + overwrite(options: IEditorOptions): EditorOptions { + if (typeof options.forceReload === 'boolean') { + this.forceReload = options.forceReload; + } + + if (typeof options.revealIfVisible === 'boolean') { + this.revealIfVisible = options.revealIfVisible; + } + + if (typeof options.revealIfOpened === 'boolean') { + this.revealIfOpened = options.revealIfOpened; + } + + if (typeof options.preserveFocus === 'boolean') { + this.preserveFocus = options.preserveFocus; + } + + if (typeof options.activation === 'number') { + this.activation = options.activation; + } + + if (typeof options.pinned === 'boolean') { + this.pinned = options.pinned; + } + + if (typeof options.inactive === 'boolean') { + this.inactive = options.inactive; + } + + if (typeof options.ignoreError === 'boolean') { + this.ignoreError = options.ignoreError; + } + + if (typeof options.index === 'number') { + this.index = options.index; + } + + return this; + } } /** @@ -792,53 +842,31 @@ export class TextEditorOptions extends EditorOptions { */ static create(options: ITextEditorOptions = Object.create(null)): TextEditorOptions { const textEditorOptions = new TextEditorOptions(); + textEditorOptions.overwrite(options); + + return textEditorOptions; + } + + /** + * Overwrites option values from the provided bag. + */ + overwrite(options: ITextEditorOptions): TextEditorOptions { + super.overwrite(options); if (options.selection) { const selection = options.selection; - textEditorOptions.selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn); + this.selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn); } if (options.viewState) { - textEditorOptions.editorViewState = options.viewState as IEditorViewState; + this.editorViewState = options.viewState as IEditorViewState; } - if (options.forceReload) { - textEditorOptions.forceReload = true; + if (typeof options.revealInCenterIfOutsideViewport === 'boolean') { + this.revealInCenterIfOutsideViewport = options.revealInCenterIfOutsideViewport; } - if (options.revealIfVisible) { - textEditorOptions.revealIfVisible = true; - } - - if (options.revealIfOpened) { - textEditorOptions.revealIfOpened = true; - } - - if (options.preserveFocus) { - textEditorOptions.preserveFocus = true; - } - - if (options.revealInCenterIfOutsideViewport) { - textEditorOptions.revealInCenterIfOutsideViewport = true; - } - - if (options.pinned) { - textEditorOptions.pinned = true; - } - - if (options.inactive) { - textEditorOptions.inactive = true; - } - - if (options.ignoreError) { - textEditorOptions.ignoreError = true; - } - - if (typeof options.index === 'number') { - textEditorOptions.index = options.index; - } - - return textEditorOptions; + return this; } /** diff --git a/src/vs/workbench/common/editor/dataUriEditorInput.ts b/src/vs/workbench/common/editor/dataUriEditorInput.ts index f75c3d04103..da07bb83608 100644 --- a/src/vs/workbench/common/editor/dataUriEditorInput.ts +++ b/src/vs/workbench/common/editor/dataUriEditorInput.ts @@ -8,7 +8,6 @@ import { URI } from 'vs/base/common/uri'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel'; import { DataUri } from 'vs/base/common/resources'; -import { withUndefinedAsNull } from 'vs/base/common/types'; /** * An editor input to present data URIs in a binary editor. Data URIs have the form of: @@ -51,8 +50,8 @@ export class DataUriEditorInput extends EditorInput { return DataUriEditorInput.ID; } - getName(): string | null { - return withUndefinedAsNull(this.name); + getName(): string | undefined { + return this.name; } getDescription(): string | undefined { diff --git a/src/vs/workbench/common/editor/diffEditorInput.ts b/src/vs/workbench/common/editor/diffEditorInput.ts index 477d54e754c..bd2b9376854 100644 --- a/src/vs/workbench/common/editor/diffEditorInput.ts +++ b/src/vs/workbench/common/editor/diffEditorInput.ts @@ -16,7 +16,7 @@ export class DiffEditorInput extends SideBySideEditorInput { static readonly ID = 'workbench.editors.diffEditorInput'; - private cachedModel: DiffEditorModel | null; + private cachedModel: DiffEditorModel | null = null; constructor(name: string, description: string | undefined, original: EditorInput, modified: EditorInput, private readonly forceOpenAsBinary?: boolean) { super(name, description, original, modified); @@ -86,4 +86,4 @@ export class DiffEditorInput extends SideBySideEditorInput { super.dispose(); } -} \ No newline at end of file +} diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 5b207d4a79d..3eb62c882cd 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -88,17 +88,18 @@ export class EditorGroup extends Disposable { //#endregion - private _id: GroupIdentifier; + private _id!: GroupIdentifier; + get id(): GroupIdentifier { return this._id; } private editors: EditorInput[] = []; private mru: EditorInput[] = []; private mapResourceToEditorCount: ResourceMap = new ResourceMap(); - private preview: EditorInput | null; // editor in preview state - private active: EditorInput | null; // editor in active state + private preview: EditorInput | null = null; // editor in preview state + private active: EditorInput | null = null; // editor in active state - private editorOpenPositioning: 'left' | 'right' | 'first' | 'last'; - private focusRecentEditorAfterClose: boolean; + private editorOpenPositioning: ('left' | 'right' | 'first' | 'last') | undefined; + private focusRecentEditorAfterClose: boolean | undefined; constructor( labelOrSerializedGroup: ISerializedEditorGroup, @@ -126,10 +127,6 @@ export class EditorGroup extends Disposable { this.focusRecentEditorAfterClose = this.configurationService.getValue('workbench.editor.focusRecentEditorAfterClose'); } - get id(): GroupIdentifier { - return this._id; - } - get count(): number { return this.editors.length; } @@ -689,8 +686,11 @@ export class EditorGroup extends Disposable { return null; })); + this.mru = data.mru.map(i => this.editors[i]); + this.active = this.mru[0]; + if (typeof data.preview === 'number') { this.preview = this.editors[data.preview]; } diff --git a/src/vs/workbench/common/editor/resourceEditorInput.ts b/src/vs/workbench/common/editor/resourceEditorInput.ts index 8ea157dffc2..1d7712d1c4e 100644 --- a/src/vs/workbench/common/editor/resourceEditorInput.ts +++ b/src/vs/workbench/common/editor/resourceEditorInput.ts @@ -17,8 +17,8 @@ export class ResourceEditorInput extends EditorInput implements IModeSupport { static readonly ID: string = 'workbench.editors.resourceEditorInput'; - private cachedModel: ResourceEditorModel | null; - private modelReference: Promise> | null; + private cachedModel: ResourceEditorModel | null = null; + private modelReference: Promise> | null = null; constructor( private name: string, diff --git a/src/vs/workbench/common/editor/textDiffEditorModel.ts b/src/vs/workbench/common/editor/textDiffEditorModel.ts index 1f48d92db29..f18c71fe3c8 100644 --- a/src/vs/workbench/common/editor/textDiffEditorModel.ts +++ b/src/vs/workbench/common/editor/textDiffEditorModel.ts @@ -14,10 +14,10 @@ import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel'; */ export class TextDiffEditorModel extends DiffEditorModel { - protected readonly _originalModel: BaseTextEditorModel; - protected readonly _modifiedModel: BaseTextEditorModel; + protected readonly _originalModel!: BaseTextEditorModel | null; + protected readonly _modifiedModel!: BaseTextEditorModel | null; - private _textDiffEditorModel: IDiffEditorModel | null; + private _textDiffEditorModel: IDiffEditorModel | null = null; constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) { super(originalModel, modifiedModel); @@ -25,11 +25,11 @@ export class TextDiffEditorModel extends DiffEditorModel { this.updateTextDiffEditorModel(); } - get originalModel(): BaseTextEditorModel { + get originalModel(): BaseTextEditorModel | null { return this._originalModel; } - get modifiedModel(): BaseTextEditorModel { + get modifiedModel(): BaseTextEditorModel | null { return this._modifiedModel; } @@ -42,7 +42,7 @@ export class TextDiffEditorModel extends DiffEditorModel { } private updateTextDiffEditorModel(): void { - if (this.originalModel.isResolved() && this.modifiedModel.isResolved()) { + if (this.originalModel && this.originalModel.isResolved() && this.modifiedModel && this.modifiedModel.isResolved()) { // Create new if (!this._textDiffEditorModel) { @@ -69,7 +69,7 @@ export class TextDiffEditorModel extends DiffEditorModel { } isReadonly(): boolean { - return this.modifiedModel.isReadonly(); + return !!this.modifiedModel && this.modifiedModel.isReadonly(); } dispose(): void { diff --git a/src/vs/workbench/common/editor/untitledEditorInput.ts b/src/vs/workbench/common/editor/untitledEditorInput.ts index 561b5cb6f87..1c021309268 100644 --- a/src/vs/workbench/common/editor/untitledEditorInput.ts +++ b/src/vs/workbench/common/editor/untitledEditorInput.ts @@ -7,7 +7,6 @@ import { URI } from 'vs/base/common/uri'; import { suggestFilename } from 'vs/base/common/mime'; import { memoize } from 'vs/base/common/decorators'; import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry'; -import { basename } from 'vs/base/common/path'; import { basenameOrAuthority, dirname } from 'vs/base/common/resources'; import { EditorInput, IEncodingSupport, EncodingMode, ConfirmResult, Verbosity, IModeSupport } from 'vs/workbench/common/editor'; import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel'; @@ -24,8 +23,8 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport static readonly ID: string = 'workbench.editors.untitledEditorInput'; - private cachedModel: UntitledEditorModel | null; - private modelResolve: Promise | null; + private cachedModel: UntitledEditorModel | null = null; + private modelResolve: Promise | null = null; private readonly _onDidModelChangeContent: Emitter = this._register(new Emitter()); readonly onDidModelChangeContent: Event = this._onDidModelChangeContent.event; @@ -64,7 +63,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport @memoize private get shortDescription(): string { - return basename(this.labelService.getUriLabel(dirname(this.resource))); + return this.labelService.getUriBasenameLabel(dirname(this.resource)); } @memoize @@ -108,7 +107,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport return this.labelService.getUriLabel(this.resource); } - getTitle(verbosity: Verbosity): string | null { + getTitle(verbosity: Verbosity): string | undefined { if (!this.hasAssociatedFilePath) { return this.getName(); } @@ -122,7 +121,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport return this.longTitle; } - return null; + return undefined; } isDirty(): boolean { diff --git a/src/vs/workbench/common/theme.ts b/src/vs/workbench/common/theme.ts index 8e5e6dab3db..86e791135af 100644 --- a/src/vs/workbench/common/theme.ts +++ b/src/vs/workbench/common/theme.ts @@ -383,13 +383,13 @@ export const EXTENSION_BADGE_REMOTE_BACKGROUND = registerColor('extensionBadge.r dark: ACTIVITY_BAR_BADGE_BACKGROUND, light: ACTIVITY_BAR_BADGE_BACKGROUND, hc: ACTIVITY_BAR_BADGE_BACKGROUND -}, nls.localize('extensionBadge.remoteBackground', "Background color for the remote badge in the extensions view")); +}, nls.localize('extensionBadge.remoteBackground', "Background color for the remote badge in the extensions view.")); export const EXTENSION_BADGE_REMOTE_FOREGROUND = registerColor('extensionBadge.remoteForeground', { dark: ACTIVITY_BAR_BADGE_FOREGROUND, light: ACTIVITY_BAR_BADGE_FOREGROUND, hc: ACTIVITY_BAR_BADGE_FOREGROUND -}, nls.localize('extensionBadge.remoteForeground', "Foreground color for the remote badge in the extensions view")); +}, nls.localize('extensionBadge.remoteForeground', "Foreground color for the remote badge in the extensions view.")); // < --- Side Bar --- > @@ -449,13 +449,13 @@ export const QUICK_INPUT_BACKGROUND = registerColor('quickInput.background', { dark: SIDE_BAR_BACKGROUND, light: SIDE_BAR_BACKGROUND, hc: SIDE_BAR_BACKGROUND -}, nls.localize('quickInputBackground', "Quick Input background color. The Quick Input widget is the container for views like the color theme picker")); +}, nls.localize('quickInputBackground', "Quick Input background color. The Quick Input widget is the container for views like the color theme picker.")); export const QUICK_INPUT_FOREGROUND = registerColor('quickInput.foreground', { dark: SIDE_BAR_FOREGROUND, light: SIDE_BAR_FOREGROUND, hc: SIDE_BAR_FOREGROUND -}, nls.localize('quickInputForeground', "Quick Input foreground color. The Quick Input widget is the container for views like the color theme picker")); +}, nls.localize('quickInputForeground', "Quick Input foreground color. The Quick Input widget is the container for views like the color theme picker.")); // < --- Title Bar --- > diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 7306d530fcb..35e716a87b7 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -10,7 +10,7 @@ import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/con import { ITreeViewDataProvider } from 'vs/workbench/common/views'; import { localize } from 'vs/nls'; import { IViewlet } from 'vs/workbench/common/viewlet'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { values, keys } from 'vs/base/common/map'; @@ -295,7 +295,7 @@ export interface IViewsViewlet extends IViewlet { export const IViewsService = createDecorator('viewsService'); export interface IViewsService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; openView(id: string, focus?: boolean): Promise; diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index 1166da97f9c..de26aa5c241 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -203,6 +203,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { }; this._tree = this._instantiationService.createInstance( WorkbenchAsyncDataTree, + 'CallHierarchyPeek', treeContainer, new callHTree.VirtualDelegate(), [this._instantiationService.createInstance(callHTree.CallRenderer)], diff --git a/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.ts b/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.ts index 59060ed7fb4..3acf0719616 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.ts @@ -17,6 +17,7 @@ import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/c import { Registry } from 'vs/platform/registry/common/platform'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ITextMateService } from 'vs/workbench/services/textMate/common/textMateService'; +import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages'; interface IRegExp { pattern: string; @@ -101,7 +102,7 @@ export class LanguageConfigurationFileHandler { const errors: ParseError[] = []; const configuration = parse(contents.value.toString(), errors); if (errors.length) { - console.error(nls.localize('parseErrors', "Errors parsing {0}: {1}", configFileLocation.toString(), errors.join('\n'))); + console.error(nls.localize('parseErrors', "Errors parsing {0}: {1}", configFileLocation.toString(), errors.map(e => (`[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`)).join('\n'))); } this._handleConfig(languageIdentifier, configuration); }, (err) => { @@ -358,6 +359,7 @@ export class LanguageConfigurationFileHandler { const schemaId = 'vscode://schemas/language-configuration'; const schema: IJSONSchema = { allowComments: true, + allowsTrailingCommas: true, default: { comments: { blockComment: ['/*', '*/'], diff --git a/src/vs/workbench/contrib/comments/browser/commentService.ts b/src/vs/workbench/contrib/comments/browser/commentService.ts index e676d7caf1a..29587a0e7d0 100644 --- a/src/vs/workbench/contrib/comments/browser/commentService.ts +++ b/src/vs/workbench/contrib/comments/browser/commentService.ts @@ -33,7 +33,7 @@ export interface IWorkspaceCommentThreadsEvent { } export interface ICommentService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidSetResourceCommentInfos: Event; readonly onDidSetAllCommentThreads: Event; readonly onDidUpdateCommentThreads: Event; @@ -60,7 +60,7 @@ export interface ICommentService { } export class CommentService extends Disposable implements ICommentService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidSetDataProvider: Emitter = this._register(new Emitter()); readonly onDidSetDataProvider: Event = this._onDidSetDataProvider.event; diff --git a/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts b/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts index 5baf982dd93..4cdcb6a6895 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts @@ -175,6 +175,7 @@ export class CommentsList extends WorkbenchAsyncDataTree { ]; super( + 'CommentsTree', container, delegate, renderers, diff --git a/src/vs/workbench/contrib/debug/browser/breakpointWidget.ts b/src/vs/workbench/contrib/debug/browser/breakpointWidget.ts index 136afbbf63d..f8752b3b1c5 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointWidget.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointWidget.ts @@ -39,13 +39,13 @@ import { onUnexpectedError } from 'vs/base/common/errors'; const $ = dom.$; const IPrivateBreakpointWidgetService = createDecorator('privateBreakopintWidgetService'); export interface IPrivateBreakpointWidgetService { - _serviceBrand: any; + _serviceBrand: undefined; close(success: boolean): void; } const DECORATION_KEY = 'breakpointwidgetdecoration'; export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWidgetService { - _serviceBrand: any; + _serviceBrand: undefined; private selectContainer!: HTMLElement; private input!: IActiveCodeEditor; diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index e1f0c4496a0..ff177c079d3 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -70,23 +70,23 @@ export class BreakpointsView extends ViewletPanel { dom.addClass(container, 'debug-breakpoints'); const delegate = new BreakpointsDelegate(this.debugService); - this.list = this.instantiationService.createInstance(WorkbenchList, container, delegate, [ + this.list = this.instantiationService.createInstance(WorkbenchList, 'Breakpoints', container, delegate, [ this.instantiationService.createInstance(BreakpointsRenderer), new ExceptionBreakpointsRenderer(this.debugService), this.instantiationService.createInstance(FunctionBreakpointsRenderer), this.instantiationService.createInstance(DataBreakpointsRenderer), new FunctionBreakpointInputRenderer(this.debugService, this.contextViewService, this.themeService) ], { - identityProvider: { getId: (element: IEnablement) => element.getId() }, - multipleSelectionSupport: false, - keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IEnablement) => e }, - ariaProvider: { - getSetSize: (_: IEnablement, index: number, listLength: number) => listLength, - getPosInSet: (_: IEnablement, index: number) => index, - getRole: (breakpoint: IEnablement) => 'checkbox', - isChecked: (breakpoint: IEnablement) => breakpoint.enabled - } - }); + identityProvider: { getId: (element: IEnablement) => element.getId() }, + multipleSelectionSupport: false, + keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IEnablement) => e }, + ariaProvider: { + getSetSize: (_: IEnablement, index: number, listLength: number) => listLength, + getPosInSet: (_: IEnablement, index: number) => index, + getRole: (breakpoint: IEnablement) => 'checkbox', + isChecked: (breakpoint: IEnablement) => breakpoint.enabled + } + }); CONTEXT_BREAKPOINTS_FOCUSED.bindTo(this.list.contextKeyService); @@ -639,7 +639,7 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, br if (!breakpoint.enabled || !debugService.getModel().areBreakpointsActivated()) { return { - className: breakpoint instanceof FunctionBreakpoint ? 'debug-function-breakpoint-disabled' : breakpoint.logMessage ? 'debug-breakpoint-log-disabled' : 'debug-breakpoint-disabled', + className: breakpoint instanceof DataBreakpoint ? 'debug-data-breakpoint-disabled' : breakpoint instanceof FunctionBreakpoint ? 'debug-function-breakpoint-disabled' : breakpoint.logMessage ? 'debug-breakpoint-log-disabled' : 'debug-breakpoint-disabled', message: breakpoint.logMessage ? nls.localize('disabledLogpoint', "Disabled logpoint") : nls.localize('disabledBreakpoint', "Disabled breakpoint"), }; } diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index 46e90870f22..d27d95c18f0 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -105,7 +105,7 @@ export class CallStackView extends ViewletPanel { const treeContainer = renderViewTree(container); this.dataSource = new CallStackDataSource(this.debugService); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, treeContainer, new CallStackDelegate(), [ + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'CallStackView', treeContainer, new CallStackDelegate(), [ new SessionsRenderer(), new ThreadsRenderer(), this.instantiationService.createInstance(StackFramesRenderer), @@ -113,40 +113,40 @@ export class CallStackView extends ViewletPanel { new LoadMoreRenderer(), new ShowMoreRenderer() ], this.dataSource, { - accessibilityProvider: new CallStackAccessibilityProvider(), - ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel' }, "Debug Call Stack"), - identityProvider: { - getId: (element: CallStackItem) => { - if (typeof element === 'string') { - return element; - } - if (element instanceof Array) { - return `showMore ${element[0].getId()}`; - } - - return element.getId(); + accessibilityProvider: new CallStackAccessibilityProvider(), + ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel' }, "Debug Call Stack"), + identityProvider: { + getId: (element: CallStackItem) => { + if (typeof element === 'string') { + return element; } - }, - keyboardNavigationLabelProvider: { - getKeyboardNavigationLabel: (e: CallStackItem) => { - if (isDebugSession(e)) { - return e.getLabel(); - } - if (e instanceof Thread) { - return `${e.name} ${e.stateLabel}`; - } - if (e instanceof StackFrame || typeof e === 'string') { - return e; - } - if (e instanceof ThreadAndSessionIds) { - return LoadMoreRenderer.LABEL; - } - - return nls.localize('showMoreStackFrames2', "Show More Stack Frames"); + if (element instanceof Array) { + return `showMore ${element[0].getId()}`; } - }, - expandOnlyOnTwistieClick: true - }); + + return element.getId(); + } + }, + keyboardNavigationLabelProvider: { + getKeyboardNavigationLabel: (e: CallStackItem) => { + if (isDebugSession(e)) { + return e.getLabel(); + } + if (e instanceof Thread) { + return `${e.name} ${e.stateLabel}`; + } + if (e instanceof StackFrame || typeof e === 'string') { + return e; + } + if (e instanceof ThreadAndSessionIds) { + return LoadMoreRenderer.LABEL; + } + + return nls.localize('showMoreStackFrames2', "Show More Stack Frames"); + } + }, + expandOnlyOnTwistieClick: true + }); this.tree.setInput(this.debugService.getModel()).then(undefined, onUnexpectedError); diff --git a/src/vs/workbench/contrib/debug/browser/debugActions.ts b/src/vs/workbench/contrib/debug/browser/debugActions.ts index 8f926b2a35a..5d71d9aa40f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugActions.ts @@ -210,7 +210,7 @@ export class RemoveAllBreakpointsAction extends AbstractDebugAction { protected isEnabled(state: State): boolean { const model = this.debugService.getModel(); - return super.isEnabled(state) && (model.getBreakpoints().length > 0 || model.getFunctionBreakpoints().length > 0); + return super.isEnabled(state) && (model.getBreakpoints().length > 0 || model.getFunctionBreakpoints().length > 0 || model.getDataBreakpoints().length > 0); } } @@ -272,7 +272,7 @@ export class ToggleBreakpointsActivatedAction extends AbstractDebugAction { } protected isEnabled(state: State): boolean { - return (this.debugService.getModel().getFunctionBreakpoints().length + this.debugService.getModel().getBreakpoints().length) > 0; + return !!(this.debugService.getModel().getFunctionBreakpoints().length || this.debugService.getModel().getBreakpoints().length || this.debugService.getModel().getDataBreakpoints().length); } } @@ -292,7 +292,7 @@ export class ReapplyBreakpointsAction extends AbstractDebugAction { protected isEnabled(state: State): boolean { const model = this.debugService.getModel(); return super.isEnabled(state) && (state === State.Running || state === State.Stopped) && - (model.getFunctionBreakpoints().length + model.getBreakpoints().length + model.getExceptionBreakpoints().length > 0); + ((model.getFunctionBreakpoints().length + model.getBreakpoints().length + model.getExceptionBreakpoints().length + model.getDataBreakpoints().length) > 0); } } diff --git a/src/vs/workbench/contrib/debug/browser/debugHover.ts b/src/vs/workbench/contrib/debug/browser/debugHover.ts index b7f66a4a69b..e4f23037af0 100644 --- a/src/vs/workbench/contrib/debug/browser/debugHover.ts +++ b/src/vs/workbench/contrib/debug/browser/debugHover.ts @@ -73,13 +73,13 @@ export class DebugHoverWidget implements IContentWidget { this.treeContainer.setAttribute('role', 'tree'); const dataSource = new DebugHoverDataSource(); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new DebugHoverDelegate(), [this.instantiationService.createInstance(VariablesRenderer)], + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'DebugHover', this.treeContainer, new DebugHoverDelegate(), [this.instantiationService.createInstance(VariablesRenderer)], dataSource, { - ariaLabel: nls.localize('treeAriaLabel', "Debug Hover"), - accessibilityProvider: new DebugHoverAccessibilityProvider(), - mouseSupport: false, - horizontalScrolling: true - }); + ariaLabel: nls.localize('treeAriaLabel', "Debug Hover"), + accessibilityProvider: new DebugHoverAccessibilityProvider(), + mouseSupport: false, + horizontalScrolling: true + }); this.valueContainer = $('.value'); this.valueContainer.tabIndex = 0; diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 86c6bb089b6..95bd40e002a 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -50,7 +50,6 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint'; -const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated'; const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint'; const DEBUG_DATA_BREAKPOINTS_KEY = 'debug.databreakpoint'; const DEBUG_EXCEPTION_BREAKPOINTS_KEY = 'debug.exceptionbreakpoint'; @@ -74,7 +73,7 @@ const enum TaskRunResult { } export class DebugService implements IDebugService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidChangeState: Emitter; private readonly _onDidNewSession: Emitter; @@ -129,7 +128,7 @@ export class DebugService implements IDebugService { this.debugState = CONTEXT_DEBUG_STATE.bindTo(contextKeyService); this.inDebugMode = CONTEXT_IN_DEBUG_MODE.bindTo(contextKeyService); - this.model = new DebugModel(this.loadBreakpoints(), this.storageService.getBoolean(DEBUG_BREAKPOINTS_ACTIVATED_KEY, StorageScope.WORKSPACE, true), this.loadFunctionBreakpoints(), + this.model = new DebugModel(this.loadBreakpoints(), this.loadFunctionBreakpoints(), this.loadExceptionBreakpoints(), this.loadDataBreakpoints(), this.loadWatchExpressions(), this.textFileService); this.toDispose.push(this.model); @@ -901,12 +900,6 @@ export class DebugService implements IDebugService { setBreakpointsActivated(activated: boolean): Promise { this.model.setBreakpointsActivated(activated); - if (activated) { - this.storageService.store(DEBUG_BREAKPOINTS_ACTIVATED_KEY, 'false', StorageScope.WORKSPACE); - } else { - this.storageService.remove(DEBUG_BREAKPOINTS_ACTIVATED_KEY, StorageScope.WORKSPACE); - } - return this.sendAllBreakpoints(); } @@ -944,7 +937,8 @@ export class DebugService implements IDebugService { return Promise.all(distinct(this.model.getBreakpoints(), bp => bp.uri.toString()).map(bp => this.sendBreakpoints(bp.uri, false, session))) .then(() => this.sendFunctionBreakpoints(session)) // send exception breakpoints at the end since some debug adapters rely on the order - .then(() => this.sendExceptionBreakpoints(session)); + .then(() => this.sendExceptionBreakpoints(session)) + .then(() => this.sendDataBreakpoints(session)); } private sendBreakpoints(modelUri: uri, sourceModified = false, session?: IDebugSession): Promise { diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index 01151248238..2839f067232 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -799,8 +799,8 @@ export class DebugSession implements IDebugSession { this.rawListeners.push(this.raw.onDidBreakpoint(event => { const id = event.body && event.body.breakpoint ? event.body.breakpoint.id : undefined; - const breakpoint = this.model.getBreakpoints().filter(bp => bp.idFromAdapter === id).pop(); - const functionBreakpoint = this.model.getFunctionBreakpoints().filter(bp => bp.idFromAdapter === id).pop(); + const breakpoint = this.model.getBreakpoints().filter(bp => bp.getIdFromAdapter(this.getId()) === id).pop(); + const functionBreakpoint = this.model.getFunctionBreakpoints().filter(bp => bp.getIdFromAdapter(this.getId()) === id).pop(); if (event.body.reason === 'new' && event.body.breakpoint.source && event.body.breakpoint.line) { const source = this.getSource(event.body.breakpoint.source); diff --git a/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts b/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts index 5be0fa24b5c..49b8815ca93 100644 --- a/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts +++ b/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts @@ -9,9 +9,10 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug'; import { IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; +import { IChannel } from 'vs/base/parts/ipc/common/ipc'; +import { Event } from 'vs/base/common/event'; class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient { @@ -22,11 +23,16 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient { ) { const connection = remoteAgentService.getConnection(); - if (!connection) { - throw new Error('Missing agent connection'); + let channel: IChannel; + if (connection) { + channel = connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName); + } else { + channel = { call: async () => undefined, listen: () => Event.None } as any; + // TODO@weinand TODO@isidorn fallback? + console.warn('Extension Host Debugging not available due to missing connection.'); } - super(connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName)); + super(channel); this._register(this.onReload(event => { if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) { @@ -45,7 +51,7 @@ registerSingleton(IExtensionHostDebugService, BrowserExtensionHostDebugService); class BrowserDebugHelperService implements IDebugHelperService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; createTelemetryService(configurationService: IConfigurationService, args: string[]): TelemetryService | undefined { return undefined; diff --git a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts index 6a70b78319b..e5bb9b72a6c 100644 --- a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts +++ b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts @@ -419,7 +419,7 @@ export class LoadedScriptsView extends ViewletPanel { this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility }); this._register(this.treeLabels); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new LoadedScriptsDelegate(), + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'LoadedScriptsView', this.treeContainer, new LoadedScriptsDelegate(), [new LoadedScriptsRenderer(this.treeLabels)], new LoadedScriptsDataSource(), { diff --git a/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-disabled.svg b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-disabled.svg new file mode 100644 index 00000000000..a2c8c3417e5 --- /dev/null +++ b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-unverified.svg b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-unverified.svg new file mode 100644 index 00000000000..96dda92ee38 --- /dev/null +++ b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data-unverified.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/debug/browser/media/breakpoint-data.svg b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data.svg new file mode 100644 index 00000000000..6752b060aeb --- /dev/null +++ b/src/vs/workbench/contrib/debug/browser/media/breakpoint-data.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index eccdb6d5e52..422f7b208ab 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -62,6 +62,18 @@ background: url('breakpoint-function-disabled.svg') center center no-repeat; } +.debug-data-breakpoint { + background: url('breakpoint-data.svg') center center no-repeat; +} + +.debug-data-breakpoint-unverified { + background: url('breakpoint-data-unverified.svg') center center no-repeat; +} + +.debug-data-breakpoint-disabled { + background: url('breakpoint-data-disabled.svg') center center no-repeat; +} + .debug-breakpoint-conditional, .monaco-editor .debug-breakpoint-column.debug-breakpoint-conditional-column::before { background: url('breakpoint-conditional.svg') center center no-repeat; diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index 96bb2f8da9d..4412e5bc720 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -71,7 +71,7 @@ const IPrivateReplService = createDecorator('privateReplSer const DECORATION_KEY = 'replinputdecoration'; interface IPrivateReplService { - _serviceBrand: any; + _serviceBrand: undefined; acceptReplInput(): void; getVisibleContent(): string; selectSession(session?: IDebugSession): void; @@ -85,7 +85,7 @@ function revealLastElement(tree: WorkbenchAsyncDataTree) { const sessionsToIgnore = new Set(); export class Repl extends Panel implements IPrivateReplService, IHistoryNavigationWidget { - _serviceBrand: any; + _serviceBrand: undefined; private static readonly REFRESH_DELAY = 100; // delay in ms to refresh the repl for new elements to show private static readonly REPL_INPUT_INITIAL_HEIGHT = 19; @@ -406,6 +406,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati dom.toggleClass(treeContainer, 'word-wrap', wordWrap); this.tree = this.instantiationService.createInstance( WorkbenchAsyncDataTree, + 'DebugRepl', treeContainer, this.replDelegate, [ @@ -444,7 +445,6 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati private createReplInput(container: HTMLElement): void { this.replInputContainer = dom.append(container, $('.repl-input-wrapper')); - this.replInputContainer.title = nls.localize('debugConsole', "Debug Console"); const { scopedContextKeyService, historyNavigationEnablement } = createAndBindHistoryNavigationWidgetScopedContextKeyService(this.contextKeyService, { target: this.replInputContainer, historyNavigator: this }); this.historyNavigationEnablement = historyNavigationEnablement; @@ -455,6 +455,8 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati [IContextKeyService, scopedContextKeyService], [IPrivateReplService, this])); const options = getSimpleEditorOptions(); options.readOnly = true; + options.ariaLabel = nls.localize('debugConsole', "Debug Console"); + this.replInput = this.scopedInstantiationService.createInstance(CodeEditorWidget, this.replInputContainer, options, getSimpleCodeEditorWidgetOptions()); this._register(this.replInput.onDidScrollChange(e => { @@ -768,7 +770,7 @@ class ReplDelegate implements IListVirtualDelegate { return (nameRows + 1) * rowHeight; } - let valueRows = countNumberOfLines(value) + Math.floor(value.length / 150); + let valueRows = value ? (countNumberOfLines(value) + Math.floor(value.length / 150)) : 0; return rowHeight * (nameRows + valueRows); } diff --git a/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts b/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts index 1819f552ec3..6078564168b 100644 --- a/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts +++ b/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts @@ -70,9 +70,13 @@ export class StatusBarColorProvider extends Themable implements IWorkbenchContri // Border Color const borderColor = this.getColor(this.getColorKey(STATUS_BAR_NO_FOLDER_BORDER, STATUS_BAR_DEBUGGING_BORDER, STATUS_BAR_BORDER)) || this.getColor(contrastBorder); - container.style.borderTopWidth = borderColor ? '1px' : null; - container.style.borderTopStyle = borderColor ? 'solid' : null; - container.style.borderTopColor = borderColor; + if (borderColor) { + addClass(container, 'status-border-top'); + container.style.setProperty('--status-border-top-color', borderColor.toString()); + } else { + removeClass(container, 'status-border-top'); + container.style.removeProperty('--status-border-top-color'); + } // Notification Beak if (!this.styleElement) { diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index 052f2506db1..f2f21e715ed 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -86,14 +86,14 @@ export class VariablesView extends ViewletPanel { dom.addClass(container, 'debug-variables'); const treeContainer = renderViewTree(container); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, treeContainer, new VariablesDelegate(), + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'VariablesView', treeContainer, new VariablesDelegate(), [this.instantiationService.createInstance(VariablesRenderer), new ScopesRenderer()], new VariablesDataSource(), { - ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"), - accessibilityProvider: new VariablesAccessibilityProvider(), - identityProvider: { getId: (element: IExpression | IScope) => element.getId() }, - keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression | IScope) => e } - }); + ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"), + accessibilityProvider: new VariablesAccessibilityProvider(), + identityProvider: { getId: (element: IExpression | IScope) => element.getId() }, + keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression | IScope) => e } + }); this.tree.setInput(this.debugService.getViewModel()).then(null, onUnexpectedError); @@ -179,7 +179,7 @@ export class VariablesView extends ViewletPanel { const dataid = response.dataId; if (dataid) { actions.push(new Separator()); - actions.push(new Action('debug.addDataBreakpoint', nls.localize('setDataBreakpoint', "Set Data Breakpoint"), undefined, true, () => { + actions.push(new Action('debug.breakWhenValueChanges', nls.localize('breakWhenValueChanges', "Break When Value Changes"), undefined, true, () => { return this.debugService.addDataBreakpoint(response.description, dataid, !!response.canPersist); })); } diff --git a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts index ecc9524f016..291bb7049a1 100644 --- a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts +++ b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts @@ -61,14 +61,14 @@ export class WatchExpressionsView extends ViewletPanel { const treeContainer = renderViewTree(container); const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, treeContainer, new WatchExpressionsDelegate(), [expressionsRenderer, this.instantiationService.createInstance(VariablesRenderer)], + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'WatchExpressions', treeContainer, new WatchExpressionsDelegate(), [expressionsRenderer, this.instantiationService.createInstance(VariablesRenderer)], new WatchExpressionsDataSource(), { - ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'watchAriaTreeLabel' }, "Debug Watch Expressions"), - accessibilityProvider: new WatchExpressionsAccessibilityProvider(), - identityProvider: { getId: (element: IExpression) => element.getId() }, - keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression) => e }, - dnd: new WatchExpressionsDragAndDrop(this.debugService), - }); + ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'watchAriaTreeLabel' }, "Debug Watch Expressions"), + accessibilityProvider: new WatchExpressionsAccessibilityProvider(), + identityProvider: { getId: (element: IExpression) => element.getId() }, + keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression) => e }, + dnd: new WatchExpressionsDragAndDrop(this.debugService), + }); this.tree.setInput(this.debugService).then(undefined, onUnexpectedError); CONTEXT_WATCH_EXPRESSIONS_FOCUSED.bindTo(this.tree.contextKeyService); diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 42a35769797..165e135a452 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -337,7 +337,7 @@ export interface IBaseBreakpoint extends IEnablement { readonly hitCondition?: string; readonly logMessage?: string; readonly verified: boolean; - readonly idFromAdapter: number | undefined; + getIdFromAdapter(sessionId: string): number | undefined; } export interface IBreakpoint extends IBaseBreakpoint { @@ -682,7 +682,7 @@ export interface ILaunch { export const IDebugService = createDecorator(DEBUG_SERVICE_ID); export interface IDebugService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Gets the current debug state. @@ -857,7 +857,7 @@ export const DEBUG_HELPER_SERVICE_ID = 'debugHelperService'; export const IDebugHelperService = createDecorator(DEBUG_HELPER_SERVICE_ID); export interface IDebugHelperService { - _serviceBrand: any; + _serviceBrand: undefined; createTelemetryService(configurationService: IConfigurationService, args: string[]): TelemetryService | undefined; } diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 599c496dcd9..676811f3fd6 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -583,8 +583,8 @@ export class BaseBreakpoint extends Enablement implements IBaseBreakpoint { return data ? data.verified : true; } - get idFromAdapter(): number | undefined { - const data = this.getSessionData(); + getIdFromAdapter(sessionId: string): number | undefined { + const data = this.sessionData.get(sessionId); return data ? data.id : undefined; } @@ -797,13 +797,13 @@ export class DebugModel implements IDebugModel { private toDispose: lifecycle.IDisposable[]; private schedulers = new Map(); private breakpointsSessionId: string | undefined; + private breakpointsActivated = true; private readonly _onDidChangeBreakpoints: Emitter; private readonly _onDidChangeCallStack: Emitter; private readonly _onDidChangeWatchExpressions: Emitter; constructor( private breakpoints: Breakpoint[], - private breakpointsActivated: boolean, private functionBreakpoints: FunctionBreakpoint[], private exceptionBreakpoints: ExceptionBreakpoint[], private dataBreakopints: DataBreakpoint[], @@ -1065,9 +1065,9 @@ export class DebugModel implements IDebugModel { } setEnablement(element: IEnablement, enable: boolean): void { - if (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof ExceptionBreakpoint) { - const changed: Array = []; - if (element.enabled !== enable && (element instanceof Breakpoint || element instanceof FunctionBreakpoint)) { + if (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof ExceptionBreakpoint || element instanceof DataBreakpoint) { + const changed: Array = []; + if (element.enabled !== enable && (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof DataBreakpoint)) { changed.push(element); } diff --git a/src/vs/workbench/contrib/debug/common/debugSchemas.ts b/src/vs/workbench/contrib/debug/common/debugSchemas.ts index 6eaa73a2838..24ecc5d58e7 100644 --- a/src/vs/workbench/contrib/debug/common/debugSchemas.ts +++ b/src/vs/workbench/contrib/debug/common/debugSchemas.ts @@ -137,6 +137,8 @@ export const launchSchema: IJSONSchema = { id: launchSchemaId, type: 'object', title: nls.localize('app.launch.json.title', "Launch"), + allowsTrailingCommas: true, + allowComments: true, required: [], default: { version: '0.2.0', configurations: [], compounds: [] }, properties: { diff --git a/src/vs/workbench/contrib/debug/node/debugHelperService.ts b/src/vs/workbench/contrib/debug/node/debugHelperService.ts index 29aa2f3156b..899e32872ed 100644 --- a/src/vs/workbench/contrib/debug/node/debugHelperService.ts +++ b/src/vs/workbench/contrib/debug/node/debugHelperService.ts @@ -12,7 +12,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class NodeDebugHelperService implements IDebugHelperService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( ) { diff --git a/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts index d967dce1868..f93108d3341 100644 --- a/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts @@ -24,7 +24,7 @@ suite('Debug - Model', () => { let rawSession: MockRawSession; setup(() => { - model = new DebugModel([], true, [], [], [], [], { isDirty: (e: any) => false }); + model = new DebugModel([], [], [], [], [], { isDirty: (e: any) => false }); rawSession = new MockRawSession(); }); diff --git a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts b/src/vs/workbench/contrib/debug/test/common/mockDebug.ts index bb10110ab92..1e83d444965 100644 --- a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts +++ b/src/vs/workbench/contrib/debug/test/common/mockDebug.ts @@ -14,7 +14,7 @@ import Severity from 'vs/base/common/severity'; export class MockDebugService implements IDebugService { - public _serviceBrand: any; + public _serviceBrand: undefined; public get state(): State { throw new Error('not implemented'); diff --git a/src/vs/workbench/contrib/experiments/common/experimentService.ts b/src/vs/workbench/contrib/experiments/common/experimentService.ts index 5707377ce4b..f6d7e7e7536 100644 --- a/src/vs/workbench/contrib/experiments/common/experimentService.ts +++ b/src/vs/workbench/contrib/experiments/common/experimentService.ts @@ -63,7 +63,7 @@ export interface IExperiment { } export interface IExperimentService { - _serviceBrand: any; + _serviceBrand: undefined; getExperimentById(id: string): Promise; getExperimentsByType(type: ExperimentActionType): Promise; getCuratedExtensionsList(curatedExtensionsKey: string): Promise; @@ -108,7 +108,7 @@ interface IRawExperiment { } export class ExperimentService extends Disposable implements IExperimentService { - _serviceBrand: any; + _serviceBrand: undefined; private _experiments: IExperiment[] = []; private _loadExperimentsPromise: Promise; private _curatedMapping = Object.create(null); @@ -169,7 +169,7 @@ export class ExperimentService extends Disposable implements IExperimentService this.storageService.store(storageKey, JSON.stringify(experimentState), StorageScope.GLOBAL); } - protected getExperiments(): Promise { + protected getExperiments(): Promise { if (!this.productService.experimentsUrl || this.configurationService.getValue('workbench.enableExperiments') === false) { return Promise.resolve([]); } diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index 17e83bed319..ac00ebfdc53 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -300,7 +300,7 @@ export class ExtensionEditor extends BaseEditor { return disposables; } - async setInput(input: ExtensionsInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: ExtensionsInput, options: EditorOptions | undefined, token: CancellationToken): Promise { if (this.template) { await this.updateTemplate(input, this.template); } diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 3e7884ae1f7..cc6b6449ee6 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -68,7 +68,7 @@ function caseInsensitiveGet(obj: { [key: string]: T }, key: string): T | unde export class ExtensionTipsService extends Disposable implements IExtensionTipsService { - _serviceBrand: any; + _serviceBrand: undefined; private _fileBasedRecommendations: { [id: string]: { recommendedTime: number, sources: ExtensionRecommendationSource[] }; } = Object.create(null); private _exeBasedRecommendations: { [id: string]: IExeBasedExtensionTip; } = Object.create(null); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 53632cb694a..71a2b755343 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -3046,7 +3046,7 @@ export class InstallLocalExtensionsInRemoteAction extends Action { get label(): string { if (this.extensionManagementServerService.remoteExtensionManagementServer) { - return localize('select and install local extensions', "Install Local Extensions in {0}...", this.extensionManagementServerService.remoteExtensionManagementServer.label); + return localize('select and install local extensions', "Install Local Extensions in '{0}'...", this.extensionManagementServerService.remoteExtensionManagementServer.label); } return ''; } @@ -3091,7 +3091,7 @@ export class InstallLocalExtensionsInRemoteAction extends Action { const localExtensionsToInstall = await this.queryExtensionsToInstall(); quickPick.busy = false; if (localExtensionsToInstall.length) { - quickPick.title = localize('install local extensions title', "Install Local Extensions in {0}", this.extensionManagementServerService.remoteExtensionManagementServer!.label); + quickPick.title = localize('install local extensions title', "Install Local Extensions in '{0}'", this.extensionManagementServerService.remoteExtensionManagementServer!.label); quickPick.placeholder = localize('select extensions to install', "Select extensions to install"); quickPick.canSelectMany = true; localExtensionsToInstall.sort((e1, e2) => e1.displayName.localeCompare(e2.displayName)); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewer.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewer.ts index aeb50c75c64..919c3762319 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewer.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewer.ts @@ -198,6 +198,7 @@ export class ExtensionsTree extends WorkbenchAsyncDataTree; + }); this._register(this.list.onContextMenu(e => this.onContextMenu(e), this)); this._register(this.list.onFocusChange(e => extensionsViewState.onFocusChange(coalesce(e.elements)), this)); this._register(this.list); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.ts index 05741f72a62..553c40fbd50 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.ts @@ -170,8 +170,8 @@ export class TooltipWidget extends ExtensionWidget { if (!this.extension) { return ''; } - if (this.tooltipAction.tooltip) { - return this.tooltipAction.tooltip; + if (this.tooltipAction.label) { + return this.tooltipAction.label; } return this.recommendationWidget.tooltip; } diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts index 31f9d115e24..de3a9ed9c3a 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts @@ -474,7 +474,7 @@ class Extensions extends Disposable { export class ExtensionsWorkbenchService extends Disposable implements IExtensionsWorkbenchService, IURLHandler { private static readonly SyncPeriod = 1000 * 60 * 60 * 12; // 12 hours - _serviceBrand: any; + _serviceBrand: undefined; private readonly localExtensions: Extensions | null = null; private readonly remoteExtensions: Extensions | null = null; diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index 47b8e916d88..126a008a66b 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -74,7 +74,7 @@ export const SERVICE_ID = 'extensionsWorkbenchService'; export const IExtensionsWorkbenchService = createDecorator(SERVICE_ID); export interface IExtensionsWorkbenchService { - _serviceBrand: any; + _serviceBrand: undefined; onChange: Event; local: IExtension[]; installed: IExtension[]; diff --git a/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.ts b/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.ts index 7f719e46e5f..285e9e48de8 100644 --- a/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.ts +++ b/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.ts @@ -11,6 +11,7 @@ export const ExtensionsConfigurationSchemaId = 'vscode://schemas/extensions'; export const ExtensionsConfigurationSchema: IJSONSchema = { id: ExtensionsConfigurationSchemaId, allowComments: true, + allowsTrailingCommas: true, type: 'object', title: localize('app.extensions.json.title', "Extensions"), additionalProperties: false, @@ -50,4 +51,4 @@ export const ExtensionsConfigurationInitialContent: string = [ '\t\t', '\t]', '}' -].join('\n'); \ No newline at end of file +].join('\n'); diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts index af073fb2c6f..2d05dd683bc 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts @@ -23,7 +23,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; export class ExtensionHostProfileService extends Disposable implements IExtensionHostProfileService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _onDidChangeState: Emitter = this._register(new Emitter()); public readonly onDidChangeState: Event = this._onDidChangeState.event; diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts index b6ac536b089..55b00c7fd23 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -59,7 +59,7 @@ export enum ProfileSessionState { } export interface IExtensionHostProfileService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onDidChangeState: Event; readonly onDidChangeLastProfile: Event; @@ -404,7 +404,9 @@ export class RuntimeExtensionsEditor extends BaseEditor { } }; - this._list = this._instantiationService.createInstance(WorkbenchList, parent, delegate, [renderer], { + this._list = this._instantiationService.createInstance(WorkbenchList, + 'RuntimeExtensions', + parent, delegate, [renderer], { multipleSelectionSupport: false, setRowLineHeight: false, horizontalScrolling: false diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts index 93e10545ebd..fe1a52439e1 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts @@ -2245,7 +2245,7 @@ suite('ExtensionsActions Test', () => { extensionManagementService: remoteExtensionManagementService || createExtensionManagementService() }; return { - _serviceBrand: {}, + _serviceBrand: undefined, localExtensionManagementServer: null, remoteExtensionManagementServer, getExtensionManagementServer: (location: URI) => { @@ -2269,7 +2269,7 @@ suite('ExtensionsActions Test', () => { extensionManagementService: remoteExtensionManagementService || createExtensionManagementService() }; return { - _serviceBrand: {}, + _serviceBrand: undefined, localExtensionManagementServer, remoteExtensionManagementServer, getExtensionManagementServer: (location: URI) => { diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts index 1ac40b499a2..87deffa1001 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts @@ -65,17 +65,17 @@ const mockExtensionGallery: IGalleryExtension[] = [ rating: 4, ratingCount: 100 }, { - dependencies: ['pub.1'], - }, { - manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, - readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, - changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, - download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, - icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, - license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, - repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, - coreTranslations: [] - }), + dependencies: ['pub.1'], + }, { + manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, + readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, + changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, + download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, + icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, + license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, + repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, + coreTranslations: [] + }), aGalleryExtension('MockExtension2', { displayName: 'Mock Extension 2', version: '1.5', @@ -87,17 +87,17 @@ const mockExtensionGallery: IGalleryExtension[] = [ rating: 4, ratingCount: 100 }, { - dependencies: ['pub.1', 'pub.2'], - }, { - manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, - readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, - changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, - download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, - icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, - license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, - repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, - coreTranslations: [] - }) + dependencies: ['pub.1', 'pub.2'], + }, { + manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, + readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, + changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, + download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, + icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, + license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, + repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, + coreTranslations: [] + }) ]; const mockExtensionLocal = [ diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts index f6ca00e7b88..1edf1c907d0 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts @@ -121,17 +121,17 @@ suite('ExtensionsWorkbenchServiceTest', () => { rating: 4, ratingCount: 100 }, { - dependencies: ['pub.1', 'pub.2'], - }, { - manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, - readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, - changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, - download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, - icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, - license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, - repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, - coreTranslations: [] - }); + dependencies: ['pub.1', 'pub.2'], + }, { + manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, + readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, + changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, + download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, + icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, + license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, + repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, + coreTranslations: [] + }); testObject = await aWorkbenchService(); instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(expected)); @@ -176,21 +176,21 @@ suite('ExtensionsWorkbenchServiceTest', () => { icon: 'localIcon1', extensionDependencies: ['pub.1', 'pub.2'], }, { - type: ExtensionType.User, - readmeUrl: 'localReadmeUrl1', - changelogUrl: 'localChangelogUrl1', - location: URI.file('localPath1') - }); + type: ExtensionType.User, + readmeUrl: 'localReadmeUrl1', + changelogUrl: 'localChangelogUrl1', + location: URI.file('localPath1') + }); const expected2 = aLocalExtension('local2', { publisher: 'localPublisher2', version: '1.2.0', displayName: 'localDisplayName2', description: 'localDescription2', }, { - type: ExtensionType.System, - readmeUrl: 'localReadmeUrl2', - changelogUrl: 'localChangelogUrl2', - }); + type: ExtensionType.System, + readmeUrl: 'localReadmeUrl2', + changelogUrl: 'localChangelogUrl2', + }); instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [expected1, expected2]); testObject = await aWorkbenchService(); @@ -244,21 +244,21 @@ suite('ExtensionsWorkbenchServiceTest', () => { icon: 'localIcon1', extensionDependencies: ['pub.1', 'pub.2'], }, { - type: ExtensionType.User, - readmeUrl: 'localReadmeUrl1', - changelogUrl: 'localChangelogUrl1', - location: URI.file('localPath1') - }); + type: ExtensionType.User, + readmeUrl: 'localReadmeUrl1', + changelogUrl: 'localChangelogUrl1', + location: URI.file('localPath1') + }); const local2 = aLocalExtension('local2', { publisher: 'localPublisher2', version: '1.2.0', displayName: 'localDisplayName2', description: 'localDescription2', }, { - type: ExtensionType.System, - readmeUrl: 'localReadmeUrl2', - changelogUrl: 'localChangelogUrl2', - }); + type: ExtensionType.System, + readmeUrl: 'localReadmeUrl2', + changelogUrl: 'localChangelogUrl2', + }); const gallery1 = aGalleryExtension(local1.manifest.name, { identifier: local1.identifier, displayName: 'expectedDisplayName', @@ -271,17 +271,17 @@ suite('ExtensionsWorkbenchServiceTest', () => { rating: 4, ratingCount: 100 }, { - dependencies: ['pub.1'], - }, { - manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, - readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, - changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, - download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, - icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, - license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, - repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, - coreTranslations: [] - }); + dependencies: ['pub.1'], + }, { + manifest: { uri: 'uri:manifest', fallbackUri: 'fallback:manifest' }, + readme: { uri: 'uri:readme', fallbackUri: 'fallback:readme' }, + changelog: { uri: 'uri:changelog', fallbackUri: 'fallback:changlog' }, + download: { uri: 'uri:download', fallbackUri: 'fallback:download' }, + icon: { uri: 'uri:icon', fallbackUri: 'fallback:icon' }, + license: { uri: 'uri:license', fallbackUri: 'fallback:license' }, + repository: { uri: 'uri:repository', fallbackUri: 'fallback:repository' }, + coreTranslations: [] + }); instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local1, local2]); instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery1)); testObject = await aWorkbenchService(); diff --git a/src/vs/workbench/contrib/externalTerminal/common/externalTerminal.ts b/src/vs/workbench/contrib/externalTerminal/common/externalTerminal.ts index 6d4dfc04f46..6bbcd810c1e 100644 --- a/src/vs/workbench/contrib/externalTerminal/common/externalTerminal.ts +++ b/src/vs/workbench/contrib/externalTerminal/common/externalTerminal.ts @@ -14,7 +14,7 @@ export interface IExternalTerminalSettings { } export interface IExternalTerminalService { - _serviceBrand: any; + _serviceBrand: undefined; openTerminal(path: string): void; runInTerminal(title: string, cwd: string, args: string[], env: { [key: string]: string | null; }, settings: IExternalTerminalSettings): Promise; } diff --git a/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts b/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts index 474e2727d73..e641bc748ee 100644 --- a/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts +++ b/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts @@ -23,7 +23,7 @@ const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console"); export const DEFAULT_TERMINAL_OSX = 'Terminal.app'; export class WindowsExternalTerminalService implements IExternalTerminalService { - public _serviceBrand: any; + public _serviceBrand: undefined; private static readonly CMD = 'cmd.exe'; @@ -118,7 +118,7 @@ export class WindowsExternalTerminalService implements IExternalTerminalService } export class MacExternalTerminalService implements IExternalTerminalService { - public _serviceBrand: any; + public _serviceBrand: undefined; private static readonly OSASCRIPT = '/usr/bin/osascript'; // osascript is the AppleScript interpreter on OS X @@ -214,7 +214,7 @@ export class MacExternalTerminalService implements IExternalTerminalService { } export class LinuxExternalTerminalService implements IExternalTerminalService { - public _serviceBrand: any; + public _serviceBrand: undefined; private static readonly WAIT_MESSAGE = nls.localize('press.any.key', "Press any key to continue..."); @@ -305,7 +305,7 @@ export class LinuxExternalTerminalService implements IExternalTerminalService { if (!LinuxExternalTerminalService._DEFAULT_TERMINAL_LINUX_READY) { LinuxExternalTerminalService._DEFAULT_TERMINAL_LINUX_READY = new Promise(c => { if (env.isLinux) { - Promise.all([pfs.exists('/etc/debian_version'), process.lazyEnv || Promise.resolve(undefined)]).then(([isDebian]) => { + Promise.all([pfs.exists('/etc/debian_version'), Promise.resolve(process.lazyEnv) || Promise.resolve(undefined)]).then(([isDebian]) => { if (isDebian) { c('x-terminal-emulator'); } else if (process.env.DESKTOP_SESSION === 'gnome' || process.env.DESKTOP_SESSION === 'gnome-classic') { diff --git a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts index 9c0808d9ad1..8a9bb08108a 100644 --- a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts @@ -49,7 +49,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor { ); } - private async openInternal(input: EditorInput, options: EditorOptions): Promise { + private async openInternal(input: EditorInput, options: EditorOptions | undefined): Promise { if (input instanceof FileEditorInput) { input.setForceOpenAsText(); @@ -57,7 +57,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor { } } - getTitle(): string | null { + getTitle(): string | undefined { return this.input ? this.input.getName() : nls.localize('binaryFileEditor', "Binary File Viewer"); } } diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 76c18cda35c..eac306be109 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -27,6 +27,7 @@ import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor import { ResourceQueue, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { @@ -326,7 +327,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // Binary editor that should reload from event if (resource && editor.input && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) { - this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true }, editor.group); + this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true, activation: EditorActivation.PRESERVE }, editor.group); } }); } diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts index c52724a2e64..6afa675b8e6 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { toErrorMessage } from 'vs/base/common/errorMessage'; -import * as types from 'vs/base/common/types'; +import { isFunction } from 'vs/base/common/types'; import { isValidBasename } from 'vs/base/common/extpath'; import { basename } from 'vs/base/common/resources'; import { Action } from 'vs/base/common/actions'; @@ -32,6 +32,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor'; import { createErrorWithActions } from 'vs/base/common/errorsWithActions'; import { MutableDisposable } from 'vs/base/common/lifecycle'; +import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/editor'; /** * An implementation of editor for file system resources. @@ -89,11 +90,11 @@ export class TextFileEditor extends BaseTextEditor { return this.input ? this.input.getName() : nls.localize('textFileEditor', "Text File Editor"); } - get input(): FileEditorInput { + get input(): FileEditorInput | undefined { return this._input as FileEditorInput; } - setEditorVisible(visible: boolean, group: IEditorGroup): void { + setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { super.setEditorVisible(visible, group); // React to editors closing to preserve or clear view state. This needs to happen @@ -117,14 +118,14 @@ export class TextFileEditor extends BaseTextEditor { } } - setOptions(options: EditorOptions): void { - const textOptions = options; - if (textOptions && types.isFunction(textOptions.apply)) { + setOptions(options: EditorOptions | undefined): void { + const textOptions = options as TextEditorOptions; + if (textOptions && isFunction(textOptions.apply)) { textOptions.apply(this.getControl(), ScrollType.Smooth); } } - async setInput(input: FileEditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: FileEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { // Update/clear view settings if input changes this.doSaveOrClearTextEditorViewState(this.input); @@ -153,13 +154,13 @@ export class TextFileEditor extends BaseTextEditor { textEditor.setModel(textFileModel.textEditorModel); // Always restore View State if any associated - const editorViewState = this.loadTextEditorViewState(this.input.getResource()); + const editorViewState = this.loadTextEditorViewState(input.getResource()); if (editorViewState) { textEditor.restoreViewState(editorViewState); } // TextOptions (avoiding instanceof here for a reason, do not change!) - if (options && types.isFunction((options).apply)) { + if (options && isFunction((options).apply)) { (options).apply(textEditor, ScrollType.Immediate); } @@ -223,8 +224,20 @@ export class TextFileEditor extends BaseTextEditor { } } - private openAsBinary(input: FileEditorInput, options: EditorOptions): void { + private openAsBinary(input: FileEditorInput, options: EditorOptions | undefined): void { input.setForceOpenAsBinary(); + + // Make sure to not steal away the currently active group + // because we are triggering another openEditor() call + // and do not control the initial intent that resulted + // in us now opening as binary. + const preservingOptions: IEditorOptions = { activation: EditorActivation.PRESERVE }; + if (options) { + options.overwrite(preservingOptions); + } else { + options = EditorOptions.create(preservingOptions); + } + this.editorService.openEditor(input, options, this.group); } @@ -278,7 +291,7 @@ export class TextFileEditor extends BaseTextEditor { super.saveState(); } - private doSaveOrClearTextEditorViewState(input: FileEditorInput): void { + private doSaveOrClearTextEditorViewState(input: FileEditorInput | undefined): void { if (!input) { return; // ensure we have an input to handle view state for } diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index c9713c80989..d85d35b9bcf 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -26,10 +26,9 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { DelegatingEditorService } from 'vs/workbench/services/editor/browser/editorService'; -import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IEditorOptions } from 'vs/platform/editor/common/editor'; -import { IEditorInput, IEditor } from 'vs/workbench/common/editor'; +import { IEditor } from 'vs/workbench/common/editor'; import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet'; import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -158,7 +157,6 @@ export class ExplorerViewlet extends ViewContainerViewlet { @ITelemetryService telemetryService: ITelemetryService, @IWorkspaceContextService protected contextService: IWorkspaceContextService, @IStorageService protected storageService: IStorageService, - @IEditorService private readonly editorService: IEditorService, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IConfigurationService configurationService: IConfigurationService, @IInstantiationService protected instantiationService: IInstantiationService, @@ -187,7 +185,7 @@ export class ExplorerViewlet extends ViewContainerViewlet { // We try to be smart and only use the delay if we recognize that the user action is likely to cause // a new entry in the opened editors view. const delegatingEditorService = this.instantiationService.createInstance(DelegatingEditorService); - delegatingEditorService.setEditorOpenHandler(async (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise => { + delegatingEditorService.setEditorOpenHandler(async (delegate, group, editor, options): Promise => { let openEditorsView = this.getOpenEditorsView(); if (openEditorsView) { let delay = 0; @@ -205,7 +203,7 @@ export class ExplorerViewlet extends ViewContainerViewlet { let openedEditor: IEditor | undefined; try { - openedEditor = await this.editorService.openEditor(editor, options, group); + openedEditor = await delegate(group, editor, options); } catch (error) { // ignore } finally { diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index 384d6735830..2ee93fec213 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -225,23 +225,23 @@ async function saveAll(saveAllArguments: any, editorService: IEditorService, unt // Store some properties per untitled file to restore later after save is completed const groupIdToUntitledResourceInput = new Map(); - editorGroupService.groups.forEach(g => { - const activeEditorResource = g.activeEditor && g.activeEditor.getResource(); - g.editors.forEach(e => { + editorGroupService.groups.forEach(group => { + const activeEditorResource = group.activeEditor && group.activeEditor.getResource(); + group.editors.forEach(e => { const resource = e.getResource(); if (resource && untitledEditorService.isDirty(resource)) { - if (!groupIdToUntitledResourceInput.has(g.id)) { - groupIdToUntitledResourceInput.set(g.id, []); + if (!groupIdToUntitledResourceInput.has(group.id)) { + groupIdToUntitledResourceInput.set(group.id, []); } - groupIdToUntitledResourceInput.get(g.id)!.push({ + groupIdToUntitledResourceInput.get(group.id)!.push({ encoding: untitledEditorService.getEncoding(resource), resource, options: { inactive: activeEditorResource ? activeEditorResource.toString() !== resource.toString() : true, pinned: true, preserveFocus: true, - index: g.getIndexOfEditor(e) + index: group.getIndexOfEditor(e) } }); } diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 5a2c00e5786..bb0f7e04b7f 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -241,8 +241,7 @@ export class ExplorerView extends ViewletPanel { const activeFile = this.getActiveFile(); if (!activeFile && !focused[0].isDirectory) { // Open the focused element in the editor if there is currently no file opened #67708 - this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }) - .then(undefined, onUnexpectedError); + this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }); } } } @@ -276,35 +275,35 @@ export class ExplorerView extends ViewletPanel { this._register(createFileIconThemableTreeContainerScope(container, this.themeService)); - this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, container, new ExplorerDelegate(), [filesRenderer], + this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'FileExplorer', container, new ExplorerDelegate(), [filesRenderer], this.instantiationService.createInstance(ExplorerDataSource), { - accessibilityProvider: new ExplorerAccessibilityProvider(), - ariaLabel: nls.localize('treeAriaLabel', "Files Explorer"), - identityProvider: { - getId: (stat: ExplorerItem) => { - if (stat instanceof NewExplorerItem) { - return `new:${stat.resource}`; - } - - return stat.resource; + accessibilityProvider: new ExplorerAccessibilityProvider(), + ariaLabel: nls.localize('treeAriaLabel', "Files Explorer"), + identityProvider: { + getId: (stat: ExplorerItem) => { + if (stat instanceof NewExplorerItem) { + return `new:${stat.resource}`; } - }, - keyboardNavigationLabelProvider: { - getKeyboardNavigationLabel: (stat: ExplorerItem) => { - if (this.explorerService.isEditable(stat)) { - return undefined; - } - return stat.name; + return stat.resource; + } + }, + keyboardNavigationLabelProvider: { + getKeyboardNavigationLabel: (stat: ExplorerItem) => { + if (this.explorerService.isEditable(stat)) { + return undefined; } - }, - multipleSelectionSupport: true, - filter: this.filter, - sorter: this.instantiationService.createInstance(FileSorter), - dnd: this.instantiationService.createInstance(FileDragAndDrop), - autoExpandSingleChildren: true, - additionalScrollHeight: ExplorerDelegate.ITEM_HEIGHT - }); + + return stat.name; + } + }, + multipleSelectionSupport: true, + filter: this.filter, + sorter: this.instantiationService.createInstance(FileSorter), + dnd: this.instantiationService.createInstance(FileDragAndDrop), + autoExpandSingleChildren: true, + additionalScrollHeight: ExplorerDelegate.ITEM_HEIGHT + }); this._register(this.tree); // Bind context keys diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index 016249db38c..0c368120dff 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -170,7 +170,11 @@ export class FilesRenderer implements ITreeRenderer { - this.updateWidth(stat); + try { + this.updateWidth(stat); + } catch (e) { + // noop since the element might no longer be in the tree, no update of width necessery + } }); } diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 96be5e2659b..5bac984d510 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -28,7 +28,7 @@ import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent, IListDragAn import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'; @@ -213,13 +213,13 @@ export class OpenEditorsView extends ViewletPanel { this.listLabels.clear(); } this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility }); - this.list = this.instantiationService.createInstance(WorkbenchList, container, delegate, [ + this.list = this.instantiationService.createInstance(WorkbenchList, 'OpenEditors', container, delegate, [ new EditorGroupRenderer(this.keybindingService, this.instantiationService), new OpenEditorRenderer(this.listLabels, this.instantiationService, this.keybindingService, this.configurationService) ], { - identityProvider: { getId: (element: OpenEditor | IEditorGroup) => element instanceof OpenEditor ? element.getId() : element.id.toString() }, - dnd: new OpenEditorsDragAndDrop(this.instantiationService, this.editorGroupService) - }); + identityProvider: { getId: (element: OpenEditor | IEditorGroup) => element instanceof OpenEditor ? element.getId() : element.id.toString() }, + dnd: new OpenEditorsDragAndDrop(this.instantiationService, this.editorGroupService) + }); this._register(this.list); this._register(this.listLabels); @@ -263,15 +263,21 @@ export class OpenEditorsView extends ViewletPanel { let openToSide = false; let isSingleClick = false; let isDoubleClick = false; + let isMiddleClick = false; if (browserEvent instanceof MouseEvent) { isSingleClick = browserEvent.detail === 1; isDoubleClick = browserEvent.detail === 2; + isMiddleClick = browserEvent.button === 1; openToSide = this.list.useAltAsMultipleSelectionModifier ? (browserEvent.ctrlKey || browserEvent.metaKey) : browserEvent.altKey; } const focused = this.list.getFocusedElements(); const element = focused.length ? focused[0] : undefined; if (element instanceof OpenEditor) { + if (isMiddleClick) { + return; // already handled above: closes the editor + } + this.openEditor(element, { preserveFocus: isSingleClick, pinned: isDoubleClick, sideBySide: openToSide }); } else if (element) { this.editorGroupService.activateGroup(element); @@ -349,13 +355,9 @@ export class OpenEditorsView extends ViewletPanel { const preserveActivateGroup = options.sideBySide && options.preserveFocus; // needed for https://github.com/Microsoft/vscode/issues/42399 if (!preserveActivateGroup) { - this.editorGroupService.activateGroup(element.groupId); // needed for https://github.com/Microsoft/vscode/issues/6672 + this.editorGroupService.activateGroup(element.group); // needed for https://github.com/Microsoft/vscode/issues/6672 } - this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : ACTIVE_GROUP).then(editor => { - if (editor && !preserveActivateGroup && editor.group) { - this.editorGroupService.activateGroup(editor.group); - } - }); + this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : element.group); } } diff --git a/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts b/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts index 20c46e13777..01da7d6eff1 100644 --- a/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts +++ b/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri'; import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity'; import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import * as arrays from 'vs/base/common/arrays'; -import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; export class DirtyFilesTracker extends Disposable implements IWorkbenchContribution { private isDocumentedEdited: boolean; @@ -88,7 +88,6 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut } private doOpenDirtyResources(resources: URI[]): void { - const activeEditor = this.editorService.activeControl; // Open this.editorService.openEditors(resources.map(resource => { @@ -96,7 +95,7 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut resource, options: { inactive: true, pinned: true, preserveFocus: true } }; - }), activeEditor ? activeEditor.group : ACTIVE_GROUP); + })); } private onTextFilesSaved(e: TextFileModelChangeEvent[]): void { diff --git a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts index 3aae29a21be..e395251dc29 100644 --- a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts @@ -5,7 +5,6 @@ import { localize } from 'vs/nls'; import { memoize } from 'vs/base/common/decorators'; -import { basename } from 'vs/base/common/path'; import { dirname } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { EncodingMode, ConfirmResult, EditorInput, IFileEditorInput, ITextEditorModel, Verbosity, IRevertOptions } from 'vs/workbench/common/editor'; @@ -34,7 +33,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { private forceOpenAs: ForceOpenAs = ForceOpenAs.None; - private textModelReference: Promise> | null; + private textModelReference: Promise> | null = null; private name: string; /** @@ -147,14 +146,14 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { getName(): string { if (!this.name) { - this.name = basename(this.labelService.getUriLabel(this.resource)); + this.name = this.labelService.getUriBasenameLabel(this.resource); } return this.decorateLabel(this.name); } private get shortDescription(): string { - return basename(this.labelService.getUriLabel(dirname(this.resource))); + return this.labelService.getUriBasenameLabel(dirname(this.resource)); } private get mediumDescription(): string { diff --git a/src/vs/workbench/contrib/files/common/explorerService.ts b/src/vs/workbench/contrib/files/common/explorerService.ts index aff4390570c..4f6f55899a1 100644 --- a/src/vs/workbench/contrib/files/common/explorerService.ts +++ b/src/vs/workbench/contrib/files/common/explorerService.ts @@ -27,7 +27,7 @@ function getFileEventsExcludes(configurationService: IConfigurationService, root } export class ExplorerService implements IExplorerService { - _serviceBrand: any; + _serviceBrand: undefined; private static readonly EXPLORER_FILE_CHANGES_REACT_DELAY = 500; // delay in ms to react to file changes to give our internal events a chance to react first diff --git a/src/vs/workbench/contrib/files/common/files.ts b/src/vs/workbench/contrib/files/common/files.ts index 342088011f5..4d4af35e7e9 100644 --- a/src/vs/workbench/contrib/files/common/files.ts +++ b/src/vs/workbench/contrib/files/common/files.ts @@ -41,7 +41,7 @@ export interface IEditableData { } export interface IExplorerService { - _serviceBrand: any; + _serviceBrand: undefined; readonly roots: ExplorerItem[]; readonly sortOrder: SortOrder; readonly onDidChangeRoots: Event; diff --git a/src/vs/workbench/contrib/issue/electron-browser/issue.ts b/src/vs/workbench/contrib/issue/electron-browser/issue.ts index ca98eb60aca..da0a15a4e64 100644 --- a/src/vs/workbench/contrib/issue/electron-browser/issue.ts +++ b/src/vs/workbench/contrib/issue/electron-browser/issue.ts @@ -9,7 +9,7 @@ import { IssueReporterData } from 'vs/platform/issue/node/issue'; export const IWorkbenchIssueService = createDecorator('workbenchIssueService'); export interface IWorkbenchIssueService { - _serviceBrand: any; + _serviceBrand: undefined; openReporter(dataOverrides?: Partial): Promise; openProcessExplorer(): Promise; } diff --git a/src/vs/workbench/contrib/issue/electron-browser/issueService.ts b/src/vs/workbench/contrib/issue/electron-browser/issueService.ts index 5dfea6f09da..8be9212e101 100644 --- a/src/vs/workbench/contrib/issue/electron-browser/issueService.ts +++ b/src/vs/workbench/contrib/issue/electron-browser/issueService.ts @@ -16,7 +16,7 @@ import { ExtensionType } from 'vs/platform/extensions/common/extensions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; export class WorkbenchIssueService implements IWorkbenchIssueService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IIssueService private readonly issueService: IIssueService, diff --git a/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts b/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts index 1982d8aebc0..6d1f8376014 100644 --- a/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts +++ b/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts @@ -232,6 +232,7 @@ function registerLocaleDefinitionSchema(languages: string[]): void { jsonRegistry.registerSchema(localeDefinitionFileSchemaId, { id: localeDefinitionFileSchemaId, allowComments: true, + allowsTrailingCommas: true, description: 'Locale Definition file', type: 'object', default: { diff --git a/src/vs/workbench/contrib/logs/common/logs.contribution.ts b/src/vs/workbench/contrib/logs/common/logs.contribution.ts index b2ad741a15e..3de9142da6b 100644 --- a/src/vs/workbench/contrib/logs/common/logs.contribution.ts +++ b/src/vs/workbench/contrib/logs/common/logs.contribution.ts @@ -8,7 +8,7 @@ import { join } from 'vs/base/common/path'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; -import { SetLogLevelAction, OpenLogsFolderAction, OpenSessionLogFileAction } from 'vs/workbench/contrib/logs/common/logsActions'; +import { SetLogLevelAction, OpenLogsFolderAction, OpenWindowSessionLogFileAction } from 'vs/workbench/contrib/logs/common/logsActions'; import * as Constants from 'vs/workbench/contrib/logs/common/logConstants'; import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -49,7 +49,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution { const workbenchActionsRegistry = Registry.as(WorkbenchActionExtensions.WorkbenchActions); const devCategory = nls.localize('developer', "Developer"); - workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenSessionLogFileAction, OpenSessionLogFileAction.ID, OpenSessionLogFileAction.LABEL), 'Developer: Open Log File (Session)...', devCategory); + workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenWindowSessionLogFileAction, OpenWindowSessionLogFileAction.ID, OpenWindowSessionLogFileAction.LABEL), 'Developer: Open Browser Log File (Session)...', devCategory); } private registerNativeContributions(): void { diff --git a/src/vs/workbench/contrib/logs/common/logsActions.ts b/src/vs/workbench/contrib/logs/common/logsActions.ts index 7bf78df5a3b..00a100d4c64 100644 --- a/src/vs/workbench/contrib/logs/common/logsActions.ts +++ b/src/vs/workbench/contrib/logs/common/logsActions.ts @@ -78,10 +78,10 @@ export class SetLogLevelAction extends Action { } } -export class OpenSessionLogFileAction extends Action { +export class OpenWindowSessionLogFileAction extends Action { static ID = 'workbench.action.openSessionLogFile'; - static LABEL = nls.localize('openSessionLogFile', "Open Log File (Session)..."); + static LABEL = nls.localize('openSessionLogFile', "Open Window Log File (Session)..."); constructor(id: string, label: string, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, diff --git a/src/vs/workbench/contrib/logs/common/logsDataCleaner.ts b/src/vs/workbench/contrib/logs/common/logsDataCleaner.ts index 90d328690ed..4f7faa55ebe 100644 --- a/src/vs/workbench/contrib/logs/common/logsDataCleaner.ts +++ b/src/vs/workbench/contrib/logs/common/logsDataCleaner.ts @@ -22,7 +22,7 @@ export class LogsDataCleaner extends Disposable { } private cleanUpOldLogsSoon(): void { - let handle: NodeJS.Timeout | undefined = setTimeout(async () => { + let handle: any = setTimeout(async () => { handle = undefined; const logsPath = URI.file(this.environmentService.logsPath).with({ scheme: this.environmentService.logFile.scheme }); const stat = await this.fileService.resolve(dirname(logsPath)); diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index 08d95709864..3a31ebe7ade 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -118,6 +118,7 @@ registerAction({ group: 'navigation' }, keybinding: { + weight: KeybindingWeight.WorkbenchContrib, keys: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C }, @@ -155,6 +156,7 @@ registerAction({ }, keybinding: { when: Constants.MarkerPanelFilterFocusContextKey, + weight: KeybindingWeight.WorkbenchContrib, keys: { primary: KeyMod.CtrlCmd | KeyCode.DownArrow }, @@ -167,6 +169,7 @@ registerAction({ }, keybinding: { when: Constants.MarkerPanelFocusContextKey, + weight: KeybindingWeight.WorkbenchContrib, keys: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F }, @@ -339,4 +342,4 @@ class MarkersStatusBarContributions extends Disposable implements IWorkbenchCont } } -workbenchRegistry.registerWorkbenchContribution(MarkersStatusBarContributions, LifecyclePhase.Restored); \ No newline at end of file +workbenchRegistry.registerWorkbenchContribution(MarkersStatusBarContributions, LifecyclePhase.Restored); diff --git a/src/vs/workbench/contrib/markers/browser/markers.ts b/src/vs/workbench/contrib/markers/browser/markers.ts index 4b27488a458..47bebfa187f 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.ts @@ -13,6 +13,8 @@ import Constants from './constants'; import { URI } from 'vs/base/common/uri'; import { groupBy } from 'vs/base/common/arrays'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; +import { Event } from 'vs/base/common/event'; +import { ResourceMap } from 'vs/base/common/map'; export const IMarkersWorkbenchService = createDecorator('markersWorkbenchService'); @@ -22,12 +24,12 @@ export interface IFilter { } export interface IMarkersWorkbenchService { - _serviceBrand: any; + _serviceBrand: undefined; readonly markersModel: MarkersModel; } export class MarkersWorkbenchService extends Disposable implements IMarkersWorkbenchService { - _serviceBrand: any; + _serviceBrand: undefined; readonly markersModel: MarkersModel; @@ -38,17 +40,16 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb super(); this.markersModel = this._register(instantiationService.createInstance(MarkersModel, this.readMarkers())); - for (const group of groupBy(this.readMarkers(), compareMarkersByUri)) { - this.markersModel.setResourceMarkers(group[0].resource, group); - } - - this._register(markerService.onMarkerChanged(resources => this.onMarkerChanged(resources))); + this.markersModel.setResourceMarkers(groupBy(this.readMarkers(), compareMarkersByUri).map(group => [group[0].resource, group])); + this._register(Event.debounce>(markerService.onMarkerChanged, (resourcesMap, resources) => { + resourcesMap = resourcesMap ? resourcesMap : new ResourceMap(); + resources.forEach(resource => resourcesMap!.set(resource, resource)); + return resourcesMap; + }, 0)(resourcesMap => this.onMarkerChanged(resourcesMap.values()))); } private onMarkerChanged(resources: URI[]): void { - for (const resource of resources) { - this.markersModel.setResourceMarkers(resource, this.readMarkers(resource)); - } + this.markersModel.setResourceMarkers(resources.map(resource => [resource, this.readMarkers(resource)])); } private readMarkers(resource?: URI): IMarker[] { @@ -76,4 +77,4 @@ export class ActivityUpdater extends Disposable implements IWorkbenchContributio const message = localize('totalProblems', 'Total {0} Problems', total); this.activity.value = this.activityService.showActivity(Constants.MARKERS_PANEL_ID, new NumberBadge(total, () => message)); } -} \ No newline at end of file +} diff --git a/src/vs/workbench/contrib/markers/browser/markersModel.ts b/src/vs/workbench/contrib/markers/browser/markersModel.ts index 857e74d0cad..06c7f4d437d 100644 --- a/src/vs/workbench/contrib/markers/browser/markersModel.ts +++ b/src/vs/workbench/contrib/markers/browser/markersModel.ts @@ -50,7 +50,7 @@ export class ResourceMarkers { @memoize get name(): string { return basename(this.resource); } - constructor(readonly id: string, readonly resource: URI, readonly markers: Marker[]) { } + constructor(readonly id: string, readonly resource: URI, public markers: Marker[]) { } } export class Marker { @@ -58,7 +58,7 @@ export class Marker { get resource(): URI { return this.marker.resource; } get range(): IRange { return this.marker; } - private _lines: string[]; + private _lines: string[] | undefined; get lines(): string[] { if (!this._lines) { this._lines = this.marker.message.split(/\r\n|\r|\n/g); @@ -90,12 +90,18 @@ export class RelatedInformation { ) { } } +export interface MarkerChangesEvent { + readonly added: ResourceMarkers[]; + readonly removed: ResourceMarkers[]; + readonly updated: ResourceMarkers[]; +} + export class MarkersModel { private cachedSortedResources: ResourceMarkers[] | undefined = undefined; - private readonly _onDidChange = new Emitter(); - readonly onDidChange: Event = this._onDidChange.event; + private readonly _onDidChange = new Emitter(); + readonly onDidChange: Event = this._onDidChange.event; get resourceMarkers(): ResourceMarkers[] { if (!this.cachedSortedResources) { @@ -115,33 +121,48 @@ export class MarkersModel { return withUndefinedAsNull(this.resourcesByUri.get(resource.toString())); } - setResourceMarkers(resource: URI, rawMarkers: IMarker[]): void { - if (isFalsyOrEmpty(rawMarkers)) { - this.resourcesByUri.delete(resource.toString()); - } else { - - const resourceMarkersId = this.id(resource.toString()); - const markersCountByKey = new Map(); - const markers = mergeSort(rawMarkers.map((rawMarker) => { - const key = IMarkerData.makeKey(rawMarker); - const index = markersCountByKey.get(key) || 0; - markersCountByKey.set(key, index + 1); - - const markerId = this.id(resourceMarkersId, key, index); - - let relatedInformation: RelatedInformation[] | undefined = undefined; - if (rawMarker.relatedInformation) { - relatedInformation = rawMarker.relatedInformation.map((r, index) => new RelatedInformation(this.id(markerId, r.resource.toString(), r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn, index), rawMarker, r)); + setResourceMarkers(resourcesMarkers: [URI, IMarker[]][]): void { + const change: MarkerChangesEvent = { added: [], removed: [], updated: [] }; + for (const [resource, rawMarkers] of resourcesMarkers) { + let resourceMarkers = this.resourcesByUri.get(resource.toString()); + if (isFalsyOrEmpty(rawMarkers)) { + if (resourceMarkers) { + this.resourcesByUri.delete(resource.toString()); + change.removed.push(resourceMarkers); } + } else { + const resourceMarkersId = this.id(resource.toString()); + const markersCountByKey = new Map(); + const markers = mergeSort(rawMarkers.map((rawMarker) => { + const key = IMarkerData.makeKey(rawMarker); + const index = markersCountByKey.get(key) || 0; + markersCountByKey.set(key, index + 1); - return new Marker(markerId, rawMarker, relatedInformation); - }), compareMarkers); + const markerId = this.id(resourceMarkersId, key, index); - this.resourcesByUri.set(resource.toString(), new ResourceMarkers(resourceMarkersId, resource, markers)); + let relatedInformation: RelatedInformation[] | undefined = undefined; + if (rawMarker.relatedInformation) { + relatedInformation = rawMarker.relatedInformation.map((r, index) => new RelatedInformation(this.id(markerId, r.resource.toString(), r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn, index), rawMarker, r)); + } + + return new Marker(markerId, rawMarker, relatedInformation); + }), compareMarkers); + + if (resourceMarkers) { + resourceMarkers.markers = markers; + change.updated.push(resourceMarkers); + } else { + resourceMarkers = new ResourceMarkers(resourceMarkersId, resource, markers); + change.added.push(resourceMarkers); + } + this.resourcesByUri.set(resource.toString(), resourceMarkers); + } } this.cachedSortedResources = undefined; - this._onDidChange.fire(resource); + if (change.added.length || change.removed.length || change.updated.length) { + this._onDidChange.fire(change); + } } private id(...values: (string | number)[]): string { diff --git a/src/vs/workbench/contrib/markers/browser/markersPanel.ts b/src/vs/workbench/contrib/markers/browser/markersPanel.ts index 36f1b9bd365..cea80184fe4 100644 --- a/src/vs/workbench/contrib/markers/browser/markersPanel.ts +++ b/src/vs/workbench/contrib/markers/browser/markersPanel.ts @@ -12,7 +12,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Panel } from 'vs/workbench/browser/panel'; import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import Constants from 'vs/workbench/contrib/markers/browser/constants'; -import { Marker, ResourceMarkers, RelatedInformation, MarkersModel } from 'vs/workbench/contrib/markers/browser/markersModel'; +import { Marker, ResourceMarkers, RelatedInformation, MarkersModel, MarkerChangesEvent } from 'vs/workbench/contrib/markers/browser/markersModel'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { MarkersFilterActionViewItem, MarkersFilterAction, IMarkersFilterActionChangeEvent, IMarkerFilterController } from 'vs/workbench/contrib/markers/browser/markersPanelActions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -49,18 +49,19 @@ import { MementoObject } from 'vs/workbench/common/memento'; function createModelIterator(model: MarkersModel): Iterator> { const resourcesIt = Iterator.fromArray(model.resourceMarkers); - return Iterator.map(resourcesIt, m => { - const markersIt = Iterator.fromArray(m.markers); + return Iterator.map(resourcesIt, m => ({ element: m, children: createResourceMarkersIterator(m) })); +} - const children = Iterator.map(markersIt, m => { - const relatedInformationIt = Iterator.from(m.relatedInformation); - const children = Iterator.map(relatedInformationIt, r => ({ element: r })); +function createResourceMarkersIterator(resourceMarkers: ResourceMarkers): Iterator> { + const markersIt = Iterator.fromArray(resourceMarkers.markers); - return { element: m, children }; - }); + return Iterator.map(markersIt, m => { + const relatedInformationIt = Iterator.from(m.relatedInformation); + const children = Iterator.map(relatedInformationIt, r => ({ element: r })); return { element: m, children }; }); + } export class MarkersPanel extends Panel implements IMarkerFilterController { @@ -229,13 +230,26 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { return false; } - private refreshPanel(marker?: Marker): void { + private refreshPanel(markerOrChange?: Marker | MarkerChangesEvent): void { if (this.isVisible()) { this.cachedFilterStats = undefined; - if (marker) { - this.tree.rerender(marker); + if (markerOrChange) { + if (markerOrChange instanceof Marker) { + this.tree.rerender(markerOrChange); + } else { + if (markerOrChange.added.length || markerOrChange.removed.length) { + // Reset complete tree + this.tree.setChildren(null, createModelIterator(this.markersWorkbenchService.markersModel)); + } else { + // Update resource + for (const updated of markerOrChange.updated) { + this.tree.setChildren(updated, createResourceMarkersIterator(updated)); + } + } + } } else { + // Reset complete tree this.tree.setChildren(null, createModelIterator(this.markersWorkbenchService.markersModel)); } @@ -310,6 +324,7 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { }; this.tree = this.instantiationService.createInstance(WorkbenchObjectTree, + 'MarkersPanel', this.treeContainer, virtualDelegate, renderers, @@ -395,29 +410,13 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { } private createListeners(): void { - const onModelOrActiveEditorChanged = Event.debounce(Event.any(this.markersWorkbenchService.markersModel.onDidChange, Event.map(this.editorService.onDidActiveEditorChange, () => true)), (result, e) => { - if (!result) { - result = { - resources: [], - activeEditorChanged: false - }; - } - if (e === true) { - result.activeEditorChanged = true; + this._register(Event.any(this.markersWorkbenchService.markersModel.onDidChange, this.editorService.onDidActiveEditorChange)(changes => { + if (changes) { + this.onDidChangeModel(changes); } else { - result.resources.push(e); - } - return result; - }, 0); - - this._register(onModelOrActiveEditorChanged(({ resources, activeEditorChanged }) => { - if (resources) { - this.onDidChangeModel(resources); - } - if (activeEditorChanged) { this.onActiveEditorChanged(); } - }, this)); + })); this._register(this.tree.onDidChangeSelection(() => this.onSelected())); this._register(this.filterAction.onDidChange((event: IMarkersFilterActionChangeEvent) => { if (event.filterText || event.useFilesExclude) { @@ -427,8 +426,10 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { this.actions.forEach(a => this._register(a)); } - private onDidChangeModel(resources: URI[]) { - for (const resource of resources) { + private onDidChangeModel(change: MarkerChangesEvent) { + const resourceMarkers = [...change.added, ...change.removed, ...change.updated]; + const resources: URI[] = []; + for (const { resource } of resourceMarkers) { this.markersViewModel.remove(resource); const resourceMarkers = this.markersWorkbenchService.markersModel.getResourceMarkers(resource); if (resourceMarkers) { @@ -436,9 +437,10 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { this.markersViewModel.add(marker); } } + resources.push(resource); } this.currentResourceGotAddedToMarkersData = this.currentResourceGotAddedToMarkersData || this.isCurrentResourceGotAddedToMarkersData(resources); - this.refreshPanel(); + this.refreshPanel(change); this.updateRangeHighlights(); if (this.currentResourceGotAddedToMarkersData) { this.autoReveal(); diff --git a/src/vs/workbench/contrib/markers/test/electron-browser/markersModel.test.ts b/src/vs/workbench/contrib/markers/test/electron-browser/markersModel.test.ts index 322c336945c..1cff079b0ae 100644 --- a/src/vs/workbench/contrib/markers/test/electron-browser/markersModel.test.ts +++ b/src/vs/workbench/contrib/markers/test/electron-browser/markersModel.test.ts @@ -20,7 +20,7 @@ class TestMarkersModel extends MarkersModel { const markers = byResource[key]; const resource = markers[0].resource; - this.setResourceMarkers(resource, markers); + this.setResourceMarkers([[resource, markers]]); }); } } diff --git a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts index 90dfc9732bf..55ec4cb5e4b 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts @@ -317,6 +317,7 @@ export class OutlinePanel extends ViewletPanel { this._treeComparator = new OutlineItemComparator(this._outlineViewState.sortBy); this._tree = this._instantiationService.createInstance( WorkbenchDataTree, + 'OutlinePanel', treeContainer, new OutlineVirtualDelegate(), [new OutlineGroupRenderer(), this._treeRenderer], diff --git a/src/vs/workbench/contrib/output/browser/outputPanel.ts b/src/vs/workbench/contrib/output/browser/outputPanel.ts index b63f819dcf6..f1c0b211d32 100644 --- a/src/vs/workbench/contrib/output/browser/outputPanel.ts +++ b/src/vs/workbench/contrib/output/browser/outputPanel.ts @@ -114,8 +114,8 @@ export class OutputPanel extends AbstractTextResourceEditor { return channel ? nls.localize('outputPanelWithInputAriaLabel', "{0}, Output panel", channel.label) : nls.localize('outputPanelAriaLabel', "Output panel"); } - public setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { - this._focus = !options.preserveFocus; + public setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { + this._focus = !(options && options.preserveFocus); if (input.matches(this.input)) { return Promise.resolve(undefined); } diff --git a/src/vs/workbench/contrib/output/browser/outputServices.ts b/src/vs/workbench/contrib/output/browser/outputServices.ts index 6e7141a041b..1a3e692d6e7 100644 --- a/src/vs/workbench/contrib/output/browser/outputServices.ts +++ b/src/vs/workbench/contrib/output/browser/outputServices.ts @@ -59,7 +59,7 @@ class OutputChannel extends Disposable implements IOutputChannel { export class OutputService extends Disposable implements IOutputService, ITextModelContentProvider { - public _serviceBrand: any; + public _serviceBrand: undefined; private channels: Map = new Map(); private activeChannelIdInStorage: string; diff --git a/src/vs/workbench/contrib/output/common/output.ts b/src/vs/workbench/contrib/output/common/output.ts index ab2b6efe73f..75abffaa04d 100644 --- a/src/vs/workbench/contrib/output/common/output.ts +++ b/src/vs/workbench/contrib/output/common/output.ts @@ -62,7 +62,7 @@ export const IOutputService = createDecorator(OUTPUT_SERVICE_ID) * The output service to manage output from the various processes running. */ export interface IOutputService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Given the channel id returns the output channel instance. diff --git a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts index eb7ff5278a6..304a9dbf686 100644 --- a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts @@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co import { IStorageService } from 'vs/platform/storage/common/storage'; import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { Emitter, Event } from 'vs/base/common/event'; +import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions'; const $ = DOM.$; @@ -126,7 +127,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor this.createBody(keybindingsEditorElement); } - setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Promise { + setInput(input: KeybindingsEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { this.keybindingsEditorContextKey.set(true); return super.setInput(input, options, token) .then(() => this.render(!!(options && options.preserveFocus))); @@ -452,7 +453,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor private createList(parent: HTMLElement): void { this.keybindingsListContainer = DOM.append(parent, $('.keybindings-list-container')); - this.keybindingsList = this._register(this.instantiationService.createInstance(WorkbenchList, this.keybindingsListContainer, new Delegate(), [new KeybindingItemRenderer(this, this.instantiationService)], { + this.keybindingsList = this._register(this.instantiationService.createInstance(WorkbenchList, 'KeybindingsEditor', this.keybindingsListContainer, new Delegate(), [new KeybindingItemRenderer(this, this.instantiationService)], { identityProvider: { getId: (e: IListEntry) => e.id }, ariaLabel: localize('keybindingsLabel', "Keybindings"), setRowLineHeight: false, @@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor if (this.input) { const input: KeybindingsEditorInput = this.input as KeybindingsEditorInput; this.keybindingsEditorModel = await input.resolve(); - const editorActionsLabels: Map = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => { - editorActions.set(editorAction.id, editorAction.label); - return editorActions; - }, new Map()); - await this.keybindingsEditorModel.resolve(editorActionsLabels); + await this.keybindingsEditorModel.resolve(this.getActionsLabels()); this.renderKeybindingsEntries(false, preserveFocus); if (input.searchOptions) { this.recordKeysAction.checked = input.searchOptions.recordKeybindings; @@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor } } + private getActionsLabels(): Map { + const actionsLabels: Map = new Map(); + EditorExtensionsRegistry.getEditorActions().forEach(editorAction => actionsLabels.set(editorAction.id, editorAction.label)); + for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) { + if (isIMenuItem(menuItem)) { + const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value; + const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined; + actionsLabels.set(menuItem.command.id, category ? `${category}: ${title}` : title); + } + } + return actionsLabels; + } + private filterKeybindings(): void { this.renderKeybindingsEntries(this.searchWidget.hasFocus()); this.delayedFilterLogging.trigger(() => this.reportFilteringUsed(this.searchWidget.getValue())); @@ -716,7 +726,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor private createCopyCommandAction(keybinding: IKeybindingItemEntry): IAction { return { - label: localize('copyCommandLabel', "Copy Command"), + label: localize('copyCommandLabel', "Copy Command ID"), enabled: true, id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, run: () => this.copyKeybindingCommand(keybinding) diff --git a/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts index 75a9891cb22..d9b7e38db91 100644 --- a/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts @@ -302,14 +302,12 @@ export class KeybindingEditorDecorationsRenderer extends Disposable { private _createDecoration(isError: boolean, uiLabel: string | null, usLabel: string | null, model: ITextModel, keyNode: Node): IModelDeltaDecoration { let msg: MarkdownString; let className: string; - let beforeContentClassName: string; let overviewRulerColor: ThemeColor; if (isError) { // this is the error case msg = new MarkdownString().appendText(NLS_KB_LAYOUT_ERROR_MESSAGE); className = 'keybindingError'; - beforeContentClassName = 'inlineKeybindingError'; overviewRulerColor = themeColorFromId(overviewRulerError); } else { // this is the info case @@ -335,7 +333,6 @@ export class KeybindingEditorDecorationsRenderer extends Disposable { ); } className = 'keybindingInfo'; - beforeContentClassName = 'inlineKeybindingInfo'; overviewRulerColor = themeColorFromId(overviewRulerInfo); } @@ -352,7 +349,6 @@ export class KeybindingEditorDecorationsRenderer extends Disposable { options: { stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, className: className, - beforeContentClassName: beforeContentClassName, hoverMessage: msg, overviewRuler: { color: overviewRulerColor, diff --git a/src/vs/workbench/contrib/preferences/browser/media/keybindings.css b/src/vs/workbench/contrib/preferences/browser/media/keybindings.css index 702a19ed631..e77553529e8 100644 --- a/src/vs/workbench/contrib/preferences/browser/media/keybindings.css +++ b/src/vs/workbench/contrib/preferences/browser/media/keybindings.css @@ -41,24 +41,6 @@ } /* Editor decorations */ -.monaco-editor .inlineKeybindingInfo:before { - margin: 0.2em 0.1em 0 0.1em; - content:" "; - display:inline-block; - height:0.8em; - width:1em; - background-size: 0.9em; -} - -.monaco-editor .inlineKeybindingError:before { - margin: 0.1em 0.1em 0 0.1em; - content:" "; - display:inline-block; - height:0.8em; - width:1em; - background-size: 1em; -} - .monaco-editor .keybindingInfo { box-shadow: inset 0 0 0 1px #B9B9B9; background-color: rgba(100, 100, 250, 0.2); diff --git a/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css index 5e8238fde91..faf363f6a3e 100644 --- a/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css @@ -369,6 +369,10 @@ margin-top: -1px; z-index: 1; } +.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-list .setting-item-contents.invalid-input .setting-item-validation-message { + position: static; + margin-top: 1rem; +} .settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-text .setting-item-validation-message { width: 500px; diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts index cd164f0923d..4e724b3d988 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts @@ -154,7 +154,7 @@ export class PreferencesEditor extends BaseEditor { this.preferencesRenderers.editFocusedPreference(); } - setInput(newInput: EditorInput, options: SettingsEditorOptions, token: CancellationToken): Promise { + setInput(newInput: EditorInput, options: SettingsEditorOptions | undefined, token: CancellationToken): Promise { this.defaultSettingsEditorContextKey.set(true); this.defaultSettingsJSONEditorContextKey.set(true); if (options && options.query) { @@ -202,12 +202,12 @@ export class PreferencesEditor extends BaseEditor { super.clearInput(); } - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { + protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { this.sideBySidePreferencesWidget.setEditorVisible(visible, group); super.setEditorVisible(visible, group); } - private updateInput(newInput: PreferencesEditorInput, options: EditorOptions, token: CancellationToken): Promise { + private updateInput(newInput: PreferencesEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { return this.sideBySidePreferencesWidget.setInput(newInput.details, newInput.master, options, token).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => { if (token.isCancellationRequested) { return; @@ -781,7 +781,7 @@ class SideBySidePreferencesWidget extends Widget { private splitview: SplitView; private isVisible: boolean; - private group: IEditorGroup; + private group: IEditorGroup | undefined; get minimumWidth(): number { return this.splitview.minimumSize; } get maximumWidth(): number { return this.splitview.maximumSize; } @@ -845,7 +845,7 @@ class SideBySidePreferencesWidget extends Widget { this._register(focusTracker.onDidFocus(() => this._onFocus.fire())); } - setInput(defaultPreferencesEditorInput: DefaultPreferencesEditorInput, editablePreferencesEditorInput: EditorInput, options: EditorOptions, token: CancellationToken): Promise<{ defaultPreferencesRenderer?: IPreferencesRenderer, editablePreferencesRenderer?: IPreferencesRenderer }> { + setInput(defaultPreferencesEditorInput: DefaultPreferencesEditorInput, editablePreferencesEditorInput: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<{ defaultPreferencesRenderer?: IPreferencesRenderer, editablePreferencesRenderer?: IPreferencesRenderer }> { this.getOrCreateEditablePreferencesEditor(editablePreferencesEditorInput); this.settingsTargetsWidget.settingsTarget = this.getSettingsTarget(editablePreferencesEditorInput.getResource()!); return Promise.all([ @@ -902,7 +902,7 @@ class SideBySidePreferencesWidget extends Widget { } } - setEditorVisible(visible: boolean, group: IEditorGroup): void { + setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { this.isVisible = visible; this.group = group; @@ -928,7 +928,7 @@ class SideBySidePreferencesWidget extends Widget { return editor; } - private updateInput(editor: BaseEditor, input: EditorInput, editorContributionId: string, associatedPreferencesModelUri: URI, options: EditorOptions, token: CancellationToken): Promise | undefined> { + private updateInput(editor: BaseEditor, input: EditorInput, editorContributionId: string, associatedPreferencesModelUri: URI, options: EditorOptions | undefined, token: CancellationToken): Promise | undefined> { return editor.setInput(input, options, token) .then(() => { if (token.isCancellationRequested) { @@ -1034,7 +1034,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor { return options; } - setInput(input: DefaultPreferencesEditorInput, options: EditorOptions, token: CancellationToken): Promise { + setInput(input: DefaultPreferencesEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { return super.setInput(input, options, token) .then(() => this.input!.resolve() .then(editorModel => { diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts index d8abbb29809..ccede6e64c6 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts @@ -1017,12 +1017,12 @@ class UnsupportedSettingsRenderer extends Disposable { } private handleLocalUserConfiguration(setting: ISetting, configuration: IConfigurationNode, markerData: IMarkerData[]): void { - if (this.workbenchEnvironmentService.configuration.remote && configuration.scope === ConfigurationScope.MACHINE) { + if (this.workbenchEnvironmentService.configuration.remoteAuthority && (configuration.scope === ConfigurationScope.MACHINE || configuration.scope === ConfigurationScope.MACHINE_OVERRIDABLE)) { markerData.push({ severity: MarkerSeverity.Hint, tags: [MarkerTag.Unnecessary], ...setting.range, - message: nls.localize('unsupportedRemoteMachineSetting', "This setting can be applied only in remote machine settings") + message: nls.localize('unsupportedRemoteMachineSetting', "This setting cannot be applied now. It will be applied when you open local window.") }); } } @@ -1076,7 +1076,7 @@ class UnsupportedSettingsRenderer extends Disposable { severity: MarkerSeverity.Hint, tags: [MarkerTag.Unnecessary], ...setting.range, - message: nls.localize('unsupportedMachineSetting', "This setting can be applied only in user settings") + message: nls.localize('unsupportedMachineSetting', "This setting can only be applied in user settings in local window or in remote settings in remote window.") }; } diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts b/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts index 37de5e7766e..a6d0b93b024 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts @@ -33,7 +33,7 @@ export interface IEndpointDetails { } export class PreferencesSearchService extends Disposable implements IPreferencesSearchService { - _serviceBrand: any; + _serviceBrand: undefined; private _installedExtensions: Promise; diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 1382fd0df38..9a49fcd1425 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -207,7 +207,7 @@ export class SettingsEditor2 extends BaseEditor { this.updateStyles(); } - setInput(input: SettingsEditor2Input, options: SettingsEditorOptions | null, token: CancellationToken): Promise { + setInput(input: SettingsEditor2Input, options: SettingsEditorOptions | undefined, token: CancellationToken): Promise { this.inSettingsEditorContextKey.set(true); return super.setInput(input, options, token) .then(() => timeout(0)) // Force setInput to be async @@ -250,7 +250,7 @@ export class SettingsEditor2 extends BaseEditor { } } - setOptions(options: SettingsEditorOptions | null): void { + setOptions(options: SettingsEditorOptions | undefined): void { super.setOptions(options); if (options) { @@ -383,10 +383,10 @@ export class SettingsEditor2 extends BaseEditor { return SettingsEditor2.SUGGESTIONS.filter(tag => query.indexOf(tag) === -1).map(tag => strings.endsWith(tag, ':') ? tag : tag + ' '); } }, searchBoxLabel, 'settingseditor:searchinput' + SettingsEditor2.NUM_INSTANCES++, { - placeholderText: searchBoxLabel, - focusContextKey: this.searchFocusContextKey, - // TODO: Aria-live - }) + placeholderText: searchBoxLabel, + focusContextKey: this.searchFocusContextKey, + // TODO: Aria-live + }) ); this._register(this.searchWidget.onFocus(() => { diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index 82465a22624..05894806680 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -224,8 +224,9 @@ interface ISettingComplexItemTemplate extends ISettingItemTemplate { button: Button; } -interface ISettingListItemTemplate extends ISettingItemTemplate { +interface ISettingListItemTemplate extends ISettingItemTemplate { listWidget: ListSettingWidget; + validationErrorMessageElement: HTMLElement; } interface ISettingExcludeItemTemplate extends ISettingItemTemplate { @@ -679,6 +680,9 @@ export class SettingArrayRenderer extends AbstractSettingRenderer implements ITr renderTemplate(container: HTMLElement): ISettingListItemTemplate { const common = this.renderCommonTemplate(null, container, 'list'); + const descriptionElement = common.containerElement.querySelector('.setting-item-description')!; + const validationErrorMessageElement = $('.setting-item-validation-message'); + descriptionElement.after(validationErrorMessageElement); const listWidget = this._instantiationService.createInstance(ListSettingWidget, common.controlElement); listWidget.domNode.classList.add(AbstractSettingRenderer.CONTROL_CLASS); @@ -686,19 +690,40 @@ export class SettingArrayRenderer extends AbstractSettingRenderer implements ITr const template: ISettingListItemTemplate = { ...common, - listWidget + listWidget, + validationErrorMessageElement }; this.addSettingElementFocusHandler(template); - common.toDispose.push(listWidget.onDidChangeList(e => this.onDidChangeList(template, e))); + common.toDispose.push( + listWidget.onDidChangeList(e => { + const newList = this.computeNewList(template, e); + this.onDidChangeList(template, newList); + if (newList !== null && template.onChange) { + template.onChange(newList); + } + }) + ); return template; } - private onDidChangeList(template: ISettingListItemTemplate, e: IListChangeEvent): void { + private onDidChangeList(template: ISettingListItemTemplate, newList: string[] | undefined | null): void { + if (!template.context || newList === null) { + return; + } + + this._onDidChangeSetting.fire({ + key: template.context.setting.key, + value: newList, + type: template.context.valueType + }); + } + + private computeNewList(template: ISettingListItemTemplate, e: IListChangeEvent): string[] | undefined | null { if (template.context) { - let newValue: any[] = []; + let newValue: string[] = []; if (isArray(template.context.scopeValue)) { newValue = [...template.context.scopeValue]; } else if (isArray(template.context.value)) { @@ -732,29 +757,30 @@ export class SettingArrayRenderer extends AbstractSettingRenderer implements ITr template.context.defaultValue.length === newValue.length && template.context.defaultValue.join() === newValue.join() ) { - return this._onDidChangeSetting.fire({ - key: template.context.setting.key, - value: undefined, // reset setting - type: template.context.valueType - }); + return undefined; } - this._onDidChangeSetting.fire({ - key: template.context.setting.key, - value: newValue, - type: template.context.valueType - }); + return newValue; } + + return undefined; } renderElement(element: ITreeNode, index: number, templateData: ISettingListItemTemplate): void { super.renderSettingElement(element, index, templateData); } - protected renderValue(dataElement: SettingsTreeSettingElement, template: ISettingListItemTemplate, onChange: (value: string) => void): void { + protected renderValue(dataElement: SettingsTreeSettingElement, template: ISettingListItemTemplate, onChange: (value: string[] | undefined) => void): void { const value = getListDisplayValue(dataElement); template.listWidget.setValue(value); template.context = dataElement; + + template.onChange = (v) => { + onChange(v); + renderArrayValidations(dataElement, template, v, false); + }; + + renderArrayValidations(dataElement, template, value.map(v => v.value), true); } } @@ -1237,6 +1263,29 @@ function renderValidations(dataElement: SettingsTreeSettingElement, template: IS DOM.removeClass(template.containerElement, 'invalid-input'); } +function renderArrayValidations( + dataElement: SettingsTreeSettingElement, + template: ISettingListItemTemplate, + value: string[] | undefined, + calledOnStartup: boolean +) { + DOM.addClass(template.containerElement, 'invalid-input'); + if (dataElement.setting.validator) { + const errMsg = dataElement.setting.validator(value); + if (errMsg && errMsg !== '') { + DOM.addClass(template.containerElement, 'invalid-input'); + template.validationErrorMessageElement.innerText = errMsg; + const validationError = localize('validationError', "Validation Error."); + template.containerElement.setAttribute('aria-label', [dataElement.setting.key, validationError, errMsg].join(' ')); + if (!calledOnStartup) { ariaAlert(validationError + ' ' + errMsg); } + return; + } else { + template.containerElement.setAttribute('aria-label', dataElement.setting.key); + DOM.removeClass(template.containerElement, 'invalid-input'); + } + } +} + function cleanRenderedMarkdown(element: Node): void { for (let i = 0; i < element.childNodes.length; i++) { const child = element.childNodes.item(i); @@ -1420,7 +1469,7 @@ export class SettingsTree extends ObjectTree { ) { const treeClass = 'settings-editor-tree'; - super(container, + super('SettingsTree', container, new SettingsTreeDelegate(), renderers, { @@ -1507,8 +1556,8 @@ export class SettingsTree extends ObjectTree { })); } - protected createModel(view: ISpliceable>, options: IObjectTreeOptions): ITreeModel { - return new NonCollapsibleObjectTreeModel(view, options); + protected createModel(user: string, view: ISpliceable>, options: IObjectTreeOptions): ITreeModel { + return new NonCollapsibleObjectTreeModel(user, view, options); } } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts index 6a2fbad2b88..a52e919c7bf 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts @@ -457,6 +457,7 @@ export class ListSettingWidget extends Disposable { onSubmit(false); e.preventDefault(); } + rowElement.focus(); }; const valueInput = new InputBox(rowElement, this.contextViewService, { diff --git a/src/vs/workbench/contrib/preferences/browser/tocTree.ts b/src/vs/workbench/contrib/preferences/browser/tocTree.ts index 5c057d629c4..6a4df8af7d0 100644 --- a/src/vs/workbench/contrib/preferences/browser/tocTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/tocTree.ts @@ -204,7 +204,7 @@ export class TOCTree extends ObjectTree { collapseByDefault: true }; - super(container, + super('SettingsTOC', container, new TOCTreeDelegate(), [new TOCRenderer()], options); diff --git a/src/vs/workbench/contrib/preferences/common/preferences.ts b/src/vs/workbench/contrib/preferences/common/preferences.ts index 98fd156537b..c9901f5f4eb 100644 --- a/src/vs/workbench/contrib/preferences/common/preferences.ts +++ b/src/vs/workbench/contrib/preferences/common/preferences.ts @@ -33,7 +33,7 @@ export interface IEndpointDetails { export const IPreferencesSearchService = createDecorator('preferencesSearchService'); export interface IPreferencesSearchService { - _serviceBrand: any; + _serviceBrand: undefined; getLocalSearchProvider(filter: string): ISearchProvider; getRemoteSearchProvider(filter: string, newExtensionsOnly?: boolean): ISearchProvider | undefined; diff --git a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts index 6e7f43ffcfa..cde13f2ab32 100644 --- a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts +++ b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts @@ -26,7 +26,7 @@ import { FOLDER_SETTINGS_PATH, IPreferencesService, USE_SPLIT_JSON_SETTING } fro const schemaRegistry = Registry.as(JSONContributionRegistry.Extensions.JSONContribution); export class PreferencesContribution implements IWorkbenchContribution { - private editorOpeningListener: IDisposable; + private editorOpeningListener: IDisposable | undefined; private settingsListener: IDisposable; constructor( diff --git a/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts b/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts index 3aa5697ed25..9bfb056d4ed 100644 --- a/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts @@ -62,7 +62,7 @@ class CommandsHistory extends Disposable { private static readonly PREF_KEY_CACHE = 'commandPalette.mru.cache'; private static readonly PREF_KEY_COUNTER = 'commandPalette.mru.counter'; - private commandHistoryLength: number; + private commandHistoryLength!: number; constructor( @IStorageService private readonly storageService: IStorageService, @@ -217,8 +217,8 @@ class CommandPaletteEditorAction extends EditorAction { } abstract class BaseCommandEntry extends QuickOpenEntryGroup { - private description: string; - private alias: string; + private description: string | undefined; + private alias: string | undefined; private labelLowercase: string; private readonly keybindingAriaLabel?: string; @@ -258,7 +258,7 @@ abstract class BaseCommandEntry extends QuickOpenEntryGroup { return this.labelLowercase; } - getDescription(): string { + getDescription(): string | undefined { return this.description; } @@ -270,7 +270,7 @@ abstract class BaseCommandEntry extends QuickOpenEntryGroup { return this.keybinding; } - getDetail(): string { + getDetail(): string | undefined { return this.alias; } @@ -381,13 +381,13 @@ export class CommandsHandler extends QuickOpenHandler implements IDisposable { static readonly ID = 'workbench.picker.commands'; - private commandHistoryEnabled: boolean; + private commandHistoryEnabled: boolean | undefined; private readonly commandsHistory: CommandsHistory; private readonly disposables = new DisposableStore(); private readonly disposeOnClose = new DisposableStore(); - private waitedForExtensionsRegistered: boolean; + private waitedForExtensionsRegistered: boolean | undefined; constructor( @IEditorService private readonly editorService: IEditorService, diff --git a/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts b/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts index 19e76cbf3b7..3dcbb07c16c 100644 --- a/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts @@ -87,8 +87,10 @@ class GotoLineEntry extends EditorQuickOpenEntry { private parseInput(line: string) { const numbers = line.split(/,|:|#/).map(part => parseInt(part, 10)).filter(part => !isNaN(part)); - this.line = numbers[0]; + const endLine = this.getMaxLineNumber() + 1; + this.column = numbers[1]; + this.line = numbers[0] > 0 ? numbers[0] : endLine + numbers[0]; } getLabel(): string { @@ -113,7 +115,7 @@ class GotoLineEntry extends EditorQuickOpenEntry { } private invalidRange(maxLineNumber: number = this.getMaxLineNumber()): boolean { - return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber); + return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber) || this.line < 0; } private getMaxLineNumber(): number { diff --git a/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts index eef3c303d6c..85362cb1aa9 100644 --- a/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts @@ -16,15 +16,15 @@ import { IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecorati import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen'; -import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind } from 'vs/editor/common/modes'; -import { IRange } from 'vs/editor/common/core/range'; +import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind, SymbolTag } from 'vs/editor/common/modes'; +import { IRange, Range } from 'vs/editor/common/core/range'; import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry'; import { GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor'; import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { asPromise } from 'vs/base/common/async'; import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; +import { IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; export const GOTO_SYMBOL_PREFIX = '@'; export const SCOPE_PREFIX = ':'; @@ -73,10 +73,8 @@ class OutlineModel extends QuickOpenModel { applyFilter(searchValue: string): void { // Normalize search - let normalizedSearchValue = searchValue; - if (searchValue.indexOf(SCOPE_PREFIX) === 0) { - normalizedSearchValue = normalizedSearchValue.substr(SCOPE_PREFIX.length); - } + const searchValueLow = searchValue.toLowerCase(); + const searchValuePos = searchValue.indexOf(SCOPE_PREFIX) === 0 ? 1 : 0; // Check for match and update visibility and group label this.entries.forEach((entry: SymbolEntry) => { @@ -84,34 +82,24 @@ class OutlineModel extends QuickOpenModel { // Clear all state first entry.setGroupLabel(undefined); entry.setShowBorder(false); - entry.setHighlights([]); + entry.setScore(undefined); entry.setHidden(false); // Filter by search - if (normalizedSearchValue) { - const highlights = filters.matchesFuzzy2(normalizedSearchValue, entry.getLabel()); - if (highlights) { - entry.setHighlights(highlights); - entry.setHidden(false); - } else if (!entry.isHidden()) { - entry.setHidden(true); - } + if (searchValue.length > searchValuePos) { + const score = filters.fuzzyScore( + searchValue, searchValueLow, searchValuePos, + entry.getLabel(), entry.getLabel().toLowerCase(), 0, + true + ); + entry.setScore(score); + entry.setHidden(!score); } }); - // Sort properly if actually searching - if (searchValue) { - if (searchValue.indexOf(SCOPE_PREFIX) === 0) { - this.entries.sort(this.sortScoped.bind(this, searchValue.toLowerCase())); - } else { - this.entries.sort(this.sortNormal.bind(this, searchValue.toLowerCase())); - } - } + this.entries.sort(SymbolEntry.compareByRank); + - // Otherwise restore order as appearing in outline - else { - this.entries.sort((a: SymbolEntry, b: SymbolEntry) => a.getIndex() - b.getIndex()); - } // Mark all type groups const visibleResults = this.getEntries(true); @@ -156,74 +144,6 @@ class OutlineModel extends QuickOpenModel { } } - private sortNormal(searchValue: string, elementA: SymbolEntry, elementB: SymbolEntry): number { - - // Handle hidden elements - if (elementA.isHidden() && elementB.isHidden()) { - return 0; - } else if (elementA.isHidden()) { - return 1; - } else if (elementB.isHidden()) { - return -1; - } - - const elementAName = elementA.getLabel().toLowerCase(); - const elementBName = elementB.getLabel().toLowerCase(); - - // Compare by name - const r = elementAName.localeCompare(elementBName); - if (r !== 0) { - return r; - } - - // If name identical sort by range instead - const elementARange = elementA.getRange(); - const elementBRange = elementB.getRange(); - - return elementARange.startLineNumber - elementBRange.startLineNumber; - } - - private sortScoped(searchValue: string, elementA: SymbolEntry, elementB: SymbolEntry): number { - - // Handle hidden elements - if (elementA.isHidden() && elementB.isHidden()) { - return 0; - } else if (elementA.isHidden()) { - return 1; - } else if (elementB.isHidden()) { - return -1; - } - - // Remove scope char - searchValue = searchValue.substr(SCOPE_PREFIX.length); - - // Sort by type first if scoped search - const elementATypeLabel = NLS_SYMBOL_KIND_CACHE[elementA.getKind()] || FALLBACK_NLS_SYMBOL_KIND; - const elementBTypeLabel = NLS_SYMBOL_KIND_CACHE[elementB.getKind()] || FALLBACK_NLS_SYMBOL_KIND; - let r = elementATypeLabel.localeCompare(elementBTypeLabel); - if (r !== 0) { - return r; - } - - // Special sort when searching in scoped mode - if (searchValue) { - const elementAName = elementA.getLabel().toLowerCase(); - const elementBName = elementB.getLabel().toLowerCase(); - - // Compare by name - r = elementAName.localeCompare(elementBName); - if (r !== 0) { - return r; - } - } - - // Default to sort by range - const elementARange = elementA.getRange(); - const elementBRange = elementB.getRange(); - - return elementARange.startLineNumber - elementBRange.startLineNumber; - } - private renderGroupLabel(type: SymbolKind, count: number): string { let pattern = NLS_SYMBOL_KIND_CACHE[type]; if (!pattern) { @@ -235,33 +155,26 @@ class OutlineModel extends QuickOpenModel { } class SymbolEntry extends EditorQuickOpenEntryGroup { - private editorService: IEditorService; - private index: number; - private name: string; - private kind: SymbolKind; - private icon: string; - private description: string; - private range: IRange; - private revealRange: IRange; - private handler: GotoSymbolHandler; - constructor(index: number, name: string, kind: SymbolKind, description: string, icon: string, range: IRange, revealRange: IRange, highlights: IHighlight[], editorService: IEditorService, handler: GotoSymbolHandler) { + private score?: filters.FuzzyScore; + + constructor( + private readonly index: number, + private readonly name: string, + private readonly kind: SymbolKind, + private readonly description: string, + private readonly icon: string, + private readonly deprecated: boolean, + private readonly range: IRange, + private readonly revealRange: IRange, + private readonly editorService: IEditorService, + private readonly handler: GotoSymbolHandler + ) { super(); - - this.index = index; - this.name = name; - this.kind = kind; - this.icon = icon; - this.description = description; - this.range = range; - this.revealRange = revealRange || range; - this.setHighlights(highlights); - this.editorService = editorService; - this.handler = handler; } - getIndex(): number { - return this.index; + setScore(score: filters.FuzzyScore | undefined): void { + this.score = score; } getLabel(): string { @@ -276,6 +189,18 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { return this.icon; } + getLabelOptions(): IIconLabelValueOptions | undefined { + return this.deprecated ? { extraClasses: ['deprecated'] } : undefined; + } + + getHighlights(): [IHighlight[], IHighlight[] | undefined, IHighlight[] | undefined] { + return [ + this.deprecated ? [] : filters.createMatches(this.score), + undefined, + undefined + ]; + } + getDescription(): string { return this.description; } @@ -294,7 +219,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { getOptions(pinned?: boolean): ITextEditorOptions { return { - selection: this.toSelection(), + selection: Range.collapseToStart(this.revealRange), pinned }; } @@ -317,7 +242,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { // Apply selection and focus else { - const range = this.toSelection(); + const range = Range.collapseToStart(this.revealRange); const activeTextEditorWidget = this.editorService.activeTextEditorWidget; if (activeTextEditorWidget) { activeTextEditorWidget.setSelection(range); @@ -331,7 +256,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { private runPreview(): boolean { // Select Outline Position - const range = this.toSelection(); + const range = Range.collapseToStart(this.revealRange); const activeTextEditorWidget = this.editorService.activeTextEditorWidget; if (activeTextEditorWidget) { activeTextEditorWidget.revealRangeInCenter(range, ScrollType.Smooth); @@ -345,13 +270,36 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { return false; } - private toSelection(): IRange { - return { - startLineNumber: this.revealRange.startLineNumber, - startColumn: this.revealRange.startColumn || 1, - endLineNumber: this.revealRange.startLineNumber, - endColumn: this.revealRange.startColumn || 1 - }; + static compareByRank(a: SymbolEntry, b: SymbolEntry): number { + if (!a.score && b.score) { + return 1; + } else if (a.score && !b.score) { + return -1; + } + if (a.score && b.score) { + if (a.score[0] > b.score[0]) { + return -1; + } else if (a.score[0] < b.score[0]) { + return 1; + } + } + if (a.index < b.index) { + return -1; + } else if (a.index > b.index) { + return 1; + } + return 0; + } + + static compareByKindAndRank(a: SymbolEntry, b: SymbolEntry): number { + // Sort by type first if scoped search + const kindA = NLS_SYMBOL_KIND_CACHE[a.getKind()] || FALLBACK_NLS_SYMBOL_KIND; + const kindB = NLS_SYMBOL_KIND_CACHE[b.getKind()] || FALLBACK_NLS_SYMBOL_KIND; + let r = kindA.localeCompare(kindB); + if (r === 0) { + r = this.compareByRank(a, b); + } + return r; } } @@ -466,11 +414,11 @@ export class GotoSymbolHandler extends QuickOpenHandler { }; } - private toQuickOpenEntries(flattened: DocumentSymbol[]): SymbolEntry[] { + private toQuickOpenEntries(symbols: DocumentSymbol[]): SymbolEntry[] { const results: SymbolEntry[] = []; - for (let i = 0; i < flattened.length; i++) { - const element = flattened[i]; + for (let i = 0; i < symbols.length; i++) { + const element = symbols[i]; const label = strings.trim(element.name); // Show parent scope as description @@ -479,8 +427,8 @@ export class GotoSymbolHandler extends QuickOpenHandler { // Add results.push(new SymbolEntry(i, - label, element.kind, description, `symbol-icon ${icon}`, - element.range, element.selectionRange, [], this.editorService, this + label, element.kind, description, `symbol-icon ${icon}`, element.tags && element.tags.indexOf(SymbolTag.Deprecated) >= 0, + element.range, element.selectionRange, this.editorService, this )); } @@ -504,7 +452,7 @@ export class GotoSymbolHandler extends QuickOpenHandler { } if (model && types.isFunction((model).getLanguageIdentifier)) { - const entries = await asPromise(() => getDocumentSymbols(model, true, this.pendingOutlineRequest!.token)); + const entries = await getDocumentSymbols(model, true, this.pendingOutlineRequest!.token); return new OutlineModel(this.toQuickOpenEntries(entries)); } diff --git a/src/vs/workbench/contrib/relauncher/common/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/common/relauncher.contribution.ts index 2ec3089894f..d691ca646e3 100644 --- a/src/vs/workbench/contrib/relauncher/common/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/common/relauncher.contribution.ts @@ -29,15 +29,15 @@ interface IConfiguration extends IWindowsConfiguration { export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution { - private titleBarStyle: 'native' | 'custom'; - private nativeTabs: boolean; - private nativeFullScreen: boolean; - private clickThroughInactive: boolean; - private updateMode: string; - private enableCrashReporter: boolean; - private treeHorizontalScrolling: boolean; - private useGridLayout: boolean; - private debugConsoleWordWrap: boolean; + private titleBarStyle: 'native' | 'custom' | undefined; + private nativeTabs: boolean | undefined; + private nativeFullScreen: boolean | undefined; + private clickThroughInactive: boolean | undefined; + private updateMode: string | undefined; + private enableCrashReporter: boolean | undefined; + private treeHorizontalScrolling: boolean | undefined; + private useGridLayout: boolean | undefined; + private debugConsoleWordWrap: boolean | undefined; constructor( @IWindowsService private readonly windowsService: IWindowsService, diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index eb7bc581f9d..6d3e2d53b4c 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -33,7 +33,11 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions' import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet'; +import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction } from 'vs/workbench/browser/viewlet'; +import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions'; +import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; interface HelpInformation { extensionDescription: IExtensionDescription; @@ -311,6 +315,7 @@ class HelpPanel extends ViewletPanel { container.appendChild(treeContainer); this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, + 'RemoteHelp', treeContainer, new HelpTreeVirtualDelegate(), [new HelpTreeRenderer()], @@ -421,3 +426,22 @@ Registry.as(ViewletExtensions.Viewlets).registerViewlet(new Vie 'remote', 4 )); + +class OpenRemoteViewletAction extends ShowViewletAction { + + static readonly ID = VIEWLET_ID; + static LABEL = nls.localize('toggleRemoteViewlet', "Show Remote Explorer"); + + constructor(id: string, label: string, @IViewletService viewletService: IViewletService, @IEditorGroupsService editorGroupService: IEditorGroupsService, @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService) { + super(id, label, VIEWLET_ID, viewletService, editorGroupService, layoutService); + } +} + +// Register Action to Open Viewlet +Registry.as(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction( + new SyncActionDescriptor(OpenRemoteViewletAction, VIEWLET_ID, nls.localize('toggleRemoteViewlet', "Show Remote Explorer"), { + primary: 0 + }), + 'View: Show Remote Explorer', + nls.localize('view', "View") +); diff --git a/src/vs/workbench/contrib/remote/common/remote.contribution.ts b/src/vs/workbench/contrib/remote/common/remote.contribution.ts index 124fbfdbc9f..404f5a2a78d 100644 --- a/src/vs/workbench/contrib/remote/common/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/common/remote.contribution.ts @@ -7,8 +7,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as import { Registry } from 'vs/platform/registry/common/platform'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ILabelService } from 'vs/platform/label/common/label'; -import { isWeb, OperatingSystem } from 'vs/base/common/platform'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { OperatingSystem } from 'vs/base/common/platform'; import { Schemas } from 'vs/base/common/network'; import { IRemoteAgentService, RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService'; import { ILogService } from 'vs/platform/log/common/log'; @@ -49,28 +48,24 @@ export const VIEW_CONTAINER: ViewContainer = Registry.as { - if (remoteEnvironment) { - this.labelService.registerFormatter({ - scheme: Schemas.vscodeRemote, - authority: this.environmentService.configuration.remoteAuthority, - formatting: { - label: '${path}', - separator: remoteEnvironment.os === OperatingSystem.Windows ? '\\' : '/', - tildify: remoteEnvironment.os !== OperatingSystem.Windows, - normalizeDriveLetter: remoteEnvironment.os === OperatingSystem.Windows - } - }); - } - }); - } + this.remoteAgentService.getEnvironment().then(remoteEnvironment => { + if (remoteEnvironment) { + this.labelService.registerFormatter({ + scheme: Schemas.vscodeRemote, + formatting: { + label: '${path}', + separator: remoteEnvironment.os === OperatingSystem.Windows ? '\\' : '/', + tildify: remoteEnvironment.os !== OperatingSystem.Windows, + normalizeDriveLetter: remoteEnvironment.os === OperatingSystem.Windows + } + }); + } + }); } } diff --git a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts index 00e601638ec..857e42cd54c 100644 --- a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts @@ -30,7 +30,7 @@ import { ipcRenderer as ipc } from 'electron'; import { IDiagnosticInfoOptions, IRemoteDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IProgressService, IProgress, IProgressStep, ProgressLocation } from 'vs/platform/progress/common/progress'; -import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; +import { PersistentConnectionEventType, ReconnectionWaitEvent } from 'vs/platform/remote/common/remoteAgentConnection'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import Severity from 'vs/base/common/severity'; @@ -309,46 +309,111 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution { @IRemoteAgentService remoteAgentService: IRemoteAgentService, @IProgressService progressService: IProgressService, @IDialogService dialogService: IDialogService, - @ICommandService commandService: ICommandService + @ICommandService commandService: ICommandService, + @IContextKeyService contextKeyService: IContextKeyService ) { const connection = remoteAgentService.getConnection(); if (connection) { let currentProgressPromiseResolve: (() => void) | null = null; let progressReporter: ProgressReporter | null = null; + let lastLocation: ProgressLocation | null = null; let currentTimer: ReconnectionTimer | null = null; + let reconnectWaitEvent: ReconnectionWaitEvent | null = null; + let disposableListener: IDisposable | null = null; + + function showProgress(location: ProgressLocation, buttons?: string[]) { + if (currentProgressPromiseResolve) { + currentProgressPromiseResolve(); + } + + const promise = new Promise((resolve) => currentProgressPromiseResolve = resolve); + lastLocation = location; + + if (location === ProgressLocation.Dialog) { + // Show dialog + progressService!.withProgress( + { location: ProgressLocation.Dialog, buttons }, + (progress) => { if (progressReporter) { progressReporter.currentProgress = progress; } return promise; }, + (choice?) => { + // Handle choice from dialog + if (choice === 0 && buttons && reconnectWaitEvent) { + reconnectWaitEvent.skipWait(); + } else { + showProgress(ProgressLocation.Notification, buttons); + } + + progressReporter!.report(); + }); + } else { + // Show notification + progressService!.withProgress( + { location: ProgressLocation.Notification, buttons }, + (progress) => { if (progressReporter) { progressReporter.currentProgress = progress; } return promise; }, + (choice?) => { + // Handle choice from notification + if (choice === 0 && buttons && reconnectWaitEvent) { + reconnectWaitEvent.skipWait(); + } else { + hideProgress(); + } + }); + } + } + + function hideProgress() { + if (currentProgressPromiseResolve) { + currentProgressPromiseResolve(); + } + + currentProgressPromiseResolve = null; + } connection.onDidStateChange((e) => { if (currentTimer) { currentTimer.dispose(); currentTimer = null; } + + if (disposableListener) { + disposableListener.dispose(); + disposableListener = null; + } switch (e.type) { case PersistentConnectionEventType.ConnectionLost: if (!currentProgressPromiseResolve) { - let promise = new Promise((resolve) => currentProgressPromiseResolve = resolve); - progressService!.withProgress( - { location: ProgressLocation.Dialog }, - (progress: IProgress | null) => { progressReporter = new ProgressReporter(progress!); return promise; }, - () => { - currentProgressPromiseResolve!(); - promise = new Promise((resolve) => currentProgressPromiseResolve = resolve); - progressService!.withProgress({ location: ProgressLocation.Notification }, (progress) => { if (progressReporter) { progressReporter.currentProgress = progress; } return promise; }); - progressReporter!.report(); - } - ); + progressReporter = new ProgressReporter(null); + showProgress(ProgressLocation.Dialog, [nls.localize('reconnectNow', "Reconnect Now")]); } progressReporter!.report(nls.localize('connectionLost', "Connection Lost")); break; case PersistentConnectionEventType.ReconnectionWait: + hideProgress(); + reconnectWaitEvent = e; + showProgress(lastLocation || ProgressLocation.Notification, [nls.localize('reconnectNow', "Reconnect Now")]); currentTimer = new ReconnectionTimer(progressReporter!, Date.now() + 1000 * e.durationSeconds); break; case PersistentConnectionEventType.ReconnectionRunning: + hideProgress(); + showProgress(lastLocation || ProgressLocation.Notification); progressReporter!.report(nls.localize('reconnectionRunning', "Attempting to reconnect...")); + + // Register to listen for quick input is opened + disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => { + const reconnectInteraction = new Set(['inQuickOpen']); + if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) { + // Need to move from dialog if being shown and user needs to type in a prompt + if (lastLocation === ProgressLocation.Dialog && progressReporter !== null) { + hideProgress(); + showProgress(ProgressLocation.Notification); + progressReporter.report(); + } + } + }); + break; case PersistentConnectionEventType.ReconnectionPermanentFailure: - currentProgressPromiseResolve!(); - currentProgressPromiseResolve = null; + hideProgress(); progressReporter = null; dialogService.show(Severity.Error, nls.localize('reconnectionPermanentFailure', "Cannot reconnect. Please reload the window."), [nls.localize('reloadWindow', "Reload Window"), nls.localize('cancel', "Cancel")], { cancelId: 1 }).then(choice => { @@ -359,8 +424,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution { }); break; case PersistentConnectionEventType.ConnectionGain: - currentProgressPromiseResolve!(); - currentProgressPromiseResolve = null; + hideProgress(); progressReporter = null; break; } diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts index 3534ef147df..dfad93af11f 100644 --- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts +++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts @@ -5,7 +5,58 @@ import { URI } from 'vs/base/common/uri'; -//https://stackoverflow.com/questions/56356655/structuring-a-typescript-project-with-workers/56374158#56374158 +//#region --- lib.webworker.d.ts madness --- + +interface ExtendableEvent extends Event { + waitUntil(f: any): void; +} + +interface FetchEvent extends ExtendableEvent { + readonly clientId: string; + readonly preloadResponse: Promise; + readonly replacesClientId: string; + readonly request: Request; + readonly resultingClientId: string; + respondWith(r: Response | Promise): void; +} +interface ExtendableMessageEvent extends ExtendableEvent { + readonly data: any; + readonly lastEventId: string; + readonly origin: string; + readonly ports: ReadonlyArray; + readonly source: ServiceWorker | MessagePort | null; +} + +interface ServiceWorkerGlobalScopeEventMap { + 'activate': ExtendableEvent; + 'fetch': FetchEvent; + 'install': ExtendableEvent; + 'message': ExtendableMessageEvent; + 'messageerror': MessageEvent; +} + +interface Clients { + claim(): Promise; + get(id: string): Promise; +} + +interface ServiceWorkerGlobalScope { + readonly clients: Clients; + onactivate: ((this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any) | null; + onfetch: ((this: ServiceWorkerGlobalScope, ev: FetchEvent) => any) | null; + oninstall: ((this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any) | null; + onmessage: ((this: ServiceWorkerGlobalScope, ev: ExtendableMessageEvent) => any) | null; + onmessageerror: ((this: ServiceWorkerGlobalScope, ev: MessageEvent) => any) | null; + readonly registration: ServiceWorkerRegistration; + skipWaiting(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +//#endregion + declare var self: ServiceWorkerGlobalScope; //#region --- installing/activating diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts index 326dfb49eea..935753f002d 100644 --- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts +++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts @@ -7,14 +7,11 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ILogService } from 'vs/platform/log/common/log'; -import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; class ResourceServiceWorker { private static _url = require.toUrl('./resourceServiceWorkerMain.js'); - private readonly _disposables = new DisposableStore(); - constructor( @ILogService private readonly _logService: ILogService, ) { @@ -27,18 +24,8 @@ class ResourceServiceWorker { this._logService.error('SW#init', err); }); - const handler = (e: ExtendableMessageEvent) => this._handleMessage(e); - navigator.serviceWorker.addEventListener('message', handler); - this._disposables.add(toDisposable(() => navigator.serviceWorker.removeEventListener('message', handler))); } - dispose(): void { - this._disposables.dispose(); - } - - private _handleMessage(event: ExtendableMessageEvent): void { - this._logService.trace('SW', event.data); - } } Registry.as(Extensions.Workbench).registerWorkbenchContribution( diff --git a/src/vs/workbench/contrib/scm/browser/scmViewlet.ts b/src/vs/workbench/contrib/scm/browser/scmViewlet.ts index 30ef53951d0..6c1b3ed6182 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewlet.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewlet.ts @@ -20,7 +20,7 @@ import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKeyService, ContextKeyExpr, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { MenuItemAction, IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'; @@ -243,7 +243,7 @@ export class MainPanel extends ViewletPanel { const renderer = this.instantiationService.createInstance(ProviderRenderer); const identityProvider = { getId: (r: ISCMRepository) => r.provider.id }; - this.list = this.instantiationService.createInstance(WorkbenchList, container, delegate, [renderer], { + this.list = this.instantiationService.createInstance(WorkbenchList, `SCM Main`, container, delegate, [renderer], { identityProvider, horizontalScrolling: false }); @@ -848,7 +848,7 @@ export class RepositoryPanel extends ViewletPanel { new ResourceRenderer(this.listLabels, actionViewItemProvider, () => this.getSelectedResources(), this.themeService, this.menus) ]; - this.list = this.instantiationService.createInstance(WorkbenchList, this.listContainer, delegate, renderers, { + this.list = this.instantiationService.createInstance(WorkbenchList, `SCM Repo`, this.listContainer, delegate, renderers, { identityProvider: scmResourceIdentityProvider, keyboardNavigationLabelProvider: scmKeyboardNavigationLabelProvider, horizontalScrolling: false @@ -1030,9 +1030,10 @@ class MainPanelDescriptor implements IViewDescriptor { readonly name = MainPanel.TITLE; readonly ctorDescriptor: { ctor: any, arguments?: any[] }; readonly canToggleVisibility = true; - readonly hideByDefault = true; + readonly hideByDefault = false; readonly order = -1000; readonly workspace = true; + readonly when = ContextKeyExpr.or(ContextKeyExpr.equals('config.scm.alwaysShowProviders', true), ContextKeyExpr.and(ContextKeyExpr.notEquals('scm.providerCount', 0), ContextKeyExpr.notEquals('scm.providerCount', 1))); constructor(viewModel: IViewModel) { this.ctorDescriptor = { ctor: MainPanel, arguments: [viewModel] }; @@ -1043,13 +1044,12 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { private static readonly STATE_KEY = 'workbench.scm.views.state'; - private repositoryCount = 0; private el: HTMLElement; private message: HTMLElement; private menus: SCMMenus; private _repositories: ISCMRepository[] = []; - private mainPanelDescriptor = new MainPanelDescriptor(this); + private repositoryCountKey: IContextKey; private viewDescriptors: RepositoryViewDescriptor[] = []; private _onDidSplice = new Emitter>(); @@ -1072,40 +1072,6 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { return Event.map(modificationEvent, () => this.visibleRepositories); } - setVisibleRepositories(repositories: ISCMRepository[]): void { - const visibleViewDescriptors = this.viewsModel.visibleViewDescriptors; - - const toSetVisible = this.viewsModel.viewDescriptors - .filter((d): d is RepositoryViewDescriptor => d instanceof RepositoryViewDescriptor && repositories.indexOf(d.repository) > -1 && visibleViewDescriptors.indexOf(d) === -1); - - const toSetInvisible = visibleViewDescriptors - .filter((d): d is RepositoryViewDescriptor => d instanceof RepositoryViewDescriptor && repositories.indexOf(d.repository) === -1); - - let size: number | undefined; - const oneToOne = toSetVisible.length === 1 && toSetInvisible.length === 1; - - for (const viewDescriptor of toSetInvisible) { - if (oneToOne) { - const panel = this.panels.filter(panel => panel.id === viewDescriptor.id)[0]; - - if (panel) { - size = this.getPanelSize(panel); - } - } - - viewDescriptor.repository.setSelected(false); - this.viewsModel.setVisible(viewDescriptor.id, false); - } - - for (const viewDescriptor of toSetVisible) { - viewDescriptor.repository.setSelected(true); - this.viewsModel.setVisible(viewDescriptor.id, true, size); - } - } - - private readonly _onDidChangeRepositories = new Emitter(); - private readonly onDidFinishStartup = Event.once(Event.debounce(this._onDidChangeRepositories.event, () => null, 1000)); - constructor( @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, @ITelemetryService telemetryService: ITelemetryService, @@ -1121,6 +1087,7 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { @IConfigurationService configurationService: IConfigurationService, @IExtensionService extensionService: IExtensionService, @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IContextKeyService contextKeyService: IContextKeyService, ) { super(VIEWLET_ID, SCMViewlet.STATE_KEY, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); @@ -1129,13 +1096,16 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { this.message = $('.empty-message', { tabIndex: 0 }, localize('no open repo', "No source control providers registered.")); + const viewsRegistry = Registry.as(Extensions.ViewsRegistry); + viewsRegistry.registerViews([new MainPanelDescriptor(this)], VIEW_CONTAINER); + this._register(configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration('scm.alwaysShowProviders')) { - this.onDidChangeRepositories(); + if (e.affectsConfiguration('scm.alwaysShowProviders') && configurationService.getValue('scm.alwaysShowProviders')) { + this.viewsModel.setVisible(MainPanel.ID, true); } })); - this._register(this.onDidFinishStartup(this.onAfterStartup, this)); + this.repositoryCountKey = contextKeyService.createKey('scm.providerCount', 0); this._register(this.viewsModel.onDidRemove(this.onDidHideView, this)); } @@ -1185,44 +1155,20 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { private onDidChangeRepositories(): void { const repositoryCount = this.repositories.length; - - const viewsRegistry = Registry.as(Extensions.ViewsRegistry); - if (this.repositoryCount === 0 && repositoryCount !== 0) { - viewsRegistry.registerViews([this.mainPanelDescriptor], VIEW_CONTAINER); - } else if (this.repositoryCount !== 0 && repositoryCount === 0) { - viewsRegistry.deregisterViews([this.mainPanelDescriptor], VIEW_CONTAINER); - } - - const alwaysShowProviders = this.configurationService.getValue('scm.alwaysShowProviders') || false; - - if (alwaysShowProviders && repositoryCount > 0) { - this.viewsModel.setVisible(MainPanel.ID, true); - } - toggleClass(this.el, 'empty', repositoryCount === 0); - this.repositoryCount = repositoryCount; - - this._onDidChangeRepositories.fire(); - } - - private onAfterStartup(): void { - if (this.repositoryCount > 0 && this.viewDescriptors.every(d => !this.viewsModel.isVisible(d.id))) { - this.viewsModel.setVisible(this.viewDescriptors[0].id, true); - } + this.repositoryCountKey.set(repositoryCount); } private onDidHideView(): void { nextTick(() => { - if (this.repositoryCount > 0 && this.viewDescriptors.every(d => !this.viewsModel.isVisible(d.id))) { - const alwaysShowProviders = this.configurationService.getValue('scm.alwaysShowProviders') || false; - this.viewsModel.setVisible(MainPanel.ID, alwaysShowProviders || this.repositoryCount > 1); + if (this.repositoryCountKey.get()! > 0 && this.viewDescriptors.every(d => !this.viewsModel.isVisible(d.id))) { this.viewsModel.setVisible(this.viewDescriptors[0].id, true); } }); } focus(): void { - if (this.repositoryCount === 0) { + if (this.repositoryCountKey.get()! === 0) { this.message.focus(); } else { const repository = this.visibleRepositories[0]; @@ -1286,4 +1232,35 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { return this.repositories[0].provider; } } + + setVisibleRepositories(repositories: ISCMRepository[]): void { + const visibleViewDescriptors = this.viewsModel.visibleViewDescriptors; + + const toSetVisible = this.viewsModel.viewDescriptors + .filter((d): d is RepositoryViewDescriptor => d instanceof RepositoryViewDescriptor && repositories.indexOf(d.repository) > -1 && visibleViewDescriptors.indexOf(d) === -1); + + const toSetInvisible = visibleViewDescriptors + .filter((d): d is RepositoryViewDescriptor => d instanceof RepositoryViewDescriptor && repositories.indexOf(d.repository) === -1); + + let size: number | undefined; + const oneToOne = toSetVisible.length === 1 && toSetInvisible.length === 1; + + for (const viewDescriptor of toSetInvisible) { + if (oneToOne) { + const panel = this.panels.filter(panel => panel.id === viewDescriptor.id)[0]; + + if (panel) { + size = this.getPanelSize(panel); + } + } + + viewDescriptor.repository.setSelected(false); + this.viewsModel.setVisible(viewDescriptor.id, false); + } + + for (const viewDescriptor of toSetVisible) { + viewDescriptor.repository.setSelected(true); + this.viewsModel.setVisible(viewDescriptor.id, true, size); + } + } } diff --git a/src/vs/workbench/contrib/scm/common/scm.ts b/src/vs/workbench/contrib/scm/common/scm.ts index 53f10d56b9b..5e1afd2d5fb 100644 --- a/src/vs/workbench/contrib/scm/common/scm.ts +++ b/src/vs/workbench/contrib/scm/common/scm.ts @@ -112,7 +112,7 @@ export interface ISCMRepository extends IDisposable { export interface ISCMService { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; readonly onDidAddRepository: Event; readonly onDidRemoveRepository: Event; diff --git a/src/vs/workbench/contrib/scm/common/scmService.ts b/src/vs/workbench/contrib/scm/common/scmService.ts index e75d7df468e..d4a6da75f93 100644 --- a/src/vs/workbench/contrib/scm/common/scmService.ts +++ b/src/vs/workbench/contrib/scm/common/scmService.ts @@ -105,7 +105,7 @@ class SCMRepository implements ISCMRepository { export class SCMService implements ISCMService { - _serviceBrand: any; + _serviceBrand: undefined; private _providerIds = new Set(); private _repositories: ISCMRepository[] = []; diff --git a/src/vs/workbench/contrib/search/browser/openAnythingHandler.ts b/src/vs/workbench/contrib/search/browser/openAnythingHandler.ts index 85a0ce55040..86adf6381f3 100644 --- a/src/vs/workbench/contrib/search/browser/openAnythingHandler.ts +++ b/src/vs/workbench/contrib/search/browser/openAnythingHandler.ts @@ -40,10 +40,10 @@ export class OpenAnythingHandler extends QuickOpenHandler { private openSymbolHandler: OpenSymbolHandler; private openFileHandler: OpenFileHandler; - private searchDelayer: ThrottledDelayer; - private isClosed: boolean; + private searchDelayer: ThrottledDelayer; + private isClosed: boolean | undefined; private scorerCache: ScorerCache; - private includeSymbols: boolean; + private includeSymbols: boolean | undefined; constructor( @INotificationService private readonly notificationService: INotificationService, @@ -83,7 +83,7 @@ export class OpenAnythingHandler extends QuickOpenHandler { }); } - getResults(searchValue: string, token: CancellationToken): Promise { + getResults(searchValue: string, token: CancellationToken): Promise { this.isClosed = false; // Treat this call as the handler being in use // Find a suitable range from the pattern looking for ":" and "#" @@ -99,7 +99,7 @@ export class OpenAnythingHandler extends QuickOpenHandler { } // The throttler needs a factory for its promises - const resultsPromise = () => { + const resultsPromise = (): Promise => { const resultPromises: Promise[] = []; // File Results diff --git a/src/vs/workbench/contrib/search/browser/openFileHandler.ts b/src/vs/workbench/contrib/search/browser/openFileHandler.ts index 39d390233dd..0374b69749f 100644 --- a/src/vs/workbench/contrib/search/browser/openFileHandler.ts +++ b/src/vs/workbench/contrib/search/browser/openFileHandler.ts @@ -114,7 +114,7 @@ export interface IOpenFileOptions { export class OpenFileHandler extends QuickOpenHandler { private options: IOpenFileOptions | undefined; private queryBuilder: QueryBuilder; - private cacheState: CacheState; + private cacheState: CacheState | undefined; constructor( @IInstantiationService private readonly instantiationService: IInstantiationService, @@ -143,7 +143,7 @@ export class OpenFileHandler extends QuickOpenHandler { } // Do find results - return this.doFindResults(query, token, this.cacheState.cacheKey, maxSortedResults); + return this.doFindResults(query, token, this.cacheState ? this.cacheState.cacheKey : undefined, maxSortedResults); } private async doFindResults(query: IPreparedQuery, token: CancellationToken, cacheKey?: string, maxSortedResults?: number): Promise { @@ -246,7 +246,7 @@ export class OpenFileHandler extends QuickOpenHandler { } get isCacheLoaded(): boolean { - return this.cacheState && this.cacheState.isLoaded; + return !!this.cacheState && this.cacheState.isLoaded; } getGroupLabel(): string { @@ -279,14 +279,14 @@ export class CacheState { private loadingPhase = LoadingPhase.Created; private promise: Promise | undefined; - constructor(cacheQuery: (cacheKey: string) => IFileQuery, private doLoad: (query: IFileQuery) => Promise, private doDispose: (cacheKey: string) => Promise, private previous: CacheState | null) { + constructor(cacheQuery: (cacheKey: string) => IFileQuery, private doLoad: (query: IFileQuery) => Promise, private doDispose: (cacheKey: string) => Promise, private previous: CacheState | undefined) { this.query = cacheQuery(this._cacheKey); if (this.previous) { const current = objects.assign({}, this.query, { cacheKey: null }); const previous = objects.assign({}, this.previous.query, { cacheKey: null }); if (!objects.equals(current, previous)) { this.previous.dispose(); - this.previous = null; + this.previous = undefined; } } } @@ -315,7 +315,7 @@ export class CacheState { this.loadingPhase = LoadingPhase.Loaded; if (this.previous) { this.previous.dispose(); - this.previous = null; + this.previous = undefined; } }, err => { this.loadingPhase = LoadingPhase.Errored; @@ -337,7 +337,7 @@ export class CacheState { } if (this.previous) { this.previous.dispose(); - this.previous = null; + this.previous = undefined; } } } diff --git a/src/vs/workbench/contrib/search/browser/openSymbolHandler.ts b/src/vs/workbench/contrib/search/browser/openSymbolHandler.ts index 4a0a138d83b..c0bcedcb221 100644 --- a/src/vs/workbench/contrib/search/browser/openSymbolHandler.ts +++ b/src/vs/workbench/contrib/search/browser/openSymbolHandler.ts @@ -8,13 +8,13 @@ import { URI } from 'vs/base/common/uri'; import { onUnexpectedError } from 'vs/base/common/errors'; import { ThrottledDelayer } from 'vs/base/common/async'; import { QuickOpenHandler, EditorQuickOpenEntry } from 'vs/workbench/browser/quickopen'; -import { QuickOpenModel, QuickOpenEntry, compareEntries } from 'vs/base/parts/quickopen/browser/quickOpenModel'; +import { QuickOpenModel, QuickOpenEntry, IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel'; import { IAutoFocus, Mode, IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen'; import * as filters from 'vs/base/common/filters'; import * as strings from 'vs/base/common/strings'; import { Range } from 'vs/editor/common/core/range'; import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor'; -import { symbolKindToCssClass } from 'vs/editor/common/modes'; +import { symbolKindToCssClass, SymbolTag } from 'vs/editor/common/modes'; import { IResourceInput } from 'vs/platform/editor/common/editor'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -25,9 +25,12 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Schemas } from 'vs/base/common/network'; import { IOpenerService } from 'vs/platform/opener/common/opener'; +import { IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; class SymbolEntry extends EditorQuickOpenEntry { - private bearingResolve: Promise | undefined; + + private bearingResolve?: Promise; + private score?: filters.FuzzyScore; constructor( private bearing: IWorkspaceSymbol, @@ -40,6 +43,14 @@ class SymbolEntry extends EditorQuickOpenEntry { super(editorService); } + setScore(score: filters.FuzzyScore | undefined) { + this.score = score; + } + + getHighlights(): [IHighlight[] /* Label */, IHighlight[] | undefined /* Description */, IHighlight[] | undefined /* Detail */] { + return [this.isDeprecated() ? [] : filters.createMatches(this.score), undefined, undefined]; + } + getLabel(): string { return this.bearing.name; } @@ -65,10 +76,18 @@ class SymbolEntry extends EditorQuickOpenEntry { return symbolKindToCssClass(this.bearing.kind); } + getLabelOptions(): IIconLabelValueOptions | undefined { + return this.isDeprecated() ? { extraClasses: ['deprecated'] } : undefined; + } + getResource(): URI { return this.bearing.location.uri; } + private isDeprecated(): boolean { + return this.bearing.tags ? this.bearing.tags.indexOf(SymbolTag.Deprecated) >= 0 : false; + } + run(mode: Mode, context: IEntryRunContext): boolean { // resolve this type bearing if neccessary @@ -111,18 +130,24 @@ class SymbolEntry extends EditorQuickOpenEntry { return input; } - static compare(elementA: SymbolEntry, elementB: SymbolEntry, searchValue: string): number { - - // Sort by Type if name is identical - const elementAName = elementA.getLabel().toLowerCase(); - const elementBName = elementB.getLabel().toLowerCase(); - if (elementAName === elementBName) { - let elementAType = symbolKindToCssClass(elementA.bearing.kind); - let elementBType = symbolKindToCssClass(elementB.bearing.kind); - return elementAType.localeCompare(elementBType); + static compare(a: SymbolEntry, b: SymbolEntry, searchValue: string): number { + // order: score, name, kind + if (a.score && b.score) { + if (a.score[0] > b.score[0]) { + return -1; + } else if (a.score[0] < b.score[0]) { + return 1; + } } - - return compareEntries(elementA, elementB, searchValue); + const aName = a.getLabel().toLowerCase(); + const bName = b.getLabel().toLowerCase(); + let res = aName.localeCompare(bName); + if (res !== 0) { + return res; + } + let aKind = symbolKindToCssClass(a.bearing.kind); + let bKind = symbolKindToCssClass(b.bearing.kind); + return aKind.localeCompare(bKind); } } @@ -198,6 +223,9 @@ export class OpenSymbolHandler extends QuickOpenHandler { private fillInSymbolEntries(bucket: SymbolEntry[], provider: IWorkspaceSymbolProvider, types: IWorkspaceSymbol[], searchValue: string): void { + const pattern = strings.stripWildcards(searchValue); + const patternLow = pattern.toLowerCase(); + // Convert to Entries for (let element of types) { if (this.options.skipLocalSymbols && !!element.containerName) { @@ -205,7 +233,11 @@ export class OpenSymbolHandler extends QuickOpenHandler { } const entry = this.instantiationService.createInstance(SymbolEntry, element, provider); - entry.setHighlights(filters.matchesFuzzy2(searchValue, entry.getLabel()) || []); + entry.setScore(filters.fuzzyScore( + pattern, patternLow, 0, + entry.getLabel(), entry.getLabel().toLowerCase(), 0, + true + )); bucket.push(entry); } } diff --git a/src/vs/workbench/contrib/search/browser/replaceService.ts b/src/vs/workbench/contrib/search/browser/replaceService.ts index ff9c9bacaf1..502e32a326c 100644 --- a/src/vs/workbench/contrib/search/browser/replaceService.ts +++ b/src/vs/workbench/contrib/search/browser/replaceService.ts @@ -91,7 +91,7 @@ class ReplacePreviewModel extends Disposable { export class ReplaceService implements IReplaceService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @ITextFileService private readonly textFileService: ITextFileService, diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index db23b909109..87140d0b464 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -274,7 +274,7 @@ MenuRegistry.appendMenuItem(MenuId.SearchContext, { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.CopyPathCommandId, weight: KeybindingWeight.WorkbenchContrib, - when: Constants.FileMatchOrFolderMatchFocusKey, + when: Constants.FileMatchOrFolderMatchWithResourceFocusKey, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_C, win: { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_C @@ -287,7 +287,7 @@ MenuRegistry.appendMenuItem(MenuId.SearchContext, { id: Constants.CopyPathCommandId, title: nls.localize('copyPathLabel', "Copy Path") }, - when: Constants.FileMatchOrFolderMatchFocusKey, + when: Constants.FileMatchOrFolderMatchWithResourceFocusKey, group: 'search_2', order: 2 }); diff --git a/src/vs/workbench/contrib/search/browser/searchActions.ts b/src/vs/workbench/contrib/search/browser/searchActions.ts index 9eac783512a..1973a3e26bf 100644 --- a/src/vs/workbench/contrib/search/browser/searchActions.ts +++ b/src/vs/workbench/contrib/search/browser/searchActions.ts @@ -20,7 +20,7 @@ import { getSelectionKeyboardEvent, WorkbenchObjectTree } from 'vs/platform/list import { SearchView } from 'vs/workbench/contrib/search/browser/searchView'; import * as Constants from 'vs/workbench/contrib/search/common/constants'; import { IReplaceService } from 'vs/workbench/contrib/search/common/replace'; -import { BaseFolderMatch, FileMatch, FileMatchOrMatch, FolderMatch, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel'; +import { FolderMatch, FileMatch, FileMatchOrMatch, FolderMatchWithResource, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; @@ -312,7 +312,7 @@ export class CollapseDeepestExpandedLevelAction extends Action { const navigator = viewer.navigate(); let node = navigator.first(); let collapseFileMatchLevel = false; - if (node instanceof BaseFolderMatch) { + if (node instanceof FolderMatch) { while (node = navigator.next()) { if (node instanceof Match) { collapseFileMatchLevel = true; @@ -448,8 +448,8 @@ export abstract class AbstractSearchAndReplaceAction extends Action { getNextElementAfterRemoved(viewer: WorkbenchObjectTree, element: RenderableMatch): RenderableMatch { const navigator: INavigator = viewer.navigate(element); - if (element instanceof BaseFolderMatch) { - while (!!navigator.next() && !(navigator.current() instanceof BaseFolderMatch)) { } + if (element instanceof FolderMatch) { + while (!!navigator.next() && !(navigator.current() instanceof FolderMatch)) { } } else if (element instanceof FileMatch) { while (!!navigator.next() && !(navigator.current() instanceof FileMatch)) { } } else { @@ -476,7 +476,7 @@ export abstract class AbstractSearchAndReplaceAction extends Action { // If the previous element is a File or Folder, expand it and go to its last child. // Spell out the two cases, would be too easy to create an infinite loop, like by adding another level... - if (element instanceof Match && previousElement && previousElement instanceof BaseFolderMatch) { + if (element instanceof Match && previousElement && previousElement instanceof FolderMatch) { navigator.next(); viewer.expand(previousElement); previousElement = navigator.previous(); @@ -664,7 +664,7 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction { } } -export const copyPathCommand: ICommandHandler = async (accessor, fileMatch: FileMatch | FolderMatch) => { +export const copyPathCommand: ICommandHandler = async (accessor, fileMatch: FileMatch | FolderMatchWithResource) => { const clipboardService = accessor.get(IClipboardService); const labelService = accessor.get(ILabelService); @@ -712,7 +712,7 @@ function fileMatchToString(fileMatch: FileMatch, maxMatches: number, labelServic }; } -function folderMatchToString(folderMatch: FolderMatch | BaseFolderMatch, maxMatches: number, labelService: ILabelService): { text: string, count: number } { +function folderMatchToString(folderMatch: FolderMatchWithResource | FolderMatch, maxMatches: number, labelService: ILabelService): { text: string, count: number } { const fileResults: string[] = []; let numMatches = 0; @@ -740,7 +740,7 @@ export const copyMatchCommand: ICommandHandler = async (accessor, match: Rendera text = matchToString(match); } else if (match instanceof FileMatch) { text = fileMatchToString(match, maxClipboardMatches, labelService).text; - } else if (match instanceof BaseFolderMatch) { + } else if (match instanceof FolderMatch) { text = folderMatchToString(match, maxClipboardMatches, labelService).text; } @@ -749,7 +749,7 @@ export const copyMatchCommand: ICommandHandler = async (accessor, match: Rendera } }; -function allFolderMatchesToString(folderMatches: Array, maxMatches: number, labelService: ILabelService): string { +function allFolderMatchesToString(folderMatches: Array, maxMatches: number, labelService: ILabelService): string { const folderResults: string[] = []; let numMatches = 0; folderMatches = folderMatches.sort(searchMatchComparer); diff --git a/src/vs/workbench/contrib/search/browser/searchResultsView.ts b/src/vs/workbench/contrib/search/browser/searchResultsView.ts index 7635f1eac29..f4c82733c60 100644 --- a/src/vs/workbench/contrib/search/browser/searchResultsView.ts +++ b/src/vs/workbench/contrib/search/browser/searchResultsView.ts @@ -25,7 +25,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { IResourceLabel, ResourceLabels } from 'vs/workbench/browser/labels'; import { RemoveAction, ReplaceAction, ReplaceAllAction, ReplaceAllInFolderAction } from 'vs/workbench/contrib/search/browser/searchActions'; import { SearchView } from 'vs/workbench/contrib/search/browser/searchView'; -import { FileMatch, FolderMatch, Match, RenderableMatch, SearchModel, BaseFolderMatch } from 'vs/workbench/contrib/search/common/searchModel'; +import { FileMatch, Match, RenderableMatch, SearchModel, FolderMatch } from 'vs/workbench/contrib/search/common/searchModel'; import { IDragAndDropData } from 'vs/base/browser/dnd'; import { fillResourceDataTransfers } from 'vs/workbench/browser/dnd'; import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView'; @@ -63,7 +63,7 @@ export class SearchDelegate implements IListVirtualDelegate { } getTemplateId(element: RenderableMatch): string { - if (element instanceof BaseFolderMatch) { + if (element instanceof FolderMatch) { return FolderMatchRenderer.TEMPLATE_ID; } else if (element instanceof FileMatch) { return FileMatchRenderer.TEMPLATE_ID; @@ -114,7 +114,7 @@ export class FolderMatchRenderer extends Disposable implements ITreeRenderer, index: number, templateData: IFolderMatchTemplate): void { const folderMatch = node.element; - if (folderMatch.hasResource()) { + if (folderMatch.resource) { const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource); if (workspaceFolder && resources.isEqual(workspaceFolder.uri, folderMatch.resource)) { templateData.label.setFile(folderMatch.resource, { fileKind: FileKind.ROOT_FOLDER, hidePath: true }); @@ -309,8 +309,8 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider; private fileMatchOrMatchFocused: IContextKey; private fileMatchOrFolderMatchFocus: IContextKey; + private fileMatchOrFolderMatchWithResourceFocus: IContextKey; private fileMatchFocused: IContextKey; private folderMatchFocused: IContextKey; private matchFocused: IContextKey; @@ -109,7 +109,6 @@ export class SearchView extends ViewletPanel { private tree: WorkbenchObjectTree; private treeLabels: ResourceLabels; private viewletState: MementoObject; - private globalMemento: MementoObject; private messagesElement: HTMLElement; private messageDisposables: IDisposable[] = []; private searchWidgetsContainerElement: HTMLElement; @@ -148,7 +147,6 @@ export class SearchView extends ViewletPanel { @IPreferencesService private readonly preferencesService: IPreferencesService, @IThemeService protected themeService: IThemeService, @ISearchHistoryService private readonly searchHistoryService: ISearchHistoryService, - @IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService, @IContextMenuService contextMenuService: IContextMenuService, @IMenuService private readonly menuService: IMenuService, @IAccessibilityService private readonly accessibilityService: IAccessibilityService, @@ -166,6 +164,7 @@ export class SearchView extends ViewletPanel { this.firstMatchFocused = Constants.FirstMatchFocusKey.bindTo(contextKeyService); this.fileMatchOrMatchFocused = Constants.FileMatchOrMatchFocusKey.bindTo(contextKeyService); this.fileMatchOrFolderMatchFocus = Constants.FileMatchOrFolderMatchFocusKey.bindTo(contextKeyService); + this.fileMatchOrFolderMatchWithResourceFocus = Constants.FileMatchOrFolderMatchWithResourceFocusKey.bindTo(contextKeyService); this.fileMatchFocused = Constants.FileFocusKey.bindTo(contextKeyService); this.folderMatchFocused = Constants.FolderFocusKey.bindTo(contextKeyService); this.matchFocused = Constants.MatchFocusKey.bindTo(this.contextKeyService); @@ -175,7 +174,6 @@ export class SearchView extends ViewletPanel { this.queryBuilder = this.instantiationService.createInstance(QueryBuilder); this.memento = new Memento(this.id, storageService); this.viewletState = this.memento.getMemento(StorageScope.WORKSPACE); - this.globalMemento = this.memento.getMemento(StorageScope.GLOBAL); this._register(this.fileService.onFileChanges(e => this.onFilesChanged(e))); this._register(this.untitledEditorService.onDidChangeDirty(e => this.onUntitledDidChangeDirty(e))); @@ -450,21 +448,13 @@ export class SearchView extends ViewletPanel { refreshTree(event?: IChangeEvent): void { const collapseResults = this.configurationService.getValue('search').collapseResults; if (!event || event.added || event.removed) { + // Refresh whole tree this.tree.setChildren(null, this.createResultIterator(collapseResults)); } else { + // FileMatch modified, refresh those elements event.elements.forEach(element => { - if (element instanceof BaseFolderMatch) { - // The folder may or may not be in the tree. Refresh the whole thing. - this.tree.setChildren(null, this.createResultIterator(collapseResults)); - return; - } - - if (element instanceof SearchResult) { - this.tree.setChildren(null, this.createIterator(element, collapseResults)); - } else { - this.tree.setChildren(element, this.createIterator(element, collapseResults)); - this.tree.rerender(element); - } + this.tree.setChildren(element, this.createIterator(element, collapseResults)); + this.tree.rerender(element); }); } } @@ -485,7 +475,7 @@ export class SearchView extends ViewletPanel { }); } - private createFolderIterator(folderMatch: BaseFolderMatch, collapseResults: ISearchConfigurationProperties['collapseResults']): Iterator> { + private createFolderIterator(folderMatch: FolderMatch, collapseResults: ISearchConfigurationProperties['collapseResults']): Iterator> { const filesIt = Iterator.fromArray( folderMatch.matches() .sort(searchMatchComparer)); @@ -510,9 +500,9 @@ export class SearchView extends ViewletPanel { return Iterator.map(matchesIt, r => (>{ element: r })); } - private createIterator(match: BaseFolderMatch | FileMatch | SearchResult, collapseResults: ISearchConfigurationProperties['collapseResults']): Iterator> { + private createIterator(match: FolderMatch | FileMatch | SearchResult, collapseResults: ISearchConfigurationProperties['collapseResults']): Iterator> { return match instanceof SearchResult ? this.createResultIterator(collapseResults) : - match instanceof BaseFolderMatch ? this.createFolderIterator(match, collapseResults) : + match instanceof FolderMatch ? this.createFolderIterator(match, collapseResults) : this.createFileIterator(match); } @@ -644,6 +634,7 @@ export class SearchView extends ViewletPanel { this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility })); this.tree = this._register(this.instantiationService.createInstance(WorkbenchObjectTree, + 'SearchView', this.resultsElement, delegate, [ @@ -682,6 +673,7 @@ export class SearchView extends ViewletPanel { this.folderMatchFocused.set(focus instanceof FolderMatch); this.matchFocused.set(focus instanceof Match); this.fileMatchOrFolderMatchFocus.set(focus instanceof FileMatch || focus instanceof FolderMatch); + this.fileMatchOrFolderMatchWithResourceFocus.set(focus instanceof FileMatch || focus instanceof FolderMatchWithResource); } })); @@ -692,6 +684,7 @@ export class SearchView extends ViewletPanel { this.folderMatchFocused.reset(); this.matchFocused.reset(); this.fileMatchOrFolderMatchFocus.reset(); + this.fileMatchOrFolderMatchWithResourceFocus.reset(); })); } @@ -1385,10 +1378,6 @@ export class SearchView extends ViewletPanel { this.searchWidget.searchInput.showMessage({ content: e.message, type: MessageType.ERROR }); this.viewModel.searchResult.clear(); - if (e.code === SearchErrorCode.regexParseError && !this.configurationService.getValue('search.usePCRE2')) { - this.showPcre2Hint(); - } - return Promise.resolve(); } }; @@ -1423,23 +1412,6 @@ export class SearchView extends ViewletPanel { .then(onComplete, onError); } - private showPcre2Hint(): void { - if (!this.globalMemento['disablePcre2Hint']) { - // If the regex parsed in JS but not rg, it likely uses features that are supported in JS and PCRE2 but not Rust - this.notificationService.prompt(Severity.Info, nls.localize('rgRegexError', "You can enable \"search.usePCRE2\" to enable some extra regex features like lookbehind and backreferences."), [ - { - label: nls.localize('neverAgain', "Don't Show Again"), - run: () => this.globalMemento['disablePcre2Hint'] = true, - isSecondary: true - }, - { - label: nls.localize('otherEncodingWarning.openSettingsLabel', "Open Settings"), - run: () => this.openSettings('search.usePCRE2') - } - ]); - } - } - private addClickEvents = (element: HTMLElement, handler: (event: any) => void): void => { this.messageDisposables.push(dom.addDisposableListener(element, dom.EventType.CLICK, handler)); this.messageDisposables.push(dom.addDisposableListener(element, dom.EventType.KEY_DOWN, e => { @@ -1570,10 +1542,6 @@ export class SearchView extends ViewletPanel { } else { this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange(); } - - if (editor) { - this.editorGroupsService.activateGroup(editor.group!); - } }, errors.onUnexpectedError); } diff --git a/src/vs/workbench/contrib/search/common/constants.ts b/src/vs/workbench/contrib/search/common/constants.ts index a13dfb10def..d2261e85097 100644 --- a/src/vs/workbench/contrib/search/common/constants.ts +++ b/src/vs/workbench/contrib/search/common/constants.ts @@ -41,6 +41,7 @@ export const HasSearchResults = new RawContextKey('hasSearchResult', fa export const FirstMatchFocusKey = new RawContextKey('firstMatchFocus', false); export const FileMatchOrMatchFocusKey = new RawContextKey('fileMatchOrMatchFocus', false); // This is actually, Match or File or Folder export const FileMatchOrFolderMatchFocusKey = new RawContextKey('fileMatchOrFolderMatchFocus', false); +export const FileMatchOrFolderMatchWithResourceFocusKey = new RawContextKey('fileMatchOrFolderMatchWithResourceFocus', false); // Excludes "Other files" export const FileFocusKey = new RawContextKey('fileMatchFocus', false); export const FolderFocusKey = new RawContextKey('folderMatchFocus', false); export const MatchFocusKey = new RawContextKey('matchFocus', false); diff --git a/src/vs/workbench/contrib/search/common/replace.ts b/src/vs/workbench/contrib/search/common/replace.ts index f66493dc466..d3d94df9371 100644 --- a/src/vs/workbench/contrib/search/common/replace.ts +++ b/src/vs/workbench/contrib/search/common/replace.ts @@ -11,7 +11,7 @@ export const IReplaceService = createDecorator('replaceService' export interface IReplaceService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Replaces the given match in the file that match belongs to diff --git a/src/vs/workbench/contrib/search/common/search.ts b/src/vs/workbench/contrib/search/common/search.ts index 0f87a2f56f6..10e3f093834 100644 --- a/src/vs/workbench/contrib/search/common/search.ts +++ b/src/vs/workbench/contrib/search/common/search.ts @@ -6,7 +6,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { IDisposable } from 'vs/base/common/lifecycle'; import { ISearchConfiguration, ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search'; -import { SymbolKind, Location, ProviderResult } from 'vs/editor/common/modes'; +import { SymbolKind, Location, ProviderResult, SymbolTag } from 'vs/editor/common/modes'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { URI } from 'vs/base/common/uri'; import { toResource, SideBySideEditor } from 'vs/workbench/common/editor'; @@ -19,6 +19,7 @@ export interface IWorkspaceSymbol { name: string; containerName?: string; kind: SymbolKind; + tags?: SymbolTag[]; location: Location; } diff --git a/src/vs/workbench/contrib/search/common/searchHistoryService.ts b/src/vs/workbench/contrib/search/common/searchHistoryService.ts index 9c8e4b3b8e4..5f5496fb9d2 100644 --- a/src/vs/workbench/contrib/search/common/searchHistoryService.ts +++ b/src/vs/workbench/contrib/search/common/searchHistoryService.ts @@ -9,7 +9,7 @@ import { isEmptyObject } from 'vs/base/common/types'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export interface ISearchHistoryService { - _serviceBrand: any; + _serviceBrand: undefined; onDidClearHistory: Event; clearHistory(): void; load(): ISearchHistoryValues; @@ -26,7 +26,7 @@ export interface ISearchHistoryValues { } export class SearchHistoryService implements ISearchHistoryService { - _serviceBrand: any; + _serviceBrand: undefined; private static readonly SEARCH_HISTORY_KEY = 'workbench.search.history'; diff --git a/src/vs/workbench/contrib/search/common/searchModel.ts b/src/vs/workbench/contrib/search/common/searchModel.ts index 1962709126f..7d003d61cd4 100644 --- a/src/vs/workbench/contrib/search/common/searchModel.ts +++ b/src/vs/workbench/contrib/search/common/searchModel.ts @@ -197,7 +197,7 @@ export class FileMatch extends Disposable implements IFileMatch { private _updateScheduler: RunOnceScheduler; private _modelDecorations: string[] = []; - constructor(private _query: IPatternInfo, private _previewOptions: ITextSearchPreviewOptions, private _maxResults: number, private _parent: BaseFolderMatch, private rawMatch: IFileMatch, + constructor(private _query: IPatternInfo, private _previewOptions: ITextSearchPreviewOptions, private _maxResults: number, private _parent: FolderMatch, private rawMatch: IFileMatch, @IModelService private readonly modelService: IModelService, @IReplaceService private readonly replaceService: IReplaceService ) { super(); @@ -322,7 +322,7 @@ export class FileMatch extends Disposable implements IFileMatch { return this.resource.toString(); } - parent(): BaseFolderMatch { + parent(): FolderMatch { return this._parent; } @@ -400,12 +400,12 @@ export class FileMatch extends Disposable implements IFileMatch { } export interface IChangeEvent { - elements: (FileMatch | FolderMatch | SearchResult)[]; + elements: FileMatch[]; added?: boolean; removed?: boolean; } -export class BaseFolderMatch extends Disposable { +export class FolderMatch extends Disposable { private _onChange = this._register(new Emitter()); readonly onChange: Event = this._onChange.event; @@ -458,10 +458,6 @@ export class BaseFolderMatch extends Disposable { return this._parent; } - hasResource(): boolean { - return !!this._resource; - } - bindModel(model: ITextModel): void { const fileMatch = this._fileMatches.get(model.uri); if (fileMatch) { @@ -598,7 +594,7 @@ export class BaseFolderMatch extends Disposable { * BaseFolderMatch => optional resource ("other files" node) * FolderMatch => required resource (normal folder node) */ -export class FolderMatch extends BaseFolderMatch { +export class FolderMatchWithResource extends FolderMatch { constructor(_resource: URI, _id: string, _index: number, _query: ITextQuery, _parent: SearchResult, _searchModel: SearchModel, @IReplaceService replaceService: IReplaceService, @IInstantiationService instantiationService: IInstantiationService @@ -616,7 +612,7 @@ export class FolderMatch extends BaseFolderMatch { * and their sort order is undefined. */ export function searchMatchComparer(elementA: RenderableMatch, elementB: RenderableMatch): number { - if (elementA instanceof BaseFolderMatch && elementB instanceof BaseFolderMatch) { + if (elementA instanceof FolderMatch && elementB instanceof FolderMatch) { return elementA.index() - elementB.index(); } @@ -636,9 +632,9 @@ export class SearchResult extends Disposable { private _onChange = this._register(new Emitter()); readonly onChange: Event = this._onChange.event; - private _folderMatches: FolderMatch[] = []; - private _otherFilesMatch: BaseFolderMatch; - private _folderMatchesMap: TernarySearchTree = TernarySearchTree.forPaths(); + private _folderMatches: FolderMatchWithResource[] = []; + private _otherFilesMatch: FolderMatch; + private _folderMatchesMap: TernarySearchTree = TernarySearchTree.forPaths(); private _showHighlights: boolean; private _query: ITextQuery; @@ -666,7 +662,7 @@ export class SearchResult extends Disposable { this.clear(); this._folderMatches = (query.folderQueries || []) .map(fq => fq.folder) - .map((resource, index) => this.createFolderMatch(resource, resource.toString(), index, query)); + .map((resource, index) => this.createFolderMatchWithResource(resource, resource.toString(), index, query)); this._folderMatches.forEach(fm => this._folderMatchesMap.set(fm.resource.toString(), fm)); this._otherFilesMatch = this.createOtherFilesFolderMatch('otherFiles', this._folderMatches.length + 1, query); @@ -681,15 +677,15 @@ export class SearchResult extends Disposable { } } - private createFolderMatch(resource: URI, id: string, index: number, query: ITextQuery): FolderMatch { - return this._createBaseFolderMatch(FolderMatch, resource, id, index, query); + private createFolderMatchWithResource(resource: URI, id: string, index: number, query: ITextQuery): FolderMatchWithResource { + return this._createBaseFolderMatch(FolderMatchWithResource, resource, id, index, query); } - private createOtherFilesFolderMatch(id: string, index: number, query: ITextQuery): BaseFolderMatch { - return this._createBaseFolderMatch(BaseFolderMatch, null, id, index, query); + private createOtherFilesFolderMatch(id: string, index: number, query: ITextQuery): FolderMatch { + return this._createBaseFolderMatch(FolderMatch, null, id, index, query); } - private _createBaseFolderMatch(folderMatchClass: typeof BaseFolderMatch | typeof FolderMatch, resource: URI | null, id: string, index: number, query: ITextQuery): BaseFolderMatch { + private _createBaseFolderMatch(folderMatchClass: typeof FolderMatch | typeof FolderMatchWithResource, resource: URI | null, id: string, index: number, query: ITextQuery): FolderMatch { const folderMatch = this.instantiationService.createInstance(folderMatchClass, resource, id, index, query, this, this._searchModel); const disposable = folderMatch.onChange((event) => this._onChange.fire(event)); folderMatch.onDispose(() => disposable.dispose()); @@ -734,9 +730,9 @@ export class SearchResult extends Disposable { } }); - matches = matches.filter(m => m instanceof FileMatch); + const fileMatches: FileMatch[] = matches.filter(m => m instanceof FileMatch) as FileMatch[]; - const { byFolder, other } = this.groupFilesByFolder(matches); + const { byFolder, other } = this.groupFilesByFolder(fileMatches); byFolder.forEach(matches => { if (!matches.length) { return; @@ -774,7 +770,7 @@ export class SearchResult extends Disposable { }); } - folderMatches(): BaseFolderMatch[] { + folderMatches(): FolderMatch[] { return this._otherFilesMatch ? [ ...this._folderMatches, @@ -837,7 +833,7 @@ export class SearchResult extends Disposable { return this._rangeHighlightDecorations; } - private getFolderMatch(resource: URI): BaseFolderMatch { + private getFolderMatch(resource: URI): FolderMatch { const folderMatch = this._folderMatchesMap.findSubstr(resource.toString()); return folderMatch ? folderMatch : this._otherFilesMatch; } @@ -877,7 +873,7 @@ export class SearchResult extends Disposable { private disposeMatches(): void { this.folderMatches().forEach(folderMatch => folderMatch.dispose()); this._folderMatches = []; - this._folderMatchesMap = TernarySearchTree.forPaths(); + this._folderMatchesMap = TernarySearchTree.forPaths(); this._rangeHighlightDecorations.removeHighlightRange(); } @@ -1063,11 +1059,11 @@ export class SearchModel extends Disposable { export type FileMatchOrMatch = FileMatch | Match; -export type RenderableMatch = BaseFolderMatch | FolderMatch | FileMatch | Match; +export type RenderableMatch = FolderMatch | FolderMatchWithResource | FileMatch | Match; export class SearchWorkbenchService implements ISearchWorkbenchService { - _serviceBrand: any; + _serviceBrand: undefined; private _searchModel: SearchModel; constructor(@IInstantiationService private readonly instantiationService: IInstantiationService) { @@ -1084,7 +1080,7 @@ export class SearchWorkbenchService implements ISearchWorkbenchService { export const ISearchWorkbenchService = createDecorator('searchWorkbenchService'); export interface ISearchWorkbenchService { - _serviceBrand: any; + _serviceBrand: undefined; readonly searchModel: SearchModel; } diff --git a/src/vs/workbench/contrib/snippets/browser/snippets.contribution.ts b/src/vs/workbench/contrib/snippets/browser/snippets.contribution.ts index ee158fb00bf..3498f2bf3e5 100644 --- a/src/vs/workbench/contrib/snippets/browser/snippets.contribution.ts +++ b/src/vs/workbench/contrib/snippets/browser/snippets.contribution.ts @@ -15,7 +15,7 @@ export const ISnippetsService = createDecorator('snippetServic export interface ISnippetsService { - _serviceBrand: any; + _serviceBrand: undefined; getSnippetFiles(): Promise; @@ -28,6 +28,7 @@ const languageScopeSchemaId = 'vscode://schemas/snippets'; const languageScopeSchema: IJSONSchema = { id: languageScopeSchemaId, allowComments: true, + allowsTrailingCommas: true, defaultSnippets: [{ label: nls.localize('snippetSchema.json.default', "Empty snippet"), body: { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } } @@ -63,6 +64,7 @@ const globalSchemaId = 'vscode://schemas/global-snippets'; const globalSchema: IJSONSchema = { id: globalSchemaId, allowComments: true, + allowsTrailingCommas: true, defaultSnippets: [{ label: nls.localize('snippetSchema.json.default', "Empty snippet"), body: { '${1:snippetName}': { 'scope': '${2:scope}', 'prefix': '${3:prefix}', 'body': '${4:snippet}', 'description': '${5:description}' } } diff --git a/src/vs/workbench/contrib/snippets/browser/snippetsService.ts b/src/vs/workbench/contrib/snippets/browser/snippetsService.ts index 11cbeea9c87..241f485ed28 100644 --- a/src/vs/workbench/contrib/snippets/browser/snippetsService.ts +++ b/src/vs/workbench/contrib/snippets/browser/snippetsService.ts @@ -127,7 +127,7 @@ function watch(service: IFileService, resource: URI, callback: (type: FileChange class SnippetsService implements ISnippetsService { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private readonly _disposables = new DisposableStore(); private readonly _pendingWork: Promise[] = []; diff --git a/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts b/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts index 03915648eb4..298f9a71b6c 100644 --- a/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts +++ b/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts @@ -15,7 +15,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo import { CompletionContext, CompletionTriggerKind } from 'vs/editor/common/modes'; class SimpleSnippetService implements ISnippetsService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(readonly snippets: Snippet[]) { } getSnippets() { diff --git a/src/vs/workbench/contrib/stats/common/workspaceStats.ts b/src/vs/workbench/contrib/stats/common/workspaceStats.ts index 7bd69fc83cd..c8205e1a076 100644 --- a/src/vs/workbench/contrib/stats/common/workspaceStats.ts +++ b/src/vs/workbench/contrib/stats/common/workspaceStats.ts @@ -12,7 +12,7 @@ export type Tags = { [index: string]: boolean | number | string | undefined }; export const IWorkspaceStatsService = createDecorator('workspaceStatsService'); export interface IWorkspaceStatsService { - _serviceBrand: any; + _serviceBrand: undefined; getTags(): Promise; diff --git a/src/vs/workbench/contrib/stats/electron-browser/workspaceStats.ts b/src/vs/workbench/contrib/stats/electron-browser/workspaceStats.ts index 7457e3b6bcd..e6ca4e0869b 100644 --- a/src/vs/workbench/contrib/stats/electron-browser/workspaceStats.ts +++ b/src/vs/workbench/contrib/stats/electron-browser/workspaceStats.ts @@ -147,7 +147,9 @@ export class WorkspaceStats implements IWorkbenchContribution { @ISharedProcessService private readonly sharedProcessService: ISharedProcessService, @IWorkspaceStatsService private readonly workspaceStatsService: IWorkspaceStatsService ) { - this.report(); + if (this.telemetryService.isOptedIn) { + this.report(); + } } private report(): void { diff --git a/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts b/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts index 2cb249cba47..a597f6e017e 100644 --- a/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts +++ b/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts @@ -90,8 +90,8 @@ const PyModulesToLookFor = [ ]; export class WorkspaceStatsService implements IWorkspaceStatsService { - _serviceBrand: any; - private _tags: Tags; + _serviceBrand: undefined; + private _tags: Tags | undefined; constructor( @IFileService private readonly fileService: IFileService, diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 461797d862c..2f8360d29be 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -173,7 +173,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer private static readonly IgnoreTask010DonotShowAgain_key = 'workbench.tasks.ignoreTask010Shown'; private static CustomizationTelemetryEventName: string = 'taskService.customize'; - public _serviceBrand: any; + public _serviceBrand: undefined; public static OutputChannelId: string = 'tasks'; public static OutputChannelLabel: string = nls.localize('tasks', "Tasks"); @@ -1723,18 +1723,18 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } return entries; }), { - placeHolder, - matchOnDescription: true, - onDidTriggerItemButton: context => { - let task = context.item.task; - this.quickInputService.cancel(); - if (ContributedTask.is(task)) { - this.customize(task, undefined, true); - } else if (CustomTask.is(task)) { - this.openConfig(task); - } + placeHolder, + matchOnDescription: true, + onDidTriggerItemButton: context => { + let task = context.item.task; + this.quickInputService.cancel(); + if (ContributedTask.is(task)) { + this.customize(task, undefined, true); + } else if (CustomTask.is(task)) { + this.openConfig(task); } - }); + } + }); } private showIgnoredFoldersMessage(): Promise { diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index 92d2f493108..d1af7064a55 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -260,6 +260,8 @@ let schema: IJSONSchema = { id: schemaId, description: 'Task definition file', type: 'object', + allowsTrailingCommas: true, + allowComments: true, default: { version: '2.0.0', tasks: [ diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 96148b4e58f..354af731840 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -44,6 +44,7 @@ import { Schemas } from 'vs/base/common/network'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; +import { env as processEnv, cwd as processCwd } from 'vs/base/common/process'; interface TerminalData { terminal: ITerminalInstance; @@ -339,9 +340,7 @@ export class TerminalTaskSystem implements ITaskSystem { private async executeTask(task: Task, resolver: ITaskResolver, trigger: string): Promise { let promises: Promise[] = []; if (task.configurationProperties.dependsOn) { - // tslint:disable-next-line: no-for-in-array - for (let index in task.configurationProperties.dependsOn) { - const dependency = task.configurationProperties.dependsOn[index]; + for (const dependency of task.configurationProperties.dependsOn) { let dependencyTask = resolver.resolve(dependency.workspaceFolder, dependency.task!); if (dependencyTask) { let key = dependencyTask.getMapKey(); @@ -570,7 +569,12 @@ export class TerminalTaskSystem implements ITaskSystem { }); this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.Start, task, terminal.id)); const registeredLinkMatchers = this.registerLinkMatchers(terminal, problemMatchers); + let skipLine: boolean = (!!task.command.presentation && task.command.presentation.echo); const onData = terminal.onLineData((line) => { + if (skipLine) { + skipLine = false; + return; + } watchingProblemMatcher.processLine(line); if (!delayer) { delayer = new Async.Delayer(3000); @@ -648,7 +652,12 @@ export class TerminalTaskSystem implements ITaskSystem { let problemMatchers = this.resolveMatchers(resolver, task.configurationProperties.problemMatchers); let startStopProblemMatcher = new StartStopProblemCollector(problemMatchers, this.markerService, this.modelService, ProblemHandlingStrategy.Clean, this.fileService); const registeredLinkMatchers = this.registerLinkMatchers(terminal, problemMatchers); + let skipLine: boolean = (!!task.command.presentation && task.command.presentation.echo); const onData = terminal.onLineData((line) => { + if (skipLine) { + skipLine = false; + return; + } startStopProblemMatcher.processLine(line); }); promise = new Promise((resolve, reject) => { @@ -1376,8 +1385,7 @@ export class TerminalTaskSystem implements ITaskSystem { return command; } if (cwd === undefined) { - // tslint:disable-next-line: no-nodejs-globals - cwd = process.cwd(); + cwd = processCwd(); } const dir = path.dirname(command); if (dir !== '.') { @@ -1385,10 +1393,8 @@ export class TerminalTaskSystem implements ITaskSystem { // to the current working directory. return path.join(cwd, command); } - // tslint:disable-next-line: no-nodejs-globals - if (paths === undefined && Types.isString(process.env.PATH)) { - // tslint:disable-next-line: no-nodejs-globals - paths = process.env.PATH.split(path.delimiter); + if (paths === undefined && Types.isString(processEnv.PATH)) { + paths = processEnv.PATH.split(path.delimiter); } // No PATH environment. Make path absolute to the cwd. if (paths === undefined || paths.length === 0) { diff --git a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts index f21b1b2bbc2..c80793f83d0 100644 --- a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts +++ b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts @@ -98,7 +98,7 @@ const presentation: IJSONSchema = { showReuseMessage: true, clear: false, }, - description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s ouput and reads its input.'), + description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s output and reads its input.'), additionalProperties: false, properties: { echo: { @@ -481,6 +481,7 @@ tasks.items = { definitionsTaskRunnerConfigurationProperties.inputs = inputsSchema.definitions!.inputs; definitions.commandConfiguration.properties!.isShellCommand = Objects.deepClone(shellCommand); +definitions.commandConfiguration.properties!.args = Objects.deepClone(args); definitions.options.properties!.shell = { $ref: '#/definitions/shellConfiguration' }; diff --git a/src/vs/workbench/contrib/tasks/common/problemMatcher.ts b/src/vs/workbench/contrib/tasks/common/problemMatcher.ts index ec7c7bcbb96..73f8f8f218f 100644 --- a/src/vs/workbench/contrib/tasks/common/problemMatcher.ts +++ b/src/vs/workbench/contrib/tasks/common/problemMatcher.ts @@ -216,11 +216,11 @@ export async function getResource(filename: string, matcher: ProblemMatcher, fil if (fullPath === undefined) { throw new Error('FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.'); } + fullPath = normalize(fullPath); fullPath = fullPath.replace(/\\/g, '/'); if (fullPath[0] !== '/') { fullPath = '/' + fullPath; } - fullPath = normalize(fullPath); if (matcher.uriProvider !== undefined) { return matcher.uriProvider(fullPath); } else { diff --git a/src/vs/workbench/contrib/tasks/common/taskService.ts b/src/vs/workbench/contrib/tasks/common/taskService.ts index b154aed1cbe..ed0b41e5c16 100644 --- a/src/vs/workbench/contrib/tasks/common/taskService.ts +++ b/src/vs/workbench/contrib/tasks/common/taskService.ts @@ -51,7 +51,7 @@ export interface WorkspaceFolderTaskResult extends WorkspaceTaskResult { } export interface ITaskService { - _serviceBrand: any; + _serviceBrand: undefined; onDidStateChange: Event; supportsMultipleTaskExecutions: boolean; diff --git a/src/vs/workbench/contrib/tasks/common/taskTemplates.ts b/src/vs/workbench/contrib/tasks/common/taskTemplates.ts index a0412d55268..c367ede9ab7 100644 --- a/src/vs/workbench/contrib/tasks/common/taskTemplates.ts +++ b/src/vs/workbench/contrib/tasks/common/taskTemplates.ts @@ -27,9 +27,10 @@ const dotnetBuild: TaskEntry = { '\t"tasks": [', '\t\t{', '\t\t\t"label": "build",', - '\t\t\t"command": "dotnet build",', + '\t\t\t"command": "dotnet",', '\t\t\t"type": "shell",', '\t\t\t"args": [', + '\t\t\t\t"build",', '\t\t\t\t// Ask dotnet build to generate full paths for file names.', '\t\t\t\t"/property:GenerateFullPaths=true",', '\t\t\t\t// Do not generate summary otherwise it leads to duplicate errors in Problems panel', diff --git a/src/vs/workbench/contrib/tasks/common/tasks.ts b/src/vs/workbench/contrib/tasks/common/tasks.ts index 49d370e71e0..24d77f427d7 100644 --- a/src/vs/workbench/contrib/tasks/common/tasks.ts +++ b/src/vs/workbench/contrib/tasks/common/tasks.ts @@ -985,15 +985,14 @@ export namespace KeyedTaskIdentifier { function sortedStringify(literal: any): string { const keys = Object.keys(literal).sort(); let result: string = ''; - // tslint:disable-next-line: no-for-in-array - for (let position in keys) { - let stringified = literal[keys[position]]; + for (const key of keys) { + let stringified = literal[key]; if (stringified instanceof Object) { stringified = sortedStringify(stringified); } else if (typeof stringified === 'string') { stringified = stringified.replace(/,/g, ',,'); } - result += keys[position] + ',' + stringified + ','; + result += key + ',' + stringified + ','; } return result; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index 73a8047c940..db587f13986 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -72,17 +72,17 @@ configurationRegistry.registerConfiguration({ type: 'object', properties: { 'terminal.integrated.automationShell.linux': { - markdownDescription: nls.localize('terminal.integrated.automationShell.linux', "A path that when set will override {0} and ignore {1} and {2} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.linux`', '`shellArgs`', '`env`'), + markdownDescription: nls.localize('terminal.integrated.automationShell.linux', "A path that when set will override {0} and ignore {1} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.linux`', '`shellArgs`'), type: ['string', 'null'], default: null }, 'terminal.integrated.automationShell.osx': { - markdownDescription: nls.localize('terminal.integrated.automationShell.osx', "A path that when set will override {0} and ignore {1} and {2} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.osx`', '`shellArgs`', '`env`'), + markdownDescription: nls.localize('terminal.integrated.automationShell.osx', "A path that when set will override {0} and ignore {1} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.osx`', '`shellArgs`'), type: ['string', 'null'], default: null }, 'terminal.integrated.automationShell.windows': { - markdownDescription: nls.localize('terminal.integrated.automationShell.windows', "A path that when set will override {0} and ignore {1} and {2} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.windows`', '`shellArgs`', '`env`'), + markdownDescription: nls.localize('terminal.integrated.automationShell.windows', "A path that when set will override {0} and ignore {1} values for automation-related terminal usage like tasks and debug.", '`terminal.integrated.shell.windows`', '`shellArgs`'), type: ['string', 'null'], default: null }, diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index 42e98f25547..21244047743 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -19,7 +19,7 @@ export const ITerminalInstanceService = createDecorator; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index e4a307e4059..79138f8545a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -17,6 +17,10 @@ import { Emitter, Event } from 'vs/base/common/event'; import { basename } from 'vs/base/common/path'; import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { InstallRecommendedExtensionAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions'; +import { IProductService } from 'vs/platform/product/common/product'; const MINIMUM_FONT_SIZE = 6; const MAXIMUM_FONT_SIZE = 25; @@ -40,7 +44,10 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { @IConfigurationService private readonly _configurationService: IConfigurationService, @IExtensionManagementService private readonly _extensionManagementService: IExtensionManagementService, @INotificationService private readonly _notificationService: INotificationService, - @IStorageService private readonly _storageService: IStorageService + @IStorageService private readonly _storageService: IStorageService, + @ITelemetryService private readonly telemetryService: ITelemetryService, + @IInstantiationService private readonly instantiationService: IInstantiationService, + @IProductService private readonly productService: IProductService ) { this._updateConfig(); this._configurationService.onDidChangeConfiguration(e => { @@ -263,18 +270,42 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { this.recommendationsShown = true; if (platform.isWindows && shellLaunchConfig.executable && basename(shellLaunchConfig.executable).toLowerCase() === 'wsl.exe') { - if (! await this.isExtensionInstalled('ms-vscode-remote.remote-wsl')) { + const exeBasedExtensionTips = this.productService.exeBasedExtensionTips; + if (!exeBasedExtensionTips || !exeBasedExtensionTips.wsl) { + return; + } + const extId = exeBasedExtensionTips.wsl.recommendations[0]; + if (extId && ! await this.isExtensionInstalled(extId)) { this._notificationService.prompt( Severity.Info, nls.localize( - 'useWslExtension.title', - "Check out the 'Visual Studio Code Remote - WSL' extension for a great development experience in WSL. Click [here]({0}) to learn more.", - 'https://go.microsoft.com/fwlink/?linkid=2097212' - ), - [], + 'useWslExtension.title', "The '{0}' extension is recommended for opening a terminal in WSL.", exeBasedExtensionTips.wsl.friendlyName), + [ + { + label: nls.localize('install', 'Install'), + run: () => { + /* __GDPR__ + "terminalLaunchRecommendation:popup" : { + "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" } + } + */ + this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId }); + this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run(); + } + } + ], { sticky: true, - neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE } + neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE }, + onCancel: () => { + /* __GDPR__ + "terminalLaunchRecommendation:popup" : { + "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' }); + } } ); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 9ab3aa21384..c210bb9d05d 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -500,7 +500,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { // Force line data to be sent when the cursor is moved, the main purpose for // this is because ConPTY will often not do a line feed but instead move the // cursor, in which case we still want to send the current line's data to tasks. - xterm.addCsiHandler('H', () => { + xterm.parser.addCsiHandler({ final: 'H' }, () => { this._onCursorMove(); return false; }); @@ -865,7 +865,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { return; } this.focus(); - this._xterm._core._coreService.triggerDataEvent(await this._clipboardService.readText(), true); + this._xterm.paste(await this._clipboardService.readText()); } public write(text: string): void { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstanceService.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstanceService.ts index 8eff2daf466..d00ad6d0f78 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstanceService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstanceService.ts @@ -17,7 +17,7 @@ let WebLinksAddon: typeof XTermWebLinksAddon; let SearchAddon: typeof XTermSearchAddon; export class TerminalInstanceService implements ITerminalInstanceService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _onRequestDefaultShellAndArgs = new Emitter(); public get onRequestDefaultShellAndArgs(): Event { return this._onRequestDefaultShellAndArgs.event; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalNativeService.ts b/src/vs/workbench/contrib/terminal/browser/terminalNativeService.ts index ce98262677e..09b7a5eae37 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalNativeService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalNativeService.ts @@ -9,7 +9,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class TerminalNativeService implements ITerminalNativeService { - public _serviceBrand: any; + public _serviceBrand: undefined; public get linuxDistro(): LinuxDistro { return LinuxDistro.Unknown; } diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index 9d582c1ad67..fc6b1f3faf3 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -218,7 +218,7 @@ export interface IShellLaunchConfig { } export interface ITerminalService { - _serviceBrand: any; + _serviceBrand: undefined; activeTabIndex: number; configHelper: ITerminalConfigHelper; @@ -248,7 +248,7 @@ export interface ITerminalService { /** * Creates a raw terminal instance, this should not be used outside of the terminal part. */ - // tslint:disable-next-line: no-dom-globals + // tslint:disable-next-line: no-dom-globals TODO@daniel createInstance(container: HTMLElement | undefined, shellLaunchConfig: IShellLaunchConfig): ITerminalInstance; getInstanceFromId(terminalId: number): ITerminalInstance | undefined; getInstanceFromIndex(terminalIndex: number): ITerminalInstance; @@ -304,7 +304,7 @@ export interface ITerminalService { * Provides access to native or electron APIs to other terminal services. */ export interface ITerminalNativeService { - _serviceBrand: any; + _serviceBrand: undefined; readonly linuxDistro: LinuxDistro; diff --git a/src/vs/workbench/contrib/terminal/common/terminalService.ts b/src/vs/workbench/contrib/terminal/common/terminalService.ts index 74d2b5728dc..3303cd18301 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalService.ts @@ -30,7 +30,7 @@ interface IExtHostReadyEntry { } export abstract class TerminalService implements ITerminalService { - public _serviceBrand: any; + public _serviceBrand: undefined; protected _isShuttingDown: boolean; protected _terminalFocusContextKey: IContextKey; @@ -568,7 +568,7 @@ export abstract class TerminalService implements ITerminalService { const options: IPickOptions = { placeHolder: nls.localize('terminal.integrated.chooseWindowsShell', "Select your preferred terminal shell, you can change this later in your settings") }; - const quickPickItems = shells.map(s => { + const quickPickItems = shells.map((s): IQuickPickItem => { return { label: s.label, description: s.path }; }); return this._quickInputService.pick(quickPickItems, options).then(async value => { diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts index a7c3813e987..dd0874bfced 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts @@ -27,7 +27,7 @@ let WebLinksAddon: typeof XTermWebLinksAddon; let SearchAddon: typeof XTermSearchAddon; export class TerminalInstanceService implements ITerminalInstanceService { - public _serviceBrand: any; + public _serviceBrand: undefined; constructor( @IInstantiationService private readonly _instantiationService: IInstantiationService, diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts index d8591bc6172..30a6841ac76 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts @@ -17,7 +17,7 @@ import { registerRemoteContributions } from 'vs/workbench/contrib/terminal/node/ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; export class TerminalNativeService implements ITerminalNativeService { - public _serviceBrand: any; + public _serviceBrand: undefined; public get linuxDistro(): LinuxDistro { return linuxDistro; } diff --git a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts index f1984496f23..139d6ea06d7 100644 --- a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts @@ -16,20 +16,20 @@ suite('Workbench - TerminalConfigHelper', () => { fixture = document.body; }); - test('TerminalConfigHelper - getFont fontFamily', function () { - const configurationService = new TestConfigurationService(); - configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); - configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: 'bar' } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); - configHelper.panelContainer = fixture; - assert.equal(configHelper.getFont().fontFamily, 'bar', 'terminal.integrated.fontFamily should be selected over editor.fontFamily'); - }); + // test('TerminalConfigHelper - getFont fontFamily', function () { + // const configurationService = new TestConfigurationService(); + // configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); + // configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: 'bar' } }); + // const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + // configHelper.panelContainer = fixture; + // assert.equal(configHelper.getFont().fontFamily, 'bar', 'terminal.integrated.fontFamily should be selected over editor.fontFamily'); + // }); test('TerminalConfigHelper - getFont fontFamily (Linux Fedora)', function () { const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, '\'DejaVu Sans Mono\', monospace', 'Fedora should have its font overridden when terminal.integrated.fontFamily not set'); }); @@ -38,7 +38,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, '\'Ubuntu Mono\', monospace', 'Ubuntu should have its font overridden when terminal.integrated.fontFamily not set'); }); @@ -47,7 +47,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, 'foo', 'editor.fontFamily should be the fallback when terminal.integrated.fontFamily not set'); }); @@ -65,7 +65,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 10 } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 10, 'terminal.integrated.fontSize should be selected over editor.fontSize'); @@ -78,11 +78,11 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 0 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 8, 'The minimum terminal font size (with adjustment) should be used when terminal.integrated.fontSize less than it'); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 6, 'The minimum terminal font size should be used when terminal.integrated.fontSize less than it'); @@ -95,7 +95,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 1500 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 25, 'The maximum terminal font size should be used when terminal.integrated.fontSize more than it'); @@ -108,11 +108,11 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: null } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize + 2, 'The default editor font size (with adjustment) should be used when terminal.integrated.fontSize is not set'); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize, 'The default editor font size should be used when terminal.integrated.fontSize is not set'); }); @@ -130,7 +130,7 @@ suite('Workbench - TerminalConfigHelper', () => { lineHeight: 2 } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().lineHeight, 2, 'terminal.integrated.lineHeight should be selected over editor.lineHeight'); @@ -144,7 +144,7 @@ suite('Workbench - TerminalConfigHelper', () => { lineHeight: 0 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().lineHeight, 1, 'editor.lineHeight should be 1 when terminal.integrated.lineHeight not set'); }); @@ -157,7 +157,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -169,7 +169,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'sans-serif' } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -181,7 +181,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'serif' } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); @@ -197,7 +197,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -213,7 +213,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -229,8 +229,8 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); -}); \ No newline at end of file +}); diff --git a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts index 1aeea762f4f..a5b8dbedfbd 100644 --- a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts +++ b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts @@ -35,7 +35,7 @@ class MockTerminalInstanceService implements ITerminalInstanceService { getDefaultShellAndArgs(): Promise<{ shell: string; args: string | string[] | undefined; }> { throw new Error('Method not implemented.'); } - _serviceBrand: any; + _serviceBrand: undefined; getXtermConstructor(): Promise { throw new Error('Method not implemented.'); } diff --git a/src/vs/workbench/contrib/update/electron-browser/update.ts b/src/vs/workbench/contrib/update/electron-browser/update.ts index 64d43209612..d429d21347d 100644 --- a/src/vs/workbench/contrib/update/electron-browser/update.ts +++ b/src/vs/workbench/contrib/update/electron-browser/update.ts @@ -119,7 +119,7 @@ export class ProductContribution implements IWorkbenchContribution { @IStorageService storageService: IStorageService, @IInstantiationService instantiationService: IInstantiationService, @INotificationService notificationService: INotificationService, - @IEnvironmentService environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IOpenerService openerService: IOpenerService, @IConfigurationService configurationService: IConfigurationService, @IWindowService windowService: IWindowService, diff --git a/src/vs/workbench/contrib/url/common/url.contribution.ts b/src/vs/workbench/contrib/url/common/url.contribution.ts index 7d8a5f9e8fc..c01181c70c4 100644 --- a/src/vs/workbench/contrib/url/common/url.contribution.ts +++ b/src/vs/workbench/contrib/url/common/url.contribution.ts @@ -14,7 +14,11 @@ import { Action } from 'vs/base/common/actions'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; +import { + IWorkbenchContribution, + IWorkbenchContributionsRegistry, + Extensions as WorkbenchExtensions +} from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IProductService } from 'vs/platform/product/common/product'; @@ -50,23 +54,20 @@ Registry.as(ActionExtensions.WorkbenchActions).registe localize('developer', 'Developer') ); -const VSCODE_DOMAIN = 'https://code.visualstudio.com'; - const configureTrustedDomainsHandler = async ( quickInputService: IQuickInputService, storageService: IStorageService, + linkProtectionTrustedDomains: string[], domainToConfigure?: string ) => { - let trustedDomains: string[] = [VSCODE_DOMAIN]; - try { - const trustedDomainsSrc = storageService.get('http.trustedDomains', StorageScope.GLOBAL); + const trustedDomainsSrc = storageService.get('http.linkProtectionTrustedDomains', StorageScope.GLOBAL); if (trustedDomainsSrc) { - trustedDomains = JSON.parse(trustedDomainsSrc); + linkProtectionTrustedDomains = JSON.parse(trustedDomainsSrc); } } catch (err) { } - const domainQuickPickItems: IQuickPickItem[] = trustedDomains + const domainQuickPickItems: IQuickPickItem[] = linkProtectionTrustedDomains .filter(d => d !== '*') .map(d => { return { @@ -82,12 +83,12 @@ const configureTrustedDomainsHandler = async ( type: 'item', label: localize('openAllLinksWithoutPrompt', 'Open all links without prompt'), id: '*', - picked: trustedDomains.indexOf('*') !== -1 + picked: linkProtectionTrustedDomains.indexOf('*') !== -1 } ]; let domainToConfigureItem: IQuickPickItem | undefined = undefined; - if (domainToConfigure && trustedDomains.indexOf(domainToConfigure) === -1) { + if (domainToConfigure && linkProtectionTrustedDomains.indexOf(domainToConfigure) === -1) { domainToConfigureItem = { type: 'item', label: domainToConfigure, @@ -110,7 +111,7 @@ const configureTrustedDomainsHandler = async ( if (pickedResult) { const pickedDomains: string[] = pickedResult.map(r => r.id!); - storageService.store('http.trustedDomains', JSON.stringify(pickedDomains), StorageScope.GLOBAL); + storageService.store('http.linkProtectionTrustedDomains', JSON.stringify(pickedDomains), StorageScope.GLOBAL); return pickedDomains; } @@ -119,16 +120,21 @@ const configureTrustedDomainsHandler = async ( }; const configureTrustedDomainCommand = { - id: 'workbench.action.configureTrustedDomains', + id: 'workbench.action.configureLinkProtectionTrustedDomains', description: { - description: localize('configureTrustedDomains', 'Configure Trusted Domains'), + description: localize('configureLinkProtectionTrustedDomains', 'Configure Trusted Domains for Link Protection'), args: [{ name: 'domainToConfigure', schema: { type: 'string' } }] }, handler: (accessor: ServicesAccessor, domainToConfigure?: string) => { const quickInputService = accessor.get(IQuickInputService); const storageService = accessor.get(IStorageService); + const productService = accessor.get(IProductService); - return configureTrustedDomainsHandler(quickInputService, storageService, domainToConfigure); + const trustedDomains = productService.linkProtectionTrustedDomains + ? [...productService.linkProtectionTrustedDomains] + : []; + + return configureTrustedDomainsHandler(quickInputService, storageService, trustedDomains, domainToConfigure); } }; @@ -158,9 +164,12 @@ class OpenerValidatorContributions implements IWorkbenchContribution { return true; } - let trustedDomains: string[] = [VSCODE_DOMAIN]; + let trustedDomains: string[] = this._productService.linkProtectionTrustedDomains + ? [...this._productService.linkProtectionTrustedDomains] + : []; + try { - const trustedDomainsSrc = this._storageService.get('http.trustedDomains', StorageScope.GLOBAL); + const trustedDomainsSrc = this._storageService.get('http.linkProtectionTrustedDomains', StorageScope.GLOBAL); if (trustedDomainsSrc) { trustedDomains = JSON.parse(trustedDomainsSrc); } @@ -168,7 +177,7 @@ class OpenerValidatorContributions implements IWorkbenchContribution { const domainToOpen = `${scheme}://${authority}`; - if (isDomainTrusted(domainToOpen, trustedDomains)) { + if (isURLDomainTrusted(resource, trustedDomains)) { return true; } else { const choice = await this._dialogService.show( @@ -195,7 +204,12 @@ class OpenerValidatorContributions implements IWorkbenchContribution { } // Configure Trusted Domains else if (choice === 2) { - const pickedDomains = await configureTrustedDomainsHandler(this._quickInputService, this._storageService, domainToOpen); + const pickedDomains = await configureTrustedDomainsHandler( + this._quickInputService, + this._storageService, + trustedDomains, + domainToOpen + ); if (pickedDomains.indexOf(domainToOpen) !== -1) { return true; } @@ -212,11 +226,28 @@ Registry.as(WorkbenchExtensions.Workbench).regi LifecyclePhase.Restored ); +const rLocalhost = /^localhost(:\d+)?$/i; +const r127 = /^127.0.0.1(:\d+)?$/; + +function isLocalhostAuthority(authority: string) { + return rLocalhost.test(authority) || r127.test(authority); +} + /** * Check whether a domain like https://www.microsoft.com matches * the list of trusted domains. + * + * - Schemes must match + * - There's no subdomain matching. For example https://microsoft.com doesn't match https://www.microsoft.com + * - Star matches all. For example https://*.microsoft.com matches https://www.microsoft.com */ -function isDomainTrusted(domain: string, trustedDomains: string[]) { +export function isURLDomainTrusted(url: URI, trustedDomains: string[]) { + if (isLocalhostAuthority(url.authority)) { + return true; + } + + const domain = `${url.scheme}://${url.authority}`; + for (let i = 0; i < trustedDomains.length; i++) { if (trustedDomains[i] === '*') { return true; @@ -225,6 +256,24 @@ function isDomainTrusted(domain: string, trustedDomains: string[]) { if (trustedDomains[i] === domain) { return true; } + + if (trustedDomains[i].indexOf('*') !== -1) { + const parsedTrustedDomain = URI.parse(trustedDomains[i]); + if (url.scheme === parsedTrustedDomain.scheme) { + const authoritySegments = url.authority.split('.'); + const trustedDomainAuthoritySegments = parsedTrustedDomain.authority.split('.'); + + if (authoritySegments.length === trustedDomainAuthoritySegments.length) { + if ( + authoritySegments.every( + (val, i) => trustedDomainAuthoritySegments[i] === '*' || val === trustedDomainAuthoritySegments[i] + ) + ) { + return true; + } + } + } + } } return false; diff --git a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts b/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts index ead4c72d910..01aa54b6ba2 100644 --- a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts +++ b/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts @@ -3,12 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { memoize } from 'vs/base/common/decorators'; import { Emitter, Event } from 'vs/base/common/event'; import { Disposable, DisposableStore, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; +import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IWebviewService, Webview, WebviewContentOptions, WebviewEditorOverlay, WebviewElement, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; -import { memoize } from 'vs/base/common/decorators'; /** * Webview editor overlay that creates and destroys the underlying webview as needed. @@ -76,6 +77,7 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd webview.onDidFocus(() => { this._onDidFocus.fire(); }, undefined, this._webviewEvents); webview.onDidClickLink(x => { this._onDidClickLink.fire(x); }, undefined, this._webviewEvents); webview.onMessage(x => { this._onMessage.fire(x); }, undefined, this._webviewEvents); + webview.onMissingCsp(x => { this._onMissingCsp.fire(x); }, undefined, this._webviewEvents); webview.onDidScroll(x => { this._initialScrollProgress = x.scrollYPercentage; @@ -132,6 +134,9 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd private readonly _onMessage = this._register(new Emitter()); public readonly onMessage: Event = this._onMessage.event; + private readonly _onMissingCsp = this._register(new Emitter()); + public readonly onMissingCsp: Event = this._onMissingCsp.event; + sendMessage(data: any): void { if (this._webview.value) { this._webview.value.sendMessage(data); diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js index c766b83c114..c97da43b4c5 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/main.js +++ b/src/vs/workbench/contrib/webview/browser/pre/main.js @@ -188,11 +188,6 @@ return; } - // Prevent middle clicks opening a broken link in the browser - if (event.button == 1) { - event.preventDefault(); - } - let baseElement = event.view.document.getElementsByTagName('base')[0]; /** @type {any} */ let node = event.target; @@ -215,6 +210,27 @@ } }; + /** + * @param {MouseEvent} event + */ + const handleAuxClick = (event) => { + // Prevent middle clicks opening a broken link in the browser + if (!event.view || !event.view.document) { + return; + } + + if (event.button === 1) { + let node = /** @type {any} */ (event.target); + while (node) { + if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) { + event.preventDefault(); + break; + } + node = node.parentNode; + } + } + }; + /** * @param {KeyboardEvent} e */ @@ -459,7 +475,8 @@ }); // Bubble out link clicks - newFrame.contentWindow.addEventListener('mousedown', handleInnerClick); + newFrame.contentWindow.addEventListener('click', handleInnerClick); + newFrame.contentWindow.addEventListener('auxclick', handleAuxClick); if (host.onIframeLoaded) { host.onIframeLoaded(newFrame); diff --git a/src/vs/workbench/contrib/webview/browser/webview.ts b/src/vs/workbench/contrib/webview/browser/webview.ts index e7ef6086eaf..eaf2e79f274 100644 --- a/src/vs/workbench/contrib/webview/browser/webview.ts +++ b/src/vs/workbench/contrib/webview/browser/webview.ts @@ -24,7 +24,7 @@ export const IWebviewService = createDecorator('webviewService' * Handles the creation of webview elements. */ export interface IWebviewService { - _serviceBrand: any; + _serviceBrand: undefined; createWebview( id: string, @@ -70,6 +70,7 @@ export interface Webview extends IDisposable { readonly onDidScroll: Event<{ scrollYPercentage: number }>; readonly onDidUpdateState: Event; readonly onMessage: Event; + readonly onMissingCsp: Event; sendMessage(data: any): void; update( diff --git a/src/vs/workbench/contrib/webview/browser/webviewEditor.ts b/src/vs/workbench/contrib/webview/browser/webviewEditor.ts index 33d33303076..791f21b8457 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewEditor.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewEditor.ts @@ -88,9 +88,9 @@ export class WebviewEditor extends BaseEditor { this.withWebview(webview => webview.reload()); } - public layout(_dimension: DOM.Dimension): void { + public layout(dimension: DOM.Dimension): void { if (this.input && this.input instanceof WebviewEditorInput) { - this.synchronizeWebviewContainerDimensions(this.input.webview); + this.synchronizeWebviewContainerDimensions(this.input.webview, dimension); this.input.webview.layout(); } } @@ -114,7 +114,7 @@ export class WebviewEditor extends BaseEditor { } } - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { + protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { const webview = this.input && (this.input as WebviewEditorInput).webview; if (webview) { if (visible) { @@ -136,7 +136,7 @@ export class WebviewEditor extends BaseEditor { super.clearInput(); } - public async setInput(input: WebviewEditorInput, options: EditorOptions, token: CancellationToken): Promise { + public async setInput(input: WebviewEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { if (this.input && this.input instanceof WebviewEditorInput) { this.input.webview.release(this); } @@ -170,17 +170,16 @@ export class WebviewEditor extends BaseEditor { this.trackFocus(input.webview); } - private synchronizeWebviewContainerDimensions(webview: WebviewEditorOverlay) { + private synchronizeWebviewContainerDimensions(webview: WebviewEditorOverlay, dimension?: DOM.Dimension) { const webviewContainer = webview.container; if (webviewContainer && webviewContainer.parentElement && this._editorFrame) { const frameRect = this._editorFrame.getBoundingClientRect(); const containerRect = webviewContainer.parentElement.getBoundingClientRect(); - webviewContainer.style.position = 'absolute'; webviewContainer.style.top = `${frameRect.top - containerRect.top}px`; webviewContainer.style.left = `${frameRect.left - containerRect.left}px`; - webviewContainer.style.width = `${frameRect.width}px`; - webviewContainer.style.height = `${frameRect.height}px`; + webviewContainer.style.width = `${dimension ? dimension.width : frameRect.width}px`; + webviewContainer.style.height = `${dimension ? dimension.height : frameRect.height}px`; } } diff --git a/src/vs/workbench/contrib/webview/browser/webviewEditorService.ts b/src/vs/workbench/contrib/webview/browser/webviewEditorService.ts index 6fdda6cfb1c..2918330cf01 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewEditorService.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewEditorService.ts @@ -16,6 +16,7 @@ import { ACTIVE_GROUP_TYPE, IEditorService, SIDE_GROUP_TYPE } from 'vs/workbench import { RevivedWebviewEditorInput, WebviewEditorInput } from './webviewEditorInput'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; export const IWebviewEditorService = createDecorator('webviewEditorService'); @@ -25,7 +26,7 @@ export interface ICreateWebViewShowOptions { } export interface IWebviewEditorService { - _serviceBrand: any; + _serviceBrand: undefined; createWebview( id: string, @@ -119,7 +120,7 @@ class RevivalPool { } export class WebviewEditorService implements IWebviewEditorService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _revivers = new Set(); private readonly _revivalPool = new RevivalPool(); @@ -146,7 +147,13 @@ export class WebviewEditorService implements IWebviewEditorService { const webview = this.createWebiew(id, extension, options); const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, id, viewType, title, extension, new UnownedDisposable(webview)); - this._editorService.openEditor(webviewInput, { pinned: true, preserveFocus: showOptions.preserveFocus }, showOptions.group); + this._editorService.openEditor(webviewInput, { + pinned: true, + preserveFocus: showOptions.preserveFocus, + // preserve pre 1.38 behaviour to not make group active when preserveFocus: true + // but make sure to restore the editor to fix https://github.com/microsoft/vscode/issues/79633 + activation: showOptions.preserveFocus ? EditorActivation.RESTORE : undefined + }, showOptions.group); return webviewInput; } @@ -156,7 +163,12 @@ export class WebviewEditorService implements IWebviewEditorService { preserveFocus: boolean ): void { if (webview.group === group.id) { - this._editorService.openEditor(webview, { preserveFocus }, webview.group); + this._editorService.openEditor(webview, { + preserveFocus, + // preserve pre 1.38 behaviour to not make group active when preserveFocus: true + // but make sure to restore the editor to fix https://github.com/microsoft/vscode/issues/79633 + activation: preserveFocus ? EditorActivation.RESTORE : undefined + }, webview.group); } else { const groupView = this._editorGroupService.getGroup(webview.group!); if (groupView) { @@ -248,9 +260,9 @@ export class WebviewEditorService implements IWebviewEditorService { enableFindWidget: options.enableFindWidget, retainContextWhenHidden: options.retainContextWhenHidden }, { - ...options, - localResourceRoots: options.localResourceRoots || this.getDefaultLocalResourceRoots(extension), - }); + ...options, + localResourceRoots: options.localResourceRoots || this.getDefaultLocalResourceRoots(extension), + }); } private getDefaultLocalResourceRoots(extension: undefined | { diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts index b18f47f0f96..a7b1d1bd42a 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts @@ -3,20 +3,21 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { addClass, addDisposableListener } from 'vs/base/browser/dom'; import { Emitter } from 'vs/base/common/event'; -import { URI } from 'vs/base/common/uri'; -import { Webview, WebviewContentOptions, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; -import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; -import { IFileService } from 'vs/platform/files/common/files'; import { Disposable } from 'vs/base/common/lifecycle'; -import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewEditorService'; -import { addDisposableListener, addClass } from 'vs/base/browser/dom'; -import { getWebviewThemeData } from 'vs/workbench/contrib/webview/common/themeing'; +import { URI } from 'vs/base/common/uri'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { loadLocalResource } from 'vs/workbench/contrib/webview/common/resourceLoader'; -import { WebviewPortMappingManager } from 'vs/workbench/contrib/webview/common/portMapping'; +import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; +import { IFileService } from 'vs/platform/files/common/files'; import { ITunnelService } from 'vs/platform/remote/common/tunnel'; +import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService'; +import { Webview, WebviewContentOptions, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; +import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewEditorService'; +import { WebviewPortMappingManager } from 'vs/workbench/contrib/webview/common/portMapping'; +import { loadLocalResource } from 'vs/workbench/contrib/webview/common/resourceLoader'; +import { getWebviewThemeData } from 'vs/workbench/contrib/webview/common/themeing'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; interface WebviewContent { readonly html: string; @@ -40,14 +41,14 @@ export class IFrameWebview extends Disposable implements Webview { contentOptions: WebviewContentOptions, @IThemeService themeService: IThemeService, @ITunnelService tunnelService: ITunnelService, - @IEnvironmentService private readonly environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IFileService private readonly fileService: IFileService, @IConfigurationService private readonly _configurationService: IConfigurationService, ) { super(); const useExternalEndpoint = this._configurationService.getValue('webview.experimental.useExternalEndpoint'); - if (typeof environmentService.webviewEndpoint !== 'string' && !useExternalEndpoint) { + if (!useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) { throw new Error('To use iframe based webviews, you must configure `environmentService.webviewEndpoint`'); } @@ -145,7 +146,7 @@ export class IFrameWebview extends Disposable implements Webview { private get endpoint(): string { const useExternalEndpoint = this._configurationService.getValue('webview.experimental.useExternalEndpoint'); - const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.webviewEndpoint!; + const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.options!.webviewEndpoint!; const endpoint = baseEndpoint.replace('{{uuid}}', this.id); if (endpoint[endpoint.length - 1] === '/') { return endpoint.slice(0, endpoint.length - 1); @@ -231,6 +232,10 @@ export class IFrameWebview extends Disposable implements Webview { private readonly _onMessage = this._register(new Emitter()); public readonly onMessage = this._onMessage.event; + private readonly _onMissingCsp = this._register(new Emitter()); + public readonly onMissingCsp = this._onMissingCsp.event; + + sendMessage(data: any): void { this._send('message', data); } diff --git a/src/vs/workbench/contrib/webview/browser/webviewService.ts b/src/vs/workbench/contrib/webview/browser/webviewService.ts index eed1445c492..21333aca8bc 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewService.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewService.ts @@ -10,7 +10,7 @@ import { DynamicWebviewEditorOverlay } from './dynamicWebviewEditorOverlay'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class WebviewService implements IWebviewService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IInstantiationService private readonly _instantiationService: IInstantiationService, diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts index ac65e4df36a..a52dc525f08 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts @@ -13,14 +13,15 @@ import { URI } from 'vs/base/common/uri'; import * as modes from 'vs/editor/common/modes'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IFileService } from 'vs/platform/files/common/files'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ITunnelService } from 'vs/platform/remote/common/tunnel'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService'; +import { Webview, WebviewContentOptions, WebviewOptions, WebviewResourceScheme } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewPortMappingManager } from 'vs/workbench/contrib/webview/common/portMapping'; import { getWebviewThemeData } from 'vs/workbench/contrib/webview/common/themeing'; -import { Webview, WebviewContentOptions, WebviewOptions, WebviewResourceScheme } from 'vs/workbench/contrib/webview/browser/webview'; import { registerFileProtocol } from 'vs/workbench/contrib/webview/electron-browser/webviewProtocols'; import { areWebviewInputOptionsEqual } from '../browser/webviewEditorService'; import { WebviewFindWidget } from '../browser/webviewFindWidget'; @@ -426,6 +427,9 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview { private readonly _onMessage = this._register(new Emitter()); public readonly onMessage = this._onMessage.event; + private readonly _onMissingCsp = this._register(new Emitter()); + public readonly onMissingCsp = this._onMissingCsp.event; + private _send(channel: string, data?: any): void { this._ready .then(() => { @@ -522,7 +526,7 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview { if (this._options.extension && this._options.extension.id) { if (this._environementService.isExtensionDevelopment) { - console.warn(`${this._options.extension.id.value} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`); + this._onMissingCsp.fire(this._options.extension.id); } type TelemetryClassification = { diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewService.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewService.ts index dedb445ab5c..49ec194e743 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewService.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewService.ts @@ -11,7 +11,7 @@ import { IWebviewService, WebviewContentOptions, WebviewEditorOverlay, WebviewEl import { ElectronWebviewBasedWebview } from 'vs/workbench/contrib/webview/electron-browser/webviewElement'; export class ElectronWebviewService implements IWebviewService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IInstantiationService private readonly _instantiationService: IInstantiationService, diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts index 200de4fa5c9..6bcad15f718 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts @@ -6,7 +6,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import * as platform from 'vs/base/common/platform'; import product from 'vs/platform/product/node/product'; import { IOpenerService } from 'vs/platform/opener/common/opener'; @@ -21,7 +21,7 @@ export class GettingStarted implements IWorkbenchContribution { constructor( @IStorageService private readonly storageService: IStorageService, - @IEnvironmentService environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IOpenerService private readonly openerService: IOpenerService ) { diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts index f137c1a6fce..5afb3bb9954 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts @@ -22,8 +22,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; export class TelemetryOptOut implements IWorkbenchContribution { private static TELEMETRY_OPT_OUT_SHOWN = 'workbench.telemetryOptOutShown'; - private privacyUrl: string; - private optOutUrl: string; + private privacyUrl: string | undefined; constructor( @IStorageService storageService: IStorageService, @@ -50,7 +49,6 @@ export class TelemetryOptOut implements IWorkbenchContribution { } storageService.store(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true, StorageScope.GLOBAL); - this.optOutUrl = product.telemetryOptOutUrl; this.privacyUrl = product.privacyStatementUrl || product.telemetryOptOutUrl; if (experimentState && experimentState.state === ExperimentState.Run && telemetryService.isOptedIn) { @@ -58,15 +56,15 @@ export class TelemetryOptOut implements IWorkbenchContribution { return; } - const optOutNotice = localize('telemetryOptOut.optOutNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt out]({1}).", this.privacyUrl, this.optOutUrl); - const optInNotice = localize('telemetryOptOut.optInNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt in]({1}).", this.privacyUrl, this.optOutUrl); + const optOutNotice = localize('telemetryOptOut.optOutNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt out]({1}).", this.privacyUrl, product.telemetryOptOutUrl); + const optInNotice = localize('telemetryOptOut.optInNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt in]({1}).", this.privacyUrl, product.telemetryOptOutUrl); notificationService.prompt( Severity.Info, telemetryService.isOptedIn ? optOutNotice : optInNotice, [{ label: localize('telemetryOptOut.readMore', "Read More"), - run: () => openerService.open(URI.parse(this.optOutUrl)) + run: () => openerService.open(URI.parse(product.telemetryOptOutUrl)) }], { sticky: true } ); diff --git a/src/vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay.ts b/src/vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay.ts index 2cfebd34775..0ba17c87166 100644 --- a/src/vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay.ts +++ b/src/vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay.ts @@ -153,7 +153,7 @@ export class HideWelcomeOverlayAction extends Action { class WelcomeOverlay extends Disposable { private _overlayVisible: IContextKey; - private _overlay: HTMLElement; + private _overlay!: HTMLElement; constructor( @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, diff --git a/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts index 71faece75fd..9a0ed0de114 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts @@ -251,7 +251,7 @@ export class WalkThroughPart extends BaseEditor { this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop + scrollDimensions.height }); } - setInput(input: WalkThroughInput, options: EditorOptions, token: CancellationToken): Promise { + setInput(input: WalkThroughInput, options: EditorOptions | undefined, token: CancellationToken): Promise { if (this.input instanceof WalkThroughInput) { this.saveTextEditorViewState(this.input); } diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index a6836c38075..0d72bef3b42 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -194,7 +194,7 @@ class CodeRendererMain extends Disposable { const signService = new SignService(); serviceCollection.set(ISignService, signService); - const remoteAgentService = this._register(new RemoteAgentService(this.environmentService.configuration, this.environmentService, remoteAuthorityResolverService, signService)); + const remoteAgentService = this._register(new RemoteAgentService(this.environmentService.configuration, this.environmentService, remoteAuthorityResolverService, signService, logService)); serviceCollection.set(IRemoteAgentService, remoteAgentService); // Files diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index 7f13270ca83..da4b46c3991 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -70,12 +70,12 @@ const TextInputActions: IAction[] = [ export class ElectronWindow extends Disposable { - private touchBarMenu?: IMenu; - private touchBarUpdater: RunOnceScheduler; + private touchBarMenu: IMenu | undefined; + private touchBarUpdater: RunOnceScheduler | undefined; private readonly touchBarDisposables = this._register(new DisposableStore()); - private lastInstalledTouchedBar: ICommandAction[][]; + private lastInstalledTouchedBar: ICommandAction[][] | undefined; - private previousConfiguredZoomLevel: number; + private previousConfiguredZoomLevel: number | undefined; private addFoldersScheduler: RunOnceScheduler; private pendingFoldersToAdd: URI[]; @@ -325,24 +325,21 @@ export class ElectronWindow extends Disposable { this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure })); // Root warning - this.lifecycleService.when(LifecyclePhase.Restored).then(() => { - let isAdminPromise: Promise; + this.lifecycleService.when(LifecyclePhase.Restored).then(async () => { + let isAdmin: boolean; if (isWindows) { - isAdminPromise = import('native-is-elevated').then(isElevated => isElevated()); // not using async here due to https://github.com/microsoft/vscode/issues/74321 + isAdmin = (await import('native-is-elevated'))(); } else { - isAdminPromise = Promise.resolve(isRootUser()); + isAdmin = isRootUser(); } - return isAdminPromise.then(isAdmin => { + // Update title + this.titleService.updateProperties({ isAdmin }); - // Update title - this.titleService.updateProperties({ isAdmin }); - - // Show warning message (unix only) - if (isAdmin && !isWindows) { - this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort)); - } - }); + // Show warning message (unix only) + if (isAdmin && !isWindows) { + this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort)); + } }); // Touchbar menu (if enabled) @@ -406,7 +403,7 @@ export class ElectronWindow extends Disposable { if (!this.touchBarMenu) { this.touchBarMenu = this.editorService.invokeWithinEditorContext(accessor => this.menuService.createMenu(MenuId.TouchBarContext, accessor.get(IContextKeyService))); this.touchBarDisposables.add(this.touchBarMenu); - this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule())); + this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => this.touchBarUpdater!.schedule())); } const actions: Array = []; diff --git a/src/vs/workbench/services/accessibility/node/accessibilityService.ts b/src/vs/workbench/services/accessibility/node/accessibilityService.ts index 983db9c1e67..ac9bb03fd85 100644 --- a/src/vs/workbench/services/accessibility/node/accessibilityService.ts +++ b/src/vs/workbench/services/accessibility/node/accessibilityService.ts @@ -10,11 +10,10 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { AbstractAccessibilityService } from 'vs/platform/accessibility/common/abstractAccessibilityService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class AccessibilityService extends AbstractAccessibilityService implements IAccessibilityService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _accessibilitySupport = AccessibilitySupport.Unknown; diff --git a/src/vs/workbench/services/activity/browser/activityService.ts b/src/vs/workbench/services/activity/browser/activityService.ts index 47aa8030056..496375b3a19 100644 --- a/src/vs/workbench/services/activity/browser/activityService.ts +++ b/src/vs/workbench/services/activity/browser/activityService.ts @@ -11,7 +11,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class ActivityService implements IActivityService { - public _serviceBrand: any; + public _serviceBrand: undefined; constructor( @IPanelService private readonly panelService: IPanelService, diff --git a/src/vs/workbench/services/activity/common/activity.ts b/src/vs/workbench/services/activity/common/activity.ts index 0400cd7a46d..628590befc4 100644 --- a/src/vs/workbench/services/activity/common/activity.ts +++ b/src/vs/workbench/services/activity/common/activity.ts @@ -58,7 +58,7 @@ export class ProgressBadge extends BaseBadge { } export const IActivityService = createDecorator('activityService'); export interface IActivityService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Show activity in the panel for the given panel or in the activitybar for the given viewlet or global action. diff --git a/src/vs/workbench/services/activityBar/browser/activityBarService.ts b/src/vs/workbench/services/activityBar/browser/activityBarService.ts index a3527621d21..e5badcfbb96 100644 --- a/src/vs/workbench/services/activityBar/browser/activityBarService.ts +++ b/src/vs/workbench/services/activityBar/browser/activityBarService.ts @@ -10,7 +10,7 @@ import { IDisposable } from 'vs/base/common/lifecycle'; export const IActivityBarService = createDecorator('activityBarService'); export interface IActivityBarService { - _serviceBrand: any; + _serviceBrand: undefined; /** * Show an activity in a viewlet. diff --git a/src/vs/workbench/services/backup/common/backup.ts b/src/vs/workbench/services/backup/common/backup.ts index 771cba84a18..0f13f6c8a42 100644 --- a/src/vs/workbench/services/backup/common/backup.ts +++ b/src/vs/workbench/services/backup/common/backup.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI } from 'vs/base/common/uri'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ITextBufferFactory, ITextSnapshot } from 'vs/editor/common/model'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { joinPath, relativePath } from 'vs/base/common/resources'; @@ -21,7 +21,7 @@ export interface IResolvedBackup { */ export interface IBackupFileService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Finds out if there are any backups stored. @@ -91,4 +91,4 @@ export interface IBackupFileService { export function toBackupWorkspaceResource(backupWorkspacePath: string, environmentService: IEnvironmentService): URI { return joinPath(environmentService.userRoamingDataHome, relativePath(URI.file(environmentService.userDataPath), URI.file(backupWorkspacePath))!); -} \ No newline at end of file +} diff --git a/src/vs/workbench/services/backup/common/backupFileService.ts b/src/vs/workbench/services/backup/common/backupFileService.ts index 6725c5e2bb9..de81c2b7d58 100644 --- a/src/vs/workbench/services/backup/common/backupFileService.ts +++ b/src/vs/workbench/services/backup/common/backupFileService.ts @@ -19,7 +19,6 @@ import { Schemas } from 'vs/base/common/network'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { VSBuffer } from 'vs/base/common/buffer'; import { TextSnapshotReadable } from 'vs/workbench/services/textfile/common/textfiles'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export interface IBackupFilesModel { resolve(backupRoot: URI): Promise; @@ -106,7 +105,7 @@ export class BackupFilesModel implements IBackupFilesModel { export class BackupFileService implements IBackupFileService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private impl: IBackupFileService; @@ -114,7 +113,7 @@ export class BackupFileService implements IBackupFileService { @IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService, @IFileService protected fileService: IFileService ) { - this.initialize(); + this.impl = this.initialize(); } protected hashPath(resource: URI): string { @@ -123,13 +122,13 @@ export class BackupFileService implements IBackupFileService { return hash(str).toString(16); } - private initialize(): void { + private initialize(): IBackupFileService { const backupWorkspaceResource = this.environmentService.configuration.backupWorkspaceResource; if (backupWorkspaceResource) { - this.impl = new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService); - } else { - this.impl = new InMemoryBackupFileService(this.hashPath); + return new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService); } + + return new InMemoryBackupFileService(this.hashPath); } reinitialize(): void { @@ -188,7 +187,7 @@ class BackupFileServiceImpl implements IBackupFileService { private static readonly PREAMBLE_META_SEPARATOR = ' '; // using a character that is know to be escaped in a URI as separator private static readonly PREAMBLE_MAX_LENGTH = 10000; - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private backupWorkspacePath!: URI; @@ -398,7 +397,7 @@ class BackupFileServiceImpl implements IBackupFileService { export class InMemoryBackupFileService implements IBackupFileService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private backups: Map = new Map(); diff --git a/src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts b/src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts index fff264d6463..671a8064710 100644 --- a/src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts +++ b/src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts @@ -374,7 +374,7 @@ export class BulkEdit { export class BulkEditService implements IBulkEditService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @ILogService private readonly _logService: ILogService, diff --git a/src/vs/workbench/services/commands/common/commandService.ts b/src/vs/workbench/services/commands/common/commandService.ts index f1826cd036a..8bd181690e0 100644 --- a/src/vs/workbench/services/commands/common/commandService.ts +++ b/src/vs/workbench/services/commands/common/commandService.ts @@ -14,7 +14,7 @@ import { timeout } from 'vs/base/common/async'; export class CommandService extends Disposable implements ICommandService { - _serviceBrand: any; + _serviceBrand: undefined; private _extensionHostIsReady: boolean = false; private _starActivation: Promise | null; diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 50ffb6be24c..9e2c2252f90 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -6,7 +6,7 @@ import { URI } from 'vs/base/common/uri'; import { Event, Emitter } from 'vs/base/common/event'; import { ResourceMap } from 'vs/base/common/map'; -import { equals, deepClone } from 'vs/base/common/objects'; +import { equals } from 'vs/base/common/objects'; import { Disposable } from 'vs/base/common/lifecycle'; import { Queue, Barrier } from 'vs/base/common/async'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; @@ -16,13 +16,13 @@ import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides import { Configuration, WorkspaceConfigurationChangeEvent, AllKeysConfigurationChangeEvent } from 'vs/workbench/services/configuration/common/configurationModels'; import { FOLDER_CONFIG_FOLDER_NAME, defaultSettingsSchemaId, userSettingsSchemaId, workspaceSettingsSchemaId, folderSettingsSchemaId, IConfigurationCache, machineSettingsSchemaId, LOCAL_MACHINE_SCOPES } from 'vs/workbench/services/configuration/common/configuration'; import { Registry } from 'vs/platform/registry/common/platform'; -import { IConfigurationRegistry, Extensions, allSettings, windowSettings, resourceSettings, applicationSettings, machineSettings } from 'vs/platform/configuration/common/configurationRegistry'; +import { IConfigurationRegistry, Extensions, allSettings, windowSettings, resourceSettings, applicationSettings, machineSettings, machineOverridableSettings } from 'vs/platform/configuration/common/configurationRegistry'; import { IWorkspaceIdentifier, isWorkspaceIdentifier, IStoredWorkspaceFolder, isStoredWorkspaceFolder, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, IWorkspaceInitializationPayload, isSingleFolderWorkspaceInitializationPayload, ISingleFolderWorkspaceInitializationPayload, IEmptyWorkspaceInitializationPayload, useSlashForPath, getStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ConfigurationEditingService, EditableConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditingService'; import { WorkspaceConfiguration, FolderConfiguration, RemoteUserConfiguration, UserConfiguration } from 'vs/workbench/services/configuration/browser/configuration'; import { JSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditingService'; -import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema'; +import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { isEqual, dirname } from 'vs/base/common/resources'; import { mark } from 'vs/base/common/performance'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; @@ -31,7 +31,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ export class WorkspaceService extends Disposable implements IConfigurationService, IWorkspaceContextService { - public _serviceBrand: any; + public _serviceBrand: undefined; private workspace: Workspace; private completeWorkspaceBarrier: Barrier; @@ -491,6 +491,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic if (this.workspace) { this._configuration.updateDefaultConfiguration(this.defaultConfiguration); if (this.remoteUserConfiguration) { + this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reprocess()); this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reprocess()); } if (this.getWorkbenchState() === WorkbenchState.FOLDER) { @@ -506,29 +507,17 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private registerConfigurationSchemas(): void { if (this.workspace) { const jsonRegistry = Registry.as(JSONExtensions.JSONContribution); - const convertToNotSuggestedProperties = (properties: IJSONSchemaMap): IJSONSchemaMap => { - return Object.keys(properties).reduce((result: IJSONSchemaMap, property) => { - result[property] = deepClone(properties[property]); - result[property].doNotSuggest = true; - return result; - }, {}); - }; - - const unsupportedApplicationSettings = convertToNotSuggestedProperties(applicationSettings.properties); - const unsupportedMachineSettings = convertToNotSuggestedProperties(machineSettings.properties); - const unsupportedRemoteMachineSettings = convertToNotSuggestedProperties(machineSettings.properties); - const allSettingsSchema: IJSONSchema = { properties: allSettings.properties, patternProperties: allSettings.patternProperties, additionalProperties: true }; - const userSettingsSchema: IJSONSchema = this.remoteUserConfiguration ? { properties: { ...applicationSettings.properties, ...unsupportedRemoteMachineSettings, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true } : allSettingsSchema; - const machineSettingsSchema: IJSONSchema = { properties: { ...unsupportedApplicationSettings, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true }; - const workspaceSettingsSchema: IJSONSchema = { properties: { ...unsupportedApplicationSettings, ...unsupportedMachineSettings, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true }; + const allSettingsSchema: IJSONSchema = { properties: allSettings.properties, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true }; + const userSettingsSchema: IJSONSchema = this.remoteUserConfiguration ? { properties: { ...applicationSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true } : allSettingsSchema; + const machineSettingsSchema: IJSONSchema = { properties: { ...machineSettings.properties, ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true }; + const workspaceSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...windowSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true }; jsonRegistry.registerSchema(defaultSettingsSchemaId, allSettingsSchema); jsonRegistry.registerSchema(userSettingsSchemaId, userSettingsSchema); jsonRegistry.registerSchema(machineSettingsSchemaId, machineSettingsSchema); if (WorkbenchState.WORKSPACE === this.getWorkbenchState()) { - const unsupportedWindowSettings = convertToNotSuggestedProperties(windowSettings.properties); - const folderSettingsSchema: IJSONSchema = { properties: { ...unsupportedApplicationSettings, ...unsupportedMachineSettings, ...unsupportedWindowSettings, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true }; + const folderSettingsSchema: IJSONSchema = { properties: { ...machineOverridableSettings.properties, ...resourceSettings.properties }, patternProperties: allSettings.patternProperties, additionalProperties: true, allowsTrailingCommas: true, allowComments: true }; jsonRegistry.registerSchema(workspaceSettingsSchemaId, workspaceSettingsSchema); jsonRegistry.registerSchema(folderSettingsSchemaId, folderSettingsSchema); } else { @@ -724,4 +713,4 @@ export class WorkspaceService extends Disposable implements IConfigurationServic } return null; } -} \ No newline at end of file +} diff --git a/src/vs/workbench/services/configuration/common/configurationEditingService.ts b/src/vs/workbench/services/configuration/common/configurationEditingService.ts index 90b8895fc96..d0458c430a5 100644 --- a/src/vs/workbench/services/configuration/common/configurationEditingService.ts +++ b/src/vs/workbench/services/configuration/common/configurationEditingService.ts @@ -130,7 +130,7 @@ interface ConfigurationEditingOptions extends IConfigurationEditingOptions { export class ConfigurationEditingService { - public _serviceBrand: any; + public _serviceBrand: undefined; private queue: Queue; private remoteSettingsResource: URI | null = null; diff --git a/src/vs/workbench/services/configuration/common/jsonEditing.ts b/src/vs/workbench/services/configuration/common/jsonEditing.ts index df125f412cd..d420c7fba9f 100644 --- a/src/vs/workbench/services/configuration/common/jsonEditing.ts +++ b/src/vs/workbench/services/configuration/common/jsonEditing.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI } from 'vs/base/common/uri'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export const IJSONEditingService = createDecorator('jsonEditingService'); @@ -34,7 +34,7 @@ export interface IJSONValue { export interface IJSONEditingService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; write(resource: URI, value: IJSONValue, save: boolean): Promise; -} \ No newline at end of file +} diff --git a/src/vs/workbench/services/configuration/common/jsonEditingService.ts b/src/vs/workbench/services/configuration/common/jsonEditingService.ts index 9313c53ccb9..74b3363505f 100644 --- a/src/vs/workbench/services/configuration/common/jsonEditingService.ts +++ b/src/vs/workbench/services/configuration/common/jsonEditingService.ts @@ -23,7 +23,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class JSONEditingService implements IJSONEditingService { - public _serviceBrand: any; + public _serviceBrand: undefined; private queue: Queue; diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts index 2a75dca343d..11587ed86d2 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts @@ -185,7 +185,7 @@ suite('ConfigurationEditingService', () => { test('do not notify error', () => { instantiationService.stub(ITextFileService, 'isDirty', true); const target = sinon.stub(); - instantiationService.stub(INotificationService, { prompt: target, _serviceBrand: null!, notify: null!, error: null!, info: null!, warn: null!, status: null! }); + instantiationService.stub(INotificationService, { prompt: target, _serviceBrand: undefined, notify: null!, error: null!, info: null!, warn: null!, status: null! }); return testObject.writeConfiguration(EditableConfigurationTarget.USER_LOCAL, { key: 'configurationEditing.service.testSetting', value: 'value' }, { donotNotifyError: true }) .then(() => assert.fail('Should fail with ERROR_CONFIGURATION_FILE_DIRTY error.'), (error: ConfigurationEditingError) => { diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index b6e9d5d09fa..ffd0eccd172 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -109,7 +109,7 @@ suite('WorkspaceContextService - Folder', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, new DiskFileSystemProvider(new NullLogService()), environmentService)); - workspaceContextService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, new RemoteAgentService({}, environmentService, new RemoteAuthorityResolverService(), new SignService(undefined))); + workspaceContextService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, new RemoteAgentService({}, environmentService, new RemoteAuthorityResolverService(), new SignService(undefined), new NullLogService())); return (workspaceContextService).initialize(convertToWorkspacePayload(URI.file(folderDir))); }); }); @@ -735,6 +735,11 @@ suite('WorkspaceConfigurationService - Folder', () => { 'default': 'isSet', scope: ConfigurationScope.MACHINE }, + 'configurationService.folder.machineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + }, 'configurationService.folder.testSetting': { 'type': 'string', 'default': 'isSet', @@ -787,7 +792,7 @@ suite('WorkspaceConfigurationService - Folder', () => { }); test('defaults', () => { - assert.deepEqual(testObject.getValue('configurationService'), { 'folder': { 'applicationSetting': 'isSet', 'machineSetting': 'isSet', 'testSetting': 'isSet' } }); + assert.deepEqual(testObject.getValue('configurationService'), { 'folder': { 'applicationSetting': 'isSet', 'machineSetting': 'isSet', 'machineOverridableSetting': 'isSet', 'testSetting': 'isSet' } }); }); test('globals override defaults', () => { @@ -815,6 +820,13 @@ suite('WorkspaceConfigurationService - Folder', () => { .then(() => assert.equal(testObject.getValue('configurationService.folder.testSetting'), 'workspaceValue')); }); + test('machine overridable settings override user Settings', () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.machineOverridableSetting": "userValue" }'); + fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.machineOverridableSetting": "workspaceValue" }'); + return testObject.reloadConfiguration() + .then(() => assert.equal(testObject.getValue('configurationService.folder.machineOverridableSetting'), 'workspaceValue')); + }); + test('workspace settings override user settings after defaults are registered ', () => { fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.newSetting": "userValue" }'); fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.newSetting": "workspaceValue" }'); @@ -836,6 +848,28 @@ suite('WorkspaceConfigurationService - Folder', () => { }); }); + test('machine overridable settings override user settings after defaults are registered ', () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.newMachineOverridableSetting": "userValue" }'); + fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.newMachineOverridableSetting": "workspaceValue" }'); + return testObject.reloadConfiguration() + .then(() => { + + configurationRegistry.registerConfiguration({ + 'id': '_test', + 'type': 'object', + 'properties': { + 'configurationService.folder.newMachineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + } + } + }); + + assert.equal(testObject.getValue('configurationService.folder.newMachineOverridableSetting'), 'workspaceValue'); + }); + }); + test('application settings are not read from workspace', () => { fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.applicationSetting": "userValue" }'); fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.applicationSetting": "workspaceValue" }'); @@ -1066,6 +1100,11 @@ suite('WorkspaceConfigurationService-Multiroot', () => { 'default': 'isSet', scope: ConfigurationScope.MACHINE }, + 'configurationService.workspace.machineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + }, 'configurationService.workspace.testResourceSetting': { 'type': 'string', 'default': 'isSet', @@ -1153,6 +1192,26 @@ suite('WorkspaceConfigurationService-Multiroot', () => { }); }); + test('workspace settings override user settings after defaults are registered for machine overridable settings ', () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.workspace.newMachineOverridableSetting": "userValue" }'); + return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, { key: 'settings', value: { 'configurationService.workspace.newMachineOverridableSetting': 'workspaceValue' } }, true) + .then(() => testObject.reloadConfiguration()) + .then(() => { + configurationRegistry.registerConfiguration({ + 'id': '_test', + 'type': 'object', + 'properties': { + 'configurationService.workspace.newMachineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + } + } + }); + assert.equal(testObject.getValue('configurationService.workspace.newMachineOverridableSetting'), 'workspaceValue'); + }); + }); + test('application settings are not read from workspace folder', () => { fs.writeFileSync(globalSettingsFile, '{ "configurationService.workspace.applicationSetting": "userValue" }'); fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.applicationSetting": "workspaceFolderValue" }'); @@ -1227,6 +1286,26 @@ suite('WorkspaceConfigurationService-Multiroot', () => { }); }); + test('machine overridable setting in folder is read after it is registered later', () => { + fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testNewMachineOverridableSetting2": "workspaceFolderValue" }'); + return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, { key: 'settings', value: { 'configurationService.workspace.testNewMachineOverridableSetting2': 'workspaceValue' } }, true) + .then(() => testObject.reloadConfiguration()) + .then(() => { + configurationRegistry.registerConfiguration({ + 'id': '_test', + 'type': 'object', + 'properties': { + 'configurationService.workspace.testNewMachineOverridableSetting2': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + } + } + }); + assert.equal(testObject.getValue('configurationService.workspace.testNewMachineOverridableSetting2', { resource: workspaceContextService.getWorkspace().folders[0].uri }), 'workspaceFolderValue'); + }); + }); + test('inspect', () => { let actual = testObject.inspect('something.missing'); assert.equal(actual.default, undefined); @@ -1467,6 +1546,11 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { 'default': 'isSet', scope: ConfigurationScope.MACHINE }, + 'configurationService.remote.machineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + }, 'configurationService.remote.testSetting': { 'type': 'string', 'default': 'isSet', @@ -1616,6 +1700,52 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'isSet'); }); + test('machine overridable settings in local user settings does not override defaults', async () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.remote.machineOverridableSetting": "globalValue" }'); + registerRemoteFileSystemProvider(); + resolveRemoteEnvironment(); + await initialize(); + assert.equal(testObject.getValue('configurationService.remote.machineOverridableSetting'), 'isSet'); + }); + + test('machine settings in local user settings does not override defaults after defalts are registered ', async () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.remote.newMachineSetting": "userValue" }'); + registerRemoteFileSystemProvider(); + resolveRemoteEnvironment(); + await initialize(); + configurationRegistry.registerConfiguration({ + 'id': '_test', + 'type': 'object', + 'properties': { + 'configurationService.remote.newMachineSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE + } + } + }); + assert.equal(testObject.getValue('configurationService.remote.newMachineSetting'), 'isSet'); + }); + + test('machine overridable settings in local user settings does not override defaults after defalts are registered ', async () => { + fs.writeFileSync(globalSettingsFile, '{ "configurationService.remote.newMachineOverridableSetting": "userValue" }'); + registerRemoteFileSystemProvider(); + resolveRemoteEnvironment(); + await initialize(); + configurationRegistry.registerConfiguration({ + 'id': '_test', + 'type': 'object', + 'properties': { + 'configurationService.remote.newMachineOverridableSetting': { + 'type': 'string', + 'default': 'isSet', + scope: ConfigurationScope.MACHINE_OVERRIDABLE + } + } + }); + assert.equal(testObject.getValue('configurationService.remote.newMachineOverridableSetting'), 'isSet'); + }); + }); function getWorkspaceId(configPath: URI): string { diff --git a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts index 4709a15555b..f5d0b60b07b 100644 --- a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts @@ -55,7 +55,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR if (activeEditor instanceof DiffEditorInput) { activeEditor = activeEditor.modifiedInput; } - const fileResource = toResource(activeEditor, { filterByScheme: Schemas.file }); + const fileResource = toResource(activeEditor, { filterByScheme: [Schemas.file, Schemas.userData] }); if (!fileResource) { return undefined; } diff --git a/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts b/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts index 47281663ce9..5559fd26ea8 100644 --- a/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts +++ b/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts @@ -10,7 +10,7 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; export const IConfigurationResolverService = createDecorator('configurationResolverService'); export interface IConfigurationResolverService { - _serviceBrand: any; + _serviceBrand: undefined; resolve(folder: IWorkspaceFolder | undefined, value: string): string; resolve(folder: IWorkspaceFolder | undefined, value: string[]): string[]; diff --git a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts index a07fb3a264d..b9284cb24ad 100644 --- a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts +++ b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts @@ -29,7 +29,7 @@ export class AbstractVariableResolverService implements IConfigurationResolverSe static VARIABLE_REGEXP = /\$\{(.*?)\}/g; - _serviceBrand: any; + _serviceBrand: undefined; constructor( private _context: IVariableResolveContext, diff --git a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts index dd668c74f6d..49a80b64df0 100644 --- a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts @@ -20,7 +20,6 @@ import * as Types from 'vs/base/common/types'; import { EditorType } from 'vs/editor/common/editorCommon'; import { Selection } from 'vs/editor/common/core/selection'; import { WorkbenchEnvironmentService } from 'vs/workbench/services/environment/node/environmentService'; -import { parseArgs } from 'vs/platform/environment/node/argv'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -492,7 +491,7 @@ suite('Configuration Resolver Service', () => { class MockConfigurationService implements IConfigurationService { - public _serviceBrand: any; + public _serviceBrand: undefined; public serviceId = IConfigurationService; public constructor(private configuration: any = {}) { } public inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getValue(), key), default: getConfigurationValue(this.getValue(), key), user: getConfigurationValue(this.getValue(), key), workspaceFolder: undefined, folder: undefined }; } @@ -519,7 +518,7 @@ class MockConfigurationService implements IConfigurationService { class MockCommandService implements ICommandService { - public _serviceBrand: any; + public _serviceBrand: undefined; public callCount = 0; onWillExecuteCommand = () => Disposable.None; @@ -539,7 +538,7 @@ class MockCommandService implements ICommandService { } class MockQuickInputService implements IQuickInputService { - _serviceBrand: any; + _serviceBrand: undefined; public pick(picks: Promise[]> | QuickPickInput[], options?: IPickOptions & { canPickMany: true }, token?: CancellationToken): Promise; public pick(picks: Promise[]> | QuickPickInput[], options?: IPickOptions & { canPickMany: false }, token?: CancellationToken): Promise; @@ -632,11 +631,7 @@ class MockInputsConfigurationService extends TestConfigurationService { class MockWorkbenchEnvironmentService extends WorkbenchEnvironmentService { - constructor(private env: platform.IProcessEnvironment) { - super(parseArgs(process.argv) as IWindowConfiguration, process.execPath); - } - - get configuration(): IWindowConfiguration { - return { userEnv: this.env } as IWindowConfiguration; + constructor(env: platform.IProcessEnvironment) { + super({ userEnv: env } as IWindowConfiguration, process.execPath); } } diff --git a/src/vs/workbench/services/contextmenu/electron-browser/contextmenuService.ts b/src/vs/workbench/services/contextmenu/electron-browser/contextmenuService.ts index 37d10c4d8fd..410b7e8ed50 100644 --- a/src/vs/workbench/services/contextmenu/electron-browser/contextmenuService.ts +++ b/src/vs/workbench/services/contextmenu/electron-browser/contextmenuService.ts @@ -28,7 +28,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class ContextMenuService extends Disposable implements IContextMenuService { - _serviceBrand: any; + _serviceBrand: undefined; get onDidContextMenu(): Event { return this.impl.onDidContextMenu; } @@ -63,7 +63,7 @@ export class ContextMenuService extends Disposable implements IContextMenuServic class NativeContextMenuService extends Disposable implements IContextMenuService { - _serviceBrand: any; + _serviceBrand: undefined; private _onDidContextMenu = this._register(new Emitter()); readonly onDidContextMenu: Event = this._onDidContextMenu.event; diff --git a/src/vs/workbench/services/credentials/browser/credentialsService.ts b/src/vs/workbench/services/credentials/browser/credentialsService.ts index b7613b9c23c..3bc3637a2b6 100644 --- a/src/vs/workbench/services/credentials/browser/credentialsService.ts +++ b/src/vs/workbench/services/credentials/browser/credentialsService.ts @@ -5,7 +5,6 @@ import { ICredentialsService } from 'vs/workbench/services/credentials/common/credentials'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; export interface ICredentialsProvider { @@ -13,11 +12,12 @@ export interface ICredentialsProvider { setPassword(service: string, account: string, password: string): Promise; deletePassword(service: string, account: string): Promise; findPassword(service: string): Promise; + findCredentials(service: string): Promise>; } export class BrowserCredentialsService implements ICredentialsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private credentialsProvider: ICredentialsProvider; @@ -29,21 +29,25 @@ export class BrowserCredentialsService implements ICredentialsService { } } - async getPassword(service: string, account: string): Promise { + getPassword(service: string, account: string): Promise { return this.credentialsProvider.getPassword(service, account); } - async setPassword(service: string, account: string, password: string): Promise { + setPassword(service: string, account: string, password: string): Promise { return this.credentialsProvider.setPassword(service, account, password); } - async deletePassword(service: string, account: string): Promise { + deletePassword(service: string, account: string): Promise { return this.credentialsProvider.deletePassword(service, account); } - async findPassword(service: string): Promise { + findPassword(service: string): Promise { return this.credentialsProvider.findPassword(service); } + + findCredentials(service: string): Promise> { + return this.credentialsProvider.findCredentials(service); + } } interface ICredential { @@ -56,7 +60,7 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider { static readonly CREDENTIALS_OPENED_KEY = 'credentials.provider'; - private _credentials: ICredential[]; + private _credentials: ICredential[] | undefined; private get credentials(): ICredential[] { if (!this._credentials) { try { @@ -127,6 +131,12 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider { async findPassword(service: string): Promise { return this.doGetPassword(service); } + + async findCredentials(service: string): Promise> { + return this.credentials + .filter(credential => credential.service === service) + .map(({ account, password }) => ({ account, password })); + } } registerSingleton(ICredentialsService, BrowserCredentialsService, true); diff --git a/src/vs/workbench/services/credentials/common/credentials.ts b/src/vs/workbench/services/credentials/common/credentials.ts index 8fa520c374e..6fcb7dffaa0 100644 --- a/src/vs/workbench/services/credentials/common/credentials.ts +++ b/src/vs/workbench/services/credentials/common/credentials.ts @@ -3,16 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export const ICredentialsService = createDecorator('ICredentialsService'); export interface ICredentialsService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; getPassword(service: string, account: string): Promise; setPassword(service: string, account: string, password: string): Promise; deletePassword(service: string, account: string): Promise; findPassword(service: string): Promise; + findCredentials(service: string): Promise>; } diff --git a/src/vs/workbench/services/credentials/node/credentialsService.ts b/src/vs/workbench/services/credentials/node/credentialsService.ts index 1361f169be3..970a5f82034 100644 --- a/src/vs/workbench/services/credentials/node/credentialsService.ts +++ b/src/vs/workbench/services/credentials/node/credentialsService.ts @@ -6,18 +6,11 @@ import { ICredentialsService } from 'vs/workbench/services/credentials/common/credentials'; import { IdleValue } from 'vs/base/common/async'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; - -type KeytarModule = { - getPassword(service: string, account: string): Promise; - setPassword(service: string, account: string, password: string): Promise; - deletePassword(service: string, account: string): Promise; - findPassword(service: string): Promise; -}; +type KeytarModule = typeof import('keytar'); export class KeytarCredentialsService implements ICredentialsService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _keytar = new IdleValue>(() => import('keytar')); @@ -40,6 +33,11 @@ export class KeytarCredentialsService implements ICredentialsService { const keytar = await this._keytar.getValue(); return keytar.findPassword(service); } + + async findCredentials(service: string): Promise> { + const keytar = await this._keytar.getValue(); + return keytar.findCredentials(service); + } } registerSingleton(ICredentialsService, KeytarCredentialsService, true); diff --git a/src/vs/workbench/services/decorations/browser/decorations.ts b/src/vs/workbench/services/decorations/browser/decorations.ts index 063ec4ee52b..214118a2c2c 100644 --- a/src/vs/workbench/services/decorations/browser/decorations.ts +++ b/src/vs/workbench/services/decorations/browser/decorations.ts @@ -40,7 +40,7 @@ export interface IResourceDecorationChangeEvent { export interface IDecorationsService { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; readonly onDidChangeDecorations: Event; diff --git a/src/vs/workbench/services/decorations/browser/decorationsService.ts b/src/vs/workbench/services/decorations/browser/decorationsService.ts index b183a2629d8..7721cb6d802 100644 --- a/src/vs/workbench/services/decorations/browser/decorationsService.ts +++ b/src/vs/workbench/services/decorations/browser/decorationsService.ts @@ -336,7 +336,7 @@ class DecorationProviderWrapper { export class FileDecorationsService implements IDecorationsService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _data = new LinkedList(); private readonly _onDidChangeDecorationsDelayed = new Emitter(); diff --git a/src/vs/workbench/services/dialogs/browser/fileDialogService.ts b/src/vs/workbench/services/dialogs/browser/fileDialogService.ts index 512d28485d8..7e9d2b3763a 100644 --- a/src/vs/workbench/services/dialogs/browser/fileDialogService.ts +++ b/src/vs/workbench/services/dialogs/browser/fileDialogService.ts @@ -23,7 +23,7 @@ import { isWeb } from 'vs/base/common/platform'; export class FileDialogService implements IFileDialogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IWindowService private readonly windowService: IWindowService, diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index 02c36b66e4c..af8d88245d6 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -18,6 +18,7 @@ import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; interface IMassagedMessageBoxOptions { @@ -35,7 +36,7 @@ interface IMassagedMessageBoxOptions { } export class DialogService implements IDialogService { - _serviceBrand: any; + _serviceBrand: undefined; private impl: IDialogService; @@ -45,12 +46,13 @@ export class DialogService implements IDialogService { @ILayoutService layoutService: ILayoutService, @IThemeService themeService: IThemeService, @IWindowService windowService: IWindowService, - @ISharedProcessService sharedProcessService: ISharedProcessService + @ISharedProcessService sharedProcessService: ISharedProcessService, + @IKeybindingService keybindingService: IKeybindingService ) { // Use HTML based dialogs if (configurationService.getValue('workbench.dialogs.customEnabled') === true) { - this.impl = new HTMLDialogService(logService, layoutService, themeService); + this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService); } // Electron dialog service else { @@ -68,7 +70,7 @@ export class DialogService implements IDialogService { class NativeDialogService implements IDialogService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IWindowService private readonly windowService: IWindowService, @@ -187,4 +189,4 @@ class NativeDialogService implements IDialogService { } } -registerSingleton(IDialogService, DialogService, true); \ No newline at end of file +registerSingleton(IDialogService, DialogService, true); diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 22375af730e..f36b9f96a4f 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; -import { IResourceInput, ITextEditorOptions, IEditorOptions } from 'vs/platform/editor/common/editor'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IResourceInput, ITextEditorOptions, IEditorOptions, EditorActivation } from 'vs/platform/editor/common/editor'; import { IEditorInput, IEditor, GroupIdentifier, IFileEditorInput, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, IFileInputFactory, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditor, ITextDiffEditor, ITextSideBySideEditor, toResource, SideBySideEditor } from 'vs/workbench/common/editor'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput'; @@ -19,7 +19,7 @@ import { basename } from 'vs/base/common/resources'; import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { localize } from 'vs/nls'; import { IEditorGroupsService, IEditorGroup, GroupsOrder, IEditorReplacement, GroupChangeKind, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { IResourceEditor, ACTIVE_GROUP_TYPE, SIDE_GROUP_TYPE, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { IResourceEditor, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService, SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Disposable, IDisposable, dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { coalesce } from 'vs/base/common/arrays'; @@ -29,13 +29,14 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { withNullAsUndefined } from 'vs/base/common/types'; -type ICachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput; +type CachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput; +type OpenInEditorGroup = IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE; export class EditorService extends Disposable implements EditorServiceImpl { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; - private static CACHE: ResourceMap = new ResourceMap(); + private static CACHE: ResourceMap = new ResourceMap(); //#region events @@ -216,47 +217,78 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region openEditor() - openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceDiffInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceSideBySideInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, group?: GroupIdentifier): Promise { + openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceInput | IUntitledResourceInput, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceDiffInput, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceSideBySideInput, group?: OpenInEditorGroup): Promise; + async openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | OpenInEditorGroup, group?: OpenInEditorGroup): Promise { + let resolvedGroup: IEditorGroup | undefined; + let candidateGroup: OpenInEditorGroup | undefined; + + let typedEditor: EditorInput | undefined; + let typedOptions: EditorOptions | undefined; // Typed Editor Support if (editor instanceof EditorInput) { - const editorOptions = this.toOptions(optionsOrGroup as IEditorOptions); - const targetGroup = this.findTargetGroup(editor, editorOptions, group); + typedEditor = editor; + typedOptions = this.toOptions(optionsOrGroup as IEditorOptions); - return this.doOpenEditor(targetGroup, editor, editorOptions); + candidateGroup = group; + resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup); } // Untyped Text Editor Support - const textInput = editor; - const typedInput = this.createInput(textInput); - if (typedInput) { - const editorOptions = TextEditorOptions.from(textInput); - const targetGroup = this.findTargetGroup(typedInput, editorOptions, optionsOrGroup as IEditorGroup | GroupIdentifier); + else { + const textInput = editor; + typedEditor = this.createInput(textInput); + if (typedEditor) { + typedOptions = TextEditorOptions.from(textInput); - return this.doOpenEditor(targetGroup, typedInput, editorOptions); + candidateGroup = optionsOrGroup as OpenInEditorGroup; + resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup); + } } - return Promise.resolve(undefined); + if (typedEditor && resolvedGroup) { + if ( + this.editorGroupService.activeGroup !== resolvedGroup && // only if target group is not already active + typedOptions && !typedOptions.inactive && // never for inactive editors + typedOptions.preserveFocus && // only if preserveFocus + typeof typedOptions.activation !== 'number' && // only if activation is not already defined (either true or false) + candidateGroup !== SIDE_GROUP // never for the SIDE_GROUP + ) { + // If the resolved group is not the active one, we typically + // want the group to become active. There are a few cases + // where we stay away from encorcing this, e.g. if the caller + // is already providing `activation`. + // + // Specifically for historic reasons we do not activate a + // group is it is opened as `SIDE_GROUP` with `preserveFocus:true`. + // repeated Alt-clicking of files in the explorer always open + // into the same side group and not cause a group to be created each time. + typedOptions.overwrite({ activation: EditorActivation.ACTIVATE }); + } + + return this.doOpenEditor(resolvedGroup, typedEditor, typedOptions); + } + + return undefined; } - protected doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise { - return group.openEditor(editor, options).then(withNullAsUndefined); + protected async doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise { + return withNullAsUndefined(await group.openEditor(editor, options)); } - private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): IEditorGroup { + private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: OpenInEditorGroup): IEditorGroup { let targetGroup: IEditorGroup | undefined; // Group: Instance of Group if (group && typeof group !== 'number') { - return group; + targetGroup = group; } // Group: Side by Side - if (group === SIDE_GROUP) { + else if (group === SIDE_GROUP) { targetGroup = this.findSideBySideGroup(); } @@ -344,9 +376,9 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region openEditors() - openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - async openEditors(editors: Array, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise { + openEditors(editors: IEditorInputWithOptions[], group?: OpenInEditorGroup): Promise; + openEditors(editors: IResourceEditor[], group?: OpenInEditorGroup): Promise; + async openEditors(editors: Array, group?: OpenInEditorGroup): Promise { // Convert to typed editors and options const typedEditors: IEditorInputWithOptions[] = []; @@ -376,22 +408,20 @@ export class EditorService extends Disposable implements EditorServiceImpl { }); } - // Open in targets + // Open in target groups const result: Promise[] = []; mapGroupToEditors.forEach((editorsWithOptions, group) => { result.push(group.openEditors(editorsWithOptions)); }); - const openedEditors = await Promise.all(result); - - return coalesce(openedEditors); + return coalesce(await Promise.all(result)); } //#endregion //#region isOpen() - isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean { + isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput): boolean { return !!this.doGetOpened(editor); } @@ -399,11 +429,11 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region getOpend() - getOpened(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined { + getOpened(editor: IResourceInput | IUntitledResourceInput): IEditorInput | undefined { return this.doGetOpened(editor); } - private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined { + private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput): IEditorInput | undefined { if (!(editor instanceof EditorInput)) { const resourceInput = editor as IResourceInput | IUntitledResourceInput; if (!resourceInput.resource) { @@ -411,20 +441,8 @@ export class EditorService extends Disposable implements EditorServiceImpl { } } - let groups: IEditorGroup[] = []; - if (typeof group === 'number') { - const groupView = this.editorGroupService.getGroup(group); - if (groupView) { - groups.push(groupView); - } - } else if (group) { - groups.push(group); - } else { - groups = [...this.editorGroupService.groups]; - } - // For each editor group - for (const group of groups) { + for (const group of this.editorGroupService.groups) { // Typed editor if (editor instanceof EditorInput) { @@ -566,7 +584,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { throw new Error('Unknown input type'); } - private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): ICachedEditorInput { + private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): CachedEditorInput { if (EditorService.CACHE.has(resource)) { const input = EditorService.CACHE.get(resource)!; if (input instanceof ResourceEditorInput) { @@ -594,9 +612,8 @@ export class EditorService extends Disposable implements EditorServiceImpl { return input; } - let input: ICachedEditorInput; - // File + let input: CachedEditorInput; if (forceFile /* fix for https://github.com/Microsoft/vscode/issues/48275 */ || this.fileService.canHandleResource(resource)) { input = this.fileInputFactory.createFileInput(resource, encoding, mode, instantiationService); } @@ -618,10 +635,10 @@ export class EditorService extends Disposable implements EditorServiceImpl { return input; } - private toDiffLabel(input: EditorInput): string | null { + private toDiffLabel(input: EditorInput): string | undefined { const res = input.getResource(); if (!res) { - return null; + return undefined; } // Do not try to extract any paths from simple untitled editors @@ -637,7 +654,12 @@ export class EditorService extends Disposable implements EditorServiceImpl { } export interface IEditorOpenHandler { - (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions): Promise; + ( + delegate: (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => Promise, + group: IEditorGroup, + editor: IEditorInput, + options?: IEditorOptions | ITextEditorOptions + ): Promise; } /** @@ -674,7 +696,13 @@ export class DelegatingEditorService extends EditorService { return super.doOpenEditor(group, editor, options); } - const control = await this.editorOpenHandler(group, editor, options); + const control = await this.editorOpenHandler( + (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => super.doOpenEditor(group, editor, options), + group, + editor, + options + ); + if (control) { return control; // the opening was handled, so return early } diff --git a/src/vs/workbench/services/editor/common/editorGroupsService.ts b/src/vs/workbench/services/editor/common/editorGroupsService.ts index a53e5ce507e..f7708c300e8 100644 --- a/src/vs/workbench/services/editor/common/editorGroupsService.ts +++ b/src/vs/workbench/services/editor/common/editorGroupsService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Event } from 'vs/base/common/event'; -import { createDecorator, ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEditorInput, IEditor, GroupIdentifier, IEditorInputWithOptions, CloseDirection, IEditorPartOptions } from 'vs/workbench/common/editor'; import { IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -149,7 +149,7 @@ export const enum EditorsOrder { export interface IEditorGroupsService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * An event for when the active editor group changes. The active editor diff --git a/src/vs/workbench/services/editor/common/editorService.ts b/src/vs/workbench/services/editor/common/editorService.ts index 5664c9c8c45..13825b028f0 100644 --- a/src/vs/workbench/services/editor/common/editorService.ts +++ b/src/vs/workbench/services/editor/common/editorService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IResourceInput, IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IEditorInput, IEditor, GroupIdentifier, IEditorInputWithOptions, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, ITextEditor, ITextDiffEditor, ITextSideBySideEditor } from 'vs/workbench/common/editor'; import { Event } from 'vs/base/common/event'; @@ -46,7 +46,7 @@ export interface IVisibleEditor extends IEditor { export interface IEditorService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Emitted when the currently active editor changes. diff --git a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts index d461e545ddc..ef7125ced08 100644 --- a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts @@ -24,7 +24,7 @@ export class TestEditorControl extends BaseEditor { constructor(@ITelemetryService telemetryService: ITelemetryService) { super('MyFileEditorForEditorGroupService', NullTelemetryService, new TestThemeService(), new TestStorageService()); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { super.setInput(input, options, token); await input.resolve(); diff --git a/src/vs/workbench/services/editor/test/browser/editorService.test.ts b/src/vs/workbench/services/editor/test/browser/editorService.test.ts index 712b8f922b4..f3c781424b3 100644 --- a/src/vs/workbench/services/editor/test/browser/editorService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorService.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { IEditorModel } from 'vs/platform/editor/common/editor'; +import { IEditorModel, EditorActivation } from 'vs/platform/editor/common/editor'; import { URI } from 'vs/base/common/uri'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { EditorInput, EditorOptions, IFileEditorInput, IEditorInput } from 'vs/workbench/common/editor'; @@ -12,7 +12,7 @@ import { workbenchInstantiationService, TestStorageService } from 'vs/workbench/ import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; import { EditorService, DelegatingEditorService } from 'vs/workbench/services/editor/browser/editorService'; -import { IEditorGroup, IEditorGroupsService, GroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IEditorGroup, IEditorGroupsService, GroupDirection, GroupsArrangement } from 'vs/workbench/services/editor/common/editorGroupsService'; import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; @@ -37,7 +37,7 @@ export class TestEditorControl extends BaseEditor { constructor(@ITelemetryService telemetryService: ITelemetryService) { super('MyTestEditorForEditorService', NullTelemetryService, new TestThemeService(), new TestStorageService()); } - async setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { + async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { super.setInput(input, options, token); await input.resolve(); @@ -330,7 +330,7 @@ suite('EditorService', () => { const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource-delegate'), undefined); const delegate = instantiationService.createInstance(DelegatingEditorService); - delegate.setEditorOpenHandler((group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => { + delegate.setEditorOpenHandler((delegate, group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => { assert.strictEqual(input, inp); done(); @@ -408,6 +408,47 @@ suite('EditorService', () => { assert.equal(editor!.group, part.groups[1]); }); + test('editor group activation', async () => { + const partInstantiator = workbenchInstantiationService(); + + const part = partInstantiator.createInstance(EditorPart); + part.create(document.createElement('div')); + part.layout(400, 300); + + const testInstantiationService = partInstantiator.createChild(new ServiceCollection([IEditorGroupsService, part])); + + const service: IEditorService = testInstantiationService.createInstance(EditorService); + + const input1 = testInstantiationService.createInstance(TestEditorInput, URI.parse('my://resource1-openside')); + const input2 = testInstantiationService.createInstance(TestEditorInput, URI.parse('my://resource2-openside')); + + const rootGroup = part.activeGroup; + + await part.whenRestored; + + await service.openEditor(input1, { pinned: true }, rootGroup); + let editor = await service.openEditor(input2, { pinned: true, preserveFocus: true, activation: EditorActivation.ACTIVATE }, SIDE_GROUP); + const sideGroup = editor!.group; + + assert.equal(part.activeGroup, sideGroup); + + editor = await service.openEditor(input1, { pinned: true, preserveFocus: true, activation: EditorActivation.PRESERVE }, rootGroup); + assert.equal(part.activeGroup, sideGroup); + + editor = await service.openEditor(input1, { pinned: true, preserveFocus: true, activation: EditorActivation.ACTIVATE }, rootGroup); + assert.equal(part.activeGroup, rootGroup); + + editor = await service.openEditor(input2, { pinned: true, activation: EditorActivation.PRESERVE }, sideGroup); + assert.equal(part.activeGroup, rootGroup); + + editor = await service.openEditor(input2, { pinned: true, activation: EditorActivation.ACTIVATE }, sideGroup); + assert.equal(part.activeGroup, sideGroup); + + part.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); + editor = await service.openEditor(input1, { pinned: true, preserveFocus: true, activation: EditorActivation.RESTORE }, rootGroup); + assert.equal(part.activeGroup, sideGroup); + }); + test('active editor change / visible editor change events', async function () { const partInstantiator = workbenchInstantiationService(); diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index c61e1974692..6895dee4694 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -5,7 +5,6 @@ import { IWindowConfiguration, IPath, IPathsToWaitFor } from 'vs/platform/windows/common/windows'; import { IExtensionHostDebugParams, IDebugParams, BACKUPS } from 'vs/platform/environment/common/environment'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { URI } from 'vs/base/common/uri'; import { IProcessEnvironment } from 'vs/base/common/platform'; import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; @@ -69,7 +68,7 @@ interface IBrowserWorkbenchEnvironemntConstructionOptions extends IWorkbenchCons export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironmentService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; readonly configuration: IWindowConfiguration = new BrowserWindowConfiguration(); @@ -96,11 +95,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment break: false }; - this.webviewEndpoint = options.webviewEndpoint; this.untitledWorkspacesHome = URI.from({ scheme: Schemas.untitled, path: 'Workspaces' }); if (document && document.location && document.location.search) { - const map = new Map(); const query = document.location.search.substring(1); const vars = query.split('&'); @@ -170,7 +167,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment verbose: boolean; skipGettingStarted: boolean; skipReleaseNotes: boolean; - skipAddToRecentlyOpened: boolean; mainIPCHandle: string; sharedIPCHandle: string; nodeCachedDataDir?: string; @@ -179,16 +175,15 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment disableCrashReporter: boolean; driverHandle?: string; driverVerbose: boolean; - webviewEndpoint?: string; galleryMachineIdResource?: URI; readonly logFile: URI; get webviewResourceRoot(): string { - return this.webviewEndpoint ? this.webviewEndpoint + '/vscode-resource{{resource}}' : 'vscode-resource:{{resource}}'; + return this.options.webviewEndpoint ? `${this.options.webviewEndpoint}/vscode-resource{{resource}}` : 'vscode-resource:{{resource}}'; } get webviewCspSource(): string { - return this.webviewEndpoint ? this.webviewEndpoint : 'vscode-resource:'; + return this.options.webviewEndpoint ? this.options.webviewEndpoint : 'vscode-resource:'; } } diff --git a/src/vs/workbench/services/environment/common/environmentService.ts b/src/vs/workbench/services/environment/common/environmentService.ts index 967ad5e43cf..d0e6e0a5b18 100644 --- a/src/vs/workbench/services/environment/common/environmentService.ts +++ b/src/vs/workbench/services/environment/common/environmentService.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment'; import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api'; import { URI } from 'vs/base/common/uri'; @@ -13,11 +13,21 @@ export const IWorkbenchEnvironmentService = createDecorator; + _serviceBrand: undefined; readonly configuration: IWindowConfiguration; - readonly logFile: URI; - readonly options?: IWorkbenchConstructionOptions; + + readonly logFile: URI; + readonly logExtensionHostCommunication: boolean; + + readonly debugSearch: IDebugParams; + + readonly webviewResourceRoot: string; + readonly webviewCspSource: string; + + readonly skipGettingStarted: boolean | undefined; + readonly skipReleaseNotes: boolean | undefined; + } diff --git a/src/vs/workbench/services/environment/node/environmentService.ts b/src/vs/workbench/services/environment/node/environmentService.ts index 0a46f3fa8e5..24320328eb6 100644 --- a/src/vs/workbench/services/environment/node/environmentService.ts +++ b/src/vs/workbench/services/environment/node/environmentService.ts @@ -3,36 +3,44 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { EnvironmentService, parseSearchPort } from 'vs/platform/environment/node/environmentService'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { memoize } from 'vs/base/common/decorators'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; import { toBackupWorkspaceResource } from 'vs/workbench/services/backup/common/backup'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { join } from 'vs/base/common/path'; +import { IDebugParams } from 'vs/platform/environment/common/environment'; export class WorkbenchEnvironmentService extends EnvironmentService implements IWorkbenchEnvironmentService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; + + readonly webviewResourceRoot = 'vscode-resource:{{resource}}'; + readonly webviewCspSource = 'vscode-resource:'; constructor( - private _configuration: IWindowConfiguration, + readonly configuration: IWindowConfiguration, execPath: string ) { - super(_configuration, execPath); + super(configuration, execPath); - this._configuration.backupWorkspaceResource = this._configuration.backupPath ? toBackupWorkspaceResource(this._configuration.backupPath, this) : undefined; + this.configuration.backupWorkspaceResource = this.configuration.backupPath ? toBackupWorkspaceResource(this.configuration.backupPath, this) : undefined; } - get configuration(): IWindowConfiguration { - return this._configuration; - } + get skipGettingStarted(): boolean { return !!this.args['skip-getting-started']; } + + get skipReleaseNotes(): boolean { return !!this.args['skip-release-notes']; } @memoize get userRoamingDataHome(): URI { return this.appSettingsHome.with({ scheme: Schemas.userData }); } @memoize get logFile(): URI { return URI.file(join(this.logsPath, `renderer${this.configuration.windowId}.log`)); } + + get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; } + + @memoize + get debugSearch(): IDebugParams { return parseSearchPort(this.args, this.isBuilt); } } diff --git a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts b/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts index 3ceb5b20856..903b0122666 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts @@ -24,7 +24,7 @@ const ENABLED_EXTENSIONS_STORAGE_PATH = 'extensionsIdentifiers/enabled'; export class ExtensionEnablementService extends Disposable implements IExtensionEnablementService { - _serviceBrand: any; + _serviceBrand: undefined; private _onEnablementChanged = new Emitter(); public readonly onEnablementChanged: Event = this._onEnablementChanged.event; diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagement.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagement.ts index bd16a2ca85b..88dbaf94d49 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionManagement.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionManagement.ts @@ -19,7 +19,7 @@ export interface IExtensionManagementServer { } export interface IExtensionManagementServerService { - _serviceBrand: any; + _serviceBrand: undefined; readonly localExtensionManagementServer: IExtensionManagementServer | null; readonly remoteExtensionManagementServer: IExtensionManagementServer | null; getExtensionManagementServer(location: URI): IExtensionManagementServer | null; @@ -37,7 +37,7 @@ export const enum EnablementState { export const IExtensionEnablementService = createDecorator('extensionEnablementService'); export interface IExtensionEnablementService { - _serviceBrand: any; + _serviceBrand: undefined; readonly allUserExtensionsDisabled: boolean; @@ -97,7 +97,7 @@ export interface IExtensionRecommendation { export const IExtensionTipsService = createDecorator('extensionTipsService'); export interface IExtensionTipsService { - _serviceBrand: any; + _serviceBrand: undefined; getAllRecommendationsWithReason(): { [id: string]: { reasonId: ExtensionRecommendationReason, reasonText: string }; }; getFileBasedRecommendations(): IExtensionRecommendation[]; getOtherRecommendations(): Promise; diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts index 0a48d2989fb..c626a20c27e 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.ts @@ -15,7 +15,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; export class ExtensionManagementServerService implements IExtensionManagementServerService { - _serviceBrand: any; + _serviceBrand: undefined; readonly localExtensionManagementServer: IExtensionManagementServer | null = null; readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null; diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts index f1831bdbc19..1efb02f782d 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts @@ -22,7 +22,7 @@ import { IDownloadService } from 'vs/platform/download/common/download'; export class ExtensionManagementService extends Disposable implements IExtensionManagementService { - _serviceBrand: any; + _serviceBrand: undefined; readonly onInstallExtension: Event; readonly onDidInstallExtension: Event; diff --git a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts index c3921f17a54..91c7ff07bce 100644 --- a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts +++ b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts @@ -24,7 +24,7 @@ const localExtensionManagementServerAuthority: string = 'vscode-local'; export class ExtensionManagementServerService implements IExtensionManagementServerService { - _serviceBrand: any; + _serviceBrand: undefined; readonly localExtensionManagementServer: IExtensionManagementServer; readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null; diff --git a/src/vs/workbench/services/extensionManagement/test/electron-browser/extensionEnablementService.test.ts b/src/vs/workbench/services/extensionManagement/test/electron-browser/extensionEnablementService.test.ts index 4536a5ad507..7c4c8ad2464 100644 --- a/src/vs/workbench/services/extensionManagement/test/electron-browser/extensionEnablementService.test.ts +++ b/src/vs/workbench/services/extensionManagement/test/electron-browser/extensionEnablementService.test.ts @@ -560,7 +560,7 @@ function aMultiExtensionManagementServerService(instantiationService: TestInstan extensionManagementService: instantiationService.get(IExtensionManagementService) }; return { - _serviceBrand: {}, + _serviceBrand: undefined, localExtensionManagementServer, remoteExtensionManagementServer, getExtensionManagementServer: (location: URI) => { diff --git a/src/vs/workbench/services/extensions/common/abstractExtensionService.ts b/src/vs/workbench/services/extensions/common/abstractExtensionService.ts index 6445a03a6e6..bcfa887b1a4 100644 --- a/src/vs/workbench/services/extensions/common/abstractExtensionService.ts +++ b/src/vs/workbench/services/extensions/common/abstractExtensionService.ts @@ -30,7 +30,7 @@ const NO_OP_VOID_PROMISE = Promise.resolve(undefined); export abstract class AbstractExtensionService extends Disposable implements IExtensionService { - public _serviceBrand: any; + public _serviceBrand: undefined; protected readonly _onDidRegisterExtensions: Emitter = this._register(new Emitter()); public readonly onDidRegisterExtensions = this._onDidRegisterExtensions.event; diff --git a/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts b/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts index f8067e33e0d..44f76d95fd0 100644 --- a/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts +++ b/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts @@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import * as strings from 'vs/base/common/strings'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ExtHostCustomersRegistry } from 'vs/workbench/api/common/extHostCustomers'; import { ExtHostContext, ExtHostExtensionServiceShape, IExtHostContext, MainContext } from 'vs/workbench/api/common/extHost.protocol'; @@ -59,7 +59,7 @@ export class ExtensionHostProcessManager extends Disposable { private readonly _remoteAuthority: string, initialActivationEvents: string[], @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IEnvironmentService private readonly _environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, ) { super(); this._extensionHostProcessFinishedActivateEvents = Object.create(null); diff --git a/src/vs/workbench/services/extensions/common/inactiveExtensionUrlHandler.ts b/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts similarity index 98% rename from src/vs/workbench/services/extensions/common/inactiveExtensionUrlHandler.ts rename to src/vs/workbench/services/extensions/common/extensionUrlHandler.ts index 22f8c02a13c..c8d9d320630 100644 --- a/src/vs/workbench/services/extensions/common/inactiveExtensionUrlHandler.ts +++ b/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts @@ -34,16 +34,16 @@ function isExtensionId(value: string): boolean { return /^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(value); } -export const IExtensionUrlHandler = createDecorator('inactiveExtensionUrlHandler'); +export const IExtensionUrlHandler = createDecorator('extensionUrlHandler'); export interface IExtensionUrlHandler { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; registerExtensionHandler(extensionId: ExtensionIdentifier, handler: IURLHandler): void; unregisterExtensionHandler(extensionId: ExtensionIdentifier): void; } /** - * This class handles URLs which are directed towards inactive extensions. + * This class handles URLs which are directed towards extensions. * If a URL is directed towards an inactive extension, it buffers it, * activates the extension and re-opens the URL once the extension registers * a URL handler. If the extension never registers a URL handler, the urls @@ -53,7 +53,7 @@ export interface IExtensionUrlHandler { */ class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler { - readonly _serviceBrand: any; + readonly _serviceBrand: undefined; private extensionHandlers = new Map(); private uriBuffer = new Map(); diff --git a/src/vs/workbench/services/extensions/common/extensions.ts b/src/vs/workbench/services/extensions/common/extensions.ts index 7c26e61e181..b127082c0c3 100644 --- a/src/vs/workbench/services/extensions/common/extensions.ts +++ b/src/vs/workbench/services/extensions/common/extensions.ts @@ -130,7 +130,7 @@ export interface IResponsiveStateChangeEvent { } export interface IExtensionService { - _serviceBrand: any; + _serviceBrand: undefined; /** * An event emitted when extensions are registered after their extension points got handled. @@ -258,7 +258,7 @@ export function toExtension(extensionDescription: IExtensionDescription): IExten export class NullExtensionService implements IExtensionService { - _serviceBrand: any; + _serviceBrand: undefined; onDidRegisterExtensions: Event = Event.None; onDidChangeExtensionsStatus: Event = Event.None; onDidChangeExtensions: Event = Event.None; diff --git a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts index 47aaf4a22bb..bcb46463c2c 100644 --- a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts +++ b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts @@ -5,7 +5,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { ILabelService } from 'vs/platform/label/common/label'; import { ILogService } from 'vs/platform/log/common/log'; import { connectRemoteAgentExtensionHost, IRemoteExtensionHostStartParams, IConnectionOptions, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection'; @@ -49,7 +49,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH private readonly _initDataProvider: IInitDataProvider, private readonly _socketFactory: ISocketFactory, @IWorkspaceContextService private readonly _contextService: IWorkspaceContextService, - @IEnvironmentService private readonly _environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @ITelemetryService private readonly _telemetryService: ITelemetryService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @ILogService private readonly _logService: ILogService, @@ -79,7 +79,8 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH return { host: authority.host, port: authority.port }; } }, - signService: this._signService + signService: this._signService, + logService: this._logService }; return this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority).then((resolverResult) => { diff --git a/src/vs/workbench/services/extensions/common/staticExtensions.ts b/src/vs/workbench/services/extensions/common/staticExtensions.ts index 06f102534d1..8eebb7aa782 100644 --- a/src/vs/workbench/services/extensions/common/staticExtensions.ts +++ b/src/vs/workbench/services/extensions/common/staticExtensions.ts @@ -4,23 +4,27 @@ *--------------------------------------------------------------------------------------------*/ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IExtensionDescription, IExtensionManifest, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; -import { UriComponents, URI } from 'vs/base/common/uri'; +import { IExtensionDescription, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; +import { URI } from 'vs/base/common/uri'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; export const IStaticExtensionsService = createDecorator('IStaticExtensionsService'); export interface IStaticExtensionsService { - _serviceBrand: any; + _serviceBrand: undefined; getExtensions(): Promise; } export class StaticExtensionsService implements IStaticExtensionsService { - _serviceBrand: any; + _serviceBrand: undefined; private readonly _descriptions: IExtensionDescription[] = []; - constructor(staticExtensions: { packageJSON: IExtensionManifest, extensionLocation: UriComponents }[]) { + constructor(@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService) { + const staticExtensions = environmentService.options && Array.isArray(environmentService.options.staticExtensions) ? environmentService.options.staticExtensions : []; + this._descriptions = staticExtensions.map(data => { identifier: new ExtensionIdentifier(`${data.packageJSON.publisher}.${data.packageJSON.name}`), extensionLocation: URI.revive(data.extensionLocation), @@ -32,3 +36,5 @@ export class StaticExtensionsService implements IStaticExtensionsService { return this._descriptions; } } + +registerSingleton(IStaticExtensionsService, StaticExtensionsService, true); diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index b8c267ab590..32a6d126e73 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -484,7 +484,14 @@ export class ExtensionService extends AbstractExtensionService implements IExten } // fetch the remote environment - const remoteEnv = (await this._remoteAgentService.getEnvironment())!; + const remoteEnv = (await this._remoteAgentService.getEnvironment()); + + if (!remoteEnv) { + this._notificationService.notify({ severity: Severity.Error, message: nls.localize('getEnvironmentFailure', "Could not fetch remote environment") }); + // Proceed with the local extension host + await this._startLocalExtensionHost(extensionHost, localExtensions, localExtensions.map(extension => extension.identifier)); + return; + } // enable or disable proposed API per extension this._checkEnableProposedApi(remoteEnv.extensions); diff --git a/src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts b/src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts index f94d89adb16..f0ce35d8a34 100644 --- a/src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts +++ b/src/vs/workbench/services/extensions/electron-browser/remoteExtensionManagementIpc.ts @@ -22,7 +22,7 @@ import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagemen export class RemoteExtensionManagementChannelClient extends ExtensionManagementChannelClient { - _serviceBrand: any; + _serviceBrand: undefined; constructor( channel: IChannel, diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts index 8b5028acac6..6d31b177aca 100644 --- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts +++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts @@ -7,9 +7,9 @@ import * as nativeWatchdog from 'native-watchdog'; import * as net from 'net'; import * as minimist from 'vscode-minimist'; import { onUnexpectedError } from 'vs/base/common/errors'; -import { Event, Emitter } from 'vs/base/common/event'; +import { Event } from 'vs/base/common/event'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; -import { PersistentProtocol, ProtocolConstants, createBufferedEvent } from 'vs/base/parts/ipc/common/ipc.net'; +import { PersistentProtocol, ProtocolConstants, BufferedEmitter } from 'vs/base/parts/ipc/common/ipc.net'; import { NodeSocket, WebSocketNodeSocket } from 'vs/base/parts/ipc/node/ipc.net'; import product from 'vs/platform/product/node/product'; import { IInitData } from 'vs/workbench/api/common/extHost.protocol'; @@ -164,8 +164,8 @@ async function createExtHostProtocol(): Promise { return new class implements IMessagePassingProtocol { - private readonly _onMessage = new Emitter(); - readonly onMessage: Event = createBufferedEvent(this._onMessage.event); + private readonly _onMessage = new BufferedEmitter(); + readonly onMessage: Event = this._onMessage.event; private _terminating: boolean; diff --git a/src/vs/workbench/services/extensions/node/extensionPoints.ts b/src/vs/workbench/services/extensions/node/extensionPoints.ts index 8abe6aa7f52..4d08f7645a0 100644 --- a/src/vs/workbench/services/extensions/node/extensionPoints.ts +++ b/src/vs/workbench/services/extensions/node/extensionPoints.ts @@ -49,15 +49,18 @@ class ExtensionManifestParser extends ExtensionManifestHandler { public parse(): Promise { return pfs.readFile(this._absoluteManifestPath).then((manifestContents) => { - try { - const manifest = JSON.parse(manifestContents.toString()); + const errors: json.ParseError[] = []; + const manifest = json.parse(manifestContents.toString(), errors); + if (errors.length === 0) { if (manifest.__metadata) { manifest.uuid = manifest.__metadata.id; } delete manifest.__metadata; return manifest; - } catch (e) { - this._log.error(this._absoluteFolderPath, nls.localize('jsonParseFail', "Failed to parse {0}: {1}.", this._absoluteManifestPath, getParseErrorMessage(e.message))); + } else { + errors.forEach(e => { + this._log.error(this._absoluteFolderPath, nls.localize('jsonParseFail', "Failed to parse {0}: [{1}, {2}] {3}.", this._absoluteManifestPath, e.offset, e.length, getParseErrorMessage(e.error))); + }); } return null; }, (err) => { diff --git a/src/vs/workbench/services/extensions/node/proxyResolver.ts b/src/vs/workbench/services/extensions/node/proxyResolver.ts index 12a6e3ea66a..64c2e0a526e 100644 --- a/src/vs/workbench/services/extensions/node/proxyResolver.ts +++ b/src/vs/workbench/services/extensions/node/proxyResolver.ts @@ -469,26 +469,24 @@ async function readCaCertificates() { } async function readWindowsCaCertificates() { - // Not using await to work around minifier bug (https://github.com/microsoft/vscode/issues/79044). - return import('vscode-windows-ca-certs') - .then(winCA => { - let ders: any[] = []; - const store = winCA(); - try { - let der: any; - while (der = store.next()) { - ders.push(der); - } - } finally { - store.done(); - } + const winCA = await import('vscode-windows-ca-certs'); - const certs = new Set(ders.map(derToPem)); - return { - certs: Array.from(certs), - append: true - }; - }); + let ders: any[] = []; + const store = winCA(); + try { + let der: any; + while (der = store.next()) { + ders.push(der); + } + } finally { + store.done(); + } + + const certs = new Set(ders.map(derToPem)); + return { + certs: Array.from(certs), + append: true + }; } async function readMacCaCertificates() { diff --git a/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts b/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts index 34e3f35a624..3b5706ce76a 100644 --- a/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts +++ b/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts @@ -12,18 +12,36 @@ import { ExtensionHostMain } from 'vs/workbench/services/extensions/common/exten import { IHostUtils } from 'vs/workbench/api/common/extHostExtensionService'; import 'vs/workbench/services/extensions/worker/extHost.services'; -// worker-self +//#region --- Define, capture, and override some globals +//todo@joh do not allow extensions to call postMessage and other globals... + +// declare WorkerSelf#postMessage +declare function postMessage(data: any, transferables?: Transferable[]): void; + declare namespace self { - function close(): void; + let close: any; + let postMessage: any; + let addEventLister: any; + let indexedDB: { open: any, [k: string]: any }; + let caches: { open: any, [k: string]: any }; } -// do not allow extensions to call terminate const nativeClose = self.close.bind(self); -self.close = () => console.trace('An extension called terminate and this was prevented'); -let onTerminate = nativeClose; +self.close = () => console.trace(`'close' has been blocked`); + +const nativePostMessage = postMessage.bind(self); +self.postMessage = () => console.trace(`'postMessage' has been blocked`); + +const nativeAddEventLister = addEventListener.bind(self); +self.addEventLister = () => console.trace(`'addEventListener' has been blocked`); + +self.indexedDB.open = () => console.trace(`'indexedDB.open' has been blocked`); +self.caches.open = () => console.trace(`'indexedDB.caches' has been blocked`); + +//#endregion --- const hostUtil = new class implements IHostUtils { - _serviceBrand: any; + _serviceBrand: undefined; exit(_code?: number | undefined): void { nativeClose(); } @@ -35,7 +53,6 @@ const hostUtil = new class implements IHostUtils { } }; -//todo@joh do not allow extensions to call postMessage and other globals... class ExtensionWorker { @@ -47,7 +64,8 @@ class ExtensionWorker { let emitter = new Emitter(); let terminating = false; - onmessage = event => { + + nativeAddEventLister('message', event => { const { data } = event; if (!(data instanceof ArrayBuffer)) { console.warn('UNKNOWN data received', data); @@ -64,14 +82,14 @@ class ExtensionWorker { // emit non-terminate messages to the outside emitter.fire(msg); - }; + }); this.protocol = { onMessage: emitter.event, send: vsbuf => { if (!terminating) { const data = vsbuf.buffer.buffer.slice(vsbuf.buffer.byteOffset, vsbuf.buffer.byteOffset + vsbuf.buffer.byteLength); - postMessage(data, [data]); + nativePostMessage(data, [data]); } } }; @@ -94,6 +112,8 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise; + _serviceBrand: undefined; private static readonly STORAGE_KEY = 'history.entries'; private static readonly MAX_HISTORY_ITEMS = 200; @@ -120,9 +120,8 @@ export class HistoryService extends Disposable implements IHistoryService { private lastEditLocation: IStackEntry | undefined; - private history: Array; + private history: Array | undefined; private recentlyClosedFiles: IRecentlyClosedFile[]; - private loaded: boolean; private resourceFilter: ResourceGlobMatcher; private fileInputFactory: IFileInputFactory; @@ -155,7 +154,6 @@ export class HistoryService extends Disposable implements IHistoryService { this.lastIndex = -1; this.stack = []; this.recentlyClosedFiles = []; - this.loaded = false; this.resourceFilter = this._register(instantiationService.createInstance( ResourceGlobMatcher, (root?: URI) => this.getExcludes(root), @@ -489,17 +487,17 @@ export class HistoryService extends Disposable implements IHistoryService { return; } - this.ensureHistoryLoaded(); + const history = this.ensureHistoryLoaded(); const historyInput = this.preferResourceInput(input); // Remove any existing entry and add to the beginning this.removeFromHistory(input); - this.history.unshift(historyInput); + history.unshift(historyInput); // Respect max entries setting - if (this.history.length > HistoryService.MAX_HISTORY_ITEMS) { - this.clearOnEditorDispose(this.history.pop()!, this.editorHistoryListeners); + if (history.length > HistoryService.MAX_HISTORY_ITEMS) { + this.clearOnEditorDispose(history.pop()!, this.editorHistoryListeners); } // Remove this from the history unless the history input is a resource @@ -555,9 +553,9 @@ export class HistoryService extends Disposable implements IHistoryService { } private removeExcludedFromHistory(): void { - this.ensureHistoryLoaded(); + const history = this.ensureHistoryLoaded(); - this.history = this.history.filter(e => { + this.history = history.filter(e => { const include = this.include(e); // Cleanup any listeners associated with the input when removing from history @@ -570,9 +568,9 @@ export class HistoryService extends Disposable implements IHistoryService { } private removeFromHistory(arg1: IEditorInput | IResourceInput | FileChangesEvent): void { - this.ensureHistoryLoaded(); + const history = this.ensureHistoryLoaded(); - this.history = this.history.filter(e => { + this.history = history.filter(e => { const matches = this.matches(arg1, e); // Cleanup any listeners associated with the input when removing from history @@ -849,17 +847,17 @@ export class HistoryService extends Disposable implements IHistoryService { } getHistory(): Array { - this.ensureHistoryLoaded(); + const history = this.ensureHistoryLoaded(); - return this.history.slice(0); + return history.slice(0); } - private ensureHistoryLoaded(): void { - if (!this.loaded) { - this.loadHistory(); + private ensureHistoryLoaded(): Array { + if (!this.history) { + this.history = this.loadHistory(); } - this.loaded = true; + return this.history; } private saveState(): void { @@ -893,7 +891,7 @@ export class HistoryService extends Disposable implements IHistoryService { this.storageService.store(HistoryService.STORAGE_KEY, JSON.stringify(entries), StorageScope.WORKSPACE); } - private loadHistory(): void { + private loadHistory(): Array { let entries: ISerializedEditorHistoryEntry[] = []; const entriesRaw = this.storageService.get(HistoryService.STORAGE_KEY, StorageScope.WORKSPACE); @@ -903,7 +901,7 @@ export class HistoryService extends Disposable implements IHistoryService { const registry = Registry.as(EditorExtensions.EditorInputFactories); - this.history = coalesce(entries.map(entry => { + return coalesce(entries.map(entry => { try { return this.safeLoadHistoryEntry(registry, entry); } catch (error) { diff --git a/src/vs/workbench/services/history/common/history.ts b/src/vs/workbench/services/history/common/history.ts index ac9830923f9..89b3e4a76c0 100644 --- a/src/vs/workbench/services/history/common/history.ts +++ b/src/vs/workbench/services/history/common/history.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IResourceInput } from 'vs/platform/editor/common/editor'; import { IEditorInput } from 'vs/workbench/common/editor'; import { URI } from 'vs/base/common/uri'; @@ -12,7 +12,7 @@ export const IHistoryService = createDecorator('historyService' export interface IHistoryService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Re-opens the last closed editor if any. diff --git a/src/vs/workbench/services/integrity/browser/integrityService.ts b/src/vs/workbench/services/integrity/browser/integrityService.ts index 5ddf9d5b3f9..0d0e5681cef 100644 --- a/src/vs/workbench/services/integrity/browser/integrityService.ts +++ b/src/vs/workbench/services/integrity/browser/integrityService.ts @@ -5,11 +5,10 @@ import { IIntegrityService, IntegrityTestResult } from 'vs/workbench/services/integrity/common/integrity'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class BrowserIntegrityServiceImpl implements IIntegrityService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; async isPure(): Promise { return { isPure: true, proof: [] }; diff --git a/src/vs/workbench/services/integrity/common/integrity.ts b/src/vs/workbench/services/integrity/common/integrity.ts index 37c0fe97ed6..07d34aef076 100644 --- a/src/vs/workbench/services/integrity/common/integrity.ts +++ b/src/vs/workbench/services/integrity/common/integrity.ts @@ -21,7 +21,7 @@ export interface IntegrityTestResult { } export interface IIntegrityService { - _serviceBrand: any; + _serviceBrand: undefined; isPure(): Promise; } diff --git a/src/vs/workbench/services/integrity/node/integrityService.ts b/src/vs/workbench/services/integrity/node/integrityService.ts index 36c80d8c148..e4e84b69c51 100644 --- a/src/vs/workbench/services/integrity/node/integrityService.ts +++ b/src/vs/workbench/services/integrity/node/integrityService.ts @@ -14,7 +14,6 @@ import product from 'vs/platform/product/node/product'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IOpenerService } from 'vs/platform/opener/common/opener'; interface IStorageData { @@ -57,7 +56,7 @@ class IntegrityStorage { export class IntegrityServiceImpl implements IIntegrityService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _storage: IntegrityStorage; private _isPurePromise: Promise; diff --git a/src/vs/workbench/services/keybinding/browser/keybindingService.ts b/src/vs/workbench/services/keybinding/browser/keybindingService.ts index 8fe901128a9..4b96b2cd946 100644 --- a/src/vs/workbench/services/keybinding/browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/browser/keybindingService.ts @@ -602,10 +602,12 @@ let commandsSchemas: IJSONSchema[] = []; let commandsEnum: string[] = []; let commandsEnumDescriptions: (string | undefined)[] = []; let schema: IJSONSchema = { - 'id': schemaId, - 'type': 'array', - 'title': nls.localize('keybindings.json.title', "Keybindings configuration"), - 'definitions': { + id: schemaId, + type: 'array', + title: nls.localize('keybindings.json.title', "Keybindings configuration"), + allowsTrailingCommas: true, + allowComments: true, + definitions: { 'editorGroupsSchema': { 'type': 'array', 'items': { @@ -623,7 +625,7 @@ let schema: IJSONSchema = { } } }, - 'items': { + items: { 'required': ['key'], 'type': 'object', 'defaultSnippets': [{ 'body': { 'key': '$1', 'command': '$2', 'when': '$3' } }], diff --git a/src/vs/workbench/services/keybinding/browser/keymapService.ts b/src/vs/workbench/services/keybinding/browser/keymapService.ts index e3744643efd..988fd218f35 100644 --- a/src/vs/workbench/services/keybinding/browser/keymapService.ts +++ b/src/vs/workbench/services/keybinding/browser/keymapService.ts @@ -495,7 +495,7 @@ class UserKeyboardLayout extends Disposable { } class BrowserKeymapService extends Disposable implements IKeymapService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _onDidChangeKeyboardMapper = new Emitter(); public readonly onDidChangeKeyboardMapper: Event = this._onDidChangeKeyboardMapper.event; diff --git a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts index b3d4e77869f..a267b3a2634 100644 --- a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts +++ b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts @@ -20,7 +20,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IFileService } from 'vs/platform/files/common/files'; -import { ServiceIdentifier, createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding'; import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; @@ -30,7 +30,7 @@ export const IKeybindingEditingService = createDecorator; + _serviceBrand: undefined; editKeybinding(keybindingItem: ResolvedKeybindingItem, key: string, when: string | undefined): Promise; @@ -41,7 +41,7 @@ export interface IKeybindingEditingService { export class KeybindingsEditingService extends Disposable implements IKeybindingEditingService { - public _serviceBrand: any; + public _serviceBrand: undefined; private queue: Queue; private resource: URI = this.environmentService.keybindingsResource; @@ -259,4 +259,4 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding } } -registerSingleton(IKeybindingEditingService, KeybindingsEditingService, true); \ No newline at end of file +registerSingleton(IKeybindingEditingService, KeybindingsEditingService, true); diff --git a/src/vs/workbench/services/keybinding/common/keymapInfo.ts b/src/vs/workbench/services/keybinding/common/keymapInfo.ts index 5282815cd9a..b521f80faa6 100644 --- a/src/vs/workbench/services/keybinding/common/keymapInfo.ts +++ b/src/vs/workbench/services/keybinding/common/keymapInfo.ts @@ -5,7 +5,7 @@ import { Event } from 'vs/base/common/event'; import { isWindows, isLinux } from 'vs/base/common/platform'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { DispatchConfig } from 'vs/workbench/services/keybinding/common/dispatchConfig'; import { IKeyboardMapper } from 'vs/workbench/services/keybinding/common/keyboardMapper'; import { IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding'; @@ -94,7 +94,7 @@ export type IKeyboardLayoutInfo = (IWindowsKeyboardLayoutInfo | ILinuxKeyboardLa export const IKeymapService = createDecorator('keymapService'); export interface IKeymapService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; onDidChangeKeyboardMapper: Event; getKeyboardMapper(dispatchConfig: DispatchConfig): IKeyboardMapper; getCurrentKeyboardLayout(): IKeyboardLayoutInfo | null; diff --git a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts index 475c881af9f..757f632c3a7 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts @@ -132,7 +132,7 @@ export class KeyboardMapperFactory { } class NativeKeymapService extends Disposable implements IKeymapService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _onDidChangeKeyboardMapper = new Emitter(); public readonly onDidChangeKeyboardMapper: Event = this._onDidChangeKeyboardMapper.event; diff --git a/src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts b/src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts index ea71e52756d..410f0ac6644 100644 --- a/src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts +++ b/src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts @@ -78,9 +78,9 @@ suite('keyboardMapper - MAC fallback', () => { test('resolveUserBinding Cmd+[Comma] Cmd+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(false, false, false, true, ScanCode.Comma), - new SimpleKeybinding(false, false, false, true, KeyCode.US_SLASH), - ], + new ScanCodeBinding(false, false, false, true, ScanCode.Comma), + new SimpleKeybinding(false, false, false, true, KeyCode.US_SLASH), + ], [{ label: '⌘, ⌘/', ariaLabel: 'Command+, Command+/', @@ -183,9 +183,9 @@ suite('keyboardMapper - LINUX fallback', () => { test('resolveUserBinding Ctrl+[Comma] Ctrl+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), + ], [{ label: 'Ctrl+, Ctrl+/', ariaLabel: 'Control+, Control+/', @@ -201,8 +201,8 @@ suite('keyboardMapper - LINUX fallback', () => { test('resolveUserBinding Ctrl+[Comma]', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + ], [{ label: 'Ctrl+,', ariaLabel: 'Control+,', diff --git a/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts b/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts index 70eecdb4582..d2d22d10600 100644 --- a/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts +++ b/src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts @@ -752,9 +752,9 @@ suite('keyboardMapper - LINUX de_ch', () => { test('resolveUserBinding Ctrl+[Comma] Ctrl+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), + ], [{ label: 'Ctrl+, Ctrl+Shift+7', ariaLabel: 'Control+, Control+Shift+7', @@ -1135,9 +1135,9 @@ suite('keyboardMapper - LINUX en_us', () => { test('resolveUserBinding Ctrl+[Comma] Ctrl+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), + ], [{ label: 'Ctrl+, Ctrl+/', ariaLabel: 'Control+, Control+/', @@ -1153,8 +1153,8 @@ suite('keyboardMapper - LINUX en_us', () => { test('resolveUserBinding Ctrl+[Comma]', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma) - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma) + ], [{ label: 'Ctrl+,', ariaLabel: 'Control+,', diff --git a/src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts b/src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts index ae393f9bbfa..10e576b7bd7 100644 --- a/src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts +++ b/src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts @@ -280,9 +280,9 @@ suite('keyboardMapper - WINDOWS de_ch', () => { test('resolveUserBinding Ctrl+[Comma] Ctrl+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), + ], [{ label: 'Ctrl+, Ctrl+§', ariaLabel: 'Control+, Control+§', @@ -351,9 +351,9 @@ suite('keyboardMapper - WINDOWS en_us', () => { test('resolveUserBinding Ctrl+[Comma] Ctrl+/', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + new SimpleKeybinding(true, false, false, false, KeyCode.US_SLASH), + ], [{ label: 'Ctrl+, Ctrl+/', ariaLabel: 'Control+, Control+/', @@ -369,8 +369,8 @@ suite('keyboardMapper - WINDOWS en_us', () => { test('resolveUserBinding Ctrl+[Comma]', () => { assertResolveUserBinding( mapper, [ - new ScanCodeBinding(true, false, false, false, ScanCode.Comma), - ], + new ScanCodeBinding(true, false, false, false, ScanCode.Comma), + ], [{ label: 'Ctrl+,', ariaLabel: 'Control+,', diff --git a/src/vs/workbench/services/label/common/labelService.ts b/src/vs/workbench/services/label/common/labelService.ts index a8e2290be22..4f138914750 100644 --- a/src/vs/workbench/services/label/common/labelService.ts +++ b/src/vs/workbench/services/label/common/labelService.ts @@ -6,6 +6,7 @@ import { localize } from 'vs/nls'; import { URI } from 'vs/base/common/uri'; import { IDisposable } from 'vs/base/common/lifecycle'; +import * as paths from 'vs/base/common/path'; import { Event, Emitter } from 'vs/base/common/event'; import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry, IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -91,7 +92,7 @@ class ResourceLabelFormattersHandler implements IWorkbenchContribution { Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ResourceLabelFormattersHandler, LifecyclePhase.Restored); export class LabelService implements ILabelService { - _serviceBrand: any; + _serviceBrand: undefined; private formatters: ResourceLabelFormatter[] = []; private readonly _onDidChangeFormatters = new Emitter(); @@ -128,7 +129,10 @@ export class LabelService implements ILabelService { } getUriLabel(resource: URI, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string { - const formatting = this.findFormatting(resource); + return this.doGetUriLabel(resource, this.findFormatting(resource), options); + } + + private doGetUriLabel(resource: URI, formatting?: ResourceLabelFormatting, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string { if (!formatting) { return getPathLabel(resource.path, this.environmentService, options.relative ? this.contextService : undefined); } @@ -159,6 +163,19 @@ export class LabelService implements ILabelService { return options.endWithSeparator ? this.appendSeparatorIfMissing(label, formatting) : label; } + getUriBasenameLabel(resource: URI): string { + const formatting = this.findFormatting(resource); + const label = this.doGetUriLabel(resource, formatting); + if (formatting) { + switch (formatting.separator) { + case paths.win32.sep: return paths.win32.basename(label); + case paths.posix.sep: return paths.posix.basename(label); + } + } + + return paths.basename(label); + } + getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string { if (IWorkspace.isIWorkspace(workspace)) { const identifier = toWorkspaceIdentifier(workspace); diff --git a/src/vs/workbench/services/label/test/label.test.ts b/src/vs/workbench/services/label/test/label.test.ts index ee4650f4d2b..a0d8af36a20 100644 --- a/src/vs/workbench/services/label/test/label.test.ts +++ b/src/vs/workbench/services/label/test/label.test.ts @@ -33,9 +33,11 @@ suite('URI Label', () => { const uri1 = TestWorkspace.folders[0].uri.with({ path: TestWorkspace.folders[0].uri.path.concat('/a/b/c/d') }); assert.equal(labelService.getUriLabel(uri1, { relative: true }), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d'); assert.equal(labelService.getUriLabel(uri1, { relative: false }), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/a/b/c/d'); + assert.equal(labelService.getUriBasenameLabel(uri1), 'd'); const uri2 = URI.file('c:\\1/2/3'); assert.equal(labelService.getUriLabel(uri2, { relative: false }), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3'); + assert.equal(labelService.getUriBasenameLabel(uri2), '3'); }); test('custom scheme', function () { @@ -51,6 +53,23 @@ suite('URI Label', () => { const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); assert.equal(labelService.getUriLabel(uri1, { relative: false }), 'LABEL//1/2/3/4/5/microsoft.com/END'); + assert.equal(labelService.getUriBasenameLabel(uri1), 'END'); + }); + + test('separator', function () { + labelService.registerFormatter({ + scheme: 'vscode', + formatting: { + label: 'LABEL\\${path}\\${authority}\\END', + separator: '\\', + tildify: true, + normalizeDriveLetter: true + } + }); + + const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); + assert.equal(labelService.getUriLabel(uri1, { relative: false }), 'LABEL\\\\1\\2\\3\\4\\5\\microsoft.com\\END'); + assert.equal(labelService.getUriBasenameLabel(uri1), 'END'); }); test('custom authority', function () { @@ -65,6 +84,7 @@ suite('URI Label', () => { const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); assert.equal(labelService.getUriLabel(uri1, { relative: false }), 'LABEL//1/2/3/4/5/microsoft.com/END'); + assert.equal(labelService.getUriBasenameLabel(uri1), 'END'); }); test('mulitple authority', function () { @@ -96,6 +116,7 @@ suite('URI Label', () => { // Make sure the most specific authority is picked const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); assert.equal(labelService.getUriLabel(uri1, { relative: false }), 'second'); + assert.equal(labelService.getUriBasenameLabel(uri1), 'second'); }); test('custom query', function () { diff --git a/src/vs/workbench/services/layout/browser/layoutService.ts b/src/vs/workbench/services/layout/browser/layoutService.ts index 344c7657de5..ef47e1a1551 100644 --- a/src/vs/workbench/services/layout/browser/layoutService.ts +++ b/src/vs/workbench/services/layout/browser/layoutService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ServiceIdentifier, createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event } from 'vs/base/common/event'; import { MenuBarVisibility } from 'vs/platform/windows/common/windows'; import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; @@ -34,7 +34,7 @@ export interface ILayoutOptions { export interface IWorkbenchLayoutService extends ILayoutService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Emits when the visibility of the title bar changes. @@ -144,6 +144,11 @@ export interface IWorkbenchLayoutService extends ILayoutService { */ setPanelPosition(position: Position): void; + /** + * Gets the maximum possible size for editor. + */ + getMaximumEditorDimensions(): Dimension; + /** * Returns the element that is parent of the workbench element. */ diff --git a/src/vs/workbench/services/notification/common/notificationService.ts b/src/vs/workbench/services/notification/common/notificationService.ts index e701a079c29..552e4e9fc51 100644 --- a/src/vs/workbench/services/notification/common/notificationService.ts +++ b/src/vs/workbench/services/notification/common/notificationService.ts @@ -9,13 +9,12 @@ import { INotificationsModel, NotificationsModel, ChoiceAction } from 'vs/workbe import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { Event } from 'vs/base/common/event'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IAction, Action } from 'vs/base/common/actions'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; export class NotificationService extends Disposable implements INotificationService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private _model: INotificationsModel = this._register(new NotificationsModel()); diff --git a/src/vs/workbench/services/output/common/outputChannelModel.ts b/src/vs/workbench/services/output/common/outputChannelModel.ts index f92624f44e8..f3a8ec8ad94 100644 --- a/src/vs/workbench/services/output/common/outputChannelModel.ts +++ b/src/vs/workbench/services/output/common/outputChannelModel.ts @@ -31,7 +31,7 @@ export interface IOutputChannelModel extends IDisposable { export const IOutputChannelModelService = createDecorator('outputChannelModelService'); export interface IOutputChannelModelService { - _serviceBrand: any; + _serviceBrand: undefined; createOutputChannelModel(id: string, modelUri: URI, mimeType: string, file?: URI): IOutputChannelModel; diff --git a/src/vs/workbench/services/output/common/outputChannelModelService.ts b/src/vs/workbench/services/output/common/outputChannelModelService.ts index 6aceb81e99e..c7a9060afb3 100644 --- a/src/vs/workbench/services/output/common/outputChannelModelService.ts +++ b/src/vs/workbench/services/output/common/outputChannelModelService.ts @@ -7,7 +7,7 @@ import { IOutputChannelModelService, AsbtractOutputChannelModelService } from 'v import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class OutputChannelModelService extends AsbtractOutputChannelModelService implements IOutputChannelModelService { - _serviceBrand: any; + _serviceBrand: undefined; } registerSingleton(IOutputChannelModelService, OutputChannelModelService); diff --git a/src/vs/workbench/services/output/node/outputChannelModelService.ts b/src/vs/workbench/services/output/node/outputChannelModelService.ts index e841597dcac..6e3c6e3e905 100644 --- a/src/vs/workbench/services/output/node/outputChannelModelService.ts +++ b/src/vs/workbench/services/output/node/outputChannelModelService.ts @@ -198,7 +198,7 @@ class DelegatedOutputChannelModel extends Disposable implements IOutputChannelMo export class OutputChannelModelService extends AsbtractOutputChannelModelService implements IOutputChannelModelService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IInstantiationService instantiationService: IInstantiationService, diff --git a/src/vs/workbench/services/panel/common/panelService.ts b/src/vs/workbench/services/panel/common/panelService.ts index 9e957d61747..d686236e30a 100644 --- a/src/vs/workbench/services/panel/common/panelService.ts +++ b/src/vs/workbench/services/panel/common/panelService.ts @@ -5,7 +5,7 @@ import { Event } from 'vs/base/common/event'; import { IPanel } from 'vs/workbench/common/panel'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IBadge } from 'vs/workbench/services/activity/common/activity'; import { IDisposable } from 'vs/base/common/lifecycle'; import { IProgressIndicator } from 'vs/platform/progress/common/progress'; @@ -20,7 +20,7 @@ export interface IPanelIdentifier { export interface IPanelService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; readonly onDidPanelOpen: Event<{ panel: IPanel, focus: boolean }>; readonly onDidPanelClose: Event; diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 1e579f2968b..d5ab502e65b 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -44,7 +44,7 @@ const emptyEditableSettingsContent = '{\n}'; export class PreferencesService extends Disposable implements IPreferencesService { - _serviceBrand: any; + _serviceBrand: undefined; private lastOpenedSettingsInput: PreferencesEditorInput | null = null; @@ -214,7 +214,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic private openSettings2(options?: ISettingsEditorOptions): Promise { const input = this.settingsEditor2Input; - return this.editorGroupService.activeGroup.openEditor(input, options) + return this.editorService.openEditor(input, options ? SettingsEditorOptions.create(options) : undefined) .then(() => this.editorGroupService.activeGroup.activeControl!); } diff --git a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts index 01bf60c346a..39a4fca36bc 100644 --- a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts +++ b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts @@ -160,14 +160,14 @@ export class KeybindingsEditorModel extends EditorModel { return result; } - resolve(editorActionsLabels: Map): Promise { + resolve(actionLabels: Map): Promise { const workbenchActionsRegistry = Registry.as(ActionExtensions.WorkbenchActions); this._keybindingItemsSortedByPrecedence = []; const boundCommands: Map = new Map(); for (const keybinding of this.keybindingsService.getKeybindings()) { if (keybinding.command) { // Skip keybindings without commands - this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, editorActionsLabels)); + this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, actionLabels)); boundCommands.set(keybinding.command, true); } } @@ -175,7 +175,7 @@ export class KeybindingsEditorModel extends EditorModel { const commandsWithDefaultKeybindings = this.keybindingsService.getDefaultKeybindings().map(keybinding => keybinding.command); for (const command of KeybindingResolver.getAllUnboundCommands(boundCommands)) { const keybindingItem = new ResolvedKeybindingItem(undefined, command, null, undefined, commandsWithDefaultKeybindings.indexOf(command) === -1); - this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, editorActionsLabels)); + this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, actionLabels)); } this._keybindingItems = this._keybindingItemsSortedByPrecedence.slice(0).sort((a, b) => KeybindingsEditorModel.compareKeybindingData(a, b)); return Promise.resolve(this); @@ -209,9 +209,9 @@ export class KeybindingsEditorModel extends EditorModel { return a.command.localeCompare(b.command); } - private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, editorActions: Map): IKeybindingItem { + private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, actions: Map): IKeybindingItem { const menuCommand = MenuRegistry.getCommand(command)!; - const editorActionLabel = editorActions.get(command)!; + const editorActionLabel = actions.get(command)!; return { keybinding: keybindingItem.resolvedKeybinding, keybindingItem, @@ -264,13 +264,13 @@ class KeybindingItemMatches { this.commandLabelMatches = keybindingItem.commandLabel ? this.matches(searchValue, keybindingItem.commandLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandLabel, true), words) : null; this.commandDefaultLabelMatches = keybindingItem.commandDefaultLabel ? this.matches(searchValue, keybindingItem.commandDefaultLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandDefaultLabel, true), words) : null; this.sourceMatches = this.matches(searchValue, keybindingItem.source, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.source, true), words); - this.whenMatches = keybindingItem.when ? this.matches(searchValue, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null; + this.whenMatches = keybindingItem.when ? this.matches(null, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null; } this.keybindingMatches = keybindingItem.keybinding ? this.matchesKeybinding(keybindingItem.keybinding, searchValue, keybindingWords, completeMatch) : null; } - private matches(searchValue: string, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null { - let matches = wordFilter(searchValue, wordToMatchAgainst); + private matches(searchValue: string | null, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null { + let matches = searchValue ? wordFilter(searchValue, wordToMatchAgainst) : null; if (!matches) { matches = this.matchesWords(words, wordToMatchAgainst, wordMatchesFilter); } diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 195631aa108..14572bc2df7 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -167,20 +167,12 @@ export class SettingsEditorOptions extends EditorOptions implements ISettingsEdi static create(settings: ISettingsEditorOptions): SettingsEditorOptions { const options = new SettingsEditorOptions(); + options.overwrite(settings); options.target = settings.target; options.folderUri = settings.folderUri; options.query = settings.query; - // IEditorOptions - options.preserveFocus = settings.preserveFocus; - options.forceReload = settings.forceReload; - options.revealIfVisible = settings.revealIfVisible; - options.revealIfOpened = settings.revealIfOpened; - options.pinned = settings.pinned; - options.index = settings.index; - options.inactive = settings.inactive; - return options; } } @@ -191,7 +183,7 @@ export interface IKeybindingsEditorModel extends IPreferencesEditorModel { export const IPreferencesService = createDecorator('preferencesService'); export interface IPreferencesService { - _serviceBrand: any; + _serviceBrand: undefined; userSettingsResource: URI; workspaceSettingsResource: URI | null; diff --git a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts index ee813e14fe5..edcb4902f76 100644 --- a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts +++ b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts @@ -21,7 +21,7 @@ export class PreferencesEditorInput extends SideBySideEditorInput { return PreferencesEditorInput.ID; } - getTitle(verbosity: Verbosity): string | null { + getTitle(verbosity: Verbosity): string | undefined { return this.master.getTitle(verbosity); } } @@ -60,7 +60,7 @@ export class KeybindingsEditorInput extends EditorInput { static readonly ID: string = 'workbench.input.keybindings'; readonly keybindingsModel: KeybindingsEditorModel; - searchOptions: IKeybindingsEditorSearchOptions | null; + searchOptions: IKeybindingsEditorSearchOptions | null = null; constructor(@IInstantiationService instantiationService: IInstantiationService) { super(); diff --git a/src/vs/workbench/services/preferences/common/preferencesModels.ts b/src/vs/workbench/services/preferences/common/preferencesModels.ts index 3e252282711..2f334c3ca5a 100644 --- a/src/vs/workbench/services/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/services/preferences/common/preferencesModels.ts @@ -1028,6 +1028,67 @@ class SettingsContentBuilder { } export function createValidator(prop: IConfigurationPropertySchema): (value: any) => (string | null) { + // Only for array of string + if (prop.type === 'array' && prop.items && !isArray(prop.items) && prop.items.type === 'string') { + const propItems = prop.items; + if (propItems && !isArray(propItems) && propItems.type === 'string') { + const withQuotes = (s: string) => `'` + s + `'`; + + return value => { + if (!value) { + return null; + } + + let message = ''; + + const stringArrayValue = value as string[]; + + if (prop.minItems && stringArrayValue.length < prop.minItems) { + message += nls.localize('validations.stringArrayMinItem', 'Array must have at least {0} items', prop.minItems); + message += '\n'; + } + + if (prop.maxItems && stringArrayValue.length > prop.maxItems) { + message += nls.localize('validations.stringArrayMaxItem', 'Array must have less than {0} items', prop.maxItems); + message += '\n'; + } + + if (typeof propItems.pattern === 'string') { + const patternRegex = new RegExp(propItems.pattern); + stringArrayValue.forEach(v => { + if (!patternRegex.test(v)) { + message += + propItems.patternErrorMessage || + nls.localize( + 'validations.stringArrayItemPattern', + 'Value {0} must match regex {1}.', + withQuotes(v), + withQuotes(propItems.pattern!) + ); + } + }); + } + + const propItemsEnum = propItems.enum; + if (propItemsEnum) { + stringArrayValue.forEach(v => { + if (propItemsEnum.indexOf(v) === -1) { + message += nls.localize( + 'validations.stringArrayItemEnum', + 'Value {0} is not one of {1}', + withQuotes(v), + '[' + propItemsEnum.map(withQuotes).join(', ') + ']' + ); + message += '\n'; + } + }); + } + + return message; + }; + } + } + return value => { let exclusiveMax: number | undefined; let exclusiveMin: number | undefined; diff --git a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts index 555da0949aa..b02e29c0c96 100644 --- a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts +++ b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts @@ -250,4 +250,82 @@ suite('Preferences Model test', () => { withMessage.rejects(' ').withMessage('always error!'); withMessage.rejects('1').withMessage('always error!'); }); -}); \ No newline at end of file + + class ArrayTester { + private validator: (value: any) => string | null; + + constructor(private settings: IConfigurationPropertySchema) { + this.validator = createValidator(settings)!; + } + + public accepts(input: string[]) { + assert.equal(this.validator(input), '', `Expected ${JSON.stringify(this.settings)} to accept \`${JSON.stringify(input)}\`. Got ${this.validator(input)}.`); + } + + public rejects(input: any[]) { + assert.notEqual(this.validator(input), '', `Expected ${JSON.stringify(this.settings)} to reject \`${JSON.stringify(input)}\`.`); + return { + withMessage: + (message: string) => { + const actual = this.validator(input); + assert.ok(actual); + assert(actual!.indexOf(message) > -1, + `Expected error of ${JSON.stringify(this.settings)} on \`${input}\` to contain ${message}. Got ${this.validator(input)}.`); + } + }; + } + } + + test('simple array', () => { + { + const arr = new ArrayTester({ type: 'array', items: { type: 'string' } }); + arr.accepts([]); + arr.accepts(['foo']); + arr.accepts(['foo', 'bar']); + } + }); + + test('min-max items array', () => { + { + const arr = new ArrayTester({ type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 2 }); + arr.rejects([]).withMessage('Array must have at least 1 items'); + arr.accepts(['a']); + arr.accepts(['a', 'a']); + arr.rejects(['a', 'a', 'a']).withMessage('Array must have less than 2 items'); + } + }); + + test('array of enums', () => { + { + const arr = new ArrayTester({ type: 'array', items: { type: 'string', enum: ['a', 'b'] } }); + arr.accepts(['a']); + arr.accepts(['a', 'b']); + + arr.rejects(['c']).withMessage(`Value 'c' is not one of`); + arr.rejects(['a', 'c']).withMessage(`Value 'c' is not one of`); + + arr.rejects(['c', 'd']).withMessage(`Value 'c' is not one of`); + arr.rejects(['c', 'd']).withMessage(`Value 'd' is not one of`); + } + }); + + test('min-max and enum', () => { + const arr = new ArrayTester({ type: 'array', items: { type: 'string', enum: ['a', 'b'] }, minItems: 1, maxItems: 2 }); + + arr.rejects(['a', 'b', 'c']).withMessage('Array must have less than 2 items'); + arr.rejects(['a', 'b', 'c']).withMessage(`Value 'c' is not one of`); + }); + + test('pattern', () => { + const arr = new ArrayTester({ type: 'array', items: { type: 'string', pattern: '^(hello)*$' } }); + + arr.accepts(['hello']); + arr.rejects(['a']).withMessage(`Value 'a' must match regex`); + }); + + test('pattern with error message', () => { + const arr = new ArrayTester({ type: 'array', items: { type: 'string', pattern: '^(hello)*$', patternErrorMessage: 'err: must be friendly' } }); + + arr.rejects(['a']).withMessage(`err: must be friendly`); + }); +}); diff --git a/src/vs/workbench/services/progress/browser/editorProgressService.ts b/src/vs/workbench/services/progress/browser/editorProgressService.ts index 73ecabab26a..b05c6305b84 100644 --- a/src/vs/workbench/services/progress/browser/editorProgressService.ts +++ b/src/vs/workbench/services/progress/browser/editorProgressService.ts @@ -3,11 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IEditorProgressService } from 'vs/platform/progress/common/progress'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { ProgressBarIndicator } from 'vs/workbench/services/progress/browser/progressIndicator'; export class EditorProgressService extends ProgressBarIndicator { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; } diff --git a/src/vs/workbench/services/progress/browser/progressService.ts b/src/vs/workbench/services/progress/browser/progressService.ts index 465920cd05d..220006ccbd1 100644 --- a/src/vs/workbench/services/progress/browser/progressService.ts +++ b/src/vs/workbench/services/progress/browser/progressService.ts @@ -23,12 +23,11 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { EventHelper } from 'vs/base/browser/dom'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; export class ProgressService extends Disposable implements IProgressService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly stack: [IProgressOptions, Progress][] = []; private readonly globalStatusEntry = this._register(new MutableDisposable()); @@ -46,7 +45,7 @@ export class ProgressService extends Disposable implements IProgressService { super(); } - withProgress(options: IProgressOptions, task: (progress: IProgress) => Promise, onDidCancel?: () => void): Promise { + withProgress(options: IProgressOptions, task: (progress: IProgress) => Promise, onDidCancel?: (choice?: number) => void): Promise { const { location } = options; if (typeof location === 'string') { if (this.viewletService.getProgressIndicator(location)) { @@ -142,7 +141,7 @@ export class ProgressService extends Disposable implements IProgressService { } } - private withNotificationProgress

, R = unknown>(options: IProgressNotificationOptions, callback: (progress: IProgress<{ message?: string, increment?: number }>) => P, onDidCancel?: () => void): P { + private withNotificationProgress

, R = unknown>(options: IProgressNotificationOptions, callback: (progress: IProgress<{ message?: string, increment?: number }>) => P, onDidCancel?: (choice?: number) => void): P { const toDispose = new DisposableStore(); const createNotification = (message: string | undefined, increment?: number): INotificationHandle | undefined => { @@ -152,6 +151,29 @@ export class ProgressService extends Disposable implements IProgressService { const primaryActions = options.primaryActions ? Array.from(options.primaryActions) : []; const secondaryActions = options.secondaryActions ? Array.from(options.secondaryActions) : []; + + if (options.buttons) { + options.buttons.forEach((button, index) => { + const buttonAction = new class extends Action { + constructor() { + super(`progress.button.${button}`, button, undefined, true); + } + + run(): Promise { + if (typeof onDidCancel === 'function') { + onDidCancel(index); + } + + return Promise.resolve(undefined); + } + }; + + toDispose.add(buttonAction); + + primaryActions.push(buttonAction); + }); + } + if (options.cancellable) { const cancelAction = new class extends Action { constructor() { @@ -182,6 +204,10 @@ export class ProgressService extends Disposable implements IProgressService { updateProgress(handle, increment); Event.once(handle.onDidClose)(() => { + if (typeof onDidCancel === 'function') { + onDidCancel(); + } + toDispose.dispose(); }); @@ -317,22 +343,29 @@ export class ProgressService extends Disposable implements IProgressService { return promise; } - private withDialogProgress

, R = unknown>(options: IProgressOptions, task: (progress: IProgress) => P, onDidCancel?: () => void): P { + private withDialogProgress

, R = unknown>(options: IProgressOptions, task: (progress: IProgress) => P, onDidCancel?: (choice?: number) => void): P { const disposables = new DisposableStore(); const allowableCommands = [ 'workbench.action.quit', - 'workbench.action.reloadWindow' + 'workbench.action.reloadWindow', + 'copy', + 'cut' ]; let dialog: Dialog; const createDialog = (message: string) => { + + const buttons = options.buttons || []; + buttons.push(options.cancellable ? localize('cancel', "Cancel") : localize('dismiss', "Dismiss")); + dialog = new Dialog( this.layoutService.container, message, - [options.cancellable ? localize('cancel', "Cancel") : localize('dismiss', "Dismiss")], + buttons, { type: 'pending', + cancelId: buttons.length - 1, keyEventProcessor: (event: StandardKeyboardEvent) => { const resolved = this.keybindingService.softDispatch(event, this.layoutService.container); if (resolved && resolved.commandId) { @@ -347,9 +380,9 @@ export class ProgressService extends Disposable implements IProgressService { disposables.add(dialog); disposables.add(attachDialogStyler(dialog, this.themeService)); - dialog.show().then(() => { + dialog.show().then((dialogResult) => { if (typeof onDidCancel === 'function') { - onDidCancel(); + onDidCancel(dialogResult.button); } dispose(dialog); diff --git a/src/vs/workbench/services/remote/browser/remoteAgentServiceImpl.ts b/src/vs/workbench/services/remote/browser/remoteAgentServiceImpl.ts index fd979ca094c..22a57d34634 100644 --- a/src/vs/workbench/services/remote/browser/remoteAgentServiceImpl.ts +++ b/src/vs/workbench/services/remote/browser/remoteAgentServiceImpl.ts @@ -11,6 +11,7 @@ import { IProductService } from 'vs/platform/product/common/product'; import { IWebSocketFactory, BrowserSocketFactory } from 'vs/platform/remote/browser/browserSocketFactory'; import { ISignService } from 'vs/platform/sign/common/sign'; import { ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection'; +import { ILogService } from 'vs/platform/log/common/log'; export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService { @@ -23,12 +24,16 @@ export class RemoteAgentService extends AbstractRemoteAgentService implements IR @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IProductService productService: IProductService, @IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService, - @ISignService signService: ISignService + @ISignService signService: ISignService, + @ILogService logService: ILogService ) { super(environmentService); this.socketFactory = new BrowserSocketFactory(webSocketFactory); - this._connection = this._register(new RemoteAgentConnection(environmentService.configuration.remoteAuthority!, productService.commit, this.socketFactory, remoteAuthorityResolverService, signService)); + const remoteAuthority = environmentService.configuration.remoteAuthority; + if (remoteAuthority) { + this._connection = this._register(new RemoteAgentConnection(remoteAuthority, productService.commit, this.socketFactory, remoteAuthorityResolverService, signService, logService)); + } } getConnection(): IRemoteAgentConnection | null { diff --git a/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts b/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts index 167e7a5bf14..c889524ee61 100644 --- a/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts +++ b/src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts @@ -20,10 +20,11 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics'; import { Emitter } from 'vs/base/common/event'; import { ISignService } from 'vs/platform/sign/common/sign'; +import { ILogService } from 'vs/platform/log/common/log'; export abstract class AbstractRemoteAgentService extends Disposable { - _serviceBrand: any; + _serviceBrand: undefined; private _environment: Promise | null; @@ -86,7 +87,8 @@ export class RemoteAgentConnection extends Disposable implements IRemoteAgentCon private readonly _commit: string | undefined, private readonly _socketFactory: ISocketFactory, private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService, - private readonly _signService: ISignService + private readonly _signService: ISignService, + private readonly _logService: ILogService ) { super(); this.remoteAuthority = remoteAuthority; @@ -124,7 +126,8 @@ export class RemoteAgentConnection extends Disposable implements IRemoteAgentCon return { host: authority.host, port: authority.port }; } }, - signService: this._signService + signService: this._signService, + logService: this._logService }; const connection = this._register(await connectRemoteAgentManagement(options, this.remoteAuthority, `renderer`)); this._register(connection.onDidStateChange(e => this._onDidStateChange.fire(e))); diff --git a/src/vs/workbench/services/remote/common/remoteAgentService.ts b/src/vs/workbench/services/remote/common/remoteAgentService.ts index fdd61483fd5..1cda189b53e 100644 --- a/src/vs/workbench/services/remote/common/remoteAgentService.ts +++ b/src/vs/workbench/services/remote/common/remoteAgentService.ts @@ -15,7 +15,7 @@ export const RemoteExtensionLogFileName = 'remoteagent'; export const IRemoteAgentService = createDecorator('remoteAgentService'); export interface IRemoteAgentService { - _serviceBrand: any; + _serviceBrand: undefined; readonly socketFactory: ISocketFactory; diff --git a/src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts b/src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts index 82d039a6c54..dc3d808786a 100644 --- a/src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts +++ b/src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts @@ -12,6 +12,7 @@ import { nodeSocketFactory } from 'vs/platform/remote/node/nodeSocketFactory'; import { AbstractRemoteAgentService, RemoteAgentConnection } from 'vs/workbench/services/remote/common/abstractRemoteAgentService'; import { ISignService } from 'vs/platform/sign/common/sign'; import { ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection'; +import { ILogService } from 'vs/platform/log/common/log'; export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService { @@ -22,12 +23,13 @@ export class RemoteAgentService extends AbstractRemoteAgentService implements IR constructor({ remoteAuthority }: IWindowConfiguration, @IEnvironmentService environmentService: IEnvironmentService, @IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService, - @ISignService signService: ISignService + @ISignService signService: ISignService, + @ILogService logService: ILogService ) { super(environmentService); this.socketFactory = nodeSocketFactory; if (remoteAuthority) { - this._connection = this._register(new RemoteAgentConnection(remoteAuthority, product.commit, nodeSocketFactory, remoteAuthorityResolverService, signService)); + this._connection = this._register(new RemoteAgentConnection(remoteAuthority, product.commit, nodeSocketFactory, remoteAuthorityResolverService, signService, logService)); } } diff --git a/src/vs/workbench/services/remote/node/tunnelService.ts b/src/vs/workbench/services/remote/node/tunnelService.ts index 457411cd670..1a6ca2412fa 100644 --- a/src/vs/workbench/services/remote/node/tunnelService.ts +++ b/src/vs/workbench/services/remote/node/tunnelService.ts @@ -15,6 +15,7 @@ import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; import { nodeSocketFactory } from 'vs/platform/remote/node/nodeSocketFactory'; import { ISignService } from 'vs/platform/sign/common/sign'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { ILogService } from 'vs/platform/log/common/log'; export async function createRemoteTunnel(options: IConnectionOptions, tunnelRemotePort: number): Promise { const tunnel = new NodeRemoteTunnel(options, tunnelRemotePort); @@ -85,12 +86,13 @@ class NodeRemoteTunnel extends Disposable implements RemoteTunnel { } export class TunnelService implements ITunnelService { - _serviceBrand: any; + _serviceBrand: undefined; public constructor( @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IRemoteAuthorityResolverService private readonly remoteAuthorityResolverService: IRemoteAuthorityResolverService, - @ISignService private readonly signService: ISignService + @ISignService private readonly signService: ISignService, + @ILogService private readonly logService: ILogService ) { } @@ -109,7 +111,8 @@ export class TunnelService implements ITunnelService { return { host: authority.host, port: authority.port }; } }, - signService: this.signService + signService: this.signService, + logService: this.logService }; return createRemoteTunnel(options, remotePort); } diff --git a/src/vs/workbench/services/request/browser/requestService.ts b/src/vs/workbench/services/request/browser/requestService.ts index cebf1654eca..13450f58132 100644 --- a/src/vs/workbench/services/request/browser/requestService.ts +++ b/src/vs/workbench/services/request/browser/requestService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; diff --git a/src/vs/workbench/services/search/common/search.ts b/src/vs/workbench/services/search/common/search.ts index da4e3edb333..bb47b117377 100644 --- a/src/vs/workbench/services/search/common/search.ts +++ b/src/vs/workbench/services/search/common/search.ts @@ -32,7 +32,7 @@ export const ISearchService = createDecorator('searchService'); * A service that enables to search for files or with in files. */ export interface ISearchService { - _serviceBrand: any; + _serviceBrand: undefined; textSearch(query: ITextQuery, token?: CancellationToken, onProgress?: (result: ISearchProgressItem) => void): Promise; fileSearch(query: IFileQuery, token?: CancellationToken): Promise; clearCache(cacheKey: string): Promise; diff --git a/src/vs/workbench/services/search/common/searchService.ts b/src/vs/workbench/services/search/common/searchService.ts index 8325ceb8317..c6c01de1548 100644 --- a/src/vs/workbench/services/search/common/searchService.ts +++ b/src/vs/workbench/services/search/common/searchService.ts @@ -21,11 +21,10 @@ import { deserializeSearchError, FileMatch, ICachedSearchStats, IFileMatch, IFil import { addContextToEditorMatches, editorMatchesToTextSearchResults } from 'vs/workbench/services/search/common/searchHelpers'; import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class SearchService extends Disposable implements ISearchService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; protected diskSearch: ISearchResultProvider; private readonly fileSearchProviders = new Map(); diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 53de732e011..9b00ee68b63 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -12,7 +12,8 @@ import { URI as uri } from 'vs/base/common/uri'; import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IDebugParams } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; import { ILogService } from 'vs/platform/log/common/log'; import { FileMatch, IFileMatch, IFileQuery, IProgressMessage, IRawSearchService, ISearchComplete, ISearchConfiguration, ISearchProgressItem, ISearchResultProvider, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITextQuery, ISearchService } from 'vs/workbench/services/search/common/search'; @@ -35,7 +36,7 @@ export class LocalSearchService extends SearchService { @ILogService logService: ILogService, @IExtensionService extensionService: IExtensionService, @IFileService fileService: IFileService, - @IEnvironmentService readonly environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService readonly environmentService: IWorkbenchEnvironmentService, @IInstantiationService readonly instantiationService: IInstantiationService ) { super(modelService, untitledEditorService, editorService, telemetryService, logService, extensionService, fileService); @@ -204,4 +205,4 @@ export class DiskSearch implements ISearchResultProvider { } } -registerSingleton(ISearchService, LocalSearchService, true); \ No newline at end of file +registerSingleton(ISearchService, LocalSearchService, true); diff --git a/src/vs/workbench/services/telemetry/browser/telemetryService.ts b/src/vs/workbench/services/telemetry/browser/telemetryService.ts index eac9dcfb1d0..68069d6746c 100644 --- a/src/vs/workbench/services/telemetry/browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/browser/telemetryService.ts @@ -66,7 +66,7 @@ export class WebTelemetryAppender implements ITelemetryAppender { export class TelemetryService extends Disposable implements ITelemetryService { - _serviceBrand: any; + _serviceBrand: undefined; private impl: ITelemetryService; diff --git a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts index c5561e44295..002216c6092 100644 --- a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts @@ -20,7 +20,7 @@ import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/pla export class TelemetryService extends Disposable implements ITelemetryService { - _serviceBrand: any; + _serviceBrand: undefined; private impl: ITelemetryService; @@ -38,7 +38,7 @@ export class TelemetryService extends Disposable implements ITelemetryService { const channel = sharedProcessService.getChannel('telemetryAppender'); const config: ITelemetryServiceConfig = { appender: combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService)), - commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, environmentService.installSourcePath, environmentService.configuration.remoteAuthority), + commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, productService.msftInternalDomains, environmentService.installSourcePath, environmentService.configuration.remoteAuthority), piiPaths: environmentService.extensionsPath ? [environmentService.appRoot, environmentService.extensionsPath] : [environmentService.appRoot] }; diff --git a/src/vs/workbench/services/textMate/browser/abstractTextMateService.ts b/src/vs/workbench/services/textMate/browser/abstractTextMateService.ts index d73ffc2fade..0fb7101230f 100644 --- a/src/vs/workbench/services/textMate/browser/abstractTextMateService.ts +++ b/src/vs/workbench/services/textMate/browser/abstractTextMateService.ts @@ -31,7 +31,7 @@ import { IValidGrammarDefinition, IValidEmbeddedLanguagesMap, IValidTokenTypeMap import { TMGrammarFactory } from 'vs/workbench/services/textMate/common/TMGrammarFactory'; export abstract class AbstractTextMateService extends Disposable implements ITextMateService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _onDidEncounterLanguage: Emitter = this._register(new Emitter()); public readonly onDidEncounterLanguage: Event = this._onDidEncounterLanguage.event; @@ -203,36 +203,37 @@ export abstract class AbstractTextMateService extends Disposable implements ITex return this._grammarFactory; } - private async _registerDefinitionIfAvailable(modeId: string): Promise { + private _registerDefinitionIfAvailable(modeId: string): void { const languageIdentifier = this._modeService.getLanguageIdentifier(modeId); if (!languageIdentifier) { return; } - const languageId = languageIdentifier.id; - try { - if (!this._canCreateGrammarFactory()) { - return; - } - const grammarFactory = await this._getOrCreateGrammarFactory(); - if (grammarFactory.has(languageId)) { - const promise = grammarFactory.createGrammar(languageId).then((r) => { - const tokenization = new TMTokenization(r.grammar, r.initialState, r.containsEmbeddedLanguages); - tokenization.onDidEncounterLanguage((languageId) => { - if (!this._encounteredLanguages[languageId]) { - this._encounteredLanguages[languageId] = true; - this._onDidEncounterLanguage.fire(languageId); - } - }); - return new TMTokenizationSupport(r.languageId, tokenization, this._notificationService, this._configurationService, this._storageService); - }, e => { - onUnexpectedError(e); - return null; - }); - this._tokenizersRegistrations.push(TokenizationRegistry.registerPromise(modeId, promise)); - } - } catch (err) { - onUnexpectedError(err); + if (!this._canCreateGrammarFactory()) { + return; } + const languageId = languageIdentifier.id; + + // Here we must register the promise ASAP (without yielding!) + this._tokenizersRegistrations.push(TokenizationRegistry.registerPromise(modeId, (async () => { + try { + const grammarFactory = await this._getOrCreateGrammarFactory(); + if (!grammarFactory.has(languageId)) { + return null; + } + const r = await grammarFactory.createGrammar(languageId); + const tokenization = new TMTokenization(r.grammar, r.initialState, r.containsEmbeddedLanguages); + tokenization.onDidEncounterLanguage((languageId) => { + if (!this._encounteredLanguages[languageId]) { + this._encounteredLanguages[languageId] = true; + this._onDidEncounterLanguage.fire(languageId); + } + }); + return new TMTokenizationSupport(r.languageId, tokenization, this._notificationService, this._configurationService, this._storageService); + } catch (err) { + onUnexpectedError(err); + return null; + } + })())); } private static _toColorMap(colorMap: string[]): Color[] { diff --git a/src/vs/workbench/services/textMate/common/textMateService.ts b/src/vs/workbench/services/textMate/common/textMateService.ts index 34bd21a09e8..2b61bb56cb8 100644 --- a/src/vs/workbench/services/textMate/common/textMateService.ts +++ b/src/vs/workbench/services/textMate/common/textMateService.ts @@ -10,7 +10,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' export const ITextMateService = createDecorator('textMateService'); export interface ITextMateService { - _serviceBrand: any; + _serviceBrand: undefined; onDidEncounterLanguage: Event; diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index 3d2d91f5996..ed7f5273046 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { TextFileService } from 'vs/workbench/services/textfile/common/textFileService'; -import { ITextFileService, IResourceEncodings, IResourceEncoding } from 'vs/workbench/services/textfile/common/textfiles'; +import { ITextFileService, IResourceEncodings, IResourceEncoding, ModelState } from 'vs/workbench/services/textfile/common/textfiles'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle'; import { Schemas } from 'vs/base/common/network'; @@ -26,6 +26,10 @@ export class BrowserTextFileService extends TextFileService { } private doBeforeShutdownSync(): boolean { + if (this.models.getAll().some(model => model.hasState(ModelState.PENDING_SAVE) || model.hasState(ModelState.PENDING_AUTO_SAVE))) { + return true; // files are pending to be saved: veto + } + const dirtyResources = this.getDirty(); if (!dirtyResources.length) { return false; // no dirty: no veto diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index 4fa61e19c83..bd6332610d8 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -593,6 +593,9 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil // Create new save timer and store it for disposal as needed const handle = setTimeout(() => { + // Clear the timeout now that we are running + this.autoSaveDisposable.clear(); + // Only trigger save if the version id has not changed meanwhile if (versionId === this.versionId) { this.doSave(versionId, { reason: SaveReason.AUTO }); // Very important here to not return the promise because if the timeout promise is canceled it will bubble up the error otherwise - do not change @@ -941,6 +944,8 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil return this.inOrphanMode; case ModelState.PENDING_SAVE: return this.saveSequentializer.hasPendingSave(); + case ModelState.PENDING_AUTO_SAVE: + return !!this.autoSaveDisposable.value; case ModelState.SAVED: return !this.dirty; } diff --git a/src/vs/workbench/services/textfile/common/textFileService.ts b/src/vs/workbench/services/textfile/common/textFileService.ts index f9147e602e8..539de46fea9 100644 --- a/src/vs/workbench/services/textfile/common/textFileService.ts +++ b/src/vs/workbench/services/textfile/common/textFileService.ts @@ -22,7 +22,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel'; import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager'; -import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ResourceMap } from 'vs/base/common/map'; import { Schemas } from 'vs/base/common/network'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; @@ -46,7 +46,7 @@ import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry'; */ export abstract class TextFileService extends Disposable implements ITextFileService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private readonly _onAutoSaveConfigurationChange: Emitter = this._register(new Emitter()); readonly onAutoSaveConfigurationChange: Event = this._onAutoSaveConfigurationChange.event; @@ -685,7 +685,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer protected async promptForPath(resource: URI, defaultUri: URI, availableFileSystems?: string[]): Promise { // Help user to find a name for the file by opening it first - await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true, } }); + await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true } }); return this.fileDialogService.pickFileToSave(this.getSaveDialogOptions(defaultUri, availableFileSystems)); } diff --git a/src/vs/workbench/services/textfile/common/textResourcePropertiesService.ts b/src/vs/workbench/services/textfile/common/textResourcePropertiesService.ts index 653da4a83c4..940794852e2 100644 --- a/src/vs/workbench/services/textfile/common/textResourcePropertiesService.ts +++ b/src/vs/workbench/services/textfile/common/textResourcePropertiesService.ts @@ -13,11 +13,10 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class TextResourcePropertiesService implements ITextResourcePropertiesService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private remoteEnvironment: IRemoteAgentEnvironment | null = null; diff --git a/src/vs/workbench/services/textfile/common/textfiles.ts b/src/vs/workbench/services/textfile/common/textfiles.ts index 02956fd1cdd..7a624c0761d 100644 --- a/src/vs/workbench/services/textfile/common/textfiles.ts +++ b/src/vs/workbench/services/textfile/common/textfiles.ts @@ -8,7 +8,7 @@ import { Event } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; import { IEncodingSupport, ConfirmResult, IRevertOptions, IModeSupport } from 'vs/workbench/common/editor'; import { IBaseStatWithMetadata, IFileStatWithMetadata, IReadFileOptions, IWriteFileOptions, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ITextEditorModel } from 'vs/editor/common/services/resolverService'; import { ITextBufferFactory, ITextModel, ITextSnapshot } from 'vs/editor/common/model'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; @@ -19,7 +19,7 @@ export const ITextFileService = createDecorator('textFileServi export interface ITextFileService extends IDisposable { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; readonly onWillMove: Event; @@ -248,10 +248,15 @@ export const enum ModelState { DIRTY, /** - * A model is transitioning from dirty to saved. + * A model is currently being saved but this operation has not completed yet. */ PENDING_SAVE, + /** + * A model is marked for being saved after a specific timeout. + */ + PENDING_AUTO_SAVE, + /** * A model is in conflict mode when changes cannot be saved because the * underlying file has changed. Models in conflict mode are always dirty. diff --git a/src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts b/src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts index b5609d42d32..629e19c6b77 100644 --- a/src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts +++ b/src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts @@ -52,6 +52,7 @@ suite('Files - TextFileEditorModel', () => { model.textEditorModel!.setValue('bar'); assert.ok(getLastModifiedTime(model) <= Date.now()); + assert.ok(model.hasState(ModelState.DIRTY)); let savedEvent = false; model.onDidStateChange(e => { @@ -60,9 +61,13 @@ suite('Files - TextFileEditorModel', () => { } }); - await model.save(); + const pendingSave = model.save(); + assert.ok(model.hasState(ModelState.PENDING_SAVE)); + + await pendingSave; assert.ok(model.getLastSaveAttemptTime() <= Date.now()); + assert.ok(model.hasState(ModelState.SAVED)); assert.ok(!model.isDirty()); assert.ok(savedEvent); diff --git a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts index a2f3269ecd0..aaa60c08768 100644 --- a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts +++ b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts @@ -121,7 +121,7 @@ class ResourceModelCollection extends ReferenceCollection(JSONExtensions.JSONContribution); schemaRegistry.registerSchema(schemaId, schema); -} \ No newline at end of file +} diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index deb116b60f8..8684b54a804 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -51,7 +51,7 @@ export interface IFileIconTheme extends IIconTheme { } export interface IWorkbenchThemeService extends IThemeService { - _serviceBrand: any; + _serviceBrand: undefined; setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; getColorTheme(): IColorTheme; getColorThemes(): Promise; diff --git a/src/vs/workbench/services/timer/electron-browser/timerService.ts b/src/vs/workbench/services/timer/electron-browser/timerService.ts index 139822af63b..3bf0c2fee4e 100644 --- a/src/vs/workbench/services/timer/electron-browser/timerService.ts +++ b/src/vs/workbench/services/timer/electron-browser/timerService.ts @@ -297,13 +297,13 @@ export interface IStartupMetrics { } export interface ITimerService { - _serviceBrand: any; + _serviceBrand: undefined; readonly startupMetrics: Promise; } class TimerService implements ITimerService { - _serviceBrand: any; + _serviceBrand: undefined; private _startupMetrics?: Promise; diff --git a/src/vs/workbench/services/title/common/titleService.ts b/src/vs/workbench/services/title/common/titleService.ts index 1745a6a2449..b3476f94deb 100644 --- a/src/vs/workbench/services/title/common/titleService.ts +++ b/src/vs/workbench/services/title/common/titleService.ts @@ -14,7 +14,7 @@ export interface ITitleProperties { } export interface ITitleService { - _serviceBrand: any; + _serviceBrand: undefined; /** * An event when the menubar visibility changes. diff --git a/src/vs/workbench/services/untitled/common/untitledEditorService.ts b/src/vs/workbench/services/untitled/common/untitledEditorService.ts index 3571e4f6c0a..ca8614f26aa 100644 --- a/src/vs/workbench/services/untitled/common/untitledEditorService.ts +++ b/src/vs/workbench/services/untitled/common/untitledEditorService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI } from 'vs/base/common/uri'; -import { createDecorator, IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import * as arrays from 'vs/base/common/arrays'; import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; import { IFilesConfiguration, IFileService } from 'vs/platform/files/common/files'; @@ -29,7 +29,7 @@ export interface IModelLoadOrCreateOptions { export interface IUntitledEditorService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; /** * Events for when untitled editors content changes (e.g. any keystroke). @@ -112,7 +112,7 @@ export interface IUntitledEditorService { export class UntitledEditorService extends Disposable implements IUntitledEditorService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private mapResourceToInput = new ResourceMap(); private mapResourceToAssociatedFilePath = new ResourceMap(); diff --git a/src/vs/workbench/services/url/browser/urlService.ts b/src/vs/workbench/services/url/browser/urlService.ts index f69c231457d..dfbca795c40 100644 --- a/src/vs/workbench/services/url/browser/urlService.ts +++ b/src/vs/workbench/services/url/browser/urlService.ts @@ -5,7 +5,7 @@ import { IURLService } from 'vs/platform/url/common/url'; import { URI, UriComponents } from 'vs/base/common/uri'; -import { ServiceIdentifier, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { AbstractURLService } from 'vs/platform/url/common/urlService'; import { Event, Emitter } from 'vs/base/common/event'; @@ -45,7 +45,7 @@ export interface IURLCallbackProvider { export class BrowserURLService extends AbstractURLService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; private provider: IURLCallbackProvider; @@ -124,7 +124,7 @@ class SelfhostURLCallbackProvider extends Disposable implements IURLCallbackProv // Start to poll on the callback being fired this.periodicFetchCallback(requestId, Date.now()); - return this.doCreateUri('callback', queryValues); + return this.doCreateUri('/callback', queryValues); } private async periodicFetchCallback(requestId: string, startTime: number): Promise { @@ -134,7 +134,7 @@ class SelfhostURLCallbackProvider extends Disposable implements IURLCallbackProv queryValues.set(SelfhostURLCallbackProvider.QUERY_KEYS.REQUEST_ID, requestId); const result = await this.requestService.request({ - url: this.doCreateUri('fetch-callback', queryValues).toString(true) + url: this.doCreateUri('/fetch-callback', queryValues).toString(true) }, CancellationToken.None); // Check for callback results diff --git a/src/vs/workbench/services/url/electron-browser/urlService.ts b/src/vs/workbench/services/url/electron-browser/urlService.ts index f1a73d383d9..b4a20ed825f 100644 --- a/src/vs/workbench/services/url/electron-browser/urlService.ts +++ b/src/vs/workbench/services/url/electron-browser/urlService.ts @@ -29,10 +29,6 @@ export class RelayURLService extends URLService implements IURLHandler { } async open(resource: URI, options?: { openToSide?: boolean, openExternal?: boolean }): Promise { - if (options && options.openExternal) { - return false; - } - if (resource.scheme !== product.urlProtocol) { return false; } diff --git a/src/vs/workbench/services/viewlet/browser/viewlet.ts b/src/vs/workbench/services/viewlet/browser/viewlet.ts index 92349b87a4b..ffc1a81d63a 100644 --- a/src/vs/workbench/services/viewlet/browser/viewlet.ts +++ b/src/vs/workbench/services/viewlet/browser/viewlet.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IViewlet } from 'vs/workbench/common/viewlet'; -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event } from 'vs/base/common/event'; import { ViewletDescriptor } from 'vs/workbench/browser/viewlet'; import { IProgressIndicator } from 'vs/platform/progress/common/progress'; @@ -13,7 +13,7 @@ export const IViewletService = createDecorator('viewletService' export interface IViewletService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; readonly onDidViewletRegister: Event; readonly onDidViewletDeregister: Event; diff --git a/src/vs/workbench/services/window/electron-browser/windowService.ts b/src/vs/workbench/services/window/electron-browser/windowService.ts index 031e015589c..5c25f1f9a55 100644 --- a/src/vs/workbench/services/window/electron-browser/windowService.ts +++ b/src/vs/workbench/services/window/electron-browser/windowService.ts @@ -19,7 +19,7 @@ export class WindowService extends Disposable implements IWindowService { readonly onDidChangeFocus: Event; readonly onDidChangeMaximize: Event; - _serviceBrand: any; + _serviceBrand: undefined; private _windowId: number; private remoteAuthority: string | undefined; diff --git a/src/vs/workbench/services/workspace/common/workspaceEditing.ts b/src/vs/workbench/services/workspace/common/workspaceEditing.ts index c1656dab17f..6bf3b4019e1 100644 --- a/src/vs/workbench/services/workspace/common/workspaceEditing.ts +++ b/src/vs/workbench/services/workspace/common/workspaceEditing.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces'; import { URI } from 'vs/base/common/uri'; @@ -11,7 +11,7 @@ export const IWorkspaceEditingService = createDecorator; + _serviceBrand: undefined; /** * Add folders to the existing workspace. @@ -56,4 +56,4 @@ export interface IWorkspaceEditingService { * picks a new workspace path */ pickNewWorkspacePath(): Promise; -} \ No newline at end of file +} diff --git a/src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts b/src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts index abf9f135d3d..55c9404ea62 100644 --- a/src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts @@ -32,11 +32,10 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ILabelService } from 'vs/platform/label/common/label'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; export class WorkspaceEditingService implements IWorkspaceEditingService { - _serviceBrand!: ServiceIdentifier; + _serviceBrand: undefined; constructor( @IJSONEditingService private readonly jsonEditingService: IJSONEditingService, diff --git a/src/vs/workbench/test/browser/quickopen.test.ts b/src/vs/workbench/test/browser/quickopen.test.ts index 1adbabeb09c..1a264a7e25c 100644 --- a/src/vs/workbench/test/browser/quickopen.test.ts +++ b/src/vs/workbench/test/browser/quickopen.test.ts @@ -11,7 +11,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction, QuickOpenHandler } from 'vs/workbench/browser/quickopen'; export class TestQuickOpenService implements IQuickOpenService { - public _serviceBrand: any; + public _serviceBrand: undefined; private callback?: (prefix?: string) => void; diff --git a/src/vs/workbench/test/contrib/linkProtection.test.ts b/src/vs/workbench/test/contrib/linkProtection.test.ts new file mode 100644 index 00000000000..ac4e9f58627 --- /dev/null +++ b/src/vs/workbench/test/contrib/linkProtection.test.ts @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; + +import { isURLDomainTrusted } from 'vs/workbench/contrib/url/common/url.contribution'; +import { URI } from 'vs/base/common/uri'; + +suite('Link protection domain matching', () => { + + test('simple', () => { + assert.ok(!isURLDomainTrusted(URI.parse('https://x.org'), [])); + assert.ok(isURLDomainTrusted(URI.parse('https://x.org'), ['https://x.org'])); + assert.ok(isURLDomainTrusted(URI.parse('https://x.org/foo'), ['https://x.org'])); + + assert.ok(!isURLDomainTrusted(URI.parse('https://x.org'), ['http://x.org'])); + assert.ok(!isURLDomainTrusted(URI.parse('http://x.org'), ['https://x.org'])); + + assert.ok(!isURLDomainTrusted(URI.parse('https://www.x.org'), ['https://x.org'])); + + assert.ok(isURLDomainTrusted(URI.parse('https://www.x.org'), ['https://www.x.org', 'https://y.org'])); + }); + + test('localhost', () => { + assert.ok(isURLDomainTrusted(URI.parse('https://127.0.0.1'), [])); + assert.ok(isURLDomainTrusted(URI.parse('https://127.0.0.1:3000'), [])); + assert.ok(isURLDomainTrusted(URI.parse('https://localhost'), [])); + assert.ok(isURLDomainTrusted(URI.parse('https://localhost:3000'), [])); + }); + + test('* star', () => { + assert.ok(isURLDomainTrusted(URI.parse('https://a.x.org'), ['https://*.x.org'])); + assert.ok(isURLDomainTrusted(URI.parse('https://a.x.org'), ['https://a.x.*'])); + assert.ok(isURLDomainTrusted(URI.parse('https://a.x.org'), ['https://a.*.org'])); + assert.ok(isURLDomainTrusted(URI.parse('https://a.x.org'), ['https://*.*.org'])); + + assert.ok(!isURLDomainTrusted(URI.parse('https://a.b.c.org'), ['https://*.*.org'])); + assert.ok(isURLDomainTrusted(URI.parse('https://a.b.c.org'), ['https://*.*.*.org'])); + }); +}); diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index f2c5b0043fe..81d4d5d7fa6 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -78,7 +78,7 @@ suite('ExtHostLanguageFeatureCommands', function () { }); instantiationService.stub(IMarkerService, new MarkerService()); instantiationService.stub(IModelService, { - _serviceBrand: IModelService, + _serviceBrand: undefined, getModel(): any { return model; }, createModel() { throw new Error(); }, updateModel() { throw new Error(); }, diff --git a/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts b/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts index 991bfbede8a..54dd9f1a9af 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts @@ -9,11 +9,10 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { INotificationService, INotification, NoOpNotification, INotificationHandle, Severity, IPromptChoice, IPromptOptions, IStatusMessageOptions } from 'vs/platform/notification/common/notification'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { mock } from 'vs/workbench/test/electron-browser/api/mock'; -import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; const emptyDialogService = new class implements IDialogService { - _serviceBrand: 'dialogService'; + _serviceBrand: undefined; show(): never { throw new Error('not implemented'); } @@ -33,7 +32,7 @@ const emptyCommandService: ICommandService = { }; const emptyNotificationService = new class implements INotificationService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; notify(...args: any[]): never { throw new Error('not implemented'); } @@ -55,7 +54,7 @@ const emptyNotificationService = new class implements INotificationService { }; class EmptyNotificationService implements INotificationService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; constructor(private withNotify: (notification: INotification) => void) { } diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts index 1dc37b2b274..aa5453e5f6c 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts @@ -75,7 +75,7 @@ suite('MainThreadDocumentsAndEditors', () => { editorGroupService, null!, new class extends mock() implements IPanelService { - _serviceBrand: any; + _serviceBrand: undefined; onDidPanelOpen = Event.None; onDidPanelClose = Event.None; getActivePanel() { diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts index 35489e8cbeb..bd1397d06fb 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -107,7 +107,7 @@ suite('MainThreadEditors', () => { editorGroupService, bulkEditService, new class extends mock() implements IPanelService { - _serviceBrand: any; + _serviceBrand: undefined; onDidPanelOpen = Event.None; onDidPanelClose = Event.None; getActivePanel() { diff --git a/src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts b/src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts index 4eef6eb559c..7f8fc49d50e 100644 --- a/src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts +++ b/src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts @@ -25,7 +25,7 @@ export function SingleProxyRPCProtocol(thing: any): IExtHostContext & IExtHostRp export class TestRPCProtocol implements IExtHostContext, IExtHostRpcService { - public _serviceBrand = undefined; + public _serviceBrand: undefined; public remoteAuthority = null!; private _callCountValue: number = 0; diff --git a/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts b/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts index c61f19b0d58..3ba7c797579 100644 --- a/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts +++ b/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts @@ -5,13 +5,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IColorRegistry, Extensions, ColorContribution } from 'vs/platform/theme/common/colorRegistry'; -import { editorMarkerNavigationError } from 'vs/editor/contrib/gotoError/gotoErrorWidget'; -import { overviewRulerModifiedForeground } from 'vs/workbench/contrib/scm/browser/dirtydiffDecorator'; -import { STATUS_BAR_DEBUGGING_BACKGROUND } from 'vs/workbench/contrib/debug/browser/statusbarColorProvider'; -import { debugExceptionWidgetBackground } from 'vs/workbench/contrib/debug/browser/exceptionWidget'; -import { debugToolBarBackground } from 'vs/workbench/contrib/debug/browser/debugToolBar'; -import { buttonBackground } from 'vs/workbench/contrib/welcome/page/browser/welcomePage'; -import { embeddedEditorBackground } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart'; + import { asText } from 'vs/platform/request/common/request'; import * as pfs from 'vs/base/node/pfs'; import * as path from 'vs/base/common/path'; @@ -20,6 +14,7 @@ import { getPathFromAmdModule } from 'vs/base/common/amd'; import { CancellationToken } from 'vs/base/common/cancellation'; import { RequestService } from 'vs/platform/request/node/requestService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; +import 'vs/workbench/workbench.desktop.main'; import { NullLogService } from 'vs/platform/log/common/log'; @@ -34,25 +29,25 @@ interface DescriptionDiff { specDescription: string; } -// add artificial dependencies to some files that are not loaded yet -export const forceColorLoad = [editorMarkerNavigationError, overviewRulerModifiedForeground, STATUS_BAR_DEBUGGING_BACKGROUND, - debugExceptionWidgetBackground, debugToolBarBackground, buttonBackground, embeddedEditorBackground]; - export const experimental: string[] = []; // 'settings.modifiedItemForeground', 'editorUnnecessary.foreground' ]; suite('Color Registry', function () { - test('all colors documented', async function () { - const reqContext = await new RequestService(new TestConfigurationService(), new NullLogService()).request({ url: 'https://raw.githubusercontent.com/Microsoft/vscode-docs/vnext/docs/getstarted/theme-color-reference.md' }, CancellationToken.None); + test('all colors documented in theme-color.md', async function () { + const reqContext = await new RequestService(new TestConfigurationService(), new NullLogService()).request({ url: 'https://raw.githubusercontent.com/microsoft/vscode-docs/vnext/api/references/theme-color.md' }, CancellationToken.None); const content = (await asText(reqContext))!; const expression = /\-\s*\`([\w\.]+)\`: (.*)/g; let m: RegExpExecArray | null; let colorsInDoc: { [id: string]: ColorInfo } = Object.create(null); + let nColorsInDoc = 0; while (m = expression.exec(content)) { colorsInDoc[m[1]] = { description: m[2], offset: m.index, length: m.length }; + nColorsInDoc++; } + assert.ok(nColorsInDoc > 0, 'theme-color.md contains to color descriptions'); + let missing = Object.create(null); let descriptionDiffs: { [id: string]: DescriptionDiff } = Object.create(null); @@ -88,7 +83,7 @@ suite('Color Registry', function () { } } - let undocumentedKeys = Object.keys(missing).map(k => `${k}: ${missing[k]}`); + let undocumentedKeys = Object.keys(missing).map(k => `\`${k}\`: ${missing[k]}`); assert.deepEqual(undocumentedKeys, [], 'Undocumented colors ids'); let superfluousKeys = Object.keys(colorsInDoc); @@ -106,7 +101,7 @@ function getDescription(color: ColorContribution) { } async function getColorsFromExtension(): Promise<{ [id: string]: string }> { - let extPath = getPathFromAmdModule(require, '../../../../../../extensions'); + let extPath = getPathFromAmdModule(require, '../../../../../extensions'); let extFolders = await pfs.readDirsInDir(extPath); let result: { [id: string]: string } = Object.create(null); for (let folder of extFolders) { diff --git a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts index b23a042280b..0c8f3e9a711 100644 --- a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts +++ b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts @@ -160,7 +160,7 @@ suite.skip('QuickOpen performance (integration)', () => { class TestTelemetryService implements ITelemetryService { - public _serviceBrand: any; + public _serviceBrand: undefined; public isOptedIn = true; public events: any[] = []; diff --git a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts index ee857b6b8b3..c0d3abb9cdc 100644 --- a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts +++ b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts @@ -145,7 +145,7 @@ suite.skip('TextSearch performance (integration)', () => { }); class TestTelemetryService implements ITelemetryService { - public _serviceBrand: any; + public _serviceBrand: undefined; public isOptedIn = true; public events: any[] = []; diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index d182e4ca73c..4014dc4da45 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -33,7 +33,7 @@ import { ITextFileStreamContent, ITextFileService, IResourceEncoding, IReadTextF import { parseArgs } from 'vs/platform/environment/node/argv'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; -import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { IWindowsService, IWindowService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, MenuBarVisibility, IURIToOpen, IOpenSettings, IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; @@ -94,7 +94,7 @@ export function createFileInput(instantiationService: IInstantiationService, res export const TestEnvironmentService = new WorkbenchEnvironmentService(parseArgs(process.argv) as IWindowConfiguration, process.execPath); export class TestContextService implements IWorkspaceContextService { - public _serviceBrand: any; + public _serviceBrand: undefined; private workspace: Workspace; private options: any; @@ -106,6 +106,7 @@ export class TestContextService implements IWorkspaceContextService { constructor(workspace: any = TestWorkspace, options: any = null) { this.workspace = workspace; this.options = options || Object.create(null); + this._onDidChangeWorkspaceName = new Emitter(); this._onDidChangeWorkspaceFolders = new Emitter(); this._onDidChangeWorkbenchState = new Emitter(); } @@ -325,7 +326,7 @@ export function workbenchInstantiationService(): IInstantiationService { } export class TestDecorationsService implements IDecorationsService { - _serviceBrand: any; + _serviceBrand: undefined; onDidChangeDecorations: Event = Event.None; registerDecorationsProvider(_provider: IDecorationsProvider): IDisposable { return Disposable.None; } getDecoration(_uri: URI, _includeChildren: boolean, _overwrite?: IDecorationData): IDecoration | undefined { return undefined; } @@ -335,7 +336,7 @@ export class TestExtensionService extends NullExtensionService { } export class TestMenuService implements IMenuService { - public _serviceBrand: any; + public _serviceBrand: undefined; createMenu(_id: MenuId, _scopedKeybindingService: IContextKeyService): IMenu { return { @@ -348,7 +349,7 @@ export class TestMenuService implements IMenuService { export class TestHistoryService implements IHistoryService { - public _serviceBrand: any; + public _serviceBrand: undefined; constructor(private root?: URI) { } @@ -392,7 +393,7 @@ export class TestHistoryService implements IHistoryService { export class TestDialogService implements IDialogService { - public _serviceBrand: any; + public _serviceBrand: undefined; public confirm(_confirmation: IConfirmation): Promise { return Promise.resolve({ confirmed: false }); @@ -405,7 +406,7 @@ export class TestDialogService implements IDialogService { export class TestFileDialogService implements IFileDialogService { - public _serviceBrand: any; + public _serviceBrand: undefined; public defaultFilePath(_schemeFilter?: string): URI | undefined { return undefined; @@ -441,7 +442,7 @@ export class TestFileDialogService implements IFileDialogService { export class TestLayoutService implements IWorkbenchLayoutService { - public _serviceBrand: any; + public _serviceBrand: undefined; dimension: IDimension = { width: 800, height: 600 }; @@ -541,6 +542,8 @@ export class TestLayoutService implements IWorkbenchLayoutService { public addClass(_clazz: string): void { } public removeClass(_clazz: string): void { } + public getMaximumEditorDimensions(): Dimension { throw new Error('not implemented'); } + public getWorkbenchContainer(): HTMLElement { throw new Error('not implemented'); } public getWorkbenchElement(): HTMLElement { throw new Error('not implemented'); } @@ -558,7 +561,7 @@ export class TestLayoutService implements IWorkbenchLayoutService { let activeViewlet: Viewlet = {} as any; export class TestViewletService implements IViewletService { - public _serviceBrand: any; + public _serviceBrand: undefined; onDidViewletRegisterEmitter = new Emitter(); onDidViewletDeregisterEmitter = new Emitter(); @@ -609,7 +612,7 @@ export class TestViewletService implements IViewletService { } export class TestPanelService implements IPanelService { - public _serviceBrand: any; + public _serviceBrand: undefined; onDidPanelOpen = new Emitter<{ panel: IPanel, focus: boolean }>().event; onDidPanelClose = new Emitter().event; @@ -658,7 +661,7 @@ export class TestStorageService extends InMemoryStorageService { } export class TestEditorGroupsService implements IEditorGroupsService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; constructor(public groups: TestEditorGroup[] = []) { } @@ -710,6 +713,10 @@ export class TestEditorGroupsService implements IEditorGroupsService { throw new Error('not implemented'); } + restoreGroup(_group: number | IEditorGroup): IEditorGroup { + throw new Error('not implemented'); + } + getSize(_group: number | IEditorGroup): { width: number, height: number } { return { width: 100, height: 100 }; } @@ -854,7 +861,7 @@ export class TestEditorGroup implements IEditorGroupView { export class TestEditorService implements EditorServiceImpl { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; onDidActiveEditorChange: Event = Event.None; onDidVisibleEditorsChange: Event = Event.None; @@ -904,7 +911,7 @@ export class TestEditorService implements EditorServiceImpl { export class TestFileService implements IFileService { - public _serviceBrand: any; + public _serviceBrand: undefined; private readonly _onFileChanges: Emitter; private readonly _onAfterOperation: Emitter; @@ -1075,7 +1082,7 @@ export class TestFileService implements IFileService { } export class TestBackupFileService implements IBackupFileService { - public _serviceBrand: any; + public _serviceBrand: undefined; public hasBackups(): Promise { return Promise.resolve(false); @@ -1140,7 +1147,7 @@ export class TestBackupFileService implements IBackupFileService { } export class TestCodeEditorService implements ICodeEditorService { - _serviceBrand: any; + _serviceBrand: undefined; onCodeEditorAdd: Event = Event.None; onCodeEditorRemove: Event = Event.None; @@ -1166,7 +1173,7 @@ export class TestCodeEditorService implements ICodeEditorService { export class TestWindowService implements IWindowService { - public _serviceBrand: any; + public _serviceBrand: undefined; onDidChangeFocus: Event = new Emitter().event; onDidChangeMaximize: Event; @@ -1297,7 +1304,7 @@ export class TestWindowService implements IWindowService { export class TestLifecycleService implements ILifecycleService { - public _serviceBrand: any; + public _serviceBrand: undefined; public phase: LifecyclePhase; public startupKind: StartupKind; @@ -1336,7 +1343,7 @@ export class TestLifecycleService implements ILifecycleService { export class TestWindowsService implements IWindowsService { - _serviceBrand: any; + _serviceBrand: undefined; public windowCount = 1; @@ -1557,7 +1564,7 @@ export class TestWindowsService implements IWindowsService { export class TestTextResourceConfigurationService implements ITextResourceConfigurationService { - _serviceBrand: any; + _serviceBrand: undefined; constructor(private configurationService = new TestConfigurationService()) { } @@ -1575,7 +1582,7 @@ export class TestTextResourceConfigurationService implements ITextResourceConfig export class TestTextResourcePropertiesService implements ITextResourcePropertiesService { - _serviceBrand: any; + _serviceBrand: undefined; constructor( @IConfigurationService private readonly configurationService: IConfigurationService, @@ -1596,7 +1603,7 @@ export class TestTextResourcePropertiesService implements ITextResourcePropertie export class TestSharedProcessService implements ISharedProcessService { - _serviceBrand: ServiceIdentifier; + _serviceBrand: undefined; getChannel(channelName: string): any { return undefined; diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 1b652aec9b4..52281873d2f 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -53,7 +53,7 @@ import 'vs/workbench/browser/parts/views/views'; //#region --- workbench services -import 'vs/workbench/services/extensions/common/inactiveExtensionUrlHandler'; +import 'vs/workbench/services/extensions/common/extensionUrlHandler'; import 'vs/workbench/services/bulkEdit/browser/bulkEditService'; import 'vs/workbench/services/keybinding/common/keybindingEditing'; import 'vs/workbench/services/decorations/browser/decorationsService'; @@ -75,6 +75,7 @@ import 'vs/workbench/services/themes/browser/workbenchThemeService'; import 'vs/workbench/services/label/common/labelService'; import 'vs/workbench/services/extensionManagement/common/extensionEnablementService'; import 'vs/workbench/services/notification/common/notificationService'; +import 'vs/workbench/services/extensions/common/staticExtensions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index a566d1d7900..27ef543f040 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -70,7 +70,6 @@ import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces'; import { WorkspacesService } from 'vs/platform/workspaces/electron-browser/workspacesService'; import { IMenubarService } from 'vs/platform/menubar/node/menubar'; import { MenubarService } from 'vs/platform/menubar/electron-browser/menubarService'; -import { StaticExtensionsService, IStaticExtensionsService } from 'vs/workbench/services/extensions/common/staticExtensions'; registerSingleton(IClipboardService, ClipboardService, true); registerSingleton(IRequestService, RequestService, true); @@ -82,7 +81,6 @@ registerSingleton(IUpdateService, UpdateService); registerSingleton(IIssueService, IssueService); registerSingleton(IWorkspacesService, WorkspacesService); registerSingleton(IMenubarService, MenubarService); -registerSingleton(IStaticExtensionsService, class extends StaticExtensionsService { constructor() { super([]); } }); //#endregion diff --git a/src/vs/workbench/workbench.web.main.css b/src/vs/workbench/workbench.web.api.css similarity index 94% rename from src/vs/workbench/workbench.web.main.css rename to src/vs/workbench/workbench.web.api.css index 06ed8a197b2..3a0641938d5 100644 --- a/src/vs/workbench/workbench.web.main.css +++ b/src/vs/workbench/workbench.web.api.css @@ -4,6 +4,3 @@ *--------------------------------------------------------------------------------------------*/ /* NOTE: THIS FILE WILL BE OVERWRITTEN DURING BUILD TIME, DO NOT EDIT */ - -div.monaco.main.css { -} \ No newline at end of file diff --git a/src/vs/workbench/workbench.web.main.nls.js b/src/vs/workbench/workbench.web.api.nls.js similarity index 96% rename from src/vs/workbench/workbench.web.main.nls.js rename to src/vs/workbench/workbench.web.api.nls.js index d6a8b487eaf..6113d093d5c 100644 --- a/src/vs/workbench/workbench.web.main.nls.js +++ b/src/vs/workbench/workbench.web.api.nls.js @@ -4,5 +4,3 @@ *--------------------------------------------------------------------------------------------*/ // NOTE: THIS FILE WILL BE OVERWRITTEN DURING BUILD TIME, DO NOT EDIT - -define([], {}); \ No newline at end of file diff --git a/src/vs/workbench/workbench.web.api.ts b/src/vs/workbench/workbench.web.api.ts index 844ff1da56a..79b0803bdb1 100644 --- a/src/vs/workbench/workbench.web.api.ts +++ b/src/vs/workbench/workbench.web.api.ts @@ -11,6 +11,8 @@ import { IWebSocketFactory } from 'vs/platform/remote/browser/browserSocketFacto import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService'; import { IExtensionManifest } from 'vs/platform/extensions/common/extensions'; import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService'; +import { IProductConfiguration } from 'vs/platform/product/common/product'; +import { LogLevel } from 'vs/platform/log/common/log'; export interface IWorkbenchConstructionOptions { @@ -18,7 +20,7 @@ export interface IWorkbenchConstructionOptions { * Experimental: the remote authority is the IP:PORT from where the workbench is served * from. It is for example being used for the websocket connections as address. */ - remoteAuthority: string; + remoteAuthority?: string; /** * The connection token to send to the server. @@ -71,6 +73,16 @@ export interface IWorkbenchConstructionOptions { * Experimental: Support for URL callbacks. */ urlCallbackProvider?: IURLCallbackProvider; + + /** + * Experimental: Support for product configuration. + */ + productConfiguration?: IProductConfiguration; + + /** + * Current logging level. Default is `LogLevel.Info`. + */ + logLevel?: LogLevel; } /** diff --git a/test/electron/renderer.html b/test/electron/renderer.html index a2d4bcc5ad9..38005b2d609 100644 --- a/test/electron/renderer.html +++ b/test/electron/renderer.html @@ -19,9 +19,9 @@ // windows. This we cannot allow as it may crash // the test run. // !!! DO NOT CHANGE !!! - window.open = function () {return null;}; - window.alert = function () {} - window.confirm = function () {} + window.open = function () { throw new Error('window.open() is not supported in tests!'); }; + window.alert = function () { throw new Error('window.alert() is not supported in tests!'); } + window.confirm = function () { throw new Error('window.confirm() is not supported in tests!'); } mocha.setup({ ui: 'tdd', diff --git a/test/smoke/package.json b/test/smoke/package.json index 185fc07d64f..99e9ddf0852 100644 --- a/test/smoke/package.json +++ b/test/smoke/package.json @@ -23,7 +23,7 @@ "@types/webdriverio": "4.6.1", "concurrently": "^3.5.1", "cpx": "^1.5.0", - "electron": "4.2.9", + "electron": "4.2.10", "htmlparser2": "^3.9.2", "mkdirp": "^0.5.1", "mocha": "^5.2.0", diff --git a/test/smoke/src/application.ts b/test/smoke/src/application.ts index 60ed794ae9a..f7510ca502c 100644 --- a/test/smoke/src/application.ts +++ b/test/smoke/src/application.ts @@ -69,7 +69,7 @@ export class Application { await this.code.waitForElement('.explorer-folders-view'); if (expectWalkthroughPart) { - await this.code.waitForActiveElement(`.editor-instance[id="workbench.editor.walkThroughPart"] > div > div[tabIndex="0"]`); + await this.code.waitForActiveElement(`.editor-instance[data-editor-id="workbench.editor.walkThroughPart"] > div > div[tabIndex="0"]`); } } diff --git a/test/smoke/src/vscode/puppeteerDriver.ts b/test/smoke/src/vscode/puppeteerDriver.ts index e7ae860b551..d8f8bd19091 100644 --- a/test/smoke/src/vscode/puppeteerDriver.ts +++ b/test/smoke/src/vscode/puppeteerDriver.ts @@ -168,7 +168,7 @@ export interface IElement { } export interface IDriver { - _serviceBrand: any; + _serviceBrand: undefined; getWindowIds(): Promise; capturePage(windowId: number): Promise; diff --git a/test/smoke/tsconfig.json b/test/smoke/tsconfig.json index 1b0b03c2d67..6f0b40e93e5 100644 --- a/test/smoke/tsconfig.json +++ b/test/smoke/tsconfig.json @@ -4,7 +4,7 @@ "noImplicitAny": false, "removeComments": false, "preserveConstEnums": true, - "target": "es2016", + "target": "es2017", "strictNullChecks": true, "noUnusedParameters": false, "noUnusedLocals": true, @@ -18,4 +18,4 @@ "exclude": [ "node_modules" ] -} \ No newline at end of file +} diff --git a/test/smoke/yarn.lock b/test/smoke/yarn.lock index 5219fecf778..81f81a3f414 100644 --- a/test/smoke/yarn.lock +++ b/test/smoke/yarn.lock @@ -683,10 +683,10 @@ electron-download@^4.1.0: semver "^5.4.1" sumchecker "^2.0.2" -electron@4.2.9: - version "4.2.9" - resolved "https://registry.yarnpkg.com/electron/-/electron-4.2.9.tgz#81226aa1ba58e1b05388474faf5a815010a11ea2" - integrity sha512-zC7K3GOiZKmxqllVG/qq/Gx+qQvyolKj5xKKwXMqIGekfokEW2hvoIO5Yh7KCoAh5dqBtpzOJjS4fj1se+YBcg== +electron@4.2.10: + version "4.2.10" + resolved "https://registry.yarnpkg.com/electron/-/electron-4.2.10.tgz#7096450bb14875ec2e6797316c0c1034e7fe2b76" + integrity sha512-dFhsJOW7OZX8JxjoBdugUZh6VWbs5PjlQIH6/w1KsZO7otgBy44j9vPI31KnIid3bdMtNbmTEF+6PA32z88kRw== dependencies: "@types/node" "^10.12.18" electron-download "^4.1.0" diff --git a/test/splitview/public/index.html b/test/splitview/public/index.html index 602682d6aab..2df71316146 100644 --- a/test/splitview/public/index.html +++ b/test/splitview/public/index.html @@ -31,51 +31,131 @@ - \ No newline at end of file + diff --git a/yarn.lock b/yarn.lock index 90baeda9809..9d0ed2b8177 100644 --- a/yarn.lock +++ b/yarn.lock @@ -411,33 +411,16 @@ acorn-dynamic-import@^3.0.0: dependencies: acorn "^5.0.0" -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= - dependencies: - acorn "^3.0.4" - acorn-jsx@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= - acorn@^5.0.0, acorn@^5.6.2: version "5.7.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" integrity sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ== -acorn@^5.5.0: - version "5.7.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" - integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== - acorn@^6.0.2: version "6.0.7" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.7.tgz#490180ce18337270232d9488a44be83d9afb7fd3" @@ -457,11 +440,6 @@ agent-base@~4.2.0: dependencies: es6-promisify "^5.0.0" -ajv-keywords@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" - integrity sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I= - ajv-keywords@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" @@ -477,7 +455,7 @@ ajv@^5.1.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" -ajv@^5.2.3, ajv@^5.3.0: +ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= @@ -536,11 +514,6 @@ ansi-cyan@^0.1.1: dependencies: ansi-wrap "0.1.0" -ansi-escapes@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" - integrity sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw== - ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" @@ -717,11 +690,6 @@ array-each@^1.0.0, array-each@^1.0.1: resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= -array-find-index@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= - array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -870,11 +838,6 @@ async-settle@^1.0.0: dependencies: async-done "^1.2.2" -async@^1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= - async@^2.1.5: version "2.6.1" resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" @@ -941,15 +904,6 @@ azure-storage@^2.10.2: xml2js "0.2.8" xmlbuilder "^9.0.7" -babel-code-frame@^6.22.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - bach@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/bach/-/bach-1.2.0.tgz#4b3ce96bf27134f79a1b414a51c14e34c3bd9880" @@ -1328,46 +1282,16 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= - callsites@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== -camelcase-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" - integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= - dependencies: - camelcase "^2.0.0" - map-obj "^1.0.0" - -camelcase@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= - camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= -camelcase@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" - integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= - camelcase@^5.0.0: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" @@ -1425,7 +1349,7 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.4.1: +chalk@^2.0.0: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== @@ -1452,16 +1376,6 @@ chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= - -chardet@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.5.0.tgz#fe3ac73c00c3d865ffcc02a0682e2c20b6a06029" - integrity sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g== - chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -1548,11 +1462,6 @@ chromium-pickle-js@^0.2.0: resolved "https://registry.yarnpkg.com/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz#04a106672c18b085ab774d983dfa3ea138f22205" integrity sha1-BKEGZywYsIWrd02YPfo+oTjyIgU= -ci-info@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.1.tgz#47b44df118c48d2597b56d342e7e25791060171a" - integrity sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ== - cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" @@ -1604,15 +1513,6 @@ cliui@^3.2.0: strip-ansi "^3.0.1" wrap-ansi "^2.0.0" -cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" - integrity sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -1737,11 +1637,6 @@ colormin@^1.0.5: css-color-names "0.0.4" has "^1.0.1" -colors@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" - integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs= - colors@^1.1.2: version "1.2.1" resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.1.tgz#f4a3d302976aaf042356ba1ade3b1a2c62d9d794" @@ -1783,7 +1678,7 @@ commander@0.6.1: resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06" integrity sha1-+mihT2qUXVTbvlDYzbMyDp47GgY= -commander@2.11.x, commander@^2.8.1, commander@^2.9.0, commander@~2.11.0: +commander@2.11.x, commander@^2.8.1, commander@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== @@ -1828,15 +1723,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" - integrity sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc= - dependencies: - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - concat-stream@1.6.2, concat-stream@^1.5.0, concat-stream@^1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" @@ -1955,11 +1841,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -corser@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" - integrity sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c= - coveralls@^2.11.11: version "2.13.3" resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-2.13.3.tgz#9ad7c2ae527417f361e8b626483f48ee92dd2bc7" @@ -2002,15 +1883,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.0.1, cross-spawn@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -2148,13 +2020,6 @@ cuint@^0.2.1: resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" integrity sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs= -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= - dependencies: - array-find-index "^1.0.1" - cyclist@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" @@ -2191,7 +2056,7 @@ debug@2.2.0: dependencies: ms "0.7.1" -debug@2.6.9, debug@^2.1.2, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3: +debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -2205,7 +2070,7 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@^3.1.0, debug@^3.2.6: +debug@^3.1.0: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -2224,13 +2089,6 @@ decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decamelize@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" - integrity sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg== - dependencies: - xregexp "4.0.0" - decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -2261,11 +2119,6 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" - integrity sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8= - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2532,16 +2385,6 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -ecstatic@^3.0.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.3.1.tgz#b15b5b036c2233defc78d7bacbd8765226c95577" - integrity sha512-/rrctvxZ78HMI/tPIsqdvFKHHscxR3IJuKrZI2ZoUgkt2SiufyLFBmcco+aqQBIu6P1qBsUNG3drAAGLx80vTQ== - dependencies: - he "^1.1.1" - mime "^1.6.0" - minimist "^1.1.0" - url-join "^2.0.5" - editorconfig@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.0.tgz#b6dd4a0b6b9e76ce48e066bdc15381aebb8804fd" @@ -2571,29 +2414,6 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-download@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-4.1.0.tgz#bf932c746f2f87ffcc09d1dd472f2ff6b9187845" - integrity sha1-v5MsdG8vh//MCdHdRy8v9rkYeEU= - dependencies: - debug "^2.2.0" - env-paths "^1.0.0" - fs-extra "^2.0.0" - minimist "^1.2.0" - nugget "^2.0.0" - path-exists "^3.0.0" - rc "^1.1.2" - semver "^5.3.0" - sumchecker "^2.0.1" - -electron-mksnapshot@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/electron-mksnapshot/-/electron-mksnapshot-2.0.0.tgz#c7a9e95b86693fdfe60ea7b65df6c237009e4be8" - integrity sha512-OoZwZJNKgHP+DwhCGVTJEuDSeb478hOzAbHeg7dKGCHDbKKmUWmjGc+pEjxGutpqQ3Mn8hCdLzdx2c/lAJcTLA== - dependencies: - electron-download "^4.1.0" - extract-zip "^1.6.5" - electron-to-chromium@^1.2.7: version "1.3.27" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" @@ -2648,11 +2468,6 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" integrity sha1-blwtClYhtdra7O+AuQ7ftc13cvA= -env-paths@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" - integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= - errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" @@ -2729,14 +2544,6 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.3, escape-string-regexp@^ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-scope@^3.7.1: - version "3.7.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.3.tgz#bb507200d3d17f60247636160b4826284b108535" - integrity sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA== - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - eslint-scope@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" @@ -2755,50 +2562,6 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^4.18.2: - version "4.19.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" - integrity sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ== - dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^3.7.1" - eslint-visitor-keys "^1.0.0" - espree "^3.5.4" - esquery "^1.0.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - regexpp "^1.0.1" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "4.0.2" - text-table "~0.2.0" - eslint@^5.0.1: version "5.13.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.13.0.tgz#ce71cc529c450eed9504530939aa97527861ede9" @@ -2841,14 +2604,6 @@ eslint@^5.0.1: table "^5.0.2" text-table "^0.2.0" -espree@^3.5.4: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - espree@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.0.tgz#fc7f984b62b36a0f543b13fb9cd7b9f4a7f5b65c" @@ -2868,13 +2623,6 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" integrity sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw== -esquery@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" - integrity sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo= - dependencies: - estraverse "^4.0.0" - esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" @@ -2931,11 +2679,6 @@ event-stream@~3.3.4: stream-combiner "^0.2.2" through "^2.3.8" -eventemitter3@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" - integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== - events@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" @@ -2949,19 +2692,6 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -3082,24 +2812,6 @@ extend@^3.0.2, extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -external-editor@^2.0.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - -external-editor@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.0.tgz#dc35c48c6f98a30ca27a20e9687d7f3c77704bb6" - integrity sha512-mpkfj0FEdxrIhOC04zk85X7StNtr0yXnG7zCb+8ikO8OJi2jsHh5YGoknNTyXgsbHOf1WOOcVU3kPFWT2WgCkQ== - dependencies: - chardet "^0.5.0" - iconv-lite "^0.4.22" - tmp "^0.0.33" - external-editor@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" @@ -3130,16 +2842,6 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-zip@^1.6.5: - version "1.6.6" - resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" - integrity sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw= - dependencies: - concat-stream "1.6.0" - debug "2.6.9" - mkdirp "0.5.0" - yauzl "2.4.1" - extract-zip@^1.6.6: version "1.6.7" resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" @@ -3281,11 +2983,6 @@ find-cache-dir@^1.0.0: make-dir "^1.0.0" pkg-dir "^2.0.0" -find-parent-dir@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" - integrity sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ= - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -3362,13 +3059,6 @@ flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: inherits "^2.0.1" readable-stream "^2.0.4" -follow-redirects@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" - integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== - dependencies: - debug "^3.2.6" - for-in@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.5.tgz#007374e2b6d5c67420a1479bdb75a04872b738c4" @@ -3478,14 +3168,6 @@ fs-extra@0.26.7: path-is-absolute "^1.0.0" rimraf "^2.2.8" -fs-extra@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35" - integrity sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU= - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -3597,16 +3279,6 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-stdin@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" - integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= - -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= - get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -3760,11 +3432,6 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -global-modules-path@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/global-modules-path/-/global-modules-path-2.3.0.tgz#b0e2bac6beac39745f7db5c59d26a36a0b94f7dc" - integrity sha512-HchvMJNYh9dGSCy8pOQ2O8u/hoXaL+0XhnrwH0RyLiSXMMTl9W3N6KUU73+JFOg5PGjtzl6VZzUQsnrpm7Szag== - global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" @@ -3785,7 +3452,7 @@ global-prefix@^1.0.1: is-windows "^1.0.1" which "^1.2.14" -globals@^11.0.1, globals@^11.1.0: +globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== @@ -4062,19 +3729,6 @@ gulp-tslint@^8.1.3: plugin-error "1.0.1" through "~2.3.8" -gulp-uglify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca" - integrity sha1-DfAzHXKg0wLj434QlIXd3zPG0co= - dependencies: - gulplog "^1.0.0" - has-gulplog "^0.1.0" - lodash "^4.13.1" - make-error-cause "^1.1.1" - through2 "^2.0.0" - uglify-js "^3.0.5" - vinyl-sourcemaps-apply "^0.2.0" - gulp-untar@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/gulp-untar/-/gulp-untar-0.0.7.tgz#92067d79e0fa1e92d60562a100233a44a5aa08b4" @@ -4180,13 +3834,6 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= -has-gulplog@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" - integrity sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4= - dependencies: - sparkles "^1.0.0" - has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" @@ -4278,11 +3925,6 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -he@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -4349,29 +3991,6 @@ http-proxy-agent@2.1.0, http-proxy-agent@^2.1.0: agent-base "4" debug "3.1.0" -http-proxy@^1.8.1: - version "1.17.0" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.17.0.tgz#7ad38494658f84605e2f6db4436df410f4e5be9a" - integrity sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g== - dependencies: - eventemitter3 "^3.0.0" - follow-redirects "^1.0.0" - requires-port "^1.0.0" - -http-server@^0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.11.1.tgz#2302a56a6ffef7f9abea0147d838a5e9b6b6a79b" - integrity sha512-6JeGDGoujJLmhjiRGlt8yK8Z9Kl0vnl/dQoQZlc4oeqaUoAKQg94NILLfrY3oWzSyFaQCVNTcKE5PZ3cH8VP9w== - dependencies: - colors "1.0.3" - corser "~2.0.0" - ecstatic "^3.0.0" - http-proxy "^1.8.1" - opener "~1.4.0" - optimist "0.6.x" - portfinder "^1.0.13" - union "~0.4.3" - http-signature@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" @@ -4403,16 +4022,6 @@ https-proxy-agent@2.2.1, https-proxy-agent@^2.2.1: agent-base "^4.1.0" debug "^3.1.0" -husky@^0.13.1: - version "0.13.4" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.13.4.tgz#48785c5028de3452a51c48c12c4f94b2124a1407" - integrity sha1-SHhcUCjeNFKlHEjBLE+UshJKFAc= - dependencies: - chalk "^1.1.3" - find-parent-dir "^0.3.0" - is-ci "^1.0.9" - normalize-path "^1.0.0" - iconv-lite@0.4.19, iconv-lite@^0.4.19: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" @@ -4425,14 +4034,14 @@ iconv-lite@0.5.0: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@^0.4.17, iconv-lite@^0.4.24: +iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@^0.4.22, iconv-lite@^0.4.4: +iconv-lite@^0.4.4: version "0.4.23" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" integrity sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA== @@ -4456,7 +4065,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.3, ignore@^3.3.5: +ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== @@ -4474,26 +4083,11 @@ import-fresh@^3.0.0: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - integrity sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ== - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= -indent-string@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= - dependencies: - repeating "^2.0.0" - indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" @@ -4532,45 +4126,6 @@ innosetup@5.6.1: resolved "https://registry.yarnpkg.com/innosetup/-/innosetup-5.6.1.tgz#6e7031ba35b23e716e4f29686bc994052e0c278c" integrity sha512-Eit24N3JR8O0Wpuq/dMWCl2r550eiNP2124SbdbwOob43x89WPGL/SGpZG5EPHu20kV2N+4TwvHwFIM8pFUJ0g== -inquirer@^3.0.6: - version "3.3.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" - integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -inquirer@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.1.0.tgz#8f65c7b31c498285f4ddf3b742ad8c487892040b" - integrity sha512-f9K2MMx/G/AVmJSaZg2a+GVLRRmTdlGLbwxsibNd6yNTxXujqxPypjCnxnC0y4+Wb/rNY5KyKuq06AO5jrE+7w== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.0" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.1.0" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - inquirer@^6.1.0: version "6.2.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" @@ -4684,13 +4239,6 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" -is-ci@^1.0.9: - version "1.0.10" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" - integrity sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4= - dependencies: - ci-info "^1.0.0" - is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -4757,13 +4305,6 @@ is-extglob@^2.1.0, is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= - dependencies: - number-is-nan "^1.0.0" - is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -4896,13 +4437,6 @@ is-relative@^1.0.0: dependencies: is-unc-path "^1.0.0" -is-resolvable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" - integrity sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI= - dependencies: - tryit "^1.0.1" - is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -5078,11 +4612,6 @@ js-beautify@^1.8.9: mkdirp "~0.5.0" nopt "~4.0.1" -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= - js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -5104,7 +4633,7 @@ js-yaml@^3.12.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.13.0, js-yaml@^3.9.1: +js-yaml@^3.13.0: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -5470,7 +4999,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.13.1, lodash@^4.15.0, lodash@^4.3.0: +lodash@^4.15.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" integrity sha1-eCA6TRwyiuHYbcpkYONptX9AVa4= @@ -5505,27 +5034,11 @@ long@^3.2.0: resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" integrity sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s= -loud-rejection@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" - integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= - dependencies: - currently-unhandled "^0.4.1" - signal-exit "^3.0.0" - lru-cache@2: version "2.7.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI= -lru-cache@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" - integrity sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - lru-cache@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" @@ -5562,18 +5075,6 @@ make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-error-cause@^1.1.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" - integrity sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0= - dependencies: - make-error "^1.2.0" - -make-error@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.0.tgz#52ad3a339ccf10ce62b4040b708fe707244b8b96" - integrity sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y= - make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -5598,11 +5099,6 @@ map-cache@^0.2.0, map-cache@^0.2.2: resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= -map-obj@^1.0.0, map-obj@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= - map-stream@0.0.7, map-stream@~0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.7.tgz#8a1f07896d82b10926bd3744a2420009f88974a8" @@ -5673,13 +5169,6 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= -mem@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" - integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= - dependencies: - mimic-fn "^1.0.0" - mem@^4.0.0: version "4.3.0" resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" @@ -5697,22 +5186,6 @@ memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: errno "^0.1.3" readable-stream "^2.0.1" -meow@^3.1.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" - integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= - dependencies: - camelcase-keys "^2.0.0" - decamelize "^1.1.2" - loud-rejection "^1.0.0" - map-obj "^1.0.1" - minimist "^1.1.3" - normalize-package-data "^2.3.4" - object-assign "^4.0.1" - read-pkg-up "^1.0.1" - redent "^1.0.0" - trim-newlines "^1.0.0" - merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" @@ -5812,7 +5285,7 @@ mime@1.4.1, mime@^1.3.4: resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== -mime@^1.4.1, mime@^1.6.0: +mime@^1.4.1: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== @@ -5867,7 +5340,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@1.2.0, minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= @@ -5921,14 +5394,7 @@ mkdirp@0.3.0: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" integrity sha1-G79asbqCevI1dRQ0kEJkVfSB/h4= -mkdirp@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" - integrity sha1-HXMHam35hs2TROFecfzAWkyavxI= - dependencies: - minimist "0.0.8" - -mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -6203,7 +5669,7 @@ nopt@~1.0.10: dependencies: abbrev "1" -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: +normalize-package-data@^2.3.2: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" integrity sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw== @@ -6213,11 +5679,6 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k= - normalize-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" @@ -6304,19 +5765,6 @@ nth-check@~1.0.1: dependencies: boolbase "~1.0.0" -nugget@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/nugget/-/nugget-2.0.1.tgz#201095a487e1ad36081b3432fa3cada4f8d071b0" - integrity sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA= - dependencies: - debug "^2.1.3" - minimist "^1.1.0" - pretty-bytes "^1.0.2" - progress-stream "^1.1.0" - request "^2.45.0" - single-line-log "^1.1.2" - throttleit "0.0.2" - num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -6457,15 +5905,10 @@ oniguruma@^7.2.0: dependencies: nan "^2.14.0" -opener@~1.4.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8" - integrity sha1-XG2ixdflgx6P+jlklQ+NZnSskLg= - -opn@^5.4.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" - integrity sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA== +opn@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/opn/-/opn-6.0.0.tgz#3c5b0db676d5f97da1233d1ed42d182bc5a27d2d" + integrity sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ== dependencies: is-wsl "^1.1.0" @@ -6476,7 +5919,7 @@ optimist@0.3.5: dependencies: wordwrap "~0.0.2" -optimist@0.6.x, optimist@^0.6.1: +optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= @@ -6528,15 +5971,6 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" -os-locale@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" - integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== - dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" - os-locale@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" @@ -6913,20 +6347,6 @@ plugin-error@1.0.1, plugin-error@^1.0.1: arr-union "^3.1.0" extend-shallow "^3.0.2" -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== - -portfinder@^1.0.13: - version "1.0.20" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.20.tgz#bea68632e54b2e13ab7b0c4775e9b41bf270e44a" - integrity sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw== - dependencies: - async "^1.5.2" - debug "^2.2.0" - mkdirp "0.5.x" - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -7209,14 +6629,6 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= -pretty-bytes@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84" - integrity sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ= - dependencies: - get-stdin "^4.0.1" - meow "^3.1.0" - pretty-hrtime@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" @@ -7250,14 +6662,6 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= -progress-stream@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/progress-stream/-/progress-stream-1.2.0.tgz#2cd3cfea33ba3a89c9c121ec3347abe9ab125f77" - integrity sha1-LNPP6jO6OonJwSHsM0er6asSX3c= - dependencies: - speedometer "~0.1.2" - through2 "~0.2.3" - progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" @@ -7397,11 +6801,6 @@ qs@6.5.1, qs@~6.5.1: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" integrity sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A== -qs@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404" - integrity sha1-6eha2+ddoLvkyOBHaghikPhjtAQ= - qs@~6.3.0: version "6.3.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c" @@ -7489,16 +6888,6 @@ raw-body@2.3.2: iconv-lite "0.4.19" unpipe "1.0.0" -rc@^1.1.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" - integrity sha1-2M6ctX6NZNnHut2YdsfDTL48cHc= - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -7575,7 +6964,7 @@ read@^1.0.7: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@^1.1.8, readable-stream@~1.1.9: +readable-stream@^1.1.8: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= @@ -7636,14 +7025,6 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -redent@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" - integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= - dependencies: - indent-string "^2.1.0" - strip-indent "^1.0.1" - reduce-css-calc@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716" @@ -7676,11 +7057,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" - integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== - regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" @@ -7723,13 +7099,6 @@ repeat-string@^1.6.1: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= - dependencies: - is-finite "^1.0.0" - replace-ext@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" @@ -7784,7 +7153,7 @@ request@2.79.0: tunnel-agent "~0.4.1" uuid "^3.0.0" -"request@>= 2.44.0 < 3.0.0", request@^2.45.0, request@^2.79.0: +"request@>= 2.44.0 < 3.0.0", request@^2.79.0: version "2.83.0" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" integrity sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw== @@ -7862,26 +7231,6 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= - -resolve-cwd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" - integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= - dependencies: - resolve-from "^3.0.0" - resolve-dir@^1.0.0, resolve-dir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" @@ -7890,16 +7239,6 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1: expand-tilde "^2.0.0" global-modules "^1.0.0" -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= - -resolve-from@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" - integrity sha1-six699nWiBvItuZTM17rywoYh0g= - resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -7992,25 +7331,6 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - integrity sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74= - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= - -rxjs@^6.1.0: - version "6.2.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" - integrity sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ== - dependencies: - tslib "^1.9.0" - rxjs@^6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" @@ -8233,13 +7553,6 @@ simple-get@^2.7.0: once "^1.3.1" simple-concat "^1.0.0" -single-line-log@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364" - integrity sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q= - dependencies: - string-width "^1.0.1" - sinon@^1.17.2: version "1.17.7" resolved "https://registry.yarnpkg.com/sinon/-/sinon-1.17.7.tgz#4542a4f49ba0c45c05eb2e9dd9d203e2b8efe0bf" @@ -8255,13 +7568,6 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== - dependencies: - is-fullwidth-code-point "^2.0.0" - slice-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" @@ -8412,11 +7718,6 @@ spdx-license-ids@^1.0.2: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" integrity sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc= -speedometer@~0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/speedometer/-/speedometer-0.1.4.tgz#9876dbd2a169d3115402d48e6ea6329c8816a50d" - integrity sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0= - split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -8566,7 +7867,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -8662,13 +7963,6 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= -strip-indent@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" - integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= - dependencies: - get-stdin "^4.0.1" - strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -8679,13 +7973,6 @@ sudo-prompt@9.0.0: resolved "https://registry.yarnpkg.com/sudo-prompt/-/sudo-prompt-9.0.0.tgz#eebedeee9fcd6f661324e6bb46335e3288e8dc8a" integrity sha512-kUn5fiOk0nhY2oKD9onIkcNCE4Zt85WTsvOfSmqCplmlEvXCcPOmp1npH5YWuf8Bmyy9wLWkIxx+D+8cThBORQ== -sumchecker@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e" - integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4= - dependencies: - debug "^2.2.0" - supports-color@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e" @@ -8717,7 +8004,7 @@ supports-color@^5.2.0: dependencies: has-flag "^3.0.0" -supports-color@^5.3.0, supports-color@^5.4.0: +supports-color@^5.3.0: version "5.4.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== @@ -8752,18 +8039,6 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" -table@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" - integrity sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA== - dependencies: - ajv "^5.2.3" - ajv-keywords "^2.1.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - table@^5.0.2: version "5.2.2" resolved "https://registry.yarnpkg.com/table/-/table-5.2.2.tgz#61d474c9e4d8f4f7062c98c7504acb3c08aa738f" @@ -8832,7 +8107,7 @@ temp@^0.8.3: os-tmpdir "^1.0.0" rimraf "~2.2.6" -text-table@^0.2.0, text-table@~0.2.0: +text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= @@ -8842,11 +8117,6 @@ textextensions@~1.0.0: resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-1.0.2.tgz#65486393ee1f2bb039a60cbba05b0b68bd9501d2" integrity sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI= -throttleit@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-0.0.2.tgz#cfedf88e60c00dd9697b61fdd2a8343a9b680eaf" - integrity sha1-z+34jmDADdlpe2H90qg0OptoDq8= - through2-filter@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" @@ -8879,14 +8149,6 @@ through2@^3.0.0: readable-stream "2 || 3" xtend "~4.0.1" -through2@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f" - integrity sha1-6zKE2k6jEbbMis42U3SKUqvyWj8= - dependencies: - readable-stream "~1.1.9" - xtend "~2.1.1" - through2@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/through2/-/through2-0.4.2.tgz#dbf5866031151ec8352bb6c4db64a2292a840b9b" @@ -9027,21 +8289,11 @@ tough-cookie@~2.4.3: resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk= -trim-newlines@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" - integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= - trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -tryit@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" - integrity sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics= - ts-loader@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-4.4.2.tgz#778d4464b24436873c78f7f9e914d88194c2a248" @@ -9157,10 +8409,10 @@ typescript-formatter@7.1.0: commandpost "^1.0.0" editorconfig "^0.15.0" -typescript@3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.2.tgz#a09e1dc69bc9551cadf17dba10ee42cf55e5d56c" - integrity sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA== +typescript@3.6: + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== typescript@^2.6.2: version "2.6.2" @@ -9172,14 +8424,6 @@ uc.micro@^1.0.1, uc.micro@^1.0.3: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.3.tgz#7ed50d5e0f9a9fb0a573379259f2a77458d50192" integrity sha1-ftUNXg+an7ClczeSWfKndFjVAZI= -uglify-es@^3.0.18: - version "3.1.9" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.9.tgz#6c82df628ac9eb7af9c61fd70c744a084abe6161" - integrity sha512-wVSiJKHDgDDFmxTVVvnbAH6IpamAFHYDI+5JvwPdaqIMnk8kRTX2JKwq1Fx7gb2+Jj5Dus8kzvIpKkWOMNU51w== - dependencies: - commander "~2.11.0" - source-map "~0.6.1" - uglify-es@^3.3.4: version "3.3.9" resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" @@ -9188,14 +8432,6 @@ uglify-es@^3.3.4: commander "~2.13.0" source-map "~0.6.1" -uglify-js@^3.0.5: - version "3.1.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.9.tgz#dffca799308cf327ec3ac77eeacb8e196ce3b452" - integrity sha512-ari2E89bD7f+fMU173NgF12JBcOhgoxeyuCs97h5K58IBENrnG9eVj2lFadrOPdqf0KifsxVmUQfzA2cHNxCZQ== - dependencies: - commander "~2.11.0" - source-map "~0.6.1" - uglify-js@^3.1.4: version "3.6.0" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" @@ -9263,13 +8499,6 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^0.4.3" -union@~0.4.3: - version "0.4.6" - resolved "https://registry.yarnpkg.com/union/-/union-0.4.6.tgz#198fbdaeba254e788b0efcb630bc11f24a2959e0" - integrity sha1-GY+9rrolTniLDvy2MLwR8kopWeA= - dependencies: - qs "~2.3.3" - uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" @@ -9354,11 +8583,6 @@ url-join@^1.1.0: resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78" integrity sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg= -url-join@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728" - integrity sha1-WvIvGMBSoACkjXuCxenC4v7tpyg= - url@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -9406,11 +8630,6 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== -v8-compile-cache@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz#a428b28bb26790734c4fc8bc9fa106fccebf6a6c" - integrity sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw== - v8-inspect-profiler@^0.0.20: version "0.0.20" resolved "https://registry.yarnpkg.com/v8-inspect-profiler/-/v8-inspect-profiler-0.0.20.tgz#f7ad0f8178dcea2f1504334e8844ef38181792ab" @@ -9526,7 +8745,7 @@ vinyl-sourcemap@^1.1.0: remove-bom-buffer "^3.0.0" vinyl "^2.0.0" -vinyl-sourcemaps-apply@^0.2.0, vinyl-sourcemaps-apply@^0.2.1: +vinyl-sourcemaps-apply@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= @@ -9636,10 +8855,10 @@ vscode-chokidar@2.1.7: optionalDependencies: vscode-fsevents "1.2.12" -vscode-debugprotocol@1.36.0-pre.0: - version "1.36.0-pre.0" - resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.36.0-pre.0.tgz#4f998e143acae9e3ce13c308d4ad322f96841926" - integrity sha512-nQhImfsUJFfr73JqA2Uc1bjTvpgZRabqkkKQWUbmrrnTLCPKRCr9AgE44Ehb/vkLXNdo+vPnWjJXWnPGjT10mA== +vscode-debugprotocol@1.36.0: + version "1.36.0" + resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.36.0.tgz#88e6246045480a9cc643e819b597396eaa9d0f4b" + integrity sha512-F0MfcUkF88TfNf4iQbcmC+K9rA+zsrQpEz1XpTKidy5sMq8sYsJGUadYDGmmktfjRX+S/ebjHgM+YV/2qm6lVQ== vscode-fsevents@1.2.12: version "1.2.12" @@ -9731,23 +8950,6 @@ watchpack@^1.5.0: graceful-fs "^4.1.2" neo-async "^2.5.0" -webpack-cli@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.1.0.tgz#d71a83687dcfeb758fdceeb0fe042f96bcf62994" - integrity sha512-p5NeKDtYwjZozUWq6kGNs9w+Gtw/CPvyuXjXn2HMdz8Tie+krjEg8oAtonvIyITZdvpF7XG9xDHwscLr2c+ugQ== - dependencies: - chalk "^2.4.1" - cross-spawn "^6.0.5" - enhanced-resolve "^4.0.0" - global-modules-path "^2.1.0" - import-local "^1.0.0" - inquirer "^6.0.0" - interpret "^1.1.0" - loader-utils "^1.1.0" - supports-color "^5.4.0" - v8-compile-cache "^2.0.0" - yargs "^12.0.1" - webpack-sources@^1.0.1, webpack-sources@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54" @@ -9975,11 +9177,6 @@ xmldom@0.1.x: resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= -xregexp@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" - integrity sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg== - "xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -10002,17 +9199,17 @@ xterm-addon-web-links@0.1.0-beta10: resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23" integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg== -xterm@3.15.0-beta99: - version "3.15.0-beta99" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta99.tgz#0010a7ea5d56cbb08a1e3a525b353c96a158e7a0" - integrity sha512-Vm0ZWToWwO4uk/28Kqvqt9L92h5EU2z4WR9I6xcQaPIBmkJPINIARU4LWQnvaOfgFhRbpwBMveTfh8/jM97lPg== +xterm@3.15.0-beta101: + version "3.15.0-beta101" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta101.tgz#38ffa0df5a3e9bdcb1818e74fe59b2f98b0fff69" + integrity sha512-HRa7+FDqQ8iWBTvb1Ni+uMGILnu6k9mF7JHMHRHfWxFoQlSoGYCyfdyXlJjk68YN8GsEQREmrII6cPLiQizdEQ== y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== @@ -10027,13 +9224,6 @@ yallist@^3.0.0, yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" integrity sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k= -yargs-parser@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" - integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== - dependencies: - camelcase "^4.1.0" - yargs-parser@^13.1.0: version "13.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" @@ -10049,24 +9239,6 @@ yargs-parser@^5.0.0: dependencies: camelcase "^3.0.0" -yargs@^12.0.1: - version "12.0.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" - integrity sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ== - dependencies: - cliui "^4.0.0" - decamelize "^2.0.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^10.1.0" - yargs@^13.2.4: version "13.2.4" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83"