Merge branch 'master' into joh/sigusr1

This commit is contained in:
Johannes Rieken 2019-10-08 18:02:55 +02:00 committed by GitHub
commit a5b9969f06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
267 changed files with 1888 additions and 2261 deletions

View file

@ -40,7 +40,7 @@
"mime": "^1.3.4",
"minimist": "^1.2.0",
"request": "^2.85.0",
"terser": "4.3.1",
"terser": "4.3.8",
"tslint": "^5.9.1",
"typescript": "3.6.2",
"vsce": "1.48.0",

View file

@ -2178,10 +2178,10 @@ terser@*:
source-map "~0.6.1"
source-map-support "~0.5.12"
terser@4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65"
integrity sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg==
terser@4.3.8:
version "4.3.8"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.8.tgz#707f05f3f4c1c70c840e626addfdb1c158a17136"
integrity sha512-otmIRlRVmLChAWsnSFNO0Bfk6YySuBp6G9qrHiJwlLDd4mxe2ta4sjI7TzIR+W1nBMjilzrMcPOz9pSusgx3hQ==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"

View file

@ -13,8 +13,7 @@
["[", "]"],
["(", ")"],
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "/*", "close": " */", "notIn": ["string"] }
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] }
],
"surroundingPairs": [
["{", "}"],
@ -30,4 +29,4 @@
"end": "^\\s*#endregion\\b"
}
}
}
}

View file

@ -75,9 +75,9 @@ const fileSystemProvider: FileSystemProvider = {
let type = FileType.Unknown;
if (stats.isFile()) {
type = FileType.File;
} else if (stats.isDirectory) {
} else if (stats.isDirectory()) {
type = FileType.Directory;
} else if (stats.isSymbolicLink) {
} else if (stats.isSymbolicLink()) {
type = FileType.SymbolicLink;
}

View file

@ -362,6 +362,11 @@
"title": "%command.ignore%",
"category": "Git"
},
{
"command": "git.revealInExplorer",
"title": "%command.revealInExplorer%",
"category": "Git"
},
{
"command": "git.stashIncludeUntracked",
"title": "%command.stashIncludeUntracked%",
@ -507,6 +512,10 @@
"command": "git.restoreCommitTemplate",
"when": "false"
},
{
"command": "git.revealInExplorer",
"when": "false"
},
{
"command": "git.undoCommit",
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
@ -913,6 +922,11 @@
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "inline"
},
{
"command": "git.revealInExplorer",
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "2_view"
},
{
"command": "git.openFile2",
"when": "scmProvider == git && scmResourceGroup == merge && config.git.showInlineOpenFileAction && config.git.openDiffOnClick",
@ -948,6 +962,11 @@
"when": "scmProvider == git && scmResourceGroup == index",
"group": "inline"
},
{
"command": "git.revealInExplorer",
"when": "scmProvider == git && scmResourceGroup == index",
"group": "2_view"
},
{
"command": "git.openFile2",
"when": "scmProvider == git && scmResourceGroup == index && config.git.showInlineOpenFileAction && config.git.openDiffOnClick",
@ -1007,6 +1026,11 @@
"command": "git.ignore",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "1_modification@3"
},
{
"command": "git.revealInExplorer",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "2_view"
}
],
"editor/title": [

View file

@ -56,6 +56,7 @@
"command.publish": "Publish Branch",
"command.showOutput": "Show Git Output",
"command.ignore": "Add to .gitignore",
"command.revealInExplorer": "Reveal in Explorer",
"command.stashIncludeUntracked": "Stash (Include Untracked)",
"command.stash": "Stash",
"command.stashPop": "Pop Stash...",

View file

@ -2069,6 +2069,19 @@ export class CommandCenter {
await this.runByRepository(resources, async (repository, resources) => repository.ignore(resources));
}
@command('git.revealInExplorer')
async revealInExplorer(resourceState: SourceControlResourceState): Promise<void> {
if (!resourceState) {
return;
}
if (!(resourceState.resourceUri instanceof Uri)) {
return;
}
await commands.executeCommand('revealInExplorer', resourceState.resourceUri);
}
private async _stash(repository: Repository, includeUntracked = false): Promise<void> {
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0;
const noStagedChanges = repository.indexGroup.resourceStates.length === 0;

View file

@ -160,7 +160,7 @@ export async function mkdirp(path: string, mode?: number): Promise<boolean> {
if (err.code === 'EEXIST') {
const stat = await nfcall<fs.Stats>(fs.stat, path);
if (stat.isDirectory) {
if (stat.isDirectory()) {
return;
}

View file

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
html, body {
width: 100%;
height: 100%;
max-height: 100%;
text-align: center;
}

View file

@ -12,8 +12,7 @@
{ "open": "[", "close": "]", "notIn": ["string"] },
{ "open": "(", "close": ")", "notIn": ["string"] },
{ "open": "'", "close": "'", "notIn": ["string"] },
{ "open": "/*", "close": "*/", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] }
]
}
}

View file

@ -24,7 +24,7 @@ the hover shown on a script or using the command `Run Selected Npm Script`.
### Others
The extension fetches data from https://registry.npmjs/org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.
The extension fetches data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.
## Settings

View file

@ -7,7 +7,7 @@
"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 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.",
"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}",
"taskdef.script": "The npm script to customize.",
"taskdef.path": "The path to the folder of the package.json file that provides the script. Can be omitted.",

View file

@ -23,6 +23,12 @@
"language": "shellscript",
"scopeName": "source.shell",
"path": "./syntaxes/shell-unix-bash.tmLanguage.json"
}]
}],
"configurationDefaults": {
"[shellscript]": {
"files.eol": "\n"
}
}
}
}

View file

@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.40.0",
"distro": "fd32ba99f225d591cb667f0bdf23dbb481743eab",
"distro": "7d62db65536347b7a7c21ae355071b55920c4d84",
"author": {
"name": "Microsoft Corporation"
},
@ -28,10 +28,9 @@
"update-distro": "node build/npm/update-distro.js"
},
"dependencies": {
"@microsoft/applicationinsights-web": "^2.1.1",
"applicationinsights": "1.0.8",
"chokidar": "3.1.0",
"graceful-fs": "4.1.11",
"graceful-fs": "4.2.2",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"iconv-lite": "0.5.0",
@ -52,8 +51,8 @@
"vscode-ripgrep": "^1.5.7",
"vscode-sqlite3": "4.0.8",
"vscode-textmate": "^4.2.2",
"xterm": "4.1.0-beta8",
"xterm-addon-search": "0.2.0",
"xterm": "4.2.0-beta4",
"xterm-addon-search": "0.3.0-beta5",
"xterm-addon-web-links": "0.2.0",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
@ -101,6 +100,7 @@
"gulp-tslint": "^8.1.3",
"gulp-untar": "^0.0.7",
"gulp-vinyl-zip": "^2.1.2",
"husky": "^0.13.1",
"innosetup": "5.6.1",
"is": "^3.1.0",
"istanbul-lib-coverage": "^2.0.5",
@ -153,4 +153,4 @@
"windows-mutex": "0.3.0",
"windows-process-tree": "0.2.4"
}
}
}

View file

@ -2,11 +2,10 @@
"name": "vscode-reh",
"version": "0.0.0",
"dependencies": {
"@microsoft/applicationinsights-web": "^2.1.1",
"applicationinsights": "1.0.8",
"chokidar": "3.1.0",
"cookie": "^0.4.0",
"graceful-fs": "4.1.11",
"graceful-fs": "4.2.2",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"iconv-lite": "0.5.0",
@ -21,8 +20,8 @@
"vscode-proxy-agent": "0.4.0",
"vscode-ripgrep": "^1.5.7",
"vscode-textmate": "^4.2.2",
"xterm": "4.1.0-beta8",
"xterm-addon-search": "0.2.0",
"xterm": "4.2.0-beta4",
"xterm-addon-search": "0.3.0-beta5",
"xterm-addon-web-links": "0.2.0",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"

View file

@ -2,12 +2,11 @@
"name": "vscode-web",
"version": "0.0.0",
"dependencies": {
"@microsoft/applicationinsights-web": "^2.1.1",
"onigasm-umd": "^2.2.2",
"semver-umd": "^5.5.3",
"vscode-textmate": "^4.2.2",
"xterm": "4.1.0-beta8",
"xterm-addon-search": "0.2.0",
"xterm": "4.2.0-beta4",
"xterm-addon-search": "0.3.0-beta5",
"xterm-addon-web-links": "0.2.0"
}
}

View file

@ -2,69 +2,6 @@
# yarn lockfile v1
"@microsoft/applicationinsights-analytics-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-analytics-js/-/applicationinsights-analytics-js-2.1.1.tgz#6d09c1915f808026e2d45165d04802f09affed59"
integrity sha512-VKIutoFKY99CyKwxLUuj6Vnq14/QwXo9/QSQDpYnHEjo+uKn7QmLsHqWw0K9uYNfNAXt4BZimX/zDg6jZtzeXg==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-channel-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-2.1.1.tgz#e205eddd93e49d17d9e0711a612b4bfc9810888f"
integrity sha512-fYr9IAqtaEr9AmaPaL3SLQVT3t3GQzl+n74gpNKyAVakDIm0nYQ/bimjdcAhJMDf1VGNSPg/xICneyuZg7Wxlg==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-common@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-common/-/applicationinsights-common-2.1.1.tgz#27e6074584a7a3a8ca3f11f7ff2b7ff0f395bf2d"
integrity sha512-2hkS1Ia1FmAjCuYZ5JlG20/WgObqdsKtmK5YALAFGHIB4KSQ/Za1qazS+7GsG+E0F9UJivNWL1geUIcNqg5Qjg==
dependencies:
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-core-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.1.1.tgz#30fb6a519cc1c6119c419c4811ce72c260217d9e"
integrity sha512-4t4wf6SKqIcWEQDPg/uOhm+BxtHhu/AFreyEoYZmMfcxzAu33h1FtTQRtxBNbYH1+thiNZCh80yUpnT7d9Hrlw==
dependencies:
tslib "^1.9.3"
"@microsoft/applicationinsights-dependencies-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-dependencies-js/-/applicationinsights-dependencies-js-2.1.1.tgz#8154c3efcb24617d015d0bce7c2cc47797a8d3c4"
integrity sha512-yhb4EToBp+aI+qLo0h5NDNtoo3sDFV60uyIOK843YjzXqVotcXX/lRShlghTkJtYH09QhrdzDjViUHnD4sMFSQ==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-properties-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-properties-js/-/applicationinsights-properties-js-2.1.1.tgz#ca34232766eb16167b5d87693e2ae5d94f2a1559"
integrity sha512-8l+/ppw6xKTam2RL4EHZ52Lcf217olw81j6kyBNKtIcGwSnLNHrFwEeF3vBWIteG2JKzlg1GhGjrkB3oxXsV2g==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-web@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-web/-/applicationinsights-web-2.1.1.tgz#1a44eddda7c244b88d9eb052dab6c855682e4f05"
integrity sha512-crvhCkNsNxkFuPWmttyWNSAA96D5FxBtKS6UA9MV9f9XHevTfchf/E3AuU9JZcsXufWMQLwLrUQ9ZiA1QJ0EWA==
dependencies:
"@microsoft/applicationinsights-analytics-js" "2.1.1"
"@microsoft/applicationinsights-channel-js" "2.1.1"
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
"@microsoft/applicationinsights-dependencies-js" "2.1.1"
"@microsoft/applicationinsights-properties-js" "2.1.1"
nan@^2.14.0:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
@ -87,11 +24,6 @@ semver-umd@^5.5.3:
resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e"
integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw==
tslib@^1.9.3:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
vscode-textmate@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.2.2.tgz#0b4dabc69a6fba79a065cb6b615f66eac07c8f4c"
@ -99,17 +31,17 @@ vscode-textmate@^4.2.2:
dependencies:
oniguruma "^7.2.0"
xterm-addon-search@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.2.0.tgz#46659c7c33f9fc268ad3e7e6c5824bb2fdb65852"
integrity sha512-C/v2VvFn3hb1qUgjJPo7LxzxNCLBgNJv8n6v/bH2NqPz32/PNUF+IHu0SFf1TaIH+pydUpKXCtob5a/UyZg/+Q==
xterm-addon-search@0.3.0-beta5:
version "0.3.0-beta5"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.3.0-beta5.tgz#fd53d33a77a0235018479c712be8c12f7c0d083a"
integrity sha512-3GkGc4hST35/4hzgnQPLLvQ29WH7MkZ0mUrBE/Vm1IQum7TnMvWPTkGemwM+wAl4tdBmynNccHJlFeQzaQtVUg==
xterm-addon-web-links@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.0.tgz#b408a0be46211d8d4a0bb5e701d8f3c2bd07d473"
integrity sha512-dq81c4Pzli2PgKVBgY2REte9sCVibR3df8AP3SEvCTM9uYFnUFxtxzMTplPnc7+rXabVhFdbU6x+rstIk8HNQg==
xterm@4.1.0-beta8:
version "4.1.0-beta8"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.1.0-beta8.tgz#c1ef323ba336d92f5b52302b66f672dfff75b3ef"
integrity sha512-6lf+XVv0qT285w49P92tSYoUB406jdbgdhnPKNzxCIGtGX8kcwK+pHZ8HncDwcEhmTmI4LZ/WXPGtOQJg+onwg==
xterm@4.2.0-beta4:
version "4.2.0-beta4"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.2.0-beta4.tgz#596577f94a1da372119d192363ea2b19d1f8b50c"
integrity sha512-BmkpxCpqdOJoNdIcddkRT8S65sGjgBbWI0uIJNSnzZvj81OKcraMSTmF/ODw0TF/MDLc33Fx9cpDx/D6lQgl8Q==

View file

@ -2,69 +2,6 @@
# yarn lockfile v1
"@microsoft/applicationinsights-analytics-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-analytics-js/-/applicationinsights-analytics-js-2.1.1.tgz#6d09c1915f808026e2d45165d04802f09affed59"
integrity sha512-VKIutoFKY99CyKwxLUuj6Vnq14/QwXo9/QSQDpYnHEjo+uKn7QmLsHqWw0K9uYNfNAXt4BZimX/zDg6jZtzeXg==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-channel-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-2.1.1.tgz#e205eddd93e49d17d9e0711a612b4bfc9810888f"
integrity sha512-fYr9IAqtaEr9AmaPaL3SLQVT3t3GQzl+n74gpNKyAVakDIm0nYQ/bimjdcAhJMDf1VGNSPg/xICneyuZg7Wxlg==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-common@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-common/-/applicationinsights-common-2.1.1.tgz#27e6074584a7a3a8ca3f11f7ff2b7ff0f395bf2d"
integrity sha512-2hkS1Ia1FmAjCuYZ5JlG20/WgObqdsKtmK5YALAFGHIB4KSQ/Za1qazS+7GsG+E0F9UJivNWL1geUIcNqg5Qjg==
dependencies:
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-core-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.1.1.tgz#30fb6a519cc1c6119c419c4811ce72c260217d9e"
integrity sha512-4t4wf6SKqIcWEQDPg/uOhm+BxtHhu/AFreyEoYZmMfcxzAu33h1FtTQRtxBNbYH1+thiNZCh80yUpnT7d9Hrlw==
dependencies:
tslib "^1.9.3"
"@microsoft/applicationinsights-dependencies-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-dependencies-js/-/applicationinsights-dependencies-js-2.1.1.tgz#8154c3efcb24617d015d0bce7c2cc47797a8d3c4"
integrity sha512-yhb4EToBp+aI+qLo0h5NDNtoo3sDFV60uyIOK843YjzXqVotcXX/lRShlghTkJtYH09QhrdzDjViUHnD4sMFSQ==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-properties-js@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-properties-js/-/applicationinsights-properties-js-2.1.1.tgz#ca34232766eb16167b5d87693e2ae5d94f2a1559"
integrity sha512-8l+/ppw6xKTam2RL4EHZ52Lcf217olw81j6kyBNKtIcGwSnLNHrFwEeF3vBWIteG2JKzlg1GhGjrkB3oxXsV2g==
dependencies:
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
tslib "^1.9.3"
"@microsoft/applicationinsights-web@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-web/-/applicationinsights-web-2.1.1.tgz#1a44eddda7c244b88d9eb052dab6c855682e4f05"
integrity sha512-crvhCkNsNxkFuPWmttyWNSAA96D5FxBtKS6UA9MV9f9XHevTfchf/E3AuU9JZcsXufWMQLwLrUQ9ZiA1QJ0EWA==
dependencies:
"@microsoft/applicationinsights-analytics-js" "2.1.1"
"@microsoft/applicationinsights-channel-js" "2.1.1"
"@microsoft/applicationinsights-common" "2.1.1"
"@microsoft/applicationinsights-core-js" "2.1.1"
"@microsoft/applicationinsights-dependencies-js" "2.1.1"
"@microsoft/applicationinsights-properties-js" "2.1.1"
agent-base@4, agent-base@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce"
@ -211,7 +148,12 @@ glob-parent@^5.0.0:
dependencies:
is-glob "^4.0.1"
graceful-fs@4.1.11, graceful-fs@^4.1.2:
graceful-fs@4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02"
integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==
graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=
@ -430,11 +372,6 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
tslib@^1.9.3:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
@ -479,20 +416,20 @@ vscode-windows-registry@1.0.2:
resolved "https://registry.yarnpkg.com/vscode-windows-registry/-/vscode-windows-registry-1.0.2.tgz#b863e704a6a69c50b3098a55fbddbe595b0c124a"
integrity sha512-/CLLvuOSM2Vme2z6aNyB+4Omd7hDxpf4Thrt8ImxnXeQtxzel2bClJpFQvQqK/s4oaXlkBKS7LqVLeZM+uSVIA==
xterm-addon-search@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.2.0.tgz#46659c7c33f9fc268ad3e7e6c5824bb2fdb65852"
integrity sha512-C/v2VvFn3hb1qUgjJPo7LxzxNCLBgNJv8n6v/bH2NqPz32/PNUF+IHu0SFf1TaIH+pydUpKXCtob5a/UyZg/+Q==
xterm-addon-search@0.3.0-beta5:
version "0.3.0-beta5"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.3.0-beta5.tgz#fd53d33a77a0235018479c712be8c12f7c0d083a"
integrity sha512-3GkGc4hST35/4hzgnQPLLvQ29WH7MkZ0mUrBE/Vm1IQum7TnMvWPTkGemwM+wAl4tdBmynNccHJlFeQzaQtVUg==
xterm-addon-web-links@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.0.tgz#b408a0be46211d8d4a0bb5e701d8f3c2bd07d473"
integrity sha512-dq81c4Pzli2PgKVBgY2REte9sCVibR3df8AP3SEvCTM9uYFnUFxtxzMTplPnc7+rXabVhFdbU6x+rstIk8HNQg==
xterm@4.1.0-beta8:
version "4.1.0-beta8"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.1.0-beta8.tgz#c1ef323ba336d92f5b52302b66f672dfff75b3ef"
integrity sha512-6lf+XVv0qT285w49P92tSYoUB406jdbgdhnPKNzxCIGtGX8kcwK+pHZ8HncDwcEhmTmI4LZ/WXPGtOQJg+onwg==
xterm@4.2.0-beta4:
version "4.2.0-beta4"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.2.0-beta4.tgz#596577f94a1da372119d192363ea2b19d1f8b50c"
integrity sha512-BmkpxCpqdOJoNdIcddkRT8S65sGjgBbWI0uIJNSnzZvj81OKcraMSTmF/ODw0TF/MDLc33Fx9cpDx/D6lQgl8Q==
yauzl@^2.9.2:
version "2.10.0"

View file

@ -30,7 +30,7 @@ if [ ! -L $0 ]; then
# if path is not a symlink, find relatively
VSCODE_PATH="$(dirname $0)/.."
else
if which readlink >/dev/null; then
if command -v readlink >/dev/null; then
# if readlink exists, follow the symlink and find relatively
VSCODE_PATH="$(dirname $(readlink -f $0))/.."
else

View file

@ -29,10 +29,12 @@ call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
if %errorlevel% neq 0 exit /b %errorlevel%
:: Tests in the extension host
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 --user-data-dir=%VSCODEUSERDATADIR%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
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 --user-data-dir=%VSCODEUSERDATADIR%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
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 --user-data-dir=%VSCODEUSERDATADIR%

View file

@ -37,10 +37,11 @@ fi
./scripts/test.sh --runGlob **/*.integrationTest.js "$@"
# Tests in the extension host
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testWorkspace --enable-proposed-api=vscode.vscode-api-tests --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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR
mkdir -p $ROOT/extensions/emmet/test-fixtures
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --user-data-dir=$VSCODEUSERDATADIR

View file

@ -67,7 +67,7 @@ export class Gesture extends Disposable {
private static readonly SCROLL_FRICTION = -0.005;
private static INSTANCE: Gesture;
private static HOLD_DELAY = 700;
private static readonly HOLD_DELAY = 700;
private dispatched = false;
private targets: HTMLElement[];

View file

@ -85,15 +85,15 @@ export class CountBadge {
private applyStyles(): void {
if (this.element) {
const background = this.badgeBackground ? this.badgeBackground.toString() : null;
const foreground = this.badgeForeground ? this.badgeForeground.toString() : null;
const border = this.badgeBorder ? this.badgeBorder.toString() : null;
const background = this.badgeBackground ? this.badgeBackground.toString() : '';
const foreground = this.badgeForeground ? this.badgeForeground.toString() : '';
const border = this.badgeBorder ? this.badgeBorder.toString() : '';
this.element.style.backgroundColor = background;
this.element.style.color = foreground;
this.element.style.borderWidth = border ? '1px' : null;
this.element.style.borderStyle = border ? 'solid' : null;
this.element.style.borderWidth = border ? '1px' : '';
this.element.style.borderStyle = border ? 'solid' : '';
this.element.style.borderColor = border;
}
}

View file

@ -241,10 +241,10 @@ export class Dialog extends Disposable {
if (this.styles) {
const style = this.styles;
const fgColor = style.dialogForeground ? `${style.dialogForeground}` : null;
const bgColor = style.dialogBackground ? `${style.dialogBackground}` : null;
const shadowColor = style.dialogShadow ? `0 0px 8px ${style.dialogShadow}` : null;
const border = style.dialogBorder ? `1px solid ${style.dialogBorder}` : null;
const fgColor = style.dialogForeground ? `${style.dialogForeground}` : '';
const bgColor = style.dialogBackground ? `${style.dialogBackground}` : '';
const shadowColor = style.dialogShadow ? `0 0px 8px ${style.dialogShadow}` : '';
const border = style.dialogBorder ? `1px solid ${style.dialogBorder}` : '';
if (this.element) {
this.element.style.color = fgColor;

View file

@ -9,7 +9,6 @@ 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, IGridViewOptions } from './gridview';
import { Event } from 'vs/base/common/event';
import { InvisibleSizing } from 'vs/base/browser/ui/splitview/splitview';
export { Orientation, Sizing as GridViewSizing, IViewSize, orthogonal, LayoutPriority } from './gridview';

View file

@ -373,7 +373,7 @@ export class InputBox extends Widget {
dom.addClass(this.element, this.classForType(message.type));
const styles = this.stylesForType(this.message.type);
this.element.style.border = styles.border ? `1px solid ${styles.border}` : null;
this.element.style.border = styles.border ? `1px solid ${styles.border}` : '';
// ARIA Support
let alertText: string;
@ -473,9 +473,9 @@ export class InputBox extends Widget {
dom.addClass(spanElement, this.classForType(this.message.type));
const styles = this.stylesForType(this.message.type);
spanElement.style.backgroundColor = styles.background ? styles.background.toString() : null;
spanElement.style.backgroundColor = styles.background ? styles.background.toString() : '';
spanElement.style.color = styles.foreground ? styles.foreground.toString() : null;
spanElement.style.border = styles.border ? `1px solid ${styles.border}` : null;
spanElement.style.border = styles.border ? `1px solid ${styles.border}` : '';
dom.append(div, spanElement);
@ -552,17 +552,17 @@ export class InputBox extends Widget {
}
protected applyStyles(): void {
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() : '';
const foreground = this.inputForeground ? this.inputForeground.toString() : '';
const border = this.inputBorder ? this.inputBorder.toString() : '';
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.borderWidth = border ? '1px' : '';
this.element.style.borderStyle = border ? 'solid' : '';
this.element.style.borderColor = border;
}

View file

@ -204,7 +204,7 @@ export class Menu extends ActionBar {
}));
const scrollElement = this.scrollableElement.getDomNode();
scrollElement.style.position = null;
scrollElement.style.position = '';
menuElement.style.maxHeight = `${Math.max(10, window.innerHeight - container.getBoundingClientRect().top - 30)}px`;
@ -231,10 +231,10 @@ export class Menu extends ActionBar {
style(style: IMenuStyles): void {
const container = this.getContainer();
const fgColor = style.foregroundColor ? `${style.foregroundColor}` : null;
const bgColor = style.backgroundColor ? `${style.backgroundColor}` : null;
const border = style.borderColor ? `2px solid ${style.borderColor}` : null;
const shadow = style.shadowColor ? `0 2px 4px ${style.shadowColor}` : null;
const fgColor = style.foregroundColor ? `${style.foregroundColor}` : '';
const bgColor = style.backgroundColor ? `${style.backgroundColor}` : '';
const border = style.borderColor ? `2px solid ${style.borderColor}` : '';
const shadow = style.shadowColor ? `0 2px 4px ${style.shadowColor}` : '';
container.style.border = border;
this.domNode.style.color = fgColor;
@ -575,11 +575,11 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
const isSelected = this.element && hasClass(this.element, 'focused');
const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : this.menuStyle.backgroundColor;
const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : null;
const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : '';
this.item.style.color = fgColor ? `${fgColor}` : null;
this.check.style.backgroundColor = fgColor ? `${fgColor}` : null;
this.item.style.backgroundColor = bgColor ? `${bgColor}` : null;
this.check.style.backgroundColor = fgColor ? `${fgColor}` : '';
this.item.style.backgroundColor = bgColor ? `${bgColor}` : '';
this.container.style.border = border;
}
@ -793,7 +793,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
const isSelected = this.element && hasClass(this.element, 'focused');
const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
this.submenuIndicator.style.backgroundColor = fgColor ? `${fgColor}` : null;
this.submenuIndicator.style.backgroundColor = fgColor ? `${fgColor}` : '';
if (this.parentData.submenu) {
this.parentData.submenu.style(this.menuStyle);
@ -819,7 +819,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
class MenuSeparatorActionViewItem extends ActionViewItem {
style(style: IMenuStyles): void {
if (this.label) {
this.label.style.borderBottomColor = style.separatorColor ? `${style.separatorColor}` : null;
this.label.style.borderBottomColor = style.separatorColor ? `${style.separatorColor}` : '';
}
}
}

View file

@ -374,9 +374,9 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
// Style parent select
if (this.selectElement) {
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : null;
const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : null;
const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : null;
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : '';
const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : '';
const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : '';
this.selectElement.style.backgroundColor = background;
this.selectElement.style.color = foreground;
@ -392,10 +392,10 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
private styleList() {
if (this.selectList) {
let background = this.styles.selectBackground ? this.styles.selectBackground.toString() : null;
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : '';
this.selectList.style({});
let listBackground = this.styles.selectListBackground ? this.styles.selectListBackground.toString() : background;
const listBackground = this.styles.selectListBackground ? this.styles.selectListBackground.toString() : background;
this.selectDropDownListContainer.style.backgroundColor = listBackground;
this.selectionDetailsPane.style.backgroundColor = listBackground;
const optionsBorder = this.styles.focusBorder ? this.styles.focusBorder.toString() : '';

View file

@ -147,9 +147,9 @@ export class SelectBoxNative extends Disposable implements ISelectBoxDelegate {
// Style native select
if (this.selectElement) {
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : null;
const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : null;
const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : null;
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : '';
const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : '';
const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : '';
this.selectElement.style.backgroundColor = background;
this.selectElement.style.color = foreground;

View file

@ -229,8 +229,8 @@ export abstract class Panel extends Disposable implements IView {
this.header.setAttribute('aria-expanded', String(expanded));
this.header.style.color = this.styles.headerForeground ? this.styles.headerForeground.toString() : null;
this.header.style.backgroundColor = this.styles.headerBackground ? this.styles.headerBackground.toString() : null;
this.header.style.borderTop = this.styles.headerBorder ? `1px solid ${this.styles.headerBorder}` : null;
this.header.style.backgroundColor = this.styles.headerBackground ? this.styles.headerBackground.toString() : '';
this.header.style.borderTop = this.styles.headerBorder ? `1px solid ${this.styles.headerBorder}` : '';
this._dropBackground = this.styles.dropBackground;
}
@ -340,7 +340,7 @@ class PanelDraggable extends Disposable {
backgroundColor = (this.panel.dropBackground || PanelDraggable.DefaultDragOverBackgroundColor).toString();
}
this.panel.dropTargetElement.style.backgroundColor = backgroundColor;
this.panel.dropTargetElement.style.backgroundColor = backgroundColor || '';
}
}

View file

@ -238,7 +238,7 @@ class EventCollection<T> implements Collection<T> {
class TreeRenderer<T, TFilterData, TRef, TTemplateData> implements IListRenderer<ITreeNode<T, TFilterData>, ITreeListTemplateData<TTemplateData>> {
private static DefaultIndent = 8;
private static readonly DefaultIndent = 8;
readonly templateId: string;
private renderedElements = new Map<T, ITreeNode<T, TFilterData>>();

View file

@ -7,7 +7,7 @@ import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate
import { ObjectTree, IObjectTreeOptions, CompressibleObjectTree, ICompressibleTreeRenderer, ICompressibleKeyboardNavigationLabelProvider, ICompressibleObjectTreeOptions } 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, TreeError, WeakMapper } from 'vs/base/browser/ui/tree/tree';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IDisposable, dispose, DisposableStore } from 'vs/base/common/lifecycle';
import { Emitter, Event } from 'vs/base/common/event';
import { timeout, CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
@ -88,7 +88,6 @@ class AsyncDataTreeRenderer<TInput, T, TFilterData, TTemplateData> implements IT
readonly templateId: string;
private renderedNodes = new Map<IAsyncDataTreeNode<TInput, T>, IDataTreeListTemplateData<TTemplateData>>();
private disposables: IDisposable[] = [];
constructor(
protected renderer: ITreeRenderer<T, TFilterData, TTemplateData>,
@ -124,7 +123,6 @@ class AsyncDataTreeRenderer<TInput, T, TFilterData, TTemplateData> implements IT
dispose(): void {
this.renderedNodes.clear();
this.disposables = dispose(this.disposables);
}
}
@ -292,7 +290,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
protected readonly nodeMapper: AsyncDataTreeNodeMapper<TInput, T, TFilterData> = new WeakMapper(node => new AsyncDataTreeNodeWrapper(node));
protected readonly disposables: IDisposable[] = [];
protected readonly disposables = new DisposableStore();
get onDidScroll(): Event<ScrollEvent> { return this.tree.onDidScroll; }
@ -930,7 +928,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
}
dispose(): void {
dispose(this.disposables);
this.disposables.dispose();
}
}

View file

@ -4,22 +4,28 @@
*--------------------------------------------------------------------------------------------*/
import { DiffChange } from 'vs/base/common/diff/diffChange';
import { stringHash } from 'vs/base/common/hash';
function createStringSequence(a: string): ISequence {
return {
getLength() { return a.length; },
getElementAtIndex(pos: number) { return a.charCodeAt(pos); }
};
export class StringDiffSequence implements ISequence {
constructor(private source: string) { }
getElements(): Int32Array | number[] | string[] {
const source = this.source;
const characters = new Int32Array(source.length);
for (let i = 0, len = source.length; i < len; i++) {
characters[i] = source.charCodeAt(i);
}
return characters;
}
}
export function stringDiff(original: string, modified: string, pretty: boolean): IDiffChange[] {
return new LcsDiff(createStringSequence(original), createStringSequence(modified)).ComputeDiff(pretty);
return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty);
}
export interface ISequence {
getLength(): number;
getElementAtIndex(index: number): number | string;
getElements(): Int32Array | number[] | string[];
}
export interface IDiffChange {
@ -49,7 +55,7 @@ export interface IDiffChange {
}
export interface IContinueProcessingPredicate {
(furthestOriginalIndex: number, originalSequence: ISequence, matchLengthOfLongest: number): boolean;
(furthestOriginalIndex: number, matchLengthOfLongest: number): boolean;
}
//
@ -86,6 +92,11 @@ export class MyArray {
destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
}
}
public static Copy2(sourceArray: Int32Array, sourceIndex: number, destinationArray: Int32Array, destinationIndex: number, length: number) {
for (let i = 0; i < length; i++) {
destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
}
}
}
//*****************************************************************************
@ -214,39 +225,81 @@ class DiffChangeHelper {
*/
export class LcsDiff {
private OriginalSequence: ISequence;
private ModifiedSequence: ISequence;
private ContinueProcessingPredicate: IContinueProcessingPredicate | null;
private readonly ContinueProcessingPredicate: IContinueProcessingPredicate | null;
private m_forwardHistory: number[][];
private m_reverseHistory: number[][];
private readonly _hasStrings: boolean;
private readonly _originalStringElements: string[];
private readonly _originalElementsOrHash: Int32Array;
private readonly _modifiedStringElements: string[];
private readonly _modifiedElementsOrHash: Int32Array;
private m_forwardHistory: Int32Array[];
private m_reverseHistory: Int32Array[];
/**
* Constructs the DiffFinder
*/
constructor(originalSequence: ISequence, newSequence: ISequence, continueProcessingPredicate: IContinueProcessingPredicate | null = null) {
this.OriginalSequence = originalSequence;
this.ModifiedSequence = newSequence;
constructor(originalSequence: ISequence, modifiedSequence: ISequence, continueProcessingPredicate: IContinueProcessingPredicate | null = null) {
this.ContinueProcessingPredicate = continueProcessingPredicate;
const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence);
const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence);
this._hasStrings = (originalHasStrings && modifiedHasStrings);
this._originalStringElements = originalStringElements;
this._originalElementsOrHash = originalElementsOrHash;
this._modifiedStringElements = modifiedStringElements;
this._modifiedElementsOrHash = modifiedElementsOrHash;
this.m_forwardHistory = [];
this.m_reverseHistory = [];
}
private static _isStringArray(arr: Int32Array | number[] | string[]): arr is string[] {
return (arr.length > 0 && typeof arr[0] === 'string');
}
private static _getElements(sequence: ISequence): [string[], Int32Array, boolean] {
const elements = sequence.getElements();
if (LcsDiff._isStringArray(elements)) {
const hashes = new Int32Array(elements.length);
for (let i = 0, len = elements.length; i < len; i++) {
hashes[i] = stringHash(elements[i], 0);
}
return [elements, hashes, true];
}
if (elements instanceof Int32Array) {
return [[], elements, false];
}
return [[], new Int32Array(elements), false];
}
private ElementsAreEqual(originalIndex: number, newIndex: number): boolean {
return (this.OriginalSequence.getElementAtIndex(originalIndex) === this.ModifiedSequence.getElementAtIndex(newIndex));
if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {
return false;
}
return (this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true);
}
private OriginalElementsAreEqual(index1: number, index2: number): boolean {
return (this.OriginalSequence.getElementAtIndex(index1) === this.OriginalSequence.getElementAtIndex(index2));
if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {
return false;
}
return (this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true);
}
private ModifiedElementsAreEqual(index1: number, index2: number): boolean {
return (this.ModifiedSequence.getElementAtIndex(index1) === this.ModifiedSequence.getElementAtIndex(index2));
if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {
return false;
}
return (this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true);
}
public ComputeDiff(pretty: boolean): IDiffChange[] {
return this._ComputeDiff(0, this.OriginalSequence.getLength() - 1, 0, this.ModifiedSequence.getLength() - 1, pretty);
return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);
}
/**
@ -358,7 +411,7 @@ export class LcsDiff {
private WALKTRACE(diagonalForwardBase: number, diagonalForwardStart: number, diagonalForwardEnd: number, diagonalForwardOffset: number,
diagonalReverseBase: number, diagonalReverseStart: number, diagonalReverseEnd: number, diagonalReverseOffset: number,
forwardPoints: number[], reversePoints: number[],
forwardPoints: Int32Array, reversePoints: Int32Array,
originalIndex: number, originalEnd: number, midOriginalArr: number[],
modifiedIndex: number, modifiedEnd: number, midModifiedArr: number[],
deltaIsEven: boolean, quitEarlyArr: boolean[]): DiffChange[] {
@ -523,8 +576,8 @@ export class LcsDiff {
// The modifiedIndex can be computed mathematically from the originalIndex and the diagonal number.
let maxDifferences = (originalEnd - originalStart) + (modifiedEnd - modifiedStart);
let numDiagonals = maxDifferences + 1;
let forwardPoints: number[] = new Array<number>(numDiagonals);
let reversePoints: number[] = new Array<number>(numDiagonals);
let forwardPoints = new Int32Array(numDiagonals);
let reversePoints = new Int32Array(numDiagonals);
// diagonalForwardBase: Index into forwardPoints of the diagonal which passes through (originalStart, modifiedStart)
// diagonalReverseBase: Index into reversePoints of the diagonal which passes through (originalEnd, modifiedEnd)
let diagonalForwardBase = (modifiedEnd - modifiedStart);
@ -624,7 +677,7 @@ export class LcsDiff {
// Check to see if we should be quitting early, before moving on to the next iteration.
let matchLengthOfLongest = ((furthestOriginalIndex - originalStart) + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;
if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, this.OriginalSequence, matchLengthOfLongest)) {
if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {
// We can't finish, so skip ahead to generating a result from what we have.
quitEarlyArr[0] = true;
@ -711,14 +764,14 @@ export class LcsDiff {
if (numDifferences <= MaxDifferencesHistory) {
// We are allocating space for one extra int, which we fill with
// the index of the diagonal base index
let temp: number[] = new Array<number>(diagonalForwardEnd - diagonalForwardStart + 2);
let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);
temp[0] = diagonalForwardBase - diagonalForwardStart + 1;
MyArray.Copy(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);
MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);
this.m_forwardHistory.push(temp);
temp = new Array<number>(diagonalReverseEnd - diagonalReverseStart + 2);
temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);
temp[0] = diagonalReverseBase - diagonalReverseStart + 1;
MyArray.Copy(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);
MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);
this.m_reverseHistory.push(temp);
}
@ -750,8 +803,8 @@ export class LcsDiff {
// Shift all the changes down first
for (let i = 0; i < changes.length; i++) {
const change = changes[i];
const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this.OriginalSequence.getLength();
const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this.ModifiedSequence.getLength();
const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this._originalElementsOrHash.length;
const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;
const checkOriginal = change.originalLength > 0;
const checkModified = change.modifiedLength > 0;
@ -826,11 +879,10 @@ export class LcsDiff {
}
private _OriginalIsBoundary(index: number): boolean {
if (index <= 0 || index >= this.OriginalSequence.getLength() - 1) {
if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {
return true;
}
const element = this.OriginalSequence.getElementAtIndex(index);
return (typeof element === 'string' && /^\s*$/.test(element));
return (this._hasStrings && /^\s*$/.test(this._originalStringElements[index]));
}
private _OriginalRegionIsBoundary(originalStart: number, originalLength: number): boolean {
@ -847,11 +899,10 @@ export class LcsDiff {
}
private _ModifiedIsBoundary(index: number): boolean {
if (index <= 0 || index >= this.ModifiedSequence.getLength() - 1) {
if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {
return true;
}
const element = this.ModifiedSequence.getElementAtIndex(index);
return (typeof element === 'string' && /^\s*$/.test(element));
return (this._hasStrings && /^\s*$/.test(this._modifiedStringElements[index]));
}
private _ModifiedRegionIsBoundary(modifiedStart: number, modifiedLength: number): boolean {

View file

@ -36,7 +36,7 @@ function booleanHash(b: boolean, initialHashVal: number): number {
return numberHash(b ? 433 : 863, initialHashVal);
}
function stringHash(s: string, hashVal: number) {
export function stringHash(s: string, hashVal: number) {
hashVal = numberHash(149417, hashVal);
for (let i = 0, length = s.length; i < length; i++) {
hashVal = numberHash(s.charCodeAt(i), hashVal);

View file

@ -5,6 +5,7 @@
import { OperatingSystem } from 'vs/base/common/platform';
import { illegalArgument } from 'vs/base/common/errors';
import { equals } from 'vs/base/common/arrays';
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
@ -525,15 +526,7 @@ export class ChordKeybinding {
if (other === null) {
return false;
}
if (this.parts.length !== other.parts.length) {
return false;
}
for (let i = 0; i < this.parts.length; i++) {
if (!this.parts[i].equals(other.parts[i])) {
return false;
}
}
return true;
return equals(this.parts, other.parts, (a, b) => a.equals(b));
}
}

View file

@ -138,7 +138,7 @@ export class DisposableStore implements IDisposable {
export abstract class Disposable implements IDisposable {
static None = Object.freeze<IDisposable>({ dispose() { } });
static readonly None = Object.freeze<IDisposable>({ dispose() { } });
private readonly _store = new DisposableStore();

View file

@ -11,21 +11,15 @@ const cmdline = {
unix: '/sbin/ifconfig -a || /sbin/ip link'
};
const invalidMacAddresses = [
const invalidMacAddresses = new Set([
'00:00:00:00:00:00',
'ff:ff:ff:ff:ff:ff',
'ac:de:48:00:11:22'
];
]);
function validateMacAddress(candidate: string): boolean {
let tempCandidate = candidate.replace(/\-/g, ':').toLowerCase();
for (let invalidMacAddress of invalidMacAddresses) {
if (invalidMacAddress === tempCandidate) {
return false;
}
}
return true;
const tempCandidate = candidate.replace(/\-/g, ':').toLowerCase();
return !invalidMacAddresses.has(tempCandidate);
}
export function getMac(): Promise<string> {
@ -66,4 +60,4 @@ function doGetMac(): Promise<string> {
reject(err);
}
});
}
}

View file

@ -8,7 +8,6 @@ import { IDisposable, toDisposable, combinedDisposable } from 'vs/base/common/li
import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import * as errors from 'vs/base/common/errors';
import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc';
import { VSBuffer } from 'vs/base/common/buffer';
/**

View file

@ -23,7 +23,7 @@ function createScopedOnMessageEvent(senderId: number, eventName: string): Event<
export class Server extends IPCServer {
private static Clients = new Map<number, IDisposable>();
private static readonly Clients = new Map<number, IDisposable>();
private static getOnDidClientConnect(): Event<ClientConnectionEvent> {
const onHello = Event.fromNodeEventEmitter<WebContents>(ipcMain, 'ipc:hello', ({ sender }) => sender);

View file

@ -53,7 +53,7 @@ export const QuickOpenItemAccessor = new QuickOpenItemAccessorClass();
export class QuickOpenEntry {
private id: string;
private labelHighlights: IHighlight[];
private labelHighlights?: IHighlight[];
private descriptionHighlights?: IHighlight[];
private detailHighlights?: IHighlight[];
private hidden: boolean | undefined;
@ -160,7 +160,7 @@ export class QuickOpenEntry {
/**
* Allows to set highlight ranges that should show up for the entry label and optionally description if set.
*/
setHighlights(labelHighlights: IHighlight[], descriptionHighlights?: IHighlight[], detailHighlights?: IHighlight[]): void {
setHighlights(labelHighlights?: IHighlight[], descriptionHighlights?: IHighlight[], detailHighlights?: IHighlight[]): void {
this.labelHighlights = labelHighlights;
this.descriptionHighlights = descriptionHighlights;
this.detailHighlights = detailHighlights;
@ -169,7 +169,7 @@ export class QuickOpenEntry {
/**
* Allows to return highlight ranges that should show up for the entry label and description.
*/
getHighlights(): [IHighlight[] /* Label */, IHighlight[] | undefined /* Description */, IHighlight[] | undefined /* Detail */] {
getHighlights(): [IHighlight[] | undefined /* Label */, IHighlight[] | undefined /* Description */, IHighlight[] | undefined /* Detail */] {
return [this.labelHighlights, this.descriptionHighlights, this.detailHighlights];
}
@ -260,7 +260,7 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
return this.entry;
}
getHighlights(): [IHighlight[], IHighlight[] | undefined, IHighlight[] | undefined] {
getHighlights(): [IHighlight[] | undefined, IHighlight[] | undefined, IHighlight[] | undefined] {
return this.entry ? this.entry.getHighlights() : super.getHighlights();
}
@ -268,7 +268,7 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
return this.entry ? this.entry.isHidden() : super.isHidden();
}
setHighlights(labelHighlights: IHighlight[], descriptionHighlights?: IHighlight[], detailHighlights?: IHighlight[]): void {
setHighlights(labelHighlights?: IHighlight[], descriptionHighlights?: IHighlight[], detailHighlights?: IHighlight[]): void {
this.entry ? this.entry.setHighlights(labelHighlights, descriptionHighlights, detailHighlights) : super.setHighlights(labelHighlights, descriptionHighlights, detailHighlights);
}

View file

@ -396,16 +396,16 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
protected applyStyles(): void {
if (this.element) {
const foreground = this.styles.foreground ? this.styles.foreground.toString() : null;
const background = this.styles.background ? this.styles.background.toString() : null;
const borderColor = this.styles.borderColor ? this.styles.borderColor.toString() : null;
const widgetShadow = this.styles.widgetShadow ? this.styles.widgetShadow.toString() : null;
const background = this.styles.background ? this.styles.background.toString() : '';
const borderColor = this.styles.borderColor ? this.styles.borderColor.toString() : '';
const widgetShadow = this.styles.widgetShadow ? this.styles.widgetShadow.toString() : '';
this.element.style.color = foreground;
this.element.style.backgroundColor = background;
this.element.style.borderColor = borderColor;
this.element.style.borderWidth = borderColor ? '1px' : null;
this.element.style.borderStyle = borderColor ? 'solid' : null;
this.element.style.boxShadow = widgetShadow ? `0 5px 8px ${widgetShadow}` : null;
this.element.style.borderWidth = borderColor ? '1px' : '';
this.element.style.borderStyle = borderColor ? 'solid' : '';
this.element.style.boxShadow = widgetShadow ? `0 5px 8px ${widgetShadow}` : '';
}
if (this.progressBar) {

View file

@ -32,12 +32,12 @@ export interface ISQLiteStorageDatabaseLoggingOptions {
export class SQLiteStorageDatabase implements IStorageDatabase {
static IN_MEMORY_PATH = ':memory:';
static readonly IN_MEMORY_PATH = ':memory:';
get onDidChangeItemsExternal(): Event<IStorageItemsChangeEvent> { return Event.None; } // since we are the only client, there can be no external changes
private static BUSY_OPEN_TIMEOUT = 2000; // timeout in ms to retry when opening DB fails with SQLITE_BUSY
private static MAX_HOST_PARAMETERS = 256; // maximum number of parameters within a statement
private static readonly BUSY_OPEN_TIMEOUT = 2000; // timeout in ms to retry when opening DB fails with SQLITE_BUSY
private static readonly MAX_HOST_PARAMETERS = 256; // maximum number of parameters within a statement
private path: string;
private name: string;

View file

@ -398,8 +398,8 @@ function reactionEquals(one: _.IDragOverReaction, other: _.IDragOverReaction | n
export class TreeView extends HeightMap {
static BINDING = 'monaco-tree-row';
static LOADING_DECORATION_DELAY = 800;
static readonly BINDING = 'monaco-tree-row';
static readonly LOADING_DECORATION_DELAY = 800;
private static counter: number = 0;
private instance: number;
@ -925,12 +925,11 @@ export class TreeView extends HeightMap {
if (!skipDiff) {
const lcs = new Diff.LcsDiff(
{
getLength: () => previousChildrenIds.length,
getElementAtIndex: (i: number) => previousChildrenIds[i]
}, {
getLength: () => afterModelItems.length,
getElementAtIndex: (i: number) => afterModelItems[i].id
},
getElements: () => previousChildrenIds
},
{
getElements: () => afterModelItems.map(item => item.id)
},
null
);

View file

@ -4,21 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { LcsDiff, IDiffChange, ISequence } from 'vs/base/common/diff/diff';
class StringDiffSequence implements ISequence {
constructor(private source: string) {
}
getLength() {
return this.source.length;
}
getElementAtIndex(i: number) {
return this.source.charCodeAt(i);
}
}
import { LcsDiff, IDiffChange, StringDiffSequence } from 'vs/base/common/diff/diff';
function createArray<T>(length: number, value: T): T[] {
const r: T[] = [];
@ -123,12 +109,11 @@ suite('Diff - Ported from VS', () => {
// doesn't get there first.
let predicateCallCount = 0;
let diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, leftSequence, longestMatchSoFar) {
let diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, longestMatchSoFar) {
assert.equal(predicateCallCount, 0);
predicateCallCount++;
assert.equal(leftSequence.getLength(), left.length);
assert.equal(leftIndex, 1);
// cancel processing
@ -144,7 +129,7 @@ suite('Diff - Ported from VS', () => {
// Cancel after the first match ('c')
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, leftSequence, longestMatchSoFar) {
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, longestMatchSoFar) {
assert(longestMatchSoFar <= 1); // We never see a match of length > 1
// Continue processing as long as there hasn't been a match made.
@ -157,7 +142,7 @@ suite('Diff - Ported from VS', () => {
// Cancel after the second match ('d')
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, leftSequence, longestMatchSoFar) {
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, longestMatchSoFar) {
assert(longestMatchSoFar <= 2); // We never see a match of length > 2
// Continue processing as long as there hasn't been a match made.
@ -171,7 +156,7 @@ suite('Diff - Ported from VS', () => {
// Cancel *one iteration* after the second match ('d')
let hitSecondMatch = false;
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, leftSequence, longestMatchSoFar) {
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, longestMatchSoFar) {
assert(longestMatchSoFar <= 2); // We never see a match of length > 2
let hitYet = hitSecondMatch;
@ -186,7 +171,7 @@ suite('Diff - Ported from VS', () => {
// Cancel after the third and final match ('e')
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, leftSequence, longestMatchSoFar) {
diff = new LcsDiff(new StringDiffSequence(left), new StringDiffSequence(right), function (leftIndex, longestMatchSoFar) {
assert(longestMatchSoFar <= 3); // We never see a match of length > 3
// Continue processing as long as there hasn't been a match made.

View file

@ -14,7 +14,7 @@
default-src 'self';
img-src 'self' https: data: blob:;
media-src 'none';
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-AMRGFXNZ7mBnD/6F4lTV00XAjE5CBSM7ZeIv3DIp5YM=' 'sha256-meDZW3XhN5JmdjFUrWGhTouRKBiWYtXHltaKnqn/WMo=';
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-/Ua2yZoIzhImbjP5mnPF6fXTgzsTEtN8hPP1XAB1n6U=' 'sha256-meDZW3XhN5JmdjFUrWGhTouRKBiWYtXHltaKnqn/WMo=';
child-src 'self';
frame-src 'self' https://*.vscode-webview-test.com;
worker-src 'self';
@ -50,7 +50,6 @@
'xterm-addon-search': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-web-links': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
'semver-umd': `${window.location.origin}/static/remote/web/node_modules/semver-umd/lib/semver-umd.js`,
'@microsoft/applicationinsights-web': `${window.location.origin}/static/remote/web/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
}
};
</script>

View file

@ -14,7 +14,7 @@
default-src 'self';
img-src 'self' https: data: blob:;
media-src 'none';
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-4DqvCTjCHj2KW4QxC/Yt6uBwMRyYiEg7kOoykSEkonQ=';
script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https: 'sha256-lrlqPnPED1SjcFocGzCtf6ikbQdTUwJKs8VprSqhvS4=';
child-src 'self';
frame-src 'self' https://*.vscode-webview-test.com;
worker-src 'self';
@ -37,7 +37,6 @@
<!-- Prefetch to avoid waterfall -->
<link rel="prefetch" href="./static/node_modules/semver-umd/lib/semver-umd.js">
<link rel="prefetch" href="./static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js">
</head>
<body aria-label="">
@ -55,7 +54,6 @@
'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
'@microsoft/applicationinsights-web': `${window.location.origin}/static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
}
};
</script>

View file

@ -103,10 +103,10 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider {
class PollingURLCallbackProvider extends Disposable implements IURLCallbackProvider {
static FETCH_INTERVAL = 500; // fetch every 500ms
static FETCH_TIMEOUT = 5 * 60 * 1000; // ...but stop after 5min
static readonly FETCH_INTERVAL = 500; // fetch every 500ms
static readonly FETCH_TIMEOUT = 5 * 60 * 1000; // ...but stop after 5min
static QUERY_KEYS = {
static readonly QUERY_KEYS = {
REQUEST_ID: 'vscode-requestId',
SCHEME: 'vscode-scheme',
AUTHORITY: 'vscode-authority',

View file

@ -37,7 +37,6 @@ import { ILogService, getLogLevel } from 'vs/platform/log/common/log';
import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { normalizeGitHubUrl } from 'vs/code/electron-browser/issue/issueReporterUtil';
import { Button } from 'vs/base/browser/ui/button/button';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { SystemInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
@ -232,7 +231,7 @@ export class IssueReporter extends Disposable {
styleTag.innerHTML = content.join('\n');
document.head.appendChild(styleTag);
document.body.style.color = withUndefinedAsNull(styles.color);
document.body.style.color = styles.color || '';
}
private handleExtensionData(extensions: IssueReporterExtensionData[]) {

View file

@ -13,7 +13,7 @@ import { IBackupWorkspacesFormat } from 'vs/platform/backup/node/backup';
export class StorageDataCleaner extends Disposable {
// Workspace/Folder storage names are MD5 hashes (128bits / 4 due to hex presentation)
private static NON_EMPTY_WORKSPACE_ID_LENGTH = 128 / 4;
private static readonly NON_EMPTY_WORKSPACE_ID_LENGTH = 128 / 4;
constructor(
@IEnvironmentService private readonly environmentService: IEnvironmentService

View file

@ -65,7 +65,7 @@ export interface IPointerHandlerHelper {
export class MouseHandler extends ViewEventHandler {
static MOUSE_MOVE_MINIMUM_TIME = 100; // ms
static readonly MOUSE_MOVE_MINIMUM_TIME = 100; // ms
protected _context: ViewContext;
protected viewController: ViewController;

View file

@ -972,7 +972,7 @@ export class MouseTargetFactory {
// Thank you browsers for making this so 'easy' :)
if (document.caretRangeFromPoint) {
if (typeof document.caretRangeFromPoint === 'function') {
return this._doHitTestWithCaretRangeFromPoint(ctx, request);

View file

@ -66,7 +66,7 @@ interface LocalClipboardMetadata {
* we can fetch the previous metadata.
*/
class LocalClipboardMetadataManager {
public static INSTANCE = new LocalClipboardMetadataManager();
public static readonly INSTANCE = new LocalClipboardMetadataManager();
private _lastState: LocalClipboardMetadata | null;

View file

@ -16,17 +16,17 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IConstructorSignature1, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IConstructorSignature1, ServicesAccessor as InstantiationServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindings, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { withNullAsUndefined } from 'vs/base/common/types';
export type ServicesAccessor = ServicesAccessor;
export type ServicesAccessor = InstantiationServicesAccessor;
export type IEditorContributionCtor = IConstructorSignature1<ICodeEditor, IEditorContribution>;
export type EditorTelemetryDataFragment = {
target: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
snippet: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
target: { classification: 'SystemMetaData', purpose: 'FeatureInsight', };
snippet: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true, };
};
//#region Command
@ -224,8 +224,8 @@ export abstract class EditorAction extends EditorCommand {
protected reportTelemetry(accessor: ServicesAccessor, editor: ICodeEditor) {
type EditorActionInvokedClassification = {
name: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
id: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
name: { classification: 'SystemMetaData', purpose: 'FeatureInsight', };
id: { classification: 'SystemMetaData', purpose: 'FeatureInsight', };
};
type EditorActionInvokedEvent = {
name: string;
@ -241,7 +241,7 @@ export abstract class EditorAction extends EditorCommand {
// --- Registration of commands and actions
export function registerLanguageCommand<Args extends { [n: string]: any }>(id: string, handler: (accessor: ServicesAccessor, args: Args) => any) {
export function registerLanguageCommand<Args extends { [n: string]: any; }>(id: string, handler: (accessor: ServicesAccessor, args: Args) => any) {
CommandsRegistry.registerCommand(id, (accessor, args) => handler(accessor, args || {}));
}

View file

@ -61,8 +61,8 @@ class Settings {
const minimapOpts = options.get(EditorOption.minimap);
const minimapEnabled = minimapOpts.enabled;
const minimapSide = minimapOpts.side;
const backgroundColor = (minimapEnabled ? TokenizationRegistry.getDefaultBackground() : null);
if (backgroundColor === null || minimapSide === 'left') {
const backgroundColor = (minimapEnabled ? TokenizationRegistry.getDefaultBackground() : undefined);
if (typeof backgroundColor === 'undefined' || minimapSide === 'left') {
this.backgroundColor = null;
} else {
this.backgroundColor = Color.Format.CSS.formatHex(backgroundColor);

View file

@ -18,7 +18,7 @@ import { registerThemingParticipant } from 'vs/platform/theme/common/themeServic
export class ViewCursors extends ViewPart {
static BLINK_INTERVAL = 500;
static readonly BLINK_INTERVAL = 500;
private _readOnly: boolean;
private _cursorBlinking: TextEditorCursorBlinkingStyle;

View file

@ -1562,7 +1562,7 @@ const DECORATIONS = {
class DiffEditorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEditorWidgetStyle, IVerticalSashLayoutProvider {
static MINIMUM_EDITOR_WIDTH = 100;
static readonly MINIMUM_EDITOR_WIDTH = 100;
private _disableSash: boolean;
private readonly _sash: Sash;

View file

@ -304,18 +304,6 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
return EditorConfiguration2.computeOptions(this._validatedOptions, env);
}
private static _primitiveArrayEquals(a: any[], b: any[]): boolean {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
private static _subsetEquals(base: { [key: string]: any }, subset: { [key: string]: any }): boolean {
for (const key in subset) {
if (hasOwnProperty.call(subset, key)) {
@ -326,7 +314,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
continue;
}
if (Array.isArray(baseValue) && Array.isArray(subsetValue)) {
if (!this._primitiveArrayEquals(baseValue, subsetValue)) {
if (!arrays.equals(baseValue, subsetValue)) {
return false;
}
continue;

View file

@ -21,14 +21,10 @@ import * as viewEvents from 'vs/editor/common/view/viewEvents';
import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
import { dispose } from 'vs/base/common/lifecycle';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { equals } from 'vs/base/common/arrays';
function containsLineMappingChanged(events: viewEvents.ViewEvent[]): boolean {
for (let i = 0, len = events.length; i < len; i++) {
if (events[i].type === viewEvents.ViewEventType.ViewLineMappingChanged) {
return true;
}
}
return false;
function containsLineMappingChanged(events: readonly viewEvents.ViewEvent[]): boolean {
return events.some(event => event.type === viewEvents.ViewEventType.ViewLineMappingChanged);
}
export class CursorStateChangedEvent {
@ -73,15 +69,7 @@ export class CursorModelState {
if (this.modelVersionId !== other.modelVersionId) {
return false;
}
if (this.cursorState.length !== other.cursorState.length) {
return false;
}
for (let i = 0, len = this.cursorState.length; i < len; i++) {
if (!this.cursorState[i].equals(other.cursorState[i])) {
return false;
}
}
return true;
return equals(this.cursorState, other.cursorState, (a, b) => a.equals(b));
}
}
@ -153,7 +141,7 @@ class AutoClosedAction {
export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
public static MAX_CURSOR_COUNT = 10000;
public static readonly MAX_CURSOR_COUNT = 10000;
private readonly _onDidReachMaxCursorCount: Emitter<void> = this._register(new Emitter<void>());
public readonly onDidReachMaxCursorCount: Event<void> = this._onDidReachMaxCursorCount.event;
@ -949,12 +937,7 @@ class CommandExecutor {
}
private static _arrayIsEmpty(commands: (editorCommon.ICommand | null)[]): boolean {
for (let i = 0, len = commands.length; i < len; i++) {
if (commands[i]) {
return false;
}
}
return true;
return commands.every(command => !command);
}
private static _getEditOperations(ctx: IExecContext, commands: (editorCommon.ICommand | null)[]): ICommandsData {

View file

@ -81,15 +81,12 @@ export class TypeOperations {
const selection = selections[i];
let position = selection.getPosition();
if (pasteOnNewLine && !selection.isEmpty()) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && text.indexOf('\n') !== text.length - 1) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startLineNumber !== selection.endLineNumber) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startColumn === model.getLineMinColumn(selection.startLineNumber) && selection.endColumn === model.getLineMaxColumn(selection.startLineNumber)) {
pasteOnNewLine = false;
}
if (pasteOnNewLine) {
// Paste entire line at the beginning of line

View file

@ -10,7 +10,7 @@
export class RGBA8 {
_rgba8Brand: void;
static Empty = new RGBA8(0, 0, 0, 0);
static readonly Empty = new RGBA8(0, 0, 0, 0);
/**
* Red: integer in [0-255]

View file

@ -5,6 +5,7 @@
import { IPosition, Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { equals } from 'vs/base/common/arrays';
/**
* A selection in the editor.
@ -171,15 +172,7 @@ export class Selection extends Range {
if (!a && !b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (let i = 0, len = a.length; i < len; i++) {
if (!this.selectionsEqual(a[i], b[i])) {
return false;
}
}
return true;
return equals(a, b, this.selectionsEqual);
}
/**

View file

@ -15,9 +15,9 @@ function computeDiff(originalSequence: ISequence, modifiedSequence: ISequence, c
return diffAlgo.ComputeDiff(pretty);
}
class LineMarkerSequence implements ISequence {
class LineSequence implements ISequence {
private readonly _lines: string[];
public readonly lines: string[];
private readonly _startColumns: number[];
private readonly _endColumns: number[];
@ -25,61 +25,37 @@ class LineMarkerSequence implements ISequence {
let startColumns: number[] = [];
let endColumns: number[] = [];
for (let i = 0, length = lines.length; i < length; i++) {
startColumns[i] = LineMarkerSequence._getFirstNonBlankColumn(lines[i], 1);
endColumns[i] = LineMarkerSequence._getLastNonBlankColumn(lines[i], 1);
startColumns[i] = getFirstNonBlankColumn(lines[i], 1);
endColumns[i] = getLastNonBlankColumn(lines[i], 1);
}
this._lines = lines;
this.lines = lines;
this._startColumns = startColumns;
this._endColumns = endColumns;
}
public getLength(): number {
return this._lines.length;
}
public getElementAtIndex(i: number): string {
return this._lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);
public getElements(): Int32Array | number[] | string[] {
const elements: string[] = [];
for (let i = 0, len = this.lines.length; i < len; i++) {
elements[i] = this.lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);
}
return elements;
}
public getStartLineNumber(i: number): number {
return i + 1;
}
public getStartColumn(i: number): number {
return this._startColumns[i];
}
public getEndLineNumber(i: number): number {
return i + 1;
}
public getEndColumn(i: number): number {
return this._endColumns[i];
}
public static _getFirstNonBlankColumn(txt: string, defaultValue: number): number {
const r = strings.firstNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 1;
}
public static _getLastNonBlankColumn(txt: string, defaultValue: number): number {
const r = strings.lastNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 2;
}
public getCharSequence(shouldIgnoreTrimWhitespace: boolean, startIndex: number, endIndex: number): CharSequence {
public createCharSequence(shouldIgnoreTrimWhitespace: boolean, startIndex: number, endIndex: number): CharSequence {
let charCodes: number[] = [];
let lineNumbers: number[] = [];
let columns: number[] = [];
let len = 0;
for (let index = startIndex; index <= endIndex; index++) {
const lineContent = this._lines[index];
const lineContent = this.lines[index];
const startColumn = (shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1);
const endColumn = (shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1);
for (let col = startColumn; col < endColumn; col++) {
@ -105,12 +81,8 @@ class CharSequence implements ISequence {
this._columns = columns;
}
public getLength(): number {
return this._charCodes.length;
}
public getElementAtIndex(i: number): number {
return this._charCodes[i];
public getElements(): Int32Array | number[] | string[] {
return this._charCodes;
}
public getStartLineNumber(i: number): number {
@ -254,7 +226,7 @@ class LineChange implements ILineChange {
this.charChanges = charChanges;
}
public static createFromDiffResult(shouldIgnoreTrimWhitespace: boolean, diffChange: IDiffChange, originalLineSequence: LineMarkerSequence, modifiedLineSequence: LineMarkerSequence, continueProcessingPredicate: () => boolean, shouldComputeCharChanges: boolean, shouldPostProcessCharChanges: boolean): LineChange {
public static createFromDiffResult(shouldIgnoreTrimWhitespace: boolean, diffChange: IDiffChange, originalLineSequence: LineSequence, modifiedLineSequence: LineSequence, continueProcessingPredicate: () => boolean, shouldComputeCharChanges: boolean, shouldPostProcessCharChanges: boolean): LineChange {
let originalStartLineNumber: number;
let originalEndLineNumber: number;
let modifiedStartLineNumber: number;
@ -277,9 +249,10 @@ class LineChange implements ILineChange {
modifiedEndLineNumber = modifiedLineSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);
}
if (shouldComputeCharChanges && diffChange.originalLength !== 0 && diffChange.modifiedLength !== 0 && continueProcessingPredicate()) {
const originalCharSequence = originalLineSequence.getCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);
const modifiedCharSequence = modifiedLineSequence.getCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);
if (shouldComputeCharChanges && diffChange.originalLength > 0 && diffChange.originalLength < 20 && diffChange.modifiedLength > 0 && diffChange.modifiedLength < 20 && continueProcessingPredicate()) {
// Compute character changes for diff chunks of at most 20 lines...
const originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);
const modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);
let rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueProcessingPredicate, true);
@ -313,8 +286,8 @@ export class DiffComputer {
private readonly maximumRunTimeMs: number;
private readonly originalLines: string[];
private readonly modifiedLines: string[];
private readonly original: LineMarkerSequence;
private readonly modified: LineMarkerSequence;
private readonly original: LineSequence;
private readonly modified: LineSequence;
private computationStartTime: number;
@ -326,21 +299,21 @@ export class DiffComputer {
this.maximumRunTimeMs = MAXIMUM_RUN_TIME;
this.originalLines = originalLines;
this.modifiedLines = modifiedLines;
this.original = new LineMarkerSequence(originalLines);
this.modified = new LineMarkerSequence(modifiedLines);
this.original = new LineSequence(originalLines);
this.modified = new LineSequence(modifiedLines);
this.computationStartTime = (new Date()).getTime();
}
public computeDiff(): ILineChange[] {
if (this.original.getLength() === 1 && this.original.getElementAtIndex(0).length === 0) {
if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {
// empty original => fast path
return [{
originalStartLineNumber: 1,
originalEndLineNumber: 1,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: this.modified.getLength(),
modifiedEndLineNumber: this.modified.lines.length,
charChanges: [{
modifiedEndColumn: 0,
modifiedEndLineNumber: 0,
@ -354,11 +327,11 @@ export class DiffComputer {
}];
}
if (this.modified.getLength() === 1 && this.modified.getElementAtIndex(0).length === 0) {
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
// empty modified => fast path
return [{
originalStartLineNumber: 1,
originalEndLineNumber: this.original.getLength(),
originalEndLineNumber: this.original.lines.length,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: 1,
charChanges: [{
@ -409,8 +382,8 @@ export class DiffComputer {
// Check the leading whitespace
{
let originalStartColumn = LineMarkerSequence._getFirstNonBlankColumn(originalLine, 1);
let modifiedStartColumn = LineMarkerSequence._getFirstNonBlankColumn(modifiedLine, 1);
let originalStartColumn = getFirstNonBlankColumn(originalLine, 1);
let modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);
while (originalStartColumn > 1 && modifiedStartColumn > 1) {
const originalChar = originalLine.charCodeAt(originalStartColumn - 2);
const modifiedChar = modifiedLine.charCodeAt(modifiedStartColumn - 2);
@ -431,8 +404,8 @@ export class DiffComputer {
// Check the trailing whitespace
{
let originalEndColumn = LineMarkerSequence._getLastNonBlankColumn(originalLine, 1);
let modifiedEndColumn = LineMarkerSequence._getLastNonBlankColumn(modifiedLine, 1);
let originalEndColumn = getLastNonBlankColumn(originalLine, 1);
let modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);
const originalMaxColumn = originalLine.length + 1;
const modifiedMaxColumn = modifiedLine.length + 1;
while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {
@ -534,3 +507,19 @@ export class DiffComputer {
}
}
function getFirstNonBlankColumn(txt: string, defaultValue: number): number {
const r = strings.firstNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 1;
}
function getLastNonBlankColumn(txt: string, defaultValue: number): number {
const r = strings.lastNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 2;
}

View file

@ -197,14 +197,13 @@ export class TextModelTokenization extends Disposable {
private readonly _textModel: TextModel;
private readonly _tokenizationStateStore: TokenizationStateStore;
private _revalidateTokensTimeout: any;
private _tokenizationSupport: ITokenizationSupport | null;
private _tokenizationSupport: ITokenizationSupport | undefined;
constructor(textModel: TextModel) {
super();
this._textModel = textModel;
this._tokenizationStateStore = new TokenizationStateStore();
this._revalidateTokensTimeout = -1;
this._tokenizationSupport = null;
this._register(TokenizationRegistry.onDidChange((e) => {
const languageIdentifier = this._textModel.getLanguageIdentifier();
@ -428,11 +427,11 @@ export class TextModelTokenization extends Disposable {
}
}
function initializeTokenization(textModel: TextModel): [ITokenizationSupport | null, IState | null] {
function initializeTokenization(textModel: TextModel): [ITokenizationSupport | undefined, IState | null] {
const languageIdentifier = textModel.getLanguageIdentifier();
let tokenizationSupport = (
textModel.isTooLargeForTokenization()
? null
? undefined
: TokenizationRegistry.get(languageIdentifier.language)
);
let initialState: IState | null = null;
@ -441,7 +440,7 @@ function initializeTokenization(textModel: TextModel): [ITokenizationSupport | n
initialState = tokenizationSupport.getInitialState();
} catch (e) {
onUnexpectedError(e);
tokenizationSupport = null;
tokenizationSupport = undefined;
}
}
return [tokenizationSupport, initialState];

View file

@ -1568,9 +1568,9 @@ export interface ITokenizationRegistry {
/**
* Get the tokenization support for a language.
* Returns `null` if not found.
* Returns `undefined` if not found.
*/
get(language: string): ITokenizationSupport | null;
get(language: string): ITokenizationSupport | undefined;
/**
* Get the promise of a tokenization support for a language.
@ -1583,9 +1583,9 @@ export interface ITokenizationRegistry {
*/
setColorMap(colorMap: Color[]): void;
getColorMap(): Color[] | null;
getColorMap(): Color[] | undefined;
getDefaultBackground(): Color | null;
getDefaultBackground(): Color | undefined;
}
/**

View file

@ -247,7 +247,7 @@ export class StandardAutoClosingPairConditional {
if (Array.isArray(source.notIn)) {
for (let i = 0, len = source.notIn.length; i < len; i++) {
let notIn = source.notIn[i];
const notIn: string = source.notIn[i];
switch (notIn) {
case 'string':
this._standardTokenMask |= StandardTokenType.String;

View file

@ -7,7 +7,6 @@ import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { ColorId, ITokenizationRegistry, ITokenizationSupport, ITokenizationSupportChangedEvent } from 'vs/editor/common/modes';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { keys } from 'vs/base/common/map';
export class TokenizationRegistryImpl implements ITokenizationRegistry {
@ -18,11 +17,7 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
private readonly _onDidChange = new Emitter<ITokenizationSupportChangedEvent>();
public readonly onDidChange: Event<ITokenizationSupportChangedEvent> = this._onDidChange.event;
private _colorMap: Color[] | null;
constructor() {
this._colorMap = null;
}
private _colorMap: Color[] | undefined;
public fire(languages: string[]): void {
this._onDidChange.fire({
@ -76,8 +71,8 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
return null;
}
public get(language: string): ITokenizationSupport | null {
return withUndefinedAsNull(this._map.get(language));
public get(language: string): ITokenizationSupport | undefined {
return this._map.get(language);
}
public setColorMap(colorMap: Color[]): void {
@ -88,14 +83,14 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
});
}
public getColorMap(): Color[] | null {
public getColorMap(): Color[] | undefined {
return this._colorMap;
}
public getDefaultBackground(): Color | null {
public getDefaultBackground(): Color | undefined {
if (this._colorMap && this._colorMap.length > ColorId.DefaultBackground) {
return this._colorMap[ColorId.DefaultBackground];
}
return null;
return undefined;
}
}

View file

@ -218,6 +218,10 @@ export class ModelServiceImpl extends Disposable implements IModelService {
}
private static _setModelOptionsForModel(model: ITextModel, newOptions: ITextModelCreationOptions, currentOptions: ITextModelCreationOptions): void {
if (currentOptions && currentOptions.defaultEOL !== newOptions.defaultEOL && model.getLineCount() === 1) {
model.setEOL(newOptions.defaultEOL === DefaultEndOfLine.LF ? EndOfLineSequence.LF : EndOfLineSequence.CRLF);
}
if (currentOptions
&& (currentOptions.detectIndentation === newOptions.detectIndentation)
&& (currentOptions.insertSpaces === newOptions.insertSpaces)

View file

@ -6,6 +6,7 @@
import * as strings from 'vs/base/common/strings';
import { Constants } from 'vs/editor/common/core/uint';
import { InlineDecoration, InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
import { equals } from 'vs/base/common/arrays';
export class LineDecoration {
_lineDecorationBrand: void;
@ -27,18 +28,8 @@ export class LineDecoration {
);
}
public static equalsArr(a: LineDecoration[], b: LineDecoration[]): boolean {
let aLen = a.length;
let bLen = b.length;
if (aLen !== bLen) {
return false;
}
for (let i = 0; i < aLen; i++) {
if (!LineDecoration._equals(a[i], b[i])) {
return false;
}
}
return true;
public static equalsArr(a: readonly LineDecoration[], b: readonly LineDecoration[]): boolean {
return equals(a, b, LineDecoration._equals);
}
public static filter(lineDecorations: InlineDecoration[], lineNumber: number, minLineColumn: number, maxLineColumn: number): LineDecoration[] {

View file

@ -9,6 +9,7 @@ import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
import { IStringBuilder, createStringBuilder } from 'vs/editor/common/core/stringBuilder';
import { LineDecoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/lineDecorations';
import { InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
import { equals } from 'vs/base/common/arrays';
export const enum RenderWhitespace {
None = 0,
@ -131,17 +132,7 @@ export class RenderLineInput {
return false;
}
if (otherSelections.length !== this.selectionsOnLine.length) {
return false;
}
for (let i = 0; i < this.selectionsOnLine.length; i++) {
if (!this.selectionsOnLine[i].equals(otherSelections[i])) {
return false;
}
}
return true;
return equals(this.selectionsOnLine, otherSelections, (a, b) => a.equals(b));
}
public equals(other: RenderLineInput): boolean {

View file

@ -6,7 +6,7 @@
import 'vs/css!./codelensWidget';
import * as dom from 'vs/base/browser/dom';
import { coalesce, isFalsyOrEmpty } from 'vs/base/common/arrays';
import { escape } from 'vs/base/common/strings';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { Range } from 'vs/editor/common/core/range';
import { IModelDecorationsChangeAccessor, IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model';
@ -104,7 +104,7 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
for (let i = 0; i < symbols.length; i++) {
const command = symbols[i].command;
if (command) {
const title = escape(command.title);
const title = renderOcticons(command.title);
let part: string;
if (command.id) {
part = `<a id=${i}>${title}</a>`;

View file

@ -27,7 +27,7 @@ export class ColorDetector extends Disposable implements IEditorContribution {
private static readonly ID: string = 'editor.contrib.colorDetector';
static RECOMPUTE_TIME = 1000; // ms
static readonly RECOMPUTE_TIME = 1000; // ms
private readonly _localToDispose = this._register(new DisposableStore());
private _computePromise: CancelablePromise<IColorData[]> | null;

View file

@ -12,6 +12,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { equals } from 'vs/base/common/arrays';
class CursorState {
readonly selections: readonly Selection[];
@ -21,17 +22,7 @@ class CursorState {
}
public equals(other: CursorState): boolean {
const thisLen = this.selections.length;
const otherLen = other.selections.length;
if (thisLen !== otherLen) {
return false;
}
for (let i = 0; i < thisLen; i++) {
if (!this.selections[i].equalsSelection(other.selections[i])) {
return false;
}
}
return true;
return equals(this.selections, other.selections, (a, b) => a.equalsSelection(b));
}
}

View file

@ -38,7 +38,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE
private _dndDecorationIds: string[];
private _mouseDown: boolean;
private _modifierPressed: boolean;
static TRIGGER_KEY_VALUE = isMacintosh ? KeyCode.Alt : KeyCode.Ctrl;
static readonly TRIGGER_KEY_VALUE = isMacintosh ? KeyCode.Alt : KeyCode.Ctrl;
static get(editor: ICodeEditor): DragAndDropController {
return editor.getContribution<DragAndDropController>(DragAndDropController.ID);

View file

@ -44,7 +44,7 @@ export class OutlineIdentityProvider implements IIdentityProvider<OutlineItem> {
}
export class OutlineGroupTemplate {
static id = 'OutlineGroupTemplate';
static readonly id = 'OutlineGroupTemplate';
constructor(
readonly labelContainer: HTMLElement,
readonly label: HighlightedLabel,
@ -52,7 +52,7 @@ export class OutlineGroupTemplate {
}
export class OutlineElementTemplate {
static id = 'OutlineElementTemplate';
static readonly id = 'OutlineElementTemplate';
constructor(
readonly container: HTMLElement,
readonly iconLabel: IconLabel,

View file

@ -50,7 +50,7 @@ interface FoldingStateMemento {
export class FoldingController extends Disposable implements IEditorContribution {
static MAX_FOLDING_REGIONS = 5000;
static readonly MAX_FOLDING_REGIONS = 5000;
public static get(editor: ICodeEditor): FoldingController {

View file

@ -10,18 +10,18 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
export class FoldingDecorationProvider implements IDecorationProvider {
private static COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
private static readonly COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
afterContentClassName: 'inline-folded',
linesDecorationsClassName: 'codicon codicon-chevron-right'
});
private static EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({
private static readonly EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
linesDecorationsClassName: 'codicon codicon-chevron-down'
});
private static EXPANDED_VISUAL_DECORATION = ModelDecorationOptions.register({
private static readonly EXPANDED_VISUAL_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
linesDecorationsClassName: 'codicon codicon-chevron-down alwaysShowFoldIcons'
});

View file

@ -30,7 +30,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.gotodefinitionwithmouse';
static MAX_SOURCE_PREVIEW_LINES = 8;
static readonly MAX_SOURCE_PREVIEW_LINES = 8;
private readonly editor: ICodeEditor;
private readonly toUnhook = new DisposableStore();

View file

@ -20,7 +20,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { MarkerNavigationWidget } from './gotoErrorWidget';
import { compare } from 'vs/base/common/strings';
import { binarySearch } from 'vs/base/common/arrays';
import { binarySearch, find } from 'vs/base/common/arrays';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
@ -173,12 +173,7 @@ class MarkerModel {
}
public findMarkerAtPosition(pos: Position): IMarker | undefined {
for (const marker of this._markers) {
if (Range.containsPosition(marker, pos)) {
return marker;
}
}
return undefined;
return find(this._markers, marker => Range.containsPosition(marker, pos));
}
public get total() {

View file

@ -283,7 +283,7 @@ export class MarkerNavigationWidget extends PeekViewWidget {
: nls.localize('change', "{0} of {1} problem", markerIdx, markerCount);
this.setTitle(basename(model.uri), detail);
}
this._icon.className = SeverityIcon.className(MarkerSeverity.toSeverity(this._severity));
this._icon.className = `codicon ${SeverityIcon.className(MarkerSeverity.toSeverity(this._severity))}`;
this.editor.revealPositionInCenter(position, ScrollType.Smooth);
}

View file

@ -106,7 +106,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
return editor.getContribution<LinkDetector>(LinkDetector.ID);
}
static RECOMPUTE_TIME = 1000; // ms
static readonly RECOMPUTE_TIME = 1000; // ms
private readonly editor: ICodeEditor;
private enabled: boolean;

View file

@ -23,7 +23,7 @@ export class MessageController extends Disposable implements editorCommon.IEdito
private static readonly _id = 'editor.contrib.messageController';
static MESSAGE_VISIBLE = new RawContextKey<boolean>('messageVisible', false);
static readonly MESSAGE_VISIBLE = new RawContextKey<boolean>('messageVisible', false);
static get(editor: ICodeEditor): MessageController {
return editor.getContribution<MessageController>(MessageController._id);

View file

@ -60,3 +60,7 @@
border-top: 1px solid;
position: relative;
}
.monaco-editor .peekview-widget .head .peekview-title .codicon {
margin-right: 4px;
}

View file

@ -12,33 +12,11 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
import { BracketSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/bracketSelections';
import { provideSelectionRanges } from 'vs/editor/contrib/smartSelect/smartSelect';
import { CancellationToken } from 'vs/base/common/cancellation';
import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSelections';
class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
_serviceBrand: undefined;
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
) {
}
getEOL(resource: URI | undefined): string {
const filesConfiguration = this.configurationService.getValue<{ eol: string }>('files');
if (filesConfiguration && filesConfiguration.eol) {
if (filesConfiguration.eol !== 'auto') {
return filesConfiguration.eol;
}
}
return (isLinux || isMacintosh) ? '\n' : '\r\n';
}
}
import { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/modelService.test';
class MockJSMode extends MockMode {

View file

@ -44,9 +44,9 @@ export class SnippetController2 implements IEditorContribution {
return editor.getContribution<SnippetController2>('snippetController2');
}
static InSnippetMode = new RawContextKey('inSnippetMode', false);
static HasNextTabstop = new RawContextKey('hasNextTabstop', false);
static HasPrevTabstop = new RawContextKey('hasPrevTabstop', false);
static readonly InSnippetMode = new RawContextKey('inSnippetMode', false);
static readonly HasNextTabstop = new RawContextKey('hasNextTabstop', false);
static readonly HasPrevTabstop = new RawContextKey('hasPrevTabstop', false);
private readonly _inSnippet: IContextKey<boolean>;
private readonly _hasNextTabstop: IContextKey<boolean>;

View file

@ -11,7 +11,7 @@ import { ISelectedSuggestion } from './suggestWidget';
export class SuggestAlternatives {
static OtherSuggestions = new RawContextKey<boolean>('hasOtherSuggestions', false);
static readonly OtherSuggestions = new RawContextKey<boolean>('hasOtherSuggestions', false);
private readonly _ckOtherSuggestions: IContextKey<boolean>;

View file

@ -515,12 +515,10 @@ export class SimpleResourcePropertiesService implements ITextResourcePropertiesS
) {
}
getEOL(resource: URI): string {
const filesConfiguration = this.configurationService.getValue<{ eol: string }>('files');
if (filesConfiguration && filesConfiguration.eol) {
if (filesConfiguration.eol !== 'auto') {
return filesConfiguration.eol;
}
getEOL(resource: URI, language?: string): string {
const eol = this.configurationService.getValue<string>('files.eol', { overrideIdentifier: language, resource });
if (eol && eol !== 'auto') {
return eol;
}
return (isLinux || isMacintosh) ? '\n' : '\r\n';
}
@ -551,7 +549,7 @@ export class SimpleWorkspaceContextService implements IWorkspaceContextService {
public _serviceBrand: undefined;
private static SCHEME = 'inmemory';
private static readonly SCHEME = 'inmemory';
private readonly _onDidChangeWorkspaceName = new Emitter<void>();
public readonly onDidChangeWorkspaceName: Event<void> = this._onDidChangeWorkspaceName.event;

View file

@ -21,18 +21,7 @@ import { IMonarchLanguage, IMonarchLanguageBracket } from 'vs/editor/standalone/
*/
function isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {
if (!obj) {
return false;
}
if (!(Array.isArray(obj))) {
return false;
}
for (const el of obj) {
if (!(elemType(el))) {
return false;
}
}
return true;
return Array.isArray(obj) && obj.every(elemType);
}
function bool(prop: any, defValue: boolean): boolean {

View file

@ -1494,6 +1494,25 @@ suite('Editor Controller - Regression tests', () => {
});
});
test('issue #74722: Pasting whole line does not replace selection', () => {
usingCursor({
text: [
'line1',
'line sel 2',
'line3'
],
}, (model, cursor) => {
cursor.setSelections('test', [new Selection(2, 6, 2, 9)]);
cursorCommand(cursor, H.Paste, { text: 'line1\n', pasteOnNewLine: true });
assert.equal(model.getLineContent(1), 'line1');
assert.equal(model.getLineContent(2), 'line line1');
assert.equal(model.getLineContent(3), ' 2');
assert.equal(model.getLineContent(4), 'line3');
});
});
test('issue #4996: Multiple cursor paste pastes contents of all cursors', () => {
usingCursor({
text: [

View file

@ -5,6 +5,7 @@
import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
import { ColorId, TokenMetadata } from 'vs/editor/common/modes';
import { equals } from 'vs/base/common/arrays';
/**
* A token on a line.
@ -42,18 +43,8 @@ export class ViewLineToken {
);
}
public static equalsArr(a: ViewLineToken[], b: ViewLineToken[]): boolean {
const aLen = a.length;
const bLen = b.length;
if (aLen !== bLen) {
return false;
}
for (let i = 0; i < aLen; i++) {
if (!this._equals(a[i], b[i])) {
return false;
}
}
return true;
public static equalsArr(a: readonly ViewLineToken[], b: readonly ViewLineToken[]): boolean {
return equals(a, b, this._equals);
}
}

View file

@ -8,6 +8,7 @@ import { StandardTokenType } from 'vs/editor/common/modes';
import { CharacterPairSupport } from 'vs/editor/common/modes/supports/characterPair';
import { TokenText, createFakeScopedLineTokens } from 'vs/editor/test/common/modesTestUtils';
import { StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration';
import { find } from 'vs/base/common/arrays';
suite('CharacterPairSupport', () => {
@ -53,13 +54,8 @@ suite('CharacterPairSupport', () => {
assert.deepEqual(characaterPairSupport.getSurroundingPairs(), []);
});
function findAutoClosingPair(characterPairSupport: CharacterPairSupport, character: string): StandardAutoClosingPairConditional | null {
for (const autoClosingPair of characterPairSupport.getAutoClosingPairs()) {
if (autoClosingPair.open === character) {
return autoClosingPair;
}
}
return null;
function findAutoClosingPair(characterPairSupport: CharacterPairSupport, character: string): StandardAutoClosingPairConditional | undefined {
return find(characterPairSupport.getAutoClosingPairs(), autoClosingPair => autoClosingPair.open === character);
}
function testShouldAutoClose(characterPairSupport: CharacterPairSupport, line: TokenText[], character: string, column: number): boolean {

View file

@ -365,7 +365,7 @@ assertComputeEdits(file1, file2);
}
}
class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
export class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
_serviceBrand: undefined;
@ -375,11 +375,9 @@ class TestTextResourcePropertiesService implements ITextResourcePropertiesServic
}
getEOL(resource: URI, language?: string): string {
const filesConfiguration = this.configurationService.getValue<{ eol: string }>('files', { overrideIdentifier: language, resource });
if (filesConfiguration && filesConfiguration.eol) {
if (filesConfiguration.eol !== 'auto') {
return filesConfiguration.eol;
}
const eol = this.configurationService.getValue<string>('files.eol', { overrideIdentifier: language, resource });
if (eol && eol !== 'auto') {
return eol;
}
return (platform.isLinux || platform.isMacintosh) ? '\n' : '\r\n';
}

View file

@ -518,14 +518,14 @@ export class Configuration {
return folderConsolidatedConfiguration;
}
private getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | undefined): ConfigurationModel | null {
private getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | undefined): ConfigurationModel | undefined {
if (workspace && resource) {
const root = workspace.getFolder(resource);
if (root) {
return types.withUndefinedAsNull(this._folderConfigurations.get(root.uri));
return this._folderConfigurations.get(root.uri);
}
}
return null;
return undefined;
}
toData(): IConfigurationData {
@ -663,13 +663,7 @@ export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent i
configurationModelsToSearch.push(...this._changedConfigurationByResource.values());
}
for (const configuration of configurationModelsToSearch) {
if (this.doesConfigurationContains(configuration, config)) {
return true;
}
}
return false;
return configurationModelsToSearch.some(configuration => this.doesConfigurationContains(configuration, config));
}
private changeWithKeys(keys: string[], resource?: URI): void {

View file

@ -87,7 +87,7 @@ class NullContext extends Context {
class ConfigAwareContextValuesContainer extends Context {
private static _keyPrefix = 'config.';
private static readonly _keyPrefix = 'config.';
private readonly _values = new Map<string, any>();
private readonly _listener: IDisposable;
@ -203,24 +203,14 @@ class SimpleContextKeyChangeEvent implements IContextKeyChangeEvent {
class ArrayContextKeyChangeEvent implements IContextKeyChangeEvent {
constructor(readonly keys: string[]) { }
affectsSome(keys: IReadableSet<string>): boolean {
for (const key of this.keys) {
if (keys.has(key)) {
return true;
}
}
return false;
return this.keys.some(key => keys.has(key));
}
}
class CompositeContextKeyChangeEvent implements IContextKeyChangeEvent {
constructor(readonly events: IContextKeyChangeEvent[]) { }
affectsSome(keys: IReadableSet<string>): boolean {
for (const e of this.events) {
if (e.affectsSome(keys)) {
return true;
}
}
return false;
return this.events.some(e => e.affectsSome(keys));
}
}

View file

@ -6,6 +6,7 @@
import { Event } from 'vs/base/common/event';
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { equals } from 'vs/base/common/arrays';
export const enum ContextKeyExprType {
Defined = 1,
@ -574,15 +575,7 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
public equals(other: ContextKeyExpr): boolean {
if (other instanceof ContextKeyAndExpr) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
return equals(this.expr, other.expr, (a, b) => a.equals(b));
}
return false;
}
@ -674,15 +667,7 @@ export class ContextKeyOrExpr implements ContextKeyExpr {
public equals(other: ContextKeyExpr): boolean {
if (other instanceof ContextKeyOrExpr) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
return equals(this.expr, other.expr, (a, b) => a.equals(b));
}
return false;
}

View file

@ -17,6 +17,7 @@ import { isMacintosh, isLinux } from 'vs/base/common/platform';
import { IDiskFileChange, normalizeFileChanges, ILogMessage } from 'vs/platform/files/node/watcher/watcher';
import { IWatcherRequest, IWatcherService, IWatcherOptions } from 'vs/platform/files/node/watcher/unix/watcher';
import { Emitter, Event } from 'vs/base/common/event';
import { equals } from 'vs/base/common/arrays';
interface IWatcher {
requests: ExtendedWatcherRequest[];
@ -351,26 +352,10 @@ export function normalizeRoots(requests: IWatcherRequest[]): { [basePath: string
return result;
}
function isEqualRequests(r1: IWatcherRequest[], r2: IWatcherRequest[]) {
if (r1.length !== r2.length) {
return false;
}
for (let k = 0; k < r1.length; k++) {
if (r1[k].path !== r2[k].path || !isEqualIgnore(r1[k].excludes, r2[k].excludes)) {
return false;
}
}
return true;
function isEqualRequests(r1: readonly IWatcherRequest[], r2: readonly IWatcherRequest[]) {
return equals(r1, r2, (a, b) => a.path === b.path && isEqualIgnore(a.excludes, b.excludes));
}
function isEqualIgnore(i1: string[], i2: string[]) {
if (i1.length !== i2.length) {
return false;
}
for (let k = 0; k < i1.length; k++) {
if (i1[k] !== i2[k]) {
return false;
}
}
return true;
function isEqualIgnore(i1: readonly string[], i2: readonly string[]) {
return equals(i1, i2);
}

View file

@ -21,19 +21,13 @@ import { isLinux, isWindows } from 'vs/base/common/platform';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { isEqual } from 'vs/base/common/resources';
import { VSBuffer, VSBufferReadable, toVSBufferReadableStream, VSBufferReadableStream, bufferToReadable, bufferToStream } from 'vs/base/common/buffer';
import { find } from 'vs/base/common/arrays';
function getByName(root: IFileStat, name: string): IFileStat | null {
function getByName(root: IFileStat, name: string): IFileStat | undefined {
if (root.children === undefined) {
return null;
return undefined;
}
for (const child of root.children) {
if (child.name === name) {
return child;
}
}
return null;
return find(root.children, child => child.name === name);
}
function toLineByLineReadable(content: string): VSBufferReadable {

View file

@ -219,13 +219,23 @@ export class InstantiationService implements IInstantiationService {
// Return a proxy object that's backed by an idle value. That
// strategy is to instantiate services in our idle time or when actually
// needed but not when injected into a consumer
const idle = new IdleValue(() => this._createInstance<T>(ctor, args, _trace));
const idle = new IdleValue<any>(() => this._createInstance<T>(ctor, args, _trace));
return <T>new Proxy(Object.create(null), {
get(_target: T, prop: PropertyKey): any {
return (idle.getValue() as any)[prop];
get(target: any, key: PropertyKey): any {
if (key in target) {
return target[key];
}
let obj = idle.getValue();
let prop = obj[key];
if (typeof prop !== 'function') {
return prop;
}
prop = prop.bind(obj);
target[key] = prop;
return prop;
},
set(_target: T, p: PropertyKey, value: any): boolean {
(idle.getValue() as any)[p] = value;
idle.getValue()[p] = value;
return true;
}
});
@ -241,7 +251,7 @@ const enum TraceType {
class Trace {
private static _None = new class extends Trace {
private static readonly _None = new class extends Trace {
constructor() { super(-1, null); }
stop() { }
branch() { return this; }

View file

@ -881,9 +881,9 @@ export class WorkbenchAsyncDataTree<TInput, T, TFilterData = void> extends Async
) {
const { options: treeOptions, getAutomaticKeyboardNavigation, disposable } = workbenchTreeDataPreamble(container, options, contextKeyService, themeService, configurationService, keybindingService, accessibilityService);
super(user, container, delegate, renderers, dataSource, treeOptions);
this.disposables.push(disposable);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, treeOptions, getAutomaticKeyboardNavigation, contextKeyService, listService, themeService, configurationService, accessibilityService);
this.disposables.push(this.internals);
this.disposables.add(this.internals);
}
}
@ -910,9 +910,9 @@ export class WorkbenchCompressibleAsyncDataTree<TInput, T, TFilterData = void> e
) {
const { options: treeOptions, getAutomaticKeyboardNavigation, disposable } = workbenchTreeDataPreamble(container, options, contextKeyService, themeService, configurationService, keybindingService, accessibilityService);
super(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, treeOptions);
this.disposables.push(disposable);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, treeOptions, getAutomaticKeyboardNavigation, contextKeyService, listService, themeService, configurationService, accessibilityService);
this.disposables.push(this.internals);
this.disposables.add(this.internals);
}
}

View file

@ -4,70 +4,57 @@
*--------------------------------------------------------------------------------------------*/
import Severity from 'vs/base/common/severity';
import { registerThemingParticipant, ITheme, LIGHT } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
const errorStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.58318 2.02842C9.96435 2.16331 11.2561 2.77279 12.2383 3.75307C13.3643 4.87923 13.9978 6.40584 14 7.99829C14.0004 9.38617 13.5196 10.7313 12.6396 11.8045C11.7595 12.8778 10.5345 13.6127 9.17333 13.8841C7.81215 14.1556 6.39895 13.9467 5.1745 13.2931C3.95005 12.6394 2.99008 11.5815 2.45814 10.2995C1.92619 9.0175 1.85517 7.59072 2.25717 6.26222C2.65917 4.93373 3.50933 3.7857 4.66282 3.0137C5.8163 2.24171 7.20177 1.89351 8.58318 2.02842ZM8.68038 1.03316C10.292 1.19055 11.7993 1.90184 12.9453 3.04585C14.2587 4.35938 14.9976 6.14013 15 7.99764C15.0005 9.61695 14.4396 11.1864 13.4129 12.4385C12.3861 13.6907 10.9569 14.5482 9.36889 14.8648C7.78084 15.1815 6.13211 14.9378 4.70359 14.1752C3.27506 13.4127 2.1551 12.1784 1.53449 10.6828C0.913887 9.18708 0.831027 7.52251 1.30003 5.97259C1.76903 4.42268 2.76089 3.08331 4.10662 2.18265C5.45236 1.28199 7.06873 0.875761 8.68038 1.03316ZM5.52498 5L8.00004 7.47506L10.4751 5L11.1822 5.70711L8.70714 8.18217L11.1818 10.6569L10.4747 11.364L8.00004 8.88927L5.52535 11.364L4.81824 10.6569L7.29293 8.18217L4.81787 5.70711L5.52498 5Z" fill="`);
const errorEnd = encodeURIComponent(`"/></svg>`);
const errorDarkStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.58318 2.02842C9.96435 2.16331 11.2561 2.77279 12.2383 3.75307C13.3643 4.87923 13.9978 6.40584 14 7.99829C14.0004 9.38617 13.5196 10.7313 12.6396 11.8045C11.7595 12.8778 10.5345 13.6127 9.17333 13.8841C7.81215 14.1556 6.39895 13.9467 5.1745 13.2931C3.95005 12.6394 2.99008 11.5815 2.45814 10.2995C1.92619 9.0175 1.85517 7.59072 2.25717 6.26222C2.65917 4.93373 3.50933 3.7857 4.66282 3.0137C5.8163 2.24171 7.20177 1.89351 8.58318 2.02842ZM8.68038 1.03316C10.292 1.19055 11.7993 1.90184 12.9453 3.04585C14.2587 4.35938 14.9976 6.14013 15 7.99764C15.0005 9.61695 14.4396 11.1864 13.4129 12.4385C12.3861 13.6907 10.9569 14.5482 9.36889 14.8648C7.78084 15.1815 6.13211 14.9378 4.70359 14.1752C3.27506 13.4127 2.1551 12.1784 1.53449 10.6828C0.913887 9.18708 0.831027 7.52251 1.30003 5.97259C1.76903 4.42268 2.76089 3.08331 4.10662 2.18265C5.45236 1.28199 7.06873 0.875761 8.68038 1.03316ZM5.52498 5L8.00004 7.47506L10.4751 5L11.1822 5.70711L8.70714 8.18217L11.1818 10.6569L10.4747 11.364L8.00004 8.88927L5.52535 11.364L4.81824 10.6569L7.29293 8.18217L4.81787 5.70711L5.52498 5Z" fill="`);
const errorDarkEnd = encodeURIComponent(`"/></svg>`);
const warningStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.12 13.9725L15 12.5L9.37927 2H7.61924L1.9985 12.5L2.87852 13.9725H14.12ZM2.87852 12.9725L8.49925 2.47249L14.12 12.9725H2.87852ZM7.98952 6H8.98802V10H7.98952V6ZM7.98952 11H8.98802V12H7.98952V11Z" fill="`);
const warningEnd = encodeURIComponent(`"/></svg>`);
const warningDarkStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.12 13.9725L15 12.5L9.37927 2H7.61924L1.9985 12.5L2.87852 13.9725H14.12ZM2.87852 12.9725L8.49925 2.47249L14.12 12.9725H2.87852ZM7.98952 6H8.98802V10H7.98952V6ZM7.98952 11H8.98802V12H7.98952V11Z" fill="`);
const warningDarkEnd = encodeURIComponent(`"/></svg>`);
const infoStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 7.5C3 4.46243 5.46243 2 8.5 2C11.5376 2 14 4.46243 14 7.5C14 10.5376 11.5376 13 8.5 13C5.46243 13 3 10.5376 3 7.5ZM2 7.5C2 3.91015 4.91015 1 8.5 1C12.0899 1 15 3.91015 15 7.5C15 11.0899 12.0899 14 8.5 14C4.91015 14 2 11.0899 2 7.5ZM8 4V5H9V4H8ZM8 6L8 10H9L9 6H8Z" fill="`);
const infoEnd = encodeURIComponent(`"/></svg>`);
const infoDarkStart = encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 7.5C3 4.46243 5.46243 2 8.5 2C11.5376 2 14 4.46243 14 7.5C14 10.5376 11.5376 13 8.5 13C5.46243 13 3 10.5376 3 7.5ZM2 7.5C2 3.91015 4.91015 1 8.5 1C12.0899 1 15 3.91015 15 7.5C15 11.0899 12.0899 14 8.5 14C4.91015 14 2 11.0899 2 7.5ZM8 4V5H9V4H8ZM8 6L8 10H9L9 6H8Z" fill="`);
const infoDarkEnd = encodeURIComponent(`"/></svg>`);
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { problemsErrorIconForeground, problemsInfoIconForeground, problemsWarningIconForeground } from 'vs/platform/theme/common/colorRegistry';
export namespace SeverityIcon {
export function getSVGData(severity: Severity, theme: ITheme): string {
switch (severity) {
case Severity.Ignore:
const ignoreColor = theme.type === LIGHT ? Color.fromHex('#75BEFF') : Color.fromHex('#007ACC');
return theme.type === LIGHT ? infoStart + encodeURIComponent(ignoreColor.toString()) + infoEnd
: infoDarkStart + encodeURIComponent(ignoreColor.toString()) + infoDarkEnd;
case Severity.Info:
const infoColor = theme.type === LIGHT ? Color.fromHex('#007ACC') : Color.fromHex('#75BEFF');
return theme.type === LIGHT ? infoStart + encodeURIComponent(infoColor.toString()) + infoEnd
: infoDarkStart + encodeURIComponent(infoColor.toString()) + infoDarkEnd;
case Severity.Warning:
const warningColor = theme.type === LIGHT ? Color.fromHex('#DDB100') : Color.fromHex('#fc0');
return theme.type === LIGHT ? warningStart + encodeURIComponent(warningColor.toString()) + warningEnd
: warningDarkStart + encodeURIComponent(warningColor.toString()) + warningDarkEnd;
case Severity.Error:
const errorColor = theme.type === LIGHT ? Color.fromHex('#A1260D') : Color.fromHex('#F48771');
return theme.type === LIGHT ? errorStart + encodeURIComponent(errorColor.toString()) + errorEnd
: errorDarkStart + encodeURIComponent(errorColor.toString()) + errorDarkEnd;
}
return '';
}
export function className(severity: Severity): string {
switch (severity) {
case Severity.Ignore:
return 'severity-icon severity-ignore';
return 'severity-ignore codicon-info';
case Severity.Info:
return 'severity-icon severity-info';
return 'codicon-info';
case Severity.Warning:
return 'severity-icon severity-warning';
return 'codicon-warning';
case Severity.Error:
return 'severity-icon severity-error';
return 'codicon-error';
}
return '';
}
}
function getCSSRule(severity: Severity, theme: ITheme): string {
return `.${SeverityIcon.className(severity).split(' ').join('.')} { background: url("data:image/svg+xml,${SeverityIcon.getSVGData(severity, theme)}") center center no-repeat; height: 16px; width: 16px; }`;
}
registerThemingParticipant((theme, collector) => {
collector.addRule(getCSSRule(Severity.Error, theme));
collector.addRule(getCSSRule(Severity.Warning, theme));
collector.addRule(getCSSRule(Severity.Info, theme));
collector.addRule(getCSSRule(Severity.Ignore, theme));
});
const errorIconForeground = theme.getColor(problemsErrorIconForeground);
if (errorIconForeground) {
collector.addRule(`
.monaco-workbench .zone-widget .codicon-error,
.monaco-workbench .markers-panel .marker-icon.codicon-error,
.monaco-workbench .extensions-viewlet > .extensions .codicon-error {
color: ${errorIconForeground};
}
`);
}
const warningIconForeground = theme.getColor(problemsWarningIconForeground);
if (errorIconForeground) {
collector.addRule(`
.monaco-workbench .zone-widget .codicon-warning,
.monaco-workbench .markers-panel .marker-icon.codicon-warning,
.monaco-workbench .extensions-viewlet > .extensions .codicon-warning {
color: ${warningIconForeground};
}
`);
}
const infoIconForeground = theme.getColor(problemsInfoIconForeground);
if (errorIconForeground) {
collector.addRule(`
.monaco-workbench .zone-widget .codicon-info,
.monaco-workbench .markers-panel .marker-icon.codicon-info {
color: ${infoIconForeground};
}
`);
}
});

View file

@ -127,7 +127,7 @@ export class StateService implements IStateService {
_serviceBrand: undefined;
private static STATE_FILE = 'storage.json';
private static readonly STATE_FILE = 'storage.json';
private fileStorage: FileStorage;

Some files were not shown because too many files have changed in this diff Show more