diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000..dda0884b38115 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,16 @@ +**/vs/nls.build.js +**/vs/nls.js +**/vs/css.build.js +**/vs/css.js +**/vs/loader.js +**/promise-polyfill/** +**/insane/** +**/marked/** +**/test/**/*.js +**/node_modules/** +**/vscode-api-tests/testWorkspace/** +**/vscode-api-tests/testWorkspace2/** +**/extensions/**/out/** +**/extensions/**/build/** +**/extensions/markdown-language-features/media/** +**/extensions/typescript-basics/test/colorize-fixtures/** diff --git a/.eslintrc.json b/.eslintrc.json index 29efa7cbbc202..e1dc514e65eac 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,20 +1,693 @@ { - "root": true, - "env": { - "node": true, - "es6": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": 1, - "no-extra-semi": "warn", - "semi": "warn" - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - } + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "jsdoc" + ], + "rules": { + "constructor-super": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-buffer-constructor": "warn", + "no-caller": "warn", + "no-debugger": "warn", + "no-duplicate-case": "warn", + "no-duplicate-imports": "warn", + "no-eval": "warn", + "no-extra-semi": "warn", + "no-new-wrappers": "warn", + "no-redeclare": "off", + "no-sparse-arrays": "warn", + "no-throw-literal": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-restricted-globals": [ + "warn", + "name", + "length", + "event", + "closed", + "external", + "status", + "origin", + "orientation" + ], // non-complete list of globals that are easy to access unintentionally + "no-var": "warn", + "jsdoc/no-types": "warn", + "semi": "off", + "@typescript-eslint/semi": "warn", + "@typescript-eslint/class-name-casing": "warn", + "code-no-unused-expressions": [ + "warn", + { + "allowTernary": true + } + ], + "code-translation-remind": "warn", + "code-no-nls-in-standalone-editor": "warn", + "code-no-standalone-editor": "warn", + "code-no-unexternalized-strings": "warn", + "code-layering": [ + "warn", + { + "common": [], + "node": [ + "common" + ], + "browser": [ + "common" + ], + "electron-main": [ + "common", + "node" + ], + "electron-browser": [ + "common", + "browser", + "node" + ] + } + ], + "code-import-patterns": [ + "warn", + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!! Do not relax these rules !!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + { + "target": "**/vs/base/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**" + ] + }, + { + "target": "**/vs/base/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/test/common/**" + ] + }, + { + "target": "**/vs/base/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + // vs/base/test/browser contains tests for vs/base/browser + "target": "**/vs/base/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/base/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/parts/*/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**" + ] + }, + { + "target": "**/vs/base/parts/*/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/parts/*/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "**/vs/base/parts/*/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/base/parts/*/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/base/parts/*/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node,electron-main}/**", + "**/vs/base/parts/*/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**", + "**/vs/platform/*/common/**" + ] + }, + { + "target": "**/vs/platform/*/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**" + ] + }, + { + "target": "**/vs/platform/*/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**" + ] + }, + { + "target": "**/vs/platform/*/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "**/vs/base/parts/*/{common,node}/**", + "**/vs/platform/*/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "**/vs/platform/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node,electron-main}/**", + "**/vs/base/parts/*/{common,node,electron-main}/**", + "**/vs/platform/*/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/worker/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**" + ] + }, + { + "target": "**/vs/editor/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**", + "**/vs/editor/common/**", + "**/vs/editor/test/common/**" + ] + }, + { + "target": "**/vs/editor/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/standalone/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/standalone/common/**" + ] + }, + { + "target": "**/vs/editor/standalone/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**", + "**/vs/editor/common/**", + "**/vs/editor/test/common/**" + ] + }, + { + "target": "**/vs/editor/standalone/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**", + "**/vs/editor/standalone/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/standalone/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/standalone/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/contrib/*/test/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/base/test/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**", + "**/vs/editor/contrib/**" + ] + }, + { + "target": "**/vs/editor/contrib/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**" + ] + }, + { + "target": "**/vs/workbench/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/contrib/*/common/**", + "**/vs/workbench/common/**", + "**/vs/workbench/services/*/common/**", + "assert" + ] + }, + { + "target": "**/vs/workbench/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/{common,browser}/**", + "**/vs/workbench/services/*/{common,browser}/**", + "assert" + ] + }, + { + "target": "**/vs/workbench/workbench.desktop.main.ts", + "restrictions": [ + "**" + ] + }, + { + "target": "**/vs/workbench/api/common/**", + "restrictions": [ + "vscode", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/contrib/*/common/**", + "**/vs/workbench/api/common/**", + "**/vs/workbench/common/**", + "**/vs/workbench/services/*/common/**", + "**/vs/workbench/contrib/*/common/**" + ] + }, + { + "target": "**/vs/workbench/api/worker/**", + "restrictions": [ + "vscode", + "vs/nls", + "**/vs/**/{common,worker}/**" + ] + }, + { + "target": "**/vs/workbench/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "**/vs/platform/*/{common,browser,node,electron-browser}/**", + "**/vs/editor/{common,browser,node,electron-browser}/**", + "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention + "**/vs/workbench/{common,browser,node,electron-browser,api}/**", + "**/vs/workbench/services/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/test/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**", + "**/vs/platform/**", + "**/vs/editor/**", + "**/vs/workbench/{common,browser,node,electron-browser}/**", + "vs/workbench/contrib/files/common/editors/fileEditorInput", + "**/vs/workbench/services/**", + "**/vs/workbench/test/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/common/**", + "**/vs/platform/**/common/**", + "**/vs/editor/common/**", + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/common/**", + "**/vs/workbench/services/**/common/**", + "**/vs/workbench/api/**/common/**", + "vscode-textmate" + ] + }, + { + "target": "**/vs/workbench/services/**/worker/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/common/**", + "**/vs/platform/**/common/**", + "**/vs/editor/common/**", + "**/vs/workbench/**/common/**", + "**/vs/workbench/**/worker/**", + "**/vs/workbench/services/**/common/**", + "vscode" + ] + }, + { + "target": "**/vs/workbench/services/**/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,worker}/**", + "**/vs/platform/**/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/{common,browser}/**", + "**/vs/workbench/api/{common,browser}/**", + "**/vs/workbench/services/**/{common,browser}/**", + "vscode-textmate", + "onigasm-umd" + ] + }, + { + "target": "**/vs/workbench/services/**/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/editor/{common,node}/**", + "**/vs/workbench/{common,node}/**", + "**/vs/workbench/api/{common,node}/**", + "**/vs/workbench/services/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,worker,node,electron-browser}/**", + "**/vs/platform/**/{common,browser,node,electron-browser}/**", + "**/vs/editor/**", + "**/vs/workbench/{common,browser,node,electron-browser,api}/**", + "**/vs/workbench/services/**/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/contrib/terminal/browser/**", + "restrictions": [ + // xterm and its addons are strictly browser-only components + "xterm", + "xterm-addon-*", + "**/vs/**" + ] + }, + { + "target": "**/vs/workbench/contrib/extensions/browser/**", + "restrictions": [ + "semver-umd", + "**/vs/**" + ] + }, + { + "target": "**/vs/workbench/contrib/update/browser/update.ts", + "restrictions": [ + "semver-umd", + "**/vs/**" + ] + }, + { + "target": "**/vs/code/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/base/parts/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/code/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/code/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/**/{common,browser,node,electron-browser}/**", + "**/vs/platform/**/{common,browser,node,electron-browser}/**", + "**/vs/code/**/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/code/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node,electron-main}/**", + "**/vs/base/parts/**/{common,node,electron-main}/**", + "**/vs/platform/**/{common,node,electron-main}/**", + "**/vs/code/**/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/server/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/base/parts/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/workbench/**/{common,node}/**", + "**/vs/server/**", + "**/vs/code/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/{node,electron-browser,electron-main}/**", + "restrictions": "**/*" + }, + { + "target": "**/extensions/**", + "restrictions": "**/*" + }, + { + "target": "**/test/smoke/**", + "restrictions": [ + "**/test/smoke/**", + "*" + ] + }, + { + "target": "**/test/automation/**", + "restrictions": [ + "**/test/automation/**", + "*" + ] + }, + { + "target": "**/test/integration/**", + "restrictions": [ + "**/test/integration/**", + "*" + ] + }, + { + "target": "{**/api/**.test.ts,}", + "restrictions": "{**/vs/**,assert,sinon,crypto,vscode}" + }, + { + "target": "{**/**.test.ts,**/test/**}", + "restrictions": "{**/vs/**,assert,sinon,crypto,xterm*}" + }, + { + "target": "**/{common,browser,workbench}/**", + "restrictions": "**/vs/**" + } + ] + }, + "overrides": [ + { + "files": [ + "*.js" + ], + "rules": { + "jsdoc/no-types": "off" + } + }, + { + "files": [ + "**/vscode.d.ts", + "**/vscode.proposed.d.ts" + ], + "rules": { + "vscode-dts-create-func": "warn", + "vscode-dts-literal-or-types": "warn", + "vscode-dts-interface-naming": "warn", + "vscode-dts-event-naming": [ + "warn", + { + "allowed": [ + "onCancellationRequested", + "event" + ], + "verbs": [ + "accept", + "change", + "close", + "collapse", + "create", + "delete", + "dispose", + "end", + "expand", + "hide", + "open", + "override", + "receive", + "register", + "rename", + "save", + "send", + "start", + "terminate", + "trigger", + "unregister", + "write" + ] + } + ] + } + } + ] } diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index addf36f4339e4..4b385f041833a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve --- - + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a820760fc48f7..2dc1460b16f15 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,6 +4,7 @@ about: Suggest an idea for this project --- + diff --git a/.github/classifier.yml b/.github/classifier.yml index 92da2b03f5fb1..f190a03149d78 100644 --- a/.github/classifier.yml +++ b/.github/classifier.yml @@ -1,5 +1,5 @@ { - perform: true, + perform: false, alwaysRequireAssignee: false, labelsRequiringAssignee: [], autoAssignees: { @@ -18,124 +18,124 @@ assignees: [ weinand ], assignLabel: false }, - diff-editor: : { + diff-editor: { assignees: [], assignLabel: false }, dropdown: [], - editor: : { + editor: { assignees: [], assignLabel: false }, - editor-1000-limit: : { + editor-1000-limit: { assignees: [], assignLabel: false }, - editor-autoclosing: : { + editor-autoclosing: { assignees: [], assignLabel: false }, - editor-autoindent: : { + editor-autoindent: { assignees: [], assignLabel: false }, - editor-brackets: : { + editor-brackets: { assignees: [], assignLabel: false }, - editor-clipboard: : { + editor-clipboard: { assignees: [], assignLabel: false }, - editor-code-actions: : { + editor-code-actions: { assignees: [], assignLabel: false }, - editor-code-lens: : { + editor-code-lens: { assignees: [], assignLabel: false }, - editor-color-picker: : { + editor-color-picker: { assignees: [], assignLabel: false }, - editor-colors: : { + editor-colors: { assignees: [], assignLabel: false }, - editor-columnselect: : { + editor-columnselect: { assignees: [], assignLabel: false }, - editor-commands: : { + editor-commands: { assignees: [], assignLabel: false }, - editor-contrib: : { + editor-contrib: { assignees: [], assignLabel: false }, - editor-drag-and-drop: : { + editor-drag-and-drop: { assignees: [], assignLabel: false }, - editor-find: : { + editor-find: { assignees: [], assignLabel: false }, - editor-folding: : { + editor-folding: { assignees: [], assignLabel: false }, - editor-hover: : { + editor-hover: { assignees: [], assignLabel: false }, - editor-ime: : { + editor-ime: { assignees: [], assignLabel: false }, - editor-input: : { + editor-input: { assignees: [], assignLabel: false }, - editor-ligatures: : { + editor-ligatures: { assignees: [], assignLabel: false }, - editor-links: : { + editor-links: { assignees: [], assignLabel: false }, - editor-minimap: : { + editor-minimap: { assignees: [], assignLabel: false }, - editor-multicursor: : { + editor-multicursor: { assignees: [], assignLabel: false }, - editor-parameter-hints: : { + editor-parameter-hints: { assignees: [], assignLabel: false }, - editor-rendering: : { + editor-rendering: { assignees: [], assignLabel: false }, - editor-smooth: : { + editor-smooth: { assignees: [], assignLabel: false }, - editor-symbols: : { + editor-symbols: { assignees: [], assignLabel: false }, - editor-textbuffer: : { + editor-textbuffer: { assignees: [], assignLabel: false }, - editor-wrapping: : { + editor-wrapping: { assignees: [], assignLabel: false }, @@ -175,11 +175,11 @@ issue-reporter: [ RMacfarlane ], javascript: [ mjbvz ], json: [], - keyboard-layout: : { + keyboard-layout: { assignees: [], assignLabel: false }, - keybindings: : { + keybindings: { assignees: [], assignLabel: false }, @@ -207,7 +207,7 @@ quick-pick: [ chrmarti ], release-notes: [], remote: { - assignees: [ jrieken ], + assignees: [ ], assignLabel: false }, rename: [], diff --git a/.github/commands.yml b/.github/commands.yml index c649e6c4d8915..24ac951d6f013 100644 --- a/.github/commands.yml +++ b/.github/commands.yml @@ -118,10 +118,10 @@ }, { type: 'label', - name: '*needs more info', + name: '~needs more info', action: 'updateLabels', addLabel: 'needs more info', - removeLabel: '*needs more info', + removeLabel: '~needs more info', comment: "Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines. Please take the time to review these and update the issue.\n\nHappy Coding!" }, { @@ -133,10 +133,9 @@ }, { type: 'label', - name: '*needs more info', - action: 'updateLabels', - addLabel: 'needs more info', - removeLabel: '*needs more info' - }, + name: '*off-topic', + action: 'close', + comment: "Thanks for creating this issue. We think this issue is unactionable or unrelated to the goals of this project. Please follow our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!" + } ] } diff --git a/.github/copycat.yml b/.github/copycat.yml index eccccc16b007d..690c803bd0a80 100644 --- a/.github/copycat.yml +++ b/.github/copycat.yml @@ -2,4 +2,4 @@ perform: true, target_owner: 'chrmarti', target_repo: 'testissues' -} \ No newline at end of file +} diff --git a/.github/feature-requests.yml b/.github/feature-requests.yml new file mode 100644 index 0000000000000..18055b844862d --- /dev/null +++ b/.github/feature-requests.yml @@ -0,0 +1,34 @@ +{ + typeLabel: { + name: 'feature-request' + }, + candidateMilestone: { + number: 107, + name: 'Backlog Candidates' + }, + approvedMilestone: { + number: 8, + name: 'Backlog' + }, + onLabeled: { + delay: 60, + perform: true + }, + onCandidateMilestoned: { + candidatesComment: "This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!", + perform: true + }, + onMonitorUpvotes: { + upvoteThreshold: 20, + acceptanceComment: ":slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!", + perform: true + }, + onMonitorDaysOnCandidateMilestone: { + daysOnMilestone: 60, + warningPeriod: 10, + numberOfCommentsToPreventAutomaticRejection: 20, + rejectionComment: ":slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!", + warningComment: "This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding", + perform: true + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6b96ee9ae35b..c88e4255affd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: # TODO: rename azure-pipelines/linux/xvfb.init to github-actions - run: | sudo apt-get update - sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 + sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb sudo chmod +x /etc/init.d/xvfb sudo update-rc.d xvfb defaults @@ -35,20 +35,22 @@ jobs: name: Install Dependencies - run: yarn electron x64 name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks + - run: yarn valid-layers-check + name: Run Valid Layers Checks - run: yarn compile name: Compile Sources - run: yarn download-builtin-extensions name: Download Built-in Extensions - run: DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests" - name: Run Unit Tests + name: Run Unit Tests (Electron) + - run: DISPLAY=:10 yarn test-browser --browser chromium + name: Run Unit Tests (Browser) - run: DISPLAY=:10 ./scripts/test-integration.sh --tfs "Integration Tests" - name: Run Integration Tests + name: Run Integration Tests (Electron) windows: runs-on: windows-2016 @@ -67,20 +69,22 @@ jobs: name: Install Dependencies - run: yarn electron name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks + - run: yarn valid-layers-check + name: Run Valid Layers Checks - run: yarn compile name: Compile Sources - run: yarn download-builtin-extensions name: Download Built-in Extensions - run: .\scripts\test.bat --tfs "Unit Tests" - name: Run Unit Tests + name: Run Unit Tests (Electron) + - run: yarn test-browser --browser chromium + name: Run Unit Tests (Browser) - run: .\scripts\test-integration.bat --tfs "Integration Tests" - name: Run Integration Tests + name: Run Integration Tests (Electron) darwin: runs-on: macos-latest @@ -96,20 +100,22 @@ jobs: name: Install Dependencies - run: yarn electron x64 name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks + - run: yarn valid-layers-check + name: Run Valid Layers Checks - run: yarn compile name: Compile Sources - run: yarn download-builtin-extensions name: Download Built-in Extensions - run: ./scripts/test.sh --tfs "Unit Tests" - name: Run Unit Tests + name: Run Unit Tests (Electron) + - run: yarn test-browser --browser chromium --browser webkit + name: Run Unit Tests (Browser) - run: ./scripts/test-integration.sh --tfs "Integration Tests" - name: Run Integration Tests + name: Run Integration Tests (Electron) monaco: runs-on: macos-latest diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000000..d54a71fdf1f45 --- /dev/null +++ b/.mailmap @@ -0,0 +1,2 @@ +Eric Amodio Eric Amodio +Daniel Imms Daniel Imms diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b4336e7d127d5..2cd0a32b9ce77 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,7 +2,6 @@ // See https://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "ms-vscode.vscode-typescript-tslint-plugin", "dbaeumer.vscode-eslint", "EditorConfig.EditorConfig", "msjsdiag.debugger-for-chrome" diff --git a/.vscode/launch.json b/.vscode/launch.json index 25279b09fd314..caaed4c25a7b4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,7 +16,6 @@ "request": "attach", "name": "Attach to Extension Host", "port": 5870, - "restart": true, "outFiles": [ "${workspaceFolder}/out/**/*.js" ] @@ -35,7 +34,10 @@ "port": 5876, "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "hidden": true, + } }, { "type": "node", @@ -53,7 +55,10 @@ "port": 5875, "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "hidden": true, + } }, { "type": "extensionHost", @@ -67,7 +72,29 @@ ], "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 6 + } + }, + { + "type": "extensionHost", + "request": "launch", + "name": "VS Code Git Tests", + "runtimeExecutable": "${execPath}", + "args": [ + "/tmp/my4g9l", + "--extensionDevelopmentPath=${workspaceFolder}/extensions/git", + "--extensionTestsPath=${workspaceFolder}/extensions/git/out/test" + ], + "outFiles": [ + "${workspaceFolder}/extensions/git/out/**/*.js" + ], + "presentation": { + "group": "5_tests", + "order": 6 + } }, { "type": "extensionHost", @@ -82,7 +109,11 @@ ], "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 3 + } }, { "type": "extensionHost", @@ -96,7 +127,11 @@ ], "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 4 + } }, { "type": "extensionHost", @@ -110,7 +145,11 @@ ], "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 5 + } }, { "type": "chrome", @@ -131,6 +170,7 @@ "linux": { "runtimeExecutable": "${workspaceFolder}/scripts/code.sh" }, + "port": 9222, "timeout": 20000, "env": { "VSCODE_EXTHOST_WILL_SEND_SOCKET": null @@ -139,9 +179,14 @@ "urlFilter": "*workbench.html*", "runtimeArgs": [ "--inspect=5875", - "--no-cached-data" + "--no-cached-data", + ], + "webRoot": "${workspaceFolder}", + // Settings for js-debug: + "pauseForSourceMap": false, + "outFiles": [ + "${workspaceFolder}/out/**/*.js" ], - "webRoot": "${workspaceFolder}" }, { "type": "node", @@ -156,7 +201,11 @@ ], "outFiles": [ "${workspaceFolder}/out/**/*.js" - ] + ], + "presentation": { + "group": "2_launch", + "order": 1 + } }, { "type": "node", @@ -166,13 +215,21 @@ "runtimeArgs": [ "web" ], + "presentation": { + "group": "2_launch", + "order": 2 + } }, { "type": "chrome", "request": "launch", "name": "Launch VS Code (Web, Chrome)", "url": "http://localhost:8080", - "preLaunchTask": "Run web" + "preLaunchTask": "Run web", + "presentation": { + "group": "2_launch", + "order": 3 + } }, { "type": "node", @@ -183,7 +240,26 @@ "cwd": "${workspaceFolder}/extensions/git", "outFiles": [ "${workspaceFolder}/extensions/git/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 10 + } + }, + { + "type": "node", + "request": "launch", + "name": "HTML Unit Tests", + "program": "${workspaceFolder}/extensions/html-language-features/server/test/index.js", + "stopOnEntry": false, + "cwd": "${workspaceFolder}/extensions/html-language-features/server", + "outFiles": [ + "${workspaceFolder}/extensions/html-language-features/server/out/**/*.js" + ], + "presentation": { + "group": "5_tests", + "order": 10 + } }, { "type": "extensionHost", @@ -197,7 +273,11 @@ ], "outFiles": [ "${workspaceFolder}/extensions/markdown-language-features/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 7 + } }, { "type": "extensionHost", @@ -211,13 +291,17 @@ ], "outFiles": [ "${workspaceFolder}/extensions/typescript-language-features/out/**/*.js" - ] + ], + "presentation": { + "group": "5_tests", + "order": 8 + } }, { "type": "node", "request": "launch", "name": "Run Unit Tests", - "program": "${workspaceFolder}/test/electron/index.js", + "program": "${workspaceFolder}/test/unit/electron/index.js", "runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.app/Contents/MacOS/Electron", "windows": { "runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.exe" @@ -235,6 +319,9 @@ ], "env": { "MOCHA_COLORS": "true" + }, + "presentation": { + "hidden": true } }, { @@ -275,28 +362,44 @@ "Launch VS Code", "Attach to Main Process", "Attach to Extension Host" - ] + ], + "presentation": { + "group": "1_vscode", + "order": 1 + } }, { "name": "Search and Renderer processes", "configurations": [ "Launch VS Code", "Attach to Search Process" - ] + ], + "presentation": { + "group": "1_vscode", + "order": 4 + } }, { "name": "Renderer and Extension Host processes", "configurations": [ "Launch VS Code", "Attach to Extension Host" - ] + ], + "presentation": { + "group": "1_vscode", + "order": 3 + } }, { "name": "Debug Unit Tests", "configurations": [ "Attach to VS Code", "Run Unit Tests" - ] - }, + ], + "presentation": { + "group": "1_vscode", + "order": 2 + } + } ] } diff --git a/.vscode/searches/ts36031.code-search b/.vscode/searches/ts36031.code-search new file mode 100644 index 0000000000000..a232dfbd3444f --- /dev/null +++ b/.vscode/searches/ts36031.code-search @@ -0,0 +1,9 @@ +# Query: \\w+\\?\\..+![(.[] +# Flags: RegExp +# ContextLines: 2 +src/vs/base/browser/ui/tree/asyncDataTree.ts: + 270 } : undefined, + 271 isChecked: options.ariaProvider!.isChecked ? (e) => { + 272: return options.ariaProvider?.isChecked!(e.element as T); + 273 } : undefined + 274 }, diff --git a/.vscode/settings.json b/.vscode/settings.json index ef1f7370d26e3..d56f75c41d494 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,6 +22,8 @@ "i18n/**": true, "extensions/**/out/**": true, "test/smoke/out/**": true, + "test/automation/out/**": true, + "test/integration/browser/out/**": true, "src/vs/base/test/node/uri.test.data.txt": true }, "lcov.path": [ @@ -37,6 +39,11 @@ } } ], + "eslint.options": { + "rulePaths": [ + "./build/lib/eslint" + ] + }, "typescript.tsdk": "node_modules/typescript/lib", "npm.exclude": "**/extensions/**", "npm.packageManager": "yarn", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d1a697bb41daa..30b783943e038 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -31,28 +31,6 @@ } } }, - { - "type": "npm", - "script": "strict-initialization-watch", - "label": "TS - Strict Initialization", - "isBackground": true, - "presentation": { - "reveal": "never" - }, - "problemMatcher": { - "base": "$tsc-watch", - "owner": "typescript-strict-initialization", - "applyTo": "allDocuments" - } - }, - { - "type": "gulp", - "task": "tslint", - "label": "Run tslint", - "problemMatcher": [ - "$tslint5" - ] - }, { "label": "Run tests", "type": "shell", @@ -90,7 +68,6 @@ "command": "yarn web -- --no-launch", "label": "Run web", "isBackground": true, - // This section to make error go away when launching the debug config "problemMatcher": { "pattern": { "regexp": "" @@ -104,5 +81,13 @@ "reveal": "never" } }, + { + "type": "npm", + "script": "eslint", + "problemMatcher": { + "source": "eslint", + "base": "$eslint-stylish" + } + } ] } diff --git a/.yarnrc b/.yarnrc index 7f3fa82972f98..7808166004a1e 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,3 +1,3 @@ disturl "https://atom.io/download/electron" -target "6.1.4" +target "7.1.11" runtime "electron" diff --git a/README.md b/README.md index 5d39d7e40c616..1d3bc28f9bb6e 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Stu Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on [Visual Studio Code's website](https://code.visualstudio.com/Download). To get the latest releases every day, install the [Insiders build](https://code.visualstudio.com/insiders). - - ## Contributing There are many ways in which you can participate in the project, for example: @@ -46,17 +44,17 @@ please see the document [How to Contribute](https://github.com/Microsoft/vscode/ * Ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode) * [Request a new feature](CONTRIBUTING.md) -* Up vote [popular feature requests](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) +* Upvote [popular feature requests](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) * [File an issue](https://github.com/Microsoft/vscode/issues) * Follow [@code](https://twitter.com/code) and let us know what you think! ## Related Projects -Many of the core components and extensions to Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/Microsoft/vscode/wiki). +Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/Microsoft/vscode/wiki). ## Bundled Extensions -Code includes a set of built-in extensions located in the [extensions](extensions) folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix `language-features`. For example, the `json` extension provides coloring for `JSON` and the `json-language-features` provides rich language support for `JSON`. +VS Code includes a set of built-in extensions located in the [extensions](extensions) folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix `language-features`. For example, the `json` extension provides coloring for `JSON` and the `json-language-features` provides rich language support for `JSON`. ## Code of Conduct diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 440edf6844ba8..7bd723dcbff9f 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -7,33 +7,33 @@ This project incorporates components from the projects listed below. The origina 1. atom/language-clojure version 0.22.7 (https://github.com/atom/language-clojure) 2. atom/language-coffee-script version 0.49.3 (https://github.com/atom/language-coffee-script) -3. atom/language-java version 0.31.3 (https://github.com/atom/language-java) -4. atom/language-sass version 0.61.4 (https://github.com/atom/language-sass) +3. atom/language-java version 0.31.4 (https://github.com/atom/language-java) +4. atom/language-sass version 0.62.1 (https://github.com/atom/language-sass) 5. atom/language-shellscript version 0.26.0 (https://github.com/atom/language-shellscript) 6. atom/language-xml version 0.35.2 (https://github.com/atom/language-xml) -7. Colorsublime-Themes version 0.1.0 (https://github.com/Colorsublime/Colorsublime-Themes) -8. daaain/Handlebars version 1.8.0 (https://github.com/daaain/Handlebars) -9. davidrios/pug-tmbundle (https://github.com/davidrios/pug-tmbundle) -10. definitelytyped (https://github.com/DefinitelyTyped/DefinitelyTyped) -11. demyte/language-cshtml version 0.3.0 (https://github.com/demyte/language-cshtml) -12. Document Object Model version 4.0.0 (https://www.w3.org/DOM/) -13. dotnet/csharp-tmLanguage version 0.1.0 (https://github.com/dotnet/csharp-tmLanguage) -14. expand-abbreviation version 0.5.8 (https://github.com/emmetio/expand-abbreviation) -15. fadeevab/make.tmbundle (https://github.com/fadeevab/make.tmbundle) -16. freebroccolo/atom-language-swift (https://github.com/freebroccolo/atom-language-swift) -17. HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/) -18. Ikuyadeu/vscode-R version 0.5.5 (https://github.com/Ikuyadeu/vscode-R) -19. insane version 2.6.2 (https://github.com/bevacqua/insane) -20. Ionic documentation version 1.2.4 (https://github.com/ionic-team/ionic-site) -21. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) -22. jeff-hykin/cpp-textmate-grammar version 1.12.11 (https://github.com/jeff-hykin/cpp-textmate-grammar) -23. jeff-hykin/cpp-textmate-grammar version 1.14.9 (https://github.com/jeff-hykin/cpp-textmate-grammar) -24. js-beautify version 1.6.8 (https://github.com/beautify-web/js-beautify) -25. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) -26. language-docker (https://github.com/moby/moby) -27. language-go version 0.44.3 (https://github.com/atom/language-go) +7. better-go-syntax version 1.0.0 (https://github.com/jeff-hykin/better-go-syntax/ ) +8. Colorsublime-Themes version 0.1.0 (https://github.com/Colorsublime/Colorsublime-Themes) +9. daaain/Handlebars version 1.8.0 (https://github.com/daaain/Handlebars) +10. davidrios/pug-tmbundle (https://github.com/davidrios/pug-tmbundle) +11. definitelytyped (https://github.com/DefinitelyTyped/DefinitelyTyped) +12. demyte/language-cshtml version 0.3.0 (https://github.com/demyte/language-cshtml) +13. Document Object Model version 4.0.0 (https://www.w3.org/DOM/) +14. dotnet/csharp-tmLanguage version 0.1.0 (https://github.com/dotnet/csharp-tmLanguage) +15. expand-abbreviation version 0.5.8 (https://github.com/emmetio/expand-abbreviation) +16. fadeevab/make.tmbundle (https://github.com/fadeevab/make.tmbundle) +17. freebroccolo/atom-language-swift (https://github.com/freebroccolo/atom-language-swift) +18. HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/) +19. Ikuyadeu/vscode-R version 0.5.5 (https://github.com/Ikuyadeu/vscode-R) +20. insane version 2.6.2 (https://github.com/bevacqua/insane) +21. Ionic documentation version 1.2.4 (https://github.com/ionic-team/ionic-site) +22. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) +23. jeff-hykin/cpp-textmate-grammar version 1.12.11 (https://github.com/jeff-hykin/cpp-textmate-grammar) +24. jeff-hykin/cpp-textmate-grammar version 1.14.15 (https://github.com/jeff-hykin/cpp-textmate-grammar) +25. js-beautify version 1.6.8 (https://github.com/beautify-web/js-beautify) +26. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) +27. language-docker (https://github.com/moby/moby) 28. language-less version 0.34.2 (https://github.com/atom/language-less) -29. language-php version 0.44.2 (https://github.com/atom/language-php) +29. language-php version 0.44.3 (https://github.com/atom/language-php) 30. language-rust version 0.4.12 (https://github.com/zargony/atom-language-rust) 31. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) 32. marked version 0.6.2 (https://github.com/markedjs/marked) @@ -340,6 +340,32 @@ suitability for any purpose. ========================================= END OF atom/language-xml NOTICES AND INFORMATION +%% better-go-syntax NOTICES AND INFORMATION BEGIN HERE +========================================= +MIT License + +Copyright (c) 2019 Jeff Hykin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +========================================= +END OF better-go-syntax NOTICES AND INFORMATION + %% Colorsublime-Themes NOTICES AND INFORMATION BEGIN HERE ========================================= Copyright (c) 2015 Colorsublime.com @@ -589,7 +615,7 @@ END OF HTML 5.1 W3C Working Draft NOTICES AND INFORMATION ========================================= MIT License -Copyright (c) 2017 Yuki Ueda +Copyright (c) 2019 Yuki Ueda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -987,83 +1013,6 @@ Apache License ========================================= END OF language-docker NOTICES AND INFORMATION -%% language-go NOTICES AND INFORMATION BEGIN HERE -========================================= -The MIT License (MIT) - -Copyright (c) 2014 GitHub Inc. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -This package was derived from a TextMate bundle located at -https://github.com/rsms/Go.tmbundle and distributed under the following -license, located in `LICENSE`: - -Copyright (c) 2009 Rasmus Andersson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The Go Template grammar was derived from GoSublime located at -https://github.com/DisposaBoy/GoSublime and distributed under the following -license, located in `LICENSE.md`: - -Copyright (c) 2012 The GoSublime Authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -========================================= -END OF language-go NOTICES AND INFORMATION - %% language-less NOTICES AND INFORMATION BEGIN HERE ========================================= The MIT License (MIT) @@ -1692,10 +1641,10 @@ Copyright (c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Copyright (c) 2016 Sanjay Nagamangalam +Copyright (c) 2016 Microsoft The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------ END OF LICENSE ------------------------------------------ +----------------------------------------------- END OF LICENSE ----------------------------------------- ========================================= END OF Microsoft/vscode-mssql NOTICES AND INFORMATION @@ -2858,4 +2807,4 @@ Apache License See the License for the specific language governing permissions and limitations under the License. ========================================= -END OF Web Background Synchronization NOTICES AND INFORMATION \ No newline at end of file +END OF Web Background Synchronization NOTICES AND INFORMATION diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e52afca602874..b2f9a13c2b7b9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,6 +13,6 @@ jobs: - job: macOS pool: - vmImage: macOS 10.13 + vmImage: macOS-latest steps: - - template: build/azure-pipelines/darwin/continuous-build-darwin.yml \ No newline at end of file + - template: build/azure-pipelines/darwin/continuous-build-darwin.yml diff --git a/build/azure-pipelines/common/createAsset.ts b/build/azure-pipelines/common/createAsset.ts index 619c92a04120e..53c15a28fcf53 100644 --- a/build/azure-pipelines/common/createAsset.ts +++ b/build/azure-pipelines/common/createAsset.ts @@ -44,15 +44,16 @@ async function doesAssetExist(blobService: azure.BlobService, quality: string, b return existsResult.exists; } -async function uploadBlob(blobService: azure.BlobService, quality: string, blobName: string, file: string): Promise { +async function uploadBlob(blobService: azure.BlobService, quality: string, blobName: string, filePath: string, fileName: string): Promise { const blobOptions: azure.BlobService.CreateBlockBlobRequestOptions = { contentSettings: { - contentType: mime.lookup(file), + contentType: mime.lookup(filePath), + contentDisposition: `attachment; filename="${fileName}"`, cacheControl: 'max-age=31536000, public' } }; - await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(quality, blobName, file, blobOptions, err => err ? e(err) : c())); + await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(quality, blobName, filePath, blobOptions, err => err ? e(err) : c())); } function getEnv(name: string): string { @@ -66,24 +67,24 @@ function getEnv(name: string): string { } async function main(): Promise { - const [, , platform, type, name, file] = process.argv; + const [, , platform, type, fileName, filePath] = process.argv; const quality = getEnv('VSCODE_QUALITY'); const commit = getEnv('BUILD_SOURCEVERSION'); console.log('Creating asset...'); - const stat = await new Promise((c, e) => fs.stat(file, (err, stat) => err ? e(err) : c(stat))); + const stat = await new Promise((c, e) => fs.stat(filePath, (err, stat) => err ? e(err) : c(stat))); const size = stat.size; console.log('Size:', size); - const stream = fs.createReadStream(file); + const stream = fs.createReadStream(filePath); const [sha1hash, sha256hash] = await Promise.all([hashStream('sha1', stream), hashStream('sha256', stream)]); console.log('SHA1:', sha1hash); console.log('SHA256:', sha256hash); - const blobName = commit + '/' + name; + const blobName = commit + '/' + fileName; const storageAccount = process.env['AZURE_STORAGE_ACCOUNT_2']!; const blobService = azure.createBlobService(storageAccount, process.env['AZURE_STORAGE_ACCESS_KEY_2']!) @@ -98,7 +99,7 @@ async function main(): Promise { console.log('Uploading blobs to Azure storage...'); - await uploadBlob(blobService, quality, blobName, file); + await uploadBlob(blobService, quality, blobName, filePath, fileName); console.log('Blobs successfully uploaded.'); diff --git a/build/azure-pipelines/darwin/continuous-build-darwin.yml b/build/azure-pipelines/darwin/continuous-build-darwin.yml index 476ee9137a1bd..c8f5b08fe2a15 100644 --- a/build/azure-pipelines/darwin/continuous-build-darwin.yml +++ b/build/azure-pipelines/darwin/continuous-build-darwin.yml @@ -2,14 +2,14 @@ steps: - task: NodeTool@0 inputs: versionSpec: "12.13.0" +- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 + inputs: + versionSpec: "1.x" - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' -- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 - inputs: - versionSpec: "1.x" + vstsFeed: 'vscode-build-cache' - script: | CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install Dependencies @@ -18,20 +18,20 @@ steps: inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' + vstsFeed: 'vscode-build-cache' condition: and(succeeded(), ne(variables['CacheRestored'], 'true')) - script: | yarn electron x64 displayName: Download Electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks +- script: | + yarn valid-layers-check + displayName: Run Valid Layers Checks - script: | yarn compile displayName: Compile Sources @@ -40,10 +40,13 @@ steps: displayName: Download Built-in Extensions - script: | ./scripts/test.sh --tfs "Unit Tests" - displayName: Run Unit Tests + displayName: Run Unit Tests (Electron) +- script: | + yarn test-browser --browser chromium --browser webkit + displayName: Run Unit Tests (Browser) - script: | ./scripts/test-integration.sh --tfs "Integration Tests" - displayName: Run Integration Tests + displayName: Run Integration Tests (Electron) - task: PublishTestResults@2 displayName: Publish Tests Results inputs: diff --git a/build/azure-pipelines/darwin/entitlements.plist b/build/azure-pipelines/darwin/entitlements.plist new file mode 100644 index 0000000000000..be8b7163da7fc --- /dev/null +++ b/build/azure-pipelines/darwin/entitlements.plist @@ -0,0 +1,14 @@ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.allow-dyld-environment-variables + + + diff --git a/build/azure-pipelines/darwin/product-build-darwin.yml b/build/azure-pipelines/darwin/product-build-darwin.yml index 273a728927f25..795bc78556ebf 100644 --- a/build/azure-pipelines/darwin/product-build-darwin.yml +++ b/build/azure-pipelines/darwin/product-build-darwin.yml @@ -96,9 +96,13 @@ steps: - script: | set -e ./scripts/test.sh --build --tfs "Unit Tests" - # APP_NAME="`ls $(agent.builddirectory)/VSCode-darwin | head -n 1`" - # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-darwin/$APP_NAME" - displayName: Run unit tests + displayName: Run unit tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + yarn test-browser --build --browser chromium --browser webkit + displayName: Run unit tests (Browser) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | @@ -111,23 +115,40 @@ steps: INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" - displayName: Run integration tests + displayName: Run integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + APP_ROOT=$(agent.builddirectory)/VSCode-darwin + APP_NAME="`ls $APP_ROOT | head -n 1`" + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ + ./resources/server/test/test-remote-integration.sh + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \ + ./resources/server/test/test-web-integration.sh --browser webkit + displayName: Run integration tests (Browser) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) -# Web Smoke Tests disabled due to https://github.com/microsoft/vscode/issues/80308 -# - script: | -# set -e -# cd test/smoke -# yarn compile -# cd - -# yarn smoketest --web --headless -# continueOnError: true -# displayName: Run web smoke tests -# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain + security default-keychain -s $(agent.tempdirectory)/buildagent.keychain + security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain + echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12 + security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain + codesign -s 99FM488X57 --deep --force --options runtime --entitlements build/azure-pipelines/darwin/entitlements.plist $(agent.builddirectory)/VSCode-darwin/*.app + displayName: Set Hardened Entitlements - script: | set -e - pushd ../VSCode-darwin && zip -r -X -y ../VSCode-darwin.zip * && popd + pushd $(agent.builddirectory)/VSCode-darwin && zip -r -X -y $(agent.builddirectory)/VSCode-darwin.zip * && popd displayName: Archive build - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 @@ -141,14 +162,54 @@ steps: { "keyCode": "CP-401337-Apple", "operationSetCode": "MacAppDeveloperSign", - "parameters": [ ], + "parameters": [ + { + "parameterName": "Hardening", + "parameterValue": "--options=runtime" + } + ], "toolName": "sign", "toolVersion": "1.0" } ] - SessionTimeout: 120 + SessionTimeout: 60 displayName: Codesign +- script: | + zip -d $(agent.builddirectory)/VSCode-darwin.zip "*.pkg" + displayName: Clean Archive + +- script: | + APP_ROOT=$(agent.builddirectory)/VSCode-darwin + APP_NAME="`ls $APP_ROOT | head -n 1`" + BUNDLE_IDENTIFIER=$(node -p "require(\"$APP_ROOT/$APP_NAME/Contents/Resources/app/product.json\").darwinBundleIdentifier") + echo "##vso[task.setvariable variable=BundleIdentifier]$BUNDLE_IDENTIFIER" + displayName: Export bundle identifier + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + inputs: + ConnectedServiceName: 'ESRP CodeSign' + FolderPath: '$(agent.builddirectory)' + Pattern: 'VSCode-darwin.zip' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-401337-Apple", + "operationSetCode": "MacAppNotarize", + "parameters": [ + { + "parameterName": "BundleId", + "parameterValue": "$(BundleIdentifier)" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 60 + displayName: Notarization + - script: | set -e VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ diff --git a/build/azure-pipelines/darwin/publish.sh b/build/azure-pipelines/darwin/publish.sh index a8067a5eefb96..f0375d2a3c8f2 100755 --- a/build/azure-pipelines/darwin/publish.sh +++ b/build/azure-pipelines/darwin/publish.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash set -e -# remove pkg from archive -zip -d ../VSCode-darwin.zip "*.pkg" - # publish the build node build/azure-pipelines/common/createAsset.js \ darwin \ @@ -22,7 +19,9 @@ node build/azure-pipelines/common/createAsset.js \ ../vscode-server-darwin.zip # publish hockeyapp symbols -node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" x64 "$VSCODE_HOCKEYAPP_ID_MACOS" +# node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" x64 "$VSCODE_HOCKEYAPP_ID_MACOS" +# Skip hockey app because build failure. +# https://github.com/microsoft/vscode/issues/90491 # upload configuration yarn gulp upload-vscode-configuration diff --git a/build/azure-pipelines/linux/continuous-build-linux.yml b/build/azure-pipelines/linux/continuous-build-linux.yml index a87e3753e77a3..9de15845c04b0 100644 --- a/build/azure-pipelines/linux/continuous-build-linux.yml +++ b/build/azure-pipelines/linux/continuous-build-linux.yml @@ -10,14 +10,14 @@ steps: - task: NodeTool@0 inputs: versionSpec: "12.13.0" +- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 + inputs: + versionSpec: "1.x" - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' -- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 - inputs: - versionSpec: "1.x" + vstsFeed: 'vscode-build-cache' - script: | CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install Dependencies @@ -26,20 +26,20 @@ steps: inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' + vstsFeed: 'vscode-build-cache' condition: and(succeeded(), ne(variables['CacheRestored'], 'true')) - script: | yarn electron x64 displayName: Download Electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks +- script: | + yarn valid-layers-check + displayName: Run Valid Layers Checks - script: | yarn compile displayName: Compile Sources @@ -48,10 +48,13 @@ steps: displayName: Download Built-in Extensions - script: | DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests" - displayName: Run Unit Tests + displayName: Run Unit Tests (Electron) +- script: | + DISPLAY=:10 yarn test-browser --browser chromium + displayName: Run Unit Tests (Browser) - script: | DISPLAY=:10 ./scripts/test-integration.sh --tfs "Integration Tests" - displayName: Run Integration Tests + displayName: Run Integration Tests (Electron) - task: PublishTestResults@2 displayName: Publish Tests Results inputs: diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 6e1f8ec1e536b..cbe3bf051e6cc 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -101,7 +101,13 @@ steps: - script: | set -e DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests" - displayName: Run unit tests + displayName: Run unit tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + DISPLAY=:10 yarn test-browser --build --browser chromium + displayName: Run unit tests (Browser) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | @@ -114,10 +120,52 @@ steps: INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-x64" \ DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests" - # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-x64" - displayName: Run integration tests + displayName: Run integration tests (Electron) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + APP_ROOT=$(agent.builddirectory)/VSCode-linux-x64 + APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName") + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-x64" \ + DISPLAY=:10 ./resources/server/test/test-remote-integration.sh + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-x64" \ + DISPLAY=:10 ./resources/server/test/test-web-integration.sh --browser chromium + displayName: Run integration tests (Browser) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + yarn gulp "vscode-linux-x64-build-deb" + yarn gulp "vscode-linux-x64-build-rpm" + yarn gulp "vscode-linux-x64-prepare-snap" + displayName: Build packages + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + inputs: + ConnectedServiceName: 'ESRP CodeSign' + FolderPath: '.build/linux/rpm/x86_64' + Pattern: '*.rpm' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-450779-Pgp", + "operationSetCode": "LinuxSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 120 + displayName: Codesign rpm + - script: | set -e AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \ diff --git a/build/azure-pipelines/linux/publish.sh b/build/azure-pipelines/linux/publish.sh index 3a5f9683eaac9..b168ab9cf7bf0 100755 --- a/build/azure-pipelines/linux/publish.sh +++ b/build/azure-pipelines/linux/publish.sh @@ -28,10 +28,11 @@ rm -rf $ROOT/vscode-server-*.tar.* node build/azure-pipelines/common/createAsset.js "server-$PLATFORM_LINUX" archive-unsigned "$SERVER_TARBALL_FILENAME" "$SERVER_TARBALL_PATH" # Publish hockeyapp symbols -node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" "x64" "$VSCODE_HOCKEYAPP_ID_LINUX64" +# node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" "x64" "$VSCODE_HOCKEYAPP_ID_LINUX64" +# Skip hockey app because build failure. +# https://github.com/microsoft/vscode/issues/90491 # Publish DEB -yarn gulp "vscode-linux-x64-build-deb" PLATFORM_DEB="linux-deb-x64" DEB_ARCH="amd64" DEB_FILENAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/)" @@ -40,7 +41,6 @@ DEB_PATH="$REPO/.build/linux/deb/$DEB_ARCH/deb/$DEB_FILENAME" node build/azure-pipelines/common/createAsset.js "$PLATFORM_DEB" package "$DEB_FILENAME" "$DEB_PATH" # Publish RPM -yarn gulp "vscode-linux-x64-build-rpm" PLATFORM_RPM="linux-rpm-x64" RPM_ARCH="x86_64" RPM_FILENAME="$(ls $REPO/.build/linux/rpm/$RPM_ARCH/ | grep .rpm)" @@ -49,8 +49,6 @@ RPM_PATH="$REPO/.build/linux/rpm/$RPM_ARCH/$RPM_FILENAME" node build/azure-pipelines/common/createAsset.js "$PLATFORM_RPM" package "$RPM_FILENAME" "$RPM_PATH" # Publish Snap -yarn gulp "vscode-linux-x64-prepare-snap" - # Pack snap tarball artifact, in order to preserve file perms mkdir -p $REPO/.build/linux/snap-tarball SNAP_TARBALL_PATH="$REPO/.build/linux/snap-tarball/snap-x64.tar.gz" diff --git a/build/azure-pipelines/linux/xvfb.init b/build/azure-pipelines/linux/xvfb.init index 4d77d253a2649..2365c09f3a460 100644 --- a/build/azure-pipelines/linux/xvfb.init +++ b/build/azure-pipelines/linux/xvfb.init @@ -19,7 +19,7 @@ [ "${NETWORKING}" = "no" ] && exit 0 PROG="/usr/bin/Xvfb" -PROG_OPTIONS=":10 -ac" +PROG_OPTIONS=":10 -ac -screen 0 1024x768x24" PROG_OUTPUT="/tmp/Xvfb.out" case "$1" in @@ -50,4 +50,4 @@ case "$1" in exit 1 esac -exit $RETVAL \ No newline at end of file +exit $RETVAL diff --git a/build/azure-pipelines/product-build.yml b/build/azure-pipelines/product-build.yml index ecf47fa1cdd59..a98b5f4f77e2a 100644 --- a/build/azure-pipelines/product-build.yml +++ b/build/azure-pipelines/product-build.yml @@ -67,7 +67,7 @@ jobs: - template: linux/product-build-linux-multiarch.yml - job: LinuxArm64 - condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ARM64'], 'true'), ne(variables['VSCODE_QUALITY'], 'stable')) + condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_LINUX_ARM64'], 'true')) pool: vmImage: 'Ubuntu-16.04' variables: @@ -102,7 +102,7 @@ jobs: - job: macOS condition: and(succeeded(), eq(variables['VSCODE_COMPILE_ONLY'], 'false'), eq(variables['VSCODE_BUILD_MACOS'], 'true')) pool: - vmImage: macOS 10.13 + vmImage: macOS-latest dependsOn: - Compile steps: @@ -118,6 +118,7 @@ jobs: - Linux - LinuxSnap - LinuxArmhf + - LinuxArm64 - LinuxAlpine - macOS steps: @@ -133,6 +134,7 @@ jobs: - Linux - LinuxSnap - LinuxArmhf + - LinuxArm64 - LinuxAlpine - LinuxWeb - macOS diff --git a/build/azure-pipelines/product-compile.yml b/build/azure-pipelines/product-compile.yml index 87c70f4f8053f..e527b8b134f7c 100644 --- a/build/azure-pipelines/product-compile.yml +++ b/build/azure-pipelines/product-compile.yml @@ -12,23 +12,24 @@ steps: vstsFeed: 'npm-vscode' platformIndependent: true alias: 'Compilation' + dryRun: true - task: NodeTool@0 inputs: versionSpec: "12.13.0" - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 inputs: versionSpec: "1.x" - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - task: AzureKeyVault@1 displayName: 'Azure Key Vault: Get Secrets' inputs: azureSubscription: 'vscode-builds-subscription' KeyVaultName: vscode - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e @@ -41,7 +42,7 @@ steps: git config user.email "vscode@microsoft.com" git config user.name "VSCode" displayName: Prepare tooling - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e @@ -49,33 +50,33 @@ steps: git fetch distro git merge $(node -p "require('./package.json').distro") displayName: Merge distro - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 inputs: keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'npm-vscode' - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install dependencies - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), ne(variables['CacheRestored'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), ne(variables['CacheRestored'], 'true')) - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 inputs: keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'npm-vscode' - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), ne(variables['CacheRestored'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), ne(variables['CacheRestored'], 'true')) - script: | set -e yarn postinstall displayName: Run postinstall scripts - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['CacheRestored'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['CacheRestored'], 'true')) # Mixin must run before optimize, because the CSS loader will # inline small SVGs @@ -83,28 +84,28 @@ steps: set -e node build/azure-pipelines/mixin displayName: Mix in quality - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e - yarn gulp hygiene --skip-tslint - yarn gulp tslint + yarn gulp hygiene yarn monaco-compile-check - displayName: Run hygiene, tslint and monaco compile checks - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + yarn valid-layers-check + displayName: Run hygiene, monaco compile & valid layers checks + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | set - ./build/azure-pipelines/common/extract-telemetry.sh displayName: Extract Telemetry - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e AZURE_WEBVIEW_STORAGE_ACCESS_KEY="$(vscode-webview-storage-key)" \ ./build/azure-pipelines/common/publish-webview.sh displayName: Publish Webview - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e @@ -114,14 +115,19 @@ steps: yarn gulp minify-vscode-reh yarn gulp minify-vscode-reh-web displayName: Compile - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) + env: + OSS_GITHUB_ID: "a5d3c261b032765a78de" + OSS_GITHUB_SECRET: $(oss-github-client-secret) + INSIDERS_GITHUB_ID: "31f02627809389d9f111" + INSIDERS_GITHUB_SECRET: $(insiders-github-client-secret) - script: | set -e AZURE_STORAGE_ACCESS_KEY="$(ticino-storage-key)" \ node build/azure-pipelines/upload-sourcemaps displayName: Upload sourcemaps - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - script: | set -e @@ -129,7 +135,7 @@ steps: AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \ node build/azure-pipelines/common/createBuild.js $VERSION displayName: Create build - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 inputs: @@ -138,4 +144,4 @@ steps: vstsFeed: 'npm-vscode' platformIndependent: true alias: 'Compilation' - condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true')) + condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true')) diff --git a/build/azure-pipelines/win32/ESRPClient/packages.config b/build/azure-pipelines/win32/ESRPClient/packages.config index d7a6f144f4778..c10bed141215a 100644 --- a/build/azure-pipelines/win32/ESRPClient/packages.config +++ b/build/azure-pipelines/win32/ESRPClient/packages.config @@ -1,4 +1,4 @@ - + diff --git a/build/azure-pipelines/win32/continuous-build-win32.yml b/build/azure-pipelines/win32/continuous-build-win32.yml index 7e16a00f0d898..e438550f8f5f8 100644 --- a/build/azure-pipelines/win32/continuous-build-win32.yml +++ b/build/azure-pipelines/win32/continuous-build-win32.yml @@ -13,7 +13,7 @@ steps: inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' + vstsFeed: 'vscode-build-cache' - powershell: | yarn --frozen-lockfile env: @@ -24,19 +24,19 @@ steps: inputs: keyfile: '.yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' + vstsFeed: 'vscode-build-cache' condition: and(succeeded(), ne(variables['CacheRestored'], 'true')) - powershell: | yarn electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - powershell: | yarn monaco-compile-check displayName: Run Monaco Editor Checks +- script: | + yarn valid-layers-check + displayName: Run Valid Layers Checks - powershell: | yarn compile displayName: Compile Sources @@ -45,10 +45,13 @@ steps: displayName: Download Built-in Extensions - powershell: | .\scripts\test.bat --tfs "Unit Tests" - displayName: Run Unit Tests + displayName: Run Unit Tests (Electron) +- powershell: | + yarn test-browser --browser chromium + displayName: Run Unit Tests (Browser) - powershell: | .\scripts\test-integration.bat --tfs "Integration Tests" - displayName: Run Integration Tests + displayName: Run Integration Tests (Electron) - task: PublishTestResults@2 displayName: Publish Tests Results inputs: diff --git a/build/azure-pipelines/win32/product-build-win32.yml b/build/azure-pipelines/win32/product-build-win32.yml index 4c9336c6c1c5a..7a8a12aa28047 100644 --- a/build/azure-pipelines/win32/product-build-win32.yml +++ b/build/azure-pipelines/win32/product-build-win32.yml @@ -109,7 +109,14 @@ steps: $ErrorActionPreference = "Stop" exec { yarn electron $(VSCODE_ARCH) } exec { .\scripts\test.bat --build --tfs "Unit Tests" } - displayName: Run unit tests + displayName: Run unit tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- powershell: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + exec { yarn test-browser --build --browser chromium } + displayName: Run unit tests (Browser) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - powershell: | @@ -122,7 +129,24 @@ steps: $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json $AppNameShort = $AppProductJson.nameShort exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" } - displayName: Run integration tests + displayName: Run integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- powershell: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)" + $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json + $AppNameShort = $AppProductJson.nameShort + exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\resources\server\test\test-remote-integration.bat } + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- powershell: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\resources\server\test\test-web-integration.bat --browser firefox } + displayName: Run integration tests (Browser) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 diff --git a/build/azure-pipelines/win32/publish.ps1 b/build/azure-pipelines/win32/publish.ps1 index 5a22d4749cf6c..c9ff9d09ec429 100644 --- a/build/azure-pipelines/win32/publish.ps1 +++ b/build/azure-pipelines/win32/publish.ps1 @@ -11,13 +11,12 @@ $SystemExe = "$Repo\.build\win32-$Arch\system-setup\VSCodeSetup.exe" $UserExe = "$Repo\.build\win32-$Arch\user-setup\VSCodeSetup.exe" $Zip = "$Repo\.build\win32-$Arch\archive\VSCode-win32-$Arch.zip" $LegacyServer = "$Root\vscode-reh-win32-$Arch" -$ServerName = "vscode-server-win32-$Arch" -$Server = "$Root\$ServerName" +$Server = "$Root\vscode-server-win32-$Arch" $ServerZip = "$Repo\.build\vscode-server-win32-$Arch.zip" $Build = "$Root\VSCode-win32-$Arch" # Create server archive -exec { Rename-Item -Path $LegacyServer -NewName $ServerName } +exec { xcopy $LegacyServer $Server /H /E /I } exec { .\node_modules\7zip\7zip-lite\7z.exe a -tzip $ServerZip $Server -r } # get version @@ -31,6 +30,8 @@ exec { node build/azure-pipelines/common/createAsset.js "$AssetPlatform" setup " exec { node build/azure-pipelines/common/createAsset.js "$AssetPlatform-user" setup "VSCodeUserSetup-$Arch-$Version.exe" $UserExe } exec { node build/azure-pipelines/common/createAsset.js "server-$AssetPlatform" archive "vscode-server-win32-$Arch.zip" $ServerZip } +# Skip hockey app because build failure. +# https://github.com/microsoft/vscode/issues/90491 # publish hockeyapp symbols -$hockeyAppId = if ("$Arch" -eq "ia32") { "$env:VSCODE_HOCKEYAPP_ID_WIN32" } else { "$env:VSCODE_HOCKEYAPP_ID_WIN64" } -exec { node build/azure-pipelines/common/symbols.js "$env:VSCODE_MIXIN_PASSWORD" "$env:VSCODE_HOCKEYAPP_TOKEN" "$Arch" $hockeyAppId } +# $hockeyAppId = if ("$Arch" -eq "ia32") { "$env:VSCODE_HOCKEYAPP_ID_WIN32" } else { "$env:VSCODE_HOCKEYAPP_ID_WIN64" } +# exec { node build/azure-pipelines/common/symbols.js "$env:VSCODE_MIXIN_PASSWORD" "$env:VSCODE_HOCKEYAPP_TOKEN" "$Arch" $hockeyAppId } diff --git a/build/azure-pipelines/win32/sign.ps1 b/build/azure-pipelines/win32/sign.ps1 index 00c4d42d9dbff..840cbe4071f8a 100644 --- a/build/azure-pipelines/win32/sign.ps1 +++ b/build/azure-pipelines/win32/sign.ps1 @@ -67,4 +67,4 @@ $Input = Create-TmpJson @{ $Output = [System.IO.Path]::GetTempFileName() $ScriptPath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -& "$ScriptPath\ESRPClient\packages\EsrpClient.1.0.27\tools\ESRPClient.exe" Sign -a $Auth -p $Policy -i $Input -o $Output \ No newline at end of file +& "$ScriptPath\ESRPClient\packages\Microsoft.ESRPClient.1.2.25\tools\ESRPClient.exe" Sign -a $Auth -p $Policy -i $Input -o $Output diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 3c85dd690d5ab..9bd52b930f6ba 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -1,7 +1,7 @@ [ { "name": "ms-vscode.node-debug", - "version": "1.40.1", + "version": "1.43.0", "repo": "https://github.com/Microsoft/vscode-node-debug", "metadata": { "id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6", @@ -16,7 +16,7 @@ }, { "name": "ms-vscode.node-debug2", - "version": "1.39.3", + "version": "1.42.1", "repo": "https://github.com/Microsoft/vscode-node-debug2", "metadata": { "id": "36d19e17-7569-4841-a001-947eb18602b2", @@ -31,7 +31,7 @@ }, { "name": "ms-vscode.references-view", - "version": "0.0.35", + "version": "0.0.47", "repo": "https://github.com/Microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", @@ -43,5 +43,23 @@ }, "publisherDisplayName": "Microsoft" } + }, + { + "name": "ms-vscode.js-debug-nightly", + "version": "2020.2.1417", + "forQualities": [ + "insider" + ], + "repo": "https://github.com/Microsoft/vscode-js-debug", + "metadata": { + "id": "7acbb4ce-c85a-49d4-8d95-a8054406ae97", + "publisherId": { + "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", + "publisherName": "ms-vscode", + "displayName": "Microsoft", + "flags": "verified" + }, + "publisherDisplayName": "Microsoft" + } } ] diff --git a/build/builtin/browser-main.js b/build/builtin/browser-main.js index 60b30655c0cb3..a7618454656d8 100644 --- a/build/builtin/browser-main.js +++ b/build/builtin/browser-main.js @@ -10,6 +10,7 @@ const os = require('os'); const { remote } = require('electron'); const dialog = remote.dialog; +const productJsonPath = path.join(__dirname, '..', '..', 'product.json'); const builtInExtensionsPath = path.join(__dirname, '..', 'builtInExtensions.json'); const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); @@ -51,6 +52,7 @@ function render(el, state) { } const ul = document.createElement('ul'); + const { quality } = readJson(productJsonPath); const { builtin, control } = state; for (const ext of builtin) { @@ -61,6 +63,10 @@ function render(el, state) { const name = document.createElement('code'); name.textContent = ext.name; + if (quality && ext.forQualities && !ext.forQualities.includes(quality)) { + name.textContent += ` (only on ${ext.forQualities.join(', ')})`; + } + li.appendChild(name); const form = document.createElement('form'); @@ -123,4 +129,4 @@ function main() { render(el, { builtin, control }); } -window.onload = main; \ No newline at end of file +window.onload = main; diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index a6358d883ee58..5f112e7ef0680 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -17,14 +17,14 @@ const compilation = require('./lib/compilation'); const monacoapi = require('./monaco/api'); const fs = require('fs'); -var root = path.dirname(__dirname); -var sha1 = util.getVersion(root); -var semver = require('./monaco/package.json').version; -var headerVersion = semver + '(' + sha1 + ')'; +let root = path.dirname(__dirname); +let sha1 = util.getVersion(root); +let semver = require('./monaco/package.json').version; +let headerVersion = semver + '(' + sha1 + ')'; // Build -var editorEntryPoints = [ +let editorEntryPoints = [ { name: 'vs/editor/editor.main', include: [], @@ -40,11 +40,11 @@ var editorEntryPoints = [ } ]; -var editorResources = [ +let editorResources = [ 'out-editor-build/vs/base/browser/ui/codiconLabel/**/*.ttf' ]; -var BUNDLED_FILE_HEADER = [ +let BUNDLED_FILE_HEADER = [ '/*!-----------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', ' * Version: ' + headerVersion, @@ -197,7 +197,7 @@ const compileEditorESMTask = task.define('compile-editor-esm', () => { }); function toExternalDTS(contents) { - let lines = contents.split('\n'); + let lines = contents.split(/\r\n|\r|\n/); let killNextCloseCurlyBrace = false; for (let i = 0; i < lines.length; i++) { let line = lines[i]; @@ -227,8 +227,13 @@ function toExternalDTS(contents) { if (line.indexOf('declare namespace monaco.') === 0) { lines[i] = line.replace('declare namespace monaco.', 'export namespace '); } + + if (line.indexOf('declare let MonacoEnvironment') === 0) { + lines[i] = `declare global {\n let MonacoEnvironment: Environment | undefined;\n}`; + // lines[i] = line.replace('declare namespace monaco.', 'export namespace '); + } } - return lines.join('\n'); + return lines.join('\n').replace(/\n\n\n+/g, '\n\n'); } function filterStream(testFunc) { @@ -263,7 +268,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { // package.json gulp.src('build/monaco/package.json') .pipe(es.through(function (data) { - var json = JSON.parse(data.contents.toString()); + let json = JSON.parse(data.contents.toString()); json.private = false; data.contents = Buffer.from(JSON.stringify(json, null, ' ')); this.emit('data', data); @@ -307,10 +312,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { return; } - var relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); + let relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); - var strContents = data.contents.toString(); - var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); + let strContents = data.contents.toString(); + let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr); data.contents = Buffer.from(strContents); @@ -375,6 +380,13 @@ gulp.task('editor-esm-bundle', ) ); +gulp.task('monacodts', task.define('monacodts', () => { + const result = monacoapi.execute(); + fs.writeFileSync(result.filePath, result.content); + fs.writeFileSync(path.join(root, 'src/vs/editor/common/standalone/standaloneEnums.ts'), result.enums); + return Promise.resolve(true); +})); + //#region monaco type checking function createTscCompileTask(watch) { diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index ca28c413a71ec..25cccf6d8e5b1 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -109,7 +109,8 @@ const tasks = compilations.map(function (tsconfigFile) { const compileTask = task.define(`compile-extension:${name}`, task.series(cleanTask, () => { const pipeline = createPipeline(false, true); - const input = pipeline.tsProjectSrc(); + const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts'])); + const input = es.merge(nonts, pipeline.tsProjectSrc()); return input .pipe(pipeline()) @@ -118,7 +119,8 @@ const tasks = compilations.map(function (tsconfigFile) { const watchTask = task.define(`watch-extension:${name}`, task.series(cleanTask, () => { const pipeline = createPipeline(false); - const input = pipeline.tsProjectSrc(); + const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts'])); + const input = es.merge(nonts, pipeline.tsProjectSrc()); const watchInput = watcher(src, { ...srcOpts, ...{ readDelay: 200 } }); return watchInput @@ -128,7 +130,8 @@ const tasks = compilations.map(function (tsconfigFile) { const compileBuildTask = task.define(`compile-build-extension-${name}`, task.series(cleanTask, () => { const pipeline = createPipeline(true, true); - const input = pipeline.tsProjectSrc(); + const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts'])); + const input = es.merge(nonts, pipeline.tsProjectSrc()); return input .pipe(pipeline()) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index a8bb8898c90fb..ccf965a9dc4fd 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -8,10 +8,8 @@ const gulp = require('gulp'); const filter = require('gulp-filter'); const es = require('event-stream'); -const gulptslint = require('gulp-tslint'); const gulpeslint = require('gulp-eslint'); const tsfmt = require('typescript-formatter'); -const tslint = require('tslint'); const VinylFile = require('vinyl'); const vfs = require('vinyl-fs'); const path = require('path'); @@ -35,6 +33,7 @@ const all = [ 'scripts/**/*', 'src/**/*', 'test/**/*', + '!test/**/out/**', '!**/node_modules/**' ]; @@ -55,7 +54,7 @@ const indentationFilter = [ '!src/vs/base/common/marked/marked.js', '!src/vs/base/node/terminateProcess.sh', '!src/vs/base/node/cpuUsage.sh', - '!test/assert.js', + '!test/unit/assert.js', // except specific folders '!test/automation/out/**', @@ -84,8 +83,8 @@ const indentationFilter = [ '!src/vs/*/**/*.d.ts', '!src/typings/**/*.d.ts', '!extensions/**/*.d.ts', - '!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe,ico,icns}', - '!build/{lib,tslintRules,download}/**/*.js', + '!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe,ico,icns,plist}', + '!build/{lib,download}/**/*.js', '!build/**/*.sh', '!build/azure-pipelines/**/*.js', '!build/azure-pipelines/**/*.config', @@ -128,7 +127,7 @@ const copyrightFilter = [ '!scripts/code-web.js' ]; -const eslintFilter = [ +const jsHygieneFilter = [ 'src/**/*.js', 'build/gulpfile.*.js', '!src/vs/loader.js', @@ -141,7 +140,10 @@ const eslintFilter = [ '!**/test/**' ]; -const tslintBaseFilter = [ +const tsHygieneFilter = [ + 'src/**/*.ts', + 'test/**/*.ts', + 'extensions/**/*.ts', '!**/fixtures/**', '!**/typings/**', '!**/node_modules/**', @@ -152,30 +154,6 @@ const tslintBaseFilter = [ '!extensions/html-language-features/server/lib/jquery.d.ts' ]; -const tslintCoreFilter = [ - 'src/**/*.ts', - 'test/**/*.ts', - '!extensions/**/*.ts', - '!test/automation/**', - '!test/smoke/**', - ...tslintBaseFilter -]; - -const tslintExtensionsFilter = [ - 'extensions/**/*.ts', - '!src/**/*.ts', - '!test/**/*.ts', - 'test/automation/**/*.ts', - ...tslintBaseFilter -]; - -const tslintHygieneFilter = [ - 'src/**/*.ts', - 'test/**/*.ts', - 'extensions/**/*.ts', - ...tslintBaseFilter -]; - const copyrightHeaderLines = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', @@ -185,27 +163,17 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) + .pipe(gulpeslint({ + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'] + })) .pipe(gulpeslint.formatEach('compact')) - .pipe(gulpeslint.failAfterError()); -}); - -gulp.task('tslint', () => { - return es.merge([ - - // Core: include type information (required by certain rules like no-nodejs-globals) - vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(tslintCoreFilter)) - .pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint', program: tslint.Linter.createProgram('src/tsconfig.json') })) - .pipe(gulptslint.default.report({ emitError: true })), - - // Exenstions: do not include type information - vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(tslintExtensionsFilter)) - .pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint' })) - .pipe(gulptslint.default.report({ emitError: true })) - ]).pipe(es.through()); + .pipe(gulpeslint.results(results => { + if (results.warningCount > 0 || results.errorCount > 0) { + throw new Error('eslint failed with warnings and/or errors'); + } + })); }); function checkPackageJSON(actualPath) { @@ -227,7 +195,7 @@ function checkPackageJSON(actualPath) { const checkPackageJSONTask = task.define('check-package-json', () => { return gulp.src('package.json') - .pipe(es.through(function() { + .pipe(es.through(function () { checkPackageJSON.call(this, 'remote/package.json'); checkPackageJSON.call(this, 'remote/web/package.json'); })); @@ -294,8 +262,6 @@ function hygiene(some) { replace: undefined, tsconfig: undefined, tsconfigFile: undefined, - tslint: undefined, - tslintFile: undefined, tsfmtFile: undefined, vscode: undefined, vscodeFile: undefined @@ -304,7 +270,7 @@ function hygiene(some) { let formatted = result.dest.replace(/\r\n/gm, '\n'); if (original !== formatted) { - console.error("File not formatted. Run the 'Format Document' command to fix it:", file.relative); + console.error('File not formatted. Run the \'Format Document\' command to fix it:', file.relative); errorCount++; } cb(null, file); @@ -314,20 +280,15 @@ function hygiene(some) { }); }); - const tslintConfiguration = tslint.Configuration.findConfiguration('tslint.json', '.'); - const tslintOptions = { fix: false, formatter: 'json' }; - const tsLinter = new tslint.Linter(tslintOptions); - - const tsl = es.through(function (file) { - const contents = file.contents.toString('utf8'); - tsLinter.lint(file.relative, contents, tslintConfiguration.results); - this.emit('data', file); - }); - let input; if (Array.isArray(some) || typeof some === 'string' || !some) { - input = vfs.src(some || all, { base: '.', follow: true, allowEmpty: true }); + const options = { base: '.', follow: true, allowEmpty: true }; + if (some) { + input = vfs.src(some, options).pipe(filter(all)); // split this up to not unnecessarily filter all a second time + } else { + input = vfs.src(all, options); + } } else { input = some; } @@ -344,19 +305,21 @@ function hygiene(some) { .pipe(filter(copyrightFilter)) .pipe(copyrights); - let typescript = result - .pipe(filter(tslintHygieneFilter)) + const typescript = result + .pipe(filter(tsHygieneFilter)) .pipe(formatting); - if (!process.argv.some(arg => arg === '--skip-tslint')) { - typescript = typescript.pipe(tsl); - } - const javascript = result - .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) + .pipe(gulpeslint({ + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'] + })) .pipe(gulpeslint.formatEach('compact')) - .pipe(gulpeslint.failAfterError()); + .pipe(gulpeslint.results(results => { + errorCount += results.warningCount; + errorCount += results.errorCount; + })); let count = 0; return es.merge(typescript, javascript) @@ -368,20 +331,6 @@ function hygiene(some) { this.emit('data', data); }, function () { process.stdout.write('\n'); - - const tslintResult = tsLinter.getResult(); - if (tslintResult.failures.length > 0) { - for (const failure of tslintResult.failures) { - const name = failure.getFileName(); - const position = failure.getStartPosition(); - const line = position.getLineAndCharacter().line; - const character = position.getLineAndCharacter().character; - - console.error(`${name}:${line + 1}:${character + 1}:${failure.getFailure()}`); - } - errorCount += tslintResult.failures.length; - } - if (errorCount > 0) { this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.'); } else { diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index a956fba979ef6..f2ea1bd37010b 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -118,7 +118,7 @@ function mixinServer(watch) { const packageJSONPath = path.join(path.dirname(__dirname), 'package.json'); function exec(cmdLine) { console.log(cmdLine); - cp.execSync(cmdLine, { stdio: "inherit" }); + cp.execSync(cmdLine, { stdio: 'inherit' }); } function checkout() { const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString()); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 93a943aba0be0..4906bfdb1a24c 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -81,6 +81,7 @@ const vscodeResources = [ 'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js', 'out-build/vs/code/electron-browser/issue/issueReporter.js', 'out-build/vs/code/electron-browser/processExplorer/processExplorer.js', + 'out-build/vs/platform/auth/common/auth.css', '!**/test/**' ]; @@ -120,9 +121,9 @@ gulp.task(minifyVSCodeTask); * @return {Object} A map of paths to checksums. */ function computeChecksums(out, filenames) { - var result = {}; + let result = {}; filenames.forEach(function (filename) { - var fullPath = path.join(process.cwd(), out, filename); + let fullPath = path.join(process.cwd(), out, filename); result[filename] = computeChecksum(fullPath); }); return result; @@ -135,9 +136,9 @@ function computeChecksums(out, filenames) { * @return {string} The checksum for `filename`. */ function computeChecksum(filename) { - var contents = fs.readFileSync(filename); + let contents = fs.readFileSync(filename); - var hash = crypto + let hash = crypto .createHash('md5') .update(contents) .digest('base64') @@ -427,7 +428,7 @@ gulp.task('vscode-translations-pull', function () { }); gulp.task('vscode-translations-import', function () { - var options = minimist(process.argv.slice(2), { + let options = minimist(process.argv.slice(2), { string: 'location', default: { location: '../vscode-translations-import' diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js index 9d3a7caa07e68..51c7002f5b12c 100644 --- a/build/gulpfile.vscode.linux.js +++ b/build/gulpfile.vscode.linux.js @@ -23,7 +23,7 @@ const commit = util.getVersion(root); const linuxPackageRevision = Math.floor(new Date().getTime() / 1000); function getDebPackageArch(arch) { - return { x64: 'amd64', arm: 'armhf', arm64: "arm64" }[arch]; + return { x64: 'amd64', arm: 'armhf', arm64: 'arm64' }[arch]; } function prepareDebPackage(arch) { @@ -117,7 +117,7 @@ function getRpmBuildPath(rpmArch) { } function getRpmPackageArch(arch) { - return { x64: 'x86_64', arm: 'armhf', arm64: "arm64" }[arch]; + return { x64: 'x86_64', arm: 'armhf', arm64: 'arm64' }[arch]; } function prepareRpmPackage(arch) { diff --git a/build/lib/compilation.js b/build/lib/compilation.js index 59bf1a250f61f..96ef00c0657a2 100644 --- a/build/lib/compilation.js +++ b/build/lib/compilation.js @@ -74,6 +74,7 @@ function compileTask(src, out, build) { if (src === 'src') { generator.execute(); } + generateGitHubAuthConfig(); return srcPipe .pipe(generator.stream) .pipe(compile()) @@ -96,6 +97,17 @@ function watchTask(out, build) { } exports.watchTask = watchTask; const REPO_SRC_FOLDER = path.join(__dirname, '../../src'); +function generateGitHubAuthConfig() { + const schemes = ['OSS', 'INSIDERS']; + let content = {}; + schemes.forEach(scheme => { + content[scheme] = { + id: process.env[`${scheme}_GITHUB_ID`], + secret: process.env[`${scheme}_GITHUB_SECRET`] + }; + }); + fs.writeFileSync(path.join(__dirname, '../../extensions/github-authentication/src/common/config.json'), JSON.stringify(content)); +} class MonacoGenerator { constructor(isWatch) { this._executeSoonTimer = null; diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts index 578fae31a19c4..0d225d899722a 100644 --- a/build/lib/compilation.ts +++ b/build/lib/compilation.ts @@ -88,6 +88,8 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod generator.execute(); } + generateGitHubAuthConfig(); + return srcPipe .pipe(generator.stream) .pipe(compile()) @@ -115,6 +117,19 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt const REPO_SRC_FOLDER = path.join(__dirname, '../../src'); +function generateGitHubAuthConfig() { + const schemes = ['OSS', 'INSIDERS']; + let content: { [key: string]: { id?: string, secret?: string }} = {}; + schemes.forEach(scheme => { + content[scheme] = { + id: process.env[`${scheme}_GITHUB_ID`], + secret: process.env[`${scheme}_GITHUB_SECRET`] + }; + }); + + fs.writeFileSync(path.join(__dirname, '../../extensions/github-authentication/src/common/config.json'), JSON.stringify(content)); +} + class MonacoGenerator { private readonly _isWatch: boolean; public readonly stream: NodeJS.ReadWriteStream; diff --git a/build/lib/electron.js b/build/lib/electron.js index c7c4cd9a69339..b38a1f6edc90d 100644 --- a/build/lib/electron.js +++ b/build/lib/electron.js @@ -53,7 +53,7 @@ exports.config = { darwinBundleDocumentType(["asp", "aspx", "cshtml", "htm", "html", "jshtm", "jsp", "phtml", "shtml"], 'resources/darwin/html.icns'), darwinBundleDocumentType(["jade"], 'resources/darwin/jade.icns'), darwinBundleDocumentType(["jav", "java"], 'resources/darwin/java.icns'), - darwinBundleDocumentType(["js", "jscsrc", "jshintrc", "mjs"], 'resources/darwin/javascript.icns'), + darwinBundleDocumentType(["js", "jscsrc", "jshintrc", "mjs", "cjs"], 'resources/darwin/javascript.icns'), darwinBundleDocumentType(["json"], 'resources/darwin/json.icns'), darwinBundleDocumentType(["less"], 'resources/darwin/less.icns'), darwinBundleDocumentType(["markdown", "md", "mdoc", "mdown", "mdtext", "mdtxt", "mdwn", "mkd", "mkdn"], 'resources/darwin/markdown.icns'), diff --git a/build/lib/electron.ts b/build/lib/electron.ts index 90a25f4cac8d9..86c7afcf31218 100644 --- a/build/lib/electron.ts +++ b/build/lib/electron.ts @@ -59,7 +59,7 @@ export const config = { darwinBundleDocumentType(["asp", "aspx", "cshtml", "htm", "html", "jshtm", "jsp", "phtml", "shtml"], 'resources/darwin/html.icns'), darwinBundleDocumentType(["jade"], 'resources/darwin/jade.icns'), darwinBundleDocumentType(["jav", "java"], 'resources/darwin/java.icns'), - darwinBundleDocumentType(["js", "jscsrc", "jshintrc", "mjs"], 'resources/darwin/javascript.icns'), + darwinBundleDocumentType(["js", "jscsrc", "jshintrc", "mjs", "cjs"], 'resources/darwin/javascript.icns'), darwinBundleDocumentType(["json"], 'resources/darwin/json.icns'), darwinBundleDocumentType(["less"], 'resources/darwin/less.icns'), darwinBundleDocumentType(["markdown", "md", "mdoc", "mdown", "mdtext", "mdtxt", "mdwn", "mkd", "mkdn"], 'resources/darwin/markdown.icns'), diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js new file mode 100644 index 0000000000000..0d508d1d00e37 --- /dev/null +++ b/build/lib/eslint/code-import-patterns.js @@ -0,0 +1,59 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const minimatch = require("minimatch"); +const utils_1 = require("./utils"); +module.exports = new class { + constructor() { + this.meta = { + messages: { + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + } + create(context) { + const configs = context.options; + for (const config of configs) { + if (minimatch(context.getFilename(), config.target)) { + return utils_1.createImportRuleListener((node, value) => this._checkImport(context, config, node, value)); + } + } + return {}; + } + _checkImport(context, config, node, path) { + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + let restrictions; + if (typeof config.restrictions === 'string') { + restrictions = [config.restrictions]; + } + else { + restrictions = config.restrictions; + } + let matched = false; + for (const pattern of restrictions) { + if (minimatch(path, pattern)) { + matched = true; + break; + } + } + if (!matched) { + // None of the restrictions matched + context.report({ + loc: node.loc, + messageId: 'badImport', + data: { + restrictions: restrictions.join(' or ') + } + }); + } + } +}; diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts new file mode 100644 index 0000000000000..c3daadbf59a0d --- /dev/null +++ b/build/lib/eslint/code-import-patterns.ts @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { join } from 'path'; +import * as minimatch from 'minimatch'; +import { createImportRuleListener } from './utils'; + +interface ImportPatternsConfig { + target: string; + restrictions: string | string[]; +} + +export = new class implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const configs = context.options; + + for (const config of configs) { + if (minimatch(context.getFilename(), config.target)) { + return createImportRuleListener((node, value) => this._checkImport(context, config, node, value)); + } + } + + return {}; + } + + private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, path: string) { + + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + let restrictions: string[]; + if (typeof config.restrictions === 'string') { + restrictions = [config.restrictions]; + } else { + restrictions = config.restrictions; + } + + let matched = false; + for (const pattern of restrictions) { + if (minimatch(path, pattern)) { + matched = true; + break; + } + } + + if (!matched) { + // None of the restrictions matched + context.report({ + loc: node.loc, + messageId: 'badImport', + data: { + restrictions: restrictions.join(' or ') + } + }); + } + } +}; + diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js new file mode 100644 index 0000000000000..db591f789c72c --- /dev/null +++ b/build/lib/eslint/code-layering.js @@ -0,0 +1,68 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class { + constructor() { + this.meta = { + messages: { + layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + } + create(context) { + const fileDirname = path_1.dirname(context.getFilename()); + const parts = fileDirname.split(/\\|\//); + const ruleArgs = context.options[0]; + let config; + for (let i = parts.length - 1; i >= 0; i--) { + if (ruleArgs[parts[i]]) { + config = { + allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), + disallowed: new Set() + }; + Object.keys(ruleArgs).forEach(key => { + if (!config.allowed.has(key)) { + config.disallowed.add(key); + } + }); + break; + } + } + if (!config) { + // nothing + return {}; + } + return utils_1.createImportRuleListener((node, path) => { + if (path[0] === '.') { + path = path_1.join(path_1.dirname(context.getFilename()), path); + } + const parts = path_1.dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + if (config.allowed.has(part)) { + // GOOD - same layer + break; + } + if (config.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + loc: node.loc, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config.allowed.keys()].join(', ') + } + }); + break; + } + } + }); + } +}; diff --git a/build/lib/eslint/code-layering.ts b/build/lib/eslint/code-layering.ts new file mode 100644 index 0000000000000..cca72eeec71e4 --- /dev/null +++ b/build/lib/eslint/code-layering.ts @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { join, dirname } from 'path'; +import { createImportRuleListener } from './utils'; + +type Config = { + allowed: Set; + disallowed: Set; +}; + +export = new class implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const fileDirname = dirname(context.getFilename()); + const parts = fileDirname.split(/\\|\//); + const ruleArgs = >context.options[0]; + + let config: Config | undefined; + for (let i = parts.length - 1; i >= 0; i--) { + if (ruleArgs[parts[i]]) { + config = { + allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), + disallowed: new Set() + }; + Object.keys(ruleArgs).forEach(key => { + if (!config!.allowed.has(key)) { + config!.disallowed.add(key); + } + }); + break; + } + } + + if (!config) { + // nothing + return {}; + } + + return createImportRuleListener((node, path) => { + if (path[0] === '.') { + path = join(dirname(context.getFilename()), path); + } + + const parts = dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + + if (config!.allowed.has(part)) { + // GOOD - same layer + break; + } + + if (config!.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + loc: node.loc, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config!.allowed.keys()].join(', ') + } + }); + break; + } + } + }); + } +}; + diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js new file mode 100644 index 0000000000000..d8955507bedc9 --- /dev/null +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -0,0 +1,38 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + messages: { + noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' + } + }; + } + create(context) { + const fileName = context.getFilename(); + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) { + return utils_1.createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + if (/vs(\/|\\)nls/.test(path)) { + context.report({ + loc: node.loc, + messageId: 'noNls' + }); + } + }); + } + return {}; + } +}; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts new file mode 100644 index 0000000000000..90c80dee70c9d --- /dev/null +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.ts @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { join } from 'path'; +import { createImportRuleListener } from './utils'; + +export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const fileName = context.getFilename(); + if ( + /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName) + ) { + return createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + if ( + /vs(\/|\\)nls/.test(path) + ) { + context.report({ + loc: node.loc, + messageId: 'noNls' + }); + } + }); + } + + return {}; + } +}; + diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js new file mode 100644 index 0000000000000..d9d6bb55b872f --- /dev/null +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -0,0 +1,41 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + messages: { + badImport: 'Not allowed to import standalone editor modules.' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + } + create(context) { + if (/vs(\/|\\)editor/.test(context.getFilename())) { + // the vs/editor folder is allowed to use the standalone editor + return {}; + } + return utils_1.createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { + context.report({ + loc: node.loc, + messageId: 'badImport' + }); + } + }); + } +}; diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts new file mode 100644 index 0000000000000..898886d17d203 --- /dev/null +++ b/build/lib/eslint/code-no-standalone-editor.ts @@ -0,0 +1,50 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { join } from 'path'; +import { createImportRuleListener } from './utils'; + +export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + badImport: 'Not allowed to import standalone editor modules.' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + if (/vs(\/|\\)editor/.test(context.getFilename())) { + // the vs/editor folder is allowed to use the standalone editor + return {}; + } + + return createImportRuleListener((node, path) => { + + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + if ( + /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) + ) { + context.report({ + loc: node.loc, + messageId: 'badImport' + }); + } + }); + } +}; + diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js new file mode 100644 index 0000000000000..28fce5b9a182b --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -0,0 +1,111 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +function isStringLiteral(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} +function isDoubleQuoted(node) { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; +} +module.exports = new (_a = class NoUnexternalizedStrings { + constructor() { + this.meta = { + messages: { + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' + } + }; + } + create(context) { + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + function collectDoubleQuotedStrings(node) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + } + function visitLocalizeCall(node) { + // localize(key, message) + const [keyNode, messageNode] = node.arguments; + // (1) + // extract key so that it can be checked later + let key; + if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider + key = keyNode.value; + } + else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider + key = property.value.value; + break; + } + } + } + } + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + } + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + for (const [key, values] of externalizedStringLiterals) { + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } + } + } + return { + ['Literal']: (node) => collectDoubleQuotedStrings(node), + ['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node), + ['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, + }; + } + }, + _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, + _a); diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts new file mode 100644 index 0000000000000..29db884cd9f31 --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -0,0 +1,126 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; + +function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral { + return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} + +function isDoubleQuoted(node: TSESTree.StringLiteral): boolean { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; +} + +export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { + + private static _rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + + function collectDoubleQuotedStrings(node: TSESTree.Literal) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + } + + function visitLocalizeCall(node: TSESTree.CallExpression) { + + // localize(key, message) + const [keyNode, messageNode] = (node).arguments; + + // (1) + // extract key so that it can be checked later + let key: string | undefined; + if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider + key = keyNode.value; + + } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider + key = property.value.value; + break; + } + } + } + } + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } + + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + } + + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + + for (const [key, values] of externalizedStringLiterals) { + + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } + } + } + + return { + ['Literal']: (node: any) => collectDoubleQuotedStrings(node), + ['ExpressionStatement[directive] Literal:exit']: (node: any) => doubleQuotedStringLiterals.delete(node), + ['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, + }; + } +}; + diff --git a/build/lib/eslint/code-no-unused-expressions.js b/build/lib/eslint/code-no-unused-expressions.js new file mode 100644 index 0000000000000..c7b175513117c --- /dev/null +++ b/build/lib/eslint/code-no-unused-expressions.js @@ -0,0 +1,145 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// FORKED FROM https://github.com/eslint/eslint/blob/b23ad0d789a909baf8d7c41a35bc53df932eaf30/lib/rules/no-unused-expressions.js +// and added support for `OptionalCallExpression`, see https://github.com/facebook/create-react-app/issues/8107 and https://github.com/eslint/eslint/issues/12642 + +/** + * @fileoverview Flag expressions in statement position that do not side effect + * @author Michael Ficarra + */ + +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: 'suggestion', + + docs: { + description: 'disallow unused expressions', + category: 'Best Practices', + recommended: false, + url: 'https://eslint.org/docs/rules/no-unused-expressions' + }, + + schema: [ + { + type: 'object', + properties: { + allowShortCircuit: { + type: 'boolean', + default: false + }, + allowTernary: { + type: 'boolean', + default: false + }, + allowTaggedTemplates: { + type: 'boolean', + default: false + } + }, + additionalProperties: false + } + ] + }, + + create(context) { + const config = context.options[0] || {}, + allowShortCircuit = config.allowShortCircuit || false, + allowTernary = config.allowTernary || false, + allowTaggedTemplates = config.allowTaggedTemplates || false; + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node any node + * @returns {boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === 'ExpressionStatement' && + node.expression.type === 'Literal' && typeof node.expression.value === 'string'; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {Function} predicate ([a] -> Boolean) the function used to make the determination + * @param {a[]} list the input list + * @returns {a[]} the leading sequence of members in the given list that pass the given predicate + */ + function takeWhile(predicate, list) { + for (let i = 0; i < list.length; ++i) { + if (!predicate(list[i])) { + return list.slice(0, i); + } + } + return list.slice(); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node a Program or BlockStatement node + * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body + */ + function directives(node) { + return takeWhile(looksLikeDirective, node.body); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node any node + * @param {ASTNode[]} ancestors the given node's ancestors + * @returns {boolean} whether the given node is considered a directive in its current position + */ + function isDirective(node, ancestors) { + const parent = ancestors[ancestors.length - 1], + grandparent = ancestors[ancestors.length - 2]; + + return (parent.type === 'Program' || parent.type === 'BlockStatement' && + (/Function/u.test(grandparent.type))) && + directives(parent).indexOf(node) >= 0; + } + + /** + * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. + * @param {ASTNode} node any node + * @returns {boolean} whether the given node is a valid expression + */ + function isValidExpression(node) { + if (allowTernary) { + + // Recursive check for ternary and logical expressions + if (node.type === 'ConditionalExpression') { + return isValidExpression(node.consequent) && isValidExpression(node.alternate); + } + } + + if (allowShortCircuit) { + if (node.type === 'LogicalExpression') { + return isValidExpression(node.right); + } + } + + if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') { + return true; + } + + return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await)Expression$/u.test(node.type) || + (node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0); + } + + return { + ExpressionStatement(node) { + if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) { + context.report({ node, message: 'Expected an assignment or function call and instead saw an expression.' }); + } + } + }; + + } +}; diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js new file mode 100644 index 0000000000000..a276e7c0028aa --- /dev/null +++ b/build/lib/eslint/code-translation-remind.js @@ -0,0 +1,57 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const fs_1 = require("fs"); +const utils_1 = require("./utils"); +module.exports = new (_a = class TranslationRemind { + constructor() { + this.meta = { + messages: { + missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' + } + }; + } + create(context) { + return utils_1.createImportRuleListener((node, path) => this._checkImport(context, node, path)); + } + _checkImport(context, node, path) { + if (path !== TranslationRemind.NLS_MODULE) { + return; + } + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + const resource = matchService ? matchService[0] : matchPart[0]; + let resourceDefined = false; + let json; + try { + json = fs_1.readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } + catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + workbenchResources.forEach((existingResource) => { + if (existingResource.name === resource) { + resourceDefined = true; + return; + } + }); + if (!resourceDefined) { + context.report({ + loc: node.loc, + messageId: 'missing', + data: { resource } + }); + } + } + }, + _a.NLS_MODULE = 'vs/nls', + _a); diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts new file mode 100644 index 0000000000000..1ce01107a72a5 --- /dev/null +++ b/build/lib/eslint/code-translation-remind.ts @@ -0,0 +1,67 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { readFileSync } from 'fs'; +import { createImportRuleListener } from './utils'; + + +export = new class TranslationRemind implements eslint.Rule.RuleModule { + + private static NLS_MODULE = 'vs/nls'; + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + return createImportRuleListener((node, path) => this._checkImport(context, node, path)); + } + + private _checkImport(context: eslint.Rule.RuleContext, node: TSESTree.Node, path: string) { + + if (path !== TranslationRemind.NLS_MODULE) { + return; + } + + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + + const resource = matchService ? matchService[0] : matchPart![0]; + let resourceDefined = false; + + let json; + try { + json = readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + + workbenchResources.forEach((existingResource: any) => { + if (existingResource.name === resource) { + resourceDefined = true; + return; + } + }); + + if (!resourceDefined) { + context.report({ + loc: node.loc, + messageId: 'missing', + data: { resource } + }); + } + } +}; + diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js new file mode 100644 index 0000000000000..ec59aef3b7d3c --- /dev/null +++ b/build/lib/eslint/utils.js @@ -0,0 +1,36 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +function createImportRuleListener(validateImport) { + function _checkImport(node) { + if (node && node.type === 'Literal' && typeof node.value === 'string') { + validateImport(node, node.value); + } + } + return { + // import ??? from 'module' + ImportDeclaration: (node) => { + _checkImport(node.source); + }, + // import('module').then(...) OR await import('module') + ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => { + _checkImport(node); + }, + // import foo = ... + ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => { + _checkImport(node); + }, + // export ?? from 'module' + ExportAllDeclaration: (node) => { + _checkImport(node.source); + }, + // export {foo} from 'module' + ExportNamedDeclaration: (node) => { + _checkImport(node.source); + }, + }; +} +exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint/utils.ts new file mode 100644 index 0000000000000..428832e9cf97a --- /dev/null +++ b/build/lib/eslint/utils.ts @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; + +export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener { + + function _checkImport(node: TSESTree.Node | null) { + if (node && node.type === 'Literal' && typeof node.value === 'string') { + validateImport(node, node.value); + } + } + + return { + // import ??? from 'module' + ImportDeclaration: (node: any) => { + _checkImport((node).source); + }, + // import('module').then(...) OR await import('module') + ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node: any) => { + _checkImport(node); + }, + // import foo = ... + ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node: any) => { + _checkImport(node); + }, + // export ?? from 'module' + ExportAllDeclaration: (node: any) => { + _checkImport((node).source); + }, + // export {foo} from 'module' + ExportNamedDeclaration: (node: any) => { + _checkImport((node).source); + }, + + }; +} diff --git a/build/lib/eslint/vscode-dts-create-func.js b/build/lib/eslint/vscode-dts-create-func.js new file mode 100644 index 0000000000000..5a27bf51c80f8 --- /dev/null +++ b/build/lib/eslint/vscode-dts-create-func.js @@ -0,0 +1,35 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +module.exports = new class ApiLiteralOrTypes { + constructor() { + this.meta = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' }, + messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', } + }; + } + create(context) { + return { + ['TSDeclareFunction Identifier[name=/create.*/]']: (node) => { + var _a; + const decl = node.parent; + if (((_a = decl.returnType) === null || _a === void 0 ? void 0 : _a.typeAnnotation.type) !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) { + return; + } + if (decl.returnType.typeAnnotation.typeName.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) { + return; + } + const ident = decl.returnType.typeAnnotation.typeName.name; + if (ident === 'Promise' || ident === 'Thenable') { + context.report({ + node, + messageId: 'sync' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint/vscode-dts-create-func.ts b/build/lib/eslint/vscode-dts-create-func.ts new file mode 100644 index 0000000000000..295d099da7ce4 --- /dev/null +++ b/build/lib/eslint/vscode-dts-create-func.ts @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; + +export = new class ApiLiteralOrTypes implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' }, + messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + return { + ['TSDeclareFunction Identifier[name=/create.*/]']: (node: any) => { + + const decl = (node).parent; + + if (decl.returnType?.typeAnnotation.type !== AST_NODE_TYPES.TSTypeReference) { + return; + } + if (decl.returnType.typeAnnotation.typeName.type !== AST_NODE_TYPES.Identifier) { + return; + } + + const ident = decl.returnType.typeAnnotation.typeName.name; + if (ident === 'Promise' || ident === 'Thenable') { + context.report({ + node, + messageId: 'sync' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint/vscode-dts-event-naming.js b/build/lib/eslint/vscode-dts-event-naming.js new file mode 100644 index 0000000000000..c93c181830531 --- /dev/null +++ b/build/lib/eslint/vscode-dts-event-naming.js @@ -0,0 +1,81 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +module.exports = new (_a = class ApiEventNaming { + constructor() { + this.meta = { + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#event-naming' + }, + messages: { + naming: 'Event names must follow this patten: `on[Did|Will]`', + verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration', + subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API', + unknown: 'UNKNOWN event declaration, lint-rule needs tweaking' + } + }; + } + create(context) { + const config = context.options[0]; + const allowed = new Set(config.allowed); + const verbs = new Set(config.verbs); + return { + ['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node) => { + var _a, _b; + const def = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent; + let ident; + if ((def === null || def === void 0 ? void 0 : def.type) === experimental_utils_1.AST_NODE_TYPES.Identifier) { + ident = def; + } + else if (((def === null || def === void 0 ? void 0 : def.type) === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || (def === null || def === void 0 ? void 0 : def.type) === experimental_utils_1.AST_NODE_TYPES.ClassProperty) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { + ident = def.key; + } + if (!ident) { + // event on unknown structure... + return context.report({ + node, + message: 'unknown' + }); + } + if (allowed.has(ident.name)) { + // configured exception + return; + } + const match = ApiEventNaming._nameRegExp.exec(ident.name); + if (!match) { + context.report({ + node: ident, + messageId: 'naming' + }); + return; + } + // check that is spelled out (configured) as verb + if (!verbs.has(match[2].toLowerCase())) { + context.report({ + node: ident, + messageId: 'verb', + data: { verb: match[2] } + }); + } + // check that a subject (if present) has occurred + if (match[3]) { + const regex = new RegExp(match[3], 'ig'); + const parts = context.getSourceCode().getText().split(regex); + if (parts.length < 3) { + context.report({ + node: ident, + messageId: 'subject', + data: { subject: match[3] } + }); + } + } + } + }; + } + }, + _a._nameRegExp = /on(Did|Will)([A-Z][a-z]+)([A-Z][a-z]+)?/, + _a); diff --git a/build/lib/eslint/vscode-dts-event-naming.ts b/build/lib/eslint/vscode-dts-event-naming.ts new file mode 100644 index 0000000000000..6543c4586bc6a --- /dev/null +++ b/build/lib/eslint/vscode-dts-event-naming.ts @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; + +export = new class ApiEventNaming implements eslint.Rule.RuleModule { + + private static _nameRegExp = /on(Did|Will)([A-Z][a-z]+)([A-Z][a-z]+)?/; + + readonly meta: eslint.Rule.RuleMetaData = { + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#event-naming' + }, + messages: { + naming: 'Event names must follow this patten: `on[Did|Will]`', + verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration', + subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API', + unknown: 'UNKNOWN event declaration, lint-rule needs tweaking' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const config = <{ allowed: string[], verbs: string[] }>context.options[0]; + const allowed = new Set(config.allowed); + const verbs = new Set(config.verbs); + + return { + ['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node: any) => { + + const def = (node).parent?.parent?.parent; + let ident: TSESTree.Identifier | undefined; + + if (def?.type === AST_NODE_TYPES.Identifier) { + ident = def; + + } else if ((def?.type === AST_NODE_TYPES.TSPropertySignature || def?.type === AST_NODE_TYPES.ClassProperty) && def.key.type === AST_NODE_TYPES.Identifier) { + ident = def.key; + } + + if (!ident) { + // event on unknown structure... + return context.report({ + node, + message: 'unknown' + }); + } + + if (allowed.has(ident.name)) { + // configured exception + return; + } + + const match = ApiEventNaming._nameRegExp.exec(ident.name); + if (!match) { + context.report({ + node: ident, + messageId: 'naming' + }); + return; + } + + // check that is spelled out (configured) as verb + if (!verbs.has(match[2].toLowerCase())) { + context.report({ + node: ident, + messageId: 'verb', + data: { verb: match[2] } + }); + } + + // check that a subject (if present) has occurred + if (match[3]) { + const regex = new RegExp(match[3], 'ig'); + const parts = context.getSourceCode().getText().split(regex); + if (parts.length < 3) { + context.report({ + node: ident, + messageId: 'subject', + data: { subject: match[3] } + }); + } + } + } + }; + } +}; + diff --git a/build/lib/eslint/vscode-dts-interface-naming.js b/build/lib/eslint/vscode-dts-interface-naming.js new file mode 100644 index 0000000000000..70ca810825ba0 --- /dev/null +++ b/build/lib/eslint/vscode-dts-interface-naming.js @@ -0,0 +1,30 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +module.exports = new (_a = class ApiInterfaceNaming { + constructor() { + this.meta = { + messages: { + naming: 'Interfaces must not be prefixed with uppercase `I`', + } + }; + } + create(context) { + return { + ['TSInterfaceDeclaration Identifier']: (node) => { + const name = node.name; + if (ApiInterfaceNaming._nameRegExp.test(name)) { + context.report({ + node, + messageId: 'naming' + }); + } + } + }; + } + }, + _a._nameRegExp = /I[A-Z]/, + _a); diff --git a/build/lib/eslint/vscode-dts-interface-naming.ts b/build/lib/eslint/vscode-dts-interface-naming.ts new file mode 100644 index 0000000000000..d9ec4e8c34cbe --- /dev/null +++ b/build/lib/eslint/vscode-dts-interface-naming.ts @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; + +export = new class ApiInterfaceNaming implements eslint.Rule.RuleModule { + + private static _nameRegExp = /I[A-Z]/; + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + naming: 'Interfaces must not be prefixed with uppercase `I`', + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + return { + ['TSInterfaceDeclaration Identifier']: (node: any) => { + + const name = (node).name; + if (ApiInterfaceNaming._nameRegExp.test(name)) { + context.report({ + node, + messageId: 'naming' + }); + } + } + }; + } +}; + diff --git a/build/lib/eslint/vscode-dts-literal-or-types.js b/build/lib/eslint/vscode-dts-literal-or-types.js new file mode 100644 index 0000000000000..02e6de876ba9c --- /dev/null +++ b/build/lib/eslint/vscode-dts-literal-or-types.js @@ -0,0 +1,23 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiLiteralOrTypes { + constructor() { + this.meta = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' }, + messages: { useEnum: 'Use enums, not literal-or-types', } + }; + } + create(context) { + return { + ['TSTypeAnnotation TSUnionType TSLiteralType']: (node) => { + context.report({ + node: node, + messageId: 'useEnum' + }); + } + }; + } +}; diff --git a/build/lib/eslint/vscode-dts-literal-or-types.ts b/build/lib/eslint/vscode-dts-literal-or-types.ts new file mode 100644 index 0000000000000..01a3eb2152367 --- /dev/null +++ b/build/lib/eslint/vscode-dts-literal-or-types.ts @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; + +export = new class ApiLiteralOrTypes implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' }, + messages: { useEnum: 'Use enums, not literal-or-types', } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + return { + ['TSTypeAnnotation TSUnionType TSLiteralType']: (node: any) => { + context.report({ + node: node, + messageId: 'useEnum' + }); + } + }; + } +}; diff --git a/build/lib/extensions.js b/build/lib/extensions.js index c4385655eb929..e45b0d4e35a49 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -27,6 +27,7 @@ const util = require('./util'); const root = path.dirname(path.dirname(__dirname)); const commit = util.getVersion(root); const sourceMappingURLBase = `https://ticino.blob.core.windows.net/sourcemaps/${commit}`; +const product = require('../../product.json'); function fromLocal(extensionPath) { const webpackFilename = path.join(extensionPath, 'extension.webpack.config.js'); const input = fs.existsSync(webpackFilename) @@ -184,8 +185,10 @@ const excludedExtensions = [ 'vscode-test-resolver', 'ms-vscode.node-debug', 'ms-vscode.node-debug2', + 'ms.vscode.js-debug-nightly' ]; -const builtInExtensions = require('../builtInExtensions.json'); +const builtInExtensions = require('../builtInExtensions.json') + .filter(({ forQualities }) => { var _a; return !product.quality || ((_a = forQualities === null || forQualities === void 0 ? void 0 : forQualities.includes) === null || _a === void 0 ? void 0 : _a.call(forQualities, product.quality)) !== false; }); function packageLocalExtensionsStream() { const localExtensionDescriptions = glob.sync('extensions/*/package.json') .map(manifestPath => { diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index 05bc70948468f..9c90cb60c47e2 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -27,6 +27,7 @@ const util = require('./util'); const root = path.dirname(path.dirname(__dirname)); const commit = util.getVersion(root); const sourceMappingURLBase = `https://ticino.blob.core.windows.net/sourcemaps/${commit}`; +const product = require('../../product.json'); function fromLocal(extensionPath: string): Stream { const webpackFilename = path.join(extensionPath, 'extension.webpack.config.js'); @@ -219,16 +220,19 @@ const excludedExtensions = [ 'vscode-test-resolver', 'ms-vscode.node-debug', 'ms-vscode.node-debug2', + 'ms.vscode.js-debug-nightly' ]; interface IBuiltInExtension { name: string; version: string; repo: string; + forQualities?: ReadonlyArray; metadata: any; } -const builtInExtensions: IBuiltInExtension[] = require('../builtInExtensions.json'); +const builtInExtensions = (require('../builtInExtensions.json')) + .filter(({ forQualities }) => !product.quality || forQualities?.includes?.(product.quality) !== false); export function packageLocalExtensionsStream(): NodeJS.ReadWriteStream { const localExtensionDescriptions = (glob.sync('extensions/*/package.json')) diff --git a/build/lib/i18n.resources.json b/build/lib/i18n.resources.json index 6a3f89dc4717a..ae71fd3bf63d2 100644 --- a/build/lib/i18n.resources.json +++ b/build/lib/i18n.resources.json @@ -30,6 +30,14 @@ "name": "vs/workbench/api/common", "project": "vscode-workbench" }, + { + "name": "vs/workbench/contrib/backup", + "project": "vscode-workbench" + }, + { + "name": "vs/workbench/contrib/bulkEdit", + "project": "vscode-workbench" + }, { "name": "vs/workbench/contrib/cli", "project": "vscode-workbench" @@ -51,15 +59,15 @@ "project": "vscode-workbench" }, { - "name": "vs/workbench/contrib/testCustomEditors", + "name": "vs/workbench/contrib/debug", "project": "vscode-workbench" }, { - "name": "vs/workbench/contrib/debug", + "name": "vs/workbench/contrib/emmet", "project": "vscode-workbench" }, { - "name": "vs/workbench/contrib/emmet", + "name": "vs/workbench/contrib/experiments", "project": "vscode-workbench" }, { @@ -102,6 +110,10 @@ "name": "vs/workbench/contrib/output", "project": "vscode-workbench" }, + { + "name": "vs/workbench/contrib/openInDesktop", + "project": "vscode-workbench" + }, { "name": "vs/workbench/contrib/performance", "project": "vscode-workbench" @@ -134,6 +146,10 @@ "name": "vs/workbench/contrib/search", "project": "vscode-workbench" }, + { + "name": "vs/workbench/contrib/searchEditor", + "project": "vscode-workbench" + }, { "name": "vs/workbench/contrib/snippets", "project": "vscode-workbench" @@ -270,6 +286,10 @@ "name": "vs/workbench/services/remote", "project": "vscode-workbench" }, + { + "name": "vs/workbench/services/search", + "project": "vscode-workbench" + }, { "name": "vs/workbench/services/textfile", "project": "vscode-workbench" @@ -282,6 +302,10 @@ "name": "vs/workbench/services/textMate", "project": "vscode-workbench" }, + { + "name": "vs/workbench/services/workingCopy", + "project": "vscode-workbench" + }, { "name": "vs/workbench/services/workspaces", "project": "vscode-workbench" @@ -305,6 +329,14 @@ { "name": "vs/workbench/services/userData", "project": "vscode-workbench" + }, + { + "name": "vs/workbench/services/userDataSync", + "project": "vscode-workbench" + }, + { + "name": "vs/workbench/contrib/timeline", + "project": "vscode-workbench" } ] } diff --git a/build/lib/layersChecker.js b/build/lib/layersChecker.js new file mode 100644 index 0000000000000..663769dacea67 --- /dev/null +++ b/build/lib/layersChecker.js @@ -0,0 +1,218 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +const fs_1 = require("fs"); +const path_1 = require("path"); +const minimatch_1 = require("minimatch"); +// +// ############################################################################################# +// +// A custom typescript checker for the specific task of detecting the use of certain types in a +// layer that does not allow such use. For example: +// - using DOM globals in common/node/electron-main layer (e.g. HTMLElement) +// - using node.js globals in common/browser layer (e.g. process) +// +// Make changes to below RULES to lift certain files from these checks only if absolutely needed +// +// ############################################################################################# +// +// Types we assume are present in all implementations of JS VMs (node.js, browsers) +// Feel free to add more core types as you see needed if present in node.js and browsers +const CORE_TYPES = [ + 'require', + 'atob', + 'btoa', + 'setTimeout', + 'clearTimeout', + 'setInterval', + 'clearInterval', + 'console', + 'log', + 'info', + 'warn', + 'error', + 'group', + 'groupEnd', + 'table', + 'assert', + 'Error', + 'String', + 'throws', + 'stack', + 'captureStackTrace', + 'stackTraceLimit', + 'TextDecoder', + 'TextEncoder', + 'encode', + 'decode', + 'self', + 'trimLeft', + 'trimRight' +]; +const RULES = [ + // Tests: skip + { + target: '**/vs/**/test/**', + skip: true // -> skip all test files + }, + // Common: vs/base/common/platform.ts + { + target: '**/vs/base/common/platform.ts', + allowedTypes: [ + ...CORE_TYPES, + // Safe access to postMessage() and friends + 'MessageEvent', + 'data' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts', + '@types/node' // no node.js + ] + }, + // Common: vs/workbench/api/common/extHostExtensionService.ts + { + target: '**/vs/workbench/api/common/extHostExtensionService.ts', + allowedTypes: [ + ...CORE_TYPES, + // Safe access to global + 'global' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts', + '@types/node' // no node.js + ] + }, + // Common + { + target: '**/vs/**/common/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + 'lib.dom.d.ts', + '@types/node' // no node.js + ] + }, + // Browser + { + target: '**/vs/**/browser/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + '@types/node' // no node.js + ] + }, + // Browser (editor contrib) + { + target: '**/src/vs/editor/contrib/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + '@types/node' // no node.js + ] + }, + // node.js + { + target: '**/vs/**/node/**', + allowedTypes: [ + ...CORE_TYPES, + // --> types from node.d.ts that duplicate from lib.dom.d.ts + 'URL', + 'protocol', + 'hostname', + 'port', + 'pathname', + 'search', + 'username', + 'password' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts' // no DOM + ] + }, + // Electron (renderer): skip + { + target: '**/vs/**/electron-browser/**', + skip: true // -> supports all types + }, + // Electron (main) + { + target: '**/vs/**/electron-main/**', + allowedTypes: [ + ...CORE_TYPES, + // --> types from electron.d.ts that duplicate from lib.dom.d.ts + 'Event', + 'Request' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts' // no DOM + ] + } +]; +const TS_CONFIG_PATH = path_1.join(__dirname, '../../', 'src', 'tsconfig.json'); +let hasErrors = false; +function checkFile(program, sourceFile, rule) { + checkNode(sourceFile); + function checkNode(node) { + var _a; + if (node.kind !== ts.SyntaxKind.Identifier) { + return ts.forEachChild(node, checkNode); // recurse down + } + const text = node.getText(sourceFile); + if ((_a = rule.allowedTypes) === null || _a === void 0 ? void 0 : _a.some(allowed => allowed === text)) { + return; // override + } + const checker = program.getTypeChecker(); + const symbol = checker.getSymbolAtLocation(node); + if (symbol) { + const declarations = symbol.declarations; + if (Array.isArray(declarations)) { + for (const declaration of declarations) { + if (declaration) { + const parent = declaration.parent; + if (parent) { + const parentSourceFile = parent.getSourceFile(); + if (parentSourceFile) { + const definitionFileName = parentSourceFile.fileName; + if (rule.disallowedDefinitions) { + for (const disallowedDefinition of rule.disallowedDefinitions) { + if (definitionFileName.indexOf(disallowedDefinition) >= 0) { + const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`[build/lib/layersChecker.ts]: Reference to '${text}' from '${disallowedDefinition}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1})`); + hasErrors = true; + return; + } + } + } + } + } + } + } + } + } + } +} +function createProgram(tsconfigPath) { + const tsConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile); + const configHostParser = { fileExists: fs_1.existsSync, readDirectory: ts.sys.readDirectory, readFile: file => fs_1.readFileSync(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' }; + const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, path_1.resolve(path_1.dirname(tsconfigPath)), { noEmit: true }); + const compilerHost = ts.createCompilerHost(tsConfigParsed.options, true); + return ts.createProgram(tsConfigParsed.fileNames, tsConfigParsed.options, compilerHost); +} +// +// Create program and start checking +// +const program = createProgram(TS_CONFIG_PATH); +for (const sourceFile of program.getSourceFiles()) { + for (const rule of RULES) { + if (minimatch_1.match([sourceFile.fileName], rule.target).length > 0) { + if (!rule.skip) { + checkFile(program, sourceFile, rule); + } + break; + } + } +} +if (hasErrors) { + process.exit(1); +} diff --git a/build/lib/layersChecker.ts b/build/lib/layersChecker.ts new file mode 100644 index 0000000000000..0dcedb8d4e32d --- /dev/null +++ b/build/lib/layersChecker.ts @@ -0,0 +1,255 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as ts from 'typescript'; +import { readFileSync, existsSync } from 'fs'; +import { resolve, dirname, join } from 'path'; +import { match } from 'minimatch'; + +// +// ############################################################################################# +// +// A custom typescript checker for the specific task of detecting the use of certain types in a +// layer that does not allow such use. For example: +// - using DOM globals in common/node/electron-main layer (e.g. HTMLElement) +// - using node.js globals in common/browser layer (e.g. process) +// +// Make changes to below RULES to lift certain files from these checks only if absolutely needed +// +// ############################################################################################# +// + +// Types we assume are present in all implementations of JS VMs (node.js, browsers) +// Feel free to add more core types as you see needed if present in node.js and browsers +const CORE_TYPES = [ + 'require', // from our AMD loader + 'atob', + 'btoa', + 'setTimeout', + 'clearTimeout', + 'setInterval', + 'clearInterval', + 'console', + 'log', + 'info', + 'warn', + 'error', + 'group', + 'groupEnd', + 'table', + 'assert', + 'Error', + 'String', + 'throws', + 'stack', + 'captureStackTrace', + 'stackTraceLimit', + 'TextDecoder', + 'TextEncoder', + 'encode', + 'decode', + 'self', + 'trimLeft', + 'trimRight' +]; + +const RULES = [ + + // Tests: skip + { + target: '**/vs/**/test/**', + skip: true // -> skip all test files + }, + + // Common: vs/base/common/platform.ts + { + target: '**/vs/base/common/platform.ts', + allowedTypes: [ + ...CORE_TYPES, + + // Safe access to postMessage() and friends + 'MessageEvent', + 'data' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts', // no DOM + '@types/node' // no node.js + ] + }, + + // Common: vs/workbench/api/common/extHostExtensionService.ts + { + target: '**/vs/workbench/api/common/extHostExtensionService.ts', + allowedTypes: [ + ...CORE_TYPES, + + // Safe access to global + 'global' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts', // no DOM + '@types/node' // no node.js + ] + }, + + // Common + { + target: '**/vs/**/common/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + 'lib.dom.d.ts', // no DOM + '@types/node' // no node.js + ] + }, + + // Browser + { + target: '**/vs/**/browser/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + '@types/node' // no node.js + ] + }, + + // Browser (editor contrib) + { + target: '**/src/vs/editor/contrib/**', + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + '@types/node' // no node.js + ] + }, + + // node.js + { + target: '**/vs/**/node/**', + allowedTypes: [ + ...CORE_TYPES, + + // --> types from node.d.ts that duplicate from lib.dom.d.ts + 'URL', + 'protocol', + 'hostname', + 'port', + 'pathname', + 'search', + 'username', + 'password' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts' // no DOM + ] + }, + + // Electron (renderer): skip + { + target: '**/vs/**/electron-browser/**', + skip: true // -> supports all types + }, + + // Electron (main) + { + target: '**/vs/**/electron-main/**', + allowedTypes: [ + ...CORE_TYPES, + + // --> types from electron.d.ts that duplicate from lib.dom.d.ts + 'Event', + 'Request' + ], + disallowedDefinitions: [ + 'lib.dom.d.ts' // no DOM + ] + } +]; + +const TS_CONFIG_PATH = join(__dirname, '../../', 'src', 'tsconfig.json'); + +interface IRule { + target: string; + skip?: boolean; + allowedTypes?: string[]; + disallowedDefinitions?: string[]; +} + +let hasErrors = false; + +function checkFile(program: ts.Program, sourceFile: ts.SourceFile, rule: IRule) { + checkNode(sourceFile); + + function checkNode(node: ts.Node): void { + if (node.kind !== ts.SyntaxKind.Identifier) { + return ts.forEachChild(node, checkNode); // recurse down + } + + const text = node.getText(sourceFile); + + if (rule.allowedTypes?.some(allowed => allowed === text)) { + return; // override + } + + const checker = program.getTypeChecker(); + const symbol = checker.getSymbolAtLocation(node); + if (symbol) { + const declarations = symbol.declarations; + if (Array.isArray(declarations)) { + for (const declaration of declarations) { + if (declaration) { + const parent = declaration.parent; + if (parent) { + const parentSourceFile = parent.getSourceFile(); + if (parentSourceFile) { + const definitionFileName = parentSourceFile.fileName; + if (rule.disallowedDefinitions) { + for (const disallowedDefinition of rule.disallowedDefinitions) { + if (definitionFileName.indexOf(disallowedDefinition) >= 0) { + const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`[build/lib/layersChecker.ts]: Reference to '${text}' from '${disallowedDefinition}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1})`); + + hasErrors = true; + return; + } + } + } + } + } + } + } + } + } + } +} + +function createProgram(tsconfigPath: string): ts.Program { + const tsConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile); + + const configHostParser: ts.ParseConfigHost = { fileExists: existsSync, readDirectory: ts.sys.readDirectory, readFile: file => readFileSync(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' }; + const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, resolve(dirname(tsconfigPath)), { noEmit: true }); + + const compilerHost = ts.createCompilerHost(tsConfigParsed.options, true); + + return ts.createProgram(tsConfigParsed.fileNames, tsConfigParsed.options, compilerHost); +} + +// +// Create program and start checking +// +const program = createProgram(TS_CONFIG_PATH); + +for (const sourceFile of program.getSourceFiles()) { + for (const rule of RULES) { + if (match([sourceFile.fileName], rule.target).length > 0) { + if (!rule.skip) { + checkFile(program, sourceFile, rule); + } + + break; + } + } +} + +if (hasErrors) { + process.exit(1); +} diff --git a/build/lib/tslint/abstractGlobalsRule.js b/build/lib/tslint/abstractGlobalsRule.js deleted file mode 100644 index 1566c0aa57605..0000000000000 --- a/build/lib/tslint/abstractGlobalsRule.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -class AbstractGlobalsRuleWalker extends Lint.RuleWalker { - constructor(file, program, opts, _config) { - super(file, opts); - this.program = program; - this._config = _config; - } - visitIdentifier(node) { - if (this.getDisallowedGlobals().some(disallowedGlobal => disallowedGlobal === node.text)) { - if (this._config.allowed && this._config.allowed.some(allowed => allowed === node.text)) { - return; // override - } - const checker = this.program.getTypeChecker(); - const symbol = checker.getSymbolAtLocation(node); - if (symbol) { - const declarations = symbol.declarations; - if (Array.isArray(declarations) && symbol.declarations.some(declaration => { - if (declaration) { - const parent = declaration.parent; - if (parent) { - const sourceFile = parent.getSourceFile(); - if (sourceFile) { - const fileName = sourceFile.fileName; - if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) { - return true; - } - } - } - } - return false; - })) { - this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`); - } - } - } - super.visitIdentifier(node); - } -} -exports.AbstractGlobalsRuleWalker = AbstractGlobalsRuleWalker; diff --git a/build/lib/tslint/abstractGlobalsRule.ts b/build/lib/tslint/abstractGlobalsRule.ts deleted file mode 100644 index 543720455c3b7..0000000000000 --- a/build/lib/tslint/abstractGlobalsRule.ts +++ /dev/null @@ -1,57 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -interface AbstractGlobalsRuleConfig { - target: string; - allowed: string[]; -} - -export abstract class AbstractGlobalsRuleWalker extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, private program: ts.Program, opts: Lint.IOptions, private _config: AbstractGlobalsRuleConfig) { - super(file, opts); - } - - protected abstract getDisallowedGlobals(): string[]; - - protected abstract getDefinitionPattern(): string; - - visitIdentifier(node: ts.Identifier) { - if (this.getDisallowedGlobals().some(disallowedGlobal => disallowedGlobal === node.text)) { - if (this._config.allowed && this._config.allowed.some(allowed => allowed === node.text)) { - return; // override - } - - const checker = this.program.getTypeChecker(); - const symbol = checker.getSymbolAtLocation(node); - if (symbol) { - const declarations = symbol.declarations; - if (Array.isArray(declarations) && symbol.declarations.some(declaration => { - if (declaration) { - const parent = declaration.parent; - if (parent) { - const sourceFile = parent.getSourceFile(); - if (sourceFile) { - const fileName = sourceFile.fileName; - if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) { - return true; - } - } - } - } - - return false; - })) { - this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`); - } - } - } - - super.visitIdentifier(node); - } -} diff --git a/build/lib/tslint/duplicateImportsRule.js b/build/lib/tslint/duplicateImportsRule.js deleted file mode 100644 index f336095fc6a20..0000000000000 --- a/build/lib/tslint/duplicateImportsRule.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const path_1 = require("path"); -const Lint = require("tslint"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class ImportPatterns extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - this.imports = Object.create(null); - } - visitImportDeclaration(node) { - let path = node.moduleSpecifier.getText(); - // remove quotes - path = path.slice(1, -1); - if (path[0] === '.') { - path = path_1.join(path_1.dirname(node.getSourceFile().fileName), path); - } - if (this.imports[path]) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Duplicate imports for '${path}'.`)); - } - this.imports[path] = true; - } -} diff --git a/build/lib/tslint/duplicateImportsRule.ts b/build/lib/tslint/duplicateImportsRule.ts deleted file mode 100644 index c648084be1db0..0000000000000 --- a/build/lib/tslint/duplicateImportsRule.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import { join, dirname } from 'path'; -import * as Lint from 'tslint'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions())); - } -} - -class ImportPatterns extends Lint.RuleWalker { - - private imports: { [path: string]: boolean; } = Object.create(null); - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - let path = node.moduleSpecifier.getText(); - - // remove quotes - path = path.slice(1, -1); - - if (path[0] === '.') { - path = join(dirname(node.getSourceFile().fileName), path); - } - - if (this.imports[path]) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Duplicate imports for '${path}'.`)); - } - - this.imports[path] = true; - } -} diff --git a/build/lib/tslint/importPatternsRule.js b/build/lib/tslint/importPatternsRule.js deleted file mode 100644 index a64f5a6967877..0000000000000 --- a/build/lib/tslint/importPatternsRule.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const minimatch = require("minimatch"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - const configs = this.getOptions().ruleArguments; - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions(), config)); - } - } - return []; - } -} -exports.Rule = Rule; -class ImportPatterns extends Lint.RuleWalker { - constructor(file, opts, _config) { - super(file, opts); - this._config = _config; - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - let restrictions; - if (typeof this._config.restrictions === 'string') { - restrictions = [this._config.restrictions]; - } - else { - restrictions = this._config.restrictions; - } - let matched = false; - for (const pattern of restrictions) { - if (minimatch(path, pattern)) { - matched = true; - break; - } - } - if (!matched) { - // None of the restrictions matched - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Imports violates '${restrictions.join(' or ')}' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/importPatternsRule.ts b/build/lib/tslint/importPatternsRule.ts deleted file mode 100644 index 6e545a6be1605..0000000000000 --- a/build/lib/tslint/importPatternsRule.ts +++ /dev/null @@ -1,87 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as minimatch from 'minimatch'; -import { join } from 'path'; - -interface ImportPatternsConfig { - target: string; - restrictions: string | string[]; -} - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - - const configs = this.getOptions().ruleArguments; - - - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions(), config)); - } - } - - return []; - } -} - -class ImportPatterns extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions, private _config: ImportPatternsConfig) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - let restrictions: string[]; - if (typeof this._config.restrictions === 'string') { - restrictions = [this._config.restrictions]; - } else { - restrictions = this._config.restrictions; - } - - let matched = false; - for (const pattern of restrictions) { - if (minimatch(path, pattern)) { - matched = true; - break; - } - } - - if (!matched) { - // None of the restrictions matched - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Imports violates '${restrictions.join(' or ')}' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/layeringRule.js b/build/lib/tslint/layeringRule.js deleted file mode 100644 index 21a7c9a16d947..0000000000000 --- a/build/lib/tslint/layeringRule.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - const parts = path_1.dirname(sourceFile.fileName).split(/\\|\//); - const ruleArgs = this.getOptions().ruleArguments[0]; - let config; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config.allowed.has(key)) { - config.disallowed.add(key); - } - }); - break; - } - } - if (!config) { - return []; - } - return this.applyWithWalker(new LayeringRule(sourceFile, config, this.getOptions())); - } -} -exports.Rule = Rule; -class LayeringRule extends Lint.RuleWalker { - constructor(file, config, opts) { - super(file, opts); - this._config = config; - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - if (path[0] === '.') { - path = path_1.join(path_1.dirname(node.getSourceFile().fileName), path); - } - const parts = path_1.dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (this._config.allowed.has(part)) { - // GOOD - same layer - return; - } - if (this._config.disallowed.has(part)) { - // BAD - wrong layer - const message = `Bad layering. You are not allowed to access '${part}' from here, allowed layers are: [${LayeringRule._print(this._config.allowed)}]`; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), message)); - return; - } - } - } - static _print(set) { - const r = []; - set.forEach(e => r.push(e)); - return r.join(', '); - } -} diff --git a/build/lib/tslint/layeringRule.ts b/build/lib/tslint/layeringRule.ts deleted file mode 100644 index dc0053fe8de17..0000000000000 --- a/build/lib/tslint/layeringRule.ts +++ /dev/null @@ -1,105 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join, dirname } from 'path'; - -interface Config { - allowed: Set; - disallowed: Set; -} - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - - const parts = dirname(sourceFile.fileName).split(/\\|\//); - const ruleArgs = this.getOptions().ruleArguments[0]; - - let config: Config | undefined; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config!.allowed.has(key)) { - config!.disallowed.add(key); - } - }); - break; - } - } - - if (!config) { - return []; - } - - return this.applyWithWalker(new LayeringRule(sourceFile, config, this.getOptions())); - } -} - -class LayeringRule extends Lint.RuleWalker { - - private _config: Config; - - constructor(file: ts.SourceFile, config: Config, opts: Lint.IOptions) { - super(file, opts); - this._config = config; - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - if (path[0] === '.') { - path = join(dirname(node.getSourceFile().fileName), path); - } - - const parts = dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - - if (this._config.allowed.has(part)) { - // GOOD - same layer - return; - } - - if (this._config.disallowed.has(part)) { - // BAD - wrong layer - const message = `Bad layering. You are not allowed to access '${part}' from here, allowed layers are: [${LayeringRule._print(this._config.allowed)}]`; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), message)); - return; - } - } - } - - static _print(set: Set): string { - const r: string[] = []; - set.forEach(e => r.push(e)); - return r.join(', '); - } -} diff --git a/build/lib/tslint/noDomGlobalsRule.js b/build/lib/tslint/noDomGlobalsRule.js deleted file mode 100644 index a83ac8f7f5958..0000000000000 --- a/build/lib/tslint/noDomGlobalsRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -const minimatch = require("minimatch"); -const abstractGlobalsRule_1 = require("./abstractGlobalsRule"); -class Rule extends Lint.Rules.TypedRule { - applyWithProgram(sourceFile, program) { - const configs = this.getOptions().ruleArguments; - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new NoDOMGlobalsRuleWalker(sourceFile, program, this.getOptions(), config)); - } - } - return []; - } -} -exports.Rule = Rule; -class NoDOMGlobalsRuleWalker extends abstractGlobalsRule_1.AbstractGlobalsRuleWalker { - getDefinitionPattern() { - return 'lib.dom.d.ts'; - } - getDisallowedGlobals() { - // intentionally not complete - return [ - "window", - "document", - "HTMLElement" - ]; - } -} diff --git a/build/lib/tslint/noDomGlobalsRule.ts b/build/lib/tslint/noDomGlobalsRule.ts deleted file mode 100644 index df9e67bf78b6f..0000000000000 --- a/build/lib/tslint/noDomGlobalsRule.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as minimatch from 'minimatch'; -import { AbstractGlobalsRuleWalker } from './abstractGlobalsRule'; - -interface NoDOMGlobalsRuleConfig { - target: string; - allowed: string[]; -} - -export class Rule extends Lint.Rules.TypedRule { - - applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] { - const configs = this.getOptions().ruleArguments; - - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new NoDOMGlobalsRuleWalker(sourceFile, program, this.getOptions(), config)); - } - } - - return []; - } -} - -class NoDOMGlobalsRuleWalker extends AbstractGlobalsRuleWalker { - - getDefinitionPattern(): string { - return 'lib.dom.d.ts'; - } - - getDisallowedGlobals(): string[] { - // intentionally not complete - return [ - "window", - "document", - "HTMLElement" - ]; - } -} diff --git a/build/lib/tslint/noNewBufferRule.js b/build/lib/tslint/noNewBufferRule.js deleted file mode 100644 index ae9b02d457ec4..0000000000000 --- a/build/lib/tslint/noNewBufferRule.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new NewBufferRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class NewBufferRuleWalker extends Lint.RuleWalker { - visitNewExpression(node) { - if (node.expression.kind === ts.SyntaxKind.Identifier && node.expression && node.expression.text === 'Buffer') { - this.addFailureAtNode(node, '`new Buffer` is deprecated. Consider Buffer.From or Buffer.alloc instead.'); - } - super.visitNewExpression(node); - } -} diff --git a/build/lib/tslint/noNewBufferRule.ts b/build/lib/tslint/noNewBufferRule.ts deleted file mode 100644 index 7b0dd43e5383a..0000000000000 --- a/build/lib/tslint/noNewBufferRule.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -export class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new NewBufferRuleWalker(sourceFile, this.getOptions())); - } -} - -class NewBufferRuleWalker extends Lint.RuleWalker { - visitNewExpression(node: ts.NewExpression) { - if (node.expression.kind === ts.SyntaxKind.Identifier && node.expression && (node.expression as ts.Identifier).text === 'Buffer') { - this.addFailureAtNode(node, '`new Buffer` is deprecated. Consider Buffer.From or Buffer.alloc instead.'); - } - - super.visitNewExpression(node); - } -} \ No newline at end of file diff --git a/build/lib/tslint/noNlsInStandaloneEditorRule.js b/build/lib/tslint/noNlsInStandaloneEditorRule.js deleted file mode 100644 index affd4cc837034..0000000000000 --- a/build/lib/tslint/noNlsInStandaloneEditorRule.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName)) { - return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } - return []; - } -} -exports.Rule = Rule; -class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - if (/vs(\/|\\)nls/.test(path)) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`)); - } - } -} diff --git a/build/lib/tslint/noNlsInStandaloneEditorRule.ts b/build/lib/tslint/noNlsInStandaloneEditorRule.ts deleted file mode 100644 index ae23d74d784d5..0000000000000 --- a/build/lib/tslint/noNlsInStandaloneEditorRule.ts +++ /dev/null @@ -1,67 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join } from 'path'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if ( - /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName) - ) { - return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } - - return []; - } -} - -class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - if ( - /vs(\/|\\)nls/.test(path) - ) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`)); - } - } -} diff --git a/build/lib/tslint/noNodejsGlobalsRule.js b/build/lib/tslint/noNodejsGlobalsRule.js deleted file mode 100644 index 8c36fa342c273..0000000000000 --- a/build/lib/tslint/noNodejsGlobalsRule.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -const minimatch = require("minimatch"); -const abstractGlobalsRule_1 = require("./abstractGlobalsRule"); -class Rule extends Lint.Rules.TypedRule { - applyWithProgram(sourceFile, program) { - const configs = this.getOptions().ruleArguments; - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new NoNodejsGlobalsRuleWalker(sourceFile, program, this.getOptions(), config)); - } - } - return []; - } -} -exports.Rule = Rule; -class NoNodejsGlobalsRuleWalker extends abstractGlobalsRule_1.AbstractGlobalsRuleWalker { - getDefinitionPattern() { - return '@types/node'; - } - getDisallowedGlobals() { - // https://nodejs.org/api/globals.html#globals_global_objects - return [ - "NodeJS", - "Buffer", - "__dirname", - "__filename", - "clearImmediate", - "exports", - "global", - "module", - "process", - "setImmediate" - ]; - } -} diff --git a/build/lib/tslint/noNodejsGlobalsRule.ts b/build/lib/tslint/noNodejsGlobalsRule.ts deleted file mode 100644 index 7e5767d857086..0000000000000 --- a/build/lib/tslint/noNodejsGlobalsRule.ts +++ /dev/null @@ -1,52 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as minimatch from 'minimatch'; -import { AbstractGlobalsRuleWalker } from './abstractGlobalsRule'; - -interface NoNodejsGlobalsConfig { - target: string; - allowed: string[]; -} - -export class Rule extends Lint.Rules.TypedRule { - - applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] { - const configs = this.getOptions().ruleArguments; - - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new NoNodejsGlobalsRuleWalker(sourceFile, program, this.getOptions(), config)); - } - } - - return []; - } -} - -class NoNodejsGlobalsRuleWalker extends AbstractGlobalsRuleWalker { - - getDefinitionPattern(): string { - return '@types/node'; - } - - getDisallowedGlobals(): string[] { - // https://nodejs.org/api/globals.html#globals_global_objects - return [ - "NodeJS", - "Buffer", - "__dirname", - "__filename", - "clearImmediate", - "exports", - "global", - "module", - "process", - "setImmediate" - ]; - } -} diff --git a/build/lib/tslint/noStandaloneEditorRule.js b/build/lib/tslint/noStandaloneEditorRule.js deleted file mode 100644 index 44b70a6a8d7bb..0000000000000 --- a/build/lib/tslint/noStandaloneEditorRule.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/vs(\/|\\)editor/.test(sourceFile.fileName)) { - // the vs/editor folder is allowed to use the standalone editor - return []; - } - return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class NoStandaloneEditorRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/noStandaloneEditorRule.ts b/build/lib/tslint/noStandaloneEditorRule.ts deleted file mode 100644 index 713b94097d4c0..0000000000000 --- a/build/lib/tslint/noStandaloneEditorRule.ts +++ /dev/null @@ -1,65 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join } from 'path'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if (/vs(\/|\\)editor/.test(sourceFile.fileName)) { - // the vs/editor folder is allowed to use the standalone editor - return []; - } - return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } -} - -class NoStandaloneEditorRuleWalker extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - if ( - /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) - ) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/noUnexternalizedStringsRule.js b/build/lib/tslint/noUnexternalizedStringsRule.js deleted file mode 100644 index a1183ce68e767..0000000000000 --- a/build/lib/tslint/noUnexternalizedStringsRule.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -/** - * Implementation of the no-unexternalized-strings rule. - */ -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/\.d.ts$/.test(sourceFile.fileName)) { - return []; - } - return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -function isStringLiteral(node) { - return node && node.kind === ts.SyntaxKind.StringLiteral; -} -function isObjectLiteral(node) { - return node && node.kind === ts.SyntaxKind.ObjectLiteralExpression; -} -function isPropertyAssignment(node) { - return node && node.kind === ts.SyntaxKind.PropertyAssignment; -} -class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - this.signatures = Object.create(null); - this.ignores = Object.create(null); - this.messageIndex = undefined; - this.keyIndex = undefined; - this.usedKeys = Object.create(null); - const options = this.getOptions(); - const first = options && options.length > 0 ? options[0] : null; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; - } - } - } - visitSourceFile(node) { - super.visitSourceFile(node); - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - let identifier = key.substr(1, key.length - 2); - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - let occurrence = this.usedKeys[key][0]; - this.addFailure(this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `The key ${occurrence.key.getText()} doesn't conform to a valid localize identifier`)); - } - const occurrences = this.usedKeys[key]; - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`))); - }); - } - }); - } - visitStringLiteral(node) { - this.checkStringLiteral(node); - super.visitStringLiteral(node); - } - checkStringLiteral(node) { - const text = node.getText(); - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this.findDescribingParent(node); - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''), - Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''), - ]; - this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, fix); - return; - } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo ? callInfo.callExpression.expression.getText() : null; - if (functionName && this.ignores[functionName]) { - return; - } - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) { - const s = node.getText(); - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`), - ]; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix)); - return; - } - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = property.name.getText(); - if (name === 'key') { - const initializer = property.initializer; - if (isStringLiteral(initializer)) { - this.recordKey(initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - break; - } - } - } - } - } - const messageArg = callInfo.callExpression.arguments[this.messageIndex]; - if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) { - this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), `Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`)); - return; - } - } - recordKey(keyNode, messageNode) { - const text = keyNode.getText(); - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { - this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`); - } - else { - this.addFailureAtNode(keyNode, `Key is empty.`); - } - return; - } - let occurrences = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; - } - if (messageNode) { - if (occurrences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) { - return; - } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - findDescribingParent(node) { - let parent; - while ((parent = node.parent)) { - const kind = parent.kind; - if (kind === ts.SyntaxKind.CallExpression) { - const callExpression = parent; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - } - else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) { - return { isImport: true }; - } - else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration - || kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration - || kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.ModuleDeclaration - || kind === ts.SyntaxKind.TypeAliasDeclaration || kind === ts.SyntaxKind.SourceFile) { - return null; - } - node = parent; - } - return null; - } -} -NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double quotes for imports.'; -NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"'; -NoUnexternalizedStringsRuleWalker.IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; diff --git a/build/lib/tslint/noUnexternalizedStringsRule.ts b/build/lib/tslint/noUnexternalizedStringsRule.ts deleted file mode 100644 index d896e4fabe2ee..0000000000000 --- a/build/lib/tslint/noUnexternalizedStringsRule.ts +++ /dev/null @@ -1,222 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -/** - * Implementation of the no-unexternalized-strings rule. - */ -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if (/\.d.ts$/.test(sourceFile.fileName)) { - return []; - } - return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions())); - } -} - -interface Map { - [key: string]: V; -} - -interface UnexternalizedStringsOptions { - signatures?: string[]; - messageIndex?: number; - keyIndex?: number; - ignores?: string[]; -} - -function isStringLiteral(node: ts.Node): node is ts.StringLiteral { - return node && node.kind === ts.SyntaxKind.StringLiteral; -} - -function isObjectLiteral(node: ts.Node): node is ts.ObjectLiteralExpression { - return node && node.kind === ts.SyntaxKind.ObjectLiteralExpression; -} - -function isPropertyAssignment(node: ts.Node): node is ts.PropertyAssignment { - return node && node.kind === ts.SyntaxKind.PropertyAssignment; -} - -interface KeyMessagePair { - key: ts.StringLiteral; - message: ts.Node | undefined; -} - -class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker { - - private static ImportFailureMessage = 'Do not use double quotes for imports.'; - - private static DOUBLE_QUOTE: string = '"'; - - private signatures: Map; - private messageIndex: number | undefined; - private keyIndex: number | undefined; - private ignores: Map; - - private usedKeys: Map; - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - this.signatures = Object.create(null); - this.ignores = Object.create(null); - this.messageIndex = undefined; - this.keyIndex = undefined; - this.usedKeys = Object.create(null); - const options: any[] = this.getOptions(); - const first: UnexternalizedStringsOptions = options && options.length > 0 ? options[0] : null; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature: string) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore: string) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; - } - } - } - - private static IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; - protected visitSourceFile(node: ts.SourceFile): void { - super.visitSourceFile(node); - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - let identifier = key.substr(1, key.length - 2); - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - let occurrence = this.usedKeys[key][0]; - this.addFailure(this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `The key ${occurrence.key.getText()} doesn't conform to a valid localize identifier`)); - } - const occurrences = this.usedKeys[key]; - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`))); - }); - } - }); - } - - protected visitStringLiteral(node: ts.StringLiteral): void { - this.checkStringLiteral(node); - super.visitStringLiteral(node); - } - - private checkStringLiteral(node: ts.StringLiteral): void { - const text = node.getText(); - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this.findDescribingParent(node); - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''), - Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''), - ]; - this.addFailureAtNode( - node, - NoUnexternalizedStringsRuleWalker.ImportFailureMessage, - fix - ); - return; - } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo ? callInfo.callExpression.expression.getText() : null; - if (functionName && this.ignores[functionName]) { - return; - } - - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName!])) { - const s = node.getText(); - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`), - ]; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix)); - return; - } - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName!]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg: ts.Expression | null = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = property.name.getText(); - if (name === 'key') { - const initializer = property.initializer; - if (isStringLiteral(initializer)) { - this.recordKey(initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - break; - } - } - } - } - } - - const messageArg = callInfo!.callExpression.arguments[this.messageIndex!]; - - if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) { - this.addFailure(this.createFailure( - messageArg.getStart(), messageArg.getWidth(), - `Message argument to '${callInfo!.callExpression.expression.getText()}' must be a string literal.`)); - return; - } - } - - private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node | undefined) { - const text = keyNode.getText(); - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { - this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`); - } else { - this.addFailureAtNode(keyNode, `Key is empty.`); - } - return; - } - let occurrences: KeyMessagePair[] = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; - } - if (messageNode) { - if (occurrences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) { - return; - } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - - private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, isImport?: boolean; } | null { - let parent: ts.Node; - while ((parent = node.parent)) { - const kind = parent.kind; - if (kind === ts.SyntaxKind.CallExpression) { - const callExpression = parent as ts.CallExpression; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - } else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) { - return { isImport: true }; - } else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration - || kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration - || kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.ModuleDeclaration - || kind === ts.SyntaxKind.TypeAliasDeclaration || kind === ts.SyntaxKind.SourceFile) { - return null; - } - node = parent; - } - return null; - } -} diff --git a/build/lib/tslint/translationRemindRule.js b/build/lib/tslint/translationRemindRule.js deleted file mode 100644 index 2234094421bb9..0000000000000 --- a/build/lib/tslint/translationRemindRule.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -const fs = require("fs"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new TranslationRemindRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class TranslationRemindRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportDeclaration(node) { - const declaration = node.moduleSpecifier.getText(); - if (declaration !== `'${TranslationRemindRuleWalker.NLS_MODULE}'`) { - return; - } - this.visitImportLikeDeclaration(node); - } - visitImportEqualsDeclaration(node) { - const reference = node.moduleReference.getText(); - if (reference !== `require('${TranslationRemindRuleWalker.NLS_MODULE}')`) { - return; - } - this.visitImportLikeDeclaration(node); - } - visitImportLikeDeclaration(node) { - const currentFile = node.getSourceFile().fileName; - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - const resource = matchService ? matchService[0] : matchPart[0]; - let resourceDefined = false; - let json; - try { - json = fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } - catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - workbenchResources.forEach((existingResource) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - if (!resourceDefined) { - this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`); - } - } -} -TranslationRemindRuleWalker.NLS_MODULE = 'vs/nls'; diff --git a/build/lib/tslint/translationRemindRule.ts b/build/lib/tslint/translationRemindRule.ts deleted file mode 100644 index e2671599d3c0a..0000000000000 --- a/build/lib/tslint/translationRemindRule.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as fs from 'fs'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new TranslationRemindRuleWalker(sourceFile, this.getOptions())); - } -} - -class TranslationRemindRuleWalker extends Lint.RuleWalker { - - private static NLS_MODULE: string = 'vs/nls'; - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - const declaration = node.moduleSpecifier.getText(); - if (declaration !== `'${TranslationRemindRuleWalker.NLS_MODULE}'`) { - return; - } - - this.visitImportLikeDeclaration(node); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - const reference = node.moduleReference.getText(); - if (reference !== `require('${TranslationRemindRuleWalker.NLS_MODULE}')`) { - return; - } - - this.visitImportLikeDeclaration(node); - } - - private visitImportLikeDeclaration(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration) { - const currentFile = node.getSourceFile().fileName; - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - - const resource = matchService ? matchService[0] : matchPart![0]; - let resourceDefined = false; - - let json; - try { - json = fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - - workbenchResources.forEach((existingResource: any) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - - if (!resourceDefined) { - this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`); - } - } -} diff --git a/build/monaco/api.js b/build/monaco/api.js index a429cd66cde20..0fbaf7335b7da 100644 --- a/build/monaco/api.js +++ b/build/monaco/api.js @@ -9,7 +9,7 @@ const ts = require("typescript"); const path = require("path"); const fancyLog = require("fancy-log"); const ansiColors = require("ansi-colors"); -const dtsv = '2'; +const dtsv = '3'; const tsfmt = require('../../tsfmt.json'); const SRC = path.join(__dirname, '../../src'); exports.RECIPE_PATH = path.join(__dirname, './monaco.d.ts.recipe'); @@ -148,12 +148,44 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, } }); } + else if (declaration.kind === ts.SyntaxKind.VariableStatement) { + const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile)); + if (jsDoc.indexOf('@monacodtsreplace') >= 0) { + const jsDocLines = jsDoc.split(/\r\n|\r|\n/); + let directives = []; + for (const jsDocLine of jsDocLines) { + const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/); + if (m) { + directives.push([new RegExp(m[1], 'g'), m[2]]); + } + } + // remove the jsdoc + result = result.substr(jsDoc.length); + if (directives.length > 0) { + // apply replace directives + const replacer = createReplacerFromDirectives(directives); + result = replacer(result); + } + } + } result = result.replace(/export default /g, 'export '); result = result.replace(/export declare /g, 'export '); result = result.replace(/declare /g, ''); + let lines = result.split(/\r\n|\r|\n/); + for (let i = 0; i < lines.length; i++) { + if (/\s*\*/.test(lines[i])) { + // very likely a comment + continue; + } + lines[i] = lines[i].replace(/"/g, '\''); + } + result = lines.join('\n'); if (declaration.kind === ts.SyntaxKind.EnumDeclaration) { result = result.replace(/const enum/, 'enum'); - enums.push(result); + enums.push({ + enumName: declaration.name.getText(sourceFile), + text: result + }); } return result; } @@ -277,6 +309,14 @@ function format(text, endl) { return result; } } +function createReplacerFromDirectives(directives) { + return (str) => { + for (let i = 0; i < directives.length; i++) { + str = str.replace(directives[i][0], directives[i][1]); + } + return str; + }; +} function createReplacer(data) { data = data || ''; let rawDirectives = data.split(';'); @@ -292,12 +332,7 @@ function createReplacer(data) { findStr = '\\b' + findStr + '\\b'; directives.push([new RegExp(findStr, 'g'), replaceStr]); }); - return (str) => { - for (let i = 0; i < directives.length; i++) { - str = str.replace(directives[i][0], directives[i][1]); - } - return str; - }; + return createReplacerFromDirectives(directives); } function generateDeclarationFile(recipe, sourceFileGetter) { const endl = /\r\n/.test(recipe) ? '\r\n' : '\n'; @@ -415,6 +450,15 @@ function generateDeclarationFile(recipe, sourceFileGetter) { resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl); resultTxt = format(resultTxt, endl); resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl); + enums.sort((e1, e2) => { + if (e1.enumName < e2.enumName) { + return -1; + } + if (e1.enumName > e2.enumName) { + return 1; + } + return 0; + }); let resultEnums = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', @@ -423,7 +467,7 @@ function generateDeclarationFile(recipe, sourceFileGetter) { '', '// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.', '' - ].concat(enums).join(endl); + ].concat(enums.map(e => e.text)).join(endl); resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl); resultEnums = format(resultEnums, endl); resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl); diff --git a/build/monaco/api.ts b/build/monaco/api.ts index ae058292344d7..511768ee64be2 100644 --- a/build/monaco/api.ts +++ b/build/monaco/api.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import * as fancyLog from 'fancy-log'; import * as ansiColors from 'ansi-colors'; -const dtsv = '2'; +const dtsv = '3'; const tsfmt = require('../../tsfmt.json'); @@ -138,7 +138,7 @@ function isDefaultExport(declaration: ts.InterfaceDeclaration | ts.ClassDeclarat ); } -function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: string[]): string { +function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: IEnumEntry[]): string { let result = getNodeText(sourceFile, declaration); if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) { let interfaceDeclaration = declaration; @@ -177,14 +177,45 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati // life.. } }); + } else if (declaration.kind === ts.SyntaxKind.VariableStatement) { + const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile)); + if (jsDoc.indexOf('@monacodtsreplace') >= 0) { + const jsDocLines = jsDoc.split(/\r\n|\r|\n/); + let directives: [RegExp, string][] = []; + for (const jsDocLine of jsDocLines) { + const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/); + if (m) { + directives.push([new RegExp(m[1], 'g'), m[2]]); + } + } + // remove the jsdoc + result = result.substr(jsDoc.length); + if (directives.length > 0) { + // apply replace directives + const replacer = createReplacerFromDirectives(directives); + result = replacer(result); + } + } } result = result.replace(/export default /g, 'export '); result = result.replace(/export declare /g, 'export '); result = result.replace(/declare /g, ''); + let lines = result.split(/\r\n|\r|\n/); + for (let i = 0; i < lines.length; i++) { + if (/\s*\*/.test(lines[i])) { + // very likely a comment + continue; + } + lines[i] = lines[i].replace(/"/g, '\''); + } + result = lines.join('\n'); if (declaration.kind === ts.SyntaxKind.EnumDeclaration) { result = result.replace(/const enum/, 'enum'); - enums.push(result); + enums.push({ + enumName: declaration.name.getText(sourceFile), + text: result + }); } return result; @@ -324,6 +355,15 @@ function format(text: string, endl: string): string { } } +function createReplacerFromDirectives(directives: [RegExp, string][]): (str: string) => string { + return (str: string) => { + for (let i = 0; i < directives.length; i++) { + str = str.replace(directives[i][0], directives[i][1]); + } + return str; + }; +} + function createReplacer(data: string): (str: string) => string { data = data || ''; let rawDirectives = data.split(';'); @@ -341,12 +381,7 @@ function createReplacer(data: string): (str: string) => string { directives.push([new RegExp(findStr, 'g'), replaceStr]); }); - return (str: string) => { - for (let i = 0; i < directives.length; i++) { - str = str.replace(directives[i][0], directives[i][1]); - } - return str; - }; + return createReplacerFromDirectives(directives); } interface ITempResult { @@ -355,6 +390,11 @@ interface ITempResult { enums: string; } +interface IEnumEntry { + enumName: string; + text: string; +} + function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGetter): ITempResult | null { const endl = /\r\n/.test(recipe) ? '\r\n' : '\n'; @@ -376,7 +416,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet return importName; }; - let enums: string[] = []; + let enums: IEnumEntry[] = []; let version: string | null = null; lines.forEach(line => { @@ -492,6 +532,16 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet resultTxt = format(resultTxt, endl); resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl); + enums.sort((e1, e2) => { + if (e1.enumName < e2.enumName) { + return -1; + } + if (e1.enumName > e2.enumName) { + return 1; + } + return 0; + }); + let resultEnums = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', @@ -500,7 +550,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet '', '// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.', '' - ].concat(enums).join(endl); + ].concat(enums.map(e => e.text)).join(endl); resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl); resultEnums = format(resultEnums, endl); resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl); diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe index 0c49fac1c369e..7288af94c9d99 100644 --- a/build/monaco/monaco.d.ts.recipe +++ b/build/monaco/monaco.d.ts.recipe @@ -3,12 +3,18 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare namespace monaco { +declare let MonacoEnvironment: monaco.Environment | undefined; - // THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. +declare namespace monaco { export type Thenable = PromiseLike; + export interface Environment { + baseUrl?: string; + getWorker?(workerId: string, label: string): Worker; + getWorkerUrl?(workerId: string, label: string): string; + } + export interface IDisposable { dispose(): void; } @@ -48,7 +54,7 @@ declare namespace monaco.editor { #include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors #include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule #include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions -#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor +#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IGlobalEditorOptions, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor export interface ICommandHandler { (...args: any[]): void; } @@ -88,4 +94,4 @@ declare namespace monaco.worker { } -//dtsv=2 +//dtsv=3 diff --git a/build/monaco/package.json b/build/monaco/package.json index 1ff3e4e72f3fe..70021689eb4a1 100644 --- a/build/monaco/package.json +++ b/build/monaco/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor-core", "private": true, - "version": "0.18.0", + "version": "0.19.2", "description": "A browser based code editor", "author": "Microsoft Corporation", "license": "MIT", diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 83e31e8b85315..5a937a80bd899 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -72,4 +72,5 @@ runtime "${runtime}"`; yarnInstall(`build`); // node modules required for build yarnInstall('test/automation'); // node modules required for smoketest yarnInstall('test/smoke'); // node modules required for smoketest +yarnInstall('test/integration/browser'); // node modules required for integration yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron diff --git a/build/package.json b/build/package.json index a685a901b88c2..d1cd1b063b7fa 100644 --- a/build/package.json +++ b/build/package.json @@ -6,6 +6,7 @@ "@types/ansi-colors": "^3.2.0", "@types/azure": "0.9.19", "@types/debounce": "^1.0.0", + "@types/eslint": "4.16.1", "@types/fancy-log": "^1.3.0", "@types/glob": "^7.1.1", "@types/gulp": "^4.0.5", @@ -28,6 +29,8 @@ "@types/through2": "^2.0.34", "@types/underscore": "^1.8.9", "@types/xml2js": "0.0.33", + "@typescript-eslint/experimental-utils": "~2.13.0", + "@typescript-eslint/parser": "^2.12.0", "applicationinsights": "1.0.8", "azure-storage": "^2.1.0", "github-releases": "^0.4.1", @@ -36,11 +39,11 @@ "gulp-uglify": "^3.0.0", "iconv-lite": "0.4.23", "mime": "^1.3.4", + "minimatch": "3.0.4", "minimist": "^1.2.0", "request": "^2.85.0", "terser": "4.3.8", - "tslint": "^5.9.1", - "typescript": "3.7.2", + "typescript": "3.8.2", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.5.4", "xml2js": "^0.4.17" diff --git a/build/tslint.json b/build/tslint.json deleted file mode 100644 index 15275279139de..0000000000000 --- a/build/tslint.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "rules": { - "no-unused-expression": true, - "no-duplicate-variable": true, - "curly": true, - "class-name": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": true - }, - "defaultSeverity": "warning" -} \ No newline at end of file diff --git a/build/win32/code.iss b/build/win32/code.iss index 0e2ed70d64ac0..15293a0c5cf92 100644 --- a/build/win32/code.iss +++ b/build/win32/code.iss @@ -182,6 +182,13 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cc"; Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\cpp.ico"; Tasks: associatewithfiles Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.cjs\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.cjs\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.cjs"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cjs"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,JavaScript}"; Flags: uninsdeletekey; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cjs"; ValueType: string; ValueName: "AppUserModelID"; ValueData: "{#AppUserId}"; Flags: uninsdeletekey; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cjs\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\javascript.ico"; Tasks: associatewithfiles +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.cjs\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles + Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.clj\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.clj\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.clj"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.clj"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,Clojure}"; Flags: uninsdeletekey; Tasks: associatewithfiles @@ -957,16 +964,16 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBas Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBasename}.exe\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\default.ico" Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBasename}.exe\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1""" -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu, {#ShellNameShort}}"; Tasks: addcontextmenufiles; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufiles; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufiles Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: addcontextmenufiles -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu, {#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufolders Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%V"""; Tasks: addcontextmenufolders -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\background\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "Open w&ith {#ShellNameShort}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\background\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\background\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufolders Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\background\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%V"""; Tasks: addcontextmenufolders -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "Open w&ith {#ShellNameShort}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufolders Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%V"""; Tasks: addcontextmenufolders diff --git a/build/win32/i18n/messages.en.isl b/build/win32/i18n/messages.en.isl index 6535824eed674..12189c080d4b6 100644 --- a/build/win32/i18n/messages.en.isl +++ b/build/win32/i18n/messages.en.isl @@ -6,4 +6,4 @@ AddToPath=Add to PATH (requires shell restart) RunAfter=Run %1 after installation Other=Other: SourceFile=%1 Source File -OpenWithCodeContextMenu=Open with %1 \ No newline at end of file +OpenWithCodeContextMenu=Open w&ith %1 diff --git a/build/yarn.lock b/build/yarn.lock index 36f6c025d487c..53bc78757a80d 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -90,6 +90,24 @@ resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + +"@types/eslint@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-4.16.1.tgz#19730c9fcb66b6e44742d12b27a603fabfeb2f49" + integrity sha512-lRUXQAULl5geixTiP2K0iYvMUbCkEnuOwvLGjwff12I4ECxoW5QaWML5UUOZ1CvpQLILkddBdMPMZz4ByQizsg== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*": + version "0.0.41" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421" + integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA== + "@types/events@*": version "1.2.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" @@ -184,6 +202,11 @@ resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c" integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA== +"@types/json-schema@*", "@types/json-schema@^7.0.3": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" + integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== + "@types/mime@0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b" @@ -312,6 +335,60 @@ resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.33.tgz#20c5dd6460245284d64a55690015b95e409fb7de" integrity sha1-IMXdZGAkUoTWSlVpABW5XkCft94= +"@typescript-eslint/experimental-utils@2.14.0": + version "2.14.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.14.0.tgz#e9179fa3c44e00b3106b85d7b69342901fb43e3b" + integrity sha512-KcyKS7G6IWnIgl3ZpyxyBCxhkBPV+0a5Jjy2g5HxlrbG2ZLQNFeneIBVXdaBCYOVjvGmGGFKom1kgiAY75SDeQ== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.14.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/experimental-utils@~2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.13.0.tgz#958614faa6f77599ee2b241740e0ea402482533d" + integrity sha512-+Hss3clwa6aNiC8ZjA45wEm4FutDV5HsVXPl/rDug1THq6gEtOYRGLqS3JlTk7mSnL5TbJz0LpEbzbPnKvY6sw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@^2.12.0": + version "2.14.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.14.0.tgz#30fa0523d86d74172a5e32274558404ba4262cd6" + integrity sha512-haS+8D35fUydIs+zdSf4BxpOartb/DjrZ2IxQ5sR8zyGfd77uT9ZJZYF8+I0WPhzqHmfafUBx8MYpcp8pfaoSA== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.14.0" + "@typescript-eslint/typescript-estree" "2.14.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.13.0.tgz#a2e746867da772c857c13853219fced10d2566bc" + integrity sha512-t21Mg5cc8T3ADEUGwDisHLIubgXKjuNRbkpzDMLb7/JMmgCe/gHM9FaaujokLey+gwTuLF5ndSQ7/EfQqrQx4g== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + +"@typescript-eslint/typescript-estree@2.14.0": + version "2.14.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.14.0.tgz#c67698acdc14547f095eeefe908958d93e1a648d" + integrity sha512-pnLpUcMNG7GfFFfNQbEX6f1aPa5fMnH2G9By+A1yovYI4VIOK2DzkaRuUlIkbagpAcrxQHLqovI1YWqEcXyRnA== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + acorn@4.X: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -352,13 +429,6 @@ ansi-styles@^2.2.1: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - ansi-wrap@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" @@ -482,15 +552,6 @@ azure-storage@^2.1.0: xml2js "0.2.7" xmlbuilder "0.4.3" -babel-code-frame@^6.22.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -564,17 +625,12 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= - caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@^1.0.0, chalk@^1.1.3: +chalk@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= @@ -585,15 +641,6 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.3.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" - integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - cheerio@^1.0.0-rc.1: version "1.0.0-rc.2" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db" @@ -626,18 +673,6 @@ code-block-writer@9.4.1: resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-9.4.1.tgz#1448fca79dfc7a3649000f4c85be6bc770604c4c" integrity sha512-LHAB+DL4YZDcwK8y/kAxZ0Lf/ncwLh/Ux4cTVWbPwIdrf1gPxXiPcwpz8r8/KqXu1aD+Raz46EOxDjFlbyO6bA== -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - color-support@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" @@ -672,16 +707,16 @@ command-line-args@^5.1.1: lodash.camelcase "^4.3.0" typical "^4.0.0" -commander@^2.12.1, commander@^2.8.1: - version "2.19.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" - integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== - commander@^2.20.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commander@^2.8.1: + version "2.19.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -816,11 +851,6 @@ diagnostic-channel@0.2.0: dependencies: semver "^5.3.0" -diff@^3.2.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" - integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -900,20 +930,35 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.1.0, estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== execa@^1.0.0: version "1.0.0" @@ -1078,7 +1123,7 @@ glob-parent@^5.0.0: dependencies: is-glob "^4.0.1" -glob@^7.0.6, glob@^7.1.1: +glob@^7.0.6: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== @@ -1102,6 +1147,18 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globby@^10.0.1: version "10.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" @@ -1238,11 +1295,6 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - has-gulplog@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" @@ -1451,19 +1503,6 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= - -js-yaml@^3.7.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -1641,6 +1680,11 @@ lodash.templatesettings@^3.0.0: lodash._reinterpolate "^3.0.0" lodash.escape "^3.0.0" +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash@^4.15.0, lodash@^4.17.10: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -1900,11 +1944,6 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= -path-parse@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== - path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -2103,13 +2142,6 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.3.2: - version "1.8.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" - integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== - dependencies: - path-parse "^1.0.5" - reusify@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -2165,6 +2197,11 @@ semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -2301,13 +2338,6 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - terser@*: version "4.2.1" resolved "https://registry.yarnpkg.com/terser/-/terser-4.2.1.tgz#1052cfe17576c66e7bc70fcc7119f22b155bdac1" @@ -2381,7 +2411,7 @@ ts-morph@^3.1.3: multimatch "^4.0.0" typescript "^3.0.1" -tslib@^1.8.0, tslib@^1.8.1: +tslib@^1.8.1: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== @@ -2391,28 +2421,10 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint@^5.9.1: - version "5.11.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed" - integrity sha1-mPMMAurjzecAYgHkwzywi0hYHu0= - dependencies: - babel-code-frame "^6.22.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^3.2.0" - glob "^7.1.1" - js-yaml "^3.7.0" - minimatch "^3.0.4" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.8.0" - tsutils "^2.27.2" - -tsutils@^2.27.2: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== dependencies: tslib "^1.8.1" @@ -2441,10 +2453,10 @@ typed-rest-client@^0.9.0: tunnel "0.0.4" underscore "1.8.3" -typescript@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@3.8.2: + version "3.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a" + integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ== typescript@^3.0.1: version "3.5.3" diff --git a/cgmanifest.json b/cgmanifest.json index 3d6e8a2108047..40d6e42aa7832 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "chromium", "repositoryUrl": "https://chromium.googlesource.com/chromium/src", - "commitHash": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa" + "commitHash": "e4745133a1d3745f066e068b8033c6a269b59caf" } }, "licenseDetail": [ @@ -40,7 +40,7 @@ "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ], "isOnlyProductionDependency": true, - "version": "76.0.3809.146" + "version": "78.0.3904.130" }, { "component": { @@ -48,11 +48,11 @@ "git": { "name": "nodejs", "repositoryUrl": "https://github.com/nodejs/node", - "commitHash": "64219741218aa87e259cf8257596073b8e747f0a" + "commitHash": "787378879acfb212ed4ff824bf9f767a24a5cb43a" } }, "isOnlyProductionDependency": true, - "version": "12.4.0" + "version": "12.8.1" }, { "component": { @@ -60,12 +60,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "a5b474e8248803f54efc2c2c724c3322590c4fda" + "commitHash": "d17dfabfcba7bd0bc994b8dac5f5d2000bef572c" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "6.1.4" + "version": "7.1.11" }, { "component": { @@ -98,7 +98,7 @@ "git": { "name": "vscode-codicons", "repositoryUrl": "https://github.com/microsoft/vscode-codicons", - "commitHash": "65d11e0839d0ce09faa1a159dc0b3c0bd1aa50be" + "commitHash": "f0caa623812a8ed5059516277675b4158d4c4867" } }, "license": "MIT and Creative Commons Attribution 4.0", diff --git a/extensions/bat/language-configuration.json b/extensions/bat/language-configuration.json index 2fb5445a34a47..17bc92f6a91fa 100644 --- a/extensions/bat/language-configuration.json +++ b/extensions/bat/language-configuration.json @@ -11,12 +11,13 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"], + ["%", "%"], ["\"", "\""] ], "folding": { diff --git a/extensions/clojure/language-configuration.json b/extensions/clojure/language-configuration.json index 24f5248001560..a62cb968ece20 100644 --- a/extensions/clojure/language-configuration.json +++ b/extensions/clojure/language-configuration.json @@ -11,7 +11,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -22,4 +22,4 @@ "folding": { "offSide": true } -} \ No newline at end of file +} diff --git a/extensions/clojure/test/colorize-results/test_clj.json b/extensions/clojure/test/colorize-results/test_clj.json index b7dd17d91e886..64b91983a1017 100644 --- a/extensions/clojure/test/colorize-results/test_clj.json +++ b/extensions/clojure/test/colorize-results/test_clj.json @@ -202,9 +202,9 @@ "t": "source.clojure meta.expression.clojure meta.definition.global.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -235,9 +235,9 @@ "t": "source.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -257,9 +257,9 @@ "t": "source.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -279,9 +279,9 @@ "t": "source.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -345,9 +345,9 @@ "t": "source.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -466,9 +466,9 @@ "t": "source.clojure meta.map.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -510,9 +510,9 @@ "t": "source.clojure meta.map.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -620,9 +620,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -642,9 +642,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -664,9 +664,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1368,9 +1368,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1390,9 +1390,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1412,9 +1412,9 @@ "t": "source.clojure meta.quoted-expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1522,9 +1522,9 @@ "t": "source.clojure meta.expression.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1566,9 +1566,9 @@ "t": "source.clojure meta.expression.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1610,9 +1610,9 @@ "t": "source.clojure meta.expression.clojure meta.vector.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2567,9 +2567,9 @@ "t": "source.clojure meta.expression.clojure meta.definition.global.clojure meta.map.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2611,9 +2611,9 @@ "t": "source.clojure meta.expression.clojure meta.definition.global.clojure meta.map.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2721,9 +2721,9 @@ "t": "source.clojure meta.expression.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3007,9 +3007,9 @@ "t": "source.clojure meta.expression.clojure meta.definition.global.clojure meta.expression.clojure meta.map.clojure constant.numeric.long.clojure", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3321,4 +3321,4 @@ "hc_black": "comment: #7CA668" } } -] \ No newline at end of file +] diff --git a/extensions/coffeescript/language-configuration.json b/extensions/coffeescript/language-configuration.json index fd4a1b88c87dd..c2b8662039d61 100644 --- a/extensions/coffeescript/language-configuration.json +++ b/extensions/coffeescript/language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], diff --git a/extensions/coffeescript/test/colorize-results/test-regex_coffee.json b/extensions/coffeescript/test/colorize-results/test-regex_coffee.json index 9daab0d553371..15f4b3cd38449 100644 --- a/extensions/coffeescript/test/colorize-results/test-regex_coffee.json +++ b/extensions/coffeescript/test/colorize-results/test-regex_coffee.json @@ -147,9 +147,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -191,9 +191,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -202,9 +202,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -224,9 +224,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -725,4 +725,4 @@ "hc_black": "string.regexp: #D16969" } } -] \ No newline at end of file +] diff --git a/extensions/coffeescript/test/colorize-results/test_coffee.json b/extensions/coffeescript/test/colorize-results/test_coffee.json index d3de07d3f82de..7c72176431db8 100644 --- a/extensions/coffeescript/test/colorize-results/test_coffee.json +++ b/extensions/coffeescript/test/colorize-results/test_coffee.json @@ -1016,9 +1016,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1038,9 +1038,9 @@ "t": "source.coffee constant.numeric.decimal.coffee", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1605,4 +1605,4 @@ "hc_black": "string.regexp: #D16969" } } -] \ No newline at end of file +] diff --git a/extensions/configuration-editing/package.json b/extensions/configuration-editing/package.json index 5defc86cf5d9e..0defd3aee6f86 100644 --- a/extensions/configuration-editing/package.json +++ b/extensions/configuration-editing/package.json @@ -18,8 +18,8 @@ "watch": "gulp watch-extension:configuration-editing" }, "dependencies": { - "jsonc-parser": "^2.1.1", - "vscode-nls": "^4.0.0" + "jsonc-parser": "^2.2.1", + "vscode-nls": "^4.1.1" }, "contributes": { "languages": [ @@ -88,6 +88,10 @@ "fileMatch": "/.vscode/tasks.json", "url": "vscode://schemas/tasks" }, + { + "fileMatch": "%APP_SETTINGS_HOME%/tasks.json", + "url": "vscode://schemas/tasks" + }, { "fileMatch": "%APP_SETTINGS_HOME%/snippets/*.json", "url": "vscode://schemas/snippets" diff --git a/extensions/configuration-editing/schemas/attachContainer.schema.json b/extensions/configuration-editing/schemas/attachContainer.schema.json index 5f3d28abb89ec..015e32e8018fe 100644 --- a/extensions/configuration-editing/schemas/attachContainer.schema.json +++ b/extensions/configuration-editing/schemas/attachContainer.schema.json @@ -1,7 +1,8 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "description": "Configures an attached to container", "allowComments": true, + "allowTrailingCommas": true, "type": "object", "definitions": { "attachContainer": { @@ -18,11 +19,31 @@ "type": "integer" } }, + "settings": { + "$ref": "vscode://schemas/settings/machine", + "description": "Machine specific settings that should be copied into the container." + }, + "remoteEnv": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + }, + "description": "Remote environment variables." + }, + "remoteUser": { + "type": "string", + "description": "The user VS Code Server will be started with. The default is the same user as the container." + }, "extensions": { "type": "array", "description": "An array of extensions that should be installed into the container.", "items": { - "type": "string" + "type": "string", + "pattern": "^([a-z0-9A-Z][a-z0-9\\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\\-A-Z]*)$", + "errorMessage": "Expected format '${publisher}.${name}'. Example: 'vscode.csharp'." } } } diff --git a/extensions/configuration-editing/schemas/devContainer.schema.json b/extensions/configuration-editing/schemas/devContainer.schema.json index 1358c74f2d2a9..0d47b27bec954 100644 --- a/extensions/configuration-editing/schemas/devContainer.schema.json +++ b/extensions/configuration-editing/schemas/devContainer.schema.json @@ -1,7 +1,8 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "description": "Defines a dev container", "allowComments": true, + "allowTrailingCommas": true, "type": "object", "definitions": { "devContainerCommon": { @@ -15,13 +16,38 @@ "type": "array", "description": "An array of extensions that should be installed into the container.", "items": { - "type": "string" + "type": "string", + "pattern": "^([a-z0-9A-Z][a-z0-9\\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\\-A-Z]*)$", + "errorMessage": "Expected format '${publisher}.${name}'. Example: 'vscode.csharp'." } }, "settings": { "$ref": "vscode://schemas/settings/machine", "description": "Machine specific settings that should be copied into the container." }, + "forwardPorts": { + "type": "array", + "description": "Ports that are forwarded from the container to the local machine.", + "items": { + "type": "integer", + "maximum": 65535, + "minimum": 0 + } + }, + "remoteEnv": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + }, + "description": "Remote environment variables." + }, + "remoteUser": { + "type": "string", + "description": "The user VS Code Server will be started with. The default is the same user as the container." + }, "postCreateCommand": { "type": [ "string", @@ -55,6 +81,28 @@ ] } }, + "containerEnv": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Container environment variables." + }, + "containerUser": { + "type": "string", + "description": "The user the container will be started with. The default is the user on the Docker image." + }, + "updateRemoteUserUID": { + "type": "boolean", + "description": "Controls whether on Linux the container's user should be updated with the local user's UID and GID. On by default." + }, + "mounts": { + "type": "array", + "description": "Mount points to set up when creating the container. See Docker's documentation for the --mount option for the supported syntax.", + "items": { + "type": "string" + } + }, "runArgs": { "type": "array", "description": "The arguments required when starting in the container.", diff --git a/extensions/configuration-editing/src/extension.ts b/extensions/configuration-editing/src/extension.ts index 72e2fcf627f94..966073e23f87b 100644 --- a/extensions/configuration-editing/src/extension.ts +++ b/extensions/configuration-editing/src/extension.ts @@ -4,23 +4,12 @@ *--------------------------------------------------------------------------------------------*/ import { getLocation, parse, visit } from 'jsonc-parser'; -import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; import { SettingsDocument } from './settingsDocumentHelper'; +import { provideInstalledExtensionProposals } from './extensionsProposals'; const localize = nls.loadMessageBundle(); -const fadedDecoration = vscode.window.createTextEditorDecorationType({ - light: { - color: '#757575' - }, - dark: { - color: '#878787' - } -}); - -let pendingLaunchJsonDecoration: NodeJS.Timer; - export function activate(context: vscode.ExtensionContext): void { //settings.json suggestions context.subscriptions.push(registerSettingsCompletions()); @@ -33,18 +22,6 @@ export function activate(context: vscode.ExtensionContext): void { // task.json variable suggestions context.subscriptions.push(registerVariableCompletions('**/tasks.json')); - - // launch.json decorations - context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(editor => updateLaunchJsonDecorations(editor), null, context.subscriptions)); - context.subscriptions.push(vscode.workspace.onDidChangeTextDocument(event => { - if (vscode.window.activeTextEditor && event.document === vscode.window.activeTextEditor.document) { - if (pendingLaunchJsonDecoration) { - clearTimeout(pendingLaunchJsonDecoration); - } - pendingLaunchJsonDecoration = setTimeout(() => updateLaunchJsonDecorations(vscode.window.activeTextEditor), 1000); - } - }, null, context.subscriptions)); - updateLaunchJsonDecorations(vscode.window.activeTextEditor); } function registerSettingsCompletions(): vscode.Disposable { @@ -104,7 +81,7 @@ function registerExtensionsCompletionsInExtensionsDocument(): vscode.Disposable const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position); if (location.path[0] === 'recommendations') { const extensionsContent = parse(document.getText()); - return provideInstalledExtensionProposals(extensionsContent, range); + return provideInstalledExtensionProposals(extensionsContent && extensionsContent.recommendations || [], range, false); } return []; } @@ -118,74 +95,13 @@ function registerExtensionsCompletionsInWorkspaceConfigurationDocument(): vscode const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position); if (location.path[0] === 'extensions' && location.path[1] === 'recommendations') { const extensionsContent = parse(document.getText())['extensions']; - return provideInstalledExtensionProposals(extensionsContent, range); + return provideInstalledExtensionProposals(extensionsContent && extensionsContent.recommendations || [], range, false); } return []; } }); } -function provideInstalledExtensionProposals(extensionsContent: IExtensionsContent, range: vscode.Range): vscode.ProviderResult { - const alreadyEnteredExtensions = extensionsContent && extensionsContent.recommendations || []; - if (Array.isArray(alreadyEnteredExtensions)) { - const knownExtensionProposals = vscode.extensions.all.filter(e => - !(e.id.startsWith('vscode.') - || e.id === 'Microsoft.vscode-markdown' - || alreadyEnteredExtensions.indexOf(e.id) > -1)); - if (knownExtensionProposals.length) { - return knownExtensionProposals.map(e => { - const item = new vscode.CompletionItem(e.id); - const insertText = `"${e.id}"`; - item.kind = vscode.CompletionItemKind.Value; - item.insertText = insertText; - item.range = range; - item.filterText = insertText; - return item; - }); - } else { - const example = new vscode.CompletionItem(localize('exampleExtension', "Example")); - example.insertText = '"vscode.csharp"'; - example.kind = vscode.CompletionItemKind.Value; - example.range = range; - return [example]; - } - } - return undefined; -} - -function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined): void { - if (!editor || path.basename(editor.document.fileName) !== 'launch.json') { - return; - } - - const ranges: vscode.Range[] = []; - let addPropertyAndValue = false; - let depthInArray = 0; - visit(editor.document.getText(), { - onObjectProperty: (property, offset, length) => { - // Decorate attributes which are unlikely to be edited by the user. - // Only decorate "configurations" if it is not inside an array (compounds have a configurations property which should not be decorated). - addPropertyAndValue = property === 'version' || property === 'type' || property === 'request' || property === 'compounds' || (property === 'configurations' && depthInArray === 0); - if (addPropertyAndValue) { - ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length))); - } - }, - onLiteralValue: (_value, offset, length) => { - if (addPropertyAndValue) { - ranges.push(new vscode.Range(editor.document.positionAt(offset), editor.document.positionAt(offset + length))); - } - }, - onArrayBegin: (_offset: number, _length: number) => { - depthInArray++; - }, - onArrayEnd: (_offset: number, _length: number) => { - depthInArray--; - } - }); - - editor.setDecorations(fadedDecoration, ranges); -} - vscode.languages.registerDocumentSymbolProvider({ pattern: '**/launch.json', language: 'jsonc' }, { provideDocumentSymbols(document: vscode.TextDocument, _token: vscode.CancellationToken): vscode.ProviderResult { const result: vscode.SymbolInformation[] = []; diff --git a/extensions/configuration-editing/src/extensionsProposals.ts b/extensions/configuration-editing/src/extensionsProposals.ts new file mode 100644 index 0000000000000..60533ae29759e --- /dev/null +++ b/extensions/configuration-editing/src/extensionsProposals.ts @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as nls from 'vscode-nls'; +const localize = nls.loadMessageBundle(); + + +export function provideInstalledExtensionProposals(existing: string[], range: vscode.Range, includeBuiltinExtensions: boolean): vscode.ProviderResult { + if (Array.isArray(existing)) { + const extensions = includeBuiltinExtensions ? vscode.extensions.all : vscode.extensions.all.filter(e => !(e.id.startsWith('vscode.') || e.id === 'Microsoft.vscode-markdown')); + const knownExtensionProposals = extensions.filter(e => existing.indexOf(e.id) === -1); + if (knownExtensionProposals.length) { + return knownExtensionProposals.map(e => { + const item = new vscode.CompletionItem(e.id); + const insertText = `"${e.id}"`; + item.kind = vscode.CompletionItemKind.Value; + item.insertText = insertText; + item.range = range; + item.filterText = insertText; + return item; + }); + } else { + const example = new vscode.CompletionItem(localize('exampleExtension', "Example")); + example.insertText = '"vscode.csharp"'; + example.kind = vscode.CompletionItemKind.Value; + example.range = range; + return [example]; + } + } + return undefined; +} + diff --git a/extensions/configuration-editing/src/settingsDocumentHelper.ts b/extensions/configuration-editing/src/settingsDocumentHelper.ts index 970f2a5ca18c3..4a7f80c2a2a1d 100644 --- a/extensions/configuration-editing/src/settingsDocumentHelper.ts +++ b/extensions/configuration-editing/src/settingsDocumentHelper.ts @@ -4,8 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { getLocation, Location } from 'jsonc-parser'; +import { getLocation, Location, parse } from 'jsonc-parser'; import * as nls from 'vscode-nls'; +import { provideInstalledExtensionProposals } from './extensionsProposals'; const localize = nls.loadMessageBundle(); @@ -13,7 +14,7 @@ export class SettingsDocument { constructor(private document: vscode.TextDocument) { } - public provideCompletionItems(position: vscode.Position, _token: vscode.CancellationToken): vscode.ProviderResult { + public provideCompletionItems(position: vscode.Position, _token: vscode.CancellationToken): vscode.ProviderResult { const location = getLocation(this.document.getText(), this.document.offsetAt(position)); const range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position); @@ -34,7 +35,20 @@ export class SettingsDocument { // files.defaultLanguage if (location.path[0] === 'files.defaultLanguage') { - return this.provideLanguageCompletionItems(location, range); + return this.provideLanguageCompletionItems(location, range).then(items => { + + // Add special item '${activeEditorLanguage}' + return [this.newSimpleCompletionItem(JSON.stringify('${activeEditorLanguage}'), range, localize('activeEditor', "Use the language of the currently active text editor if any")), ...items]; + }); + } + + // sync.ignoredExtensions + if (location.path[0] === 'sync.ignoredExtensions') { + let ignoredExtensions = []; + try { + ignoredExtensions = parse(this.document.getText())['sync.ignoredExtensions']; + } catch (e) {/* ignore error */ } + return provideInstalledExtensionProposals(ignoredExtensions, range, true); } return this.provideLanguageOverridesCompletionItems(location, position); @@ -82,7 +96,7 @@ export class SettingsDocument { })); } else { // Value - return this.provideLanguageCompletionItems(location, range); + return this.provideLanguageCompletionItemsForLanguageOverrides(location, range); } } @@ -153,7 +167,12 @@ export class SettingsDocument { return Promise.resolve(completions); } - private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): vscode.ProviderResult { + private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable { + return vscode.languages.getLanguages() + .then(languages => languages.map(l => this.newSimpleCompletionItem(formatFunc(l), range))); + } + + private provideLanguageCompletionItemsForLanguageOverrides(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable { return vscode.languages.getLanguages().then(languages => { const completionItems = []; const configuration = vscode.workspace.getConfiguration(); @@ -178,7 +197,7 @@ export class SettingsDocument { let text = this.document.getText(range); if (text && text.trim().startsWith('[')) { range = new vscode.Range(new vscode.Position(range.start.line, range.start.character + text.indexOf('[')), range.end); - return this.provideLanguageCompletionItems(location, range, language => `"[${language}]"`); + return this.provideLanguageCompletionItemsForLanguageOverrides(location, range, language => `"[${language}]"`); } range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position); @@ -205,7 +224,7 @@ export class SettingsDocument { // Suggestion model word matching includes closed sqaure bracket and ending quote // Hence include them in the proposal to replace let range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position); - return this.provideLanguageCompletionItems(location, range, language => `"[${language}]"`); + return this.provideLanguageCompletionItemsForLanguageOverrides(location, range, language => `"[${language}]"`); } return Promise.resolve([]); } diff --git a/extensions/configuration-editing/yarn.lock b/extensions/configuration-editing/yarn.lock index d5aafed1189df..36aab5fd224dc 100644 --- a/extensions/configuration-editing/yarn.lock +++ b/extensions/configuration-editing/yarn.lock @@ -7,12 +7,12 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.11.7.tgz#57682a9771a3f7b09c2497f28129a0462966524a" integrity sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA== -jsonc-parser@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" - integrity sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g== +jsonc-parser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== -vscode-nls@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" - integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== +vscode-nls@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" + integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A== diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index 4fba38d93adf1..cdcea133032b1 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "fedd206d1b2803f31a278e9b5f098ce4bc76e532" + "commitHash": "5b6f67859e895da83dc242b849480ee04ce7ce38" } }, "license": "MIT", - "version": "1.14.13", + "version": "1.14.20", "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index 916371903fbe8..acf62fab95577 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/fedd206d1b2803f31a278e9b5f098ce4bc76e532", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/85b9008b406cc9d3b1c9e779e94cc071116c8426", "name": "C", "scopeName": "source.c", "patterns": [ @@ -464,7 +464,7 @@ ] }, "backslash_escapes": { - "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3][0-7]{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", "name": "constant.character.escape.c" }, "block": { @@ -583,7 +583,7 @@ }, "case_statement": { "name": "meta.conditional.case.c", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -2874,95 +2898,219 @@ }, { "name": "meta.asm.c", - "begin": "(\\b(?:__asm__|asm)\\b)\\s*((?:volatile)?)\\s*(\\()", + "begin": "(\\b(?:__asm__|asm)\\b)\\s*((?:volatile)?)", "beginCaptures": { "1": { "name": "storage.type.asm.c" }, "2": { "name": "storage.modifier.c" - }, - "3": { - "name": "punctuation.section.parens.begin.bracket.round.assembly.c" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parens.end.bracket.round.assembly.c" } }, + "end": "(?!\\G)", "patterns": [ { - "name": "string.quoted.double.c", - "contentName": "meta.embedded.assembly.c", - "begin": "(R?)(\")", + "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\n|$)", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.c punctuation.definition.comment.begin.c" + }, + "3": { + "name": "comment.block.c" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.c punctuation.definition.comment.end.c" + }, + { + "match": "\\*", + "name": "comment.block.c" + } + ] + } + } + }, + { + "include": "#comments_context" + }, + { + "include": "#comments" + }, + { + "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\()", "beginCaptures": { "1": { - "name": "meta.encoding.c" + "name": "punctuation.section.parens.begin.bracket.round.assembly.c" }, "2": { - "name": "punctuation.definition.string.begin.assembly.c" + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.c punctuation.definition.comment.begin.c" + }, + "4": { + "name": "comment.block.c" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.c punctuation.definition.comment.end.c" + }, + { + "match": "\\*", + "name": "comment.block.c" + } + ] } }, - "end": "(\")", + "end": "(\\))", "endCaptures": { "1": { - "name": "punctuation.definition.string.end.assembly.c" + "name": "punctuation.section.parens.end.bracket.round.assembly.c" } }, "patterns": [ { - "include": "source.asm" - }, - { - "include": "source.x86" + "name": "string.quoted.double.c", + "contentName": "meta.embedded.assembly.c", + "begin": "(R?)(\")", + "beginCaptures": { + "1": { + "name": "meta.encoding.c" + }, + "2": { + "name": "punctuation.definition.string.begin.assembly.c" + } + }, + "end": "(\")", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.assembly.c" + } + }, + "patterns": [ + { + "include": "source.asm" + }, + { + "include": "source.x86" + }, + { + "include": "source.x86_64" + }, + { + "include": "source.arm" + }, + { + "include": "#backslash_escapes" + }, + { + "include": "#string_escaped_char" + } + ] }, { - "include": "source.x86_64" + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.c" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.parens.end.bracket.round.assembly.inner.c" + } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] }, { - "include": "source.arm" + "match": "\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))([a-zA-Z_]\\w*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.c punctuation.definition.comment.begin.c" + }, + "3": { + "name": "comment.block.c" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.c punctuation.definition.comment.end.c" + }, + { + "match": "\\*", + "name": "comment.block.c" + } + ] + }, + "5": { + "name": "variable.other.asm.label.c" + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.c punctuation.definition.comment.begin.c" + }, + "8": { + "name": "comment.block.c" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.c punctuation.definition.comment.end.c" + }, + { + "match": "\\*", + "name": "comment.block.c" + } + ] + } + } }, { - "include": "#backslash_escapes" + "match": ":", + "name": "punctuation.separator.delimiter.colon.assembly.c" }, { - "include": "#string_escaped_char" + "include": "#comments_context" }, { - "match": "(?=not)possible" + "include": "#comments" } ] - }, - { - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.c" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parens.end.bracket.round.assembly.inner.c" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - { - "match": ":", - "name": "punctuation.separator.delimiter.colon.assembly.c" - }, - { - "include": "#comments_context" - }, - { - "include": "#comments" } ] } @@ -3051,7 +3199,7 @@ }, "switch_conditional_parentheses": { "name": "meta.conditional.switch.c", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3099,7 +3247,7 @@ }, "switch_statement": { "name": "meta.block.switch.c", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?:protected|private|public))\\s*(:))", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "storage.type.modifier.access.control.$6.cpp" - }, - "7": { - "name": "punctuation.separator.colon.access.control.cpp" - } - } - }, "alignas_attribute": { - "name": "support.other.attribute.cpp", - "begin": "(alignas\\()", + "begin": "alignas\\(", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:\\n)|$)", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + }, + { + "include": "#comments_context" + }, + { + "include": "#comments" + }, + { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\(", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "name": "variable.other.asm.label.cpp" + }, + "6": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } }, { - "include": "#backslash_escapes" + "match": ":", + "name": "punctuation.separator.delimiter.colon.assembly.cpp" }, { - "include": "#string_escaped_char" + "include": "#comments_context" }, { - "match": "(?=not)possible" - } - ] - }, - { - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", - "captures": { - "1": { - "name": "storage.type.class.declare.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.class.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "name": "variable.other.object.declare.cpp" - }, - "21": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "comma": { - "match": ",", - "name": "punctuation.separator.delimiter.comma.cpp" - }, - "comma_in_template_argument": { - "match": ",", - "name": "punctuation.separator.delimiter.comma.template.argument.cpp" - }, "comments": { "patterns": [ { - "name": "comment.line.double-slash.documentation.cpp", - "begin": "(?:^)(?>\\s*)(\\/\\/[!\\/]+)", + "begin": "^(?:(?:\\s)+)?+(\\/\\/[!\\/]+)", + "end": "(?<=\\n)(?|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1186,7 +1077,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@]b)(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1197,7 +1088,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1216,12 +1107,20 @@ "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?(?:(?:\\s)+)?(?:in|out)(?:(?:\\s)+)?)+)\\])?(?:\\s)+(\\b\\w+\\b)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" }, "2": { + "patterns": [ + { + "match": "in|out", + "name": "keyword.other.parameter.direction.$0.cpp" + } + ] + }, + "3": { "name": "variable.parameter.cpp" } } @@ -1253,7 +1152,7 @@ "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1264,7 +1163,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@]b)(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1275,7 +1174,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1294,14 +1193,22 @@ "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?(?:(?:\\s)+)?(?:in|out)(?:(?:\\s)+)?)+)\\])?(?:\\s)+(\\b\\w+\\b)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" }, "2": { - "name": "variable.parameter.cpp" - } + "patterns": [ + { + "match": "in|out", + "name": "keyword.other.parameter.direction.$0.cpp" + } + ] + }, + "3": { + "name": "variable.parameter.cpp" + } } }, { @@ -1325,26 +1232,26 @@ "name": "comment.block.documentation.cpp" }, { - "name": "comment.block.documentation.cpp", - "begin": "((?>\\s*)\\/\\*[!*]+(?:(?:\\n|$)|(?=\\s)))", + "begin": "(?:(?:\\s)+)?+\\/\\*[!*]+(?:(?:(?:\\n)|$)|(?=\\s))", + "end": "[!*]*\\*\\/|(?=(?|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1355,7 +1262,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@]b)(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1366,7 +1273,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1385,12 +1292,20 @@ "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?(?:(?:\\s)+)?(?:in|out)(?:(?:\\s)+)?)+)\\])?(?:\\s)+(\\b\\w+\\b)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" }, "2": { + "patterns": [ + { + "match": "in|out", + "name": "keyword.other.parameter.direction.$0.cpp" + } + ] + }, + "3": { "name": "variable.parameter.cpp" } } @@ -1410,7 +1325,7 @@ ] }, { - "include": "#emacs_file_banner" + "include": "source.cpp#emacs_file_banner" }, { "include": "#block_comment" @@ -1419,31 +1334,31 @@ "include": "#line_comment" }, { - "include": "#invalid_comment_end" + "include": "source.cpp#invalid_comment_end" } ] }, "constructor_inline": { - "name": "meta.function.definition.special.constructor.cpp", - "begin": "(^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:constexpr)|(?:explicit)|(?:mutable)|(?:virtual)|(?:inline)|(?:friend))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { - "include": "#functional_specifiers_pre_parameters" + "include": "source.cpp#functional_specifiers_pre_parameters" }, { - "begin": "(:)", + "begin": ":", + "end": "(?=\\{)|(?=(?(?:(?>[^<>]*)\\g<3>?)+)>)\\s*)?(\\()", + "begin": "((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "\\s*+((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*)(((?>(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))::((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\14((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\())", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" + } + } + }, + { + "include": "source.cpp#functional_specifiers_pre_parameters" + }, + { + "begin": ":", + "end": "(?=\\{)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { + "begin": "((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)|(?=(?(?:(?>[^<>]*)\\g<3>?)+)>)\\s*)?(\\()", - "beginCaptures": { - "1": { - "name": "entity.name.function.call.initializer.cpp" - }, - "2": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" + "include": "#template_call_range" } ] }, + "3": {}, "4": { "name": "punctuation.section.arguments.begin.bracket.round.function.call.initializer.cpp" } }, - "end": "(\\))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\{)", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\{)", + "end": "\\}|(?=(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(~(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:constexpr)|(?:explicit)|(?:mutable)|(?:virtual)|(?:inline)|(?:friend))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)(~(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { - "contentName": "meta.function.definition.parameters.special.member.destructor.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))~\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*)(((?>(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))::((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))~\\14((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\())", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { - "contentName": "meta.function.definition.parameters.special.member.destructor.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:error|warning)))\\b\\s*", + "begin": "(^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?((?:error|warning)))\\b(?:(?:\\s)+)?", + "end": "(?[#;\\/=*C~]+)(?![#;\\/=*C~]))\\s*.+\\s*\\8\\s*(?:\\n|$)))|(^\\s*((\\/\\*)\\s*?((?>[#;\\/=*C~]+)(?![#;\\/=*C~]))\\s*.+\\s*\\8\\s*\\*\\/)))", - "captures": { - "1": { - "name": "meta.toc-list.banner.double-slash.cpp" - }, - "2": { - "name": "comment.line.double-slash.cpp" - }, - "3": { - "name": "punctuation.definition.comment.cpp" - }, - "4": { - "name": "meta.banner.character.cpp" - }, - "5": { - "name": "meta.toc-list.banner.block.cpp" - }, - "6": { - "name": "comment.line.banner.cpp" - }, - "7": { - "name": "punctuation.definition.comment.cpp" - }, - "8": { - "name": "meta.banner.character.cpp" - } - } - }, - "empty_square_brackets": { - "name": "storage.modifier.array.bracket.square.cpp", - "match": "(?-mix:(?-mix:(?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?(::))?\\s*((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?(::))?(?:(?:\\s)+)?((?|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", - "captures": { - "1": { - "name": "storage.type.enum.declare.cpp" + "evaluation_context": { + "patterns": [ + { + "include": "#ever_present_context" }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + { + "include": "#string_context" }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "include": "source.cpp#number_literal" }, - "4": { - "name": "comment.block.cpp" + { + "include": "#method_access" }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + { + "include": "source.cpp#member_access" }, - "6": { - "name": "entity.name.type.enum.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "name": "variable.other.object.declare.cpp" - }, - "21": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "enumerator_list": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(extern)(?=\\s*\\\")", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(extern)(?=\\s*\\\"))", - "beginCaptures": { - "1": { - "name": "meta.head.extern.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { "name": "storage.type.extern.cpp" } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", + "begin": "((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<11>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<11>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)|(?=(?))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\())", + "begin": "(?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\()", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))", + "match": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))", "captures": { "1": { "name": "storage.modifier.$1.cpp" @@ -4002,7 +3645,7 @@ "2": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -4028,23 +3671,23 @@ } ] }, - "12": { - "name": "storage.modifier.$1.cpp" + "11": { + "name": "storage.modifier.$11.cpp" }, - "13": { + "12": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "14": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "15": { + "14": { "name": "comment.block.cpp" }, - "16": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -4056,11 +3699,11 @@ } ] }, - "17": { + "16": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -4264,20 +3927,20 @@ } ] }, - "45": { + "42": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "46": { + "43": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "47": { + "44": { "name": "comment.block.cpp" }, - "48": { + "45": { "patterns": [ { "match": "\\*\\/", @@ -4289,20 +3952,20 @@ } ] }, - "49": { + "46": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "50": { + "47": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "51": { + "48": { "name": "comment.block.cpp" }, - "52": { + "49": { "patterns": [ { "match": "\\*\\/", @@ -4314,20 +3977,20 @@ } ] }, - "53": { + "50": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "54": { + "51": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "55": { + "52": { "name": "comment.block.cpp" }, - "56": { + "53": { "patterns": [ { "match": "\\*\\/", @@ -4339,20 +4002,20 @@ } ] }, - "57": { + "54": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "58": { + "55": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "59": { + "56": { "name": "comment.block.cpp" }, - "60": { + "57": { "patterns": [ { "match": "\\*\\/", @@ -4364,23 +4027,23 @@ } ] }, - "61": { + "58": { "name": "storage.type.modifier.calling-convention.cpp" }, - "62": { + "59": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "63": { + "60": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "64": { + "61": { "name": "comment.block.cpp" }, - "65": { + "62": { "patterns": [ { "match": "\\*\\/", @@ -4392,17 +4055,17 @@ } ] }, - "66": { + "63": { "patterns": [ { - "include": "#scope_resolution_function_definition_inner_generated" + "include": "source.cpp#scope_resolution_function_definition_inner_generated" } ] }, - "67": { + "64": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" }, - "69": { + "65": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4410,23 +4073,24 @@ } ] }, - "71": { + "66": {}, + "67": { "name": "entity.name.function.definition.cpp" }, - "72": { + "68": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "73": { + "69": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "74": { + "70": { "name": "comment.block.cpp" }, - "75": { + "71": { "patterns": [ { "match": "\\*\\/", @@ -4439,35 +4103,37 @@ ] } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()|(?=(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -4739,20 +4429,20 @@ } ] }, - "29": { + "27": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -4764,20 +4454,20 @@ } ] }, - "33": { + "31": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -4789,20 +4479,20 @@ } ] }, - "37": { + "35": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "38": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "37": { "name": "comment.block.cpp" }, - "40": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -4814,36 +4504,35 @@ } ] }, - "41": { + "39": { "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "42": { + "40": { "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "43": { + "41": { "name": "variable.other.definition.pointer.function.cpp" }, - "44": { + "42": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "45": { + "43": { "patterns": [ { "include": "#evaluation_context" } ] }, - "46": { + "44": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "47": { + "45": { "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" }, - "48": { + "46": { "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()|(?=(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -5091,20 +4801,20 @@ } ] }, - "29": { + "27": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -5116,20 +4826,20 @@ } ] }, - "33": { + "31": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -5141,20 +4851,20 @@ } ] }, - "37": { + "35": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "38": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "37": { "name": "comment.block.cpp" }, - "40": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -5166,36 +4876,35 @@ } ] }, - "41": { + "39": { "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "42": { + "40": { "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "43": { + "41": { "name": "variable.parameter.pointer.function.cpp" }, - "44": { + "42": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "45": { + "43": { "patterns": [ { "include": "#evaluation_context" } ] }, - "46": { + "44": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "47": { + "45": { "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" }, - "48": { + "46": { "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", - "captures": { - "1": { - "name": "keyword.control.goto.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + "inheritance_context": { + "patterns": [ + { + "include": "#ever_present_context" }, - "6": { - "name": "entity.name.label.call.cpp" - } - } - }, - "include": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + { + "match": ",", + "name": "punctuation.separator.delimiter.comma.inheritance.cpp" }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "match": "(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))", + "captures": { + "1": { + "name": "meta.qualified_type.cpp", + "patterns": [ + { + "match": "(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", - "captures": { - "1": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "3": { + "5": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "4": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "5": { - "name": "comment.block.cpp" - }, "6": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, "7": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#scope_resolution_inner_generated" } ] }, "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, "9": { - "name": "comment.block.cpp" - }, - "10": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, + "10": {}, + "11": { + "name": "entity.name.scope-resolution.cpp" + }, "12": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#scope_resolution_inner_generated" + "include": "#template_call_range" } ] }, - "13": { + "13": {}, + "14": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, "15": { - "name": "meta.template.call.cpp", "patterns": [ { - "include": "#template_call_range" + "include": "source.cpp#inline_comment" } ] }, - "17": { - "name": "entity.name.scope-resolution.cpp" - }, - "18": { - "name": "meta.template.call.cpp", + "16": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + "17": { + "name": "entity.name.type.cpp" }, - "21": { + "18": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#inline_comment" + "include": "#template_call_range" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "25": { - "name": "entity.name.type.cpp" - }, - "26": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } + "19": {} } } ] }, - "inline_comment": { - "match": "(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/))", - "captures": { - "1": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "2": { - "name": "comment.block.cpp" - }, - "3": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "invalid_comment_end": { - "match": "\\*\\/", - "name": "invalid.illegal.unexpected.punctuation.definition.comment.end.cpp" - }, - "label": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "entity.name.label.cpp" - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "name": "punctuation.separator.label.cpp" - } - } - }, "lambdas": { - "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[))((?:[^\\]\\[]*\\[.*?\\](?!\\s*\\[)[^\\]\\[]*?)*[^\\]\\[]*?)(\\](?!\\[)))", + "begin": "(?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))(?:(?:\\s)+)?(\\[(?!\\[| *+\"| *+\\d))((?:[^\\[\\]]|((??)++\\]))*+)(\\](?!((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))[\\[\\];]))", + "end": "(?<=[;}])|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", + "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", "captures": { "1": { "name": "variable.parameter.capture.cpp" @@ -5815,7 +5273,7 @@ "2": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -5850,26 +5308,52 @@ } ] }, + "3": {}, "4": { "name": "punctuation.definition.capture.end.lambda.cpp" + }, + "5": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "6": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "7": { + "name": "comment.block.cpp" + }, + "8": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } }, - "end": "(?<=})|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*line\\b)", + "begin": "^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?line\\b", + "end": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*define\\b)\\s*((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?define\\b)(?:(?:\\s)+)?((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", - "captures": { + "method_access": { + "begin": "(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:(?:\\s)+)?(?:(?:\\.\\*|\\.)|(?:->\\*|->))(?:(?:\\s)+)?)*)(?:(?:\\s)+)?(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)(?:(?:\\s)+)?(\\()", + "end": "\\)|(?=(?|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))(?:(?:\\s)+)?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -6166,12 +5638,12 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -6208,7 +5680,7 @@ } }, { - "include": "#member_access" + "include": "source.cpp#member_access" }, { "include": "#method_access" @@ -6216,229 +5688,204 @@ ] }, "10": { - "name": "variable.other.property.cpp" + "name": "entity.name.function.member.cpp" + }, + "11": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.cpp" } - } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] }, - "memory_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" + "ms_attributes": { + "begin": "__declspec\\(", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", + "namespace_block": { + "begin": "((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "variable.language.this.cpp" - }, - "6": { - "name": "variable.other.object.property.cpp" - }, - "7": { - "name": "punctuation.separator.dot-access.cpp" - }, - "8": { - "name": "punctuation.separator.pointer-access.cpp" - } - } + "include": "#attributes_context" }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<4>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)(?:(?:\\s)+)?((?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", - "captures": { + "noexcept_operator": { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*)(operator)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*)(?:(?:((?:(?:delete\\[\\])|(?:delete)|(?:new\\[\\])|(?:<=>)|(?:<<=)|(?:new)|(?:>>=)|(?:\\->\\*)|(?:\\/=)|(?:%=)|(?:&=)|(?:>=)|(?:\\|=)|(?:\\+\\+)|(?:\\-\\-)|(?:\\(\\))|(?:\\[\\])|(?:\\->)|(?:\\+\\+)|(?:<<)|(?:>>)|(?:\\-\\-)|(?:<=)|(?:\\^=)|(?:==)|(?:!=)|(?:&&)|(?:\\|\\|)|(?:\\+=)|(?:\\-=)|(?:\\*=)|,|(?:\\+)|(?:\\-)|!|~|(?:\\*)|&|(?:\\*)|(?:\\/)|%|(?:\\+)|(?:\\-)|<|>|&|(?:\\^)|(?:\\|)|=))|((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\<|\\()", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|(?=(?(?:(?>[^<>]*)\\g<9>?)+)>)\\s*)?::)*\\s*+)\\s*((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?(?:(?>[^<>]*)\\g<5>?)+)>)\\s*)?::)*\\s*+)\\s*((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#scope_resolution_namespace_block_inner_generated" + "include": "source.cpp#inline_comment" } ] }, "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" }, "4": { - "name": "meta.template.call.cpp", "patterns": [ { - "include": "#template_call_range" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" } ] - }, - "6": { - "name": "entity.name.namespace.cpp" - }, - "7": { - "name": "punctuation.separator.scope-resolution.namespace.block.cpp" - }, - "8": { - "name": "storage.modifier.inline.cpp" } - } - } - ] - }, - { - "name": "meta.body.namespace.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.operator.noexcept.cpp" }, - "2": { + "27": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "3": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "29": { "name": "comment.block.cpp" }, - "5": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -6831,39 +6173,20 @@ } ] }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.operator.noexcept.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\<|\\())", - "beginCaptures": { - "1": { - "name": "meta.head.function.definition.special.operator-overload.cpp" }, - "2": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -7362,24 +6422,24 @@ }, { "match": "\\&", - "name": "storage.modifier.reference.cpp" + "name": "entity.name.operator.type.reference.cpp" } ] }, - "30": { + "66": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "31": { + "67": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "32": { + "68": { "name": "comment.block.cpp" }, - "33": { + "69": { "patterns": [ { "match": "\\*\\/", @@ -7391,20 +6451,20 @@ } ] }, - "34": { + "70": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "35": { + "71": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "36": { + "72": { "name": "comment.block.cpp" }, - "37": { + "73": { "patterns": [ { "match": "\\*\\/", @@ -7416,20 +6476,20 @@ } ] }, - "38": { + "74": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "39": { + "75": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "40": { + "76": { "name": "comment.block.cpp" }, - "41": { + "77": { "patterns": [ { "match": "\\*\\/", @@ -7441,20 +6501,26 @@ } ] }, - "42": { + "78": { + "name": "entity.name.operator.type.array.cpp" + }, + "79": { + "name": "entity.name.operator.custom-literal.cpp" + }, + "80": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "43": { + "81": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "44": { + "82": { "name": "comment.block.cpp" }, - "45": { + "83": { "patterns": [ { "match": "\\*\\/", @@ -7466,23 +6532,23 @@ } ] }, - "46": { - "name": "storage.type.modifier.calling-convention.cpp" + "84": { + "name": "entity.name.operator.custom-literal.cpp" }, - "47": { + "85": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "48": { + "86": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "49": { + "87": { "name": "comment.block.cpp" }, - "50": { + "88": { "patterns": [ { "match": "\\*\\/", @@ -7493,385 +6559,378 @@ "name": "comment.block.cpp" } ] - }, - "51": { - "patterns": [ - { - "include": "#inline_comment" + } + }, + "endCaptures": {}, + "name": "meta.function.definition.special.operator-overload.cpp", + "patterns": [ + { + "begin": "\\G ?", + "end": "(?:\\{|<%|\\?\\?<|(?=;))|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "3": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.cpp" + } + }, + "contentName": "meta.arguments.operator.sizeof", + "patterns": [ { - "match": "\\&", - "name": "entity.name.operator.type.reference.cpp" + "include": "#evaluation_context" } ] }, - "71": { + { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?|\\?\\?>)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\w)", + "end": "(?:(?=\\))|(,))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", + "match": "((?:((?:(?:volatile)|(?:register)|(?:restrict)|(?:static)|(?:extern)|(?:const)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))+)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=,|\\)|=)", "captures": { "1": { "patterns": [ @@ -7998,7 +7041,7 @@ "3": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8023,7 +7066,7 @@ "7": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8048,7 +7091,7 @@ "11": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8073,7 +7116,7 @@ "15": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8101,7 +7144,7 @@ "20": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8129,7 +7172,7 @@ "25": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8157,7 +7200,7 @@ "30": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8188,7 +7231,7 @@ "36": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8216,15 +7259,16 @@ "include": "#storage_types" }, { - "include": "#scope_resolution_parameter_inner_generated" + "include": "source.cpp#scope_resolution_parameter_inner_generated" }, { - "match": "(?:struct|class|union|enum)", + "match": "(?:(?:struct)|(?:class)|(?:union)|(?:enum))", "name": "storage.type.$0.cpp" }, { "begin": "(?<==)", "end": "(?:(?=\\))|(,))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\)|,|\\[|=|\\n)", + "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\)|,|\\[|=|\\n)", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8273,7 +7318,7 @@ "6": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8301,19 +7346,19 @@ "include": "#attributes_context" }, { - "name": "meta.bracket.square.array.cpp", - "begin": "(\\[)", + "begin": "\\[", + "end": "\\]|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", + "match": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*))", "captures": { "0": { "patterns": [ @@ -8337,12 +7382,12 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8376,7 +7421,7 @@ "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8401,7 +7446,7 @@ "5": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -8427,26 +7472,24 @@ } ] }, - "parameter_class": { - "match": "(class)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { + "parameter_or_maybe_value": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\w)", + "end": "(?:(?=\\))|(,))|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))+)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=,|\\)|=)", + "captures": { + "1": { + "patterns": [ + { + "include": "#storage_types" + } + ] }, - { - "match": "\\*", + "2": { + "name": "storage.modifier.specifier.parameter.cpp" + }, + "3": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "4": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "5": { "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "6": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "3": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "7": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "8": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "9": { "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "10": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "11": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "12": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "13": { "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_enum": { - "match": "(enum)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.enum.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.enum.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "14": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] }, - { - "match": "\\*", + "15": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "16": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "17": { "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_or_maybe_value": { - "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "end": "(?:(?=\\))|(,))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", - "captures": { - "1": { + "18": { "patterns": [ { - "include": "#storage_types" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" } ] }, - "2": { - "name": "storage.modifier.specifier.parameter.cpp" + "19": { + "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" }, - "3": { + "20": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "4": { + "21": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "5": { + "22": { "name": "comment.block.cpp" }, - "6": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "12": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "13": { - "name": "comment.block.cpp" - }, - "14": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "15": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "16": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "17": { - "name": "comment.block.cpp" - }, - "18": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "19": { - "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { + "23": { "patterns": [ { "match": "\\*\\/", @@ -9146,7 +7677,7 @@ "25": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -9174,7 +7705,7 @@ "30": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -9205,7 +7736,7 @@ "36": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -9225,3682 +7756,267 @@ "match": "\\*", "name": "comment.block.cpp" } - ] - } - } - }, - { - "include": "#storage_types" - }, - { - "include": "#function_call" - }, - { - "include": "#scope_resolution_parameter_inner_generated" - }, - { - "match": "(?:struct|class|union|enum)", - "name": "storage.type.$0.cpp" - }, - { - "begin": "(?<==)", - "end": "(?:(?=\\))|(,))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "variable.parameter.cpp" - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - { - "include": "#attributes_context" - }, - { - "name": "meta.bracket.square.array.cpp", - "begin": "(\\[)", - "beginCaptures": { - "1": { - "name": "punctuation.definition.begin.bracket.square.array.type.cpp" - } - }, - "end": "(\\])|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", - "captures": { - "0": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "6": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "7": { - "name": "comment.block.cpp" - }, - "8": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - { - "include": "#evaluation_context" - } - ] - }, - "parameter_struct": { - "match": "(struct)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.struct.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.struct.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_union": { - "match": "(union)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.union.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.union.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parentheses": { - "name": "meta.parens.cpp", - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parens.begin.bracket.round.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\b)", - "beginCaptures": { - "1": { - "name": "keyword.control.directive.pragma.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.definition.directive.cpp" - } - }, - "end": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\s+mark)\\s+(.*)", - "captures": { - "1": { - "name": "keyword.control.directive.pragma.pragma-mark.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.definition.directive.cpp" - }, - "7": { - "name": "entity.name.tag.pragma-mark.cpp" - } - }, - "name": "meta.preprocessor.pragma.cpp" - }, - "predefined_macros": { - "patterns": [ - { - "match": "\\b(__cplusplus|__DATE__|__FILE__|__LINE__|__STDC__|__STDC_HOSTED__|__STDC_NO_COMPLEX__|__STDC_VERSION__|__STDCPP_THREADS__|__TIME__|NDEBUG|__OBJC__|__ASSEMBLER__|__ATOM__|__AVX__|__AVX2__|_CHAR_UNSIGNED|__CLR_VER|_CONTROL_FLOW_GUARD|__COUNTER__|__cplusplus_cli|__cplusplus_winrt|_CPPRTTI|_CPPUNWIND|_DEBUG|_DLL|__FUNCDNAME__|__FUNCSIG__|__FUNCTION__|_INTEGRAL_MAX_BITS|__INTELLISENSE__|_ISO_VOLATILE|_KERNEL_MODE|_M_AMD64|_M_ARM|_M_ARM_ARMV7VE|_M_ARM_FP|_M_ARM64|_M_CEE|_M_CEE_PURE|_M_CEE_SAFE|_M_FP_EXCEPT|_M_FP_FAST|_M_FP_PRECISE|_M_FP_STRICT|_M_IX86|_M_IX86_FP|_M_X64|_MANAGED|_MSC_BUILD|_MSC_EXTENSIONS|_MSC_FULL_VER|_MSC_VER|_MSVC_LANG|__MSVC_RUNTIME_CHECKS|_MT|_NATIVE_WCHAR_T_DEFINED|_OPENMP|_PREFAST|__TIMESTAMP__|_VC_NO_DEFAULTLIB|_WCHAR_T_DEFINED|_WIN32|_WIN64|_WINRT_DLL|_ATL_VER|_MFC_VER|__GFORTRAN__|__GNUC__|__GNUC_MINOR__|__GNUC_PATCHLEVEL__|__GNUG__|__STRICT_ANSI__|__BASE_FILE__|__INCLUDE_LEVEL__|__ELF__|__VERSION__|__OPTIMIZE__|__OPTIMIZE_SIZE__|__NO_INLINE__|__GNUC_STDC_INLINE__|__CHAR_UNSIGNED__|__WCHAR_UNSIGNED__|__REGISTER_PREFIX__|__REGISTER_PREFIX__|__SIZE_TYPE__|__PTRDIFF_TYPE__|__WCHAR_TYPE__|__WINT_TYPE__|__INTMAX_TYPE__|__UINTMAX_TYPE__|__SIG_ATOMIC_TYPE__|__INT8_TYPE__|__INT16_TYPE__|__INT32_TYPE__|__INT64_TYPE__|__UINT8_TYPE__|__UINT16_TYPE__|__UINT32_TYPE__|__UINT64_TYPE__|__INT_LEAST8_TYPE__|__INT_LEAST16_TYPE__|__INT_LEAST32_TYPE__|__INT_LEAST64_TYPE__|__UINT_LEAST8_TYPE__|__UINT_LEAST16_TYPE__|__UINT_LEAST32_TYPE__|__UINT_LEAST64_TYPE__|__INT_FAST8_TYPE__|__INT_FAST16_TYPE__|__INT_FAST32_TYPE__|__INT_FAST64_TYPE__|__UINT_FAST8_TYPE__|__UINT_FAST16_TYPE__|__UINT_FAST32_TYPE__|__UINT_FAST64_TYPE__|__INTPTR_TYPE__|__UINTPTR_TYPE__|__CHAR_BIT__|__SCHAR_MAX__|__WCHAR_MAX__|__SHRT_MAX__|__INT_MAX__|__LONG_MAX__|__LONG_LONG_MAX__|__WINT_MAX__|__SIZE_MAX__|__PTRDIFF_MAX__|__INTMAX_MAX__|__UINTMAX_MAX__|__SIG_ATOMIC_MAX__|__INT8_MAX__|__INT16_MAX__|__INT32_MAX__|__INT64_MAX__|__UINT8_MAX__|__UINT16_MAX__|__UINT32_MAX__|__UINT64_MAX__|__INT_LEAST8_MAX__|__INT_LEAST16_MAX__|__INT_LEAST32_MAX__|__INT_LEAST64_MAX__|__UINT_LEAST8_MAX__|__UINT_LEAST16_MAX__|__UINT_LEAST32_MAX__|__UINT_LEAST64_MAX__|__INT_FAST8_MAX__|__INT_FAST16_MAX__|__INT_FAST32_MAX__|__INT_FAST64_MAX__|__UINT_FAST8_MAX__|__UINT_FAST16_MAX__|__UINT_FAST32_MAX__|__UINT_FAST64_MAX__|__INTPTR_MAX__|__UINTPTR_MAX__|__WCHAR_MIN__|__WINT_MIN__|__SIG_ATOMIC_MIN__|__SCHAR_WIDTH__|__SHRT_WIDTH__|__INT_WIDTH__|__LONG_WIDTH__|__LONG_LONG_WIDTH__|__PTRDIFF_WIDTH__|__SIG_ATOMIC_WIDTH__|__SIZE_WIDTH__|__WCHAR_WIDTH__|__WINT_WIDTH__|__INT_LEAST8_WIDTH__|__INT_LEAST16_WIDTH__|__INT_LEAST32_WIDTH__|__INT_LEAST64_WIDTH__|__INT_FAST8_WIDTH__|__INT_FAST16_WIDTH__|__INT_FAST32_WIDTH__|__INT_FAST64_WIDTH__|__INTPTR_WIDTH__|__INTMAX_WIDTH__|__SIZEOF_INT__|__SIZEOF_LONG__|__SIZEOF_LONG_LONG__|__SIZEOF_SHORT__|__SIZEOF_POINTER__|__SIZEOF_FLOAT__|__SIZEOF_DOUBLE__|__SIZEOF_LONG_DOUBLE__|__SIZEOF_SIZE_T__|__SIZEOF_WCHAR_T__|__SIZEOF_WINT_T__|__SIZEOF_PTRDIFF_T__|__BYTE_ORDER__|__ORDER_LITTLE_ENDIAN__|__ORDER_BIG_ENDIAN__|__ORDER_PDP_ENDIAN__|__FLOAT_WORD_ORDER__|__DEPRECATED|__EXCEPTIONS|__GXX_RTTI|__USING_SJLJ_EXCEPTIONS__|__GXX_EXPERIMENTAL_CXX0X__|__GXX_WEAK__|__NEXT_RUNTIME__|__LP64__|_LP64|__SSP__|__SSP_ALL__|__SSP_STRONG__|__SSP_EXPLICIT__|__SANITIZE_ADDRESS__|__SANITIZE_THREAD__|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16|__HAVE_SPECULATION_SAFE_VALUE|__GCC_HAVE_DWARF2_CFI_ASM|__FP_FAST_FMA|__FP_FAST_FMAF|__FP_FAST_FMAL|__FP_FAST_FMAF16|__FP_FAST_FMAF32|__FP_FAST_FMAF64|__FP_FAST_FMAF128|__FP_FAST_FMAF32X|__FP_FAST_FMAF64X|__FP_FAST_FMAF128X|__GCC_IEC_559|__GCC_IEC_559_COMPLEX|__NO_MATH_ERRNO__|__has_builtin|__has_feature|__has_extension|__has_cpp_attribute|__has_c_attribute|__has_attribute|__has_declspec_attribute|__is_identifier|__has_include|__has_include_next|__has_warning|__BASE_FILE__|__FILE_NAME__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__fp16|_Float16)\\b", - "captures": { - "1": { - "name": "entity.name.other.preprocessor.macro.predefined.$1.cpp" - } - } - }, - { - "match": "\\b__([A-Z_]+)__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.probably.$1.cpp" - } - ] - }, - "preprocessor_conditional_context": { - "patterns": [ - { - "include": "#preprocessor_conditional_defined" - }, - { - "include": "#comments" - }, - { - "include": "#language_constants" - }, - { - "include": "#string_context_c" - }, - { - "include": "#preprocessor_number_literal" - }, - { - "include": "#operators" - }, - { - "include": "#predefined_macros" - }, - { - "include": "#macro_name" - }, - { - "include": "#line_continuation_character" - } - ] - }, - "preprocessor_conditional_defined": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:(?:ifndef|ifdef)|if)))", - "beginCaptures": { - "1": { - "name": "keyword.control.directive.conditional.$7.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.definition.directive.cpp" - } - }, - "end": "(?:^)(?!\\s*+#\\s*(?:else|endif))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", - "captures": { - "0": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_function_call": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_function_call_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_function_call_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_function_call_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.function.call.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" - } - } - }, - "scope_resolution_function_definition": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_function_definition_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.function.definition.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - } - } - }, - "scope_resolution_function_definition_operator_overload": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_operator_overload_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_function_definition_operator_overload_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_operator_overload_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.function.definition.operator-overload.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - } - } - }, - "scope_resolution_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - } - } - }, - "scope_resolution_namespace_alias": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_alias_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_namespace_alias_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_alias_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.namespace.alias.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - } - } - }, - "scope_resolution_namespace_block": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_block_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_namespace_block_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_block_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.namespace.block.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" - } - } - }, - "scope_resolution_namespace_using": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_using_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_namespace_using_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_using_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.namespace.using.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" - } - } - }, - "scope_resolution_parameter": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_parameter_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_parameter_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_parameter_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.parameter.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - } - } - }, - "scope_resolution_template_call": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_template_call_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_template_call_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_template_call_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.template.call.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - } - } - }, - "scope_resolution_template_definition": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_template_definition_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_template_definition_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_template_definition_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.template.definition.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" - } - } - }, - "semicolon": { - "match": ";", - "name": "punctuation.terminator.statement.cpp" - }, - "simple_type": { - "match": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?", - "captures": { - "1": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "single_line_macro": { - "match": "^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))#define.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.variadic.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "keyword.other.static_assert.cpp" - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "name": "punctuation.section.arguments.begin.bracket.round.static_assert.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.struct.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" - }, - "4": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "9": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "10": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "11": { - "name": "comment.block.cpp" - }, - "12": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" - }, - "14": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ - { - "include": "#attributes_context" - }, - { - "include": "#number_literal" - } - ] - }, - "19": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "21": { - "name": "comment.block.cpp" - }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "25": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "26": { - "name": "comment.block.cpp" - }, - "27": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", - "captures": { - "1": { - "name": "storage.type.struct.declare.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.struct.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "name": "variable.other.object.declare.cpp" - }, - "21": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "switch_conditional_parentheses": { - "name": "meta.conditional.switch.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "5": { - "name": "punctuation.section.parens.begin.bracket.round.conditional.switch.cpp" - } - }, - "end": "(\\))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:(?:\\n)|$)))", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "name": "variable.parameter.cpp" + }, + "6": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } }, { - "include": "#operators" + "include": "#attributes_context" }, { - "include": "#number_literal" + "begin": "\\[", + "end": "\\]|(?=(?(?:(?>[^<>]*)\\g<1>?)+)>)\\s*", - "captures": { - "0": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" + "match": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*))", + "captures": { + "0": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "6": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "7": { + "name": "comment.block.cpp" + }, + "8": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] - } - } - }, - "template_call_range": { - "name": "meta.template.call.cpp", - "begin": "(<)", - "beginCaptures": { - "1": { - "name": "punctuation.section.angle-brackets.begin.template.call.cpp" - } - }, - "end": "(>)|(?=(?)|(?=(?)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", - "captures": { + "pragma": { + "begin": "^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?pragma\\b", + "end": "(?\\s*$)", - "captures": { - "1": { - "name": "storage.type.template.cpp" - }, - "2": { - "name": "punctuation.section.angle-brackets.start.template.definition.cpp" - }, - "3": { - "name": "meta.template.definition.cpp", - "patterns": [ - { - "include": "#template_definition_context" - } - ] - }, - "4": { - "name": "punctuation.section.angle-brackets.end.template.definition.cpp" - } - } - }, - "ternary_operator": { - "applyEndPatternLast": true, - "begin": "(\\?)", - "beginCaptures": { - "1": { - "name": "keyword.operator.ternary.cpp" - } - }, - "end": "(:)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?((?:(?:ifndef|ifdef)|if))", + "end": "^(?!\\s*+#\\s*(?:else|endif))|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?:(?:(?>\\s+)|(?:\\/\\*)(?:(?>(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", - "captures": { + "sizeof_variadic_operator": { + "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" + "include": "#static_assert" }, { - "match": "\\&", - "name": "storage.modifier.reference.cpp" + "include": "#constructor_inline" + }, + { + "include": "#destructor_inline" + }, + { + "include": "$self" } ] }, - "61": { + { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?|\\?\\?>)|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?|(?=(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -13998,7 +9588,7 @@ "2": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -14023,7 +9613,7 @@ "6": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -14048,7 +9638,7 @@ "10": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -14085,289 +9675,97 @@ ] }, "typedef_function_pointer": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" + "name": "meta.qualified_type.cpp", + "patterns": [ + { + "match": "(?|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", - "beginCaptures": { - "1": { - "name": "meta.head.struct.cpp" - }, - "3": { - "name": "storage.type.$3.cpp" }, - "4": { + "11": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#scope_resolution_inner_generated" } ] }, - "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" + "12": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "7": { + "13": { + "name": "meta.template.call.cpp", "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#template_call_range" } ] }, - "8": { + "14": {}, + "15": { + "name": "entity.name.scope-resolution.cpp" + }, + "16": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#attributes_context" - }, - { - "include": "#number_literal" + "include": "#template_call_range" } ] }, - "9": { + "17": {}, + "18": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "19": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "10": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "21": { "name": "comment.block.cpp" }, - "12": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -14559,58 +9861,75 @@ } ] }, - "13": { - "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" + "23": { + "name": "entity.name.type.cpp" }, - "14": { + "24": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#inline_comment" + "include": "#template_call_range" } ] }, - "15": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "16": { - "name": "comment.block.cpp" - }, - "17": { + "25": {}, + "26": { "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, { "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "18": { - "patterns": [ + "name": "storage.modifier.pointer.cpp" + }, { - "include": "#attributes_context" + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" }, { - "include": "#number_literal" + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, - "19": { + "27": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "20": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "29": { "name": "comment.block.cpp" }, - "22": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -14622,23 +9941,20 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" - }, - "24": { + "31": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "25": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "33": { "name": "comment.block.cpp" }, - "27": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -14650,23 +9966,20 @@ } ] }, - "28": { - "name": "storage.type.modifier.final.cpp" - }, - "29": { + "35": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, - "30": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "37": { "name": "comment.block.cpp" }, - "32": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -14678,273 +9991,107 @@ } ] }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + "39": { + "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "40": { + "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "35": { - "name": "comment.block.cpp" + "41": { + "name": "entity.name.type.alias.cpp entity.name.type.pointer.function.cpp" }, - "36": { + "42": { + "name": "punctuation.definition.begin.bracket.square.cpp" + }, + "43": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#evaluation_context" } ] }, - "37": { - "name": "punctuation.separator.colon.inheritance.cpp" + "44": { + "name": "punctuation.definition.end.bracket.square.cpp" }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] + "45": { + "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" + }, + "46": { + "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "10": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "11": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "12": { - "name": "comment.block.cpp" - }, - "13": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "14": { - "name": "entity.name.type.alias.cpp" - } - } + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, { - "match": "," + "match": "\\*", + "name": "comment.block.cpp" } ] } + }, + "patterns": [ + { + "include": "#function_parameter_context" + } ] } ] }, - "typedef_union": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -15258,7 +10402,7 @@ "2": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -15283,7 +10427,7 @@ "6": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -15308,7 +10452,7 @@ "10": { "patterns": [ { - "include": "#inline_comment" + "include": "source.cpp#inline_comment" } ] }, @@ -15344,287 +10488,447 @@ } ] }, - "typeid_operator": { - "contentName": "meta.arguments.operator.typeid.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "typedef_union": { + "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", - "captures": { - "1": { - "name": "storage.modifier.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "2": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "10": { + "patterns": [ + { + "include": "source.cpp#inline_comment" + } + ] + }, + "11": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "12": { + "name": "comment.block.cpp" + }, + "13": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "14": { + "name": "entity.name.type.alias.cpp" + } + } + }, + { + "match": "," + } + ] } ] } - } + ] }, - "undef": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*undef\\b)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))|(?=(?|\\?\\?>)|(?=(?|\\?\\?>|(?=(?|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)|(?=(?|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", - "captures": { - "1": { - "name": "storage.type.union.declare.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.union.cpp" - }, - "7": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "8": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "name": "variable.other.object.declare.cpp" - }, - "21": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "using_name": { - "match": "(using)\\s+(?!namespace\\b)", - "captures": { - "1": { - "name": "keyword.other.using.directive.cpp" - } - } - }, "using_namespace": { - "name": "meta.using-namespace.cpp", - "begin": "(?(?:(?>[^<>]*)\\g<7>?)+)>)\\s*)?::)*\\s*+)?((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<6>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)?((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?:protected|private|public))\\s*(:))", + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(((?:(?:protected)|(?:private)|(?:public)))(?:(?:\\s)+)?(:))", "captures": { "1": { "patterns": [ @@ -105,45 +105,55 @@ ] }, "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "storage.type.modifier.access.control.$6.cpp" + "3": { + "name": "storage.type.modifier.access.control.$4.cpp" }, - "7": { + "4": {}, + "5": { "name": "punctuation.separator.colon.access.control.cpp" } } }, "alignas_attribute": { - "name": "support.other.attribute.cpp", - "begin": "(alignas\\()", + "begin": "alignas\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.begin.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.end.cpp" } }, + "name": "support.other.attribute.cpp", "patterns": [ { "include": "#attributes_context" @@ -151,6 +161,8 @@ { "begin": "\\(", "end": "\\)", + "beginCaptures": {}, + "endCaptures": {}, "patterns": [ { "include": "#attributes_context" @@ -161,7 +173,7 @@ ] }, { - "match": "(using)\\s+((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignas.cpp" @@ -228,12 +240,12 @@ "name": "punctuation.section.arguments.begin.bracket.round.operator.alignas.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.operator.alignas.cpp" } }, + "contentName": "meta.arguments.operator.alignas", "patterns": [ { "include": "#evaluation_context" @@ -241,8 +253,8 @@ ] }, "alignof_operator": { - "contentName": "meta.arguments.operator.alignof.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignof.cpp" @@ -276,12 +288,12 @@ "name": "punctuation.section.arguments.begin.bracket.round.operator.alignof.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.operator.alignof.cpp" } }, + "contentName": "meta.arguments.operator.alignof", "patterns": [ { "include": "#evaluation_context" @@ -289,96 +301,221 @@ ] }, "assembly": { - "name": "meta.asm.cpp", - "begin": "(\\b(?:__asm__|asm)\\b)\\s*((?:volatile)?)\\s*(\\()", + "begin": "(\\b(?:__asm__|asm)\\b)(?:(?:\\s)+)?((?:volatile)?)", + "end": "(?!\\G)", "beginCaptures": { "1": { "name": "storage.type.asm.cpp" }, "2": { "name": "storage.modifier.cpp" - }, - "3": { - "name": "punctuation.section.parens.begin.bracket.round.assembly.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parens.end.bracket.round.assembly.cpp" } }, + "endCaptures": {}, + "name": "meta.asm.cpp", "patterns": [ { - "name": "string.quoted.double.cpp", - "contentName": "meta.embedded.assembly.cpp", - "begin": "(R?)(\")", + "match": "^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:\\n)|$)", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + }, + { + "include": "#comments_context" + }, + { + "include": "#comments" + }, + { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\(", + "end": "\\)", "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.assembly.cpp" + }, "1": { - "name": "meta.encoding.cpp" + "patterns": [ + { + "include": "#inline_comment" + } + ] }, "2": { - "name": "punctuation.definition.string.begin.assembly.cpp" + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } }, - "end": "(\")", "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.assembly.cpp" + "0": { + "name": "punctuation.section.parens.end.bracket.round.assembly.cpp" } }, "patterns": [ { - "include": "source.asm" - }, - { - "include": "source.x86" + "begin": "(R?)(\")", + "end": "\"", + "beginCaptures": { + "1": { + "name": "meta.encoding.cpp" + }, + "2": { + "name": "punctuation.definition.string.begin.assembly.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.assembly.cpp" + } + }, + "name": "string.quoted.double.cpp", + "contentName": "meta.embedded.assembly", + "patterns": [ + { + "include": "source.asm" + }, + { + "include": "source.x86" + }, + { + "include": "source.x86_64" + }, + { + "include": "source.arm" + }, + { + "include": "#backslash_escapes" + }, + { + "include": "#string_escaped_char" + } + ] }, { - "include": "source.x86_64" + "begin": "\\(", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.assembly.inner.cpp" + } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] }, { - "include": "source.arm" + "match": "\\[((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "name": "variable.other.asm.label.cpp" + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } }, { - "include": "#backslash_escapes" + "match": ":", + "name": "punctuation.separator.delimiter.colon.assembly.cpp" }, { - "include": "#string_escaped_char" + "include": "#comments_context" }, { - "match": "(?=not)possible" - } - ] - }, - { - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parens.begin.bracket.round.assembly.inner.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parens.end.bracket.round.assembly.inner.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" + "include": "#comments" } ] - }, - { - "match": ":", - "name": "punctuation.separator.delimiter.colon.assembly.cpp" - }, - { - "include": "#comments_context" - }, - { - "include": "#comments" } ] }, @@ -403,23 +540,23 @@ ] }, "backslash_escapes": { - "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", - "name": "constant.character.escape.cpp" + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3][0-7]{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "name": "constant.character.escape" }, "block": { - "name": "meta.block.cpp", - "begin": "({)", + "begin": "{", + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, - "end": "(}|(?=\\s*#\\s*(?:elif|else|endif)\\b))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.cpp" } }, + "name": "meta.block.cpp", "patterns": [ { "include": "#function_body_context" @@ -427,22 +564,23 @@ ] }, "block_comment": { - "name": "comment.block.cpp", "begin": "\\s*+(\\/\\*)", + "end": "\\*\\/", "beginCaptures": { "1": { "name": "punctuation.definition.comment.begin.cpp" } }, - "end": "(\\*\\/)", "endCaptures": { - "1": { + "0": { "name": "punctuation.definition.comment.end.cpp" } - } + }, + "name": "comment.block.cpp" }, "builtin_storage_type_initilizer": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "patterns": [ @@ -610,9 +748,8 @@ "name": "punctuation.section.arguments.begin.bracket.round.initializer.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.initializer.cpp" } }, @@ -623,8 +760,8 @@ ] }, "case_statement": { - "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.class.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -705,7 +842,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -715,20 +852,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -740,23 +877,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -768,7 +905,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -778,20 +915,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -803,23 +940,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -831,23 +968,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -859,20 +996,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -884,18 +1021,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -904,16 +1033,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.class.cpp", "patterns": [ { - "name": "meta.head.class.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.class.cpp" } }, + "name": "meta.head.class.cpp", "patterns": [ { "include": "#ever_present_context" @@ -927,14 +1058,15 @@ ] }, { - "name": "meta.body.class.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.class.cpp" } }, + "name": "meta.body.class.cpp", "patterns": [ { "include": "#function_pointer" @@ -954,9 +1086,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.class.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -966,7 +1100,7 @@ ] }, "class_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.class.declare.cpp" @@ -979,34 +1113,43 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "name": "entity.name.type.class.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -1042,130 +1185,167 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "12": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { + "12": { "name": "variable.other.object.declare.cpp" }, - "21": { + "13": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { + "14": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "comma": { - "match": ",", - "name": "punctuation.separator.delimiter.comma.cpp" - }, - "comma_in_template_argument": { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + "comma": { + "match": ",", + "name": "punctuation.separator.delimiter.comma.cpp" + }, + "comma_in_template_argument": { "match": ",", "name": "punctuation.separator.delimiter.comma.template.argument.cpp" }, "comments": { "patterns": [ { - "name": "comment.line.double-slash.documentation.cpp", - "begin": "(?:^)(?>\\s*)(\\/\\/[!\\/]+)", + "begin": "^(?:(?:\\s)+)?+(\\/\\/[!\\/]+)", + "end": "(?<=\\n)(?\\s*)\\/\\*[!*]+(?:(?:\\n|$)|(?=\\s)))", + "begin": "(?:(?:\\s)+)?+\\/\\*[!*]+(?:(?:(?:\\n)|$)|(?=\\s))", + "end": "[!*]*\\*\\/", "beginCaptures": { - "1": { + "0": { "name": "punctuation.definition.comment.begin.documentation.cpp" } }, - "end": "([!*]*\\*\\/)", "endCaptures": { - "1": { + "0": { "name": "punctuation.definition.comment.end.documentation.cpp" } }, + "name": "comment.block.documentation.cpp", "patterns": [ { "match": "(?<=[\\s*!\\/])[\\\\@](?:callergraph|callgraph|else|endif|f\\$|f\\[|f\\]|hidecallergraph|hidecallgraph|hiderefby|hiderefs|hideinitializer|htmlinclude|n|nosubgrouping|private|privatesection|protected|protectedsection|public|publicsection|pure|showinitializer|showrefby|showrefs|tableofcontents|\\$|\\#|<|>|%|\"|\\.|=|::|\\||\\-\\-|\\-\\-\\-)\\b(?:\\{[^}]*\\})?", "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:a|em|e))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1355,7 +1551,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@]b)\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@]b)(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1366,7 +1562,7 @@ } }, { - "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))\\s+(\\S+)", + "match": "((?<=[\\s*!\\/])[\\\\@](?:c|p))(?:\\s)+(\\S+)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" @@ -1385,12 +1581,20 @@ "name": "storage.type.class.doxygen.cpp" }, { - "match": "((?<=[\\s*!\\/])[\\\\@]param)\\s+(\\b\\w+\\b)", + "match": "((?<=[\\s*!\\/])[\\\\@]param)(?:\\s*\\[((?:,?(?:(?:\\s)+)?(?:in|out)(?:(?:\\s)+)?)+)\\])?(?:\\s)+(\\b\\w+\\b)", "captures": { "1": { "name": "storage.type.class.doxygen.cpp" }, "2": { + "patterns": [ + { + "match": "in|out", + "name": "keyword.other.parameter.direction.$0.cpp" + } + ] + }, + "3": { "name": "variable.parameter.cpp" } } @@ -1424,26 +1628,26 @@ ] }, "constructor_inline": { - "name": "meta.function.definition.special.constructor.cpp", - "begin": "(^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:constexpr)|(?:explicit)|(?:mutable)|(?:virtual)|(?:inline)|(?:friend))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.function.definition.special.constructor.cpp" }, - "2": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "3": { "name": "comment.block.cpp" }, - "5": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -1455,27 +1659,27 @@ } ] }, - "6": { + "5": { "patterns": [ { "include": "#functional_specifiers_pre_parameters" } ] }, - "7": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { + "7": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "9": { + "8": { "name": "comment.block.cpp" }, - "10": { + "9": { "patterns": [ { "match": "\\*\\/", @@ -1487,20 +1691,20 @@ } ] }, - "11": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "12": { + "11": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "13": { + "12": { "name": "comment.block.cpp" }, - "14": { + "13": { "patterns": [ { "match": "\\*\\/", @@ -1512,23 +1716,23 @@ } ] }, - "15": { + "14": { "name": "storage.type.modifier.calling-convention.cpp" }, - "16": { + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { + "16": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "18": { + "17": { "name": "comment.block.cpp" }, - "19": { + "18": { "patterns": [ { "match": "\\*\\/", @@ -1540,83 +1744,82 @@ } ] }, - "20": { + "19": { "name": "entity.name.function.constructor.cpp entity.name.function.definition.special.constructor.cpp" } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.function.definition.special.constructor.cpp", "patterns": [ { - "name": "meta.head.function.definition.special.constructor.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.constructor.cpp" } }, + "name": "meta.head.function.definition.special.constructor.cpp", "patterns": [ { "include": "#ever_present_context" }, { - "patterns": [ - { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { "include": "#functional_specifiers_pre_parameters" }, { - "begin": "(:)", + "begin": ":", + "end": "(?=\\{)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.separator.initializers.cpp" } }, - "end": "(?=\\{)", + "endCaptures": {}, "patterns": [ { - "contentName": "meta.parameter.initialization.cpp", - "begin": "((?(?:(?>[^<>]*)\\g<3>?)+)>)\\s*)?(\\()", + "begin": "((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "entity.name.function.call.initializer.cpp" @@ -1629,16 +1832,17 @@ } ] }, + "3": {}, "4": { "name": "punctuation.section.arguments.begin.bracket.round.function.call.initializer.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.function.call.initializer.cpp" } }, + "contentName": "meta.parameter.initialization", "patterns": [ { "include": "#evaluation_context" @@ -1646,8 +1850,8 @@ ] }, { - "contentName": "meta.parameter.initialization.cpp", "begin": "((?|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.function.definition.special.constructor.cpp" } }, + "name": "meta.body.function.definition.special.constructor.cpp", "patterns": [ { "include": "#function_body_context" @@ -1720,9 +1926,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.function.definition.special.constructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -1732,26 +1940,26 @@ ] }, "constructor_root": { - "name": "meta.function.definition.special.constructor.cpp", - "begin": "(\\s*+((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "\\s*+((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*)(((?>(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))::((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\14((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\())", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.function.definition.special.constructor.cpp" }, - "2": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "3": { "name": "comment.block.cpp" }, - "5": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -1763,23 +1971,23 @@ } ] }, - "6": { + "5": { "name": "storage.type.modifier.calling-convention.cpp" }, - "7": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { + "7": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "9": { + "8": { "name": "comment.block.cpp" }, - "10": { + "9": { "patterns": [ { "match": "\\*\\/", @@ -1791,7 +1999,7 @@ } ] }, - "11": { + "10": { "patterns": [ { "match": "::", @@ -1806,7 +2014,7 @@ } ] }, - "13": { + "11": { "name": "meta.template.call.cpp", "patterns": [ { @@ -1814,7 +2022,8 @@ } ] }, - "15": { + "12": {}, + "13": { "patterns": [ { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?=:)", @@ -1830,20 +2039,21 @@ } ] }, - "17": { + "14": {}, + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "18": { + "16": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "19": { + "17": { "name": "comment.block.cpp" }, - "20": { + "18": { "patterns": [ { "match": "\\*\\/", @@ -1855,20 +2065,20 @@ } ] }, - "21": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "21": { "name": "comment.block.cpp" }, - "24": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -1880,20 +2090,20 @@ } ] }, - "25": { + "23": { "patterns": [ { "include": "#inline_comment" } ] }, - "26": { + "24": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "27": { + "25": { "name": "comment.block.cpp" }, - "28": { + "26": { "patterns": [ { "match": "\\*\\/", @@ -1906,79 +2116,78 @@ ] } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.function.definition.special.constructor.cpp", "patterns": [ { - "name": "meta.head.function.definition.special.constructor.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.constructor.cpp" } }, + "name": "meta.head.function.definition.special.constructor.cpp", "patterns": [ { "include": "#ever_present_context" }, { - "patterns": [ - { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { "include": "#functional_specifiers_pre_parameters" }, { - "begin": "(:)", + "begin": ":", + "end": "(?=\\{)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.separator.initializers.cpp" } }, - "end": "(?=\\{)", + "endCaptures": {}, "patterns": [ { - "contentName": "meta.parameter.initialization.cpp", - "begin": "((?(?:(?>[^<>]*)\\g<3>?)+)>)\\s*)?(\\()", + "begin": "((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "entity.name.function.call.initializer.cpp" @@ -1991,16 +2200,17 @@ } ] }, + "3": {}, "4": { "name": "punctuation.section.arguments.begin.bracket.round.function.call.initializer.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.function.call.initializer.cpp" } }, + "contentName": "meta.parameter.initialization", "patterns": [ { "include": "#evaluation_context" @@ -2008,8 +2218,8 @@ ] }, { - "contentName": "meta.parameter.initialization.cpp", "begin": "((?|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.function.definition.special.constructor.cpp" } }, + "name": "meta.body.function.definition.special.constructor.cpp", "patterns": [ { "include": "#function_body_context" @@ -2082,9 +2294,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.function.definition.special.constructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -2094,7 +2308,7 @@ ] }, "control_flow_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "keyword.control.$5.cpp" + "3": { + "name": "keyword.control.$3.cpp" } } }, "cpp_attributes": { - "name": "support.other.attribute.cpp", - "begin": "(\\[\\[)", + "begin": "\\[\\[", + "end": "\\]\\]", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.begin.cpp" } }, - "end": "(\\]\\])", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.end.cpp" } }, + "name": "support.other.attribute.cpp", "patterns": [ { "include": "#attributes_context" @@ -2147,6 +2370,8 @@ { "begin": "\\(", "end": "\\)", + "beginCaptures": {}, + "endCaptures": {}, "patterns": [ { "include": "#attributes_context" @@ -2157,7 +2382,7 @@ ] }, { - "match": "(using)\\s+((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\{)", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\{)", + "end": "\\}", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -2289,17 +2531,17 @@ } ] }, - "12": { + "11": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "13": { + "12": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "15": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -2307,10 +2549,11 @@ } ] }, - "17": { + "14": {}, + "15": { "name": "entity.name.scope-resolution.cpp" }, - "18": { + "16": { "name": "meta.template.call.cpp", "patterns": [ { @@ -2318,23 +2561,24 @@ } ] }, - "20": { + "17": {}, + "18": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "21": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "21": { "name": "comment.block.cpp" }, - "24": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -2346,10 +2590,10 @@ } ] }, - "25": { + "23": { "name": "entity.name.type.cpp" }, - "26": { + "24": { "name": "meta.template.call.cpp", "patterns": [ { @@ -2357,20 +2601,21 @@ } ] }, - "28": { + "25": {}, + "26": { "patterns": [ { "include": "#inline_comment" } ] }, - "29": { + "27": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "30": { + "28": { "name": "comment.block.cpp" }, - "31": { + "29": { "patterns": [ { "match": "\\*\\/", @@ -2382,16 +2627,16 @@ } ] }, - "32": { + "30": { "name": "punctuation.section.arguments.begin.bracket.curly.initializer.cpp" } }, - "end": "(\\})", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.curly.initializer.cpp" } }, + "name": "meta.initialization.cpp", "patterns": [ { "include": "#evaluation_context" @@ -2401,382 +2646,552 @@ } ] }, - "decltype": { - "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { + "d9bc4796b0b_module_import": { + "match": "^((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((import))(?:(?:\\s)+)?(?:(?:(?:((<)[^>]*(>?)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=\\/\\/)))|((\\\")[^\\\"]*((?:\\\")?)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=\\/\\/))))|(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=(?:\\/\\/|;)))))|((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=(?:\\/\\/|;))))(?:(?:\\s)+)?(;?)", + "captures": { "1": { - "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" - }, - "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "2": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, + "3": { + "name": "keyword.control.directive.import.cpp" + }, + "5": { + "name": "string.quoted.other.lt-gt.include.cpp" + }, "6": { - "name": "punctuation.section.arguments.begin.bracket.round.decltype.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.decltype.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - "decltype_specifier": { - "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" + "name": "punctuation.definition.string.begin.cpp" }, - "2": { + "7": { + "name": "punctuation.definition.string.end.cpp" + }, + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.decltype.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.decltype.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - "default_statement": { - "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + "10": { + "name": "string.quoted.double.include.cpp" }, - "5": { - "name": "keyword.control.default.cpp" - } - }, - "end": "(:)", - "endCaptures": { - "1": { - "name": "punctuation.separator.colon.case.default.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" + "11": { + "name": "punctuation.definition.string.begin.cpp" }, - { - "include": "#c_conditional_context" - } - ] - }, - "destructor_inline": { - "name": "meta.function.definition.special.member.destructor.cpp", - "begin": "(^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(~(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "15": { + "name": "entity.name.other.preprocessor.macro.include.cpp" + }, + "16": { "patterns": [ { "include": "#inline_comment" } ] }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { + "17": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "10": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "11": { + "18": { "patterns": [ { "include": "#inline_comment" } ] }, - "12": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "13": { - "name": "comment.block.cpp" - }, - "14": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "15": { + "19": { "patterns": [ { - "include": "#functional_specifiers_pre_parameters" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { + "20": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { + "21": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { - "name": "entity.name.function.destructor.cpp entity.name.function.definition.special.member.destructor.cpp" + "22": { + "name": "punctuation.terminator.statement.cpp" } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", - "patterns": [ - { - "name": "meta.head.function.definition.special.member.destructor.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.member.destructor.cpp" - } - }, + "name": "meta.preprocessor.import.cpp" + }, + "d9bc4796b0b_preprocessor_number_literal": { + "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?(?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" }, - { - "name": "meta.body.function.definition.special.member.destructor.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.function.definition.special.member.destructor.cpp" - } - }, + "2": { "patterns": [ { - "include": "#function_body_context" + "include": "#inline_comment" } ] }, - { - "name": "meta.tail.function.definition.special.member.destructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", - "patterns": [ - { - "include": "$self" - } - ] + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.decltype.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.decltype.cpp" + } + }, + "contentName": "meta.arguments.decltype", + "patterns": [ + { + "include": "#evaluation_context" } ] }, - "destructor_root": { - "name": "meta.function.definition.special.member.destructor.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))~\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "decltype_specifier": { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { - "name": "meta.head.function.definition.special.member.destructor.cpp" + "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" }, "2": { "patterns": [ @@ -2804,22 +3219,39 @@ ] }, "6": { - "name": "storage.type.modifier.calling-convention.cpp" - }, - "7": { + "name": "punctuation.section.arguments.begin.bracket.round.decltype.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.decltype.cpp" + } + }, + "contentName": "meta.arguments.decltype", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + "default_statement": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:constexpr)|(?:explicit)|(?:mutable)|(?:virtual)|(?:inline)|(?:friend))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)(~(?|\\?\\?>)|(?=[;>\\[\\]=]))", + "beginCaptures": { + "0": { + "name": "meta.head.function.definition.special.member.destructor.cpp" + }, + "1": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "15": { + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { "patterns": [ { - "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?=:)", - "name": "entity.name.type.destructor.cpp" - }, - { - "match": "(?<=:)~(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", - "name": "entity.name.function.definition.special.member.destructor.cpp" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, { - "match": "::", - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.destructor.cpp" + "match": "\\*", + "name": "comment.block.cpp" } ] }, - "17": { + "5": { "patterns": [ { "include": "#inline_comment" } ] }, - "18": { + "6": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "19": { + "7": { "name": "comment.block.cpp" }, - "20": { + "8": { "patterns": [ { "match": "\\*\\/", @@ -2895,20 +3339,23 @@ } ] }, - "21": { + "9": { + "name": "storage.type.modifier.calling-convention.cpp" + }, + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "11": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "12": { "name": "comment.block.cpp" }, - "24": { + "13": { "patterns": [ { "match": "\\*\\/", @@ -2920,20 +3367,27 @@ } ] }, - "25": { + "14": { + "patterns": [ + { + "include": "#functional_specifiers_pre_parameters" + } + ] + }, + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "26": { + "16": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "27": { + "17": { "name": "comment.block.cpp" }, - "28": { + "18": { "patterns": [ { "match": "\\*\\/", @@ -2944,80 +3398,82 @@ "name": "comment.block.cpp" } ] + }, + "19": { + "name": "entity.name.function.destructor.cpp entity.name.function.definition.special.member.destructor.cpp" } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.function.definition.special.member.destructor.cpp", "patterns": [ { - "name": "meta.head.function.definition.special.member.destructor.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.member.destructor.cpp" } }, + "name": "meta.head.function.definition.special.member.destructor.cpp", "patterns": [ { "include": "#ever_present_context" }, { - "patterns": [ - { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", - "captures": { - "1": { - "name": "keyword.operator.assignment.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", + "captures": { + "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "4": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "keyword.other.default.constructor.cpp" - }, - "7": { - "name": "keyword.other.delete.constructor.cpp" } - } + ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" } - ] + } }, { - "contentName": "meta.function.definition.parameters.special.member.destructor.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.begin.bracket.round.special.member.destructor.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.end.bracket.round.special.member.destructor.cpp" } - } + }, + "contentName": "meta.function.definition.parameters.special.member.destructor", + "patterns": [] }, { "include": "$self" @@ -3025,14 +3481,15 @@ ] }, { - "name": "meta.body.function.definition.special.member.destructor.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.function.definition.special.member.destructor.cpp" } }, + "name": "meta.body.function.definition.special.member.destructor.cpp", "patterns": [ { "include": "#function_body_context" @@ -3040,9 +3497,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.function.definition.special.member.destructor.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -3051,27 +3510,27 @@ } ] }, - "diagnostic": { - "name": "meta.preprocessor.diagnostic.$reference(directive).cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:error|warning)))\\b\\s*", + "destructor_root": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*)(((?>(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))::((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))~\\14((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\())", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { - "name": "keyword.control.directive.diagnostic.$7.cpp" + "0": { + "name": "meta.head.function.definition.special.member.destructor.cpp" }, - "2": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "3": { "name": "comment.block.cpp" }, - "5": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -3083,139 +3542,49 @@ } ] }, - "6": { - "name": "punctuation.definition.directive.cpp" - } - }, - "end": "(?[#;\\/=*C~]+)(?![#;\\/=*C~]))\\s*.+\\s*\\8\\s*(?:\\n|$)))|(^\\s*((\\/\\*)\\s*?((?>[#;\\/=*C~]+)(?![#;\\/=*C~]))\\s*.+\\s*\\8\\s*\\*\\/)))", - "captures": { - "1": { - "name": "meta.toc-list.banner.double-slash.cpp" - }, - "2": { - "name": "comment.line.double-slash.cpp" - }, - "3": { - "name": "punctuation.definition.comment.cpp" - }, - "4": { - "name": "meta.banner.character.cpp" - }, - "5": { - "name": "meta.toc-list.banner.block.cpp" - }, - "6": { - "name": "comment.line.banner.cpp" }, "7": { - "name": "punctuation.definition.comment.cpp" + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, "8": { - "name": "meta.banner.character.cpp" - } - } - }, - "empty_square_brackets": { - "name": "storage.modifier.array.bracket.square.cpp", - "match": "(?-mix:(?-mix:(?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<15>?)+)>)\\s*)?(::))?\\s*((?|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", - "endCaptures": { - "1": { - "name": "punctuation.terminator.statement.cpp" + "name": "comment.block.cpp" }, - "2": { - "name": "punctuation.terminator.statement.cpp" - } - }, - "patterns": [ - { - "name": "meta.head.enum.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.enum.cpp" - } - }, + "18": { "patterns": [ { - "include": "$self" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" } ] }, - { - "name": "meta.body.enum.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.enum.cpp" - } - }, + "19": { "patterns": [ { - "include": "#ever_present_context" - }, - { - "include": "#enumerator_list" - }, - { - "include": "#comments" - }, - { - "include": "#comma" - }, - { - "include": "#semicolon" + "include": "#inline_comment" } ] }, - { - "name": "meta.tail.enum.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", + "20": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "21": { + "name": "comment.block.cpp" + }, + "22": { "patterns": [ { - "include": "$self" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" } ] - } - ] - }, - "enum_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", - "captures": { - "1": { - "name": "storage.type.enum.declare.cpp" }, - "2": { + "23": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { + "24": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "25": { "name": "comment.block.cpp" }, - "5": { + "26": { "patterns": [ { "match": "\\*\\/", @@ -3336,33 +3685,45 @@ "name": "comment.block.cpp" } ] - }, - "6": { - "name": "entity.name.type.enum.cpp" - }, - "7": { + } + }, + "endCaptures": {}, + "name": "meta.function.definition.special.member.destructor.cpp", + "patterns": [ + { + "begin": "\\G ?", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.member.destructor.cpp" + } + }, + "name": "meta.head.function.definition.special.member.destructor.cpp", "patterns": [ { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" + "include": "#ever_present_context" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(\\=)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(default)|(delete))", "captures": { "1": { + "name": "keyword.operator.assignment.cpp" + }, + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "3": { + "4": { "name": "comment.block.cpp" }, - "4": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -3373,55 +3734,87 @@ "name": "comment.block.cpp" } ] + }, + "6": { + "name": "keyword.other.default.constructor.cpp" + }, + "7": { + "name": "keyword.other.delete.constructor.cpp" + } + } + }, + { + "begin": "\\(", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.section.parameters.begin.bracket.round.special.member.destructor.cpp" } }, - "name": "invalid.illegal.reference-type.cpp" + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.special.member.destructor.cpp" + } + }, + "contentName": "meta.function.definition.parameters.special.member.destructor", + "patterns": [] }, { - "match": "\\&", - "name": "storage.modifier.reference.cpp" + "include": "$self" } ] }, - "8": { + { + "begin": "(?<=\\{|<%|\\?\\?<)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.function.definition.special.member.destructor.cpp" + } + }, + "name": "meta.body.function.definition.special.member.destructor.cpp", "patterns": [ { - "include": "#inline_comment" + "include": "#function_body_context" } ] }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { + { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, + "name": "meta.tail.function.definition.special.member.destructor.cpp", "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "$self" } ] + } + ] + }, + "diagnostic": { + "begin": "(^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?((?:error|warning)))\\b(?:(?:\\s)+)?", + "end": "(?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<12>?)+>)(?:(?:\\s)+)?)?(::))?(?:(?:\\s)+)?((?|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", + "beginCaptures": { + "0": { + "name": "meta.head.enum.cpp" + }, + "1": { + "name": "storage.type.enum.cpp" }, "2": { + "name": "storage.type.enum.enum-key.$2.cpp" + }, + "3": { "patterns": [ { "include": "#attributes_context" @@ -3504,202 +3947,123 @@ } ] }, - "3": { - "name": "keyword.operator.assignment.cpp" - }, "4": { + "name": "entity.name.type.enum.cpp" + }, + "5": { + "name": "punctuation.separator.colon.type-specifier.cpp" + }, + "6": { "patterns": [ { - "include": "#evaluation_context" + "include": "#scope_resolution_inner_generated" } ] }, - "5": { + "7": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "8": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#comma" - }, - { - "include": "#semicolon" + "include": "#template_call_range" } ] - } - }, - "name": "meta.enum.definition.cpp" - }, - "evaluation_context": { - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#string_context" }, - { - "include": "#number_literal" + "9": {}, + "10": { + "name": "entity.name.scope-resolution.cpp" }, - { - "include": "#method_access" + "11": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] }, - { - "include": "#member_access" + "12": {}, + "13": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - { - "include": "#predefined_macros" + "14": { + "name": "storage.type.integral.$14.cpp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.cpp" }, + "2": { + "name": "punctuation.terminator.statement.cpp" + } + }, + "name": "meta.block.enum.cpp", + "patterns": [ { - "include": "#operators" + "begin": "\\G ?", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.enum.cpp" + } + }, + "name": "meta.head.enum.cpp", + "patterns": [ + { + "include": "$self" + } + ] }, { - "include": "#memory_operators" - }, - { - "include": "#wordlike_operators" - }, - { - "include": "#type_casting_operators" - }, - { - "include": "#control_flow_keywords" - }, - { - "include": "#exception_keywords" - }, - { - "include": "#the_this_keyword" - }, - { - "include": "#language_constants" - }, - { - "include": "#builtin_storage_type_initilizer" - }, - { - "include": "#qualifiers_and_specifiers_post_parameters" - }, - { - "include": "#functional_specifiers_pre_parameters" - }, - { - "include": "#storage_types" - }, - { - "include": "#misc_storage_modifiers" - }, - { - "include": "#lambdas" - }, - { - "include": "#attributes_context" - }, - { - "include": "#parentheses" - }, - { - "include": "#function_call" - }, - { - "include": "#scope_resolution_inner_generated" - }, - { - "include": "#square_brackets" - }, - { - "include": "#empty_square_brackets" - }, - { - "include": "#semicolon" - }, - { - "include": "#comma" - } - ] - }, - "ever_present_context": { - "patterns": [ - { - "include": "#pragma_mark" - }, - { - "include": "#pragma" - }, - { - "include": "#include" - }, - { - "include": "#module_import" - }, - { - "include": "#line" - }, - { - "include": "#diagnostic" - }, - { - "include": "#undef" - }, - { - "include": "#preprocessor_conditional_range" - }, - { - "include": "#single_line_macro" - }, - { - "include": "#macro" - }, - { - "include": "#preprocessor_conditional_standalone" - }, - { - "include": "#macro_argument" - }, - { - "include": "#comments" - }, - { - "include": "#line_continuation_character" - } - ] - }, - "exception_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?|\\?\\?>", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.enum.cpp" + } + }, + "name": "meta.body.enum.cpp", "patterns": [ { - "include": "#inline_comment" + "include": "#ever_present_context" + }, + { + "include": "#enumerator_list" + }, + { + "include": "#comments" + }, + { + "include": "#comma" + }, + { + "include": "#semicolon" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { + { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, + "name": "meta.tail.enum.cpp", "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "$self" } ] - }, - "5": { - "name": "keyword.control.exception.$5.cpp" } - } + ] }, - "extern_block": { - "name": "meta.block.extern.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(extern)(?=\\s*\\\"))", - "beginCaptures": { + "enum_declare": { + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", + "captures": { "1": { - "name": "meta.head.extern.cpp" + "name": "storage.type.enum.declare.cpp" }, "2": { "patterns": [ @@ -3709,310 +4073,408 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, "4": { - "name": "comment.block.cpp" + "name": "entity.name.type.enum.cpp" }, "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, "6": { - "name": "storage.type.extern.cpp" - } - }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", - "endCaptures": { - "1": { - "name": "punctuation.terminator.statement.cpp" - }, - "2": { - "name": "punctuation.terminator.statement.cpp" - } - }, - "patterns": [ - { - "name": "meta.head.extern.cpp", - "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", - "endCaptures": { - "1": { - "name": "punctuation.section.block.begin.bracket.curly.extern.cpp" - } - }, "patterns": [ { - "include": "$self" + "include": "#inline_comment" } ] }, - { - "name": "meta.body.extern.cpp", - "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", - "endCaptures": { - "1": { - "name": "punctuation.section.block.end.bracket.curly.extern.cpp" - } - }, + "7": { "patterns": [ { - "include": "$self" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - { - "name": "meta.tail.extern.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", + "8": { "patterns": [ { - "include": "$self" + "include": "#inline_comment" } ] }, - { - "include": "$self" + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "name": "variable.other.object.declare.cpp" + }, + "13": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "14": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] } - ] + } }, - "function_body_context": { + "enumerator_list": { + "match": "((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_function_call_inner_generated" - } - ] + "ever_present_context": { + "patterns": [ + { + "include": "#pragma_mark" }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + { + "include": "#pragma" }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] + { + "include": "#include" }, - "6": { - "name": "entity.name.function.call.cpp" + { + "include": "#line" }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + { + "include": "#diagnostic" }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "include": "#undef" }, - "9": { - "name": "comment.block.cpp" + { + "include": "#preprocessor_conditional_range" }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + { + "include": "#single_line_macro" }, - "11": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] + { + "include": "#macro" }, - "13": { - "name": "punctuation.section.arguments.begin.bracket.round.function.call.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.function.call.cpp" - } - }, - "patterns": [ { - "include": "#evaluation_context" + "include": "#preprocessor_conditional_standalone" + }, + { + "include": "#macro_argument" + }, + { + "include": "#comments" + }, + { + "include": "#line_continuation_character" } ] }, - "function_definition": { - "name": "meta.function.definition.cpp", - "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\())", - "beginCaptures": { + "exception_keywords": { + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))", + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", "captures": { "1": { - "name": "storage.modifier.$1.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "2": { "name": "comment.block.cpp" }, - "5": { + "3": { "patterns": [ { "match": "\\*\\/", @@ -4028,23 +4490,32 @@ } ] }, - "12": { - "name": "storage.modifier.$1.cpp" + "3": { + "name": "keyword.control.exception.$3.cpp" + } + } + }, + "extern_block": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(extern)(?=\\s*\\\")", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", + "beginCaptures": { + "0": { + "name": "meta.head.extern.cpp" }, - "13": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "14": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "15": { + "3": { "name": "comment.block.cpp" }, - "16": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -4056,125 +4527,194 @@ } ] }, - "17": { - "name": "meta.qualified_type.cpp", + "5": { + "name": "storage.type.extern.cpp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.cpp" + }, + "2": { + "name": "punctuation.terminator.statement.cpp" + } + }, + "name": "meta.block.extern.cpp", + "patterns": [ + { + "begin": "\\G ?", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.extern.cpp" + } + }, + "name": "meta.head.extern.cpp", "patterns": [ { - "match": "(?|\\?\\?>", + "beginCaptures": {}, + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.extern.cpp" + } + }, + "name": "meta.body.extern.cpp", "patterns": [ { - "include": "#attributes_context" - }, - { - "include": "#number_literal" + "include": "$self" } ] }, - "19": { + { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, + "name": "meta.tail.extern.cpp", "patterns": [ { - "include": "#inline_comment" + "include": "$self" } ] }, - "20": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "include": "$self" + } + ] + }, + "function_body_context": { + "patterns": [ + { + "include": "#ever_present_context" }, - "21": { - "name": "comment.block.cpp" + { + "include": "#using_namespace" }, - "22": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + { + "include": "#type_alias" }, - "23": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + { + "include": "#using_name" }, - "24": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "include": "#namespace_alias" }, - "25": { - "name": "comment.block.cpp" + { + "include": "#typedef_class" }, - "26": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, + { + "include": "#typedef_struct" + }, + { + "include": "#typedef_union" + }, + { + "include": "#misc_keywords" + }, + { + "include": "#standard_declares" + }, + { + "include": "#class_block" + }, + { + "include": "#struct_block" + }, + { + "include": "#union_block" + }, + { + "include": "#enum_block" + }, + { + "include": "#access_control_keywords" + }, + { + "include": "#block" + }, + { + "include": "#static_assert" + }, + { + "include": "#assembly" + }, + { + "include": "#function_pointer" + }, + { + "include": "#switch_statement" + }, + { + "include": "#goto_statement" + }, + { + "include": "#evaluation_context" + }, + { + "include": "#label" + } + ] + }, + "function_call": { + "begin": "((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<11>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<11>?)+>)(?:(?:\\s)+)?)?(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "patterns": [ { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#scope_resolution_function_call_inner_generated" } ] }, - "28": { + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + }, + "3": { + "name": "meta.template.call.cpp", "patterns": [ { - "include": "#scope_resolution_inner_generated" + "include": "#template_call_range" } ] }, - "29": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + "4": {}, + "5": { + "name": "entity.name.function.call.cpp" }, - "31": { - "name": "meta.template.call.cpp", + "6": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "33": { - "name": "entity.name.scope-resolution.cpp" + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "34": { + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "10": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4182,23 +4722,43 @@ } ] }, - "36": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + "11": {}, + "12": { + "name": "punctuation.section.arguments.begin.bracket.round.function.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.call.cpp" + } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + "function_definition": { + "begin": "(?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<66>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\()", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "beginCaptures": { + "0": { + "name": "meta.head.function.definition.cpp" }, - "37": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "38": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "3": { "name": "comment.block.cpp" }, - "40": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -4210,40 +4770,56 @@ } ] }, - "41": { - "name": "entity.name.type.cpp" + "5": { + "name": "storage.type.template.cpp" }, - "42": { - "name": "meta.template.call.cpp", + "6": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "44": { + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { "patterns": [ { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "10": { + "patterns": [ + { + "match": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))", "captures": { "1": { + "name": "storage.modifier.$1.cpp" + }, + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "3": { + "4": { "name": "comment.block.cpp" }, - "4": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -4255,29 +4831,27 @@ } ] } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" + } } ] }, - "45": { + "11": { + "name": "storage.modifier.$11.cpp" + }, + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "46": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "47": { + "14": { "name": "comment.block.cpp" }, - "48": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -4289,45 +4863,84 @@ } ] }, - "49": { + "16": { + "name": "meta.qualified_type.cpp", "patterns": [ { - "include": "#inline_comment" + "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] + }, + { + "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", + "name": "entity.name.type.cpp" } ] }, - "50": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "51": { - "name": "comment.block.cpp" - }, - "52": { + "17": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "include": "#attributes_context" }, { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#number_literal" } ] }, - "53": { + "18": { "patterns": [ { "include": "#inline_comment" } ] }, - "54": { + "19": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "55": { + "20": { "name": "comment.block.cpp" }, - "56": { + "21": { "patterns": [ { "match": "\\*\\/", @@ -4339,20 +4952,20 @@ } ] }, - "57": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "58": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "59": { + "24": { "name": "comment.block.cpp" }, - "60": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -4364,23 +4977,237 @@ } ] }, - "61": { + "26": { + "patterns": [ + { + "include": "#scope_resolution_inner_generated" + } + ] + }, + "27": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "28": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "29": {}, + "30": { + "name": "entity.name.scope-resolution.cpp" + }, + "31": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "32": {}, + "33": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "34": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "35": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "36": { + "name": "comment.block.cpp" + }, + "37": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "38": { + "name": "entity.name.type.cpp" + }, + "39": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "40": {}, + "41": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "42": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "43": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "44": { + "name": "comment.block.cpp" + }, + "45": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "46": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "47": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "48": { + "name": "comment.block.cpp" + }, + "49": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "50": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "51": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "52": { + "name": "comment.block.cpp" + }, + "53": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "54": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "55": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "56": { + "name": "comment.block.cpp" + }, + "57": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "58": { "name": "storage.type.modifier.calling-convention.cpp" }, - "62": { + "59": { "patterns": [ { "include": "#inline_comment" } ] }, - "63": { + "60": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "64": { + "61": { "name": "comment.block.cpp" }, - "65": { + "62": { "patterns": [ { "match": "\\*\\/", @@ -4392,17 +5219,17 @@ } ] }, - "66": { + "63": { "patterns": [ { "include": "#scope_resolution_function_definition_inner_generated" } ] }, - "67": { + "64": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" }, - "69": { + "65": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4410,23 +5237,24 @@ } ] }, - "71": { + "66": {}, + "67": { "name": "entity.name.function.definition.cpp" }, - "72": { + "68": { "patterns": [ { "include": "#inline_comment" } ] }, - "73": { + "69": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "74": { + "70": { "name": "comment.block.cpp" }, - "75": { + "71": { "patterns": [ { "match": "\\*\\/", @@ -4439,35 +5267,37 @@ ] } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.function.definition.cpp", "patterns": [ { - "name": "meta.head.function.definition.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.function.definition.cpp" } }, + "name": "meta.head.function.definition.cpp", "patterns": [ { "include": "#ever_present_context" }, { - "contentName": "meta.function.definition.parameters.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.begin.bracket.round.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.end.bracket.round.cpp" } }, + "contentName": "meta.function.definition.parameters", "patterns": [ { "include": "#ever_present_context" @@ -4489,14 +5319,15 @@ ] }, { - "name": "meta.body.function.definition.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.function.definition.cpp" } }, + "name": "meta.body.function.definition.cpp", "patterns": [ { "include": "#function_body_context" @@ -4504,9 +5335,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.function.definition.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -4529,13 +5362,14 @@ ] }, "function_pointer": { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -4628,17 +5479,17 @@ } ] }, - "12": { + "11": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "13": { + "12": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "15": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4646,10 +5497,11 @@ } ] }, - "17": { + "14": {}, + "15": { "name": "entity.name.scope-resolution.cpp" }, - "18": { + "16": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4657,23 +5509,24 @@ } ] }, - "20": { + "17": {}, + "18": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "21": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "21": { "name": "comment.block.cpp" }, - "24": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -4685,10 +5538,10 @@ } ] }, - "25": { + "23": { "name": "entity.name.type.cpp" }, - "26": { + "24": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4696,14 +5549,15 @@ } ] }, - "28": { + "25": {}, + "26": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -4739,20 +5593,20 @@ } ] }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -4764,20 +5618,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -4789,20 +5643,20 @@ } ] }, - "37": { + "35": { "patterns": [ { "include": "#inline_comment" } ] }, - "38": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "37": { "name": "comment.block.cpp" }, - "40": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -4814,36 +5668,35 @@ } ] }, - "41": { + "39": { "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "42": { + "40": { "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "43": { + "41": { "name": "variable.other.definition.pointer.function.cpp" }, - "44": { + "42": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "45": { + "43": { "patterns": [ { "include": "#evaluation_context" } ] }, - "46": { + "44": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "47": { + "45": { "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" }, - "48": { + "46": { "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -4881,13 +5734,14 @@ ] }, "function_pointer_parameter": { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -4980,17 +5851,17 @@ } ] }, - "12": { + "11": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "13": { + "12": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "15": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -4998,10 +5869,11 @@ } ] }, - "17": { + "14": {}, + "15": { "name": "entity.name.scope-resolution.cpp" }, - "18": { + "16": { "name": "meta.template.call.cpp", "patterns": [ { @@ -5009,23 +5881,24 @@ } ] }, - "20": { + "17": {}, + "18": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "21": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "21": { "name": "comment.block.cpp" }, - "24": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -5037,10 +5910,10 @@ } ] }, - "25": { + "23": { "name": "entity.name.type.cpp" }, - "26": { + "24": { "name": "meta.template.call.cpp", "patterns": [ { @@ -5048,14 +5921,15 @@ } ] }, - "28": { + "25": {}, + "26": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -5091,20 +5965,20 @@ } ] }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -5116,20 +5990,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -5141,20 +6015,20 @@ } ] }, - "37": { + "35": { "patterns": [ { "include": "#inline_comment" } ] }, - "38": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "37": { "name": "comment.block.cpp" }, - "40": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -5166,36 +6040,35 @@ } ] }, - "41": { + "39": { "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "42": { + "40": { "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "43": { + "41": { "name": "variable.parameter.pointer.function.cpp" }, - "44": { + "42": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "45": { + "43": { "patterns": [ { "include": "#evaluation_context" } ] }, - "46": { + "44": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "47": { + "45": { "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" }, - "48": { + "46": { "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -5233,23 +6106,23 @@ ] }, "functional_specifiers_pre_parameters": { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", "captures": { "1": { "name": "keyword.control.goto.cpp" @@ -5312,30 +6187,42 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "name": "entity.name.label.call.cpp" } } }, + "identifier": { + "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*" + }, "include": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", + "match": "^((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((#)(?:(?:\\s)+)?((?:include|include_next))\\b)(?:(?:\\s)+)?(?:(?:(?:((<)[^>]*(>?)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=\\/\\/)))|((\\\")[^\\\"]*((?:\\\")?)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=\\/\\/))))|(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=(?:\\/\\/|;)))))|((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:\\n)|$)|(?=(?:\\/\\/|;))))", "captures": { "1": { "patterns": [ @@ -5345,172 +6232,226 @@ ] }, "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "keyword.control.directive.$7.cpp" + "3": { + "name": "keyword.control.directive.$5.cpp" }, - "6": { + "4": { "name": "punctuation.definition.directive.cpp" }, - "8": { + "6": { "name": "string.quoted.other.lt-gt.include.cpp" }, - "9": { + "7": { "name": "punctuation.definition.string.begin.cpp" }, - "10": { + "8": { "name": "punctuation.definition.string.end.cpp" }, - "11": { + "9": { "patterns": [ { "include": "#inline_comment" } ] }, - "12": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "13": { - "name": "comment.block.cpp" - }, - "14": { + "10": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "15": { + "11": { "name": "string.quoted.double.include.cpp" }, - "16": { + "12": { "name": "punctuation.definition.string.begin.cpp" }, - "17": { + "13": { "name": "punctuation.definition.string.end.cpp" }, - "18": { + "14": { "patterns": [ { "include": "#inline_comment" } ] }, - "19": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "20": { - "name": "comment.block.cpp" - }, - "21": { + "15": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "22": { + "16": { "name": "entity.name.other.preprocessor.macro.include.cpp" }, - "23": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "24": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "25": { - "name": "comment.block.cpp" - }, - "26": { + "18": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "27": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "28": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "29": { - "name": "comment.block.cpp" - }, - "30": { + "20": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "31": { + "21": { "patterns": [ { "include": "#inline_comment" } ] }, - "32": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "33": { - "name": "comment.block.cpp" - }, - "34": { + "22": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] } @@ -5527,7 +6468,7 @@ "name": "punctuation.separator.delimiter.comma.inheritance.cpp" }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(?<=protected|virtual|private|public|,|:)(?:(?:\\s)+)?(?!(?:(?:(?:protected)|(?:private)|(?:public))|virtual))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))", "captures": { "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -5592,70 +6550,99 @@ ] }, "4": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "5": { - "name": "comment.block.cpp" - }, - "6": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "7": { + "5": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { + "6": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "12": { + "7": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "13": { + "8": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "15": { - "name": "meta.template.call.cpp", + "9": { "patterns": [ { - "include": "#template_call_range" + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, - "17": { + "10": {}, + "11": { "name": "entity.name.scope-resolution.cpp" }, - "18": { + "12": { "name": "meta.template.call.cpp", "patterns": [ { @@ -5663,51 +6650,62 @@ } ] }, - "20": { + "13": {}, + "14": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "21": { + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { + "16": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "25": { + "17": { "name": "entity.name.type.cpp" }, - "26": { + "18": { "name": "meta.template.call.cpp", "patterns": [ { "include": "#template_call_range" } ] - } + }, + "19": {} } } ] }, "inline_comment": { - "match": "(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/))", + "match": "(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/))", "captures": { "1": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" @@ -5734,7 +6732,7 @@ "name": "invalid.illegal.unexpected.punctuation.definition.comment.end.cpp" }, "label": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)", + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:)", "captures": { "1": { "patterns": [ @@ -5744,70 +6742,89 @@ ] }, "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { + "3": { "name": "entity.name.label.cpp" }, - "6": { + "4": { "patterns": [ { "include": "#inline_comment" } ] }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { + "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "10": { + "6": { "name": "punctuation.separator.label.cpp" } } }, "lambdas": { - "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[))((?:[^\\]\\[]*\\[.*?\\](?!\\s*\\[)[^\\]\\[]*?)*[^\\]\\[]*?)(\\](?!\\[)))", + "begin": "(?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))(?:(?:\\s)+)?(\\[(?!\\[| *+\"| *+\\d))((?:[^\\[\\]]|((??)++\\]))*+)(\\](?!((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))[\\[\\];]))", + "end": "(?<=[;}])", "beginCaptures": { - "2": { + "1": { "name": "punctuation.definition.capture.begin.lambda.cpp" }, - "3": { + "2": { "name": "meta.lambda.capture.cpp", "patterns": [ { "include": "#the_this_keyword" }, { - "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", + "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", "captures": { "1": { "name": "variable.parameter.capture.cpp" @@ -5850,26 +6867,52 @@ } ] }, + "3": {}, "4": { "name": "punctuation.definition.capture.end.lambda.cpp" + }, + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "6": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "7": { + "name": "comment.block.cpp" + }, + "8": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } }, - "end": "(?<=})", + "endCaptures": {}, "patterns": [ { - "name": "meta.function.definition.parameters.lambda.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.definition.parameters.begin.lambda.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.definition.parameters.end.lambda.cpp" } }, + "name": "meta.function.definition.parameters.lambda.cpp", "patterns": [ { "include": "#function_parameter_context" @@ -5877,7 +6920,7 @@ ] }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*line\\b)", + "begin": "^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?line\\b", + "end": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*define\\b)\\s*((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?define\\b)(?:(?:\\s)+)?((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", + "match": "(?:((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:(?:\\s)+)?(?:(?:\\.\\*|\\.)|(?:->\\*|->))(?:(?:\\s)+)?)*)(?:(?:\\s)+)?(\\b(?!uint_least64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_least16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_least32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_least16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_fast64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_fast32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_fast16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_least8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_least64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_least32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_fast32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_fast16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_least8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint_fast8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_fast64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int_fast8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|suseconds_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|useconds_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|in_addr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uintmax_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uintmax_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uintptr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|blksize_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|in_port_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|intmax_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|unsigned[^Pattern.new(\n match: \\/\\w\\/,\n)]|blkcnt_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|u_quad_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|intmax_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|intptr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|swblk_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|wchar_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|u_short[^Pattern.new(\n match: \\/\\w\\/,\n)]|qaddr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|caddr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|daddr_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|fixpt_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|nlink_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|segsz_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|clock_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|ssize_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int16_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int32_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int64_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|int8_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|mode_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|quad_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|ushort[^Pattern.new(\n match: \\/\\w\\/,\n)]|u_long[^Pattern.new(\n match: \\/\\w\\/,\n)]|u_char[^Pattern.new(\n match: \\/\\w\\/,\n)]|double[^Pattern.new(\n match: \\/\\w\\/,\n)]|size_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|signed[^Pattern.new(\n match: \\/\\w\\/,\n)]|time_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|key_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|ino_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|gid_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|dev_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|div_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|float[^Pattern.new(\n match: \\/\\w\\/,\n)]|u_int[^Pattern.new(\n match: \\/\\w\\/,\n)]|uid_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|short[^Pattern.new(\n match: \\/\\w\\/,\n)]|off_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|pid_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|id_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|bool[^Pattern.new(\n match: \\/\\w\\/,\n)]|char[^Pattern.new(\n match: \\/\\w\\/,\n)]|id_t[^Pattern.new(\n match: \\/\\w\\/,\n)]|uint[^Pattern.new(\n match: \\/\\w\\/,\n)]|void[^Pattern.new(\n match: \\/\\w\\/,\n)]|long[^Pattern.new(\n match: \\/\\w\\/,\n)]|auto[^Pattern.new(\n match: \\/\\w\\/,\n)]|int[^Pattern.new(\n match: \\/\\w\\/,\n)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", "captures": { "1": { "patterns": [ @@ -6092,39 +7138,48 @@ ] }, "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { + "3": { "name": "variable.language.this.cpp" }, - "6": { + "4": { "name": "variable.other.object.access.cpp" }, - "7": { + "5": { "name": "punctuation.separator.dot-access.cpp" }, - "8": { + "6": { "name": "punctuation.separator.pointer-access.cpp" }, - "9": { + "7": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))(?:(?:\\s)+)?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6166,7 +7221,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6215,13 +7270,13 @@ } ] }, - "10": { + "8": { "name": "variable.other.property.cpp" } } }, "memory_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(delete)(?:(?:\\s)+)?(\\[\\])|(delete))|(new))(?!\\w))", "captures": { "1": { "patterns": [ @@ -6231,42 +7286,52 @@ ] }, "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { + "3": { "name": "keyword.operator.wordlike.cpp" }, - "6": { + "4": { "name": "keyword.operator.delete.array.cpp" }, - "7": { + "5": { "name": "keyword.operator.delete.array.bracket.cpp" }, - "8": { + "6": { "name": "keyword.operator.delete.cpp" }, - "9": { + "7": { "name": "keyword.operator.new.cpp" } } }, "method_access": { - "begin": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", + "begin": "(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:(?:\\s)+)?(?:(?:\\.\\*|\\.)|(?:->\\*|->))(?:(?:\\s)+)?)*)(?:(?:\\s)+)?(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)(?:(?:\\s)+)?(\\()", + "end": "\\)", "beginCaptures": { "1": { "patterns": [ @@ -6308,7 +7373,7 @@ "9": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))(?:(?:\\s)+)?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6350,7 +7415,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6406,9 +7471,8 @@ "name": "punctuation.section.arguments.begin.bracket.round.function.member.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.function.member.cpp" } }, @@ -6418,12 +7482,8 @@ } ] }, - "misc_storage_modifiers": { - "match": "\\b(?:export|mutable|typename|thread_local|register|restrict|static|volatile|inline)\\b", - "name": "storage.modifier.$0.cpp" - }, - "module_import": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", + "misc_keywords": { + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "34": { - "name": "punctuation.terminator.statement.cpp" + "3": { + "name": "keyword.other.$3.cpp" } - }, - "name": "meta.preprocessor.import.cpp" + } }, "ms_attributes": { - "name": "support.other.attribute.cpp", - "begin": "(__declspec\\()", + "begin": "__declspec\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.begin.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.attribute.end.cpp" } }, + "name": "support.other.attribute.cpp", "patterns": [ { "include": "#attributes_context" @@ -6626,6 +7545,8 @@ { "begin": "\\(", "end": "\\)", + "beginCaptures": {}, + "endCaptures": {}, "patterns": [ { "include": "#attributes_context" @@ -6636,7 +7557,7 @@ ] }, { - "match": "(using)\\s+((?(?:(?>[^<>]*)\\g<9>?)+)>)\\s*)?::)*\\s*+)\\s*((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<8>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)(?:(?:\\s)+)?((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, - "10": { + "9": { "name": "entity.name.namespace.cpp" }, - "11": { + "10": { "name": "punctuation.terminator.statement.cpp" } }, "name": "meta.declaration.namespace.alias.cpp" }, "namespace_block": { - "name": "meta.block.namespace.cpp", - "begin": "(((?|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.namespace.cpp" }, - "2": { + "1": { "name": "keyword.other.namespace.definition.cpp storage.type.namespace.definition.cpp" } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.block.namespace.cpp", "patterns": [ { - "name": "meta.head.namespace.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.namespace.cpp" } }, + "name": "meta.head.namespace.cpp", "patterns": [ { "include": "#ever_present_context" @@ -6739,7 +7672,7 @@ "include": "#attributes_context" }, { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<5>?)+)>)\\s*)?::)*\\s*+)\\s*((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<4>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)(?:(?:\\s)+)?((?|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.namespace.cpp" } }, + "name": "meta.body.namespace.cpp", "patterns": [ { "include": "$self" @@ -6788,9 +7723,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.namespace.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -6800,8 +7737,8 @@ ] }, "noexcept_operator": { - "contentName": "meta.arguments.operator.noexcept.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.noexcept.cpp" @@ -6835,12 +7772,12 @@ "name": "punctuation.section.arguments.begin.bracket.round.operator.noexcept.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.operator.noexcept.cpp" } }, + "contentName": "meta.arguments.operator.noexcept", "patterns": [ { "include": "#evaluation_context" @@ -6848,7 +7785,7 @@ ] }, "non_primitive_types": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { + "3": { "name": "storage.type.cpp storage.type.built-in.cpp" } } @@ -6888,9 +7834,11 @@ { "begin": "(?=.)", "end": "$", + "beginCaptures": {}, + "endCaptures": {}, "patterns": [ { - "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\<|\\())", + "begin": "(?:(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*)(operator)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<62>?)+>)(?:(?:\\s)+)?)?::)*)(?:(?:((?:(?:delete\\[\\])|(?:delete)|(?:new\\[\\])|(?:<=>)|(?:<<=)|(?:new)|(?:>>=)|(?:\\->\\*)|(?:\\/=)|(?:%=)|(?:&=)|(?:>=)|(?:\\|=)|(?:\\+\\+)|(?:\\-\\-)|(?:\\(\\))|(?:\\[\\])|(?:\\->)|(?:\\+\\+)|(?:<<)|(?:>>)|(?:\\-\\-)|(?:<=)|(?:\\^=)|(?:==)|(?:!=)|(?:&&)|(?:\\|\\|)|(?:\\+=)|(?:\\-=)|(?:\\*=)|,|(?:\\+)|(?:\\-)|!|~|(?:\\*)|&|(?:\\*)|(?:\\/)|%|(?:\\+)|(?:\\-)|<|>|&|(?:\\^)|(?:\\|)|=))|((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\<|\\()", + "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.function.definition.special.operator-overload.cpp" }, - "2": { + "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -7195,7 +8160,7 @@ } ] }, - "3": { + "2": { "patterns": [ { "include": "#attributes_context" @@ -7205,20 +8170,20 @@ } ] }, - "4": { + "3": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "4": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "5": { "name": "comment.block.cpp" }, - "7": { + "6": { "patterns": [ { "match": "\\*\\/", @@ -7230,20 +8195,20 @@ } ] }, - "8": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "9": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "10": { + "9": { "name": "comment.block.cpp" }, - "11": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -7255,17 +8220,17 @@ } ] }, - "13": { + "11": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "14": { + "12": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "16": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -7273,10 +8238,11 @@ } ] }, - "18": { + "14": {}, + "15": { "name": "entity.name.scope-resolution.cpp" }, - "19": { + "16": { "name": "meta.template.call.cpp", "patterns": [ { @@ -7284,23 +8250,24 @@ } ] }, - "21": { + "17": {}, + "18": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "22": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "23": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "24": { + "21": { "name": "comment.block.cpp" }, - "25": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -7312,10 +8279,10 @@ } ] }, - "26": { + "23": { "name": "entity.name.type.cpp" }, - "27": { + "24": { "name": "meta.template.call.cpp", "patterns": [ { @@ -7323,14 +8290,15 @@ } ] }, - "29": { + "25": {}, + "26": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7366,20 +8334,20 @@ } ] }, - "30": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "31": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "32": { + "29": { "name": "comment.block.cpp" }, - "33": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -7391,20 +8359,20 @@ } ] }, - "34": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "35": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "36": { + "33": { "name": "comment.block.cpp" }, - "37": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -7416,20 +8384,20 @@ } ] }, - "38": { + "35": { "patterns": [ { "include": "#inline_comment" } ] }, - "39": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "40": { + "37": { "name": "comment.block.cpp" }, - "41": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -7441,20 +8409,20 @@ } ] }, - "42": { + "39": { "patterns": [ { "include": "#inline_comment" } ] }, - "43": { + "40": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "44": { + "41": { "name": "comment.block.cpp" }, - "45": { + "42": { "patterns": [ { "match": "\\*\\/", @@ -7466,23 +8434,23 @@ } ] }, - "46": { + "43": { "name": "storage.type.modifier.calling-convention.cpp" }, - "47": { + "44": { "patterns": [ { "include": "#inline_comment" } ] }, - "48": { + "45": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "49": { + "46": { "name": "comment.block.cpp" }, - "50": { + "47": { "patterns": [ { "match": "\\*\\/", @@ -7494,20 +8462,20 @@ } ] }, - "51": { + "48": { "patterns": [ { "include": "#inline_comment" } ] }, - "52": { + "49": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "53": { + "50": { "name": "comment.block.cpp" }, - "54": { + "51": { "patterns": [ { "match": "\\*\\/", @@ -7519,7 +8487,7 @@ } ] }, - "55": { + "52": { "patterns": [ { "match": "::", @@ -7534,7 +8502,7 @@ } ] }, - "57": { + "53": { "name": "meta.template.call.cpp", "patterns": [ { @@ -7542,23 +8510,24 @@ } ] }, - "59": { + "54": {}, + "55": { "name": "keyword.other.operator.overload.cpp" }, - "60": { + "56": { "patterns": [ { "include": "#inline_comment" } ] }, - "61": { + "57": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "62": { + "58": { "name": "comment.block.cpp" }, - "63": { + "59": { "patterns": [ { "match": "\\*\\/", @@ -7570,7 +8539,7 @@ } ] }, - "64": { + "60": { "patterns": [ { "match": "::", @@ -7585,7 +8554,7 @@ } ] }, - "66": { + "61": { "name": "meta.template.call.cpp", "patterns": [ { @@ -7593,20 +8562,21 @@ } ] }, - "68": { + "62": {}, + "63": { "name": "entity.name.operator.cpp" }, - "69": { + "64": { "name": "entity.name.operator.type.cpp" }, - "70": { + "65": { "patterns": [ { "match": "\\*", "name": "entity.name.operator.type.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7642,20 +8612,20 @@ } ] }, - "71": { + "66": { "patterns": [ { "include": "#inline_comment" } ] }, - "72": { + "67": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "73": { + "68": { "name": "comment.block.cpp" }, - "74": { + "69": { "patterns": [ { "match": "\\*\\/", @@ -7667,20 +8637,20 @@ } ] }, - "75": { + "70": { "patterns": [ { "include": "#inline_comment" } ] }, - "76": { + "71": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "77": { + "72": { "name": "comment.block.cpp" }, - "78": { + "73": { "patterns": [ { "match": "\\*\\/", @@ -7692,20 +8662,20 @@ } ] }, - "79": { + "74": { "patterns": [ { "include": "#inline_comment" } ] }, - "80": { + "75": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "81": { + "76": { "name": "comment.block.cpp" }, - "82": { + "77": { "patterns": [ { "match": "\\*\\/", @@ -7717,26 +8687,26 @@ } ] }, - "83": { + "78": { "name": "entity.name.operator.type.array.cpp" }, - "84": { + "79": { "name": "entity.name.operator.custom-literal.cpp" }, - "85": { + "80": { "patterns": [ { "include": "#inline_comment" } ] }, - "86": { + "81": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "87": { + "82": { "name": "comment.block.cpp" }, - "88": { + "83": { "patterns": [ { "match": "\\*\\/", @@ -7748,23 +8718,23 @@ } ] }, - "89": { + "84": { "name": "entity.name.operator.custom-literal.cpp" }, - "90": { + "85": { "patterns": [ { "include": "#inline_comment" } ] }, - "91": { + "86": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "92": { + "87": { "name": "comment.block.cpp" }, - "93": { + "88": { "patterns": [ { "match": "\\*\\/", @@ -7777,17 +8747,19 @@ ] } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.function.definition.special.operator-overload.cpp", "patterns": [ { - "name": "meta.head.function.definition.special.operator-overload.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.function.definition.special.operator-overload.cpp" } }, + "name": "meta.head.function.definition.special.operator-overload.cpp", "patterns": [ { "include": "#ever_present_context" @@ -7796,19 +8768,19 @@ "include": "#template_call_range" }, { - "contentName": "meta.function.definition.parameters.special.operator-overload.cpp", - "begin": "(\\()", + "begin": "\\(", + "end": "\\)", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.begin.bracket.round.special.operator-overload.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.parameters.end.bracket.round.special.operator-overload.cpp" } }, + "contentName": "meta.function.definition.parameters.special.operator-overload", "patterns": [ { "include": "#function_parameter_context" @@ -7827,14 +8799,15 @@ ] }, { - "name": "meta.body.function.definition.special.operator-overload.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.function.definition.special.operator-overload.cpp" } }, + "name": "meta.body.function.definition.special.operator-overload.cpp", "patterns": [ { "include": "#function_body_context" @@ -7842,9 +8815,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.function.definition.special.operator-overload.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -7856,159 +8831,26 @@ "operators": { "patterns": [ { - "include": "#sizeof_operator" - }, - { - "include": "#alignof_operator" - }, - { - "include": "#alignas_operator" - }, - { - "include": "#typeid_operator" - }, - { - "include": "#noexcept_operator" - }, - { - "include": "#sizeof_variadic_operator" - }, - { - "match": "--", - "name": "keyword.operator.decrement.cpp" - }, - { - "match": "\\+\\+", - "name": "keyword.operator.increment.cpp" - }, - { - "match": "%=|\\+=|-=|\\*=|(?>=|\\|=", - "name": "keyword.operator.assignment.compound.bitwise.cpp" - }, - { - "match": "<<|>>", - "name": "keyword.operator.bitwise.shift.cpp" - }, - { - "match": "!=|<=|>=|==|<|>", - "name": "keyword.operator.comparison.cpp" - }, - { - "match": "&&|!|\\|\\|", - "name": "keyword.operator.logical.cpp" - }, - { - "match": "&|\\||\\^|~", - "name": "keyword.operator.cpp" - }, - { - "include": "#assignment_operator" - }, - { - "match": "%|\\*|\\/|-|\\+", - "name": "keyword.operator.cpp" - }, - { - "include": "#ternary_operator" - } - ] - }, - "over_qualified_types": { - "patterns": [ - { - "include": "#parameter_struct" - }, - { - "include": "#parameter_enum" - }, - { - "include": "#parameter_union" - }, - { - "include": "#parameter_class" - } - ] - }, - "parameter": { - "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "end": "(?:(?=\\))|(,))", - "endCaptures": { - "1": { - "name": "punctuation.separator.delimiter.comma.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#function_pointer_parameter" - }, - { - "include": "#decltype" - }, - { - "include": "#vararg_ellipses" - }, - { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", - "captures": { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { "1": { - "patterns": [ - { - "include": "#storage_types" - } - ] + "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" }, "2": { - "name": "storage.modifier.specifier.parameter.cpp" - }, - "3": { "patterns": [ { "include": "#inline_comment" } ] }, - "4": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "5": { + "4": { "name": "comment.block.cpp" }, - "6": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8020,20 +8862,43 @@ } ] }, - "7": { + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.cpp" + } + }, + "contentName": "meta.arguments.operator.sizeof", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.alignof.cpp" + }, + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "9": { + "4": { "name": "comment.block.cpp" }, - "10": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8045,20 +8910,43 @@ } ] }, - "11": { + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.alignof.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.alignof.cpp" + } + }, + "contentName": "meta.arguments.operator.alignof", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.alignas.cpp" + }, + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "12": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "13": { + "4": { "name": "comment.block.cpp" }, - "14": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8070,48 +8958,43 @@ } ] }, - "15": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "16": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "17": { - "name": "comment.block.cpp" - }, - "18": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "19": { - "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.alignas.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.alignas.cpp" + } + }, + "contentName": "meta.arguments.operator.alignas", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.typeid.cpp" }, - "20": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "21": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "22": { + "4": { "name": "comment.block.cpp" }, - "23": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8123,23 +9006,43 @@ } ] }, - "24": { - "name": "storage.type.cpp storage.type.built-in.cpp" + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.typeid.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.typeid.cpp" + } + }, + "contentName": "meta.arguments.operator.typeid", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.noexcept.cpp" }, - "25": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "26": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "27": { + "4": { "name": "comment.block.cpp" }, - "28": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8151,23 +9054,43 @@ } ] }, - "29": { - "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.noexcept.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.noexcept.cpp" + } + }, + "contentName": "meta.arguments.operator.noexcept", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + { + "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" }, - "30": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "31": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "32": { + "4": { "name": "comment.block.cpp" }, - "33": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -8179,165 +9102,153 @@ } ] }, - "34": { - "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" - }, - "35": { - "name": "entity.name.type.parameter.cpp" - }, - "36": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "37": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "38": { - "name": "comment.block.cpp" - }, - "39": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.variadic.cpp" } - } - }, - { - "include": "#storage_types" - }, - { - "include": "#scope_resolution_parameter_inner_generated" - }, - { - "match": "(?:struct|class|union|enum)", - "name": "storage.type.$0.cpp" - }, - { - "begin": "(?<==)", - "end": "(?:(?=\\))|(,))", + }, "endCaptures": { - "1": { - "name": "punctuation.separator.delimiter.comma.cpp" + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.variadic.cpp" } }, + "contentName": "meta.arguments.operator.sizeof.variadic", "patterns": [ { "include": "#evaluation_context" } ] }, + { + "match": "--", + "name": "keyword.operator.decrement.cpp" + }, + { + "match": "\\+\\+", + "name": "keyword.operator.increment.cpp" + }, + { + "match": "%=|\\+=|-=|\\*=|(?>=|\\|=", + "name": "keyword.operator.assignment.compound.bitwise.cpp" + }, + { + "match": "<<|>>", + "name": "keyword.operator.bitwise.shift.cpp" + }, + { + "match": "!=|<=|>=|==|<|>", + "name": "keyword.operator.comparison.cpp" + }, + { + "match": "&&|!|\\|\\|", + "name": "keyword.operator.logical.cpp" + }, + { + "match": "&|\\||\\^|~", + "name": "keyword.operator.cpp" + }, { "include": "#assignment_operator" }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\)|,|\\[|=|\\n)", + "match": "%|\\*|\\/|-|\\+", + "name": "keyword.operator.cpp" + }, + { + "include": "#ternary_operator" + } + ] + }, + "over_qualified_types": { + "patterns": [ + { + "match": "(struct)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", "captures": { "1": { + "name": "storage.type.struct.parameter.cpp" + }, + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, "3": { - "name": "comment.block.cpp" - }, - "4": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, + "4": { + "name": "entity.name.type.struct.parameter.cpp" + }, "5": { - "name": "variable.parameter.cpp" + "patterns": [ + { + "include": "#inline_comment" + } + ] }, "6": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - { - "include": "#attributes_context" - }, - { - "name": "meta.bracket.square.array.cpp", - "begin": "(\\[)", - "beginCaptures": { - "1": { - "name": "punctuation.definition.begin.bracket.square.array.type.cpp" - } - }, - "end": "(\\])", - "endCaptures": { - "1": { - "name": "punctuation.definition.end.bracket.square.array.type.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - { - "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", - "captures": { - "0": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8373,1003 +9284,822 @@ } ] }, - "1": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - "3": { - "name": "comment.block.cpp" + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - "4": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "patterns": [ { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "5": { + "13": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "14": { + "name": "variable.other.object.declare.cpp" + }, + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "6": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "16": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - "7": { - "name": "comment.block.cpp" + "17": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - "8": { + "18": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "19": { + "patterns": [ { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" + } + ] + }, + "20": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] } } - } - ] - }, - "parameter_class": { - "match": "(class)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.class.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + { + "match": "(enum)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", + "captures": { + "1": { + "name": "storage.type.enum.parameter.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.class.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" + "4": { + "name": "entity.name.type.enum.parameter.cpp" + }, + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "6": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" + } + } + ] + }, + "7": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_enum": { - "match": "(enum)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.enum.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.enum.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" + "12": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "13": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "2": { "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] + } } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_or_maybe_value": { - "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", - "beginCaptures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "14": { + "name": "variable.other.object.declare.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - }, - "end": "(?:(?=\\))|(,))", - "endCaptures": { - "1": { - "name": "punctuation.separator.delimiter.comma.cpp" - } - }, - "patterns": [ - { - "include": "#ever_present_context" - }, - { - "include": "#function_pointer_parameter" - }, - { - "include": "#memory_operators" - }, - { - "include": "#builtin_storage_type_initilizer" - }, - { - "include": "#curly_initializer" - }, - { - "include": "#decltype" - }, - { - "include": "#vararg_ellipses" - }, - { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", - "captures": { - "1": { + "15": { "patterns": [ { - "include": "#storage_types" + "include": "#inline_comment" } ] }, - "2": { - "name": "storage.modifier.specifier.parameter.cpp" - }, - "3": { + "16": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "4": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "5": { - "name": "comment.block.cpp" - }, - "6": { + "17": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "7": { + "18": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { + "19": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "11": { + "20": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] + } + } + }, + { + "match": "(union)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", + "captures": { + "1": { + "name": "storage.type.union.parameter.cpp" }, - "12": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "13": { - "name": "comment.block.cpp" - }, - "14": { + "2": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "15": { + "3": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "17": { - "name": "comment.block.cpp" + "4": { + "name": "entity.name.type.union.parameter.cpp" }, - "18": { + "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "19": { - "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" - }, - "20": { + "6": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, - "24": { - "name": "storage.type.cpp storage.type.built-in.cpp" - }, - "25": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "29": { - "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" - }, - "30": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "31": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "32": { - "name": "comment.block.cpp" - }, - "33": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "34": { - "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" - }, - "35": { - "name": "entity.name.type.parameter.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - "36": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "37": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "38": { - "name": "comment.block.cpp" - }, - "39": { + "13": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] - } - } - }, - { - "include": "#storage_types" - }, - { - "include": "#function_call" - }, - { - "include": "#scope_resolution_parameter_inner_generated" - }, - { - "match": "(?:struct|class|union|enum)", - "name": "storage.type.$0.cpp" - }, - { - "begin": "(?<==)", - "end": "(?:(?=\\))|(,))", - "endCaptures": { - "1": { - "name": "punctuation.separator.delimiter.comma.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", - "captures": { - "1": { + }, + "14": { + "name": "variable.other.object.declare.cpp" + }, + "15": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { + "16": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "variable.parameter.cpp" - }, - "6": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - { - "include": "#attributes_context" - }, - { - "name": "meta.bracket.square.array.cpp", - "begin": "(\\[)", - "beginCaptures": { - "1": { - "name": "punctuation.definition.begin.bracket.square.array.type.cpp" - } - }, - "end": "(\\])", - "endCaptures": { - "1": { - "name": "punctuation.definition.end.bracket.square.array.type.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - { - "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", - "captures": { - "0": { + "18": { "patterns": [ { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" - }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", "captures": { "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "3": { + "2": { "name": "comment.block.cpp" }, - "4": { + "3": { "patterns": [ { "match": "\\*\\/", @@ -9381,266 +10111,395 @@ } ] } - }, - "name": "invalid.illegal.reference-type.cpp" - }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" + } } ] }, - "1": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { + "20": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] + } + } + }, + { + "match": "(class)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", + "captures": { + "1": { + "name": "storage.type.class.parameter.cpp" }, - "5": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "6": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "7": { - "name": "comment.block.cpp" - }, - "8": { + "3": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] - } - } - }, - { - "include": "#evaluation_context" - } - ] - }, - "parameter_struct": { - "match": "(struct)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.struct.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.struct.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "4": { + "name": "entity.name.type.class.parameter.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" + "6": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + } + } + ] + }, + "7": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, - "3": { - "name": "comment.block.cpp" + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "2": { "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] + } } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "12": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" + "13": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "14": { + "name": "variable.other.object.declare.cpp" + }, + "15": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "16": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "17": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "18": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "19": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "20": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { + } + } + ] + }, + "parameter": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\w)", + "end": "(?:(?=\\))|(,))", + "beginCaptures": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "26": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "27": { + "3": { "name": "comment.block.cpp" }, - "28": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -9651,437 +10510,479 @@ "name": "comment.block.cpp" } ] + } + }, + "endCaptures": { + "1": { + "name": "punctuation.separator.delimiter.comma.cpp" + } + }, + "name": "meta.parameter.cpp", + "patterns": [ + { + "include": "#ever_present_context" }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] + { + "include": "#function_pointer_parameter" }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + { + "include": "#decltype" }, - "31": { - "name": "comment.block.cpp" + { + "include": "#vararg_ellipses" }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + { + "match": "((?:((?:(?:volatile)|(?:register)|(?:restrict)|(?:static)|(?:extern)|(?:const)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))+)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=,|\\)|=)", + "captures": { + "1": { + "patterns": [ + { + "include": "#storage_types" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "2": { + "name": "storage.modifier.specifier.parameter.cpp" }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - } - } - }, - "parameter_union": { - "match": "(union)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", - "captures": { - "1": { - "name": "storage.type.union.parameter.cpp" - }, - "2": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "3": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "6": { - "name": "entity.name.type.union.parameter.cpp" - }, - "7": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "4": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "5": { "name": "comment.block.cpp" - } - ] - }, - "11": { - "patterns": [ - { - "match": "\\*", - "name": "storage.modifier.pointer.cpp" }, - { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", - "captures": { - "1": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "6": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "3": { + { + "match": "\\*", "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] } - }, - "name": "invalid.illegal.reference-type.cpp" + ] }, - { - "match": "\\&", - "name": "storage.modifier.reference.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "7": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "16": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "8": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - { - "match": "\\*", + "9": { "name": "comment.block.cpp" - } - ] - }, - "20": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", + "10": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "11": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "12": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "13": { "name": "comment.block.cpp" - } - ] - }, - "24": { - "name": "variable.other.object.declare.cpp" - }, - "25": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "26": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "27": { - "name": "comment.block.cpp" - }, - "28": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", + "14": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "15": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "16": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "17": { "name": "comment.block.cpp" - } - ] - }, - "29": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", + "18": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "19": { + "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" + }, + "20": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "21": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "22": { "name": "comment.block.cpp" - } - ] - }, - "33": { - "patterns": [ - { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" - }, - "36": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - { - "match": "\\*", + "23": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "24": { + "name": "storage.type.cpp storage.type.built-in.cpp" + }, + "25": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "26": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "27": { + "name": "comment.block.cpp" + }, + "28": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "29": { + "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" + }, + "30": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "31": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "32": { + "name": "comment.block.cpp" + }, + "33": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "34": { + "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" + }, + "35": { + "name": "entity.name.type.parameter.cpp" + }, + "36": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "37": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "38": { "name": "comment.block.cpp" + }, + "39": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] - } - } - }, - "parentheses": { - "name": "meta.parens.cpp", - "begin": "(\\()", - "beginCaptures": { - "1": { - "name": "punctuation.section.parens.begin.bracket.round.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.parens.end.bracket.round.cpp" - } - }, - "patterns": [ + } + }, { - "include": "#over_qualified_types" + "include": "#storage_types" }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\)|,|\\[|=|\\n)", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] }, - { - "match": "\\*", + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "name": "variable.parameter.cpp" + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] + } }, - "5": { - "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" - } - } - }, - "pragma": { - "name": "meta.preprocessor.pragma.cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\b)", - "beginCaptures": { - "1": { - "name": "keyword.control.directive.pragma.cpp" + { + "include": "#attributes_context" }, - "2": { - "patterns": [ - { - "include": "#inline_comment" + { + "begin": "\\[", + "end": "\\]", + "beginCaptures": { + "0": { + "name": "punctuation.definition.begin.bracket.square.array.type.cpp" } - ] - }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.square.array.type.cpp" + } + }, + "name": "meta.bracket.square.array.cpp", "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#evaluation_context" } ] }, - "6": { - "name": "punctuation.definition.directive.cpp" - } - }, - "end": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*))", + "captures": { + "0": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "6": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "7": { + "name": "comment.block.cpp" + }, + "8": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "pragma_mark": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\s+mark)\\s+(.*)", + "parameter_class": { + "match": "(class)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", "captures": { "1": { - "name": "keyword.control.directive.pragma.pragma-mark.cpp" + "name": "storage.type.class.parameter.cpp" }, "2": { "patterns": [ @@ -10091,1504 +10992,1571 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, "4": { - "name": "comment.block.cpp" + "name": "entity.name.type.class.parameter.cpp" }, "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, "6": { - "name": "punctuation.definition.directive.cpp" - }, - "7": { - "name": "entity.name.tag.pragma-mark.cpp" - } - }, - "name": "meta.preprocessor.pragma.cpp" - }, - "predefined_macros": { - "patterns": [ - { - "match": "\\b(__cplusplus|__DATE__|__FILE__|__LINE__|__STDC__|__STDC_HOSTED__|__STDC_NO_COMPLEX__|__STDC_VERSION__|__STDCPP_THREADS__|__TIME__|NDEBUG|__OBJC__|__ASSEMBLER__|__ATOM__|__AVX__|__AVX2__|_CHAR_UNSIGNED|__CLR_VER|_CONTROL_FLOW_GUARD|__COUNTER__|__cplusplus_cli|__cplusplus_winrt|_CPPRTTI|_CPPUNWIND|_DEBUG|_DLL|__FUNCDNAME__|__FUNCSIG__|__FUNCTION__|_INTEGRAL_MAX_BITS|__INTELLISENSE__|_ISO_VOLATILE|_KERNEL_MODE|_M_AMD64|_M_ARM|_M_ARM_ARMV7VE|_M_ARM_FP|_M_ARM64|_M_CEE|_M_CEE_PURE|_M_CEE_SAFE|_M_FP_EXCEPT|_M_FP_FAST|_M_FP_PRECISE|_M_FP_STRICT|_M_IX86|_M_IX86_FP|_M_X64|_MANAGED|_MSC_BUILD|_MSC_EXTENSIONS|_MSC_FULL_VER|_MSC_VER|_MSVC_LANG|__MSVC_RUNTIME_CHECKS|_MT|_NATIVE_WCHAR_T_DEFINED|_OPENMP|_PREFAST|__TIMESTAMP__|_VC_NO_DEFAULTLIB|_WCHAR_T_DEFINED|_WIN32|_WIN64|_WINRT_DLL|_ATL_VER|_MFC_VER|__GFORTRAN__|__GNUC__|__GNUC_MINOR__|__GNUC_PATCHLEVEL__|__GNUG__|__STRICT_ANSI__|__BASE_FILE__|__INCLUDE_LEVEL__|__ELF__|__VERSION__|__OPTIMIZE__|__OPTIMIZE_SIZE__|__NO_INLINE__|__GNUC_STDC_INLINE__|__CHAR_UNSIGNED__|__WCHAR_UNSIGNED__|__REGISTER_PREFIX__|__REGISTER_PREFIX__|__SIZE_TYPE__|__PTRDIFF_TYPE__|__WCHAR_TYPE__|__WINT_TYPE__|__INTMAX_TYPE__|__UINTMAX_TYPE__|__SIG_ATOMIC_TYPE__|__INT8_TYPE__|__INT16_TYPE__|__INT32_TYPE__|__INT64_TYPE__|__UINT8_TYPE__|__UINT16_TYPE__|__UINT32_TYPE__|__UINT64_TYPE__|__INT_LEAST8_TYPE__|__INT_LEAST16_TYPE__|__INT_LEAST32_TYPE__|__INT_LEAST64_TYPE__|__UINT_LEAST8_TYPE__|__UINT_LEAST16_TYPE__|__UINT_LEAST32_TYPE__|__UINT_LEAST64_TYPE__|__INT_FAST8_TYPE__|__INT_FAST16_TYPE__|__INT_FAST32_TYPE__|__INT_FAST64_TYPE__|__UINT_FAST8_TYPE__|__UINT_FAST16_TYPE__|__UINT_FAST32_TYPE__|__UINT_FAST64_TYPE__|__INTPTR_TYPE__|__UINTPTR_TYPE__|__CHAR_BIT__|__SCHAR_MAX__|__WCHAR_MAX__|__SHRT_MAX__|__INT_MAX__|__LONG_MAX__|__LONG_LONG_MAX__|__WINT_MAX__|__SIZE_MAX__|__PTRDIFF_MAX__|__INTMAX_MAX__|__UINTMAX_MAX__|__SIG_ATOMIC_MAX__|__INT8_MAX__|__INT16_MAX__|__INT32_MAX__|__INT64_MAX__|__UINT8_MAX__|__UINT16_MAX__|__UINT32_MAX__|__UINT64_MAX__|__INT_LEAST8_MAX__|__INT_LEAST16_MAX__|__INT_LEAST32_MAX__|__INT_LEAST64_MAX__|__UINT_LEAST8_MAX__|__UINT_LEAST16_MAX__|__UINT_LEAST32_MAX__|__UINT_LEAST64_MAX__|__INT_FAST8_MAX__|__INT_FAST16_MAX__|__INT_FAST32_MAX__|__INT_FAST64_MAX__|__UINT_FAST8_MAX__|__UINT_FAST16_MAX__|__UINT_FAST32_MAX__|__UINT_FAST64_MAX__|__INTPTR_MAX__|__UINTPTR_MAX__|__WCHAR_MIN__|__WINT_MIN__|__SIG_ATOMIC_MIN__|__SCHAR_WIDTH__|__SHRT_WIDTH__|__INT_WIDTH__|__LONG_WIDTH__|__LONG_LONG_WIDTH__|__PTRDIFF_WIDTH__|__SIG_ATOMIC_WIDTH__|__SIZE_WIDTH__|__WCHAR_WIDTH__|__WINT_WIDTH__|__INT_LEAST8_WIDTH__|__INT_LEAST16_WIDTH__|__INT_LEAST32_WIDTH__|__INT_LEAST64_WIDTH__|__INT_FAST8_WIDTH__|__INT_FAST16_WIDTH__|__INT_FAST32_WIDTH__|__INT_FAST64_WIDTH__|__INTPTR_WIDTH__|__INTMAX_WIDTH__|__SIZEOF_INT__|__SIZEOF_LONG__|__SIZEOF_LONG_LONG__|__SIZEOF_SHORT__|__SIZEOF_POINTER__|__SIZEOF_FLOAT__|__SIZEOF_DOUBLE__|__SIZEOF_LONG_DOUBLE__|__SIZEOF_SIZE_T__|__SIZEOF_WCHAR_T__|__SIZEOF_WINT_T__|__SIZEOF_PTRDIFF_T__|__BYTE_ORDER__|__ORDER_LITTLE_ENDIAN__|__ORDER_BIG_ENDIAN__|__ORDER_PDP_ENDIAN__|__FLOAT_WORD_ORDER__|__DEPRECATED|__EXCEPTIONS|__GXX_RTTI|__USING_SJLJ_EXCEPTIONS__|__GXX_EXPERIMENTAL_CXX0X__|__GXX_WEAK__|__NEXT_RUNTIME__|__LP64__|_LP64|__SSP__|__SSP_ALL__|__SSP_STRONG__|__SSP_EXPLICIT__|__SANITIZE_ADDRESS__|__SANITIZE_THREAD__|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16|__HAVE_SPECULATION_SAFE_VALUE|__GCC_HAVE_DWARF2_CFI_ASM|__FP_FAST_FMA|__FP_FAST_FMAF|__FP_FAST_FMAL|__FP_FAST_FMAF16|__FP_FAST_FMAF32|__FP_FAST_FMAF64|__FP_FAST_FMAF128|__FP_FAST_FMAF32X|__FP_FAST_FMAF64X|__FP_FAST_FMAF128X|__GCC_IEC_559|__GCC_IEC_559_COMPLEX|__NO_MATH_ERRNO__|__has_builtin|__has_feature|__has_extension|__has_cpp_attribute|__has_c_attribute|__has_attribute|__has_declspec_attribute|__is_identifier|__has_include|__has_include_next|__has_warning|__BASE_FILE__|__FILE_NAME__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__fp16|_Float16)\\b", - "captures": { - "1": { - "name": "entity.name.other.preprocessor.macro.predefined.$1.cpp" - } - } - }, - { - "match": "\\b__([A-Z_]+)__\\b", - "name": "entity.name.other.preprocessor.macro.predefined.probably.$1.cpp" - } - ] - }, - "preprocessor_conditional_context": { - "patterns": [ - { - "include": "#preprocessor_conditional_defined" - }, - { - "include": "#comments" - }, - { - "include": "#language_constants" - }, - { - "include": "#string_context_c" - }, - { - "include": "#preprocessor_number_literal" - }, - { - "include": "#operators" - }, - { - "include": "#predefined_macros" - }, - { - "include": "#macro_name" - }, - { - "include": "#line_continuation_character" - } - ] - }, - "preprocessor_conditional_defined": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:(?:ifndef|ifdef)|if)))", - "beginCaptures": { - "1": { - "name": "keyword.control.directive.conditional.$7.cpp" - }, - "2": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, - "6": { - "name": "punctuation.definition.directive.cpp" - } - }, - "end": "(?:^)(?!\\s*+#\\s*(?:else|endif))", - "patterns": [ - { - "name": "meta.preprocessor.conditional.cpp", - "begin": "\\G(?<=ifndef|ifdef|if)", - "end": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { + "10": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "5": { - "name": "punctuation.definition.directive.cpp" - } - }, - "name": "keyword.control.directive.$6.cpp" - }, - "preprocessor_number_literal": { - "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" }, - "2": { - "name": "constant.numeric.hexadecimal.cpp", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric.cpp" - } - ] - }, - "3": { - "name": "punctuation.separator.constant.numeric.cpp" - }, - "4": { - "name": "constant.numeric.hexadecimal.cpp" - }, - "5": { - "name": "constant.numeric.hexadecimal.cpp", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric.cpp" - } - ] - }, - "6": { - "name": "punctuation.separator.constant.numeric.cpp" - }, - "8": { - "name": "keyword.other.unit.exponent.hexadecimal.cpp" - }, - "9": { - "name": "keyword.operator.plus.exponent.hexadecimal.cpp" - }, - "10": { - "name": "keyword.operator.minus.exponent.hexadecimal.cpp" - }, - "11": { - "name": "constant.numeric.exponent.hexadecimal.cpp", - "patterns": [ - { - "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])", - "name": "punctuation.separator.constant.numeric.cpp" - } - ] - }, - "12": { - "name": "keyword.other.unit.suffix.floating-point.cpp" - } - } - }, - { - "match": "(\\G(?=[0-9.])(?!0[xXbB]))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] + "14": { + "name": "variable.other.object.declare.cpp" }, - "5": { - "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" - } - } - }, - "qualified_type": { - "match": "\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", - "captures": { - "0": { - "name": "meta.qualified_type.cpp", + "15": { "patterns": [ { - "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "18": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { + "20": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] + } + } + }, + "parameter_enum": { + "match": "(enum)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", + "captures": { + "1": { + "name": "storage.type.enum.parameter.cpp" }, - "11": { + "2": { "patterns": [ { - "include": "#scope_resolution_inner_generated" + "include": "#inline_comment" } ] }, - "12": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "14": { - "name": "meta.template.call.cpp", + "3": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { - "name": "entity.name.scope-resolution.cpp" + "4": { + "name": "entity.name.type.enum.parameter.cpp" }, - "17": { - "name": "meta.template.call.cpp", + "5": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "19": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "20": { + "6": { "patterns": [ { - "include": "#inline_comment" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "21": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "22": { - "name": "comment.block.cpp" - }, - "23": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" }, { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, - "24": { - "name": "entity.name.type.cpp" - }, - "25": { - "name": "meta.template.call.cpp", + "8": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] - } - } - }, - "qualifiers_and_specifiers_post_parameters": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" - }, - "4": { + "10": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] }, - "5": { - "name": "storage.modifier.specifier.functional.post-parameters.$5.cpp" - } - } - }, - "scope_resolution": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { + "11": { "patterns": [ { - "include": "#scope_resolution_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "3": { - "name": "meta.template.call.cpp", + "12": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] - } - } - }, - "scope_resolution_function_call": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { + }, + "13": { "patterns": [ { - "include": "#scope_resolution_function_call_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + "14": { + "name": "variable.other.object.declare.cpp" }, - "3": { - "name": "meta.template.call.cpp", + "15": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] - } - } - }, - "scope_resolution_function_call_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { + }, + "16": { "patterns": [ { - "include": "#scope_resolution_function_call_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" - }, - "4": { - "name": "meta.template.call.cpp", + "17": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "6": { - "name": "entity.name.scope-resolution.function.call.cpp" - }, - "7": { - "name": "meta.template.call.cpp", + "18": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" - } - } - }, - "scope_resolution_function_definition": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { + "19": { "patterns": [ { - "include": "#scope_resolution_function_definition_inner_generated" + "include": "#inline_comment" } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - }, - "3": { - "name": "meta.template.call.cpp", + "20": { "patterns": [ { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_function_definition_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.function.definition.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" - } - } - }, - "scope_resolution_function_definition_operator_overload": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_function_definition_operator_overload_inner_generated" - } - ] - }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] } } }, - "scope_resolution_function_definition_operator_overload_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { + "parameter_or_maybe_value": { + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\w)", + "end": "(?:(?=\\))|(,))", + "beginCaptures": { "1": { "patterns": [ { - "include": "#scope_resolution_function_definition_operator_overload_inner_generated" + "include": "#inline_comment" } ] }, "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.function.definition.operator-overload.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" - } - } - }, - "scope_resolution_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_inner_generated" - } - ] + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + "3": { + "name": "comment.block.cpp" }, "4": { - "name": "meta.template.call.cpp", "patterns": [ { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.cpp" - }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, { - "include": "#template_call_range" + "match": "\\*", + "name": "comment.block.cpp" } ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" } - } - }, - "scope_resolution_namespace_alias": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_alias_inner_generated" - } - ] - }, + }, + "endCaptures": { "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] + "name": "punctuation.separator.delimiter.comma.cpp" } - } - }, - "scope_resolution_namespace_alias_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_alias_inner_generated" - } - ] - }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "6": { - "name": "entity.name.scope-resolution.namespace.alias.cpp" + }, + "name": "meta.parameter.cpp", + "patterns": [ + { + "include": "#ever_present_context" }, - "7": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] + { + "include": "#function_pointer_parameter" }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" - } - } - }, - "scope_resolution_namespace_block": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_block_inner_generated" - } - ] + { + "include": "#memory_operators" }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + { + "include": "#builtin_storage_type_initilizer" }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_namespace_block_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_block_inner_generated" - } - ] + { + "include": "#curly_initializer" }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + { + "include": "#decltype" }, - "4": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] + { + "include": "#vararg_ellipses" }, - "6": { - "name": "entity.name.scope-resolution.namespace.block.cpp" + { + "match": "((?:((?:(?:volatile)|(?:register)|(?:restrict)|(?:static)|(?:extern)|(?:const)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))+)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=,|\\)|=)", + "captures": { + "1": { + "patterns": [ + { + "include": "#storage_types" + } + ] + }, + "2": { + "name": "storage.modifier.specifier.parameter.cpp" + }, + "3": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "4": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "5": { + "name": "comment.block.cpp" + }, + "6": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "7": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "8": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "9": { + "name": "comment.block.cpp" + }, + "10": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "11": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "12": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "13": { + "name": "comment.block.cpp" + }, + "14": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "15": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "16": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "17": { + "name": "comment.block.cpp" + }, + "18": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "19": { + "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" + }, + "20": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "21": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "22": { + "name": "comment.block.cpp" + }, + "23": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "24": { + "name": "storage.type.cpp storage.type.built-in.cpp" + }, + "25": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "26": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "27": { + "name": "comment.block.cpp" + }, + "28": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "29": { + "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" + }, + "30": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "31": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "32": { + "name": "comment.block.cpp" + }, + "33": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "34": { + "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" + }, + "35": { + "name": "entity.name.type.parameter.cpp" + }, + "36": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "37": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "38": { + "name": "comment.block.cpp" + }, + "39": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } }, - "7": { - "name": "meta.template.call.cpp", + { + "include": "#storage_types" + }, + { + "include": "#function_call" + }, + { + "include": "#scope_resolution_parameter_inner_generated" + }, + { + "match": "(?:(?:struct)|(?:class)|(?:union)|(?:enum))", + "name": "storage.type.$0.cpp" + }, + { + "begin": "(?<==)", + "end": "(?:(?=\\))|(,))", + "beginCaptures": {}, + "endCaptures": { + "1": { + "name": "punctuation.separator.delimiter.comma.cpp" + } + }, "patterns": [ { - "include": "#template_call_range" + "include": "#evaluation_context" } ] }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" - } - } - }, - "scope_resolution_namespace_using": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { - "patterns": [ - { - "include": "#scope_resolution_namespace_using_inner_generated" + { + "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:(?:\\n)|$)))", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "name": "variable.parameter.cpp" + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "8": { + "name": "comment.block.cpp" + }, + "9": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] } - ] + } }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" + { + "include": "#attributes_context" }, - "3": { - "name": "meta.template.call.cpp", + { + "begin": "\\[", + "end": "\\]", + "beginCaptures": { + "0": { + "name": "punctuation.definition.begin.bracket.square.array.type.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.square.array.type.cpp" + } + }, + "name": "meta.bracket.square.array.cpp", "patterns": [ { - "include": "#template_call_range" + "include": "#evaluation_context" } ] + }, + { + "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*))", + "captures": { + "0": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "6": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "7": { + "name": "comment.block.cpp" + }, + "8": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + }, + { + "include": "#evaluation_context" } - } + ] }, - "scope_resolution_namespace_using_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", + "parameter_struct": { + "match": "(struct)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", "captures": { "1": { - "patterns": [ - { - "include": "#scope_resolution_namespace_using_inner_generated" - } - ] + "name": "storage.type.struct.parameter.cpp" }, "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" - }, - "4": { - "name": "meta.template.call.cpp", "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "6": { - "name": "entity.name.scope-resolution.namespace.using.cpp" - }, - "7": { - "name": "meta.template.call.cpp", + "3": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" - } - } - }, - "scope_resolution_parameter": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { + "4": { + "name": "entity.name.type.struct.parameter.cpp" + }, + "5": { "patterns": [ { - "include": "#scope_resolution_parameter_inner_generated" + "include": "#inline_comment" } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - }, - "3": { - "name": "meta.template.call.cpp", + "6": { "patterns": [ { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_parameter_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { - "patterns": [ - { - "include": "#scope_resolution_parameter_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - }, - "4": { - "name": "meta.template.call.cpp", + "7": { "patterns": [ { - "include": "#template_call_range" + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" } ] }, - "6": { - "name": "entity.name.scope-resolution.parameter.cpp" - }, - "7": { - "name": "meta.template.call.cpp", + "8": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" - } - } - }, - "scope_resolution_template_call": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { "patterns": [ { - "include": "#scope_resolution_template_call_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - }, - "3": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - } - } - }, - "scope_resolution_template_call_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { + "10": { "patterns": [ { - "include": "#scope_resolution_template_call_inner_generated" + "include": "#inline_comment" } ] }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - }, - "4": { - "name": "meta.template.call.cpp", + "11": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { - "name": "entity.name.scope-resolution.template.call.cpp" - }, - "7": { - "name": "meta.template.call.cpp", + "12": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" - } - } - }, - "scope_resolution_template_definition": { - "match": "(::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<4>?)+)>)\\s*)?::)*\\s*+", - "captures": { - "0": { + "13": { "patterns": [ { - "include": "#scope_resolution_template_definition_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "1": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" + "14": { + "name": "variable.other.object.declare.cpp" }, - "3": { - "name": "meta.template.call.cpp", + "15": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] - } - } - }, - "scope_resolution_template_definition_inner_generated": { - "match": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<8>?)+)>)\\s*)?(::)", - "captures": { - "1": { + }, + "16": { "patterns": [ { - "include": "#scope_resolution_template_definition_inner_generated" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "2": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" - }, - "4": { - "name": "meta.template.call.cpp", + "17": { "patterns": [ { - "include": "#template_call_range" + "include": "#inline_comment" } ] }, - "6": { - "name": "entity.name.scope-resolution.template.definition.cpp" - }, - "7": { - "name": "meta.template.call.cpp", + "18": { "patterns": [ { - "include": "#template_call_range" - } - ] - }, - "9": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" - } - } - }, - "semicolon": { - "match": ";", - "name": "punctuation.terminator.statement.cpp" - }, - "simple_type": { - "match": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?", - "captures": { - "1": { - "name": "meta.qualified_type.cpp", - "patterns": [ - { - "match": "(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "3": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "4": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "5": { - "name": "comment.block.cpp" - }, - "6": { + "20": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] + } + } + }, + "parameter_union": { + "match": "(union)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:\\[((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\]((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?=,|\\)|\\n)", + "captures": { + "1": { + "name": "storage.type.union.parameter.cpp" }, - "7": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "12": { - "patterns": [ - { - "include": "#scope_resolution_inner_generated" - } - ] - }, - "13": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" - }, - "15": { - "name": "meta.template.call.cpp", - "patterns": [ - { - "include": "#template_call_range" - } - ] - }, - "17": { - "name": "entity.name.scope-resolution.cpp" - }, - "18": { - "name": "meta.template.call.cpp", + "3": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { - "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + "4": { + "name": "entity.name.type.union.parameter.cpp" }, - "21": { + "5": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "25": { - "name": "entity.name.type.cpp" - }, - "26": { - "name": "meta.template.call.cpp", + "6": { "patterns": [ { - "include": "#template_call_range" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "28": { + "7": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -11624,235 +12592,3205 @@ } ] }, - "29": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "31": { - "name": "comment.block.cpp" - }, - "32": { - "patterns": [ - { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" - } - ] - }, - "33": { + "9": { "patterns": [ { - "include": "#inline_comment" - } - ] - }, - "34": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "35": { - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - "36": { + "10": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "include": "#inline_comment" } ] - } - } - }, - "single_line_macro": { - "match": "^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))#define.*(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "1": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + "13": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] }, - "3": { - "name": "comment.block.cpp" + "14": { + "name": "variable.other.object.declare.cpp" }, - "4": { + "15": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, + "include": "#inline_comment" + } + ] + }, + "16": { + "patterns": [ { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] - } - } - }, - "sizeof_operator": { - "contentName": "meta.arguments.operator.sizeof.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" }, - "2": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "18": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.cpp" - } - }, - "patterns": [ - { - "include": "#evaluation_context" - } - ] - }, - "sizeof_variadic_operator": { - "contentName": "meta.arguments.operator.sizeof.variadic.cpp", - "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", - "beginCaptures": { - "1": { - "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" - }, - "2": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { + "20": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] - }, - "6": { - "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.variadic.cpp" + } + } + }, + "parentheses": { + "begin": "\\(", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.variadic.cpp" + "0": { + "name": "punctuation.section.parens.end.bracket.round.cpp" } }, + "name": "meta.parens.cpp", "patterns": [ + { + "include": "#over_qualified_types" + }, + { + "match": "(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "3": { + "name": "support.type.posix-reserved.cpp support.type.built-in.posix-reserved.cpp" } - }, - "end": "\\]", - "endCaptures": { + } + }, + "pragma": { + "begin": "^((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?pragma\\b", + "end": "(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?pragma(?:\\s)+mark)(?:\\s)+(.*)", + "captures": { + "1": { + "name": "keyword.control.directive.pragma.pragma-mark.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "name": "punctuation.definition.directive.cpp" + }, + "5": { + "name": "entity.name.tag.pragma-mark.cpp" + } + }, + "name": "meta.preprocessor.pragma.cpp" + }, + "predefined_macros": { + "patterns": [ + { + "match": "\\b(__cplusplus|__DATE__|__FILE__|__LINE__|__STDC__|__STDC_HOSTED__|__STDC_NO_COMPLEX__|__STDC_VERSION__|__STDCPP_THREADS__|__TIME__|NDEBUG|__OBJC__|__ASSEMBLER__|__ATOM__|__AVX__|__AVX2__|_CHAR_UNSIGNED|__CLR_VER|_CONTROL_FLOW_GUARD|__COUNTER__|__cplusplus_cli|__cplusplus_winrt|_CPPRTTI|_CPPUNWIND|_DEBUG|_DLL|__FUNCDNAME__|__FUNCSIG__|__FUNCTION__|_INTEGRAL_MAX_BITS|__INTELLISENSE__|_ISO_VOLATILE|_KERNEL_MODE|_M_AMD64|_M_ARM|_M_ARM_ARMV7VE|_M_ARM_FP|_M_ARM64|_M_CEE|_M_CEE_PURE|_M_CEE_SAFE|_M_FP_EXCEPT|_M_FP_FAST|_M_FP_PRECISE|_M_FP_STRICT|_M_IX86|_M_IX86_FP|_M_X64|_MANAGED|_MSC_BUILD|_MSC_EXTENSIONS|_MSC_FULL_VER|_MSC_VER|_MSVC_LANG|__MSVC_RUNTIME_CHECKS|_MT|_NATIVE_WCHAR_T_DEFINED|_OPENMP|_PREFAST|__TIMESTAMP__|_VC_NO_DEFAULTLIB|_WCHAR_T_DEFINED|_WIN32|_WIN64|_WINRT_DLL|_ATL_VER|_MFC_VER|__GFORTRAN__|__GNUC__|__GNUC_MINOR__|__GNUC_PATCHLEVEL__|__GNUG__|__STRICT_ANSI__|__BASE_FILE__|__INCLUDE_LEVEL__|__ELF__|__VERSION__|__OPTIMIZE__|__OPTIMIZE_SIZE__|__NO_INLINE__|__GNUC_STDC_INLINE__|__CHAR_UNSIGNED__|__WCHAR_UNSIGNED__|__REGISTER_PREFIX__|__REGISTER_PREFIX__|__SIZE_TYPE__|__PTRDIFF_TYPE__|__WCHAR_TYPE__|__WINT_TYPE__|__INTMAX_TYPE__|__UINTMAX_TYPE__|__SIG_ATOMIC_TYPE__|__INT8_TYPE__|__INT16_TYPE__|__INT32_TYPE__|__INT64_TYPE__|__UINT8_TYPE__|__UINT16_TYPE__|__UINT32_TYPE__|__UINT64_TYPE__|__INT_LEAST8_TYPE__|__INT_LEAST16_TYPE__|__INT_LEAST32_TYPE__|__INT_LEAST64_TYPE__|__UINT_LEAST8_TYPE__|__UINT_LEAST16_TYPE__|__UINT_LEAST32_TYPE__|__UINT_LEAST64_TYPE__|__INT_FAST8_TYPE__|__INT_FAST16_TYPE__|__INT_FAST32_TYPE__|__INT_FAST64_TYPE__|__UINT_FAST8_TYPE__|__UINT_FAST16_TYPE__|__UINT_FAST32_TYPE__|__UINT_FAST64_TYPE__|__INTPTR_TYPE__|__UINTPTR_TYPE__|__CHAR_BIT__|__SCHAR_MAX__|__WCHAR_MAX__|__SHRT_MAX__|__INT_MAX__|__LONG_MAX__|__LONG_LONG_MAX__|__WINT_MAX__|__SIZE_MAX__|__PTRDIFF_MAX__|__INTMAX_MAX__|__UINTMAX_MAX__|__SIG_ATOMIC_MAX__|__INT8_MAX__|__INT16_MAX__|__INT32_MAX__|__INT64_MAX__|__UINT8_MAX__|__UINT16_MAX__|__UINT32_MAX__|__UINT64_MAX__|__INT_LEAST8_MAX__|__INT_LEAST16_MAX__|__INT_LEAST32_MAX__|__INT_LEAST64_MAX__|__UINT_LEAST8_MAX__|__UINT_LEAST16_MAX__|__UINT_LEAST32_MAX__|__UINT_LEAST64_MAX__|__INT_FAST8_MAX__|__INT_FAST16_MAX__|__INT_FAST32_MAX__|__INT_FAST64_MAX__|__UINT_FAST8_MAX__|__UINT_FAST16_MAX__|__UINT_FAST32_MAX__|__UINT_FAST64_MAX__|__INTPTR_MAX__|__UINTPTR_MAX__|__WCHAR_MIN__|__WINT_MIN__|__SIG_ATOMIC_MIN__|__SCHAR_WIDTH__|__SHRT_WIDTH__|__INT_WIDTH__|__LONG_WIDTH__|__LONG_LONG_WIDTH__|__PTRDIFF_WIDTH__|__SIG_ATOMIC_WIDTH__|__SIZE_WIDTH__|__WCHAR_WIDTH__|__WINT_WIDTH__|__INT_LEAST8_WIDTH__|__INT_LEAST16_WIDTH__|__INT_LEAST32_WIDTH__|__INT_LEAST64_WIDTH__|__INT_FAST8_WIDTH__|__INT_FAST16_WIDTH__|__INT_FAST32_WIDTH__|__INT_FAST64_WIDTH__|__INTPTR_WIDTH__|__INTMAX_WIDTH__|__SIZEOF_INT__|__SIZEOF_LONG__|__SIZEOF_LONG_LONG__|__SIZEOF_SHORT__|__SIZEOF_POINTER__|__SIZEOF_FLOAT__|__SIZEOF_DOUBLE__|__SIZEOF_LONG_DOUBLE__|__SIZEOF_SIZE_T__|__SIZEOF_WCHAR_T__|__SIZEOF_WINT_T__|__SIZEOF_PTRDIFF_T__|__BYTE_ORDER__|__ORDER_LITTLE_ENDIAN__|__ORDER_BIG_ENDIAN__|__ORDER_PDP_ENDIAN__|__FLOAT_WORD_ORDER__|__DEPRECATED|__EXCEPTIONS|__GXX_RTTI|__USING_SJLJ_EXCEPTIONS__|__GXX_EXPERIMENTAL_CXX0X__|__GXX_WEAK__|__NEXT_RUNTIME__|__LP64__|_LP64|__SSP__|__SSP_ALL__|__SSP_STRONG__|__SSP_EXPLICIT__|__SANITIZE_ADDRESS__|__SANITIZE_THREAD__|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8|__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16|__HAVE_SPECULATION_SAFE_VALUE|__GCC_HAVE_DWARF2_CFI_ASM|__FP_FAST_FMA|__FP_FAST_FMAF|__FP_FAST_FMAL|__FP_FAST_FMAF16|__FP_FAST_FMAF32|__FP_FAST_FMAF64|__FP_FAST_FMAF128|__FP_FAST_FMAF32X|__FP_FAST_FMAF64X|__FP_FAST_FMAF128X|__GCC_IEC_559|__GCC_IEC_559_COMPLEX|__NO_MATH_ERRNO__|__has_builtin|__has_feature|__has_extension|__has_cpp_attribute|__has_c_attribute|__has_attribute|__has_declspec_attribute|__is_identifier|__has_include|__has_include_next|__has_warning|__BASE_FILE__|__FILE_NAME__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__fp16|_Float16)\\b", + "captures": { + "1": { + "name": "entity.name.other.preprocessor.macro.predefined.$1.cpp" + } + } + }, + { + "match": "\\b__([A-Z_]+)__\\b", + "name": "entity.name.other.preprocessor.macro.predefined.probably.$1.cpp" + } + ] + }, + "preprocessor_conditional_context": { "patterns": [ { - "include": "#struct_declare" + "include": "#preprocessor_conditional_defined" + }, + { + "include": "#comments" + }, + { + "include": "#language_constants" + }, + { + "include": "#d9bc4796b0b_string_context_c" + }, + { + "include": "#d9bc4796b0b_preprocessor_number_literal" + }, + { + "include": "#operators" + }, + { + "include": "#predefined_macros" + }, + { + "include": "#macro_name" + }, + { + "include": "#line_continuation_character" + } + ] + }, + "preprocessor_conditional_defined": { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?((?:(?:ifndef|ifdef)|if))", + "end": "^(?!\\s*+#\\s*(?:else|endif))", + "beginCaptures": { + "0": { + "name": "keyword.control.directive.conditional.$6.cpp" + }, + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] }, + "5": { + "name": "punctuation.definition.directive.cpp" + }, + "6": {} + }, + "endCaptures": {}, + "patterns": [ { - "include": "#enum_declare" + "begin": "\\G(?<=ifndef|ifdef|if)", + "end": "(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "3": { + "name": "punctuation.definition.directive.cpp" + } + }, + "name": "keyword.control.directive.$4.cpp" + }, + "preprocessor_context": { + "patterns": [ + { + "include": "#pragma_mark" + }, + { + "include": "#pragma" + }, + { + "include": "#include" + }, + { + "include": "#line" + }, + { + "include": "#diagnostic" + }, + { + "include": "#undef" + }, + { + "include": "#preprocessor_conditional_range" + }, + { + "include": "#single_line_macro" + }, + { + "include": "#macro" + }, + { + "include": "#preprocessor_conditional_standalone" + }, + { + "include": "#macro_argument" + } + ] + }, + "primitive_types": { + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "3": { + "name": "storage.type.primitive.cpp storage.type.built-in.primitive.cpp" + } + } + }, + "pthread_types": { + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "3": { + "name": "support.type.posix-reserved.pthread.cpp support.type.built-in.posix-reserved.pthread.cpp" + } + } + }, + "qualified_type": { + "match": "\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<18>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<18>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<18>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.])", + "captures": { + "0": { + "patterns": [ + { + "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] + }, + { + "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", + "name": "entity.name.type.cpp" + } + ] + }, + "1": { + "patterns": [ + { + "include": "#attributes_context" + }, + { + "include": "#number_literal" + } + ] + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "5": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "6": { + "patterns": [ + { + "include": "#scope_resolution_inner_generated" + } + ] + }, + "7": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "8": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "10": { + "name": "entity.name.scope-resolution.cpp" + }, + "11": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "13": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "14": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "15": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "16": { + "name": "entity.name.type.cpp" + }, + "17": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + } + }, + "name": "meta.qualified_type.cpp" + }, + "qualifiers_and_specifiers_post_parameters": { + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "3": { + "name": "storage.modifier.specifier.functional.post-parameters.$3.cpp" + } + } + }, + "scope_resolution": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_function_call": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_function_call_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_function_call_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_function_call_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.function.call.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.call.cpp" + } + } + }, + "scope_resolution_function_definition": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_function_definition_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_function_definition_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_function_definition_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.function.definition.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.cpp" + } + } + }, + "scope_resolution_function_definition_operator_overload": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_function_definition_operator_overload_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_function_definition_operator_overload_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_function_definition_operator_overload_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.function.definition.operator-overload.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.function.definition.operator-overload.cpp" + } + } + }, + "scope_resolution_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + } + } + }, + "scope_resolution_namespace_alias": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_namespace_alias_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_namespace_alias_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_namespace_alias_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.namespace.alias.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.alias.cpp" + } + } + }, + "scope_resolution_namespace_block": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_namespace_block_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_namespace_block_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_namespace_block_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.namespace.block.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.block.cpp" + } + } + }, + "scope_resolution_namespace_using": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_namespace_using_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_namespace_using_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_namespace_using_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.namespace.using.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.namespace.using.cpp" + } + } + }, + "scope_resolution_parameter": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_parameter_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_parameter_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_parameter_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.parameter.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.parameter.cpp" + } + } + }, + "scope_resolution_template_call": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_template_call_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_template_call_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_template_call_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.template.call.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.call.cpp" + } + } + }, + "scope_resolution_template_definition": { + "match": "(::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<3>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+", + "captures": { + "0": { + "patterns": [ + { + "include": "#scope_resolution_template_definition_inner_generated" + } + ] + }, + "1": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" + }, + "2": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + } + } + }, + "scope_resolution_template_definition_inner_generated": { + "match": "((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<7>?)+>)(?:(?:\\s)+)?)?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution_template_definition_inner_generated" + } + ] + }, + "2": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" + }, + "3": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "4": {}, + "5": { + "name": "entity.name.scope-resolution.template.definition.cpp" + }, + "6": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "7": {}, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.template.definition.cpp" + } + } + }, + "semicolon": { + "match": ";", + "name": "punctuation.terminator.statement.cpp" + }, + "simple_type": { + "match": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<19>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?", + "captures": { + "1": { + "name": "meta.qualified_type.cpp", + "patterns": [ + { + "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] + }, + { + "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", + "name": "entity.name.type.cpp" + } + ] + }, + "2": { + "patterns": [ + { + "include": "#attributes_context" + }, + { + "include": "#number_literal" + } + ] + }, + "3": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "4": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "5": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "6": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "7": { + "patterns": [ + { + "include": "#scope_resolution_inner_generated" + } + ] + }, + "8": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "9": { + "patterns": [ + { + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } + } + ] + }, + "10": {}, + "11": { + "name": "entity.name.scope-resolution.cpp" + }, + "12": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "13": {}, + "14": { + "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" + }, + "15": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "16": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "17": { + "name": "entity.name.type.cpp" + }, + "18": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "19": {}, + "20": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "21": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "22": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "23": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "24": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + "single_line_macro": { + "match": "^((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))#define.*(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + "sizeof_operator": { + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.cpp" + } + }, + "contentName": "meta.arguments.operator.sizeof", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + "sizeof_variadic_operator": { + "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "4": { + "name": "comment.block.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.operator.sizeof.variadic.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.variadic.cpp" + } + }, + "contentName": "meta.arguments.operator.sizeof.variadic", + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + "square_brackets": { + "name": "meta.bracket.square.access", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))?(\\[)(?!\\])", + "beginCaptures": { + "1": { + "name": "variable.other.object" + }, + "2": { + "name": "punctuation.definition.begin.bracket.square" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.square" + } + }, + "patterns": [ + { + "include": "#evaluation_context" + } + ] + }, + "standard_declares": { + "patterns": [ + { + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", + "captures": { + "1": { + "name": "storage.type.struct.declare.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "name": "entity.name.type.struct.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "name": "variable.other.object.declare.cpp" + }, + "13": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "14": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + { + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", + "captures": { + "1": { + "name": "storage.type.union.declare.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "name": "entity.name.type.union.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "name": "variable.other.object.declare.cpp" + }, + "13": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "14": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + { + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", + "captures": { + "1": { + "name": "storage.type.enum.declare.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "name": "entity.name.type.enum.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "name": "variable.other.object.declare.cpp" + }, + "13": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "14": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, + { + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", + "captures": { + "1": { + "name": "storage.type.class.declare.cpp" + }, + "2": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "3": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "4": { + "name": "entity.name.type.class.cpp" + }, + "5": { + "patterns": [ + { + "match": "\\*", + "name": "storage.modifier.pointer.cpp" + }, + { + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", + "captures": { + "1": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "2": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "3": { + "name": "comment.block.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + }, + "name": "invalid.illegal.reference-type.cpp" + }, + { + "match": "\\&", + "name": "storage.modifier.reference.cpp" + } + ] + }, + "6": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "7": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "8": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "9": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "10": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "11": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "12": { + "name": "variable.other.object.declare.cpp" + }, + "13": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "14": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } } ] }, "static_assert": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "patterns": [ @@ -11911,22 +15849,22 @@ "name": "punctuation.section.arguments.begin.bracket.round.static_assert.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.static_assert.cpp" } }, "patterns": [ { - "name": "meta.static_assert.message.cpp", - "begin": "(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)", + "begin": "(,)(?:(?:\\s)+)?(?=(?:L|u8|u|U(?:(?:\\s)+)?\\\")?)", + "end": "(?=\\))", "beginCaptures": { "1": { "name": "punctuation.separator.delimiter.comma.cpp" } }, - "end": "(?=\\))", + "endCaptures": {}, + "name": "meta.static_assert.message.cpp", "patterns": [ { "include": "#string_context" @@ -11938,8 +15876,47 @@ } ] }, + "std_space": { + "match": "(?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))", + "captures": { + "0": { + "patterns": [ + { + "include": "#inline_comment" + } + ] + }, + "1": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + } + } + }, "storage_specifiers": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "storage.modifier.specifier.$5.cpp" + "3": { + "name": "storage.modifier.specifier.$3.cpp" } } }, @@ -11999,22 +15985,22 @@ "string_context": { "patterns": [ { - "name": "string.quoted.double.cpp", - "begin": "(((?:u|u8|U|L)?)\")", + "begin": "((?:u|u8|U|L)?)\"", + "end": "\"", "beginCaptures": { - "1": { + "0": { "name": "punctuation.definition.string.begin.cpp" }, - "2": { + "1": { "name": "meta.encoding.cpp" } }, - "end": "(\")", "endCaptures": { - "1": { + "0": { "name": "punctuation.definition.string.end.cpp" } }, + "name": "string.quoted.double.cpp", "patterns": [ { "match": "(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8})", @@ -12029,7 +16015,7 @@ "name": "constant.character.escape.cpp" }, { - "match": "\\\\x[0-9a-fA-F]{2,2}", + "match": "\\\\x[0-9a-fA-F]{2}", "name": "constant.character.escape.cpp" }, { @@ -12038,22 +16024,22 @@ ] }, { - "name": "string.quoted.single.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.struct.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -12189,7 +16172,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -12199,20 +16182,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -12224,23 +16207,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -12252,7 +16235,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -12262,20 +16245,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -12287,23 +16270,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -12315,23 +16298,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -12343,20 +16326,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -12368,18 +16351,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -12388,16 +16363,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.struct.cpp", "patterns": [ { - "name": "meta.head.struct.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.struct.cpp" } }, + "name": "meta.head.struct.cpp", "patterns": [ { "include": "#ever_present_context" @@ -12411,14 +16388,15 @@ ] }, { - "name": "meta.body.struct.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.struct.cpp" } }, + "name": "meta.body.struct.cpp", "patterns": [ { "include": "#function_pointer" @@ -12438,9 +16416,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.struct.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -12450,7 +16430,7 @@ ] }, "struct_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.struct.declare.cpp" @@ -12463,34 +16443,43 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "name": "entity.name.type.struct.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -12526,114 +16515,150 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "12": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { + "12": { "name": "variable.other.object.declare.cpp" }, - "21": { + "13": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { + "14": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] } } }, "switch_conditional_parentheses": { - "name": "meta.conditional.switch.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "patterns": [ @@ -12664,12 +16689,12 @@ "name": "punctuation.section.parens.begin.bracket.round.conditional.switch.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.parens.end.bracket.round.conditional.switch.cpp" } }, + "name": "meta.conditional.switch.cpp", "patterns": [ { "include": "#evaluation_context" @@ -12680,26 +16705,26 @@ ] }, "switch_statement": { - "name": "meta.block.switch.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?|\\?\\?>)|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.switch.cpp" }, - "2": { + "1": { "patterns": [ { "include": "#inline_comment" } ] }, - "3": { + "2": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "4": { + "3": { "name": "comment.block.cpp" }, - "5": { + "4": { "patterns": [ { "match": "\\*\\/", @@ -12711,21 +16736,23 @@ } ] }, - "6": { + "5": { "name": "keyword.control.switch.cpp" } }, - "end": "(?:(?<=\\}|%>|\\?\\?>)|(?=[;>\\[\\]=]))", + "endCaptures": {}, + "name": "meta.block.switch.cpp", "patterns": [ { - "name": "meta.head.switch.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.switch.cpp" } }, + "name": "meta.head.switch.cpp", "patterns": [ { "include": "#switch_conditional_parentheses" @@ -12736,14 +16763,15 @@ ] }, { - "name": "meta.body.switch.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.switch.cpp" } }, + "name": "meta.body.switch.cpp", "patterns": [ { "include": "#default_statement" @@ -12760,9 +16788,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.switch.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -12772,7 +16802,7 @@ ] }, "template_argument_defaulted": { - "match": "(?<=<|,)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*([=])", + "match": "(?<=<|,)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\s)+)*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)(?:(?:\\s)+)?([=])", "captures": { "1": { "name": "storage.type.template.cpp" @@ -12820,32 +16850,32 @@ ] }, "template_call_innards": { - "match": "((?(?:(?>[^<>]*)\\g<1>?)+)>)\\s*", + "match": "((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<1>?)+>)(?:(?:\\s)+)?", "captures": { "0": { - "name": "meta.template.call.cpp", "patterns": [ { "include": "#template_call_range" } ] } - } + }, + "name": "meta.template.call.cpp" }, "template_call_range": { - "name": "meta.template.call.cpp", - "begin": "(<)", + "begin": "<", + "end": ">", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.angle-brackets.begin.template.call.cpp" } }, - "end": "(>)", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.angle-brackets.end.template.call.cpp" } }, + "name": "meta.template.call.cpp", "patterns": [ { "include": "#template_call_context" @@ -12853,8 +16883,8 @@ ] }, "template_definition": { - "name": "meta.template.definition.cpp", - "begin": "(?", "beginCaptures": { "1": { "name": "storage.type.template.cpp" @@ -12863,23 +16893,23 @@ "name": "punctuation.section.angle-brackets.start.template.definition.cpp" } }, - "end": "(>)", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.angle-brackets.end.template.definition.cpp" } }, + "name": "meta.template.definition.cpp", "patterns": [ { - "begin": "((?<=\\w)\\s*<)", + "begin": "(?<=\\w)(?:(?:\\s)+)?<", + "end": ">", "beginCaptures": { - "1": { + "0": { "name": "punctuation.section.angle-brackets.begin.template.call.cpp" } }, - "end": "(>)", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.angle-brackets.begin.template.call.cpp" } }, @@ -12895,37 +16925,46 @@ ] }, "template_definition_argument": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", + "match": "((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\s)+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)(?:(?:\\s)+)?(\\.\\.\\.)(?:(?:\\s)+)?((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))(?:(?:\\s)+)?(?:(,)|(?=>|$))", "captures": { "1": { "patterns": [ { "include": "#inline_comment" - } - ] - }, - "2": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "3": { - "name": "comment.block.cpp" + } + ] }, - "4": { + "2": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "storage.type.template.argument.$5.cpp" + "3": { + "name": "storage.type.template.argument.$3.cpp" }, - "6": { + "4": { "patterns": [ { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -12933,19 +16972,19 @@ } ] }, - "7": { + "5": { "name": "entity.name.type.template.cpp" }, - "8": { + "6": { "name": "storage.type.template.cpp" }, - "9": { + "7": { "name": "punctuation.vararg-ellipses.template.definition.cpp" }, - "10": { + "8": { "name": "entity.name.type.template.cpp" }, - "11": { + "9": { "name": "punctuation.separator.delimiter.comma.template.argument.cpp" } } @@ -12970,7 +17009,7 @@ ] }, "template_isolated_definition": { - "match": "(?\\s*$)", + "match": "(?(?:(?:\\s)+)?$)", "captures": { "1": { "name": "storage.type.template.cpp" @@ -12992,16 +17031,15 @@ } }, "ternary_operator": { - "applyEndPatternLast": true, - "begin": "(\\?)", + "begin": "\\?", + "end": ":", "beginCaptures": { - "1": { + "0": { "name": "keyword.operator.ternary.cpp" } }, - "end": "(:)", "endCaptures": { - "1": { + "0": { "name": "keyword.operator.ternary.cpp" } }, @@ -13081,9 +17119,6 @@ { "include": "#square_brackets" }, - { - "include": "#empty_square_brackets" - }, { "include": "#semicolon" }, @@ -13093,7 +17128,7 @@ ] }, "the_this_keyword": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { + "3": { "name": "variable.language.this.cpp" } } }, "type_alias": { - "match": "(using)\\s*(?!namespace)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?:(?:(?>\\s+)|(?:\\/\\*)(?:(?>(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", + "match": "(using)(?:(?:\\s)+)?(?!namespace)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(?:(?:\\s)+)?(\\=)(?:(?:\\s)+)?((?:typename)?)(?:(?:\\s)+)?((?:(?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<43>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))|(.*(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)?(?:(?:\\s)+)?(?:(;)|\\n)", "captures": { "1": { "name": "keyword.other.using.directive.cpp" @@ -13135,7 +17179,7 @@ "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -13186,70 +17247,98 @@ ] }, "5": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "6": { - "name": "comment.block.cpp" - }, - "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "8": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "13": { + "8": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "14": { + "9": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "16": { - "name": "meta.template.call.cpp", + "10": { "patterns": [ { - "include": "#template_call_range" + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, - "18": { + "12": { "name": "entity.name.scope-resolution.cpp" }, - "19": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -13257,38 +17346,47 @@ } ] }, - "21": { + "15": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "22": { + "16": { "patterns": [ { "include": "#inline_comment" } ] }, - "23": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "24": { - "name": "comment.block.cpp" - }, - "25": { + "17": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "26": { + "18": { "name": "entity.name.type.cpp" }, - "27": { + "19": { "name": "meta.template.call.cpp", "patterns": [ { @@ -13296,24 +17394,51 @@ } ] }, - "29": { + "21": { "name": "keyword.operator.assignment.cpp" }, - "30": { + "22": { "name": "keyword.other.typename.cpp" }, - "31": { + "23": { "patterns": [ { "include": "#storage_specifiers" } ] }, - "32": { + "24": { + "patterns": [ + { + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } + } + ] + }, + "25": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -13346,7 +17488,7 @@ } ] }, - "33": { + "26": { "patterns": [ { "include": "#attributes_context" @@ -13356,78 +17498,106 @@ } ] }, - "34": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "35": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "36": { - "name": "comment.block.cpp" - }, - "37": { + "28": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "38": { + "29": { "patterns": [ { "include": "#inline_comment" } ] }, - "39": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "40": { - "name": "comment.block.cpp" - }, - "41": { + "30": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "43": { + "31": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "44": { + "32": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "46": { - "name": "meta.template.call.cpp", + "33": { "patterns": [ { - "include": "#template_call_range" + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, - "48": { + "35": { "name": "entity.name.scope-resolution.cpp" }, - "49": { + "36": { "name": "meta.template.call.cpp", "patterns": [ { @@ -13435,38 +17605,47 @@ } ] }, - "51": { + "38": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "52": { + "39": { "patterns": [ { "include": "#inline_comment" } ] }, - "53": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "54": { - "name": "comment.block.cpp" - }, - "55": { + "40": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "56": { + "41": { "name": "entity.name.type.cpp" }, - "57": { + "42": { "name": "meta.template.call.cpp", "patterns": [ { @@ -13474,7 +17653,7 @@ } ] }, - "59": { + "44": { "name": "meta.declaration.type.alias.value.unknown.cpp", "patterns": [ { @@ -13482,14 +17661,14 @@ } ] }, - "60": { + "45": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -13525,102 +17704,129 @@ } ] }, - "61": { + "46": { "patterns": [ { "include": "#inline_comment" } ] }, - "62": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "63": { - "name": "comment.block.cpp" - }, - "64": { + "47": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "65": { + "48": { "patterns": [ { "include": "#inline_comment" } ] }, - "66": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "67": { - "name": "comment.block.cpp" - }, - "68": { + "49": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "69": { + "50": { "patterns": [ { "include": "#inline_comment" } ] }, - "70": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "71": { - "name": "comment.block.cpp" - }, - "72": { + "51": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "73": { + "52": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "74": { + "53": { "patterns": [ { "include": "#evaluation_context" } ] }, - "75": { + "54": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "76": { + "55": { "name": "punctuation.terminator.statement.cpp" } }, "name": "meta.declaration.type.alias.cpp" }, "type_casting_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "5": { - "name": "keyword.operator.wordlike.cpp keyword.operator.cast.$5.cpp" + "3": { + "name": "keyword.operator.wordlike.cpp keyword.operator.cast.$3.cpp" } } }, "typedef_class": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.class.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -13696,7 +17912,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -13706,20 +17922,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -13731,23 +17947,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -13759,7 +17975,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -13769,20 +17985,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -13794,23 +18010,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -13822,23 +18038,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -13850,20 +18066,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -13875,18 +18091,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -13895,16 +18103,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.class.cpp", "patterns": [ { - "name": "meta.head.class.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.class.cpp" } }, + "name": "meta.head.class.cpp", "patterns": [ { "include": "#ever_present_context" @@ -13918,14 +18128,15 @@ ] }, { - "name": "meta.body.class.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.class.cpp" } }, + "name": "meta.body.class.cpp", "patterns": [ { "include": "#function_pointer" @@ -13945,12 +18156,14 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.class.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14085,22 +18298,24 @@ ] }, "typedef_function_pointer": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?(?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(::))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<25>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))(((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()(\\*)(?:(?:\\s)+)?((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)(?:(?:\\s)+)?(?:(\\[)(\\w*)(\\])(?:(?:\\s)+)?)*(\\))(?:(?:\\s)+)?(\\()", + "end": "(\\))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=[{=,);>]|\\n)(?!\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -14193,17 +18425,17 @@ } ] }, - "12": { + "11": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "13": { + "12": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "15": { + "13": { "name": "meta.template.call.cpp", "patterns": [ { @@ -14211,10 +18443,11 @@ } ] }, - "17": { + "14": {}, + "15": { "name": "entity.name.scope-resolution.cpp" }, - "18": { + "16": { "name": "meta.template.call.cpp", "patterns": [ { @@ -14222,23 +18455,24 @@ } ] }, - "20": { + "17": {}, + "18": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "21": { + "19": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { + "20": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "23": { + "21": { "name": "comment.block.cpp" }, - "24": { + "22": { "patterns": [ { "match": "\\*\\/", @@ -14250,10 +18484,10 @@ } ] }, - "25": { + "23": { "name": "entity.name.type.cpp" }, - "26": { + "24": { "name": "meta.template.call.cpp", "patterns": [ { @@ -14261,14 +18495,15 @@ } ] }, - "28": { + "25": {}, + "26": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14304,20 +18539,20 @@ } ] }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -14329,20 +18564,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -14354,20 +18589,20 @@ } ] }, - "37": { + "35": { "patterns": [ { "include": "#inline_comment" } ] }, - "38": { + "36": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "39": { + "37": { "name": "comment.block.cpp" }, - "40": { + "38": { "patterns": [ { "match": "\\*\\/", @@ -14379,36 +18614,35 @@ } ] }, - "41": { + "39": { "name": "punctuation.section.parens.begin.bracket.round.function.pointer.cpp" }, - "42": { + "40": { "name": "punctuation.definition.function.pointer.dereference.cpp" }, - "43": { + "41": { "name": "entity.name.type.alias.cpp entity.name.type.pointer.function.cpp" }, - "44": { + "42": { "name": "punctuation.definition.begin.bracket.square.cpp" }, - "45": { + "43": { "patterns": [ { "include": "#evaluation_context" } ] }, - "46": { + "44": { "name": "punctuation.definition.end.bracket.square.cpp" }, - "47": { + "45": { "name": "punctuation.section.parens.end.bracket.round.function.pointer.cpp" }, - "48": { + "46": { "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -14438,81 +18672,49 @@ } ] } - }, - "patterns": [ - { - "include": "#function_parameter_context" - } - ] - } - ] - }, - "typedef_keyword": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.struct.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -14524,7 +18726,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -14534,20 +18736,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -14559,23 +18761,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -14587,7 +18789,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -14597,20 +18799,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -14622,23 +18824,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -14650,23 +18852,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -14678,20 +18880,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -14703,18 +18905,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -14723,16 +18917,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.struct.cpp", "patterns": [ { - "name": "meta.head.struct.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.struct.cpp" } }, + "name": "meta.head.struct.cpp", "patterns": [ { "include": "#ever_present_context" @@ -14746,14 +18942,15 @@ ] }, { - "name": "meta.body.struct.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.struct.cpp" } }, + "name": "meta.body.struct.cpp", "patterns": [ { "include": "#function_pointer" @@ -14773,12 +18970,14 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.struct.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14913,38 +19112,39 @@ ] }, "typedef_union": { - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.union.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -14956,7 +19156,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -14966,20 +19166,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -14991,23 +19191,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -15019,7 +19219,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -15029,20 +19229,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -15054,23 +19254,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -15082,23 +19282,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -15110,20 +19310,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -15135,18 +19335,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -15155,16 +19347,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.union.cpp", "patterns": [ { - "name": "meta.head.union.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.union.cpp" } }, + "name": "meta.head.union.cpp", "patterns": [ { "include": "#ever_present_context" @@ -15178,14 +19372,15 @@ ] }, { - "name": "meta.body.union.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.union.cpp" } }, + "name": "meta.body.union.cpp", "patterns": [ { "include": "#function_pointer" @@ -15205,12 +19400,14 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.union.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -15345,8 +19542,8 @@ ] }, "typeid_operator": { - "contentName": "meta.arguments.operator.typeid.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\()", + "end": "\\)", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.typeid.cpp" @@ -15380,12 +19577,12 @@ "name": "punctuation.section.arguments.begin.bracket.round.operator.typeid.cpp" } }, - "end": "(\\))", "endCaptures": { - "1": { + "0": { "name": "punctuation.section.arguments.end.bracket.round.operator.typeid.cpp" } }, + "contentName": "meta.arguments.operator.typeid", "patterns": [ { "include": "#evaluation_context" @@ -15393,7 +19590,7 @@ ] }, "typename": { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:((::)?((?:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(?:((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<24>?)+>)(?:(?:\\s)+)?)?::)*)\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<24>?)+>)(?:(?:\\s)+)?)?(::))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?!(?:(?:transaction_safe_dynamic)|(?:__has_cpp_attribute)|(?:reinterpret_cast)|(?:transaction_safe)|(?:atomic_noexcept)|(?:atomic_commit)|(?:atomic_cancel)|(?:__has_include)|(?:dynamic_cast)|(?:synchronized)|(?:thread_local)|(?:static_cast)|(?:const_cast)|(?:constexpr)|(?:consteval)|(?:co_return)|(?:co_return)|(?:constexpr)|(?:protected)|(?:constexpr)|(?:namespace)|(?:noexcept)|(?:typename)|(?:decltype)|(?:template)|(?:operator)|(?:noexcept)|(?:co_yield)|(?:co_await)|(?:continue)|(?:co_await)|(?:co_yield)|(?:volatile)|(?:register)|(?:restrict)|(?:explicit)|(?:override)|(?:volatile)|(?:reflexpr)|(?:noexcept)|(?:requires)|(?:alignas)|(?:typedef)|(?:nullptr)|(?:alignof)|(?:mutable)|(?:concept)|(?:virtual)|(?:defined)|(?:__asm__)|(?:include)|(?:_Pragma)|(?:mutable)|(?:default)|(?:warning)|(?:private)|(?:module)|(?:return)|(?:not_eq)|(?:xor_eq)|(?:and_eq)|(?:ifndef)|(?:pragma)|(?:export)|(?:import)|(?:sizeof)|(?:static)|(?:delete)|(?:public)|(?:define)|(?:extern)|(?:inline)|(?:typeid)|(?:switch)|(?:friend)|(?:bitand)|(?:false)|(?:compl)|(?:bitor)|(?:throw)|(?:or_eq)|(?:while)|(?:catch)|(?:break)|(?:const)|(?:final)|(?:const)|(?:endif)|(?:ifdef)|(?:undef)|(?:error)|(?:using)|(?:audit)|(?:axiom)|(?:line)|(?:else)|(?:elif)|(?:true)|(?:NULL)|(?:case)|(?:goto)|(?:else)|(?:this)|(?:new)|(?:asm)|(?:not)|(?:and)|(?:xor)|(?:try)|(?:for)|(?:if)|(?:do)|(?:or)|(?:if))\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<24>?)+>)(?:(?:\\s)+)?)?(?![\\w<:.]))", "captures": { "1": { "name": "storage.modifier.cpp" @@ -15406,53 +19603,71 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "patterns": [ { "include": "#inline_comment" } ] }, - "7": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "8": { - "name": "comment.block.cpp" - }, - "9": { + "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "10": { + "6": { "name": "meta.qualified_type.cpp", "patterns": [ { - "match": "(?", + "beginCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.call.cpp" + } + }, + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_context" + } + ] }, { "match": "(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*", @@ -15485,7 +19717,7 @@ } ] }, - "11": { + "7": { "patterns": [ { "include": "#attributes_context" @@ -15495,78 +19727,107 @@ } ] }, - "12": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "21": { + "12": { "patterns": [ { "include": "#scope_resolution_inner_generated" } ] }, - "22": { + "13": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "24": { - "name": "meta.template.call.cpp", + "14": { "patterns": [ { - "include": "#template_call_range" + "match": "(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*+(((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<2>?)+>)(?:(?:\\s)+)?)?::", + "captures": { + "1": { + "name": "meta.template.call.cpp", + "patterns": [ + { + "include": "#template_call_range" + } + ] + }, + "2": {} + } } ] }, - "26": { + "15": {}, + "16": { "name": "entity.name.scope-resolution.cpp" }, - "27": { + "17": { "name": "meta.template.call.cpp", "patterns": [ { @@ -15574,49 +19835,60 @@ } ] }, - "29": { + "18": {}, + "19": { "name": "punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp" }, - "30": { + "20": { "patterns": [ { "include": "#inline_comment" } ] }, - "31": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "32": { - "name": "comment.block.cpp" - }, - "33": { + "21": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "34": { + "22": { "name": "entity.name.type.cpp" }, - "35": { + "23": { "name": "meta.template.call.cpp", "patterns": [ { "include": "#template_call_range" } ] - } + }, + "24": {} } }, "undef": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*undef\\b)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(#)(?:(?:\\s)+)?undef\\b)((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "name": "punctuation.definition.directive.cpp" }, - "7": { + "5": { "patterns": [ { "include": "#inline_comment" } ] }, - "8": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "9": { - "name": "comment.block.cpp" - }, - "10": { + "6": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "11": { + "7": { "name": "entity.name.function.preprocessor.cpp" } }, "name": "meta.preprocessor.undef.cpp" }, "union_block": { - "name": "meta.block.union.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(DLLEXPORT)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?:(?(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(final)((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))?(?:((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(:))?", + "end": "(?:(?:(?<=\\}|%>|\\?\\?>)(?:(?:\\s)+)?(;)|(;))|(?=[;>\\[\\]=]))", "beginCaptures": { - "1": { + "0": { "name": "meta.head.union.cpp" }, - "3": { - "name": "storage.type.$3.cpp" + "1": { + "name": "storage.type.$1.cpp" }, - "4": { + "2": { "patterns": [ { "include": "#inline_comment" } ] }, - "5": { + "3": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "6": { + "4": { "name": "comment.block.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*\\/", @@ -15715,7 +20005,7 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#attributes_context" @@ -15725,20 +20015,20 @@ } ] }, - "9": { + "7": { "patterns": [ { "include": "#inline_comment" } ] }, - "10": { + "8": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "11": { + "9": { "name": "comment.block.cpp" }, - "12": { + "10": { "patterns": [ { "match": "\\*\\/", @@ -15750,23 +20040,23 @@ } ] }, - "13": { + "11": { "name": "entity.name.other.preprocessor.macro.predefined.DLLEXPORT.cpp" }, - "14": { + "12": { "patterns": [ { "include": "#inline_comment" } ] }, - "15": { + "13": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "16": { + "14": { "name": "comment.block.cpp" }, - "17": { + "15": { "patterns": [ { "match": "\\*\\/", @@ -15778,7 +20068,7 @@ } ] }, - "18": { + "16": { "patterns": [ { "include": "#attributes_context" @@ -15788,20 +20078,20 @@ } ] }, - "19": { + "17": { "patterns": [ { "include": "#inline_comment" } ] }, - "20": { + "18": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "21": { + "19": { "name": "comment.block.cpp" }, - "22": { + "20": { "patterns": [ { "match": "\\*\\/", @@ -15813,23 +20103,23 @@ } ] }, - "23": { - "name": "entity.name.type.$3.cpp" + "21": { + "name": "entity.name.type.$1.cpp" }, - "24": { + "22": { "patterns": [ { "include": "#inline_comment" } ] }, - "25": { + "23": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "26": { + "24": { "name": "comment.block.cpp" }, - "27": { + "25": { "patterns": [ { "match": "\\*\\/", @@ -15841,23 +20131,23 @@ } ] }, - "28": { + "26": { "name": "storage.type.modifier.final.cpp" }, - "29": { + "27": { "patterns": [ { "include": "#inline_comment" } ] }, - "30": { + "28": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "31": { + "29": { "name": "comment.block.cpp" }, - "32": { + "30": { "patterns": [ { "match": "\\*\\/", @@ -15869,20 +20159,20 @@ } ] }, - "33": { + "31": { "patterns": [ { "include": "#inline_comment" } ] }, - "34": { + "32": { "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" }, - "35": { + "33": { "name": "comment.block.cpp" }, - "36": { + "34": { "patterns": [ { "match": "\\*\\/", @@ -15894,18 +20184,10 @@ } ] }, - "37": { + "35": { "name": "punctuation.separator.colon.inheritance.cpp" - }, - "38": { - "patterns": [ - { - "include": "#inheritance_context" - } - ] } }, - "end": "(?:(?:(?<=\\}|%>|\\?\\?>)\\s*(;)|(;))|(?=[;>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" @@ -15914,16 +20196,18 @@ "name": "punctuation.terminator.statement.cpp" } }, + "name": "meta.block.union.cpp", "patterns": [ { - "name": "meta.head.union.cpp", "begin": "\\G ?", - "end": "((?:\\{|<%|\\?\\?<|(?=;)))", + "end": "(?:\\{|<%|\\?\\?<|(?=;))", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.begin.bracket.curly.union.cpp" } }, + "name": "meta.head.union.cpp", "patterns": [ { "include": "#ever_present_context" @@ -15937,14 +20221,15 @@ ] }, { - "name": "meta.body.union.cpp", "begin": "(?<=\\{|<%|\\?\\?<)", - "end": "(\\}|%>|\\?\\?>)", + "end": "\\}|%>|\\?\\?>", + "beginCaptures": {}, "endCaptures": { - "1": { + "0": { "name": "punctuation.section.block.end.bracket.curly.union.cpp" } }, + "name": "meta.body.union.cpp", "patterns": [ { "include": "#function_pointer" @@ -15964,9 +20249,11 @@ ] }, { + "begin": "(?<=\\}|%>|\\?\\?>)[\\s]*", + "end": "[\\s]*(?=;)", + "beginCaptures": {}, + "endCaptures": {}, "name": "meta.tail.union.cpp", - "begin": "(?<=\\}|%>|\\?\\?>)[\\s\\n]*", - "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$self" @@ -15976,7 +20263,7 @@ ] }, "union_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))?(?:(?:&|(?:\\*))((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z))))*(?:&|(?:\\*)))?((?:((?:(?>(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:\\s)+)|\\/\\*(?:[^\\*]|(?:\\*)++[^\\/])*+(?:\\*)++\\/)+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.union.declare.cpp" @@ -15989,34 +20276,43 @@ ] }, "3": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "4": { - "name": "comment.block.cpp" - }, - "5": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "6": { + "4": { "name": "entity.name.type.union.cpp" }, - "7": { + "5": { "patterns": [ { "match": "\\*", "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?:(?:(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))+)|(?:\\b)|(?=\\W)|(?<=\\W)|(?:\\A)|(?:\\Z)))){2,}\\&", "captures": { "1": { "patterns": [ @@ -16052,113 +20348,149 @@ } ] }, - "8": { + "6": { "patterns": [ { "include": "#inline_comment" } ] }, - "9": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "10": { - "name": "comment.block.cpp" - }, - "11": { + "7": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "12": { + "8": { "patterns": [ { "include": "#inline_comment" } ] }, - "13": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "14": { - "name": "comment.block.cpp" - }, - "15": { + "9": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "16": { + "10": { "patterns": [ { "include": "#inline_comment" } ] }, - "17": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "18": { - "name": "comment.block.cpp" - }, - "19": { + "11": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] }, - "20": { + "12": { "name": "variable.other.object.declare.cpp" }, - "21": { + "13": { "patterns": [ { "include": "#inline_comment" } ] }, - "22": { - "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" - }, - "23": { - "name": "comment.block.cpp" - }, - "24": { + "14": { "patterns": [ { - "match": "\\*\\/", - "name": "comment.block.cpp punctuation.definition.comment.end.cpp" - }, - { - "match": "\\*", - "name": "comment.block.cpp" + "match": "(?:(?>(?:\\s)+)|(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/)))", + "captures": { + "1": { + "name": "comment.block.cpp punctuation.definition.comment.begin.cpp" + }, + "2": { + "name": "comment.block.cpp" + }, + "3": { + "patterns": [ + { + "match": "\\*\\/", + "name": "comment.block.cpp punctuation.definition.comment.end.cpp" + }, + { + "match": "\\*", + "name": "comment.block.cpp" + } + ] + } + } } ] } } }, "using_name": { - "match": "(using)\\s+(?!namespace\\b)", + "match": "(using)(?:\\s)+(?!namespace\\b)", "captures": { "1": { "name": "keyword.other.using.directive.cpp" @@ -16166,8 +20498,8 @@ } }, "using_namespace": { - "name": "meta.using-namespace.cpp", - "begin": "(?(?:(?>[^<>]*)\\g<7>?)+)>)\\s*)?::)*\\s*+)?((?]*+|\"(?:[^\"]*|\\\\\")\")|'(?:[^']*|\\\\')')\\g<6>?)+>)(?:(?:\\s)+)?)?::)*\\s*+)?((? { + // testing the replace / insert mode + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range = { inserting: new Range(range.start, position), replacing: range }; + + } + } + function updateLabel(item: CompletionItem) { + if (item.kind === CompletionItemKind.Color) { + item.label2 = { + name: item.label, + type: (item.documentation as string) + }; + } + } + // testing the new completion + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + (Array.isArray(r) ? r : r.items).forEach(updateLabel); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); + } } }; diff --git a/extensions/css-language-features/client/src/customData.ts b/extensions/css-language-features/client/src/customData.ts index 7054d0f1ba96d..92d9030a343fa 100644 --- a/extensions/css-language-features/client/src/customData.ts +++ b/extensions/css-language-features/client/src/customData.ts @@ -13,7 +13,7 @@ interface ExperimentalConfig { }; } -export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined): string[] { +export function getCustomDataPathsInAllWorkspaces(workspaceFolders: readonly WorkspaceFolder[] | undefined): string[] { const dataPaths: string[] = []; if (!workspaceFolders) { diff --git a/extensions/css-language-features/package.json b/extensions/css-language-features/package.json index 702d9d755cad0..d10cbc6e10c68 100644 --- a/extensions/css-language-features/package.json +++ b/extensions/css-language-features/package.json @@ -783,6 +783,17 @@ } } ], + "configurationDefaults": { + "[css]": { + "editor.suggest.insertMode": "replace" + }, + "[scss]": { + "editor.suggest.insertMode": "replace" + }, + "[less]": { + "editor.suggest.insertMode": "replace" + } + }, "jsonValidation": [ { "fileMatch": "*.css-data.json", @@ -795,11 +806,11 @@ ] }, "dependencies": { - "vscode-languageclient": "^6.0.0-next.3", + "vscode-languageclient": "^6.1.0", "vscode-nls": "^4.1.1" }, "devDependencies": { "@types/node": "^12.11.7", - "mocha": "^6.1.4" + "mocha": "^7.0.1" } } diff --git a/extensions/css-language-features/schemas/package.schema.json b/extensions/css-language-features/schemas/package.schema.json index 3aeca1e040a08..cf4193008ec59 100644 --- a/extensions/css-language-features/schemas/package.schema.json +++ b/extensions/css-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "CSS contributions to package.json", "type": "object", "properties": { diff --git a/extensions/css-language-features/server/package.json b/extensions/css-language-features/server/package.json index 6d4265225396c..b13b8f650e1da 100644 --- a/extensions/css-language-features/server/package.json +++ b/extensions/css-language-features/server/package.json @@ -9,15 +9,15 @@ }, "main": "./out/cssServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.19", - "vscode-languageserver": "^6.0.0-next.3" + "vscode-css-languageservice": "^4.0.3-next.27", + "vscode-languageserver": "^6.1.0" }, "devDependencies": { "@types/mocha": "2.2.33", "@types/node": "^12.11.7", - "glob": "^7.1.4", - "mocha": "^6.1.4", - "mocha-junit-reporter": "^1.23.1", + "glob": "^7.1.6", + "mocha": "^7.0.1", + "mocha-junit-reporter": "^1.23.3", "mocha-multi-reporters": "^1.1.7" }, "scripts": { diff --git a/extensions/css-language-features/server/test/linksTestFixtures/node_modules/foo/package.json b/extensions/css-language-features/server/test/linksTestFixtures/node_modules/foo/package.json index e69de29bb2d1d..9e26dfeeb6e64 100644 --- a/extensions/css-language-features/server/test/linksTestFixtures/node_modules/foo/package.json +++ b/extensions/css-language-features/server/test/linksTestFixtures/node_modules/foo/package.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/extensions/css-language-features/server/yarn.lock b/extensions/css-language-features/server/yarn.lock index b52fde99a0079..cb93fa9789956 100644 --- a/extensions/css-language-features/server/yarn.lock +++ b/extensions/css-language-features/server/yarn.lock @@ -17,11 +17,6 @@ ansi-colors@3.2.3: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" @@ -32,13 +27,21 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -51,6 +54,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +binary-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" + integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -59,6 +67,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" @@ -83,19 +98,29 @@ charenc@~0.0.1: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= -cliui@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= +chokidar@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.0.tgz#12c0714668c55800f659e262d4962a97faf554a6" + integrity sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.2.0" + optionalDependencies: + fsevents "~2.1.1" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" color-convert@^1.9.0: version "1.9.3" @@ -114,17 +139,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -cross-spawn@^6.0.0: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - crypt@~0.0.1: version "0.0.2" resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" @@ -173,13 +187,6 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== -end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" - integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== - dependencies: - once "^1.4.0" - es-abstract@^1.5.1: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" @@ -211,18 +218,12 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" + to-regex-range "^5.0.1" find-up@3.0.0, find-up@^3.0.0: version "3.0.0" @@ -243,27 +244,27 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +fsevents@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" + integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== - get-caller-file@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-stream@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" - integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== +glob-parent@~5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== dependencies: - pump "^3.0.0" + is-glob "^4.0.1" glob@7.1.3: version "7.1.3" @@ -277,10 +278,10 @@ glob@7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.4: - version "7.1.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" - integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -329,10 +330,12 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" is-buffer@~1.1.1: version "1.1.6" @@ -354,18 +357,28 @@ is-date-object@^1.0.1: resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -373,11 +386,6 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -398,13 +406,6 @@ js-yaml@3.13.1: argparse "^1.0.7" esprima "^4.0.0" -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -418,10 +419,10 @@ lodash@^4.16.4: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg== -lodash@^4.17.11: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@^4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== log-symbols@2.2.0: version "2.2.0" @@ -430,13 +431,6 @@ log-symbols@2.2.0: dependencies: chalk "^2.0.1" -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - md5@^2.1.0: version "2.2.1" resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" @@ -446,20 +440,6 @@ md5@^2.1.0: crypt "~0.0.1" is-buffer "~1.1.1" -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - -mimic-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - minimatch@3.0.4, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -479,10 +459,10 @@ mkdirp@0.5.1, mkdirp@~0.5.1: dependencies: minimist "0.0.8" -mocha-junit-reporter@^1.23.1: - version "1.23.1" - resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.1.tgz#ba11519c0b967f404e4123dd69bc4ba022ab0f12" - integrity sha512-qeDvKlZyAH2YJE1vhryvjUQ06t2hcnwwu4k5Ddwn0GQINhgEYFhlGM0DwYCVUHq5cuo32qAW6HDsTHt7zz99Ng== +mocha-junit-reporter@^1.23.3: + version "1.23.3" + resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.3.tgz#941e219dd759ed732f8641e165918aa8b167c981" + integrity sha512-ed8LqbRj1RxZfjt/oC9t12sfrWsjZ3gNnbhV1nuj9R/Jb5/P3Xb4duv2eCfCDMYH+fEu0mqca7m4wsiVjsxsvA== dependencies: debug "^2.2.0" md5 "^2.1.0" @@ -498,13 +478,14 @@ mocha-multi-reporters@^1.1.7: debug "^3.1.0" lodash "^4.16.4" -mocha@^6.1.4: - version "6.1.4" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.4.tgz#e35fada242d5434a7e163d555c705f6875951640" - integrity sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg== +mocha@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.0.1.tgz#276186d35a4852f6249808c6dd4a1376cbf6c6ce" + integrity sha512-9eWmWTdHLXh72rGrdZjNbG3aa1/3NRPpul1z0D979QpEnFdCG0Q5tv834N+94QEN2cysfV72YocQ3fn87s70fg== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" + chokidar "3.3.0" debug "3.2.6" diff "3.5.0" escape-string-regexp "1.0.5" @@ -517,15 +498,15 @@ mocha@^6.1.4: minimatch "3.0.4" mkdirp "0.5.1" ms "2.1.1" - node-environment-flags "1.0.5" + node-environment-flags "1.0.6" object.assign "4.1.0" strip-json-comments "2.0.1" supports-color "6.0.0" which "1.3.1" wide-align "1.1.3" - yargs "13.2.2" - yargs-parser "13.0.0" - yargs-unparser "1.5.0" + yargs "13.3.0" + yargs-parser "13.1.1" + yargs-unparser "1.6.0" ms@2.0.0: version "2.0.0" @@ -542,30 +523,18 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - -node-environment-flags@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" - integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== +node-environment-flags@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" + integrity sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw== dependencies: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== object-keys@^1.0.11, object-keys@^1.0.12: version "1.1.1" @@ -590,37 +559,13 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.2" es-abstract "^1.5.1" -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" -os-locale@^3.0.0, os-locale@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.0.0" - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= - -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - p-limit@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" @@ -650,35 +595,29 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +picomatch@^2.0.4: + version "2.2.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a" + integrity sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA== -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== +readdirp@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.2.0.tgz#c30c33352b12c96dfb4b895421a49fd5a9593839" + integrity sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ== dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" + picomatch "^2.0.4" require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -semver@^5.5.0, semver@^5.7.0: +semver@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -688,38 +627,12 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -signal-exit@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2": version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -727,7 +640,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^3.0.0: +string-width@^3.0.0, string-width@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== @@ -736,13 +649,6 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" - strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" @@ -750,18 +656,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.1.0: +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: ansi-regex "^4.1.0" -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - strip-json-comments@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -781,45 +682,52 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.19: - version "4.0.3-next.19" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.19.tgz#b7dc58fb8d1968877724e163b6ef20b26c0b5ff6" - integrity sha512-wWSo2MZvd8aEI9lf/Asy0MP0Ao6xAzhBeEWxGcF+Ms/zcV4lDRkyFCNzwDt0OgWRzsBNaEBXfjeWLq9rNXkREA== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +vscode-css-languageservice@^4.0.3-next.27: + version "4.0.3-next.27" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.27.tgz#04f52bfdd85ac7eed8d82a0133aaabb4c0e18f7f" + integrity sha512-MU8sHQABb1WnzOwgazIdO4lXG7cGzFKd7VKi5j67uWTNsqSrbAVSoKGjSyOLq/o6h1L5DGG1Og/7q403z6D04g== dependencies: - vscode-languageserver-textdocument "^1.0.0-next.4" - vscode-languageserver-types "^3.15.0-next.6" + vscode-languageserver-textdocument "^1.0.1-next.1" + vscode-languageserver-types "^3.15.1" vscode-nls "^4.1.1" vscode-uri "^2.1.1" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.2: + version "3.15.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz#e52c62923140b2655ad2472f6f29cfb83bacf5b8" + integrity sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" -vscode-languageserver-textdocument@^1.0.0-next.4: - version "1.0.0-next.4" - resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.0-next.4.tgz#8f7afdfe3e81411f57baaa29bb3214d1907160cd" - integrity sha512-LJ5WfoBO54nqinjlLJKnjoo2Im4bIvPJ8bFT7R0C84ZI36iK8M29ddslfe5jUeWNSTtCda7YuKdKsDIq38HpgA== +vscode-languageserver-textdocument@^1.0.1-next.1: + version "1.0.1-next.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1-next.1.tgz#c8f2f792c7c88d33ea8441ca04bfb8376896b671" + integrity sha512-Cmt0KsNxouns+d7/Kw/jWtWU9Z3h56z1qAA8utjDOEqrDcrTs2rDXv3EJRa99nuKM3wVf6DbWym1VqL9q71XPA== -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== +vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== -vscode-languageserver@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.0.0-next.3.tgz#41e2fda6417939792f6a19fc19ecbb2f080e2072" - integrity sha512-Q6T+KwYuoXV9KRHD6x7RfTU13pV0xAX2BtcuvSC/LBCiVAnEIOe7jKZjzya+B9gDvSk4hpfvhPefy5IdQK1mpQ== +vscode-languageserver@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.1.0.tgz#f0ff149b06d1961f49ed03385ecc2a96bcaddcde" + integrity sha512-Q5kUJegYclTZMnKUaEcxJK41Ozp6qJhhoFJYj0w8y8j9JXdKT479LE945QCKRvSgWfsqTSUmgsozVTUIwQQxHw== dependencies: - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.2" vscode-nls@^4.1.1: version "4.1.1" @@ -836,7 +744,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1.3.1, which@^1.2.9: +which@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -850,13 +758,14 @@ wide-align@1.1.3: dependencies: string-width "^1.0.2 || 2" -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" wrappy@1: version "1.0.2" @@ -868,28 +777,12 @@ xml@^1.0.0: resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yargs-parser@13.0.0: - version "13.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.0.0.tgz#3fc44f3e76a8bdb1cc3602e860108602e5ccde8b" - integrity sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" - integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^13.0.0: +yargs-parser@13.1.1, yargs-parser@^13.1.1: version "13.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== @@ -897,46 +790,27 @@ yargs-parser@^13.0.0: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-unparser@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.5.0.tgz#f2bb2a7e83cbc87bb95c8e572828a06c9add6e0d" - integrity sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw== +yargs-unparser@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.6.0.tgz#ef25c2c769ff6bd09e4b0f9d7c605fb27846ea9f" + integrity sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw== dependencies: flat "^4.1.0" - lodash "^4.17.11" - yargs "^12.0.5" + lodash "^4.17.15" + yargs "^13.3.0" -yargs@13.2.2: - version "13.2.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.2.tgz#0c101f580ae95cea7f39d927e7770e3fdc97f993" - integrity sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA== +yargs@13.3.0, yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== dependencies: - cliui "^4.0.0" + cliui "^5.0.0" find-up "^3.0.0" get-caller-file "^2.0.1" - os-locale "^3.1.0" require-directory "^2.1.1" require-main-filename "^2.0.0" set-blocking "^2.0.0" string-width "^3.0.0" which-module "^2.0.0" y18n "^4.0.0" - yargs-parser "^13.0.0" - -yargs@^12.0.5: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" - integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== - dependencies: - cliui "^4.0.0" - decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" + yargs-parser "^13.1.1" diff --git a/extensions/css-language-features/yarn.lock b/extensions/css-language-features/yarn.lock index 517f84ba75b19..b90ab508aaae9 100644 --- a/extensions/css-language-features/yarn.lock +++ b/extensions/css-language-features/yarn.lock @@ -29,6 +29,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -41,6 +49,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +binary-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" + integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -49,6 +62,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" @@ -68,6 +88,21 @@ chalk@^2.0.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chokidar@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.0.tgz#12c0714668c55800f659e262d4962a97faf554a6" + integrity sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.2.0" + optionalDependencies: + fsevents "~2.1.1" + cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -158,6 +193,13 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-up@3.0.0, find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -177,6 +219,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +fsevents@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" + integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -187,6 +234,13 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +glob-parent@~5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + glob@7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" @@ -239,6 +293,13 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-buffer@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" @@ -254,11 +315,28 @@ is-date-object@^1.0.1: resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -325,13 +403,14 @@ mkdirp@0.5.1: dependencies: minimist "0.0.8" -mocha@^6.1.4: - version "6.2.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.2.1.tgz#da941c99437da9bac412097859ff99543969f94c" - integrity sha512-VCcWkLHwk79NYQc8cxhkmI8IigTIhsCwZ6RTxQsqK6go4UvEhzJkYuHm8B2YtlSxcYq2fY+ucr4JBwoD6ci80A== +mocha@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.0.1.tgz#276186d35a4852f6249808c6dd4a1376cbf6c6ce" + integrity sha512-9eWmWTdHLXh72rGrdZjNbG3aa1/3NRPpul1z0D979QpEnFdCG0Q5tv834N+94QEN2cysfV72YocQ3fn87s70fg== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" + chokidar "3.3.0" debug "3.2.6" diff "3.5.0" escape-string-regexp "1.0.5" @@ -344,7 +423,7 @@ mocha@^6.1.4: minimatch "3.0.4" mkdirp "0.5.1" ms "2.1.1" - node-environment-flags "1.0.5" + node-environment-flags "1.0.6" object.assign "4.1.0" strip-json-comments "2.0.1" supports-color "6.0.0" @@ -364,14 +443,19 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -node-environment-flags@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" - integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== +node-environment-flags@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" + integrity sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw== dependencies: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + object-inspect@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" @@ -436,6 +520,18 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +picomatch@^2.0.4: + version "2.2.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a" + integrity sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA== + +readdirp@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.2.0.tgz#c30c33352b12c96dfb4b895421a49fd5a9593839" + integrity sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ== + dependencies: + picomatch "^2.0.4" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -532,31 +628,38 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageclient@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.0.0-next.3.tgz#41b701d963fc7affc01e9279532a747fcd4f3810" - integrity sha512-SuSaG9xjqkROm4Ie0jQig0CFDuU/WxHERegl3kRsFHDbhMSK4dH45ZeBY5zMWUgZ+LrIrEbwf8qWNlrTRBlUgg== +vscode-languageclient@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz#ee67c0b7818c42ce0281572d05c89adfcc4f5a38" + integrity sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA== dependencies: semver "^6.3.0" - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.2" -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.2: + version "3.15.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz#e52c62923140b2655ad2472f6f29cfb83bacf5b8" + integrity sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== +vscode-languageserver-types@3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== vscode-nls@^4.1.1: version "4.1.1" diff --git a/extensions/css/test/colorize-results/test-variables_css.json b/extensions/css/test/colorize-results/test-variables_css.json index 218818607d484..6cb52170983ba 100644 --- a/extensions/css/test/colorize-results/test-variables_css.json +++ b/extensions/css/test/colorize-results/test-variables_css.json @@ -92,9 +92,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -103,9 +103,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -180,9 +180,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -378,9 +378,9 @@ "t": "source.css meta.property-list.css meta.property-value.css meta.function.calc.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -477,9 +477,9 @@ "t": "source.css meta.property-list.css meta.property-value.css meta.function.calc.css meta.function.variable.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -488,9 +488,9 @@ "t": "source.css meta.property-list.css meta.property-value.css meta.function.calc.css meta.function.variable.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -538,4 +538,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/css/test/colorize-results/test_css.json b/extensions/css/test/colorize-results/test_css.json index 224520e7f4899..95fa9755044a2 100644 --- a/extensions/css/test/colorize-results/test_css.json +++ b/extensions/css/test/colorize-results/test_css.json @@ -675,9 +675,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -741,9 +741,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -851,9 +851,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -862,9 +862,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -983,9 +983,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1324,9 +1324,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1390,9 +1390,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2281,9 +2281,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2501,9 +2501,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2512,9 +2512,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2633,9 +2633,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2644,9 +2644,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2710,9 +2710,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4129,9 +4129,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4151,9 +4151,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4162,9 +4162,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4184,9 +4184,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4206,9 +4206,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4217,9 +4217,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4283,9 +4283,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4470,9 +4470,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4481,9 +4481,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4547,9 +4547,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4558,9 +4558,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4877,9 +4877,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4888,9 +4888,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5020,9 +5020,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5031,9 +5031,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5097,9 +5097,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5108,9 +5108,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5240,9 +5240,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5251,9 +5251,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5493,9 +5493,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5504,9 +5504,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5570,9 +5570,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5581,9 +5581,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5768,9 +5768,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5779,9 +5779,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5801,9 +5801,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5812,9 +5812,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5834,9 +5834,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5845,9 +5845,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5867,9 +5867,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5878,9 +5878,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5944,9 +5944,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5955,9 +5955,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6186,9 +6186,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6197,9 +6197,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6219,9 +6219,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6494,9 +6494,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6505,9 +6505,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6527,9 +6527,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6538,9 +6538,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6560,9 +6560,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6582,9 +6582,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6593,9 +6593,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6714,9 +6714,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6725,9 +6725,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -6791,9 +6791,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6802,9 +6802,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7132,9 +7132,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7143,9 +7143,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7264,9 +7264,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7275,9 +7275,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7407,9 +7407,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7473,9 +7473,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7627,9 +7627,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7638,9 +7638,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7946,9 +7946,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7957,9 +7957,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8023,9 +8023,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8034,9 +8034,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8100,9 +8100,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8111,9 +8111,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8892,9 +8892,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8903,9 +8903,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8969,9 +8969,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9035,9 +9035,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9046,9 +9046,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -9112,9 +9112,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9123,9 +9123,9 @@ "t": "source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -9151,4 +9151,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/emmet/package.json b/extensions/emmet/package.json index ed8e8ea9f8718..fc149b28e54b8 100644 --- a/extensions/emmet/package.json +++ b/extensions/emmet/package.json @@ -80,7 +80,10 @@ "description": "%emmetExclude%" }, "emmet.extensionsPath": { - "type": "string", + "type": [ + "string", + "null" + ], "default": null, "description": "%emmetExtensionsPath%" }, @@ -450,7 +453,7 @@ "@emmetio/html-matcher": "^0.3.3", "@emmetio/math-expression": "^0.1.1", "image-size": "^0.5.2", - "vscode-emmet-helper": "^1.2.16", + "vscode-emmet-helper": "^1.2.17", "vscode-html-languageservice": "^3.0.3" } } diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts index 9ec8edd939944..53c724570aa57 100644 --- a/extensions/emmet/src/abbreviationActions.ts +++ b/extensions/emmet/src/abbreviationActions.ts @@ -94,8 +94,8 @@ function doWrapping(individualLines: boolean, args: any) { } else { const wholeFirstLine = editor.document.lineAt(rangeToReplace.start).text; const otherMatches = wholeFirstLine.match(/^(\s*)/); - const preceedingWhitespace = otherMatches ? otherMatches[1] : ''; - textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhitespace).join('\n\t') + '\n']; + const precedingWhitespace = otherMatches ? otherMatches[1] : ''; + textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + precedingWhitespace).join('\n\t') + '\n']; } textToWrapInPreview = textToWrapInPreview.map(e => e.replace(/(\$\d)/g, '\\$1')); diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts index 590caa70822a9..d58e2c62a6c2f 100644 --- a/extensions/emmet/src/defaultCompletionProvider.ts +++ b/extensions/emmet/src/defaultCompletionProvider.ts @@ -175,6 +175,14 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi } let result = helper.doComplete(document, position, syntax, getEmmetConfiguration(syntax!)); + + // https://github.com/microsoft/vscode/issues/86941 + if (result && result.items && result.items.length === 1) { + if (result.items[0].label === 'widows: ;') { + return undefined; + } + } + let newItems: vscode.CompletionItem[] = []; if (result && result.items) { result.items.forEach((item: any) => { diff --git a/extensions/emmet/src/extension.ts b/extensions/emmet/src/extension.ts index a5195af577c71..4fe40db638b40 100644 --- a/extensions/emmet/src/extension.ts +++ b/extensions/emmet/src/extension.ts @@ -165,7 +165,7 @@ function registerCompletionProviders(context: vscode.ExtensionContext) { completionProvidersMapping.delete(language); } - const provider = vscode.languages.registerCompletionItemProvider([{ language, scheme: 'file' }, { language, scheme: 'untitled' }], completionProvider, ...LANGUAGE_MODES[includedLanguages[language]]); + const provider = vscode.languages.registerCompletionItemProvider({ language, scheme: '*' }, completionProvider, ...LANGUAGE_MODES[includedLanguages[language]]); context.subscriptions.push(provider); languageMappingForCompletionProviders.set(language, includedLanguages[language]); @@ -174,7 +174,7 @@ function registerCompletionProviders(context: vscode.ExtensionContext) { Object.keys(LANGUAGE_MODES).forEach(language => { if (!languageMappingForCompletionProviders.has(language)) { - const provider = vscode.languages.registerCompletionItemProvider([{ language, scheme: 'file' }, { language, scheme: 'untitled' }], completionProvider, ...LANGUAGE_MODES[language]); + const provider = vscode.languages.registerCompletionItemProvider({ language, scheme: '*' }, completionProvider, ...LANGUAGE_MODES[language]); context.subscriptions.push(provider); languageMappingForCompletionProviders.set(language, language); diff --git a/extensions/emmet/src/test/abbreviationAction.test.ts b/extensions/emmet/src/test/abbreviationAction.test.ts index 31f46891965f8..cedf324490385 100644 --- a/extensions/emmet/src/test/abbreviationAction.test.ts +++ b/extensions/emmet/src/test/abbreviationAction.test.ts @@ -362,7 +362,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => { }); test('Expand html when inside script tag with javascript type if js is mapped to html (HTML)', async () => { - await workspace.getConfiguration('emmet').update('includeLanguages', { "javascript": "html" }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('includeLanguages', { 'javascript': 'html' }, ConfigurationTarget.Global); await withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => { editor.selection = new Selection(24, 10, 24, 10); let expandPromise = expandEmmetAbbreviation(null); @@ -378,7 +378,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => { test('Expand html in completion list when inside script tag with javascript type if js is mapped to html (HTML)', async () => { const abbreviation = 'span.bye'; const expandedText = ''; - await workspace.getConfiguration('emmet').update('includeLanguages', { "javascript": "html" }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('includeLanguages', { 'javascript': 'html' }, ConfigurationTarget.Global); await withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => { editor.selection = new Selection(24, 10, 24, 10); const cancelSrc = new CancellationTokenSource(); @@ -448,7 +448,7 @@ suite('Tests for jsx, xml and xsl', () => { }); test('Expand abbreviation with single quotes for jsx', async () => { - await workspace.getConfiguration('emmet').update('syntaxProfiles', { jsx: { "attr_quotes": "single" } }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('syntaxProfiles', { jsx: { 'attr_quotes': 'single' } }, ConfigurationTarget.Global); return withRandomFileEditor('img', 'javascriptreact', async (editor, _doc) => { editor.selection = new Selection(0, 6, 0, 6); await expandEmmetAbbreviation({ language: 'javascriptreact' }); diff --git a/extensions/emmet/src/test/completion.test.ts b/extensions/emmet/src/test/completion.test.ts index 1ac7ac1ba80aa..728dc26a3b379 100644 --- a/extensions/emmet/src/test/completion.test.ts +++ b/extensions/emmet/src/test/completion.test.ts @@ -30,6 +30,13 @@ suite('Tests for completion in CSS embedded in HTML', () => { { label: 'div', documentation: `
|
` } ]); }); + + // https://github.com/microsoft/vscode/issues/86941 + test('#86941, widows should not be completed', async () => { + await testCssCompletionProvider(`.foo { wi| }`, [ + { label: 'widows: ;', documentation: `widows: ;` } + ]); + }); }); interface TestCompletionItem { @@ -78,3 +85,44 @@ function testHtmlCompletionProvider(contents: string, expectedItems: TestComplet return Promise.resolve(); }); } + +function testCssCompletionProvider(contents: string, expectedItems: TestCompletionItem[]): Thenable { + const cursorPos = contents.indexOf('|'); + const cssContents = contents.slice(0, cursorPos) + contents.slice(cursorPos + 1); + + return withRandomFileEditor(cssContents, 'css', async (editor, _doc) => { + const selection = new Selection(editor.document.positionAt(cursorPos), editor.document.positionAt(cursorPos)); + editor.selection = selection; + const cancelSrc = new CancellationTokenSource(); + const completionPromise = completionProvider.provideCompletionItems( + editor.document, + editor.selection.active, + cancelSrc.token, + { triggerKind: CompletionTriggerKind.Invoke } + ); + if (!completionPromise) { + return Promise.resolve(); + } + + const completionList = await completionPromise; + if (!completionList || !completionList.items || !completionList.items.length) { + return Promise.resolve(); + } + + expectedItems.forEach(eItem => { + const matches = completionList.items.filter(i => i.label === eItem.label); + const match = matches && matches.length > 0 ? matches[0] : undefined; + assert.ok(match, `Didn't find completion item with label ${eItem.label}`); + + if (match) { + assert.equal(match.detail, 'Emmet Abbreviation', `Match needs to come from Emmet`); + + if (eItem.documentation) { + assert.equal(match.documentation, eItem.documentation, `Emmet completion Documentation doesn't match`); + } + } + }); + + return Promise.resolve(); + }); +} diff --git a/extensions/emmet/src/test/partialParsingStylesheet.test.ts b/extensions/emmet/src/test/partialParsingStylesheet.test.ts index 7a115bd47aad1..0c19d06b6453f 100644 --- a/extensions/emmet/src/test/partialParsingStylesheet.test.ts +++ b/extensions/emmet/src/test/partialParsingStylesheet.test.ts @@ -40,7 +40,7 @@ p { new vscode.Range(3, 13, 3, 14), // p just before ending of block comment new vscode.Range(6, 2, 6, 3) // p after ending of block - ] + ]; rangesForEmmet.forEach(range => { assert.equal(isValid(doc, range, 'css'), true); }); diff --git a/extensions/emmet/src/test/test-fixtures/marker.txt b/extensions/emmet/src/test/test-fixtures/marker.txt new file mode 100644 index 0000000000000..a4c9ad4073651 --- /dev/null +++ b/extensions/emmet/src/test/test-fixtures/marker.txt @@ -0,0 +1 @@ +DO NOT DELETE, USED BY INTEGRATION TESTS diff --git a/extensions/emmet/yarn.lock b/extensions/emmet/yarn.lock index a801de886fd0d..37e06ecb52270 100644 --- a/extensions/emmet/yarn.lock +++ b/extensions/emmet/yarn.lock @@ -2469,10 +2469,10 @@ vinyl@~2.0.1: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" -vscode-emmet-helper@^1.2.16: - version "1.2.16" - resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-1.2.16.tgz#cfefb8b54c68178b4696d4abae806bb3a2b043e8" - integrity sha512-BuQK6fTV2w65Yd0/CJGj1EOvcJ9NHWfrMJ9nA8pjnu9jzAAnXLhnbviuGT9medMiPU0mp0tJqc/8Z0qlXcqdGw== +vscode-emmet-helper@^1.2.17: + version "1.2.17" + resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-1.2.17.tgz#f0c6bfcebc4285d081fb2618e6e5b9a08c567afa" + integrity sha512-X4pzcrJ8dE7M3ArFuySF5fgipKDd/EauXkiJwtjBIVRWpVNq0tF9+lNCyuC7iDUwP3Oq7ow/TGssD3GdG96Jow== dependencies: "@emmetio/extract-abbreviation" "0.1.6" jsonc-parser "^1.0.0" diff --git a/extensions/extension-editing/package.json b/extensions/extension-editing/package.json index 54edf5ccbdc57..fe4a7b44d2a7d 100644 --- a/extensions/extension-editing/package.json +++ b/extensions/extension-editing/package.json @@ -19,10 +19,10 @@ "watch": "gulp watch-extension:extension-editing" }, "dependencies": { - "jsonc-parser": "^2.1.1", + "jsonc-parser": "^2.2.1", "markdown-it": "^8.3.1", "parse5": "^3.0.2", - "vscode-nls": "^4.0.0" + "vscode-nls": "^4.1.1" }, "contributes": { "jsonValidation": [ diff --git a/extensions/extension-editing/yarn.lock b/extensions/extension-editing/yarn.lock index d2f69a169d82f..50adf31c09964 100644 --- a/extensions/extension-editing/yarn.lock +++ b/extensions/extension-editing/yarn.lock @@ -29,10 +29,10 @@ entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" integrity sha1-blwtClYhtdra7O+AuQ7ftc13cvA= -jsonc-parser@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" - integrity sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g== +jsonc-parser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== linkify-it@^2.0.0: version "2.0.3" @@ -74,7 +74,7 @@ uc.micro@^1.0.1, uc.micro@^1.0.3: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.3.tgz#7ed50d5e0f9a9fb0a573379259f2a77458d50192" integrity sha1-ftUNXg+an7ClczeSWfKndFjVAZI= -vscode-nls@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" - integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== +vscode-nls@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" + integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A== diff --git a/extensions/fsharp/test/colorize-results/test_fs.json b/extensions/fsharp/test/colorize-results/test_fs.json index 2d1544d210e2d..9b68ea7507e0e 100644 --- a/extensions/fsharp/test/colorize-results/test_fs.json +++ b/extensions/fsharp/test/colorize-results/test_fs.json @@ -422,9 +422,9 @@ "t": "source.fsharp constant.numeric.integer.nativeint.fsharp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -928,9 +928,9 @@ "t": "source.fsharp constant.numeric.integer.nativeint.fsharp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1396,4 +1396,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/git-ui/package.json b/extensions/git-ui/package.json index 84133436ef8fd..b08942888ea26 100644 --- a/extensions/git-ui/package.json +++ b/extensions/git-ui/package.json @@ -7,7 +7,9 @@ "engines": { "vscode": "^1.5.0" }, - "extensionKind": "ui", + "extensionKind": [ + "ui" + ], "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", "enableProposedApi": true, "categories": [ diff --git a/extensions/git/package.json b/extensions/git/package.json index eff48607109d1..1eaf39ad44bf2 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -26,6 +26,11 @@ }, "contributes": { "commands": [ + { + "command": "git.setLogLevel", + "title": "%command.setLogLevel%", + "category": "Git" + }, { "command": "git.clone", "title": "%command.clone%", @@ -442,61 +447,81 @@ "command": "git.stashDrop", "title": "%command.stashDrop%", "category": "Git" + }, + { + "command": "git.timeline.openDiff", + "title": "%command.timelineOpenDiff%", + "icon": "$(compare-changes)", + "category": "Git" + }, + { + "command": "git.timeline.copyCommitId", + "title": "%command.timelineCopyCommitId%", + "category": "Git" + }, + { + "command": "git.timeline.copyCommitMessage", + "title": "%command.timelineCopyCommitMessage%", + "category": "Git" } ], "menus": { "commandPalette": [ + { + "command": "git.setLogLevel", + "when": "config.git.enabled && !git.missing" + }, { "command": "git.clone", - "when": "config.git.enabled" + "when": "config.git.enabled && !git.missing" }, { "command": "git.init", - "when": "config.git.enabled" + "when": "config.git.enabled && !git.missing" }, { "command": "git.openRepository", - "when": "config.git.enabled" + "when": "config.git.enabled && !git.missing" }, { "command": "git.close", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.refresh", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.openFile", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.openHEADFile", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.openChange", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stage", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stageAll", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stageAllTracked", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stageAllUntracked", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stageSelectedRanges", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stageChange", @@ -504,7 +529,7 @@ }, { "command": "git.revertSelectedRanges", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.revertChange", @@ -516,51 +541,63 @@ }, { "command": "git.unstage", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.unstageAll", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.unstageSelectedRanges", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.clean", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.cleanAll", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" + }, + { + "command": "git.cleanAllTracked", + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" + }, + { + "command": "git.cleanAllUntracked", + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commit", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitStaged", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" + }, + { + "command": "git.commitEmpty", + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitStagedSigned", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitStagedAmend", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitAll", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitAllSigned", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.commitAllAmend", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.restoreCommitTemplate", @@ -572,111 +609,111 @@ }, { "command": "git.undoCommit", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.checkout", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.branch", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.branchFrom", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.deleteBranch", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.renameBranch", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pull", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pullFrom", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pullRebase", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pullFrom", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.merge", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.createTag", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.deleteTag", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.fetch", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.fetchPrune", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.fetchAll", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.push", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pushForce", - "when": "config.git.enabled && config.git.allowForcePush && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0" }, { "command": "git.pushTo", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pushToForce", - "when": "config.git.enabled && config.git.allowForcePush && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0" }, { "command": "git.pushWithTags", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.pushWithTagsForce", - "when": "config.git.enabled && config.git.allowForcePush && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0" }, { "command": "git.addRemote", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.removeRemote", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.sync", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.syncRebase", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.publish", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.showOutput", @@ -684,43 +721,50 @@ }, { "command": "git.ignore", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashIncludeUntracked", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stash", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashPop", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashPopLatest", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashApply", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashApplyLatest", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" }, { "command": "git.stashDrop", - "when": "config.git.enabled && gitOpenRepositoryCount != 0" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" + }, + { + "command": "git.timeline.openDiff", + "when": "false" + }, + { + "command": "git.timeline.copyCommitId", + "when": "false" + }, + { + "command": "git.timeline.copyCommitMessage", + "when": "false" } ], "scm/title": [ - { - "command": "git.init", - "group": "navigation", - "when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0 && workspaceFolderCount != 0" - }, { "command": "git.commit", "group": "navigation", @@ -1194,54 +1238,76 @@ { "command": "git.openFile", "group": "navigation", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.openChange", "group": "navigation", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && !isInDiffEditor && resourceScheme == file" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && !isInDiffEditor && resourceScheme == file" }, { "command": "git.stageSelectedRanges", "group": "2_git@1", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.unstageSelectedRanges", "group": "2_git@2", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.revertSelectedRanges", "group": "2_git@3", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" } ], "editor/context": [ { "command": "git.stageSelectedRanges", "group": "2_git@1", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.unstageSelectedRanges", "group": "2_git@2", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.revertSelectedRanges", "group": "2_git@3", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" } ], "scm/change/title": [ { "command": "git.stageChange", - "when": "originalResourceScheme == git" + "when": "config.git.enabled && !git.missing && originalResourceScheme == git" }, { "command": "git.revertChange", - "when": "originalResourceScheme == git" + "when": "config.git.enabled && !git.missing && originalResourceScheme == git" + } + ], + "timeline/item/context": [ + { + "command": "git.timeline.openDiff", + "group": "inline", + "when": "config.git.enabled && !git.missing && timelineItem =~ /git:file\\b/" + }, + { + "command": "git.timeline.openDiff", + "group": "1_timeline", + "when": "config.git.enabled && !git.missing && timelineItem =~ /git:file\\b/" + }, + { + "command": "git.timeline.copyCommitId", + "group": "2_timeline@1", + "when": "config.git.enabled && !git.missing && timelineItem =~ /git:file:commit\\b/" + }, + { + "command": "git.timeline.copyCommitMessage", + "group": "2_timeline@2", + "when": "config.git.enabled && !git.missing && timelineItem =~ /git:file:commit\\b/" } ] }, @@ -1367,7 +1433,10 @@ "default": false }, "git.defaultCloneDirectory": { - "type": "string", + "type": [ + "string", + "null" + ], "default": null, "description": "%config.defaultCloneDirectory%" }, @@ -1608,12 +1677,6 @@ "default": "mixed", "description": "%config.untrackedChanges%", "scope": "resource" - }, - "git.restoreCommitTemplateComments": { - "type": "boolean", - "scope": "resource", - "default": true, - "description": "%config.restoreCommitTemplateComments%" } } }, @@ -1759,10 +1822,47 @@ 72 ] } - } + }, + "viewsWelcome": [ + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.disabled%", + "when": "!config.git.enabled" + }, + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.missing%", + "when": "config.git.enabled && git.missing" + }, + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.empty%", + "when": "config.git.enabled && !git.missing && workbenchState == empty" + }, + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.folder%", + "when": "config.git.enabled && !git.missing && workbenchState == folder" + }, + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.workspace%", + "when": "config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount != 0" + }, + { + "view": "workbench.scm", + "contents": "%view.workbench.scm.emptyWorkspace%", + "when": "config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount == 0" + }, + { + "view": "workbench.explorer.emptyView", + "contents": "%view.workbench.cloneRepository%" + } + ] }, "dependencies": { "byline": "^5.0.0", + "dayjs": "1.8.19", "file-type": "^7.2.0", "iconv-lite": "^0.4.24", "jschardet": "2.1.1", @@ -1777,6 +1877,9 @@ "@types/mocha": "2.2.43", "@types/node": "^12.11.7", "@types/which": "^1.0.28", - "mocha": "^3.2.0" + "mocha": "^3.2.0", + "mocha-junit-reporter": "^1.23.3", + "mocha-multi-reporters": "^1.1.7", + "vscode": "^1.1.36" } } diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index ad377c36b6191..6328edd99bfac 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -1,6 +1,7 @@ { "displayName": "Git", "description": "Git SCM Integration", + "command.setLogLevel": "Set Log Level...", "command.clone": "Clone", "command.init": "Initialize Repository", "command.openRepository": "Open Repository", @@ -61,7 +62,7 @@ "command.publish": "Publish Branch...", "command.showOutput": "Show Git Output", "command.ignore": "Add to .gitignore", - "command.revealInExplorer": "Reveal in Explorer", + "command.revealInExplorer": "Reveal in Side Bar", "command.stashIncludeUntracked": "Stash (Include Untracked)", "command.stash": "Stash", "command.stashPop": "Pop Stash...", @@ -69,6 +70,9 @@ "command.stashApply": "Apply Stash...", "command.stashApplyLatest": "Apply Latest Stash", "command.stashDrop": "Drop Stash...", + "command.timelineOpenDiff": "Open Changes", + "command.timelineCopyCommitId": "Copy Commit ID", + "command.timelineCopyCommitMessage": "Copy Commit Message", "config.enabled": "Whether git is enabled.", "config.path": "Path and filename of the git executable, e.g. `C:\\Program Files\\Git\\bin\\git.exe` (Windows).", "config.autoRepositoryDetection": "Configures when repositories should be automatically detected.", @@ -126,7 +130,7 @@ "config.showProgress": "Controls whether git actions should show progress.", "config.rebaseWhenSync": "Force git to use rebase when running the sync command.", "config.confirmEmptyCommits": "Always confirm the creation of empty commits for the 'Git: Commit Empty' command.", - "config.fetchOnPull": "Fetch all branches when pulling or just the current one.", + "config.fetchOnPull": "When enabled, fetch all branches when pulling. Otherwise, fetch just the current one.", "config.pullTags": "Fetch all tags when pulling.", "config.autoStash": "Stash any changes before pulling and restore them after successful pull.", "config.allowForcePush": "Controls whether force push (with or without lease) is enabled.", @@ -139,12 +143,18 @@ "config.untrackedChanges.mixed": "All changes, tracked and untracked, appear together and behave equally.", "config.untrackedChanges.separate": "Untracked changes appear separately in the Source Control view. They are also excluded from several actions.", "config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.", - "config.restoreCommitTemplateComments": "Controls whether to restore commit template comments in the commit input box.", "colors.added": "Color for added resources.", "colors.modified": "Color for modified resources.", "colors.deleted": "Color for deleted resources.", "colors.untracked": "Color for untracked resources.", "colors.ignored": "Color for ignored resources.", "colors.conflict": "Color for resources with conflicts.", - "colors.submodule": "Color for submodule resources." + "colors.submodule": "Color for submodule resources.", + "view.workbench.scm.missing": "A valid git installation was not detected, more details can be found in the [git output](command:git.showOutput).\nPlease [install git](https://git-scm.com/), or learn more about how to use Git and source control in VS Code in [our docs](https://aka.ms/vscode-scm).\nIf you're using a different version control system, you can [search the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22) for additional extensions.", + "view.workbench.scm.disabled": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "view.workbench.scm.empty": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Initialize Repository](command:git.init)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "view.workbench.scm.emptyWorkspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "view.workbench.cloneRepository": "You can also clone a repository from a URL. To learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).\n[Clone Repository](command:git.clone)" } diff --git a/extensions/git/src/api/api1.ts b/extensions/git/src/api/api1.ts index a4fd677db27d2..0b6ed8550aa84 100644 --- a/extensions/git/src/api/api1.ts +++ b/extensions/git/src/api/api1.ts @@ -5,9 +5,10 @@ import { Model } from '../model'; import { Repository as BaseRepository, Resource } from '../repository'; -import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState } from './git'; +import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions } from './git'; import { Event, SourceControlInputBox, Uri, SourceControl } from 'vscode'; import { mapEvent } from '../util'; +import { toGitUri } from '../uri'; class ApiInputBox implements InputBox { set value(value: string) { this._inputBox.value = value; } @@ -201,6 +202,10 @@ export class ApiRepository implements Repository { log(options?: LogOptions): Promise { return this._repository.log(options); } + + commit(message: string, opts?: CommitOptions): Promise { + return this._repository.commit(message, opts); + } } export class ApiGit implements Git { @@ -234,5 +239,14 @@ export class ApiImpl implements API { return this._model.repositories.map(r => new ApiRepository(r)); } + toGitUri(uri: Uri, ref: string): Uri { + return toGitUri(uri, ref); + } + + getRepository(uri: Uri): Repository | null { + const result = this._model.getRepository(uri); + return result ? new ApiRepository(result) : null; + } + constructor(private _model: Model) { } } diff --git a/extensions/git/src/api/git.d.ts b/extensions/git/src/api/git.d.ts index a0b2d3dad7f9b..c688a4444278e 100644 --- a/extensions/git/src/api/git.d.ts +++ b/extensions/git/src/api/git.d.ts @@ -41,7 +41,10 @@ export interface Commit { readonly hash: string; readonly message: string; readonly parents: string[]; - readonly authorEmail?: string | undefined; + readonly authorDate?: Date; + readonly authorName?: string; + readonly authorEmail?: string; + readonly commitDate?: Date; } export interface Submodule { @@ -119,6 +122,14 @@ export interface LogOptions { readonly maxEntries?: number; } +export interface CommitOptions { + all?: boolean | 'tracked'; + amend?: boolean; + signoff?: boolean; + signCommit?: boolean; + empty?: boolean; +} + export interface Repository { readonly rootUri: Uri; @@ -174,6 +185,8 @@ export interface Repository { blame(path: string): Promise; log(options?: LogOptions): Promise; + + commit(message: string, opts?: CommitOptions): Promise; } export type APIState = 'uninitialized' | 'initialized'; @@ -185,6 +198,9 @@ export interface API { readonly repositories: Repository[]; readonly onDidOpenRepository: Event; readonly onDidCloseRepository: Event; + + toGitUri(uri: Uri, ref: string): Uri; + getRepository(uri: Uri): Repository | null; } export interface GitExtension { diff --git a/extensions/git/src/askpass-main.ts b/extensions/git/src/askpass-main.ts index c08aa2a0afc12..685fc08ef86e7 100644 --- a/extensions/git/src/askpass-main.ts +++ b/extensions/git/src/askpass-main.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as http from 'http'; import * as fs from 'fs'; import * as nls from 'vscode-nls'; +import { IPCClient } from './ipc/ipcClient'; const localize = nls.loadMessageBundle(); @@ -20,10 +20,6 @@ function main(argv: string[]): void { return fatal('Wrong number of arguments'); } - if (!process.env['VSCODE_GIT_ASKPASS_HANDLE']) { - return fatal('Missing handle'); - } - if (!process.env['VSCODE_GIT_ASKPASS_PIPE']) { return fatal('Missing pipe'); } @@ -33,40 +29,14 @@ function main(argv: string[]): void { } const output = process.env['VSCODE_GIT_ASKPASS_PIPE'] as string; - const socketPath = process.env['VSCODE_GIT_ASKPASS_HANDLE'] as string; const request = argv[2]; const host = argv[4].substring(1, argv[4].length - 2); - const opts: http.RequestOptions = { - socketPath, - path: '/', - method: 'POST' - }; - - const req = http.request(opts, res => { - if (res.statusCode !== 200) { - return fatal(`Bad status code: ${res.statusCode}`); - } - - const chunks: string[] = []; - res.setEncoding('utf8'); - res.on('data', (d: string) => chunks.push(d)); - res.on('end', () => { - const raw = chunks.join(''); - - try { - const result = JSON.parse(raw); - fs.writeFileSync(output, result + '\n'); - } catch (err) { - return fatal(`Error parsing response`); - } - - setTimeout(() => process.exit(0), 0); - }); - }); + const ipcClient = new IPCClient('askpass'); - req.on('error', () => fatal('Error in request')); - req.write(JSON.stringify({ request, host })); - req.end(); + ipcClient.call({ request, host }).then(res => { + fs.writeFileSync(output, res + '\n'); + setTimeout(() => process.exit(0), 0); + }).catch(err => fatal(err)); } main(process.argv); diff --git a/extensions/git/src/askpass.ts b/extensions/git/src/askpass.ts index 03000c7290d05..dd7e84c2e030a 100644 --- a/extensions/git/src/askpass.ts +++ b/extensions/git/src/askpass.ts @@ -3,15 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Disposable, window, InputBoxOptions } from 'vscode'; -import { denodeify } from './util'; +import { window, InputBoxOptions } from 'vscode'; +import { IDisposable } from './util'; import * as path from 'path'; -import * as http from 'http'; -import * as os from 'os'; -import * as fs from 'fs'; -import * as crypto from 'crypto'; - -const randomBytes = denodeify(crypto.randomBytes); +import { IIPCHandler, IIPCServer } from './ipc/ipcServer'; export interface AskpassEnvironment { GIT_ASKPASS: string; @@ -21,68 +16,21 @@ export interface AskpassEnvironment { VSCODE_GIT_ASKPASS_HANDLE?: string; } -function getIPCHandlePath(nonce: string): string { - if (process.platform === 'win32') { - return `\\\\.\\pipe\\vscode-git-askpass-${nonce}-sock`; - } +export class Askpass implements IIPCHandler { - if (process.env['XDG_RUNTIME_DIR']) { - return path.join(process.env['XDG_RUNTIME_DIR'] as string, `vscode-git-askpass-${nonce}.sock`); - } - - return path.join(os.tmpdir(), `vscode-git-askpass-${nonce}.sock`); -} - -export class Askpass implements Disposable { - - private server: http.Server; - private ipcHandlePathPromise: Promise; - private ipcHandlePath: string | undefined; - private enabled = true; - - constructor() { - this.server = http.createServer((req, res) => this.onRequest(req, res)); - this.ipcHandlePathPromise = this.setup().catch(err => { - console.error(err); - return ''; - }); - } + private disposable: IDisposable; - private async setup(): Promise { - const buffer = await randomBytes(20); - const nonce = buffer.toString('hex'); - const ipcHandlePath = getIPCHandlePath(nonce); - this.ipcHandlePath = ipcHandlePath; - - try { - this.server.listen(ipcHandlePath); - this.server.on('error', err => console.error(err)); - } catch (err) { - console.error('Could not launch git askpass helper.'); - this.enabled = false; - } - - return ipcHandlePath; + static getDisabledEnv(): AskpassEnvironment { + return { + GIT_ASKPASS: path.join(__dirname, 'askpass-empty.sh') + }; } - private onRequest(req: http.IncomingMessage, res: http.ServerResponse): void { - const chunks: string[] = []; - req.setEncoding('utf8'); - req.on('data', (d: string) => chunks.push(d)); - req.on('end', () => { - const { request, host } = JSON.parse(chunks.join('')); - - this.prompt(host, request).then(result => { - res.writeHead(200); - res.end(JSON.stringify(result)); - }, () => { - res.writeHead(500); - res.end(); - }); - }); + constructor(ipc: IIPCServer) { + this.disposable = ipc.registerHandler('askpass', this); } - private async prompt(host: string, request: string): Promise { + async handle({ request, host }: { request: string, host: string }): Promise { const options: InputBoxOptions = { password: /password/i.test(request), placeHolder: request, @@ -93,27 +41,16 @@ export class Askpass implements Disposable { return await window.showInputBox(options) || ''; } - async getEnv(): Promise { - if (!this.enabled) { - return { - GIT_ASKPASS: path.join(__dirname, 'askpass-empty.sh') - }; - } - + getEnv(): AskpassEnvironment { return { ELECTRON_RUN_AS_NODE: '1', GIT_ASKPASS: path.join(__dirname, 'askpass.sh'), VSCODE_GIT_ASKPASS_NODE: process.execPath, - VSCODE_GIT_ASKPASS_MAIN: path.join(__dirname, 'askpass-main.js'), - VSCODE_GIT_ASKPASS_HANDLE: await this.ipcHandlePathPromise + VSCODE_GIT_ASKPASS_MAIN: path.join(__dirname, 'askpass-main.js') }; } dispose(): void { - this.server.close(); - - if (this.ipcHandlePath && process.platform !== 'win32') { - fs.unlinkSync(this.ipcHandlePath); - } + this.disposable.dispose(); } -} \ No newline at end of file +} diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index e58f8c42292c4..2cd44bc0f058b 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -6,16 +6,18 @@ import { lstat, Stats } from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder } from 'vscode'; +import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env } from 'vscode'; import TelemetryReporter from 'vscode-extension-telemetry'; import * as nls from 'vscode-nls'; -import { Branch, GitErrorCodes, Ref, RefType, Status } from './api/git'; -import { CommitOptions, ForcePushMode, Git, Stash } from './git'; +import { Branch, GitErrorCodes, Ref, RefType, Status, CommitOptions } from './api/git'; +import { ForcePushMode, Git, Stash } from './git'; import { Model } from './model'; import { Repository, Resource, ResourceGroupType } from './repository'; import { applyLineChanges, getModifiedRange, intersectDiffWithRange, invertLineChange, toLineRanges } from './staging'; -import { fromGitUri, toGitUri } from './uri'; +import { fromGitUri, toGitUri, isGitUri } from './uri'; import { grep, isDescendant, pathEquals } from './util'; +import { Log, LogLevel } from './log'; +import { GitTimelineItem } from './timelineProvider'; const localize = nls.loadMessageBundle(); @@ -170,14 +172,14 @@ function command(commandId: string, options: CommandOptions = {}): Function { }; } -const ImageMimetypes = [ - 'image/png', - 'image/gif', - 'image/jpeg', - 'image/webp', - 'image/tiff', - 'image/bmp' -]; +// const ImageMimetypes = [ +// 'image/png', +// 'image/gif', +// 'image/jpeg', +// 'image/webp', +// 'image/tiff', +// 'image/bmp' +// ]; async function categorizeResourceByResolution(resources: Resource[]): Promise<{ merge: Resource[], resolved: Resource[], unresolved: Resource[], deletionConflicts: Resource[] }> { const selection = resources.filter(s => s instanceof Resource) as Resource[]; @@ -252,6 +254,36 @@ export class CommandCenter { }); } + @command('git.setLogLevel') + async setLogLevel(): Promise { + const createItem = (logLevel: LogLevel) => ({ + label: LogLevel[logLevel], + logLevel, + description: Log.logLevel === logLevel ? localize('current', "Current") : undefined + }); + + const items = [ + createItem(LogLevel.Trace), + createItem(LogLevel.Debug), + createItem(LogLevel.Info), + createItem(LogLevel.Warning), + createItem(LogLevel.Error), + createItem(LogLevel.Critical), + createItem(LogLevel.Off) + ]; + + const choice = await window.showQuickPick(items, { + placeHolder: localize('select log level', "Select log level") + }); + + if (!choice) { + return; + } + + Log.logLevel = choice.logLevel; + this.outputChannel.appendLine(localize('changed', "Log level changed to: {0}", LogLevel[Log.logLevel])); + } + @command('git.refresh', { repository: true }) async refresh(repository: Repository): Promise { await repository.status(); @@ -295,10 +327,10 @@ export class CommandCenter { } } else { if (resource.type !== Status.DELETED_BY_THEM) { - left = await this.getLeftResource(resource); + left = this.getLeftResource(resource); } - right = await this.getRightResource(resource); + right = this.getRightResource(resource); } const title = this.getTitle(resource); @@ -330,79 +362,40 @@ export class CommandCenter { } } - private async getURI(uri: Uri, ref: string): Promise { - const repository = this.model.getRepository(uri); - - if (!repository) { - return toGitUri(uri, ref); - } - - try { - let gitRef = ref; - - if (gitRef === '~') { - const uriString = uri.toString(); - const [indexStatus] = repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString); - gitRef = indexStatus ? '' : 'HEAD'; - } - - const { size, object } = await repository.getObjectDetails(gitRef, uri.fsPath); - const { mimetype } = await repository.detectObjectType(object); - - if (mimetype === 'text/plain') { - return toGitUri(uri, ref); - } - - if (size > 1000000) { // 1 MB - return Uri.parse(`data:;label:${path.basename(uri.fsPath)};description:${gitRef},`); - } - - if (ImageMimetypes.indexOf(mimetype) > -1) { - const contents = await repository.buffer(gitRef, uri.fsPath); - return Uri.parse(`data:${mimetype};label:${path.basename(uri.fsPath)};description:${gitRef};size:${size};base64,${contents.toString('base64')}`); - } - - return Uri.parse(`data:;label:${path.basename(uri.fsPath)};description:${gitRef},`); - - } catch (err) { - return toGitUri(uri, ref); - } - } - - private async getLeftResource(resource: Resource): Promise { + private getLeftResource(resource: Resource): Uri | undefined { switch (resource.type) { case Status.INDEX_MODIFIED: case Status.INDEX_RENAMED: case Status.INDEX_ADDED: - return this.getURI(resource.original, 'HEAD'); + return toGitUri(resource.original, 'HEAD'); case Status.MODIFIED: case Status.UNTRACKED: - return this.getURI(resource.resourceUri, '~'); + return toGitUri(resource.resourceUri, '~'); case Status.DELETED_BY_THEM: - return this.getURI(resource.resourceUri, ''); + return toGitUri(resource.resourceUri, ''); } return undefined; } - private async getRightResource(resource: Resource): Promise { + private getRightResource(resource: Resource): Uri | undefined { switch (resource.type) { case Status.INDEX_MODIFIED: case Status.INDEX_ADDED: case Status.INDEX_COPIED: case Status.INDEX_RENAMED: - return this.getURI(resource.resourceUri, ''); + return toGitUri(resource.resourceUri, ''); case Status.INDEX_DELETED: case Status.DELETED: - return this.getURI(resource.resourceUri, 'HEAD'); + return toGitUri(resource.resourceUri, 'HEAD'); case Status.DELETED_BY_US: - return this.getURI(resource.resourceUri, '~3'); + return toGitUri(resource.resourceUri, '~3'); case Status.DELETED_BY_THEM: - return this.getURI(resource.resourceUri, '~2'); + return toGitUri(resource.resourceUri, '~2'); case Status.MODIFIED: case Status.UNTRACKED: @@ -459,7 +452,7 @@ export class CommandCenter { } @command('git.clone') - async clone(url?: string): Promise { + async clone(url?: string, parentPath?: string): Promise { if (!url) { url = await window.showInputBox({ prompt: localize('repourl', "Repository URL"), @@ -479,30 +472,32 @@ export class CommandCenter { url = url.trim().replace(/^git\s+clone\s+/, ''); - const config = workspace.getConfiguration('git'); - let defaultCloneDirectory = config.get('defaultCloneDirectory') || os.homedir(); - defaultCloneDirectory = defaultCloneDirectory.replace(/^~/, os.homedir()); - - const uris = await window.showOpenDialog({ - canSelectFiles: false, - canSelectFolders: true, - canSelectMany: false, - defaultUri: Uri.file(defaultCloneDirectory), - openLabel: localize('selectFolder', "Select Repository Location") - }); + if (!parentPath) { + const config = workspace.getConfiguration('git'); + let defaultCloneDirectory = config.get('defaultCloneDirectory') || os.homedir(); + defaultCloneDirectory = defaultCloneDirectory.replace(/^~/, os.homedir()); - if (!uris || uris.length === 0) { - /* __GDPR__ - "clone" : { - "outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - this.telemetryReporter.sendTelemetryEvent('clone', { outcome: 'no_directory' }); - return; - } + const uris = await window.showOpenDialog({ + canSelectFiles: false, + canSelectFolders: true, + canSelectMany: false, + defaultUri: Uri.file(defaultCloneDirectory), + openLabel: localize('selectFolder', "Select Repository Location") + }); - const uri = uris[0]; - const parentPath = uri.fsPath; + if (!uris || uris.length === 0) { + /* __GDPR__ + "clone" : { + "outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + this.telemetryReporter.sendTelemetryEvent('clone', { outcome: 'no_directory' }); + return; + } + + const uri = uris[0]; + parentPath = uri.fsPath; + } try { const opts = { @@ -513,7 +508,7 @@ export class CommandCenter { const repositoryPath = await window.withProgress( opts, - (progress, token) => this.git.clone(url!, parentPath, progress, token) + (progress, token) => this.git.clone(url!, parentPath!, progress, token) ); let message = localize('proposeopen', "Would you like to open the cloned repository?"); @@ -571,24 +566,29 @@ export class CommandCenter { } @command('git.init') - async init(): Promise { + async init(skipFolderPrompt = false): Promise { let repositoryPath: string | undefined = undefined; let askToOpen = true; if (workspace.workspaceFolders) { - const placeHolder = localize('init', "Pick workspace folder to initialize git repo in"); - const pick = { label: localize('choose', "Choose Folder...") }; - const items: { label: string, folder?: WorkspaceFolder }[] = [ - ...workspace.workspaceFolders.map(folder => ({ label: folder.name, description: folder.uri.fsPath, folder })), - pick - ]; - const item = await window.showQuickPick(items, { placeHolder, ignoreFocusOut: true }); - - if (!item) { - return; - } else if (item.folder) { - repositoryPath = item.folder.uri.fsPath; + if (skipFolderPrompt && workspace.workspaceFolders.length === 1) { + repositoryPath = workspace.workspaceFolders[0].uri.fsPath; askToOpen = false; + } else { + const placeHolder = localize('init', "Pick workspace folder to initialize git repo in"); + const pick = { label: localize('choose', "Choose Folder...") }; + const items: { label: string, folder?: WorkspaceFolder }[] = [ + ...workspace.workspaceFolders.map(folder => ({ label: folder.name, description: folder.uri.fsPath, folder })), + pick + ]; + const item = await window.showQuickPick(items, { placeHolder, ignoreFocusOut: true }); + + if (!item) { + return; + } else if (item.folder) { + repositoryPath = item.folder.uri.fsPath; + askToOpen = false; + } } } @@ -692,7 +692,7 @@ export class CommandCenter { let uris: Uri[] | undefined; if (arg instanceof Uri) { - if (arg.scheme === 'git') { + if (isGitUri(arg)) { uris = [Uri.file(fromGitUri(arg).path)]; } else if (arg.scheme === 'file') { uris = [arg]; @@ -771,7 +771,7 @@ export class CommandCenter { return; } - const HEAD = await this.getLeftResource(resource); + const HEAD = this.getLeftResource(resource); const basename = path.basename(resource.resourceUri.fsPath); const title = `${basename} (HEAD)`; @@ -1117,7 +1117,7 @@ export class CommandCenter { const modifiedDocument = textEditor.document; const modifiedUri = modifiedDocument.uri; - if (modifiedUri.scheme !== 'git') { + if (!isGitUri(modifiedUri)) { return; } @@ -1329,6 +1329,9 @@ export class CommandCenter { } const enableSmartCommit = config.get('enableSmartCommit') === true; + const enableCommitSigning = config.get('enableCommitSigning') === true; + const noStagedChanges = repository.indexGroup.resourceStates.length === 0; + const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0; if (promptToSaveFilesBeforeCommit !== 'never') { let documents = workspace.textDocuments @@ -1349,17 +1352,13 @@ export class CommandCenter { if (pick === saveAndCommit) { await Promise.all(documents.map(d => d.save())); - await repository.add([]); + await repository.add(documents.map(d => d.uri)); } else if (pick !== commit) { return false; // do not commit on cancel } } } - const enableCommitSigning = config.get('enableCommitSigning') === true; - const noStagedChanges = repository.indexGroup.resourceStates.length === 0; - const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0; - // no changes, and the user has not configured to commit all in this case if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit) { const suggestSmartCommit = config.get('suggestSmartCommit') === true; @@ -1445,6 +1444,7 @@ export class CommandCenter { const message = repository.inputBox.value; const getCommitMessage = async () => { let _message: string | undefined = message; + if (!_message) { let value: string | undefined = undefined; @@ -1469,7 +1469,7 @@ export class CommandCenter { }); } - return _message ? repository.cleanUpCommitEditMessage(_message) : _message; + return _message; }; const didCommit = await this.smartCommit(repository, getCommitMessage, opts); @@ -1616,7 +1616,7 @@ export class CommandCenter { await this._branch(repository, undefined, true); } - private async promptForBranchName(defaultName?: string): Promise { + private async promptForBranchName(defaultName?: string, initialValue?: string): Promise { const config = workspace.getConfiguration('git'); const branchWhitespaceChar = config.get('branchWhitespaceChar')!; const branchValidationRegex = config.get('branchValidationRegex')!; @@ -1626,7 +1626,8 @@ export class CommandCenter { const rawBranchName = defaultName || await window.showInputBox({ placeHolder: localize('branch name', "Branch name"), - prompt: localize('provide branch name', "Please provide a branch name"), + prompt: localize('provide branch name', "Please provide a new branch name"), + value: initialValue, ignoreFocusOut: true, validateInput: (name: string) => { const validateName = new RegExp(branchValidationRegex); @@ -1704,7 +1705,8 @@ export class CommandCenter { @command('git.renameBranch', { repository: true }) async renameBranch(repository: Repository): Promise { - const branchName = await this.promptForBranchName(); + const currentBranchName = repository.HEAD && repository.HEAD.name; + const branchName = await this.promptForBranchName(undefined, currentBranchName); if (!branchName) { return; @@ -2162,9 +2164,14 @@ export class CommandCenter { return; } + const branchName = repository.HEAD && repository.HEAD.name || ''; + + if (remotes.length === 1) { + return await repository.pushTo(remotes[0].name, branchName, true); + } + const addRemote = new AddRemoteItem(this); const picks = [...repository.remotes.map(r => ({ label: r.name, description: r.pushUrl })), addRemote]; - const branchName = repository.HEAD && repository.HEAD.name || ''; const placeHolder = localize('pick remote', "Pick a remote to publish the branch '{0}' to:", branchName); const choice = await window.showQuickPick(picks, { placeHolder }); @@ -2330,6 +2337,47 @@ export class CommandCenter { return result && result.stash; } + @command('git.timeline.openDiff', { repository: false }) + async timelineOpenDiff(item: TimelineItem, uri: Uri | undefined, _source: string) { + // eslint-disable-next-line eqeqeq + if (uri == null || !GitTimelineItem.is(item)) { + return undefined; + } + + const basename = path.basename(uri.fsPath); + + let title; + if ((item.previousRef === 'HEAD' || item.previousRef === '~') && item.ref === '') { + title = `${basename} (Working Tree)`; + } + else if (item.previousRef === 'HEAD' && item.ref === '~') { + title = `${basename} (Index)`; + } else { + title = `${basename} (${item.shortPreviousRef}) \u27f7 ${basename} (${item.shortRef})`; + } + + return commands.executeCommand('vscode.diff', toGitUri(uri, item.previousRef), item.ref === '' ? uri : toGitUri(uri, item.ref), title); + } + + @command('git.timeline.copyCommitId', { repository: false }) + async timelineCopyCommitId(item: TimelineItem, _uri: Uri | undefined, _source: string) { + if (!GitTimelineItem.is(item)) { + return; + } + + env.clipboard.writeText(item.ref); + } + + @command('git.timeline.copyCommitMessage', { repository: false }) + async timelineCopyCommitMessage(item: TimelineItem, _uri: Uri | undefined, _source: string) { + if (!GitTimelineItem.is(item)) { + return; + } + + env.clipboard.writeText(item.message); + } + + private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any { const result = (...args: any[]) => { let result: Promise; @@ -2454,7 +2502,7 @@ export class CommandCenter { return undefined; } - if (uri.scheme === 'git') { + if (isGitUri(uri)) { const { path } = fromGitUri(uri); uri = Uri.file(path); } diff --git a/extensions/git/src/contentProvider.ts b/extensions/git/src/contentProvider.ts index 1b7c08493ed73..ad380e70ecf3c 100644 --- a/extensions/git/src/contentProvider.ts +++ b/extensions/git/src/contentProvider.ts @@ -147,4 +147,4 @@ export class GitContentProvider { dispose(): void { this.disposables.forEach(d => d.dispose()); } -} \ No newline at end of file +} diff --git a/extensions/git/src/fileSystemProvider.ts b/extensions/git/src/fileSystemProvider.ts new file mode 100644 index 0000000000000..1168906dc3000 --- /dev/null +++ b/extensions/git/src/fileSystemProvider.ts @@ -0,0 +1,212 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { workspace, Uri, Disposable, Event, EventEmitter, window, FileSystemProvider, FileChangeEvent, FileStat, FileType, FileChangeType, FileSystemError } from 'vscode'; +import { debounce, throttle } from './decorators'; +import { fromGitUri, toGitUri } from './uri'; +import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model'; +import { filterEvent, eventToPromise, isDescendant, pathEquals, EmptyDisposable } from './util'; +import { Repository } from './repository'; + +interface CacheRow { + uri: Uri; + timestamp: number; +} + +const THREE_MINUTES = 1000 * 60 * 3; +const FIVE_MINUTES = 1000 * 60 * 5; + +function sanitizeRef(ref: string, path: string, repository: Repository): string { + if (ref === '~') { + const fileUri = Uri.file(path); + const uriString = fileUri.toString(); + const [indexStatus] = repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString); + return indexStatus ? '' : 'HEAD'; + } + + if (/^~\d$/.test(ref)) { + return `:${ref[1]}`; + } + + return ref; +} + +export class GitFileSystemProvider implements FileSystemProvider { + + private _onDidChangeFile = new EventEmitter(); + readonly onDidChangeFile: Event = this._onDidChangeFile.event; + + private changedRepositoryRoots = new Set(); + private cache = new Map(); + private mtime = new Date().getTime(); + private disposables: Disposable[] = []; + + constructor(private model: Model) { + this.disposables.push( + model.onDidChangeRepository(this.onDidChangeRepository, this), + model.onDidChangeOriginalResource(this.onDidChangeOriginalResource, this), + workspace.registerFileSystemProvider('git', this, { isReadonly: true, isCaseSensitive: true }), + workspace.registerResourceLabelFormatter({ + scheme: 'git', + formatting: { + label: '${path} (git)', + separator: '/' + } + }) + ); + + setInterval(() => this.cleanup(), FIVE_MINUTES); + } + + private onDidChangeRepository({ repository }: ModelChangeEvent): void { + this.changedRepositoryRoots.add(repository.root); + this.eventuallyFireChangeEvents(); + } + + private onDidChangeOriginalResource({ uri }: OriginalResourceChangeEvent): void { + if (uri.scheme !== 'file') { + return; + } + + const gitUri = toGitUri(uri, '', { replaceFileExtension: true }); + this.mtime = new Date().getTime(); + this._onDidChangeFile.fire([{ type: FileChangeType.Changed, uri: gitUri }]); + } + + @debounce(1100) + private eventuallyFireChangeEvents(): void { + this.fireChangeEvents(); + } + + @throttle + private async fireChangeEvents(): Promise { + if (!window.state.focused) { + const onDidFocusWindow = filterEvent(window.onDidChangeWindowState, e => e.focused); + await eventToPromise(onDidFocusWindow); + } + + const events: FileChangeEvent[] = []; + + for (const { uri } of this.cache.values()) { + const fsPath = uri.fsPath; + + for (const root of this.changedRepositoryRoots) { + if (isDescendant(root, fsPath)) { + events.push({ type: FileChangeType.Changed, uri }); + break; + } + } + } + + if (events.length > 0) { + this.mtime = new Date().getTime(); + this._onDidChangeFile.fire(events); + } + + this.changedRepositoryRoots.clear(); + } + + private cleanup(): void { + const now = new Date().getTime(); + const cache = new Map(); + + for (const row of this.cache.values()) { + const { path } = fromGitUri(row.uri); + const isOpen = workspace.textDocuments + .filter(d => d.uri.scheme === 'file') + .some(d => pathEquals(d.uri.fsPath, path)); + + if (isOpen || now - row.timestamp < THREE_MINUTES) { + cache.set(row.uri.toString(), row); + } else { + // TODO: should fire delete events? + } + } + + this.cache = cache; + } + + watch(): Disposable { + return EmptyDisposable; + } + + async stat(uri: Uri): Promise { + const { submoduleOf, path, ref } = fromGitUri(uri); + const repository = submoduleOf ? this.model.getRepository(submoduleOf) : this.model.getRepository(uri); + if (!repository) { + throw FileSystemError.FileNotFound(); + } + + let size = 0; + try { + const details = await repository.getObjectDetails(sanitizeRef(ref, path, repository), path); + size = details.size; + } catch { + // noop + } + return { type: FileType.File, size: size, mtime: this.mtime, ctime: 0 }; + } + + readDirectory(): Thenable<[string, FileType][]> { + throw new Error('Method not implemented.'); + } + + createDirectory(): void { + throw new Error('Method not implemented.'); + } + + async readFile(uri: Uri): Promise { + const { path, ref, submoduleOf } = fromGitUri(uri); + + if (submoduleOf) { + const repository = this.model.getRepository(submoduleOf); + + if (!repository) { + throw FileSystemError.FileNotFound(); + } + + const encoder = new TextEncoder(); + + if (ref === 'index') { + return encoder.encode(await repository.diffIndexWithHEAD(path)); + } else { + return encoder.encode(await repository.diffWithHEAD(path)); + } + } + + const repository = this.model.getRepository(uri); + + if (!repository) { + throw FileSystemError.FileNotFound(); + } + + const timestamp = new Date().getTime(); + const cacheValue: CacheRow = { uri, timestamp }; + + this.cache.set(uri.toString(), cacheValue); + + try { + return await repository.buffer(sanitizeRef(ref, path, repository), path); + } catch (err) { + return new Uint8Array(0); + } + } + + writeFile(): void { + throw new Error('Method not implemented.'); + } + + delete(): void { + throw new Error('Method not implemented.'); + } + + rename(): void { + throw new Error('Method not implemented.'); + } + + dispose(): void { + this.disposables.forEach(d => d.dispose()); + } +} diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index a710a539c2917..89206132470ce 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs'; +import { promises as fs, exists } from 'fs'; import * as path from 'path'; import * as os from 'os'; import * as cp from 'child_process'; @@ -11,19 +11,17 @@ import * as which from 'which'; import { EventEmitter } from 'events'; import iconv = require('iconv-lite'); import * as filetype from 'file-type'; -import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util'; -import { CancellationToken, Progress } from 'vscode'; +import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util'; +import { CancellationToken, Progress, Uri } from 'vscode'; import { URI } from 'vscode-uri'; import { detectEncoding } from './encoding'; -import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git'; +import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status, CommitOptions } from './api/git'; import * as byline from 'byline'; import { StringDecoder } from 'string_decoder'; // https://github.com/microsoft/vscode/issues/65693 const MAX_CLI_LENGTH = 30000; -const readfile = denodeify(fs.readFile); - export interface IGit { path: string; version: string; @@ -47,6 +45,15 @@ interface MutableRemote extends Remote { isReadOnly: boolean; } +// TODO[ECA]: Move to git.d.ts once we are good with the api +/** + * Log file options. + */ +export interface LogFileOptions { + /** Max number of log entries to retrieve. If not specified, the default is 32. */ + readonly maxEntries?: number; +} + function parseVersion(raw: string): string { return raw.replace(/^git version /, ''); } @@ -320,7 +327,13 @@ function getGitErrorCode(stderr: string): string | undefined { return undefined; } -const COMMIT_FORMAT = '%H\n%ae\n%P\n%B'; +// https://github.com/microsoft/vscode/issues/89373 +// https://github.com/git-for-windows/git/issues/2478 +function sanitizePath(path: string): string { + return path.replace(/^([a-z]):\\/i, (_, letter) => `${letter.toUpperCase()}:\\`); +} + +const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%B'; export class Git { @@ -350,7 +363,7 @@ export class Git { let folderPath = path.join(parentPath, folderName); let count = 1; - while (count < 20 && await new Promise(c => fs.exists(folderPath, c))) { + while (count < 20 && await new Promise(c => exists(folderPath, c))) { folderName = `${baseFolderName}-${count++}`; folderPath = path.join(parentPath, folderName); } @@ -489,6 +502,10 @@ export class Git { LANG: 'en_US.UTF-8' }); + if (options.cwd) { + options.cwd = sanitizePath(options.cwd); + } + if (options.log !== false) { this.log(`> git ${args.join(' ')}\n`); } @@ -505,7 +522,10 @@ export interface Commit { hash: string; message: string; parents: string[]; - authorEmail?: string | undefined; + authorDate?: Date; + authorName?: string; + authorEmail?: string; + commitDate?: Date; } export class GitStatusParser { @@ -636,14 +656,45 @@ export function parseGitmodules(raw: string): Submodule[] { return result; } -export function parseGitCommit(raw: string): Commit | null { - const match = /^([0-9a-f]{40})\n(.*)\n(.*)(\n([^]*))?$/m.exec(raw.trim()); - if (!match) { - return null; - } +const commitRegex = /([0-9a-f]{40})\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)(?:\n([^]*?))?(?:\x00)/gm; + +export function parseGitCommits(data: string): Commit[] { + let commits: Commit[] = []; + + let ref; + let authorName; + let authorEmail; + let authorDate; + let commitDate; + let parents; + let message; + let match; - const parents = match[3] ? match[3].split(' ') : []; - return { hash: match[1], message: match[5], parents, authorEmail: match[2] }; + do { + match = commitRegex.exec(data); + if (match === null) { + break; + } + + [, ref, authorName, authorEmail, authorDate, commitDate, parents, message] = match; + + if (message[message.length - 1] === '\n') { + message = message.substr(0, message.length - 1); + } + + // Stop excessive memory usage by using substr -- https://bugs.chromium.org/p/v8/issues/detail?id=2869 + commits.push({ + hash: ` ${ref}`.substr(1), + message: ` ${message}`.substr(1), + parents: parents ? parents.split(' ') : [], + authorDate: new Date(Number(authorDate) * 1000), + authorName: ` ${authorName}`.substr(1), + authorEmail: ` ${authorEmail}`.substr(1), + commitDate: new Date(Number(commitDate) * 1000), + }); + } while (true); + + return commits; } interface LsTreeElement { @@ -677,14 +728,6 @@ export function parseLsFiles(raw: string): LsFilesElement[] { .map(([, mode, object, stage, file]) => ({ mode, object, stage, file })); } -export interface CommitOptions { - all?: boolean | 'tracked'; - amend?: boolean; - signoff?: boolean; - signCommit?: boolean; - empty?: boolean; -} - export interface PullOptions { unshallow?: boolean; tags?: boolean; @@ -761,38 +804,29 @@ export class Repository { } async log(options?: LogOptions): Promise { - const maxEntries = options && typeof options.maxEntries === 'number' && options.maxEntries > 0 ? options.maxEntries : 32; - const args = ['log', '-' + maxEntries, `--pretty=format:${COMMIT_FORMAT}%x00%x00`]; - const gitResult = await this.run(args); - if (gitResult.exitCode) { - // An empty repo. + const maxEntries = options?.maxEntries ?? 32; + const args = ['log', `-n${maxEntries}`, `--format=${COMMIT_FORMAT}`, '-z', '--']; + + const result = await this.run(args); + if (result.exitCode) { + // An empty repo return []; } - const s = gitResult.stdout; - const result: Commit[] = []; - let index = 0; - while (index < s.length) { - let nextIndex = s.indexOf('\x00\x00', index); - if (nextIndex === -1) { - nextIndex = s.length; - } - - let entry = s.substr(index, nextIndex - index); - if (entry.startsWith('\n')) { - entry = entry.substring(1); - } + return parseGitCommits(result.stdout); + } - const commit = parseGitCommit(entry); - if (!commit) { - break; - } + async logFile(uri: Uri, options?: LogFileOptions): Promise { + const maxEntries = options?.maxEntries ?? 32; + const args = ['log', `-n${maxEntries}`, `--format=${COMMIT_FORMAT}`, '-z', '--', uri.fsPath]; - result.push(commit); - index = nextIndex + 2; + const result = await this.run(args); + if (result.exitCode) { + // No file history, e.g. a new file or untracked + return []; } - return result; + return parseGitCommits(result.stdout); } async bufferString(object: string, encoding: string = 'utf8', autoGuessEncoding = false): Promise { @@ -858,12 +892,12 @@ export class Repository { } async lstree(treeish: string, path: string): Promise { - const { stdout } = await this.run(['ls-tree', '-l', treeish, '--', path]); + const { stdout } = await this.run(['ls-tree', '-l', treeish, '--', sanitizePath(path)]); return parseLsTree(stdout); } async lsfiles(path: string): Promise { - const { stdout } = await this.run(['ls-files', '--stage', '--', path]); + const { stdout } = await this.run(['ls-files', '--stage', '--', sanitizePath(path)]); return parseLsFiles(stdout); } @@ -957,7 +991,7 @@ export class Repository { return await this.diffFiles(false); } - const args = ['diff', '--', path]; + const args = ['diff', '--', sanitizePath(path)]; const result = await this.run(args); return result.stdout; } @@ -970,7 +1004,7 @@ export class Repository { return await this.diffFiles(false, ref); } - const args = ['diff', ref, '--', path]; + const args = ['diff', ref, '--', sanitizePath(path)]; const result = await this.run(args); return result.stdout; } @@ -983,7 +1017,7 @@ export class Repository { return await this.diffFiles(true); } - const args = ['diff', '--cached', '--', path]; + const args = ['diff', '--cached', '--', sanitizePath(path)]; const result = await this.run(args); return result.stdout; } @@ -996,7 +1030,7 @@ export class Repository { return await this.diffFiles(true, ref); } - const args = ['diff', '--cached', ref, '--', path]; + const args = ['diff', '--cached', ref, '--', sanitizePath(path)]; const result = await this.run(args); return result.stdout; } @@ -1016,7 +1050,7 @@ export class Repository { return await this.diffFiles(false, range); } - const args = ['diff', range, '--', path]; + const args = ['diff', range, '--', sanitizePath(path)]; const result = await this.run(args); return result.stdout.trim(); @@ -1129,7 +1163,7 @@ export class Repository { args.push('--'); if (paths && paths.length) { - args.push.apply(args, paths); + args.push.apply(args, paths.map(sanitizePath)); } else { args.push('.'); } @@ -1144,13 +1178,13 @@ export class Repository { return; } - args.push(...paths); + args.push(...paths.map(sanitizePath)); await this.run(args); } async stage(path: string, data: string): Promise { - const child = this.stream(['hash-object', '--stdin', '-w', '--path', path], { stdio: [null, null, null] }); + const child = this.stream(['hash-object', '--stdin', '-w', '--path', sanitizePath(path)], { stdio: [null, null, null] }); child.stdin!.end(data, 'utf8'); const { exitCode, stdout } = await exec(child); @@ -1163,11 +1197,12 @@ export class Repository { }); } + const treeish = await this.getCommit('HEAD').then(() => 'HEAD', () => ''); let mode: string; let add: string = ''; try { - const details = await this.getObjectDetails('HEAD', path); + const details = await this.getObjectDetails(treeish, path); mode = details.mode; } catch (err) { if (err.gitErrorCode !== GitErrorCodes.UnknownPath) { @@ -1194,7 +1229,7 @@ export class Repository { try { if (paths && paths.length > 0) { - for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { + for (const chunk of splitInChunks(paths.map(sanitizePath), MAX_CLI_LENGTH)) { await this.run([...args, '--', ...chunk]); } } else { @@ -1333,7 +1368,7 @@ export class Repository { } async clean(paths: string[]): Promise { - const pathsByGroup = groupBy(paths, p => path.dirname(p)); + const pathsByGroup = groupBy(paths.map(sanitizePath), p => path.dirname(p)); const groups = Object.keys(pathsByGroup).map(k => pathsByGroup[k]); const limiter = new Limiter(5); @@ -1379,7 +1414,7 @@ export class Repository { } if (paths && paths.length) { - args.push.apply(args, paths); + args.push.apply(args, paths.map(sanitizePath)); } else { args.push('.'); } @@ -1530,11 +1565,8 @@ export class Repository { async blame(path: string): Promise { try { - const args = ['blame']; - args.push(path); - - let result = await this.run(args); - + const args = ['blame', sanitizePath(path)]; + const result = await this.run(args); return result.stdout.trim(); } catch (err) { if (/^fatal: no such path/.test(err.stderr || '')) { @@ -1812,26 +1844,17 @@ export class Repository { } } - cleanupCommitEditMessage(message: string): string { - // If the message is a single line starting with whitespace followed by `#`, just allow it. - if (/^\s*#[^\n]*$/.test(message)) { - return message; - } - - // Else, remove all lines starting with whitespace followed by `#`. - // TODO: Support core.commentChar - return message.replace(/^(\s*#)(.*)$(\n?)/gm, (_, prefix, content, suffix) => { - // https://github.com/microsoft/vscode/issues/84201#issuecomment-552834814 - return /^\d/.test(content) ? `${prefix}${content}${suffix}` : ''; - }).trim(); + // TODO: Support core.commentChar + stripCommitMessageComments(message: string): string { + return message.replace(/^\s*#.*$\n?/gm, '').trim(); } async getMergeMessage(): Promise { const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG'); try { - const raw = await readfile(mergeMsgPath, 'utf8'); - return raw.trim(); + const raw = await fs.readFile(mergeMsgPath, 'utf8'); + return this.stripCommitMessageComments(raw); } catch { return undefined; } @@ -1854,23 +1877,26 @@ export class Repository { templatePath = path.join(this.repositoryRoot, templatePath); } - const raw = await readfile(templatePath, 'utf8'); - return raw.trim(); - + const raw = await fs.readFile(templatePath, 'utf8'); + return this.stripCommitMessageComments(raw); } catch (err) { return ''; } } async getCommit(ref: string): Promise { - const result = await this.run(['show', '-s', `--format=${COMMIT_FORMAT}`, ref]); - return parseGitCommit(result.stdout) || Promise.reject('bad commit format'); + const result = await this.run(['show', '-s', `--format=${COMMIT_FORMAT}`, '-z', ref]); + const commits = parseGitCommits(result.stdout); + if (commits.length === 0) { + return Promise.reject('bad commit format'); + } + return commits[0]; } async updateSubmodules(paths: string[]): Promise { const args = ['submodule', 'update', '--']; - for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { + for (const chunk of splitInChunks(paths.map(sanitizePath), MAX_CLI_LENGTH)) { await this.run([...args, ...chunk]); } } @@ -1879,7 +1905,7 @@ export class Repository { const gitmodulesPath = path.join(this.root, '.gitmodules'); try { - const gitmodulesRaw = await readfile(gitmodulesPath, 'utf8'); + const gitmodulesRaw = await fs.readFile(gitmodulesPath, 'utf8'); return parseGitmodules(gitmodulesRaw); } catch (err) { if (/ENOENT/.test(err.message)) { diff --git a/extensions/git/src/ipc/ipcClient.ts b/extensions/git/src/ipc/ipcClient.ts new file mode 100644 index 0000000000000..f623b3f7b6f60 --- /dev/null +++ b/extensions/git/src/ipc/ipcClient.ts @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as http from 'http'; + +export class IPCClient { + + private ipcHandlePath: string; + + constructor(private handlerName: string) { + const ipcHandlePath = process.env['VSCODE_GIT_IPC_HANDLE']; + + if (!ipcHandlePath) { + throw new Error('Missing VSCODE_GIT_IPC_HANDLE'); + } + + this.ipcHandlePath = ipcHandlePath; + } + + call(request: any): Promise { + const opts: http.RequestOptions = { + socketPath: this.ipcHandlePath, + path: `/${this.handlerName}`, + method: 'POST' + }; + + return new Promise((c, e) => { + const req = http.request(opts, res => { + if (res.statusCode !== 200) { + return e(new Error(`Bad status code: ${res.statusCode}`)); + } + + const chunks: Buffer[] = []; + res.on('data', d => chunks.push(d)); + res.on('end', () => c(JSON.parse(Buffer.concat(chunks).toString('utf8')))); + }); + + req.on('error', err => e(err)); + req.write(JSON.stringify(request)); + req.end(); + }); + } +} diff --git a/extensions/git/src/ipc/ipcServer.ts b/extensions/git/src/ipc/ipcServer.ts new file mode 100644 index 0000000000000..332490896cc89 --- /dev/null +++ b/extensions/git/src/ipc/ipcServer.ts @@ -0,0 +1,106 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Disposable } from 'vscode'; +import { toDisposable } from '../util'; +import * as path from 'path'; +import * as http from 'http'; +import * as os from 'os'; +import * as fs from 'fs'; +import * as crypto from 'crypto'; + +function getIPCHandlePath(nonce: string): string { + if (process.platform === 'win32') { + return `\\\\.\\pipe\\vscode-git-ipc-${nonce}-sock`; + } + + if (process.env['XDG_RUNTIME_DIR']) { + return path.join(process.env['XDG_RUNTIME_DIR'] as string, `vscode-git-ipc-${nonce}.sock`); + } + + return path.join(os.tmpdir(), `vscode-git-ipc-${nonce}.sock`); +} + +export interface IIPCHandler { + handle(request: any): Promise; +} + +export async function createIPCServer(): Promise { + const server = http.createServer(); + const buffer = await new Promise((c, e) => crypto.randomBytes(20, (err, buf) => err ? e(err) : c(buf))); + const nonce = buffer.toString('hex'); + const ipcHandlePath = getIPCHandlePath(nonce); + + return new Promise((c, e) => { + try { + server.on('error', err => e(err)); + server.listen(ipcHandlePath); + c(new IPCServer(server, ipcHandlePath)); + } catch (err) { + e(err); + } + }); +} + +export interface IIPCServer extends Disposable { + readonly ipcHandlePath: string | undefined; + getEnv(): any; + registerHandler(name: string, handler: IIPCHandler): Disposable; +} + +class IPCServer implements IIPCServer, Disposable { + + private handlers = new Map(); + get ipcHandlePath(): string { return this._ipcHandlePath; } + + constructor(private server: http.Server, private _ipcHandlePath: string) { + this.server.on('request', this.onRequest.bind(this)); + } + + registerHandler(name: string, handler: IIPCHandler): Disposable { + this.handlers.set(`/${name}`, handler); + return toDisposable(() => this.handlers.delete(name)); + } + + private onRequest(req: http.IncomingMessage, res: http.ServerResponse): void { + if (!req.url) { + console.warn(`Request lacks url`); + return; + } + + const handler = this.handlers.get(req.url); + + if (!handler) { + console.warn(`IPC handler for ${req.url} not found`); + return; + } + + const chunks: Buffer[] = []; + req.on('data', d => chunks.push(d)); + req.on('end', () => { + const request = JSON.parse(Buffer.concat(chunks).toString('utf8')); + handler.handle(request).then(result => { + res.writeHead(200); + res.end(JSON.stringify(result)); + }, () => { + res.writeHead(500); + res.end(); + }); + }); + } + + getEnv(): any { + return { VSCODE_GIT_IPC_HANDLE: this.ipcHandlePath }; + } + + dispose(): void { + this.handlers.clear(); + this.server.close(); + + if (this._ipcHandlePath && process.platform !== 'win32') { + fs.unlinkSync(this._ipcHandlePath); + } + } +} diff --git a/extensions/git/src/log.ts b/extensions/git/src/log.ts new file mode 100644 index 0000000000000..487228e57a755 --- /dev/null +++ b/extensions/git/src/log.ts @@ -0,0 +1,50 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Event, EventEmitter } from 'vscode'; + +/** + * The severity level of a log message + */ +export enum LogLevel { + Trace = 1, + Debug = 2, + Info = 3, + Warning = 4, + Error = 5, + Critical = 6, + Off = 7 +} + +let _logLevel: LogLevel = LogLevel.Info; +const _onDidChangeLogLevel = new EventEmitter(); + +export const Log = { + /** + * Current logging level. + */ + get logLevel(): LogLevel { + return _logLevel; + }, + + /** + * Current logging level. + */ + set logLevel(logLevel: LogLevel) { + if (_logLevel === logLevel) { + return; + } + + _logLevel = logLevel; + _onDidChangeLogLevel.fire(logLevel); + }, + + /** + * An [event](#Event) that fires when the log level has changed. + */ + get onDidChangeLogLevel(): Event { + return _onDidChangeLogLevel.event; + } +}; diff --git a/extensions/git/src/main.ts b/extensions/git/src/main.ts index 52b7c3c106a65..ddf16d76aacbf 100644 --- a/extensions/git/src/main.ts +++ b/extensions/git/src/main.ts @@ -11,6 +11,7 @@ import { findGit, Git, IGit } from './git'; import { Model } from './model'; import { CommandCenter } from './commands'; import { GitContentProvider } from './contentProvider'; +import { GitFileSystemProvider } from './fileSystemProvider'; import { GitDecorations } from './decorationProvider'; import { Askpass } from './askpass'; import { toDisposable, filterEvent, eventToPromise } from './util'; @@ -20,6 +21,8 @@ import { GitProtocolHandler } from './protocolHandler'; import { GitExtensionImpl } from './api/extension'; import * as path from 'path'; import * as fs from 'fs'; +import { createIPCServer, IIPCServer } from './ipc/ipcServer'; +import { GitTimelineProvider } from './timelineProvider'; const deactivateTasks: { (): Promise; }[] = []; @@ -32,10 +35,26 @@ export async function deactivate(): Promise { async function createModel(context: ExtensionContext, outputChannel: OutputChannel, telemetryReporter: TelemetryReporter, disposables: Disposable[]): Promise { const pathHint = workspace.getConfiguration('git').get('path'); const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path))); - const askpass = new Askpass(); - disposables.push(askpass); - const env = await askpass.getEnv(); + let env: any = {}; + let ipc: IIPCServer | undefined; + + try { + ipc = await createIPCServer(); + disposables.push(ipc); + env = { ...env, ...ipc.getEnv() }; + } catch { + // noop + } + + if (ipc) { + const askpass = new Askpass(ipc); + disposables.push(askpass); + env = { ...env, ...askpass.getEnv() }; + } else { + env = { ...env, ...Askpass.getDisabledEnv() }; + } + const git = new Git({ gitPath: info.path, version: info.version, env }); const model = new Model(git, context.globalState, outputChannel); disposables.push(model); @@ -62,8 +81,10 @@ async function createModel(context: ExtensionContext, outputChannel: OutputChann disposables.push( new CommandCenter(git, model, outputChannel, telemetryReporter), new GitContentProvider(model), + new GitFileSystemProvider(model), new GitDecorations(model), - new GitProtocolHandler() + new GitProtocolHandler(), + new GitTimelineProvider(model) ); await checkGitVersion(info); @@ -154,6 +175,7 @@ export async function activate(context: ExtensionContext): Promise console.warn(err.message); outputChannel.appendLine(err.message); + commands.executeCommand('setContext', 'git.missing', true); warnAboutMissingGit(); return new GitExtensionImpl(); diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index da6f150efa486..bb66423510386 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -6,7 +6,7 @@ import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, OutputChannel } from 'vscode'; import { Repository, RepositoryState } from './repository'; import { memoize, sequentialize, debounce } from './decorators'; -import { dispose, anyEvent, filterEvent, isDescendant, firstIndex } from './util'; +import { dispose, anyEvent, filterEvent, isDescendant, firstIndex, pathEquals } from './util'; import { Git } from './git'; import * as path from 'path'; import * as fs from 'fs'; @@ -240,10 +240,7 @@ export class Model { return; } - const config = workspace.getConfiguration('git'); - const ignoredRepos = new Set(config.get>('ignoredRepositories')); - - if (ignoredRepos.has(rawRoot)) { + if (this.shouldRepositoryBeIgnored(rawRoot)) { return; } @@ -261,6 +258,27 @@ export class Model { } } + private shouldRepositoryBeIgnored(repositoryRoot: string): boolean { + const config = workspace.getConfiguration('git'); + const ignoredRepos = config.get('ignoredRepositories') || []; + + for (const ignoredRepo of ignoredRepos) { + if (path.isAbsolute(ignoredRepo)) { + if (pathEquals(ignoredRepo, repositoryRoot)) { + return true; + } + } else { + for (const folder of workspace.workspaceFolders || []) { + if (pathEquals(path.join(folder.uri.fsPath, ignoredRepo), repositoryRoot)) { + return true; + } + } + } + } + + return false; + } + private open(repository: Repository): void { this.outputChannel.appendLine(`Open repository: ${repository.root}`); diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 5f3c9bee46452..4f22b0784bbba 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -5,16 +5,17 @@ import * as fs from 'fs'; import * as path from 'path'; -import { CancellationToken, Command, Disposable, env, Event, EventEmitter, LogLevel, Memento, OutputChannel, ProgressLocation, ProgressOptions, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, ThemeColor, Uri, window, workspace, WorkspaceEdit, Decoration } from 'vscode'; +import { CancellationToken, Command, Disposable, Event, EventEmitter, Memento, OutputChannel, ProgressLocation, ProgressOptions, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, ThemeColor, Uri, window, workspace, WorkspaceEdit, Decoration } from 'vscode'; import * as nls from 'vscode-nls'; -import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status } from './api/git'; +import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status, CommitOptions } from './api/git'; import { AutoFetcher } from './autofetch'; import { debounce, memoize, throttle } from './decorators'; -import { Commit, CommitOptions, ForcePushMode, GitError, Repository as BaseRepository, Stash, Submodule } from './git'; +import { Commit, ForcePushMode, GitError, Repository as BaseRepository, Stash, Submodule, LogFileOptions } from './git'; import { StatusBarCommands } from './statusbar'; import { toGitUri } from './uri'; import { anyEvent, combinedDisposable, debounceEvent, dispose, EmptyDisposable, eventToPromise, filterEvent, find, IDisposable, isDescendant, onceEvent } from './util'; import { IFileWatcher, watch } from './watch'; +import { Log, LogLevel } from './log'; const timeout = (millis: number) => new Promise(c => setTimeout(c, millis)); @@ -303,15 +304,22 @@ export const enum Operation { Apply = 'Apply', Blame = 'Blame', Log = 'Log', + LogFile = 'LogFile', } function isReadOnly(operation: Operation): boolean { switch (operation) { - case Operation.Show: - case Operation.GetCommitTemplate: + case Operation.Blame: case Operation.CheckIgnore: + case Operation.Diff: + case Operation.FindTrackingBranches: + case Operation.GetBranch: + case Operation.GetCommitTemplate: case Operation.GetObjectDetails: + case Operation.Log: + case Operation.LogFile: case Operation.MergeBase: + case Operation.Show: return true; default: return false; @@ -457,8 +465,8 @@ class FileEventLogger { private onDotGitFileChange: Event, private outputChannel: OutputChannel ) { - this.logLevelDisposable = env.onDidChangeLogLevel(this.onDidChangeLogLevel, this); - this.onDidChangeLogLevel(env.logLevel); + this.logLevelDisposable = Log.onDidChangeLogLevel(this.onDidChangeLogLevel, this); + this.onDidChangeLogLevel(Log.logLevel); } private onDidChangeLogLevel(level: LogLevel): void { @@ -519,7 +527,7 @@ class DotGitWatcher implements IFileWatcher { this.transientDisposables.push(upstreamWatcher); upstreamWatcher.event(this.emitter.fire, this.emitter, this.transientDisposables); } catch (err) { - if (env.logLevel <= LogLevel.Error) { + if (Log.logLevel <= LogLevel.Error) { this.outputChannel.appendLine(`Failed to watch ref '${upstreamPath}', is most likely packed.\n${err.stack || err}`); } } @@ -682,7 +690,7 @@ export class Repository implements Disposable { onDotGitFileChange = dotGitFileWatcher.event; this.disposables.push(dotGitFileWatcher); } catch (err) { - if (env.logLevel <= LogLevel.Error) { + if (Log.logLevel <= LogLevel.Error) { outputChannel.appendLine(`Failed to watch '${this.dotGit}', reverting to legacy API file watched. Some events might be lost.\n${err.stack || err}`); } @@ -844,15 +852,7 @@ export class Repository implements Disposable { return mergeMessage; } - let template = await this.repository.getCommitTemplate(); - - const config = workspace.getConfiguration('git', Uri.file(this.root)); - - if (!config.get('restoreCommitTemplateComments')) { - template = this.cleanUpCommitEditMessage(template); - } - - return template; + return await this.repository.getCommitTemplate(); } getConfigs(): Promise<{ key: string; value: string; }[]> { @@ -875,6 +875,11 @@ export class Repository implements Disposable { return this.run(Operation.Log, () => this.repository.log(options)); } + logFile(uri: Uri, options?: LogFileOptions): Promise { + // TODO: This probably needs per-uri granularity + return this.run(Operation.LogFile, () => this.repository.logFile(uri, options)); + } + @throttle async status(): Promise { await this.run(Operation.Status); @@ -1286,10 +1291,6 @@ export class Repository implements Disposable { return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate()); } - cleanUpCommitEditMessage(editMessage: string): string { - return this.repository.cleanupCommitEditMessage(editMessage); - } - async ignore(files: Uri[]): Promise { return await this.run(Operation.Ignore, async () => { const ignoreFile = `${this.repository.root}${path.sep}.gitignore`; @@ -1733,7 +1734,7 @@ export class Repository implements Disposable { if (branchName) { // '{0}' will be replaced by the corresponding key-command later in the process, which is why it needs to stay. - this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", "{0}", branchName); + this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", '{0}', branchName); } else { this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message ({0} to commit)"); } diff --git a/extensions/git/src/test/git.test.ts b/extensions/git/src/test/git.test.ts index a860c82352ad5..8be262d3c25c8 100644 --- a/extensions/git/src/test/git.test.ts +++ b/extensions/git/src/test/git.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import 'mocha'; -import { GitStatusParser, parseGitCommit, parseGitmodules, parseLsTree, parseLsFiles } from '../git'; +import { GitStatusParser, parseGitCommits, parseGitmodules, parseLsTree, parseLsFiles } from '../git'; import * as assert from 'assert'; import { splitInChunks } from '../util'; @@ -189,44 +189,62 @@ suite('git', () => { suite('parseGitCommit', () => { test('single parent commit', function () { const GIT_OUTPUT_SINGLE_PARENT = `52c293a05038d865604c2284aa8698bd087915a1 +John Doe john.doe@mail.com +1580811030 +1580811031 8e5a374372b8393906c7e380dbb09349c5385554 -This is a commit message.`; +This is a commit message.\x00`; - assert.deepEqual(parseGitCommit(GIT_OUTPUT_SINGLE_PARENT), { + assert.deepEqual(parseGitCommits(GIT_OUTPUT_SINGLE_PARENT), [{ hash: '52c293a05038d865604c2284aa8698bd087915a1', message: 'This is a commit message.', parents: ['8e5a374372b8393906c7e380dbb09349c5385554'], + authorDate: new Date(1580811030000), + authorName: 'John Doe', authorEmail: 'john.doe@mail.com', - }); + commitDate: new Date(1580811031000), + }]); }); test('multiple parent commits', function () { const GIT_OUTPUT_MULTIPLE_PARENTS = `52c293a05038d865604c2284aa8698bd087915a1 +John Doe john.doe@mail.com +1580811030 +1580811031 8e5a374372b8393906c7e380dbb09349c5385554 df27d8c75b129ab9b178b386077da2822101b217 -This is a commit message.`; +This is a commit message.\x00`; - assert.deepEqual(parseGitCommit(GIT_OUTPUT_MULTIPLE_PARENTS), { + assert.deepEqual(parseGitCommits(GIT_OUTPUT_MULTIPLE_PARENTS), [{ hash: '52c293a05038d865604c2284aa8698bd087915a1', message: 'This is a commit message.', parents: ['8e5a374372b8393906c7e380dbb09349c5385554', 'df27d8c75b129ab9b178b386077da2822101b217'], + authorDate: new Date(1580811030000), + authorName: 'John Doe', authorEmail: 'john.doe@mail.com', - }); + commitDate: new Date(1580811031000), + }]); }); test('no parent commits', function () { const GIT_OUTPUT_NO_PARENTS = `52c293a05038d865604c2284aa8698bd087915a1 +John Doe john.doe@mail.com +1580811030 +1580811031 -This is a commit message.`; +This is a commit message.\x00`; - assert.deepEqual(parseGitCommit(GIT_OUTPUT_NO_PARENTS), { + assert.deepEqual(parseGitCommits(GIT_OUTPUT_NO_PARENTS), [{ hash: '52c293a05038d865604c2284aa8698bd087915a1', message: 'This is a commit message.', parents: [], + authorDate: new Date(1580811030000), + authorName: 'John Doe', authorEmail: 'john.doe@mail.com', - }); + commitDate: new Date(1580811031000), + }]); }); }); diff --git a/extensions/git/src/test/index.ts b/extensions/git/src/test/index.ts new file mode 100644 index 0000000000000..747c4562e8a60 --- /dev/null +++ b/extensions/git/src/test/index.ts @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const path = require('path'); +const testRunner = require('vscode/lib/testrunner'); + +const suite = 'Integration Git Tests'; + +const options: any = { + ui: 'tdd', + useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), + timeout: 60000 +}; + +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { + options.reporter = 'mocha-multi-reporters'; + options.reporterOptions = { + reporterEnabled: 'spec, mocha-junit-reporter', + mochaJunitReporterReporterOptions: { + testsuitesTitle: `${suite} ${process.platform}`, + mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + } + }; +} + +testRunner.configure(options); + +export = testRunner; diff --git a/extensions/git/src/test/smoke.test.ts b/extensions/git/src/test/smoke.test.ts new file mode 100644 index 0000000000000..9e0933776a3b2 --- /dev/null +++ b/extensions/git/src/test/smoke.test.ts @@ -0,0 +1,127 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import 'mocha'; +import * as assert from 'assert'; +import { workspace, commands, window, Uri, WorkspaceEdit, Range, TextDocument, extensions } from 'vscode'; +import * as cp from 'child_process'; +import * as fs from 'fs'; +import * as path from 'path'; +import { GitExtension, API, Repository, Status } from '../api/git'; +import { eventToPromise } from '../util'; + +suite('git smoke test', function () { + const cwd = fs.realpathSync(workspace.workspaceFolders![0].uri.fsPath); + + function file(relativePath: string) { + return path.join(cwd, relativePath); + } + + function uri(relativePath: string) { + return Uri.file(file(relativePath)); + } + + async function open(relativePath: string) { + const doc = await workspace.openTextDocument(uri(relativePath)); + await window.showTextDocument(doc); + return doc; + } + + async function type(doc: TextDocument, text: string) { + const edit = new WorkspaceEdit(); + const end = doc.lineAt(doc.lineCount - 1).range.end; + edit.replace(doc.uri, new Range(end, end), text); + await workspace.applyEdit(edit); + } + + let git: API; + let repository: Repository; + + suiteSetup(async function () { + fs.writeFileSync(file('app.js'), 'hello', 'utf8'); + fs.writeFileSync(file('index.pug'), 'hello', 'utf8'); + cp.execSync('git init', { cwd }); + cp.execSync('git config user.name testuser', { cwd }); + cp.execSync('git config user.email monacotools@microsoft.com', { cwd }); + cp.execSync('git add .', { cwd }); + cp.execSync('git commit -m "initial commit"', { cwd }); + + // make sure git is activated + const ext = extensions.getExtension('vscode.git'); + await ext?.activate(); + git = ext!.exports.getAPI(1); + + if (git.repositories.length === 0) { + await eventToPromise(git.onDidOpenRepository); + } + + assert.equal(git.repositories.length, 1); + assert.equal(fs.realpathSync(git.repositories[0].rootUri.fsPath), cwd); + + repository = git.repositories[0]; + }); + + test('reflects working tree changes', async function () { + await commands.executeCommand('workbench.view.scm'); + + const appjs = await open('app.js'); + await type(appjs, ' world'); + await appjs.save(); + await repository.status(); + assert.equal(repository.state.workingTreeChanges.length, 1); + repository.state.workingTreeChanges.some(r => r.uri.path === appjs.uri.path && r.status === Status.MODIFIED); + + fs.writeFileSync(file('newfile.txt'), ''); + const newfile = await open('newfile.txt'); + await type(newfile, 'hey there'); + await newfile.save(); + await repository.status(); + assert.equal(repository.state.workingTreeChanges.length, 2); + repository.state.workingTreeChanges.some(r => r.uri.path === appjs.uri.path && r.status === Status.MODIFIED); + repository.state.workingTreeChanges.some(r => r.uri.path === newfile.uri.path && r.status === Status.UNTRACKED); + }); + + test('opens diff editor', async function () { + const appjs = uri('app.js'); + await commands.executeCommand('git.openChange', appjs); + + assert(window.activeTextEditor); + assert.equal(window.activeTextEditor!.document.uri.path, appjs.path); + + // TODO: how do we really know this is a diff editor? + }); + + test('stages correctly', async function () { + const appjs = uri('app.js'); + const newfile = uri('newfile.txt'); + + await commands.executeCommand('git.stage', appjs); + assert.equal(repository.state.workingTreeChanges.length, 1); + repository.state.workingTreeChanges.some(r => r.uri.path === newfile.path && r.status === Status.UNTRACKED); + assert.equal(repository.state.indexChanges.length, 1); + repository.state.indexChanges.some(r => r.uri.path === appjs.path && r.status === Status.INDEX_MODIFIED); + + await commands.executeCommand('git.unstage', appjs); + assert.equal(repository.state.workingTreeChanges.length, 2); + repository.state.workingTreeChanges.some(r => r.uri.path === appjs.path && r.status === Status.MODIFIED); + repository.state.workingTreeChanges.some(r => r.uri.path === newfile.path && r.status === Status.UNTRACKED); + }); + + test('stages, commits changes and verifies outgoing change', async function () { + const appjs = uri('app.js'); + const newfile = uri('newfile.txt'); + + await commands.executeCommand('git.stage', appjs); + await repository.commit('second commit'); + assert.equal(repository.state.workingTreeChanges.length, 1); + repository.state.workingTreeChanges.some(r => r.uri.path === newfile.path && r.status === Status.UNTRACKED); + assert.equal(repository.state.indexChanges.length, 0); + + await commands.executeCommand('git.stageAll', appjs); + await repository.commit('third commit'); + assert.equal(repository.state.workingTreeChanges.length, 0); + assert.equal(repository.state.indexChanges.length, 0); + }); +}); diff --git a/extensions/git/src/timelineProvider.ts b/extensions/git/src/timelineProvider.ts new file mode 100644 index 0000000000000..9db3495aec73d --- /dev/null +++ b/extensions/git/src/timelineProvider.ts @@ -0,0 +1,246 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as dayjs from 'dayjs'; +import * as advancedFormat from 'dayjs/plugin/advancedFormat'; +import { CancellationToken, Disposable, Event, EventEmitter, ThemeIcon, Timeline, TimelineChangeEvent, TimelineCursor, TimelineItem, TimelineProvider, Uri, workspace } from 'vscode'; +import { Model } from './model'; +import { Repository } from './repository'; +import { debounce } from './decorators'; +import { Status } from './api/git'; + +dayjs.extend(advancedFormat); + +// TODO[ECA]: Localize all the strings +// TODO[ECA]: Localize or use a setting for date format + +export class GitTimelineItem extends TimelineItem { + static is(item: TimelineItem): item is GitTimelineItem { + return item instanceof GitTimelineItem; + } + + readonly ref: string; + readonly previousRef: string; + readonly message: string; + + constructor( + ref: string, + previousRef: string, + message: string, + timestamp: number, + id: string, + contextValue: string + ) { + const index = message.indexOf('\n'); + const label = index !== -1 ? `${message.substring(0, index)} \u2026` : message; + + super(label, timestamp); + + this.ref = ref; + this.previousRef = previousRef; + this.message = message; + this.id = id; + this.contextValue = contextValue; + } + + get shortRef() { + return this.shortenRef(this.ref); + } + + get shortPreviousRef() { + return this.shortenRef(this.previousRef); + } + + private shortenRef(ref: string): string { + if (ref === '' || ref === '~' || ref === 'HEAD') { + return ref; + } + return ref.endsWith('^') ? `${ref.substr(0, 8)}^` : ref.substr(0, 8); + } +} + +export class GitTimelineProvider implements TimelineProvider { + private _onDidChange = new EventEmitter(); + get onDidChange(): Event { + return this._onDidChange.event; + } + + readonly id = 'git-history'; + readonly label = 'Git History'; + + private _disposable: Disposable; + + private _repo: Repository | undefined; + private _repoDisposable: Disposable | undefined; + private _repoStatusDate: Date | undefined; + + constructor(private readonly _model: Model) { + this._disposable = Disposable.from( + _model.onDidOpenRepository(this.onRepositoriesChanged, this), + workspace.registerTimelineProvider('*', this), + ); + } + + dispose() { + this._disposable.dispose(); + } + + async provideTimeline(uri: Uri, _cursor: TimelineCursor, _token: CancellationToken): Promise { + // console.log(`GitTimelineProvider.provideTimeline: uri=${uri} state=${this._model.state}`); + + const repo = this._model.getRepository(uri); + if (!repo) { + this._repoDisposable?.dispose(); + this._repoStatusDate = undefined; + this._repo = undefined; + + return { items: [] }; + } + + if (this._repo?.root !== repo.root) { + this._repoDisposable?.dispose(); + + this._repo = repo; + this._repoStatusDate = new Date(); + this._repoDisposable = Disposable.from( + repo.onDidChangeRepository(uri => this.onRepositoryChanged(repo, uri)), + repo.onDidRunGitStatus(() => this.onRepositoryStatusChanged(repo)) + ); + } + + // TODO[ECA]: Ensure that the uri is a file -- if not we could get the history of the repo? + + const commits = await repo.logFile(uri); + + let dateFormatter: dayjs.Dayjs; + const items = commits.map(c => { + dateFormatter = dayjs(c.authorDate); + + const item = new GitTimelineItem(c.hash, `${c.hash}^`, c.message, c.authorDate?.getTime() ?? 0, c.hash, 'git:file:commit'); + item.iconPath = new (ThemeIcon as any)('git-commit'); + item.description = c.authorName; + item.detail = `${c.authorName} (${c.authorEmail}) \u2014 ${c.hash.substr(0, 8)}\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n\n${c.message}`; + item.command = { + title: 'Open Comparison', + command: 'git.timeline.openDiff', + arguments: [uri, this.id, item] + }; + + return item; + }); + + const index = repo.indexGroup.resourceStates.find(r => r.resourceUri.fsPath === uri.fsPath); + if (index) { + const date = this._repoStatusDate ?? new Date(); + dateFormatter = dayjs(date); + + let status; + switch (index.type) { + case Status.INDEX_MODIFIED: + status = 'Modified'; + break; + case Status.INDEX_ADDED: + status = 'Added'; + break; + case Status.INDEX_DELETED: + status = 'Deleted'; + break; + case Status.INDEX_RENAMED: + status = 'Renamed'; + break; + case Status.INDEX_COPIED: + status = 'Copied'; + break; + default: + status = ''; + break; + } + + const item = new GitTimelineItem('~', 'HEAD', 'Staged Changes', date.getTime(), 'index', 'git:file:index'); + // TODO[ECA]: Replace with a better icon -- reflecting its status maybe? + item.iconPath = new (ThemeIcon as any)('git-commit'); + item.description = 'You'; + item.detail = `You \u2014 Index\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`; + item.command = { + title: 'Open Comparison', + command: 'git.timeline.openDiff', + arguments: [uri, this.id, item] + }; + + items.push(item); + } + + + const working = repo.workingTreeGroup.resourceStates.find(r => r.resourceUri.fsPath === uri.fsPath); + if (working) { + const date = new Date(); + dateFormatter = dayjs(date); + + let status; + switch (working.type) { + case Status.INDEX_MODIFIED: + status = 'Modified'; + break; + case Status.INDEX_ADDED: + status = 'Added'; + break; + case Status.INDEX_DELETED: + status = 'Deleted'; + break; + case Status.INDEX_RENAMED: + status = 'Renamed'; + break; + case Status.INDEX_COPIED: + status = 'Copied'; + break; + default: + status = ''; + break; + } + + const item = new GitTimelineItem('', index ? '~' : 'HEAD', 'Uncommited Changes', date.getTime(), 'working', 'git:file:working'); + // TODO[ECA]: Replace with a better icon -- reflecting its status maybe? + item.iconPath = new (ThemeIcon as any)('git-commit'); + item.description = 'You'; + item.detail = `You \u2014 Working Tree\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`; + item.command = { + title: 'Open Comparison', + command: 'git.timeline.openDiff', + arguments: [uri, this.id, item] + }; + + items.push(item); + } + + return { items: items }; + } + + private onRepositoriesChanged(_repo: Repository) { + // console.log(`GitTimelineProvider.onRepositoriesChanged`); + + // TODO[ECA]: Being naive for now and just always refreshing each time there is a new repository + this.fireChanged(); + } + + private onRepositoryChanged(_repo: Repository, _uri: Uri) { + // console.log(`GitTimelineProvider.onRepositoryChanged: uri=${uri.toString(true)}`); + + this.fireChanged(); + } + + private onRepositoryStatusChanged(_repo: Repository) { + // console.log(`GitTimelineProvider.onRepositoryStatusChanged`); + + // This is crappy, but for now just save the last time a status was run and use that as the timestamp for staged items + this._repoStatusDate = new Date(); + + this.fireChanged(); + } + + @debounce(500) + private fireChanged() { + this._onDidChange.fire({}); + } +} diff --git a/extensions/git/src/typings/refs.d.ts b/extensions/git/src/typings/refs.d.ts index 12e1d618942de..312efe5a30f5b 100644 --- a/extensions/git/src/typings/refs.d.ts +++ b/extensions/git/src/typings/refs.d.ts @@ -4,4 +4,5 @@ *--------------------------------------------------------------------------------------------*/ /// -/// \ No newline at end of file +/// +/// diff --git a/extensions/git/src/uri.ts b/extensions/git/src/uri.ts index 2eb21adfd6f32..94e6b5e38aeeb 100644 --- a/extensions/git/src/uri.ts +++ b/extensions/git/src/uri.ts @@ -11,6 +11,10 @@ export interface GitUriParams { submoduleOf?: string; } +export function isGitUri(uri: Uri): boolean { + return /^git$/.test(uri.scheme); +} + export function fromGitUri(uri: Uri): GitUriParams { return JSON.parse(uri.query); } @@ -46,4 +50,4 @@ export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Ur path, query: JSON.stringify(params) }); -} \ No newline at end of file +} diff --git a/extensions/git/src/util.ts b/extensions/git/src/util.ts index 0722cb16fbd70..74b353f518a4c 100644 --- a/extensions/git/src/util.ts +++ b/extensions/git/src/util.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Event } from 'vscode'; +import { Event, Disposable } from 'vscode'; import { dirname, sep } from 'path'; import { Readable } from 'stream'; -import * as fs from 'fs'; +import { promises as fs, createReadStream } from 'fs'; import * as byline from 'byline'; export function log(...args: any[]): void { @@ -33,15 +33,15 @@ export function combinedDisposable(disposables: IDisposable[]): IDisposable { export const EmptyDisposable = toDisposable(() => null); export function fireEvent(event: Event): Event { - return (listener, thisArgs = null, disposables?) => event(_ => (listener as any).call(thisArgs), null, disposables); + return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => event(_ => (listener as any).call(thisArgs), null, disposables); } export function mapEvent(event: Event, map: (i: I) => O): Event { - return (listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables); + return (listener: (e: O) => any, thisArgs?: any, disposables?: Disposable[]) => event(i => listener.call(thisArgs, map(i)), null, disposables); } export function filterEvent(event: Event, filter: (e: T) => boolean): Event { - return (listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables); + return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables); } export function latchEvent(event: Event): Event { @@ -57,7 +57,7 @@ export function latchEvent(event: Event): Event { } export function anyEvent(...events: Event[]): Event { - return (listener, thisArgs = null, disposables?) => { + return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => { const result = combinedDisposable(events.map(event => event(i => listener.call(thisArgs, i)))); if (disposables) { @@ -73,7 +73,7 @@ export function done(promise: Promise): Promise { } export function onceEvent(event: Event): Event { - return (listener, thisArgs = null, disposables?) => { + return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => { const result = event(e => { result.dispose(); return listener.call(thisArgs, e); @@ -84,7 +84,7 @@ export function onceEvent(event: Event): Event { } export function debounceEvent(event: Event, delay: number): Event { - return (listener, thisArgs = null, disposables?) => { + return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => { let timer: NodeJS.Timer; return event(e => { clearTimeout(timer); @@ -140,25 +140,14 @@ export function groupBy(arr: T[], fn: (el: T) => string): { [key: string]: T[ }, Object.create(null)); } -export function denodeify(fn: Function): (a: A, b: B, c: C) => Promise; -export function denodeify(fn: Function): (a: A, b: B) => Promise; -export function denodeify(fn: Function): (a: A) => Promise; -export function denodeify(fn: Function): (...args: any[]) => Promise; -export function denodeify(fn: Function): (...args: any[]) => Promise { - return (...args) => new Promise((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r))); -} - -export function nfcall(fn: Function, ...args: any[]): Promise { - return new Promise((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r))); -} export async function mkdirp(path: string, mode?: number): Promise { const mkdir = async () => { try { - await nfcall(fs.mkdir, path, mode); + await fs.mkdir(path, mode); } catch (err) { if (err.code === 'EEXIST') { - const stat = await nfcall(fs.stat, path); + const stat = await fs.stat(path); if (stat.isDirectory()) { return; @@ -232,7 +221,7 @@ export function find(array: T[], fn: (t: T) => boolean): T | undefined { export async function grep(filename: string, pattern: RegExp): Promise { return new Promise((c, e) => { - const fileStream = fs.createReadStream(filename, { encoding: 'utf8' }); + const fileStream = createReadStream(filename, { encoding: 'utf8' }); const stream = byline(fileStream); stream.on('data', (line: string) => { if (pattern.test(line)) { diff --git a/extensions/git/test/colorize-results/COMMIT_EDITMSG.json b/extensions/git/test/colorize-results/COMMIT_EDITMSG.json index 508e3ee199c98..0cb3e0690bea0 100644 --- a/extensions/git/test/colorize-results/COMMIT_EDITMSG.json +++ b/extensions/git/test/colorize-results/COMMIT_EDITMSG.json @@ -235,9 +235,9 @@ "t": "text.git-commit meta.scope.metadata.git-commit comment.line.number-sign.git-commit markup.inserted.git-commit", "r": { "dark_plus": "markup.inserted: #B5CEA8", - "light_plus": "markup.inserted: #09885A", + "light_plus": "markup.inserted: #098658", "dark_vs": "markup.inserted: #B5CEA8", - "light_vs": "markup.inserted: #09885A", + "light_vs": "markup.inserted: #098658", "hc_black": "markup.inserted: #B5CEA8" } }, @@ -252,4 +252,4 @@ "hc_black": "comment: #7CA668" } } -] \ No newline at end of file +] diff --git a/extensions/git/test/colorize-results/example_diff.json b/extensions/git/test/colorize-results/example_diff.json index 07ec9f737b5ed..85e08b9f13573 100644 --- a/extensions/git/test/colorize-results/example_diff.json +++ b/extensions/git/test/colorize-results/example_diff.json @@ -147,9 +147,9 @@ "t": "source.diff markup.inserted.diff punctuation.definition.inserted.diff", "r": { "dark_plus": "markup.inserted: #B5CEA8", - "light_plus": "markup.inserted: #09885A", + "light_plus": "markup.inserted: #098658", "dark_vs": "markup.inserted: #B5CEA8", - "light_vs": "markup.inserted: #09885A", + "light_vs": "markup.inserted: #098658", "hc_black": "markup.inserted: #B5CEA8" } }, @@ -158,10 +158,10 @@ "t": "source.diff markup.inserted.diff", "r": { "dark_plus": "markup.inserted: #B5CEA8", - "light_plus": "markup.inserted: #09885A", + "light_plus": "markup.inserted: #098658", "dark_vs": "markup.inserted: #B5CEA8", - "light_vs": "markup.inserted: #09885A", + "light_vs": "markup.inserted: #098658", "hc_black": "markup.inserted: #B5CEA8" } } -] \ No newline at end of file +] diff --git a/extensions/git/test/colorize-results/git-rebase-todo.json b/extensions/git/test/colorize-results/git-rebase-todo.json index d21bab1709443..38d82882964e2 100644 --- a/extensions/git/test/colorize-results/git-rebase-todo.json +++ b/extensions/git/test/colorize-results/git-rebase-todo.json @@ -26,9 +26,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -81,9 +81,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -136,9 +136,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -191,9 +191,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -246,9 +246,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -301,9 +301,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -356,9 +356,9 @@ "t": "text.git-rebase meta.commit-command.git-rebase constant.sha.git-rebase", "r": { "dark_plus": "constant.sha.git-rebase: #B5CEA8", - "light_plus": "constant.sha.git-rebase: #09885A", + "light_plus": "constant.sha.git-rebase: #098658", "dark_vs": "constant.sha.git-rebase: #B5CEA8", - "light_vs": "constant.sha.git-rebase: #09885A", + "light_vs": "constant.sha.git-rebase: #098658", "hc_black": "constant.sha.git-rebase: #B5CEA8" } }, @@ -538,4 +538,4 @@ "hc_black": "comment: #7CA668" } } -] \ No newline at end of file +] diff --git a/extensions/git/yarn.lock b/extensions/git/yarn.lock index 58a82bbe41c81..ac135e43a804a 100644 --- a/extensions/git/yarn.lock +++ b/extensions/git/yarn.lock @@ -36,6 +36,28 @@ resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6" integrity sha1-AW44dim4gXvtZT/jLqtdESecjfY= +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + +ajv@^6.5.5: + version "6.11.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.11.0.tgz#c3607cbc8ae392d8a5a536f25b21f8e5f3f87fe9" + integrity sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + applicationinsights@1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-1.0.8.tgz#db6e3d983cf9f9405fe1ee5ba30ac6e1914537b5" @@ -45,11 +67,45 @@ applicationinsights@1.0.8: diagnostic-channel-publishers "0.2.1" zone.js "0.7.6" +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e" + integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug== + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + brace-expansion@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" @@ -63,11 +119,43 @@ browser-stdout@1.3.0: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE= +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +charenc@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== + commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" @@ -80,6 +168,28 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +crypt@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +dayjs@1.8.19: + version "1.8.19" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.19.tgz#5117dc390d8f8e586d53891dbff3fa308f51abfe" + integrity sha512-7kqOoj3oQSmqbvtvGFLU5iYqies+SqUiEGNT0UtUPPxcPYgY1BrkXR0Cq2R9HYSimBXN+xHkEN4Hi399W+Ovlg== + debug@2.6.8: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" @@ -87,6 +197,32 @@ debug@2.6.8: dependencies: ms "2.0.0" +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + diagnostic-channel-publishers@0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.2.1.tgz#8e2d607a8b6d79fe880b548bc58cc6beb288c4f3" @@ -104,21 +240,92 @@ diff@3.2.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" integrity sha1-yc45Okt8vQsFinJck98pkCeGj/k= +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= + dependencies: + es6-promise "^4.0.3" + escape-string-regexp@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" + integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + file-type@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-7.2.0.tgz#113cfed52e1d6959ab80248906e2f25a8cdccb74" integrity sha1-ETz+1S4daVmrgCSJBuLyWozcy3Q= +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + glob@7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" @@ -131,26 +338,98 @@ glob@7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" +glob@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.1.2: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" integrity sha1-TK+tdrxi8C+gObL5Tpo906ORpyU= +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + growl@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" integrity sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8= +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo= +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= +http-proxy-agent@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== + dependencies: + agent-base "4" + debug "3.1.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +https-proxy-agent@^2.2.1: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -171,21 +450,66 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +is-buffer@~1.1.1: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + jschardet@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-2.1.1.tgz#af6f8fd0b3b0f5d46a8fd9614a4fce490575c184" integrity sha512-pA5qG9Zwm8CBpGlK/lo2GE9jPxwqRgMV7Lzc/1iaPccw6v4Rhj8Zg2BTyrdmHmxlJojnbLupLeRnaPLsq03x6Q== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + json3@3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" integrity sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE= +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -242,7 +566,33 @@ lodash.keys@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" -minimatch@^3.0.2: +lodash@^4.16.4: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +md5@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" + integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk= + dependencies: + charenc "~0.0.1" + crypt "~0.0.1" + is-buffer "~1.1.1" + +mime-db@1.43.0: + version "1.43.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" + integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.26" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06" + integrity sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ== + dependencies: + mime-db "1.43.0" + +minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -254,13 +604,32 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -mkdirp@0.5.1: +mkdirp@0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" +mocha-junit-reporter@^1.23.3: + version "1.23.3" + resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.3.tgz#941e219dd759ed732f8641e165918aa8b167c981" + integrity sha512-ed8LqbRj1RxZfjt/oC9t12sfrWsjZ3gNnbhV1nuj9R/Jb5/P3Xb4duv2eCfCDMYH+fEu0mqca7m4wsiVjsxsvA== + dependencies: + debug "^2.2.0" + md5 "^2.1.0" + mkdirp "~0.5.1" + strip-ansi "^4.0.0" + xml "^1.0.0" + +mocha-multi-reporters@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz#cc7f3f4d32f478520941d852abb64d9988587d82" + integrity sha1-zH8/TTL0eFIJQdhSq7ZNmYhYfYI= + dependencies: + debug "^3.1.0" + lodash "^4.16.4" + mocha@^3.2.0: version "3.5.3" resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d" @@ -279,11 +648,38 @@ mocha@^3.2.0: mkdirp "0.5.1" supports-color "3.1.2" +mocha@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" + integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ== + dependencies: + browser-stdout "1.3.1" + commander "2.15.1" + debug "3.1.0" + diff "3.5.0" + escape-string-regexp "1.0.5" + glob "7.1.2" + growl "1.10.5" + he "1.1.1" + minimatch "3.0.4" + mkdirp "0.5.1" + supports-color "5.4.0" + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -296,7 +692,68 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -"safer-buffer@>= 2.1.2 < 3": +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +psl@^1.1.28: + version "1.7.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.7.0.tgz#f1c4c47a8ef97167dea5d6bbf4816d736e884a3c" + integrity sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ== + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +querystringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== + +request@^2.88.0: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -306,6 +763,46 @@ semver@^5.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== +semver@^5.4.1: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +source-map-support@^0.5.0: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" @@ -313,6 +810,62 @@ supports-color@3.1.2: dependencies: has-flag "^1.0.0" +supports-color@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== + dependencies: + has-flag "^3.0.0" + +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +url-parse@^1.4.4: + version "1.4.7" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" + integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + vscode-extension-telemetry@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.1.tgz#91387e06b33400c57abd48979b0e790415ae110b" @@ -325,11 +878,32 @@ vscode-nls@^4.0.0: resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== +vscode-test@^0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/vscode-test/-/vscode-test-0.4.3.tgz#461ebf25fc4bc93d77d982aed556658a2e2b90b8" + integrity sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w== + dependencies: + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.1" + vscode-uri@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.0.0.tgz#2df704222f72b8a71ff266ba0830ed6c51ac1542" integrity sha512-lWXWofDSYD8r/TIyu64MdwB4FaSirQ608PP/TzUyslyOeHGwQ0eTHUZeJrK1ILOmwUHaJtV693m2JoUYroUDpw== +vscode@^1.1.36: + version "1.1.36" + resolved "https://registry.yarnpkg.com/vscode/-/vscode-1.1.36.tgz#5e1a0d1bf4977d0c7bc5159a9a13d5b104d4b1b6" + integrity sha512-cGFh9jmGLcTapCpPCKvn8aG/j9zVQ+0x5hzYJq5h5YyUXVGa1iamOaB2M2PZXoumQPES4qeAP1FwkI0b6tL4bQ== + dependencies: + glob "^7.1.2" + mocha "^5.2.0" + request "^2.88.0" + semver "^5.4.1" + source-map-support "^0.5.0" + url-parse "^1.4.4" + vscode-test "^0.4.1" + which@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" @@ -342,6 +916,11 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= +xml@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + zone.js@0.7.6: version "0.7.6" resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.6.tgz#fbbc39d3e0261d0986f1ba06306eb3aeb0d22009" diff --git a/extensions/github-authentication/.gitignore b/extensions/github-authentication/.gitignore new file mode 100644 index 0000000000000..eab338cd46327 --- /dev/null +++ b/extensions/github-authentication/.gitignore @@ -0,0 +1 @@ +src/common/config.json diff --git a/extensions/github-authentication/README.md b/extensions/github-authentication/README.md new file mode 100644 index 0000000000000..755e50209617e --- /dev/null +++ b/extensions/github-authentication/README.md @@ -0,0 +1,7 @@ +# GitHub Authentication for Visual Studio Code + +**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled. + +## Features + +This extension provides support for authenticating to GitHub. diff --git a/extensions/github-authentication/extension.webpack.config.js b/extensions/github-authentication/extension.webpack.config.js new file mode 100644 index 0000000000000..a513ac5c3b511 --- /dev/null +++ b/extensions/github-authentication/extension.webpack.config.js @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); + +module.exports = withDefaults({ + context: __dirname, + entry: { + extension: './src/extension.ts', + }, + externals: { + 'keytar': 'commonjs keytar' + } +}); diff --git a/extensions/github-authentication/package.json b/extensions/github-authentication/package.json new file mode 100644 index 0000000000000..8060b63f2f588 --- /dev/null +++ b/extensions/github-authentication/package.json @@ -0,0 +1,32 @@ +{ + "name": "github-authentication", + "displayName": "%displayName%", + "description": "%description%", + "publisher": "vscode", + "version": "0.0.1", + "engines": { + "vscode": "^1.41.0" + }, + "enableProposedApi": true, + "categories": [ + "Other" + ], + "activationEvents": [ + "*" + ], + "main": "./out/extension.js", + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "gulp compile-extension:github-authentication", + "watch": "gulp watch-extension:github-authentication" + }, + "dependencies": { + "uuid": "^3.3.3" + }, + "devDependencies": { + "@types/keytar": "^4.4.2", + "@types/node": "^10.12.21", + "@types/uuid": "^3.4.6", + "typescript": "^3.7.5" + } +} diff --git a/extensions/github-authentication/package.nls.json b/extensions/github-authentication/package.nls.json new file mode 100644 index 0000000000000..592a413b9a505 --- /dev/null +++ b/extensions/github-authentication/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "GitHub Authentication", + "description": "GitHub Authentication Provider" +} diff --git a/extensions/github-authentication/src/common/clientRegistrar.ts b/extensions/github-authentication/src/common/clientRegistrar.ts new file mode 100644 index 0000000000000..b4de0b8138ae1 --- /dev/null +++ b/extensions/github-authentication/src/common/clientRegistrar.ts @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export interface ClientDetails { + id?: string; + secret?: string; +} + +export interface ClientConfig { + OSS: ClientDetails; + INSIDERS: ClientDetails; +} + +export class Registrar { + private _config: ClientConfig; + + constructor() { + try { + this._config = require('./config.json') as ClientConfig; + } catch (e) { + this._config = { + OSS: {}, + INSIDERS: {} + }; + } + } + getClientDetails(product: string): ClientDetails { + let details: ClientDetails | undefined; + switch (product) { + case 'code-oss': + details = this._config.OSS; + break; + + case 'vscode-insiders': + details = this._config.INSIDERS; + break; + + default: + throw new Error(`Unrecognized product ${product}`); + } + + if (!details.id || !details.secret) { + throw new Error(`No client configuration available for ${product}`); + } + + return details; + } +} + +const ClientRegistrar = new Registrar(); +export default ClientRegistrar; diff --git a/extensions/github-authentication/src/common/keychain.ts b/extensions/github-authentication/src/common/keychain.ts new file mode 100644 index 0000000000000..c687febb442f0 --- /dev/null +++ b/extensions/github-authentication/src/common/keychain.ts @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// keytar depends on a native module shipped in vscode, so this is +// how we load it +import * as keytarType from 'keytar'; +import { env } from 'vscode'; +import Logger from './logger'; + +function getKeytar(): Keytar | undefined { + try { + return require('keytar'); + } catch (err) { + console.log(err); + } + + return undefined; +} + +export type Keytar = { + getPassword: typeof keytarType['getPassword']; + setPassword: typeof keytarType['setPassword']; + deletePassword: typeof keytarType['deletePassword']; +}; + +const SERVICE_ID = `${env.uriScheme}-github.login`; +const ACCOUNT_ID = 'account'; + +export class Keychain { + private keytar: Keytar; + + constructor() { + const keytar = getKeytar(); + if (!keytar) { + throw new Error('System keychain unavailable'); + } + + this.keytar = keytar; + } + + async setToken(token: string): Promise { + try { + return await this.keytar.setPassword(SERVICE_ID, ACCOUNT_ID, token); + } catch (e) { + // Ignore + Logger.error(`Setting token failed: ${e}`); + } + } + + async getToken(): Promise { + try { + return await this.keytar.getPassword(SERVICE_ID, ACCOUNT_ID); + } catch (e) { + // Ignore + Logger.error(`Getting token failed: ${e}`); + return Promise.resolve(undefined); + } + } + + async deleteToken(): Promise { + try { + return await this.keytar.deletePassword(SERVICE_ID, ACCOUNT_ID); + } catch (e) { + // Ignore + Logger.error(`Deleting token failed: ${e}`); + return Promise.resolve(undefined); + } + } +} + +export const keychain = new Keychain(); diff --git a/extensions/github-authentication/src/common/logger.ts b/extensions/github-authentication/src/common/logger.ts new file mode 100644 index 0000000000000..90b3be8c97cf2 --- /dev/null +++ b/extensions/github-authentication/src/common/logger.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; + +type LogLevel = 'Trace' | 'Info' | 'Error'; + +class Log { + private output: vscode.OutputChannel; + + constructor() { + this.output = vscode.window.createOutputChannel('GitHub Authentication'); + } + + private data2String(data: any): string { + if (data instanceof Error) { + return data.stack || data.message; + } + if (data.success === false && data.message) { + return data.message; + } + return data.toString(); + } + + public info(message: string, data?: any): void { + this.logLevel('Info', message, data); + } + + public error(message: string, data?: any): void { + this.logLevel('Error', message, data); + } + + public logLevel(level: LogLevel, message: string, data?: any): void { + this.output.appendLine(`[${level} - ${this.now()}] ${message}`); + if (data) { + this.output.appendLine(this.data2String(data)); + } + } + + private now(): string { + const now = new Date(); + return padLeft(now.getUTCHours() + '', 2, '0') + + ':' + padLeft(now.getMinutes() + '', 2, '0') + + ':' + padLeft(now.getUTCSeconds() + '', 2, '0') + '.' + now.getMilliseconds(); + } +} + +function padLeft(s: string, n: number, pad = ' ') { + return pad.repeat(Math.max(0, n - s.length)) + s; +} + +const Logger = new Log(); +export default Logger; diff --git a/extensions/github-authentication/src/common/utils.ts b/extensions/github-authentication/src/common/utils.ts new file mode 100644 index 0000000000000..6b18a9221db9d --- /dev/null +++ b/extensions/github-authentication/src/common/utils.ts @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Event, Disposable } from 'vscode'; + +export function filterEvent(event: Event, filter: (e: T) => boolean): Event { + return (listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables); +} + +export function onceEvent(event: Event): Event { + return (listener, thisArgs = null, disposables?) => { + const result = event(e => { + result.dispose(); + return listener.call(thisArgs, e); + }, null, disposables); + + return result; + }; +} + + +export interface PromiseAdapter { + ( + value: T, + resolve: + (value?: U | PromiseLike) => void, + reject: + (reason: any) => void + ): any; +} + +const passthrough = (value: any, resolve: (value?: any) => void) => resolve(value); + +/** + * Return a promise that resolves with the next emitted event, or with some future + * event as decided by an adapter. + * + * If specified, the adapter is a function that will be called with + * `(event, resolve, reject)`. It will be called once per event until it resolves or + * rejects. + * + * The default adapter is the passthrough function `(value, resolve) => resolve(value)`. + * + * @param event the event + * @param adapter controls resolution of the returned promise + * @returns a promise that resolves or rejects as specified by the adapter + */ +export async function promiseFromEvent( + event: Event, + adapter: PromiseAdapter = passthrough): Promise { + let subscription: Disposable; + return new Promise((resolve, reject) => + subscription = event((value: T) => { + try { + Promise.resolve(adapter(value, resolve, reject)) + .catch(reject); + } catch (error) { + reject(error); + } + }) + ).then( + (result: U) => { + subscription.dispose(); + return result; + }, + error => { + subscription.dispose(); + throw error; + } + ); +} diff --git a/extensions/github-authentication/src/extension.ts b/extensions/github-authentication/src/extension.ts new file mode 100644 index 0000000000000..943db6f20b5f7 --- /dev/null +++ b/extensions/github-authentication/src/extension.ts @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { GitHubAuthenticationProvider, onDidChangeSessions } from './github'; +import { uriHandler } from './githubServer'; +import Logger from './common/logger'; + +export async function activate(context: vscode.ExtensionContext) { + + context.subscriptions.push(vscode.window.registerUriHandler(uriHandler)); + const loginService = new GitHubAuthenticationProvider(); + + await loginService.initialize(); + + vscode.authentication.registerAuthenticationProvider({ + id: 'GitHub', + displayName: 'GitHub', + onDidChangeSessions: onDidChangeSessions.event, + getSessions: () => Promise.resolve(loginService.sessions), + login: async (scopes: string[]) => { + try { + const session = await loginService.login(scopes.join(' ')); + Logger.info('Login success!'); + return session; + } catch (e) { + vscode.window.showErrorMessage(`Sign in failed: ${e}`); + Logger.error(e); + throw e; + } + }, + logout: async (id: string) => { + return loginService.logout(id); + } + }); + + return; +} + +// this method is called when your extension is deactivated +export function deactivate() { } diff --git a/extensions/github-authentication/src/github.ts b/extensions/github-authentication/src/github.ts new file mode 100644 index 0000000000000..fe4dcaa6d1f8d --- /dev/null +++ b/extensions/github-authentication/src/github.ts @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { keychain } from './common/keychain'; +import { GitHubServer } from './githubServer'; +import Logger from './common/logger'; + +export const onDidChangeSessions = new vscode.EventEmitter(); + +export class GitHubAuthenticationProvider { + private _sessions: vscode.AuthenticationSession[] = []; + private _githubServer = new GitHubServer(); + + public async initialize(): Promise { + this._sessions = await this.readSessions(); + this.pollForChange(); + } + + private pollForChange() { + setTimeout(async () => { + const storedSessions = await this.readSessions(); + let didChange = false; + + storedSessions.forEach(session => { + const matchesExisting = this._sessions.some(s => s.id === session.id); + // Another window added a session to the keychain, add it to our state as well + if (!matchesExisting) { + this._sessions.push(session); + didChange = true; + } + }); + + this._sessions.map(session => { + const matchesExisting = storedSessions.some(s => s.id === session.id); + // Another window has logged out, remove from our state + if (!matchesExisting) { + const sessionIndex = this._sessions.findIndex(s => s.id === session.id); + if (sessionIndex > -1) { + this._sessions.splice(sessionIndex, 1); + } + + didChange = true; + } + }); + + if (didChange) { + onDidChangeSessions.fire(); + } + + this.pollForChange(); + }, 1000 * 30); + } + + private async readSessions(): Promise { + const storedSessions = await keychain.getToken(); + if (storedSessions) { + try { + return JSON.parse(storedSessions); + } catch (e) { + Logger.error(`Error reading sessions: ${e}`); + } + } + + return []; + } + + private async storeSessions(): Promise { + await keychain.setToken(JSON.stringify(this._sessions)); + } + + get sessions(): vscode.AuthenticationSession[] { + return this._sessions; + } + + public async login(scopes: string): Promise { + const token = await this._githubServer.login(scopes); + const session = await this.tokenToSession(token, scopes.split(' ')); + await this.setToken(session); + return session; + } + + private async tokenToSession(token: string, scopes: string[]): Promise { + const userInfo = await this._githubServer.getUserInfo(token); + return { + id: userInfo.id, + accessToken: () => Promise.resolve(token), + accountName: userInfo.accountName, + scopes: scopes + }; + } + private async setToken(session: vscode.AuthenticationSession): Promise { + const sessionIndex = this._sessions.findIndex(s => s.id === session.id); + if (sessionIndex > -1) { + this._sessions.splice(sessionIndex, 1, session); + } else { + this._sessions.push(session); + } + + this.storeSessions(); + } + + public async logout(id: string) { + const sessionIndex = this._sessions.findIndex(session => session.id === id); + if (sessionIndex > -1) { + this._sessions.splice(sessionIndex, 1); + } + + this.storeSessions(); + } +} diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts new file mode 100644 index 0000000000000..6c84738261dda --- /dev/null +++ b/extensions/github-authentication/src/githubServer.ts @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as https from 'https'; +import * as vscode from 'vscode'; +import * as uuid from 'uuid'; +import { PromiseAdapter, promiseFromEvent } from './common/utils'; +import Logger from './common/logger'; +import ClientRegistrar, { ClientDetails } from './common/clientRegistrar'; + +class UriEventHandler extends vscode.EventEmitter implements vscode.UriHandler { + public handleUri(uri: vscode.Uri) { + this.fire(uri); + } +} + +export const uriHandler = new UriEventHandler; + +const exchangeCodeForToken: (state: string, clientDetails: ClientDetails) => PromiseAdapter = + (state, clientDetails) => async (uri, resolve, reject) => { + Logger.info('Exchanging code for token...'); + const query = parseQuery(uri); + const code = query.code; + + if (query.state !== state) { + reject('Received mismatched state'); + return; + } + + const post = https.request({ + host: 'github.com', + path: `/login/oauth/access_token?client_id=${clientDetails.id}&client_secret=${clientDetails.secret}&state=${query.state}&code=${code}`, + method: 'POST', + headers: { + Accept: 'application/json' + } + }, result => { + const buffer: Buffer[] = []; + result.on('data', (chunk: Buffer) => { + buffer.push(chunk); + }); + result.on('end', () => { + if (result.statusCode === 200) { + const json = JSON.parse(Buffer.concat(buffer).toString()); + Logger.info('Token exchange success!'); + resolve(json.access_token); + } else { + reject(new Error(result.statusMessage)); + } + }); + }); + + post.end(); + post.on('error', err => { + reject(err); + }); + }; + +function parseQuery(uri: vscode.Uri) { + return uri.query.split('&').reduce((prev: any, current) => { + const queryString = current.split('='); + prev[queryString[0]] = queryString[1]; + return prev; + }, {}); +} + +export class GitHubServer { + public async login(scopes: string): Promise { + Logger.info('Logging in...'); + const state = uuid(); + const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate`)); + const clientDetails = ClientRegistrar.getClientDetails(callbackUri.scheme); + const uri = vscode.Uri.parse(`https://github.com/login/oauth/authorize?redirect_uri=${encodeURIComponent(callbackUri.toString())}&scope=${scopes}&state=${state}&client_id=${clientDetails.id}`); + + vscode.env.openExternal(uri); + return promiseFromEvent(uriHandler.event, exchangeCodeForToken(state, clientDetails)); + } + + public async getUserInfo(token: string): Promise<{ id: string, accountName: string }> { + return new Promise((resolve, reject) => { + Logger.info('Getting account info...'); + const post = https.request({ + host: 'api.github.com', + path: `/user`, + method: 'GET', + headers: { + Authorization: `token ${token}`, + 'User-Agent': 'Visual-Studio-Code' + } + }, result => { + const buffer: Buffer[] = []; + result.on('data', (chunk: Buffer) => { + buffer.push(chunk); + }); + result.on('end', () => { + if (result.statusCode === 200) { + const json = JSON.parse(Buffer.concat(buffer).toString()); + Logger.info('Got account info!'); + resolve({ id: json.id, accountName: json.login }); + } else { + reject(new Error(result.statusMessage)); + } + }); + }); + + post.end(); + post.on('error', err => { + reject(err); + }); + }); + } +} diff --git a/extensions/github-authentication/src/typings/ref.d.ts b/extensions/github-authentication/src/typings/ref.d.ts new file mode 100644 index 0000000000000..c9849d48e083f --- /dev/null +++ b/extensions/github-authentication/src/typings/ref.d.ts @@ -0,0 +1,7 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// diff --git a/extensions/github-authentication/tsconfig.json b/extensions/github-authentication/tsconfig.json new file mode 100644 index 0000000000000..1225709307b01 --- /dev/null +++ b/extensions/github-authentication/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../shared.tsconfig.json", + "compilerOptions": { + "outDir": "./out", + "experimentalDecorators": true, + "typeRoots": [ + "./node_modules/@types" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/extensions/github-authentication/yarn.lock b/extensions/github-authentication/yarn.lock new file mode 100644 index 0000000000000..dcab74a1fea08 --- /dev/null +++ b/extensions/github-authentication/yarn.lock @@ -0,0 +1,454 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/keytar@^4.4.2": + version "4.4.2" + resolved "https://registry.yarnpkg.com/@types/keytar/-/keytar-4.4.2.tgz#49ef917d6cbb4f19241c0ab50cd35097b5729b32" + integrity sha512-xtQcDj9ruGnMwvSu1E2BH4SFa5Dv2PvSPd0CKEBLN5hEj/v5YpXJY+B6hAfuKIbvEomD7vJTc/P1s1xPNh2kRw== + dependencies: + keytar "*" + +"@types/node@^10.12.21": + version "10.17.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.14.tgz#b6c60ebf2fb5e4229fdd751ff9ddfae0f5f31541" + integrity sha512-G0UmX5uKEmW+ZAhmZ6PLTQ5eu/VPaT+d/tdLd5IFsKRPcbe6lPxocBtcYBFSaLaCW8O60AX90e91Nsp8lVHCNw== + +"@types/uuid@^3.4.6": + version "3.4.7" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.7.tgz#51d42247473bc00e38cc8dfaf70d936842a36c03" + integrity sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +bl@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-3.0.0.tgz#3611ec00579fd18561754360b21e9f784500ff88" + integrity sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A== + dependencies: + readable-stream "^3.0.1" + +chownr@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +decompress-response@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" + integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== + dependencies: + mimic-response "^2.0.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +keytar@*: + version "5.1.0" + resolved "https://registry.yarnpkg.com/keytar/-/keytar-5.1.0.tgz#d572ed9250ff2b4c8d729621397e00b17bfa5581" + integrity sha512-SptCrRDqLbTeOMB2Z9UmVOS+OKguIrMft+EUaCB8xJPiFMjy6Jnmjgv/LA0rg1ENgLelzwSsC5PSQXF0uoqNDQ== + dependencies: + nan "2.14.0" + prebuild-install "5.3.3" + +mimic-response@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46" + integrity sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ== + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +nan@2.14.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +napi-build-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.1.tgz#1381a0f92c39d66bf19852e7873432fc2123e508" + integrity sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA== + +node-abi@^2.7.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.14.0.tgz#24650e24e8ffad2b61352519263f0cf4e2ddbfe9" + integrity sha512-y54KGgEOHnRHlGQi7E5UiryRkH8bmksmQLj/9iLAjoje743YS+KaKB/sDYXgqtT0J16JT3c3AYJZNI98aU/kYg== + dependencies: + semver "^5.4.1" + +noop-logger@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" + integrity sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= + +npmlog@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +prebuild-install@5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.3.tgz#ef4052baac60d465f5ba6bf003c9c1de79b9da8e" + integrity sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g== + dependencies: + detect-libc "^1.0.3" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.0" + mkdirp "^0.5.1" + napi-build-utils "^1.0.1" + node-abi "^2.7.0" + noop-logger "^0.1.1" + npmlog "^4.0.1" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^3.0.3" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + which-pm-runs "^1.0.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^2.0.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.0.1, readable-stream@^3.1.1: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.5.0.tgz#465d70e6d1087f6162d079cd0b5db7fbebfd1606" + integrity sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +safe-buffer@^5.0.1, safe-buffer@~5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +semver@^5.4.1: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +simple-concat@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +simple-get@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" + integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== + dependencies: + decompress-response "^4.2.0" + once "^1.3.1" + simple-concat "^1.0.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +tar-fs@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad" + integrity sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA== + dependencies: + chownr "^1.1.1" + mkdirp "^0.5.1" + pump "^3.0.0" + tar-stream "^2.0.0" + +tar-stream@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3" + integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw== + dependencies: + bl "^3.0.0" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +typescript@^3.7.5: + version "3.7.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" + integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +uuid@^3.3.3: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= diff --git a/extensions/go/cgmanifest.json b/extensions/go/cgmanifest.json index a26813ed47e5d..f47768ba8611b 100644 --- a/extensions/go/cgmanifest.json +++ b/extensions/go/cgmanifest.json @@ -4,14 +4,14 @@ "component": { "type": "git", "git": { - "name": "language-go", - "repositoryUrl": "https://github.com/atom/language-go", - "commitHash": "b6fd68f74efa109679e31fe6f4a41ac105262d0e" + "name": "better-go-syntax", + "repositoryUrl": "https://github.com/jeff-hykin/better-go-syntax/ ", + "commitHash": "54ff898316f8647d77ffcf83880a9556445326f1" } }, "license": "MIT", - "description": "The file syntaxes/go.json was derived from the Atom package https://atom.io/packages/language-go.", - "version": "0.44.3" + "description": "The file syntaxes/go.tmLanguage.json is from https://github.com/jeff-hykin/better-go-syntax/ .", + "version": "1.0.0" } ], "version": 1 diff --git a/extensions/go/package.json b/extensions/go/package.json index a91d729adafae..121ce0c33e55e 100644 --- a/extensions/go/package.json +++ b/extensions/go/package.json @@ -5,26 +5,36 @@ "version": "1.0.0", "publisher": "vscode", "license": "MIT", - "engines": { "vscode": "*" }, + "engines": { + "vscode": "*" + }, "scripts": { - "update-grammar": "node ../../build/npm/update-grammar.js atom/language-go grammars/go.cson ./syntaxes/go.tmLanguage.json" + "update-grammar": "node ../../build/npm/update-grammar.js jeff-hykin/better-go-syntax source/generated.tmLanguage.json ./syntaxes/go.tmLanguage.json" }, "contributes": { - "languages": [{ - "id": "go", - "extensions": [ ".go" ], - "aliases": [ "Go" ], - "configuration": "./language-configuration.json" - }], - "grammars": [{ - "language": "go", - "scopeName": "source.go", - "path": "./syntaxes/go.tmLanguage.json" - }], + "languages": [ + { + "id": "go", + "extensions": [ + ".go" + ], + "aliases": [ + "Go" + ], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "go", + "scopeName": "source.go", + "path": "./syntaxes/go.tmLanguage.json" + } + ], "configurationDefaults": { "[go]": { "editor.insertSpaces": false } } } -} \ No newline at end of file +} diff --git a/extensions/go/syntaxes/go.tmLanguage.json b/extensions/go/syntaxes/go.tmLanguage.json index bc73a1d91bd44..9a803e24e5adb 100644 --- a/extensions/go/syntaxes/go.tmLanguage.json +++ b/extensions/go/syntaxes/go.tmLanguage.json @@ -1,14 +1,16 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/atom/language-go/blob/master/grammars/go.cson", + "This file has been converted from https://github.com/jeff-hykin/better-go-syntax/blob/master/source/generated.tmLanguage.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-go/commit/b6fd68f74efa109679e31fe6f4a41ac105262d0e", + "version": "https://github.com/jeff-hykin/better-go-syntax/commit/302b427373ba8390786723a99f6cdf8e38833159", "name": "Go", "scopeName": "source.go", - "comment": "Go language", "patterns": [ + { + "include": "#comments" + }, { "include": "#comments" }, @@ -147,14 +149,7 @@ } }, { - "comment": "Floating-point literals", - "match": "(\\.\\d+([Ee][-+]\\d+)?i?)\\b|\\b\\d+\\.\\d*(([Ee][-+]\\d+)?i?\\b)?", - "name": "constant.numeric.floating-point.go" - }, - { - "comment": "Integers", - "match": "\\b((0x[0-9a-fA-F]+)|(0[0-7]+i?)|(\\d+([Ee]\\d+)?i?)|(\\d+[Ee][-+]\\d+i?))\\b", - "name": "constant.numeric.integer.go" + "include": "#numeric_literals" }, { "comment": "Language constants", @@ -257,7 +252,7 @@ } }, { - "match": "\\w+(?:,\\s*\\w+)*(?=\\s*:=)", + "match": "\\b\\w+(?:,\\s*\\w+)*(?=\\s*:=)", "captures": { "0": { "patterns": [ @@ -350,24 +345,29 @@ "comments": { "patterns": [ { - "begin": "/\\*", - "end": "\\*/", - "captures": { - "0": { + "name": "comment.block.go", + "begin": "(\\/\\*)", + "beginCaptures": { + "1": { "name": "punctuation.definition.comment.go" } }, - "name": "comment.block.go" + "end": "(\\*\\/)", + "endCaptures": { + "1": { + "name": "punctuation.definition.comment.go" + } + } }, { - "begin": "//", + "name": "comment.line.double-slash.go", + "begin": "(\\/\\/)", "beginCaptures": { - "0": { + "1": { "name": "punctuation.definition.comment.go" } }, - "end": "$", - "name": "comment.line.double-slash.go" + "end": "(?:\\n|$)" } ] }, @@ -587,7 +587,7 @@ "string_placeholder": { "patterns": [ { - "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]", + "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGspw]", "name": "constant.other.placeholder.go" } ] @@ -671,6 +671,24 @@ ] } ] + }, + "numeric_literals": { + "patterns": [ + { + "include": "#float" + }, + { + "include": "#integer" + } + ] + }, + "float": { + "match": "(\\.\\d+([Ee][-+]\\d+)?i?)\\b|\\b\\d+\\.\\d*(([Ee][-+]\\d+)?i?\\b)?", + "name": "constant.numeric.floating-point.go" + }, + "integer": { + "match": "\\b((0x[0-9a-fA-F]+)|(0[0-7]+i?)|(\\d+([Ee]\\d+)?i?)|(\\d+[Ee][-+]\\d+i?))\\b", + "name": "constant.numeric.integer.go" } } } \ No newline at end of file diff --git a/extensions/groovy/language-configuration.json b/extensions/groovy/language-configuration.json index e4656d0babb69..a81a8864a5127 100644 --- a/extensions/groovy/language-configuration.json +++ b/extensions/groovy/language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -22,4 +22,4 @@ ["\"", "\""], ["'", "'"] ] -} \ No newline at end of file +} diff --git a/extensions/groovy/test/colorize-results/test_groovy.json b/extensions/groovy/test/colorize-results/test_groovy.json index 13aa74462a8ba..e6f3166fa0525 100644 --- a/extensions/groovy/test/colorize-results/test_groovy.json +++ b/extensions/groovy/test/colorize-results/test_groovy.json @@ -191,9 +191,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -356,9 +356,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4569,9 +4569,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4613,9 +4613,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4767,9 +4767,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5053,9 +5053,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5152,9 +5152,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5812,9 +5812,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5867,9 +5867,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5911,9 +5911,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6043,9 +6043,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6109,9 +6109,9 @@ "t": "source.groovy meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6131,9 +6131,9 @@ "t": "source.groovy meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6153,9 +6153,9 @@ "t": "source.groovy meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6175,9 +6175,9 @@ "t": "source.groovy meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6318,9 +6318,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6340,9 +6340,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6439,9 +6439,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6967,9 +6967,9 @@ "t": "source.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7517,9 +7517,9 @@ "t": "source.groovy meta.definition.variable.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7979,9 +7979,9 @@ "t": "source.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8001,9 +8001,9 @@ "t": "source.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8089,9 +8089,9 @@ "t": "source.groovy meta.definition.variable.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8287,9 +8287,9 @@ "t": "source.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8650,9 +8650,9 @@ "t": "source.groovy meta.definition.variable.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9321,9 +9321,9 @@ "t": "source.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9354,9 +9354,9 @@ "t": "source.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9728,9 +9728,9 @@ "t": "source.groovy meta.definition.method.groovy meta.method.body.java meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9750,9 +9750,9 @@ "t": "source.groovy meta.definition.method.groovy meta.method.body.java meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9772,9 +9772,9 @@ "t": "source.groovy meta.definition.method.groovy meta.method.body.java meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9794,9 +9794,9 @@ "t": "source.groovy meta.definition.method.groovy meta.method.body.java meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9882,9 +9882,9 @@ "t": "source.groovy meta.definition.method.groovy meta.method.body.java meta.structure.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10344,9 +10344,9 @@ "t": "source.groovy meta.declaration.assertion.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10366,9 +10366,9 @@ "t": "source.groovy meta.declaration.assertion.groovy meta.method-call.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10421,10 +10421,10 @@ "t": "source.groovy meta.declaration.assertion.groovy constant.numeric.groovy", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } } -] \ No newline at end of file +] diff --git a/extensions/grunt/src/main.ts b/extensions/grunt/src/main.ts index d8ef8a8267374..597aa909701f2 100644 --- a/extensions/grunt/src/main.ts +++ b/extensions/grunt/src/main.ts @@ -295,7 +295,7 @@ class TaskDetector { private updateProvider(): void { if (!this.taskProvider && this.detectors.size > 0) { const thisCapture = this; - this.taskProvider = vscode.workspace.registerTaskProvider('grunt', { + this.taskProvider = vscode.tasks.registerTaskProvider('grunt', { provideTasks: (): Promise => { return thisCapture.getTasks(); }, diff --git a/extensions/gulp/src/main.ts b/extensions/gulp/src/main.ts index 20d824c25ed78..534756ac81d05 100644 --- a/extensions/gulp/src/main.ts +++ b/extensions/gulp/src/main.ts @@ -277,7 +277,7 @@ class TaskDetector { private updateProvider(): void { if (!this.taskProvider && this.detectors.size > 0) { const thisCapture = this; - this.taskProvider = vscode.workspace.registerTaskProvider('gulp', { + this.taskProvider = vscode.tasks.registerTaskProvider('gulp', { provideTasks(): Promise { return thisCapture.getTasks(); }, diff --git a/extensions/hlsl/cgmanifest.json b/extensions/hlsl/cgmanifest.json index 44b3a016ee0b9..970c7915a2d3a 100644 --- a/extensions/hlsl/cgmanifest.json +++ b/extensions/hlsl/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "shaders-tmLanguage", "repositoryUrl": "https://github.com/tgjones/shaders-tmLanguage", - "commitHash": "cd1ef40f549f9ce2b9e6b73498688de114a85382" + "commitHash": "87c0dca3a39170dbd7ee7e277db4f915fb2de14a" } }, "license": "MIT", diff --git a/extensions/hlsl/syntaxes/hlsl.tmLanguage.json b/extensions/hlsl/syntaxes/hlsl.tmLanguage.json index dd8f5356fee9b..5398a76291cbb 100644 --- a/extensions/hlsl/syntaxes/hlsl.tmLanguage.json +++ b/extensions/hlsl/syntaxes/hlsl.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/tgjones/shaders-tmLanguage/commit/cd1ef40f549f9ce2b9e6b73498688de114a85382", + "version": "https://github.com/tgjones/shaders-tmLanguage/commit/87c0dca3a39170dbd7ee7e277db4f915fb2de14a", "name": "HLSL", "scopeName": "source.hlsl", "patterns": [ @@ -19,16 +19,20 @@ "end": "$" }, { - "name": "constant.numeric.hlsl", - "match": "\\b([0-9]+\\.?[0-9]*)\\b" + "name": "constant.numeric.decimal.hlsl", + "match": "\\b[0-9]+\\.[0-9]*(F|f)?\\b" }, { - "name": "constant.numeric.hlsl", - "match": "\\b(\\.[0-9]+)\\b" + "name": "constant.numeric.decimal.hlsl", + "match": "(\\.([0-9]+)(F|f)?)\\b" + }, + { + "name": "constant.numeric.decimal.hlsl", + "match": "\\b([0-9]+(F|f)?)\\b" }, { "name": "constant.numeric.hex.hlsl", - "match": "\\b(0x[0-9A-F]+)\\b" + "match": "\\b(0(x|X)[0-9a-fA-F]+)\\b" }, { "name": "constant.language.hlsl", diff --git a/extensions/html-language-features/client/src/customData.ts b/extensions/html-language-features/client/src/customData.ts index 14d8a66a8aa15..38b51d3759665 100644 --- a/extensions/html-language-features/client/src/customData.ts +++ b/extensions/html-language-features/client/src/customData.ts @@ -13,7 +13,7 @@ interface ExperimentalConfig { }; } -export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined): string[] { +export function getCustomDataPathsInAllWorkspaces(workspaceFolders: readonly WorkspaceFolder[] | undefined): string[] { const dataPaths: string[] = []; if (!workspaceFolders) { diff --git a/extensions/html-language-features/client/src/htmlMain.ts b/extensions/html-language-features/client/src/htmlMain.ts index 89bdc325721b6..c54a97f9b07a6 100644 --- a/extensions/html-language-features/client/src/htmlMain.ts +++ b/extensions/html-language-features/client/src/htmlMain.ts @@ -8,16 +8,39 @@ import * as fs from 'fs'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, Disposable, FormattingOptions, CancellationToken, ProviderResult, TextEdit } from 'vscode'; -import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams, DocumentRangeFormattingParams, DocumentRangeFormattingRequest } from 'vscode-languageclient'; +import { + languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, + Disposable, FormattingOptions, CancellationToken, ProviderResult, TextEdit, CompletionContext, CompletionList, SemanticTokensLegend, + DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider, SemanticTokens +} from 'vscode'; +import { + LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams, DocumentRangeFormattingParams, + DocumentRangeFormattingRequest, ProvideCompletionItemsSignature, TextDocumentIdentifier, RequestType0, Range as LspRange +} from 'vscode-languageclient'; import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared'; import { activateTagClosing } from './tagClosing'; import TelemetryReporter from 'vscode-extension-telemetry'; import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData'; +import { activateMirrorCursor } from './mirrorCursor'; namespace TagCloseRequest { export const type: RequestType = new RequestType('html/tag'); } +namespace MatchingTagPositionRequest { + export const type: RequestType = new RequestType('html/matchingTagPosition'); +} + +// experimental: semantic tokens +interface SemanticTokenParams { + textDocument: TextDocumentIdentifier; + ranges?: LspRange[]; +} +namespace SemanticTokenRequest { + export const type: RequestType = new RequestType('html/semanticTokens'); +} +namespace SemanticTokenLegendRequest { + export const type: RequestType0<{ types: string[]; modifiers: string[] } | null, any, any> = new RequestType0('html/semanticTokenLegend'); +} interface IPackageInfo { name: string; @@ -68,6 +91,30 @@ export function activate(context: ExtensionContext) { dataPaths, provideFormatter: false, // tell the server to not provide formatting capability and ignore the `html.format.enable` setting. }, + middleware: { + // testing the replace / insert mode + provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult { + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range = { inserting: new Range(range.start, position), replacing: range }; + } + } + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); + } + } }; // Create the language client and start the client. @@ -84,6 +131,14 @@ export function activate(context: ExtensionContext) { disposable = activateTagClosing(tagRequestor, { html: true, handlebars: true }, 'html.autoClosingTags'); toDispose.push(disposable); + const matchingTagPositionRequestor = (document: TextDocument, position: Position) => { + let param = client.code2ProtocolConverter.asTextDocumentPositionParams(document, position); + return client.sendRequest(MatchingTagPositionRequest.type, param); + }; + + disposable = activateMirrorCursor(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag'); + toDispose.push(disposable); + disposable = client.onTelemetry(e => { if (telemetryReporter) { telemetryReporter.sendTelemetryEvent(e.key, e.data); @@ -95,6 +150,32 @@ export function activate(context: ExtensionContext) { updateFormatterRegistration(); toDispose.push({ dispose: () => rangeFormatting && rangeFormatting.dispose() }); toDispose.push(workspace.onDidChangeConfiguration(e => e.affectsConfiguration('html.format.enable') && updateFormatterRegistration())); + + client.sendRequest(SemanticTokenLegendRequest.type).then(legend => { + if (legend) { + const provider: DocumentSemanticTokensProvider & DocumentRangeSemanticTokensProvider = { + provideDocumentSemanticTokens(doc) { + const params: SemanticTokenParams = { + textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(doc), + }; + return client.sendRequest(SemanticTokenRequest.type, params).then(data => { + return data && new SemanticTokens(new Uint32Array(data)); + }); + }, + provideDocumentRangeSemanticTokens(doc, range) { + const params: SemanticTokenParams = { + textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(doc), + ranges: [client.code2ProtocolConverter.asRange(range)] + }; + return client.sendRequest(SemanticTokenRequest.type, params).then(data => { + return data && new SemanticTokens(new Uint32Array(data)); + }); + } + }; + toDispose.push(languages.registerDocumentSemanticTokensProvider(documentSelector, provider, new SemanticTokensLegend(legend.types, legend.modifiers))); + } + }); + }); function updateFormatterRegistration() { diff --git a/extensions/html-language-features/client/src/mirrorCursor.ts b/extensions/html-language-features/client/src/mirrorCursor.ts new file mode 100644 index 0000000000000..5c9ae4460874b --- /dev/null +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -0,0 +1,259 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { + window, + workspace, + Disposable, + TextDocument, + Position, + TextEditorSelectionChangeEvent, + Selection, + Range, + WorkspaceEdit +} from 'vscode'; + +export function activateMirrorCursor( + matchingTagPositionProvider: (document: TextDocument, position: Position) => Thenable, + supportedLanguages: { [id: string]: boolean }, + configName: string +): Disposable { + let disposables: Disposable[] = []; + + window.onDidChangeTextEditorSelection(event => onDidChangeTextEditorSelection(event), null, disposables); + + let isEnabled = false; + updateEnabledState(); + + window.onDidChangeActiveTextEditor(updateEnabledState, null, disposables); + + function updateEnabledState() { + isEnabled = false; + let editor = window.activeTextEditor; + if (!editor) { + return; + } + let document = editor.document; + if (!supportedLanguages[document.languageId]) { + return; + } + if (!workspace.getConfiguration(undefined, document.uri).get(configName)) { + return; + } + isEnabled = true; + } + + let prevCursors: readonly Selection[] = []; + let cursors: readonly Selection[] = []; + let inMirrorMode = false; + + function onDidChangeTextEditorSelection(event: TextEditorSelectionChangeEvent) { + if (!isEnabled) { + return; + } + + if (event.textEditor.document?.languageId !== 'html' && event.textEditor.document?.languageId !== 'handlebars') { + return; + } + + prevCursors = cursors; + cursors = event.selections; + + if (cursors.length === 1) { + if (inMirrorMode && prevCursors.length === 2) { + if (cursors[0].isEqual(prevCursors[0]) || cursors[0].isEqual(prevCursors[1])) { + return; + } + } + if (event.selections[0].isEmpty) { + matchingTagPositionProvider(event.textEditor.document, event.selections[0].active).then(matchingTagPosition => { + if (matchingTagPosition && window.activeTextEditor) { + const charBeforeAndAfterPositionsRoughlyEqual = isCharBeforeAndAfterPositionsRoughlyEqual( + event.textEditor.document, + event.selections[0].anchor, + new Position(matchingTagPosition.line, matchingTagPosition.character) + ); + + if (charBeforeAndAfterPositionsRoughlyEqual) { + inMirrorMode = true; + const newCursor = new Selection( + matchingTagPosition.line, + matchingTagPosition.character, + matchingTagPosition.line, + matchingTagPosition.character + ); + window.activeTextEditor.selections = [...window.activeTextEditor.selections, newCursor]; + } + } + }); + } + } + + const exitMirrorMode = () => { + inMirrorMode = false; + window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; + }; + + if (cursors.length === 2 && inMirrorMode) { + /** + * Both cursors are positions + */ + if (event.selections[0].isEmpty && event.selections[1].isEmpty) { + if ( + prevCursors.length === 2 && + event.selections[0].anchor.line !== prevCursors[0].anchor.line && + event.selections[1].anchor.line !== prevCursors[0].anchor.line + ) { + exitMirrorMode(); + return; + } + + const charBeforeAndAfterPositionsRoughlyEqual = isCharBeforeAndAfterPositionsRoughlyEqual( + event.textEditor.document, + event.selections[0].anchor, + event.selections[1].anchor + ); + + if (!charBeforeAndAfterPositionsRoughlyEqual) { + exitMirrorMode(); + return; + } else { + // Need to cleanup in the case of
+ if ( + shouldDoCleanupForHtmlAttributeInput( + event.textEditor.document, + event.selections[0].anchor, + event.selections[1].anchor + ) + ) { + const cleanupEdit = new WorkspaceEdit(); + const cleanupRange = new Range(event.selections[1].anchor.translate(0, -1), event.selections[1].anchor); + cleanupEdit.replace(event.textEditor.document.uri, cleanupRange, ''); + exitMirrorMode(); + workspace.applyEdit(cleanupEdit); + } + } + } else { + /** + * Both cursors are selections + */ + const charBeforeAndAfterAnchorPositionsRoughlyEqual = isCharBeforeAndAfterPositionsRoughlyEqual( + event.textEditor.document, + event.selections[0].anchor, + event.selections[1].anchor + ); + + const charBeforeAndAfterActivePositionsRoughlyEqual = isCharBeforeAndAfterPositionsRoughlyEqual( + event.textEditor.document, + event.selections[0].active, + event.selections[1].active + ); + + if (!charBeforeAndAfterAnchorPositionsRoughlyEqual || !charBeforeAndAfterActivePositionsRoughlyEqual) { + exitMirrorMode(); + } + } + } + } + + return Disposable.from(...disposables); +} + +function getCharBefore(document: TextDocument, position: Position) { + const offset = document.offsetAt(position); + if (offset === 0) { + return ''; + } + + return document.getText(new Range(document.positionAt(offset - 1), position)); +} + +function getCharAfter(document: TextDocument, position: Position) { + const offset = document.offsetAt(position); + if (offset === document.getText().length) { + return ''; + } + + return document.getText(new Range(position, document.positionAt(offset + 1))); +} + +// Check if chars before and after the two positions are equal +// For the chars before, `<` and `/` are considered equal to handle the case of `<|>` +function isCharBeforeAndAfterPositionsRoughlyEqual(document: TextDocument, firstPos: Position, secondPos: Position) { + const charBeforePrimarySelection = getCharBefore(document, firstPos); + const charAfterPrimarySelection = getCharAfter(document, firstPos); + const charBeforeSecondarySelection = getCharBefore(document, secondPos); + const charAfterSecondarySelection = getCharAfter(document, secondPos); + + /** + * Special case for exiting + * |
+ * |
+ */ + if ( + charBeforePrimarySelection === ' ' && + charBeforeSecondarySelection === ' ' && + charAfterPrimarySelection === '<' && + charAfterSecondarySelection === '<' + ) { + return false; + } + /** + * Special case for exiting + * |
+ * |
+ */ + if (charBeforePrimarySelection === '\n' && charBeforeSecondarySelection === '\n') { + return false; + } + /** + * Special case for exiting + *
| + *
| + */ + if (charAfterPrimarySelection === '\n' && charAfterSecondarySelection === '\n') { + return false; + } + + // Exit mirror mode when cursor position no longer mirror + // Unless it's in the case of `<|>` + const charBeforeBothPositionRoughlyEqual = + charBeforePrimarySelection === charBeforeSecondarySelection || + (charBeforePrimarySelection === '/' && charBeforeSecondarySelection === '<') || + (charBeforeSecondarySelection === '/' && charBeforePrimarySelection === '<'); + const charAfterBothPositionRoughlyEqual = + charAfterPrimarySelection === charAfterSecondarySelection || + (charAfterPrimarySelection === ' ' && charAfterSecondarySelection === '>') || + (charAfterSecondarySelection === ' ' && charAfterPrimarySelection === '>'); + + return charBeforeBothPositionRoughlyEqual && charAfterBothPositionRoughlyEqual; +} + +function shouldDoCleanupForHtmlAttributeInput(document: TextDocument, firstPos: Position, secondPos: Position) { + // Need to cleanup in the case of
+ const charBeforePrimarySelection = getCharBefore(document, firstPos); + const charAfterPrimarySelection = getCharAfter(document, firstPos); + const charBeforeSecondarySelection = getCharBefore(document, secondPos); + const charAfterSecondarySelection = getCharAfter(document, secondPos); + + const primaryBeforeSecondary = document.offsetAt(firstPos) < document.offsetAt(secondPos); + + /** + * Check two cases + *
+ *
+ * Before 1st cursor: ` ` + * After 1st cursor: `>` or ` ` + * Before 2nd cursor: ` ` + * After 2nd cursor: `>` + */ + return ( + primaryBeforeSecondary && + charBeforePrimarySelection === ' ' && + (charAfterPrimarySelection === '>' || charAfterPrimarySelection === ' ') && + charBeforeSecondarySelection === ' ' && + charAfterSecondarySelection === '>' + ); +} diff --git a/extensions/html-language-features/package.json b/extensions/html-language-features/package.json index 7c4f83d6b5b56..526f54fcacbef 100644 --- a/extensions/html-language-features/package.json +++ b/extensions/html-language-features/package.json @@ -161,6 +161,12 @@ "default": true, "description": "%html.autoClosingTags%" }, + "html.mirrorCursorOnMatchingTag": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%html.mirrorCursorOnMatchingTag%" + }, "html.trace.server": { "type": "string", "scope": "window", @@ -174,6 +180,14 @@ } } }, + "configurationDefaults": { + "[html]": { + "editor.suggest.insertMode": "replace" + }, + "[handlebars]": { + "editor.suggest.insertMode": "replace" + } + }, "jsonValidation": [ { "fileMatch": "*.html-data.json", @@ -187,7 +201,7 @@ }, "dependencies": { "vscode-extension-telemetry": "0.1.1", - "vscode-languageclient": "^6.0.0-next.3", + "vscode-languageclient": "^6.1.0", "vscode-nls": "^4.1.1" }, "devDependencies": { diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 2cb7e3d16973a..8fa34d2527054 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -24,5 +24,6 @@ "html.trace.server.desc": "Traces the communication between VS Code and the HTML language server.", "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.", "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.", - "html.autoClosingTags": "Enable/disable autoclosing of HTML tags." + "html.autoClosingTags": "Enable/disable autoclosing of HTML tags.", + "html.mirrorCursorOnMatchingTag": "Enable/disable mirroring cursor on matching HTML tag." } diff --git a/extensions/html-language-features/schemas/package.schema.json b/extensions/html-language-features/schemas/package.schema.json index aaf9588221e41..a11810ef0909b 100644 --- a/extensions/html-language-features/schemas/package.schema.json +++ b/extensions/html-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "HTML contributions to package.json", "type": "object", "properties": { diff --git a/extensions/html-language-features/server/lib/jquery.d.ts b/extensions/html-language-features/server/lib/jquery.d.ts index 7ce90f7b80561..d31bfe6c1b546 100644 --- a/extensions/html-language-features/server/lib/jquery.d.ts +++ b/extensions/html-language-features/server/lib/jquery.d.ts @@ -34,7 +34,7 @@ interface JQueryAjaxSettings { /** * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; + beforeSend?(jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; /** * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. */ @@ -42,7 +42,7 @@ interface JQueryAjaxSettings { /** * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; + complete?(jqXHR: JQueryXHR, textStatus: string): any; /** * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) */ @@ -72,15 +72,15 @@ interface JQueryAjaxSettings { /** * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. */ - dataFilter? (data: any, ty: any): any; + dataFilter?(data: any, ty: any): any; /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). + * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). */ dataType?: string; /** * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; + error?(jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; /** * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. */ @@ -132,7 +132,7 @@ interface JQueryAjaxSettings { /** * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; + success?(data: any, textStatus: string, jqXHR: JQueryXHR): any; /** * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. */ @@ -168,11 +168,11 @@ interface JQueryAjaxSettings { */ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). + * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). */ overrideMimeType(mimeType: string): any; /** - * Cancel the request. + * Cancel the request. * * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" */ @@ -197,13 +197,13 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { interface JQueryCallback { /** * Add a callback or a collection of callbacks to a callback list. - * + * * @param callbacks A function, or array of functions, that are to be added to the callback list. */ add(callbacks: Function): JQueryCallback; /** * Add a callback or a collection of callbacks to a callback list. - * + * * @param callbacks A function, or array of functions, that are to be added to the callback list. */ add(callbacks: Function[]): JQueryCallback; @@ -225,7 +225,7 @@ interface JQueryCallback { /** * Call all of the callbacks with the given arguments - * + * * @param arguments The argument or list of arguments to pass back to the callback list. */ fire(...arguments: any[]): JQueryCallback; @@ -237,7 +237,7 @@ interface JQueryCallback { /** * Call all callbacks in a list with the given context and arguments. - * + * * @param context A reference to the context in which the callbacks in the list should be fired. * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. */ @@ -245,7 +245,7 @@ interface JQueryCallback { /** * Determine whether a supplied callback is in a list - * + * * @param callback The callback to search for. */ has(callback: Function): boolean; @@ -262,13 +262,13 @@ interface JQueryCallback { /** * Remove a callback or a collection of callbacks from a callback list. - * + * * @param callbacks A function, or array of functions, that are to be removed from the callback list. */ remove(callbacks: Function): JQueryCallback; /** * Remove a callback or a collection of callbacks from a callback list. - * + * * @param callbacks A function, or array of functions, that are to be removed from the callback list. */ remove(callbacks: Function[]): JQueryCallback; @@ -280,15 +280,15 @@ interface JQueryCallback { interface JQueryGenericPromise { /** * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * + * * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; + then(doneFilter: (value?: T, ...values: any[]) => U | JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * + * * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ @@ -303,7 +303,7 @@ interface JQueryPromiseCallback { } interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + (callback1: JQueryPromiseCallback | JQueryPromiseCallback[], ...callbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; } /** @@ -316,38 +316,38 @@ interface JQueryPromise extends JQueryGenericPromise { state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. - * + * * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...alwaysCallbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. - * + * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + done(doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...doneCallbackN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. - * + * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...failCallbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. - * + * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...progressCallbackN: Array | JQueryPromiseCallback[]>): JQueryPromise; // Deprecated - given no typings pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - + /** * Return a Deferred's Promise object. - * + * * @param target Object onto which the promise methods have to be attached */ promise(target?: any): JQueryPromise; @@ -363,42 +363,42 @@ interface JQueryDeferred extends JQueryGenericPromise { state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. - * + * * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...alwaysCallbacksN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. - * + * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + done(doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...doneCallbackN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. - * + * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...failCallbacksN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. - * + * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + progress(progressCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...progressCallbackN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. - * + * * @param args Optional arguments that are passed to the progressCallbacks. */ notify(value?: any, ...args: any[]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given context and args. - * + * * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. */ @@ -406,13 +406,13 @@ interface JQueryDeferred extends JQueryGenericPromise { /** * Reject a Deferred object and call any failCallbacks with the given args. - * + * * @param args Optional arguments that are passed to the failCallbacks. */ reject(value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given context and args. - * + * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. */ @@ -420,7 +420,7 @@ interface JQueryDeferred extends JQueryGenericPromise { /** * Resolve a Deferred object and call any doneCallbacks with the given args. - * + * * @param value First argument passed to doneCallbacks. * @param args Optional subsequent arguments that are passed to the doneCallbacks. */ @@ -428,7 +428,7 @@ interface JQueryDeferred extends JQueryGenericPromise { /** * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * + * * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. */ @@ -436,7 +436,7 @@ interface JQueryDeferred extends JQueryGenericPromise { /** * Return a Deferred's Promise object. - * + * * @param target Object onto which the promise methods have to be attached */ promise(target?: any): JQueryPromise; @@ -495,7 +495,7 @@ interface JQueryKeyEventObject extends JQueryInputEventObject { keyCode: number; } -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { } /* @@ -518,7 +518,7 @@ interface JQuerySupport { opacity?: boolean; optDisabled?: boolean; optSelected?: boolean; - scriptEval? (): boolean; + scriptEval?(): boolean; style?: boolean; submitBubbles?: boolean; tbody?: boolean; @@ -527,14 +527,14 @@ interface JQuerySupport { interface JQueryParam { /** * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * + * * @param obj An array or object to serialize. */ (obj: any): string; /** * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * + * * @param obj An array or object to serialize. * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. */ @@ -549,7 +549,7 @@ interface JQueryParam { */ interface JQueryEventConstructor { (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; + new(name: string, eventProperties?: any): JQueryEventObject; } /** @@ -568,47 +568,47 @@ interface JQuerySerializeArrayElement { value: string; } -interface JQueryAnimationOptions { +interface JQueryAnimationOptions { /** * A string or number determining how long the animation will run. */ - duration?: any; + duration?: any; /** * A string indicating which easing function to use for the transition. */ - easing?: string; + easing?: string; /** * A function to call once the animation is complete. */ - complete?: Function; + complete?: Function; /** * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. */ - step?: (now: number, tween: any) => any; + step?: (now: number, tween: any) => any; /** * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; + progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; /** * A function to call when the animation begins. (version added: 1.8) */ - start?: (animation: JQueryPromise) => any; + start?: (animation: JQueryPromise) => any; /** * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. */ - queue?: any; + queue?: any; /** * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) */ @@ -616,11 +616,11 @@ interface JQueryAnimationOptions { } interface JQueryEasingFunction { - ( percent: number ): number; + (percent: number): number; } interface JQueryEasingFunctions { - [ name: string ]: JQueryEasingFunction; + [name: string]: JQueryEasingFunction; linear: JQueryEasingFunction; swing: JQueryEasingFunction; } @@ -660,11 +660,11 @@ interface JQueryStatic { ajaxSettings: JQueryAjaxSettings; - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - */ + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + */ ajaxSetup(options: JQueryAjaxSettings): void; /** @@ -683,13 +683,13 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + get(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP GET request. * * @param settings The JQueryAjaxSettings to be used for the request */ - get(settings : JQueryAjaxSettings): JQueryXHR; + get(settings: JQueryAjaxSettings): JQueryXHR; /** * Load JSON-encoded data from the server using a GET HTTP request. * @@ -704,7 +704,7 @@ interface JQueryStatic { * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + getJSON(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** * Load a JavaScript file from the server using a GET HTTP request, then execute it. * @@ -734,13 +734,13 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + post(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP POST request. * * @param settings The JQueryAjaxSettings to be used for the request */ - post(settings : JQueryAjaxSettings): JQueryXHR; + post(settings: JQueryAjaxSettings): JQueryXHR; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. * @@ -761,7 +761,7 @@ interface JQueryStatic { * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context */ - (selector: string, context?: Element|JQuery): JQuery; + (selector: string, context?: Element | JQuery): JQuery; /** * Accepts a string containing a CSS selector which is then used to match a set of elements. @@ -831,7 +831,7 @@ interface JQueryStatic { * * @param deferreds One or more Deferred objects, or plain JavaScript objects. */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; + when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. @@ -972,7 +972,7 @@ interface JQueryStatic { /** * Check to see if a DOM element is a descendant of another DOM element. - * + * * @param container The DOM element that may contain the other element. * @param contained The DOM element that may be contained by (a descendant of) the other element. */ @@ -980,25 +980,25 @@ interface JQueryStatic { /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * + * * @param collection The object or array to iterate over. * @param callback The function that will be executed on every object. */ each( collection: T[], callback: (indexInArray: number, valueOfElement: T) => any - ): any; + ): any; /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * + * * @param collection The object or array to iterate over. * @param callback The function that will be executed on every object. */ each( collection: any, callback: (indexInArray: any, valueOfElement: any) => any - ): any; + ): any; /** * Merge the contents of two or more objects together into the first object. @@ -1088,21 +1088,21 @@ interface JQueryStatic { /** * Convert an array-like object into a true JavaScript array. - * + * * @param obj Any object to turn into a native Array. */ makeArray(obj: any): any[]; /** * Translate all items in an array or object to new array of items. - * + * * @param array The Array to translate. * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. */ map(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[]; /** * Translate all items in an array or object to new array of items. - * + * * @param arrayOrObject The Array or Object to translate. * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. */ @@ -1110,7 +1110,7 @@ interface JQueryStatic { /** * Merge the contents of two arrays together into the first array. - * + * * @param first The first array to merge, the elements of second added. * @param second The second array to merge into the first, unaltered. */ @@ -1128,7 +1128,7 @@ interface JQueryStatic { /** * Takes a well-formed JSON string and returns the resulting JavaScript object. - * + * * @param json The JSON string to parse. */ parseJSON(json: string): any; @@ -1142,21 +1142,21 @@ interface JQueryStatic { /** * Remove the whitespace from the beginning and end of a string. - * + * * @param str Remove the whitespace from the beginning and end of a string. */ trim(str: string): string; /** * Determine the internal JavaScript [[Class]] of an object. - * + * * @param obj Object to get the internal JavaScript [[Class]] of. */ type(obj: any): string; /** * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * + * * @param array The Array of DOM elements. */ unique(array: Element[]): Element[]; @@ -1228,7 +1228,7 @@ interface JQuery { * @param data A plain object or string that is sent to the server with the request. * @param complete A callback function that is executed when the request completes. */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; + load(url: string, data?: string | Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; /** * Encode a set of form elements as a string for submission. @@ -1269,21 +1269,21 @@ interface JQuery { * @param attributeName The name of the attribute to set. * @param value A value to set for the attribute. */ - attr(attributeName: string, value: string|number): JQuery; + attr(attributeName: string, value: string | number): JQuery; /** * Set one or more attributes for the set of matched elements. * * @param attributeName The name of the attribute to set. * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; + attr(attributeName: string, func: (index: number, attr: string) => string | number): JQuery; /** * Set one or more attributes for the set of matched elements. * * @param attributes An object of attribute-value pairs to set. */ attr(attributes: Object): JQuery; - + /** * Determine whether any of the matched elements are assigned the given class. * @@ -1325,7 +1325,7 @@ interface JQuery { * @param propertyName The name of the property to set. * @param value A value to set for the property. */ - prop(propertyName: string, value: string|number|boolean): JQuery; + prop(propertyName: string, value: string | number | boolean): JQuery; /** * Set one or more properties for the set of matched elements. * @@ -1397,7 +1397,7 @@ interface JQuery { * * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. */ - val(value: string|string[]|number): JQuery; + val(value: string | string[] | number): JQuery; /** * Set the value of each element in the set of matched elements. * @@ -1418,14 +1418,14 @@ interface JQuery { * @param propertyName A CSS property name. * @param value A value to set for the property. */ - css(propertyName: string, value: string|number): JQuery; + css(propertyName: string, value: string | number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * * @param propertyName A CSS property name. * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; + css(propertyName: string, value: (index: number, value: string) => string | number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * @@ -1442,13 +1442,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). */ - height(value: number|string): JQuery; + height(value: number | string): JQuery; /** * Set the CSS height of every matched element. * * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. */ - height(func: (index: number, height: number) => number|string): JQuery; + height(func: (index: number, height: number) => number | string): JQuery; /** * Get the current computed height for the first element in the set of matched elements, including padding but not border. @@ -1460,8 +1460,8 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerHeight(height: number|string): JQuery; - + innerHeight(height: number | string): JQuery; + /** * Get the current computed width for the first element in the set of matched elements, including padding but not border. */ @@ -1472,8 +1472,8 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerWidth(width: number|string): JQuery; - + innerWidth(width: number | string): JQuery; + /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. */ @@ -1503,7 +1503,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerHeight(height: number|string): JQuery; + outerHeight(height: number | string): JQuery; /** * Get the current computed width for the first element in the set of matched elements, including padding and border. @@ -1517,7 +1517,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerWidth(width: number|string): JQuery; + outerWidth(width: number | string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. @@ -1555,13 +1555,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - width(value: number|string): JQuery; + width(value: number | string): JQuery; /** * Set the CSS width of each element in the set of matched elements. * * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. */ - width(func: (index: number, width: number) => number|string): JQuery; + width(func: (index: number, width: number) => number | string): JQuery; /** * Remove from the queue all items that have not yet been run. @@ -1633,7 +1633,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; + animate(properties: Object, duration?: string | number, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1642,7 +1642,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. (default: swing) * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; + animate(properties: Object, duration?: string | number, easing?: string, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1665,7 +1665,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number|string, complete?: Function): JQuery; + fadeIn(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1673,7 +1673,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeIn(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1687,7 +1687,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number|string, complete?: Function): JQuery; + fadeOut(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -1695,7 +1695,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeOut(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -1710,7 +1710,7 @@ interface JQuery { * @param opacity A number between 0 and 1 denoting the target opacity. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; + fadeTo(duration: string | number, opacity: number, complete?: Function): JQuery; /** * Adjust the opacity of the matched elements. * @@ -1719,7 +1719,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; + fadeTo(duration: string | number, opacity: number, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. @@ -1727,7 +1727,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; + fadeToggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -1735,7 +1735,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeToggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -1756,7 +1756,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - hide(duration?: number|string, complete?: Function): JQuery; + hide(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -1764,7 +1764,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; + hide(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -1778,7 +1778,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - show(duration?: number|string, complete?: Function): JQuery; + show(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -1786,7 +1786,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; + show(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -1800,7 +1800,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number|string, complete?: Function): JQuery; + slideDown(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -1808,7 +1808,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideDown(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -1822,7 +1822,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number|string, complete?: Function): JQuery; + slideToggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -1830,7 +1830,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideToggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -1844,7 +1844,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number|string, complete?: Function): JQuery; + slideUp(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -1852,7 +1852,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideUp(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -1882,7 +1882,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number|string, complete?: Function): JQuery; + toggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -1890,7 +1890,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + toggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -1906,7 +1906,7 @@ interface JQuery { /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. @@ -1914,14 +1914,14 @@ interface JQuery { bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function to execute each time the event is triggered. */ bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. @@ -1929,14 +1929,14 @@ interface JQuery { bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. */ bind(eventType: string, preventBubble: boolean): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param events An object containing one or more DOM event types and functions to execute for them. */ bind(events: any): JQuery; @@ -2344,7 +2344,7 @@ interface JQuery { * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; /** * Attach an event handler function for one or more events to the selected elements. * @@ -2511,22 +2511,22 @@ interface JQuery { /** * Execute all handlers and behaviors attached to the matched elements for the given event type. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; + trigger(eventType: string, extraParameters?: any[] | Object): JQuery; /** * Execute all handlers and behaviors attached to the matched elements for the given event type. - * + * * @param event A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; + trigger(event: JQueryEventObject, extraParameters?: any[] | Object): JQuery; /** * Execute all handlers attached to an element for an event. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters An array of additional parameters to pass along to the event handler. */ @@ -2534,7 +2534,7 @@ interface JQuery { /** * Execute all handlers attached to an element for an event. - * + * * @param event A jQuery.Event object. * @param extraParameters An array of additional parameters to pass along to the event handler. */ @@ -2542,21 +2542,21 @@ interface JQuery { /** * Remove a previously-attached event handler from the elements. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param handler The function that is to be no longer executed. */ unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Remove a previously-attached event handler from the elements. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). */ unbind(eventType: string, fls: boolean): JQuery; /** * Remove a previously-attached event handler from the elements. - * + * * @param evt A JavaScript event object as passed to an event handler. */ unbind(evt: any): JQuery; @@ -2567,7 +2567,7 @@ interface JQuery { undelegate(): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param selector A selector which will be used to filter the event results. * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" * @param handler A function to execute at the time the event is triggered. @@ -2575,27 +2575,27 @@ interface JQuery { undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param selector A selector which will be used to filter the event results. * @param events An object of one or more event types and previously bound functions to unbind from them. */ undelegate(selector: string, events: Object): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param namespace A string containing a namespace to unbind all events from. */ undelegate(namespace: string): JQuery; /** * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * + * * @param handler A function to execute when the event is triggered. */ unload(handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * + * * @param eventData A plain object of data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. */ @@ -2610,13 +2610,13 @@ interface JQuery { /** * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * + * * @param handler A function to execute when the event is triggered. */ error(handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * + * * @param eventData A plain object of data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. */ @@ -2624,13 +2624,13 @@ interface JQuery { /** * Add a collection of DOM elements onto the jQuery stack. - * + * * @param elements An array of elements to push onto the stack and make into a new jQuery object. */ pushStack(elements: any[]): JQuery; /** * Add a collection of DOM elements onto the jQuery stack. - * + * * @param elements An array of elements to push onto the stack and make into a new jQuery object. * @param name The name of a jQuery method that generated the array of elements. * @param arguments The arguments that were passed in to the jQuery method (for serialization). @@ -2639,56 +2639,56 @@ interface JQuery { /** * Insert content, specified by the parameter, after each element in the set of matched elements. - * + * * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. */ - after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. - * + * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; + after(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * + * * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. */ - append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * + * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; + append(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert every element in the set of matched elements to the end of the target. - * + * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. */ - appendTo(target: JQuery|any[]|Element|string): JQuery; + appendTo(target: JQuery | any[] | Element | string): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. - * + * * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. */ - before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + before(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. - * + * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; + before(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Create a deep copy of the set of matched elements. - * + * * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). */ @@ -2696,7 +2696,7 @@ interface JQuery { /** * Remove the set of matched elements from the DOM. - * + * * param selector A selector expression that filters the set of matched elements to be removed. */ detach(selector?: string): JQuery; @@ -2708,65 +2708,65 @@ interface JQuery { /** * Insert every element in the set of matched elements after the target. - * + * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; + insertAfter(target: JQuery | any[] | Element | Text | string): JQuery; /** * Insert every element in the set of matched elements before the target. - * + * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; + insertBefore(target: JQuery | any[] | Element | Text | string): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * + * * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. */ - prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * + * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; + prepend(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert every element in the set of matched elements to the beginning of the target. - * + * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. */ - prependTo(target: JQuery|any[]|Element|string): JQuery; + prependTo(target: JQuery | any[] | Element | string): JQuery; /** * Remove the set of matched elements from the DOM. - * + * * @param selector A selector expression that filters the set of matched elements to be removed. */ remove(selector?: string): JQuery; /** * Replace each target element with the set of matched elements. - * + * * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; + replaceAll(target: JQuery | any[] | Element | string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * + * * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; + replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * + * * param func A function that returns content with which to replace the set of matched elements. */ - replaceWith(func: () => Element|JQuery): JQuery; + replaceWith(func: () => Element | JQuery): JQuery; /** * Get the combined text contents of each element in the set of matched elements, including their descendants. @@ -2774,13 +2774,13 @@ interface JQuery { text(): string; /** * Set the content of each element in the set of matched elements to the specified text. - * + * * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. */ - text(text: string|number|boolean): JQuery; + text(text: string | number | boolean): JQuery; /** * Set the content of each element in the set of matched elements to the specified text. - * + * * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. */ text(func: (index: number, text: string) => string): JQuery; @@ -2798,48 +2798,48 @@ interface JQuery { /** * Wrap an HTML structure around each element in the set of matched elements. - * + * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrap(wrappingElement: JQuery|Element|string): JQuery; + wrap(wrappingElement: JQuery | Element | string): JQuery; /** * Wrap an HTML structure around each element in the set of matched elements. - * + * * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - wrap(func: (index: number) => string|JQuery): JQuery; + wrap(func: (index: number) => string | JQuery): JQuery; /** * Wrap an HTML structure around all elements in the set of matched elements. - * + * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; + wrapAll(wrappingElement: JQuery | Element | string): JQuery; wrapAll(func: (index: number) => string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. - * + * * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; + wrapInner(wrappingElement: JQuery | Element | string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. - * + * * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ wrapInner(func: (index: number) => string): JQuery; /** * Iterate over a jQuery object, executing a function for each matched element. - * + * * @param func A function to execute for each matched element. */ each(func: (index: number, elem: Element) => any): JQuery; /** * Retrieve one of the elements matched by the jQuery object. - * + * * @param index A zero-based integer indicating which element to retrieve. */ get(index: number): HTMLElement; @@ -2855,10 +2855,10 @@ interface JQuery { index(): number; /** * Search for a given element from among the matched elements. - * + * * @param selector A selector representing a jQuery collection in which to look for an element. */ - index(selector: string|JQuery|Element): number; + index(selector: string | JQuery | Element): number; /** * The number of elements in the jQuery object. @@ -2874,66 +2874,66 @@ interface JQuery { /** * Add elements to the set of matched elements. - * + * * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. */ add(selector: string, context?: Element): JQuery; /** * Add elements to the set of matched elements. - * + * * @param elements One or more elements to add to the set of matched elements. */ add(...elements: Element[]): JQuery; /** * Add elements to the set of matched elements. - * + * * @param html An HTML fragment to add to the set of matched elements. */ add(html: string): JQuery; /** * Add elements to the set of matched elements. - * + * * @param obj An existing jQuery object to add to the set of matched elements. */ add(obj: JQuery): JQuery; /** * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ children(selector?: string): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param selector A string containing a selector expression to match elements against. */ closest(selector: string): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param selector A string containing a selector expression to match elements against. * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. */ closest(selector: string, context?: Element): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param obj A jQuery object to match elements against. */ closest(obj: JQuery): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param element An element to match elements against. */ closest(element: Element): JQuery; /** * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * + * * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. */ @@ -2951,52 +2951,52 @@ interface JQuery { /** * Reduce the set of matched elements to the one at the specified index. - * + * * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * + * */ eq(index: number): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param selector A string containing a selector expression to match the current set of elements against. */ filter(selector: string): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param func A function used as a test for each element in the set. this is the current DOM element. */ filter(func: (index: number, element: Element) => any): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param element An element to match the current set of elements against. */ filter(element: Element): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param obj An existing jQuery object to match the current set of elements against. */ filter(obj: JQuery): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param selector A string containing a selector expression to match elements against. */ find(selector: string): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param element An element to match elements against. */ find(element: Element): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param obj A jQuery object to match elements against. */ find(obj: JQuery): JQuery; @@ -3008,38 +3008,38 @@ interface JQuery { /** * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * + * * @param selector A string containing a selector expression to match elements against. */ has(selector: string): JQuery; /** * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * + * * @param contained A DOM element to match elements against. */ has(contained: Element): JQuery; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param selector A string containing a selector expression to match elements against. */ is(selector: string): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. */ is(func: (index: number, element: Element) => boolean): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param obj An existing jQuery object to match the current set of elements against. */ is(obj: JQuery): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param elements One or more elements to match the current set of elements against. */ is(elements: any): boolean; @@ -3051,42 +3051,42 @@ interface JQuery { /** * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - * + * * @param callback A function object that will be invoked for each element in the current set. */ map(callback: (index: number, domElement: Element) => any): JQuery; /** * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * + * * @param selector A string containing a selector expression to match elements against. */ next(selector?: string): JQuery; /** * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ nextAll(selector?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. */ nextUntil(selector?: string, filter?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. */ nextUntil(element?: Element, filter?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. */ @@ -3094,25 +3094,25 @@ interface JQuery { /** * Remove elements from the set of matched elements. - * + * * @param selector A string containing a selector expression to match elements against. */ not(selector: string): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param func A function used as a test for each element in the set. this is the current DOM element. */ not(func: (index: number, element: Element) => boolean): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param elements One or more DOM elements to remove from the matched set. */ - not(elements: Element|Element[]): JQuery; + not(elements: Element | Element[]): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param obj An existing jQuery object to match the current set of elements against. */ not(obj: JQuery): JQuery; @@ -3124,35 +3124,35 @@ interface JQuery { /** * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ parent(selector?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ parents(selector?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. */ parentsUntil(selector?: string, filter?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. */ parentsUntil(element?: Element, filter?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. */ @@ -3160,35 +3160,35 @@ interface JQuery { /** * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ prev(selector?: string): JQuery; /** * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ prevAll(selector?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. */ prevUntil(selector?: string, filter?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. */ prevUntil(element?: Element, filter?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. */ @@ -3196,14 +3196,14 @@ interface JQuery { /** * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. */ siblings(selector?: string): JQuery; /** * Reduce the set of matched elements to a subset specified by a range of indices. - * + * * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. */ @@ -3211,39 +3211,39 @@ interface JQuery { /** * Show the queue of functions to be executed on the matched elements. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. */ queue(queueName?: string): any[]; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param newQueue An array of functions to replace the current queue contents. */ queue(newQueue: Function[]): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. */ queue(callback: Function): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param newQueue An array of functions to replace the current queue contents. */ queue(queueName: string, newQueue: Function[]): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. */ queue(queueName: string, callback: Function): JQuery; } -declare module "jquery" { +declare module 'jquery' { export = $; } -declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; \ No newline at end of file +declare const jQuery: JQueryStatic; +declare const $: JQueryStatic; diff --git a/extensions/html-language-features/server/package.json b/extensions/html-language-features/server/package.json index dc078cfcb7108..0083f2b1bd5b8 100644 --- a/extensions/html-language-features/server/package.json +++ b/extensions/html-language-features/server/package.json @@ -9,18 +9,18 @@ }, "main": "./out/htmlServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.19", - "vscode-html-languageservice": "^3.0.4-next.8", - "vscode-languageserver": "^6.0.0-next.3", + "vscode-css-languageservice": "^4.0.3-next.27", + "vscode-html-languageservice": "^3.0.4-next.14", + "vscode-languageserver": "^6.1.0", "vscode-nls": "^4.1.1", - "vscode-uri": "^2.0.3" + "vscode-uri": "^2.1.1" }, "devDependencies": { "@types/mocha": "2.2.33", "@types/node": "^12.11.7", - "glob": "^7.1.4", - "mocha": "^6.1.4", - "mocha-junit-reporter": "^1.23.1", + "glob": "^7.1.6", + "mocha": "^7.0.1", + "mocha-junit-reporter": "^1.23.3", "mocha-multi-reporters": "^1.1.7" }, "scripts": { @@ -30,6 +30,6 @@ "install-service-local": "npm install ../../../../vscode-css-languageservice -f && npm install ../../../../vscode-html-languageservice -f", "install-server-next": "yarn add vscode-languageserver@next", "install-server-local": "npm install ../../../../vscode-languageserver-node/server -f", - "test": "npm run compile && npx mocha" + "test": "npm run compile && node ./test/index.js" } } diff --git a/extensions/html-language-features/server/src/htmlServerMain.ts b/extensions/html-language-features/server/src/htmlServerMain.ts index 1e6e7e2e0ce83..9ed3ce0f0a031 100644 --- a/extensions/html-language-features/server/src/htmlServerMain.ts +++ b/extensions/html-language-features/server/src/htmlServerMain.ts @@ -6,11 +6,13 @@ import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, RequestType, DocumentRangeFormattingRequest, Disposable, DocumentSelector, TextDocumentPositionParams, ServerCapabilities, - Position, ConfigurationRequest, ConfigurationParams, DidChangeWorkspaceFoldersNotification, - WorkspaceFolder, DocumentColorRequest, ColorInformation, ColorPresentationRequest, TextDocumentSyncKind + ConfigurationRequest, ConfigurationParams, DidChangeWorkspaceFoldersNotification, + DocumentColorRequest, ColorPresentationRequest, TextDocumentSyncKind } from 'vscode-languageserver'; -import { TextDocument, Diagnostic, DocumentLink, SymbolInformation } from 'vscode-html-languageservice'; -import { getLanguageModes, LanguageModes, Settings } from './modes/languageModes'; +import { + getLanguageModes, LanguageModes, Settings, TextDocument, Position, Diagnostic, WorkspaceFolder, ColorInformation, + Range, DocumentLink, SymbolInformation, TextDocumentIdentifier +} from './modes/languageModes'; import { format } from './modes/formatting'; import { pushAll } from './utils/arrays'; @@ -20,10 +22,27 @@ import { formatError, runSafe, runSafeAsync } from './utils/runner'; import { getFoldingRanges } from './modes/htmlFolding'; import { getDataProviders } from './customData'; +import { getSelectionRanges } from './modes/selectionRanges'; +import { SemanticTokenProvider, newSemanticTokenProvider } from './modes/semanticTokens'; namespace TagCloseRequest { export const type: RequestType = new RequestType('html/tag'); } +namespace MatchingTagPositionRequest { + export const type: RequestType = new RequestType('html/matchingTagPosition'); +} + +// experimental: semantic tokens +interface SemanticTokenParams { + textDocument: TextDocumentIdentifier; + ranges?: Range[]; +} +namespace SemanticTokenRequest { + export const type: RequestType = new RequestType('html/semanticTokens'); +} +namespace SemanticTokenLegendRequest { + export const type: RequestType = new RequestType('html/semanticTokenLegend'); +} // Create a connection for the server const connection: IConnection = createConnection(); @@ -136,6 +155,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => { colorProvider: {}, foldingRangeProvider: true, selectionRangeProvider: true, + renameProvider: true }; return { capabilities }; }); @@ -457,16 +477,66 @@ connection.onFoldingRanges((params, token) => { connection.onSelectionRanges((params, token) => { return runSafe(() => { const document = documents.get(params.textDocument.uri); - const positions: Position[] = params.positions; + if (document) { + return getSelectionRanges(languageModes, document, params.positions); + } + return []; + }, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token); +}); + +connection.onRenameRequest((params, token) => { + return runSafe(() => { + const document = documents.get(params.textDocument.uri); + const position: Position = params.position; if (document) { const htmlMode = languageModes.getMode('html'); - if (htmlMode && htmlMode.getSelectionRanges) { - return htmlMode.getSelectionRanges(document, positions); + if (htmlMode && htmlMode.doRename) { + return htmlMode.doRename(document, position, params.newName); } } - return []; - }, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token); + return null; + }, null, `Error while computing rename for ${params.textDocument.uri}`, token); +}); + +connection.onRequest(MatchingTagPositionRequest.type, (params, token) => { + return runSafe(() => { + const document = documents.get(params.textDocument.uri); + if (document) { + const pos = params.position; + if (pos.character > 0) { + const mode = languageModes.getModeAtPosition(document, Position.create(pos.line, pos.character - 1)); + if (mode && mode.findMatchingTagPosition) { + return mode.findMatchingTagPosition(document, pos); + } + } + } + return null; + }, null, `Error while computing matching tag position for ${params.textDocument.uri}`, token); +}); + +let semanticTokensProvider: SemanticTokenProvider | undefined; +function getSemanticTokenProvider() { + if (!semanticTokensProvider) { + semanticTokensProvider = newSemanticTokenProvider(languageModes); + } + return semanticTokensProvider; +} + +connection.onRequest(SemanticTokenRequest.type, (params, token) => { + return runSafe(() => { + const document = documents.get(params.textDocument.uri); + if (document) { + return getSemanticTokenProvider().getSemanticTokens(document, params.ranges); + } + return null; + }, null, `Error while computing semantic tokens for ${params.textDocument.uri}`, token); +}); + +connection.onRequest(SemanticTokenLegendRequest.type, (_params, token) => { + return runSafe(() => { + return getSemanticTokenProvider().legend; + }, null, `Error while computing semantic tokens legend`, token); }); diff --git a/extensions/html-language-features/server/src/languageModelCache.ts b/extensions/html-language-features/server/src/languageModelCache.ts index c022b8047a902..06d331bca8a22 100644 --- a/extensions/html-language-features/server/src/languageModelCache.ts +++ b/extensions/html-language-features/server/src/languageModelCache.ts @@ -18,10 +18,10 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime let cleanupInterval: NodeJS.Timer | undefined = undefined; if (cleanupIntervalTimeInSec > 0) { cleanupInterval = setInterval(() => { - let cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; - let uris = Object.keys(languageModels); - for (let uri of uris) { - let languageModelInfo = languageModels[uri]; + const cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; + const uris = Object.keys(languageModels); + for (const uri of uris) { + const languageModelInfo = languageModels[uri]; if (languageModelInfo.cTime < cutoffTime) { delete languageModels[uri]; nModels--; @@ -32,14 +32,14 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime return { get(document: TextDocument): T { - let version = document.version; - let languageId = document.languageId; - let languageModelInfo = languageModels[document.uri]; + const version = document.version; + const languageId = document.languageId; + const languageModelInfo = languageModels[document.uri]; if (languageModelInfo && languageModelInfo.version === version && languageModelInfo.languageId === languageId) { languageModelInfo.cTime = Date.now(); return languageModelInfo.languageModel; } - let languageModel = parse(document); + const languageModel = parse(document); languageModels[document.uri] = { languageModel, version, languageId, cTime: Date.now() }; if (!languageModelInfo) { nModels++; @@ -48,8 +48,8 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime if (nModels === maxEntries) { let oldestTime = Number.MAX_VALUE; let oldestUri = null; - for (let uri in languageModels) { - let languageModelInfo = languageModels[uri]; + for (const uri in languageModels) { + const languageModelInfo = languageModels[uri]; if (languageModelInfo.cTime < oldestTime) { oldestUri = uri; oldestTime = languageModelInfo.cTime; @@ -64,7 +64,7 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime }, onDocumentRemoved(document: TextDocument) { - let uri = document.uri; + const uri = document.uri; if (languageModels[uri]) { delete languageModels[uri]; nModels--; diff --git a/extensions/html-language-features/server/src/modes/cssMode.ts b/extensions/html-language-features/server/src/modes/cssMode.ts index 9f147f50cec4c..e705f44bbabc1 100644 --- a/extensions/html-language-features/server/src/modes/cssMode.ts +++ b/extensions/html-language-features/server/src/modes/cssMode.ts @@ -4,11 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache'; -import { TextDocument, Position, Range, CompletionList } from 'vscode-html-languageservice'; -import { Stylesheet, FoldingRange, LanguageService as CSSLanguageService } from 'vscode-css-languageservice'; -import { LanguageMode, Workspace } from './languageModes'; +import { Stylesheet, LanguageService as CSSLanguageService } from 'vscode-css-languageservice'; +import { FoldingRange, LanguageMode, Workspace, Color, TextDocument, Position, Range, CompletionList } from './languageModes'; import { HTMLDocumentRegions, CSS_STYLE_RULE } from './embeddedSupport'; -import { Color } from 'vscode-languageserver'; export function getCSSMode(cssLanguageService: CSSLanguageService, documentRegions: LanguageModelCache, workspace: Workspace): LanguageMode { let embeddedCSSDocuments = getLanguageModelCache(10, 60, document => documentRegions.get(document).getEmbeddedDocument('css')); @@ -59,6 +57,10 @@ export function getCSSMode(cssLanguageService: CSSLanguageService, documentRegio let embedded = embeddedCSSDocuments.get(document); return cssLanguageService.getFoldingRanges(embedded, {}); }, + getSelectionRange(document: TextDocument, position: Position) { + let embedded = embeddedCSSDocuments.get(document); + return cssLanguageService.getSelectionRanges(embedded, [position], cssStylesheets.get(embedded))[0]; + }, onDocumentRemoved(document: TextDocument) { embeddedCSSDocuments.onDocumentRemoved(document); cssStylesheets.onDocumentRemoved(document); diff --git a/extensions/html-language-features/server/src/modes/embeddedSupport.ts b/extensions/html-language-features/server/src/modes/embeddedSupport.ts index df47be3ed97d3..c3b8ffde437c4 100644 --- a/extensions/html-language-features/server/src/modes/embeddedSupport.ts +++ b/extensions/html-language-features/server/src/modes/embeddedSupport.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextDocument, Position, LanguageService, TokenType, Range } from 'vscode-html-languageservice'; +import { TextDocument, Position, LanguageService, TokenType, Range } from './languageModes'; export interface LanguageRange extends Range { languageId: string | undefined; @@ -58,6 +58,8 @@ export function getDocumentRegions(languageService: LanguageService, document: T } else if (lastAttributeName === 'type' && lastTagName.toLowerCase() === 'script') { if (/["'](module|(text|application)\/(java|ecma)script|text\/babel)["']/.test(scanner.getTokenText())) { languageIdFromType = 'javascript'; + } else if (/["']text\/typescript["']/.test(scanner.getTokenText())) { + languageIdFromType = 'typescript'; } else { languageIdFromType = undefined; } diff --git a/extensions/html-language-features/server/src/modes/formatting.ts b/extensions/html-language-features/server/src/modes/formatting.ts index a9df4b4a30ba7..4acb60a9b9ad3 100644 --- a/extensions/html-language-features/server/src/modes/formatting.ts +++ b/extensions/html-language-features/server/src/modes/formatting.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextDocument, Range, TextEdit, FormattingOptions, Position } from 'vscode-html-languageservice'; -import { LanguageModes, Settings, LanguageModeRange } from './languageModes'; +import { LanguageModes, Settings, LanguageModeRange, TextDocument, Range, TextEdit, FormattingOptions, Position } from './languageModes'; import { pushAll } from '../utils/arrays'; import { isEOL } from '../utils/strings'; diff --git a/extensions/html-language-features/server/src/modes/htmlFolding.ts b/extensions/html-language-features/server/src/modes/htmlFolding.ts index aacdcc604fc41..5eccc0ef876a2 100644 --- a/extensions/html-language-features/server/src/modes/htmlFolding.ts +++ b/extensions/html-language-features/server/src/modes/htmlFolding.ts @@ -3,9 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextDocument, CancellationToken, Position, Range } from 'vscode-languageserver'; -import { FoldingRange } from 'vscode-html-languageservice'; -import { LanguageModes, LanguageMode } from './languageModes'; +import { TextDocument, FoldingRange, Position, Range, LanguageModes, LanguageMode } from './languageModes'; +import { CancellationToken } from 'vscode-languageserver'; export function getFoldingRanges(languageModes: LanguageModes, document: TextDocument, maxRanges: number | undefined, _cancellationToken: CancellationToken | null): FoldingRange[] { let htmlMode = languageModes.getMode('html'); diff --git a/extensions/html-language-features/server/src/modes/htmlMode.ts b/extensions/html-language-features/server/src/modes/htmlMode.ts index 4449b01bd7cb6..251821d1272b6 100644 --- a/extensions/html-language-features/server/src/modes/htmlMode.ts +++ b/extensions/html-language-features/server/src/modes/htmlMode.ts @@ -7,9 +7,9 @@ import { getLanguageModelCache } from '../languageModelCache'; import { LanguageService as HTMLLanguageService, HTMLDocument, DocumentContext, FormattingOptions, HTMLFormatConfiguration, SelectionRange, - TextDocument, Position, Range, CompletionItem, FoldingRange -} from 'vscode-html-languageservice'; -import { LanguageMode, Workspace } from './languageModes'; + TextDocument, Position, Range, CompletionItem, FoldingRange, + LanguageMode, Workspace +} from './languageModes'; import { getPathCompletionParticipant } from './pathCompletion'; export function getHTMLMode(htmlLanguageService: HTMLLanguageService, workspace: Workspace): LanguageMode { @@ -18,8 +18,8 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService, workspace: getId() { return 'html'; }, - getSelectionRanges(document: TextDocument, positions: Position[]): SelectionRange[] { - return htmlLanguageService.getSelectionRanges(document, positions); + getSelectionRange(document: TextDocument, position: Position): SelectionRange { + return htmlLanguageService.getSelectionRanges(document, [position])[0]; }, doComplete(document: TextDocument, position: Position, settings = workspace.settings) { let options = settings && settings.html && settings.html.suggest; @@ -74,9 +74,17 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService, workspace: } return null; }, + doRename(document: TextDocument, position: Position, newName: string) { + const htmlDocument = htmlDocuments.get(document); + return htmlLanguageService.doRename(document, position, newName, htmlDocument); + }, onDocumentRemoved(document: TextDocument) { htmlDocuments.onDocumentRemoved(document); }, + findMatchingTagPosition(document: TextDocument, position: Position) { + const htmlDocument = htmlDocuments.get(document); + return htmlLanguageService.findMatchingTagPosition(document, position, htmlDocument); + }, dispose() { htmlDocuments.dispose(); } diff --git a/extensions/html-language-features/server/src/modes/javascriptMode.ts b/extensions/html-language-features/server/src/modes/javascriptMode.ts index 302b3dc271a83..03dc5755c1adc 100644 --- a/extensions/html-language-features/server/src/modes/javascriptMode.ts +++ b/extensions/html-language-features/server/src/modes/javascriptMode.ts @@ -7,16 +7,16 @@ import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache import { SymbolInformation, SymbolKind, CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation, Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover, MarkedString, - DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions, FoldingRange, FoldingRangeKind -} from 'vscode-html-languageservice'; -import { LanguageMode, Settings } from './languageModes'; + DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions, FoldingRange, FoldingRangeKind, SelectionRange, + LanguageMode, Settings, SemanticTokenData +} from './languageModes'; import { getWordAtText, startsWith, isWhitespaceOnly, repeat } from '../utils/strings'; import { HTMLDocumentRegions } from './embeddedSupport'; import * as ts from 'typescript'; import { join } from 'path'; +import { getSemanticTokens, getSemanticTokenLegend } from './javascriptSemanticTokens'; -const FILE_NAME = 'vscode://javascript/1'; // the same 'file' is used for all contents const JS_WORD_REGEX = /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g; let jquery_d_ts = join(__dirname, '../lib/jquery.d.ts'); // when packaged @@ -24,8 +24,10 @@ if (!ts.sys.fileExists(jquery_d_ts)) { jquery_d_ts = join(__dirname, '../../lib/jquery.d.ts'); // from source } -export function getJavaScriptMode(documentRegions: LanguageModelCache): LanguageMode { - let jsDocuments = getLanguageModelCache(10, 60, document => documentRegions.get(document).getEmbeddedDocument('javascript')); +export function getJavaScriptMode(documentRegions: LanguageModelCache, languageId: 'javascript' | 'typescript'): LanguageMode { + let jsDocuments = getLanguageModelCache(10, 60, document => documentRegions.get(document).getEmbeddedDocument(languageId)); + + const workingFile = languageId === 'javascript' ? 'vscode://javascript/1.js' : 'vscode://javascript/2.ts'; // the same 'file' is used for all contents let compilerOptions: ts.CompilerOptions = { allowNonTsExtensions: true, allowJs: true, lib: ['lib.es6.d.ts'], target: ts.ScriptTarget.Latest, moduleResolution: ts.ModuleResolutionKind.Classic }; let currentTextDocument: TextDocument; @@ -38,10 +40,10 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache compilerOptions, - getScriptFileNames: () => [FILE_NAME, jquery_d_ts], - getScriptKind: () => ts.ScriptKind.JS, + getScriptFileNames: () => [workingFile, jquery_d_ts], + getScriptKind: (fileName) => fileName.substr(fileName.length - 2) === 'ts' ? ts.ScriptKind.TS : ts.ScriptKind.JS, getScriptVersion: (fileName: string) => { - if (fileName === FILE_NAME) { + if (fileName === workingFile) { return String(scriptFileVersion); } return '1'; // default lib an jquery.d.ts are static @@ -49,7 +51,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache { let text = ''; if (startsWith(fileName, 'vscode:')) { - if (fileName === FILE_NAME) { + if (fileName === workingFile) { text = currentTextDocument.getText(); } } else { @@ -70,17 +72,17 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache { return { range: convertRange(currentTextDocument, diag), severity: DiagnosticSeverity.Error, - source: 'js', + source: languageId, message: ts.flattenDiagnosticMessageText(diag.messageText, '\n') }; }); @@ -88,7 +90,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache d.fileName === FILE_NAME).map(d => { + return definition.filter(d => d.fileName === workingFile).map(d => { return { uri: document.uri, range: convertRange(currentTextDocument, d.textSpan) @@ -236,9 +238,9 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache d.fileName === FILE_NAME).map(d => { + return references.filter(d => d.fileName === workingFile).map(d => { return { uri: document.uri, range: convertRange(currentTextDocument, d.textSpan) @@ -247,6 +249,15 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache { + resultTokens.push({ start: currentTextDocument.positionAt(node.getStart()), length: node.getWidth(), typeIdx, modifierSet }); + }; + collectTokens(jsLanguageService, fileName, { start: 0, length: currentTextDocument.getText().length }, collector); + + return resultTokens; +} + +function collectTokens(jsLanguageService: ts.LanguageService, fileName: string, span: ts.TextSpan, collector: (node: ts.Node, tokenType: number, tokenModifier: number) => void) { + + const program = jsLanguageService.getProgram(); + if (program) { + const typeChecker = program.getTypeChecker(); + + function visit(node: ts.Node) { + if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { + return; + } + if (ts.isIdentifier(node)) { + let symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + if (symbol.flags & ts.SymbolFlags.Alias) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + let typeIdx = classifySymbol(symbol); + if (typeIdx !== undefined) { + let modifierSet = 0; + if (node.parent) { + const parentTypeIdx = tokenFromDeclarationMapping[node.parent.kind]; + if (parentTypeIdx === typeIdx && (node.parent).name === node) { + modifierSet = 1 << TokenModifier.declaration; + } + } + const decl = symbol.valueDeclaration; + const modifiers = decl ? ts.getCombinedModifierFlags(decl) : 0; + const nodeFlags = decl ? ts.getCombinedNodeFlags(decl) : 0; + if (modifiers & ts.ModifierFlags.Static) { + modifierSet |= 1 << TokenModifier.static; + } + if (modifiers & ts.ModifierFlags.Async) { + modifierSet |= 1 << TokenModifier.async; + } + if ((modifiers & ts.ModifierFlags.Readonly) || (nodeFlags & ts.NodeFlags.Const) || (symbol.getFlags() & ts.SymbolFlags.EnumMember)) { + modifierSet |= 1 << TokenModifier.readonly; + } + collector(node, typeIdx, modifierSet); + } + } + } + + ts.forEachChild(node, visit); + } + const sourceFile = program.getSourceFile(fileName); + if (sourceFile) { + visit(sourceFile); + } + } +} + +function classifySymbol(symbol: ts.Symbol) { + const flags = symbol.getFlags(); + if (flags & ts.SymbolFlags.Class) { + return TokenType.class; + } else if (flags & ts.SymbolFlags.Enum) { + return TokenType.enum; + } else if (flags & ts.SymbolFlags.TypeAlias) { + return TokenType.type; + } else if (flags & ts.SymbolFlags.Type) { + if (flags & ts.SymbolFlags.Interface) { + return TokenType.interface; + } if (flags & ts.SymbolFlags.TypeParameter) { + return TokenType.typeParameter; + } + } + const decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0]; + return decl && tokenFromDeclarationMapping[decl.kind]; +} + +export const enum TokenType { + class, enum, interface, namespace, typeParameter, type, parameter, variable, property, function, member, _ +} + +export const enum TokenModifier { + declaration, static, async, readonly, _ +} + +const tokenTypes: string[] = []; +tokenTypes[TokenType.class] = 'class'; +tokenTypes[TokenType.enum] = 'enum'; +tokenTypes[TokenType.interface] = 'interface'; +tokenTypes[TokenType.namespace] = 'namespace'; +tokenTypes[TokenType.typeParameter] = 'typeParameter'; +tokenTypes[TokenType.type] = 'type'; +tokenTypes[TokenType.parameter] = 'parameter'; +tokenTypes[TokenType.variable] = 'variable'; +tokenTypes[TokenType.property] = 'property'; +tokenTypes[TokenType.function] = 'function'; +tokenTypes[TokenType.member] = 'member'; + +const tokenModifiers: string[] = []; +tokenModifiers[TokenModifier.async] = 'async'; +tokenModifiers[TokenModifier.declaration] = 'declaration'; +tokenModifiers[TokenModifier.readonly] = 'readonly'; +tokenModifiers[TokenModifier.static] = 'static'; + +const tokenFromDeclarationMapping: { [name: string]: TokenType } = { + [ts.SyntaxKind.VariableDeclaration]: TokenType.variable, + [ts.SyntaxKind.Parameter]: TokenType.parameter, + [ts.SyntaxKind.PropertyDeclaration]: TokenType.property, + [ts.SyntaxKind.ModuleDeclaration]: TokenType.namespace, + [ts.SyntaxKind.EnumDeclaration]: TokenType.enum, + [ts.SyntaxKind.EnumMember]: TokenType.property, + [ts.SyntaxKind.ClassDeclaration]: TokenType.class, + [ts.SyntaxKind.MethodDeclaration]: TokenType.member, + [ts.SyntaxKind.FunctionDeclaration]: TokenType.function, + [ts.SyntaxKind.MethodSignature]: TokenType.member, + [ts.SyntaxKind.GetAccessor]: TokenType.property, + [ts.SyntaxKind.PropertySignature]: TokenType.property, + [ts.SyntaxKind.InterfaceDeclaration]: TokenType.interface, + [ts.SyntaxKind.TypeAliasDeclaration]: TokenType.type, + [ts.SyntaxKind.TypeParameter]: TokenType.typeParameter +}; diff --git a/extensions/html-language-features/server/src/modes/languageModes.ts b/extensions/html-language-features/server/src/modes/languageModes.ts index 0a8e53a4ef36d..43bbc1f3d6c0b 100644 --- a/extensions/html-language-features/server/src/modes/languageModes.ts +++ b/extensions/html-language-features/server/src/modes/languageModes.ts @@ -8,7 +8,7 @@ import { ClientCapabilities, DocumentContext, getLanguageService as getHTMLLanguageService, IHTMLDataProvider, SelectionRange, CompletionItem, CompletionList, Definition, Diagnostic, DocumentHighlight, DocumentLink, FoldingRange, FormattingOptions, Hover, Location, Position, Range, SignatureHelp, SymbolInformation, TextDocument, TextEdit, - Color, ColorInformation, ColorPresentation + Color, ColorInformation, ColorPresentation, WorkspaceEdit } from 'vscode-html-languageservice'; import { WorkspaceFolder } from 'vscode-languageserver'; import { getLanguageModelCache, LanguageModelCache } from '../languageModelCache'; @@ -17,7 +17,8 @@ import { getDocumentRegions, HTMLDocumentRegions } from './embeddedSupport'; import { getHTMLMode } from './htmlMode'; import { getJavaScriptMode } from './javascriptMode'; -export { ColorInformation, ColorPresentation, Color }; +export * from 'vscode-html-languageservice'; +export { WorkspaceFolder } from 'vscode-languageserver'; export interface Settings { css?: any; @@ -30,14 +31,22 @@ export interface Workspace { readonly folders: WorkspaceFolder[]; } +export interface SemanticTokenData { + start: Position; + length: number; + typeIdx: number; + modifierSet: number; +} + export interface LanguageMode { getId(): string; - getSelectionRanges?: (document: TextDocument, positions: Position[]) => SelectionRange[]; + getSelectionRange?: (document: TextDocument, position: Position) => SelectionRange; doValidation?: (document: TextDocument, settings?: Settings) => Diagnostic[]; doComplete?: (document: TextDocument, position: Position, settings?: Settings) => CompletionList; doResolve?: (document: TextDocument, item: CompletionItem) => CompletionItem; doHover?: (document: TextDocument, position: Position) => Hover | null; doSignatureHelp?: (document: TextDocument, position: Position) => SignatureHelp | null; + doRename?: (document: TextDocument, position: Position, newName: string) => WorkspaceEdit | null; findDocumentHighlight?: (document: TextDocument, position: Position) => DocumentHighlight[]; findDocumentSymbols?: (document: TextDocument) => SymbolInformation[]; findDocumentLinks?: (document: TextDocument, documentContext: DocumentContext) => DocumentLink[]; @@ -47,8 +56,11 @@ export interface LanguageMode { findDocumentColors?: (document: TextDocument) => ColorInformation[]; getColorPresentations?: (document: TextDocument, color: Color, range: Range) => ColorPresentation[]; doAutoClose?: (document: TextDocument, position: Position) => string | null; + findMatchingTagPosition?: (document: TextDocument, position: Position) => Position | null; getFoldingRanges?: (document: TextDocument) => FoldingRange[]; onDocumentRemoved(document: TextDocument): void; + getSemanticTokens?(document: TextDocument): SemanticTokenData[]; + getSemanticTokenLegend?(): { types: string[], modifiers: string[] }; dispose(): void; } @@ -82,7 +94,8 @@ export function getLanguageModes(supportedLanguages: { [languageId: string]: boo modes['css'] = getCSSMode(cssLanguageService, documentRegions, workspace); } if (supportedLanguages['javascript']) { - modes['javascript'] = getJavaScriptMode(documentRegions); + modes['javascript'] = getJavaScriptMode(documentRegions, 'javascript'); + modes['typescript'] = getJavaScriptMode(documentRegions, 'typescript'); } return { getModeAtPosition(document: TextDocument, position: Position): LanguageMode | undefined { diff --git a/extensions/html-language-features/server/src/modes/pathCompletion.ts b/extensions/html-language-features/server/src/modes/pathCompletion.ts index 278d967bd954f..d522efdc0df02 100644 --- a/extensions/html-language-features/server/src/modes/pathCompletion.ts +++ b/extensions/html-language-features/server/src/modes/pathCompletion.ts @@ -3,11 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { WorkspaceFolder } from 'vscode-languageserver'; import * as path from 'path'; import * as fs from 'fs'; import { URI } from 'vscode-uri'; -import { ICompletionParticipant, TextDocument, CompletionItemKind, CompletionItem, TextEdit, Range, Position } from 'vscode-html-languageservice'; +import { ICompletionParticipant, TextDocument, CompletionItemKind, CompletionItem, TextEdit, Range, Position, WorkspaceFolder } from './languageModes'; import { startsWith } from '../utils/strings'; import { contains } from '../utils/arrays'; diff --git a/extensions/html-language-features/server/src/modes/selectionRanges.ts b/extensions/html-language-features/server/src/modes/selectionRanges.ts new file mode 100644 index 0000000000000..a5d0d0eea8d33 --- /dev/null +++ b/extensions/html-language-features/server/src/modes/selectionRanges.ts @@ -0,0 +1,26 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { LanguageModes, TextDocument, Position, Range, SelectionRange } from './languageModes'; +import { insideRangeButNotSame } from '../utils/positions'; + +export function getSelectionRanges(languageModes: LanguageModes, document: TextDocument, positions: Position[]) { + const htmlMode = languageModes.getMode('html'); + return positions.map(position => { + const htmlRange = htmlMode!.getSelectionRange!(document, position); + const mode = languageModes.getModeAtPosition(document, position); + if (mode && mode.getSelectionRange) { + let range = mode.getSelectionRange(document, position); + let top = range; + while (top.parent && insideRangeButNotSame(htmlRange.range, top.parent.range)) { + top = top.parent; + } + top.parent = htmlRange; + return range; + } + return htmlRange || SelectionRange.create(Range.create(position, position)); + }); +} + diff --git a/extensions/html-language-features/server/src/modes/semanticTokens.ts b/extensions/html-language-features/server/src/modes/semanticTokens.ts new file mode 100644 index 0000000000000..027c17e5dd9e0 --- /dev/null +++ b/extensions/html-language-features/server/src/modes/semanticTokens.ts @@ -0,0 +1,139 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { SemanticTokenData, Range, TextDocument, LanguageModes, Position } from './languageModes'; +import { beforeOrSame } from '../utils/positions'; + +interface LegendMapping { + types: number[] | undefined; + modifiers: number[] | undefined; +} + +export interface SemanticTokenProvider { + readonly legend: { types: string[]; modifiers: string[] }; + getSemanticTokens(document: TextDocument, ranges?: Range[]): number[]; +} + + +export function newSemanticTokenProvider(languageModes: LanguageModes): SemanticTokenProvider { + + // combined legend across modes + const legend = { types: [], modifiers: [] }; + const legendMappings: { [modeId: string]: LegendMapping } = {}; + + for (let mode of languageModes.getAllModes()) { + if (mode.getSemanticTokenLegend && mode.getSemanticTokens) { + const modeLegend = mode.getSemanticTokenLegend(); + legendMappings[mode.getId()] = { types: createMapping(modeLegend.types, legend.types), modifiers: createMapping(modeLegend.modifiers, legend.modifiers) }; + } + } + + return { + legend, + getSemanticTokens(document: TextDocument, ranges?: Range[]): number[] { + const allTokens: SemanticTokenData[] = []; + for (let mode of languageModes.getAllModesInDocument(document)) { + if (mode.getSemanticTokens) { + const mapping = legendMappings[mode.getId()]; + const tokens = mode.getSemanticTokens(document); + applyTypesMapping(tokens, mapping.types); + applyModifiersMapping(tokens, mapping.modifiers); + for (let token of tokens) { + allTokens.push(token); + } + } + } + return encodeTokens(allTokens, ranges); + } + }; +} + +function createMapping(origLegend: string[], newLegend: string[]): number[] | undefined { + const mapping: number[] = []; + let needsMapping = false; + for (let origIndex = 0; origIndex < origLegend.length; origIndex++) { + const entry = origLegend[origIndex]; + let newIndex = newLegend.indexOf(entry); + if (newIndex === -1) { + newIndex = newLegend.length; + newLegend.push(entry); + } + mapping.push(newIndex); + needsMapping = needsMapping || (newIndex !== origIndex); + } + return needsMapping ? mapping : undefined; +} + +function applyTypesMapping(tokens: SemanticTokenData[], typesMapping: number[] | undefined): void { + if (typesMapping) { + for (let token of tokens) { + token.typeIdx = typesMapping[token.typeIdx]; + } + } +} + +function applyModifiersMapping(tokens: SemanticTokenData[], modifiersMapping: number[] | undefined): void { + if (modifiersMapping) { + for (let token of tokens) { + let modifierSet = token.modifierSet; + if (modifierSet) { + let index = 0; + let result = 0; + while (modifierSet > 0) { + if ((modifierSet & 1) !== 0) { + result = result + (1 << modifiersMapping[index]); + } + index++; + modifierSet = modifierSet >> 1; + } + token.modifierSet = result; + } + } + } +} + +const fullRange = [Range.create(Position.create(0, 0), Position.create(Number.MAX_VALUE, 0))]; + +function encodeTokens(tokens: SemanticTokenData[], ranges?: Range[]): number[] { + + const resultTokens = tokens.sort((d1, d2) => d1.start.line - d2.start.line || d1.start.character - d2.start.character); + if (ranges) { + ranges = ranges.sort((d1, d2) => d1.start.line - d2.start.line || d1.start.character - d2.start.character); + } else { + ranges = fullRange; + } + + let rangeIndex = 0; + let currRange = ranges[rangeIndex++]; + + let prefLine = 0; + let prevChar = 0; + + let encodedResult: number[] = []; + + for (let k = 0; k < resultTokens.length && currRange; k++) { + const curr = resultTokens[k]; + const start = curr.start; + while (currRange && beforeOrSame(currRange.end, start)) { + currRange = ranges[rangeIndex++]; + } + if (currRange && beforeOrSame(currRange.start, start) && beforeOrSame({ line: start.line, character: start.character + curr.length }, currRange.end)) { + // token inside a range + + if (prefLine !== start.line) { + prevChar = 0; + } + encodedResult.push(start.line - prefLine); // line delta + encodedResult.push(start.character - prevChar); // line delta + encodedResult.push(curr.length); // length + encodedResult.push(curr.typeIdx); // tokenType + encodedResult.push(curr.modifierSet); // tokenModifier + + prefLine = start.line; + prevChar = start.character; + } + } + return encodedResult; +} diff --git a/extensions/html-language-features/server/src/test/completions.test.ts b/extensions/html-language-features/server/src/test/completions.test.ts index e0e3a7e22cae3..9c3b8f0831b14 100644 --- a/extensions/html-language-features/server/src/test/completions.test.ts +++ b/extensions/html-language-features/server/src/test/completions.test.ts @@ -6,10 +6,7 @@ import 'mocha'; import * as assert from 'assert'; import * as path from 'path'; import { URI } from 'vscode-uri'; -import { getLanguageModes } from '../modes/languageModes'; -import { WorkspaceFolder } from 'vscode-languageserver'; -import { TextDocument, CompletionList, CompletionItemKind, ClientCapabilities } from 'vscode-html-languageservice'; - +import { getLanguageModes, WorkspaceFolder, TextDocument, CompletionList, CompletionItemKind, ClientCapabilities} from '../modes/languageModes'; export interface ItemDescription { label: string; documentation?: string; diff --git a/extensions/html-language-features/server/src/test/embedded.test.ts b/extensions/html-language-features/server/src/test/embedded.test.ts index 4191cfcb9b5f0..525d5a59c1129 100644 --- a/extensions/html-language-features/server/src/test/embedded.test.ts +++ b/extensions/html-language-features/server/src/test/embedded.test.ts @@ -5,31 +5,32 @@ import 'mocha'; import * as assert from 'assert'; import * as embeddedSupport from '../modes/embeddedSupport'; -import { getLanguageService, TextDocument } from 'vscode-html-languageservice'; +import { getLanguageService } from 'vscode-html-languageservice'; +import { TextDocument } from '../modes/languageModes'; suite('HTML Embedded Support', () => { - var htmlLanguageService = getLanguageService(); + const htmlLanguageService = getLanguageService(); function assertLanguageId(value: string, expectedLanguageId: string | undefined): void { - let offset = value.indexOf('|'); + const offset = value.indexOf('|'); value = value.substr(0, offset) + value.substr(offset + 1); - let document = TextDocument.create('test://test/test.html', 'html', 0, value); + const document = TextDocument.create('test://test/test.html', 'html', 0, value); - let position = document.positionAt(offset); + const position = document.positionAt(offset); - let docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document); - let languageId = docRegions.getLanguageAtPosition(position); + const docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document); + const languageId = docRegions.getLanguageAtPosition(position); assert.equal(languageId, expectedLanguageId); } function assertEmbeddedLanguageContent(value: string, languageId: string, expectedContent: string): void { - let document = TextDocument.create('test://test/test.html', 'html', 0, value); + const document = TextDocument.create('test://test/test.html', 'html', 0, value); - let docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document); - let content = docRegions.getEmbeddedDocument(languageId); + const docRegions = embeddedSupport.getDocumentRegions(htmlLanguageService, document); + const content = docRegions.getEmbeddedDocument(languageId); assert.equal(content.getText(), expectedContent); } diff --git a/extensions/html-language-features/server/src/test/folding.test.ts b/extensions/html-language-features/server/src/test/folding.test.ts index f732a6cd72c9a..c86f3e40f981e 100644 --- a/extensions/html-language-features/server/src/test/folding.test.ts +++ b/extensions/html-language-features/server/src/test/folding.test.ts @@ -5,9 +5,8 @@ import 'mocha'; import * as assert from 'assert'; -import { TextDocument } from 'vscode-html-languageservice'; import { getFoldingRanges } from '../modes/htmlFolding'; -import { getLanguageModes } from '../modes/languageModes'; +import { TextDocument, getLanguageModes } from '../modes/languageModes'; import { ClientCapabilities } from 'vscode-css-languageservice'; interface ExpectedIndentRange { @@ -17,13 +16,13 @@ interface ExpectedIndentRange { } function assertRanges(lines: string[], expected: ExpectedIndentRange[], message?: string, nRanges?: number): void { - let document = TextDocument.create('test://foo/bar.json', 'json', 1, lines.join('\n')); - let workspace = { + const document = TextDocument.create('test://foo/bar.html', 'html', 1, lines.join('\n')); + const workspace = { settings: {}, folders: [{ name: 'foo', uri: 'test://foo' }] }; - let languageModes = getLanguageModes({ css: true, javascript: true }, workspace, ClientCapabilities.LATEST); - let actual = getFoldingRanges(languageModes, document, nRanges, null); + const languageModes = getLanguageModes({ css: true, javascript: true }, workspace, ClientCapabilities.LATEST); + const actual = getFoldingRanges(languageModes, document, nRanges, null); let actualRanges = []; for (let i = 0; i < actual.length; i++) { @@ -40,7 +39,7 @@ function r(startLine: number, endLine: number, kind?: string): ExpectedIndentRan suite('HTML Folding', () => { test('Embedded JavaScript', () => { - let input = [ + const input = [ /*0*/'', /*1*/'', /*2*/'', [ + [48, '1'], + [48, '1+2'], + [47, '(1+2)'], + [47, '(1+2)*6'], + [46, '((1+2)*6)'], + [39, 'return ((1+2)*6)'], + [22, 'function foo() { return ((1+2)*6) }'], + [20, ' function foo() { return ((1+2)*6) }'], + [12, ''], + [6, ''], + [0, ''], + ]); + }); + + test('Embedded CSS', () => { + assertRanges('', [ + [34, 'none'], + [25, 'display: none'], + [24, ' display: none; '], + [23, '{ display: none; }'], + [19, 'foo { display: none; }'], + [19, 'foo { display: none; } '], + [12, ''], + [6, ''], + [0, ''], + ]); + }); + + test('Embedded style', () => { + assertRanges('
', [ + [19, 'red'], + [12, 'color: red'], + [11, '"color: red"'], + [5, 'style="color: red"'], + [1, 'div style="color: red"'], + [0, '
'] + ]); + }); + + +}); diff --git a/extensions/html-language-features/server/src/test/semanticTokens.test.ts b/extensions/html-language-features/server/src/test/semanticTokens.test.ts new file mode 100644 index 0000000000000..ea3777e84e90b --- /dev/null +++ b/extensions/html-language-features/server/src/test/semanticTokens.test.ts @@ -0,0 +1,227 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import 'mocha'; +import * as assert from 'assert'; +import { TextDocument, getLanguageModes, ClientCapabilities, Range, Position } from '../modes/languageModes'; +import { newSemanticTokenProvider } from '../modes/semanticTokens'; + +interface ExpectedToken { + startLine: number; + character: number; + length: number; + tokenClassifiction: string; +} + +function assertTokens(lines: string[], expected: ExpectedToken[], ranges?: Range[], message?: string): void { + const document = TextDocument.create('test://foo/bar.html', 'html', 1, lines.join('\n')); + const workspace = { + settings: {}, + folders: [{ name: 'foo', uri: 'test://foo' }] + }; + const languageModes = getLanguageModes({ css: true, javascript: true }, workspace, ClientCapabilities.LATEST); + const semanticTokensProvider = newSemanticTokenProvider(languageModes); + + const legend = semanticTokensProvider.legend; + const actual = semanticTokensProvider.getSemanticTokens(document, ranges); + + let actualRanges = []; + let lastLine = 0; + let lastCharacter = 0; + for (let i = 0; i < actual.length; i += 5) { + const lineDelta = actual[i], charDelta = actual[i + 1], len = actual[i + 2], typeIdx = actual[i + 3], modSet = actual[i + 4]; + const line = lastLine + lineDelta; + const character = lineDelta === 0 ? lastCharacter + charDelta : charDelta; + const tokenClassifiction = [legend.types[typeIdx], ...legend.modifiers.filter((_, i) => modSet & 1 << i)].join('.'); + actualRanges.push(t(line, character, len, tokenClassifiction)); + lastLine = line; + lastCharacter = character; + } + assert.deepEqual(actualRanges, expected, message); +} + +function t(startLine: number, character: number, length: number, tokenClassifiction: string): ExpectedToken { + return { startLine, character, length, tokenClassifiction }; +} + +suite('HTML Semantic Tokens', () => { + + test('Variables', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*10*/'', + /*11*/'', + ]; + assertTokens(input, [ + t(3, 6, 1, 'variable.declaration'), t(3, 13, 2, 'variable.declaration'), t(3, 19, 1, 'variable'), + t(5, 15, 1, 'variable.declaration.readonly'), t(5, 20, 2, 'variable'), t(5, 26, 1, 'variable'), t(5, 30, 1, 'variable.readonly'), + t(6, 11, 1, 'variable.declaration'), + t(7, 10, 2, 'variable') + ]); + }); + + test('Functions', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*8*/'', + /*9*/'', + ]; + assertTokens(input, [ + t(3, 11, 3, 'function.declaration'), t(3, 15, 2, 'parameter.declaration'), + t(4, 11, 3, 'function'), t(4, 15, 4, 'interface'), t(4, 20, 3, 'member'), t(4, 24, 2, 'parameter'), + t(6, 6, 6, 'variable'), t(6, 13, 8, 'property'), t(6, 24, 5, 'member'), t(6, 35, 7, 'member'), t(6, 43, 1, 'parameter.declaration'), t(6, 48, 3, 'function'), t(6, 52, 1, 'parameter') + ]); + }); + + test('Members', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*12*/'', + /*13*/'', + ]; + + + assertTokens(input, [ + t(3, 8, 1, 'class.declaration'), + t(4, 11, 1, 'property.declaration.static'), + t(5, 4, 1, 'property.declaration'), + t(6, 10, 1, 'member.declaration.async'), t(6, 23, 1, 'class'), t(6, 25, 1, 'property.static'), t(6, 40, 1, 'member.async'), + t(7, 8, 1, 'property.declaration'), t(7, 26, 1, 'property'), + t(8, 11, 1, 'member.declaration.static'), t(8, 28, 1, 'class'), t(8, 32, 1, 'property'), + ]); + }); + + test('Interfaces', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*7*/'', + /*8*/'', + ]; + assertTokens(input, [ + t(3, 12, 8, 'interface.declaration'), t(3, 23, 1, 'property.declaration'), t(3, 34, 1, 'property.declaration'), + t(4, 8, 1, 'variable.declaration.readonly'), t(4, 30, 8, 'interface'), + t(5, 8, 3, 'variable.declaration.readonly'), t(5, 15, 1, 'parameter.declaration'), t(5, 18, 8, 'interface'), t(5, 31, 1, 'parameter'), t(5, 33, 1, 'property'), t(5, 37, 1, 'parameter'), t(5, 39, 1, 'property') + ]); + }); + + test('Readonly', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*8*/'', + /*9*/'', + ]; + assertTokens(input, [ + t(3, 8, 1, 'variable.declaration.readonly'), + t(4, 8, 1, 'class.declaration'), t(4, 28, 1, 'property.declaration.static.readonly'), t(4, 42, 3, 'property.declaration.static'), t(4, 47, 3, 'interface'), + t(5, 13, 1, 'enum.declaration'), t(5, 17, 1, 'property.declaration.readonly'), t(5, 24, 1, 'property.declaration.readonly'), t(5, 28, 1, 'property.readonly'), + t(6, 2, 7, 'variable'), t(6, 10, 3, 'member'), t(6, 14, 1, 'variable.readonly'), t(6, 18, 1, 'class'), t(6, 20, 1, 'property.static.readonly'), t(6, 24, 1, 'class'), t(6, 26, 3, 'property.static'), t(6, 30, 6, 'property.readonly'), + ]); + }); + + + test('Type aliases and type parameters', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*8*/'', + /*9*/'', + ]; + assertTokens(input, [ + t(3, 7, 5, 'type.declaration'), t(3, 15, 3, 'interface') /* to investiagte */, + t(4, 11, 1, 'function.declaration'), t(4, 13, 1, 'typeParameter.declaration'), t(4, 23, 5, 'type'), t(4, 30, 1, 'parameter.declaration'), t(4, 33, 1, 'typeParameter'), t(4, 47, 1, 'typeParameter'), + t(5, 12, 1, 'typeParameter'), t(5, 29, 3, 'interface'), t(5, 41, 5, 'type'), + ]); + }); + + test('TS and JS', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*5*/'', + /*8*/'', + /*9*/'', + ]; + assertTokens(input, [ + t(3, 11, 1, 'function.declaration'), t(3, 13, 1, 'typeParameter.declaration'), t(3, 16, 2, 'parameter.declaration'), t(3, 20, 1, 'typeParameter'), t(3, 24, 1, 'typeParameter'), t(3, 39, 2, 'parameter'), + t(6, 2, 6, 'variable'), t(6, 9, 5, 'member') + ]); + }); + + test('Ranges', () => { + const input = [ + /*0*/'', + /*1*/'', + /*2*/'', + /*5*/'', + /*8*/'', + /*9*/'', + ]; + assertTokens(input, [ + t(3, 2, 6, 'variable'), t(3, 9, 5, 'member') + ], [Range.create(Position.create(2, 0), Position.create(4, 0))]); + + assertTokens(input, [ + t(6, 2, 6, 'variable'), + ], [Range.create(Position.create(6, 2), Position.create(6, 8))]); + }); + + +}); + diff --git a/extensions/html-language-features/server/src/utils/documentContext.ts b/extensions/html-language-features/server/src/utils/documentContext.ts index 6c391064fae12..0f728860de84c 100644 --- a/extensions/html-language-features/server/src/utils/documentContext.ts +++ b/extensions/html-language-features/server/src/utils/documentContext.ts @@ -3,10 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DocumentContext } from 'vscode-html-languageservice'; +import { DocumentContext, WorkspaceFolder } from '../modes/languageModes'; import { endsWith, startsWith } from '../utils/strings'; import * as url from 'url'; -import { WorkspaceFolder } from 'vscode-languageserver'; export function getDocumentContext(documentUri: string, workspaceFolders: WorkspaceFolder[]): DocumentContext { function getRootFolder(): string | undefined { diff --git a/extensions/html-language-features/server/src/utils/positions.ts b/extensions/html-language-features/server/src/utils/positions.ts new file mode 100644 index 0000000000000..eefd7f61fd42f --- /dev/null +++ b/extensions/html-language-features/server/src/utils/positions.ts @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Position, Range } from '../modes/languageModes'; + +export function beforeOrSame(p1: Position, p2: Position) { + return p1.line < p2.line || p1.line === p2.line && p1.character <= p2.character; +} +export function insideRangeButNotSame(r1: Range, r2: Range) { + return beforeOrSame(r1.start, r2.start) && beforeOrSame(r2.end, r1.end) && !equalRange(r1, r2); +} +export function equalRange(r1: Range, r2: Range) { + return r1.start.line === r2.start.line && r1.start.character === r2.start.character && r1.end.line === r2.end.line && r1.end.character === r2.end.character; +} diff --git a/extensions/html-language-features/server/yarn.lock b/extensions/html-language-features/server/yarn.lock index f96dfc5df6203..b2659f1c92d54 100644 --- a/extensions/html-language-features/server/yarn.lock +++ b/extensions/html-language-features/server/yarn.lock @@ -34,6 +34,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -46,6 +54,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +binary-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" + integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -54,6 +67,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" @@ -78,6 +98,21 @@ charenc@~0.0.1: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= +chokidar@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.0.tgz#12c0714668c55800f659e262d4962a97faf554a6" + integrity sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.2.0" + optionalDependencies: + fsevents "~2.1.1" + cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -187,6 +222,13 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-up@3.0.0, find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -206,6 +248,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +fsevents@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" + integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -216,6 +263,13 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +glob-parent@~5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + glob@7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" @@ -228,10 +282,10 @@ glob@7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.4: - version "7.1.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" - integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -280,6 +334,13 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -300,11 +361,28 @@ is-date-object@^1.0.1: resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -385,10 +463,10 @@ mkdirp@0.5.1, mkdirp@~0.5.1: dependencies: minimist "0.0.8" -mocha-junit-reporter@^1.23.1: - version "1.23.1" - resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.1.tgz#ba11519c0b967f404e4123dd69bc4ba022ab0f12" - integrity sha512-qeDvKlZyAH2YJE1vhryvjUQ06t2hcnwwu4k5Ddwn0GQINhgEYFhlGM0DwYCVUHq5cuo32qAW6HDsTHt7zz99Ng== +mocha-junit-reporter@^1.23.3: + version "1.23.3" + resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.3.tgz#941e219dd759ed732f8641e165918aa8b167c981" + integrity sha512-ed8LqbRj1RxZfjt/oC9t12sfrWsjZ3gNnbhV1nuj9R/Jb5/P3Xb4duv2eCfCDMYH+fEu0mqca7m4wsiVjsxsvA== dependencies: debug "^2.2.0" md5 "^2.1.0" @@ -404,13 +482,14 @@ mocha-multi-reporters@^1.1.7: debug "^3.1.0" lodash "^4.16.4" -mocha@^6.1.4: - version "6.2.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.2.1.tgz#da941c99437da9bac412097859ff99543969f94c" - integrity sha512-VCcWkLHwk79NYQc8cxhkmI8IigTIhsCwZ6RTxQsqK6go4UvEhzJkYuHm8B2YtlSxcYq2fY+ucr4JBwoD6ci80A== +mocha@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.0.1.tgz#276186d35a4852f6249808c6dd4a1376cbf6c6ce" + integrity sha512-9eWmWTdHLXh72rGrdZjNbG3aa1/3NRPpul1z0D979QpEnFdCG0Q5tv834N+94QEN2cysfV72YocQ3fn87s70fg== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" + chokidar "3.3.0" debug "3.2.6" diff "3.5.0" escape-string-regexp "1.0.5" @@ -423,7 +502,7 @@ mocha@^6.1.4: minimatch "3.0.4" mkdirp "0.5.1" ms "2.1.1" - node-environment-flags "1.0.5" + node-environment-flags "1.0.6" object.assign "4.1.0" strip-json-comments "2.0.1" supports-color "6.0.0" @@ -448,14 +527,19 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -node-environment-flags@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" - integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== +node-environment-flags@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" + integrity sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw== dependencies: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + object-inspect@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" @@ -520,6 +604,18 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +picomatch@^2.0.4: + version "2.2.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a" + integrity sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA== + +readdirp@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.2.0.tgz#c30c33352b12c96dfb4b895421a49fd5a9593839" + integrity sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ== + dependencies: + picomatch "^2.0.4" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -611,66 +707,68 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.19: - version "4.0.3-next.19" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.19.tgz#b7dc58fb8d1968877724e163b6ef20b26c0b5ff6" - integrity sha512-wWSo2MZvd8aEI9lf/Asy0MP0Ao6xAzhBeEWxGcF+Ms/zcV4lDRkyFCNzwDt0OgWRzsBNaEBXfjeWLq9rNXkREA== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: - vscode-languageserver-textdocument "^1.0.0-next.4" - vscode-languageserver-types "^3.15.0-next.6" + is-number "^7.0.0" + +vscode-css-languageservice@^4.0.3-next.27: + version "4.0.3-next.27" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.27.tgz#04f52bfdd85ac7eed8d82a0133aaabb4c0e18f7f" + integrity sha512-MU8sHQABb1WnzOwgazIdO4lXG7cGzFKd7VKi5j67uWTNsqSrbAVSoKGjSyOLq/o6h1L5DGG1Og/7q403z6D04g== + dependencies: + vscode-languageserver-textdocument "^1.0.1-next.1" + vscode-languageserver-types "^3.15.1" vscode-nls "^4.1.1" vscode-uri "^2.1.1" -vscode-html-languageservice@^3.0.4-next.8: - version "3.0.4-next.8" - resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.8.tgz#b3df7b7e8f69c1bf76392c4fd4df4cf483e77e7d" - integrity sha512-gT34wzCwM1rCJzd0EAFnuVe0FaaSr3eXaJpYcMj6rt1UspIJYaL4WtDLCcw4eBL906N1b1Vu+sapiRmV5PjZpg== +vscode-html-languageservice@^3.0.4-next.14: + version "3.0.4-next.14" + resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-3.0.4-next.14.tgz#143cda8d1b032da3506de2ee7c352f50159edc7f" + integrity sha512-YQ1nYy3Yqai+mrvORFeJW1/CvkBd9y2kYDOvfTEmt5uCd7+7iMTQLdhPFWwlx/GKDXuvQJoJ0E3eNd/gGb3cvQ== dependencies: - vscode-languageserver-textdocument "^1.0.0-next.4" - vscode-languageserver-types "^3.15.0-next.6" + vscode-languageserver-textdocument "^1.0.1-next.1" + vscode-languageserver-types "^3.15.1" vscode-nls "^4.1.1" - vscode-uri "^2.0.3" + vscode-uri "^2.1.1" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.2: + version "3.15.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz#e52c62923140b2655ad2472f6f29cfb83bacf5b8" + integrity sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" -vscode-languageserver-textdocument@^1.0.0-next.4: - version "1.0.0-next.4" - resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.0-next.4.tgz#8f7afdfe3e81411f57baaa29bb3214d1907160cd" - integrity sha512-LJ5WfoBO54nqinjlLJKnjoo2Im4bIvPJ8bFT7R0C84ZI36iK8M29ddslfe5jUeWNSTtCda7YuKdKsDIq38HpgA== +vscode-languageserver-textdocument@^1.0.1-next.1: + version "1.0.1-next.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1-next.1.tgz#c8f2f792c7c88d33ea8441ca04bfb8376896b671" + integrity sha512-Cmt0KsNxouns+d7/Kw/jWtWU9Z3h56z1qAA8utjDOEqrDcrTs2rDXv3EJRa99nuKM3wVf6DbWym1VqL9q71XPA== -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== +vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== -vscode-languageserver@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.0.0-next.3.tgz#41e2fda6417939792f6a19fc19ecbb2f080e2072" - integrity sha512-Q6T+KwYuoXV9KRHD6x7RfTU13pV0xAX2BtcuvSC/LBCiVAnEIOe7jKZjzya+B9gDvSk4hpfvhPefy5IdQK1mpQ== +vscode-languageserver@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.1.0.tgz#f0ff149b06d1961f49ed03385ecc2a96bcaddcde" + integrity sha512-Q5kUJegYclTZMnKUaEcxJK41Ozp6qJhhoFJYj0w8y8j9JXdKT479LE945QCKRvSgWfsqTSUmgsozVTUIwQQxHw== dependencies: - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.2" vscode-nls@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A== -vscode-uri@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.0.3.tgz#25e5f37f552fbee3cec7e5f80cef8469cefc6543" - integrity sha512-4D3DI3F4uRy09WNtDGD93H9q034OHImxiIcSq664Hq1Y1AScehlP3qqZyTkX/RWxeu0MRMHGkrxYqm2qlDF/aw== - vscode-uri@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.1.tgz#5aa1803391b6ebdd17d047f51365cf62c38f6e90" diff --git a/extensions/html-language-features/yarn.lock b/extensions/html-language-features/yarn.lock index f3528ff867a47..e91ad63907deb 100644 --- a/extensions/html-language-features/yarn.lock +++ b/extensions/html-language-features/yarn.lock @@ -45,31 +45,31 @@ vscode-extension-telemetry@0.1.1: dependencies: applicationinsights "1.0.8" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageclient@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.0.0-next.3.tgz#41b701d963fc7affc01e9279532a747fcd4f3810" - integrity sha512-SuSaG9xjqkROm4Ie0jQig0CFDuU/WxHERegl3kRsFHDbhMSK4dH45ZeBY5zMWUgZ+LrIrEbwf8qWNlrTRBlUgg== +vscode-languageclient@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz#ee67c0b7818c42ce0281572d05c89adfcc4f5a38" + integrity sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA== dependencies: semver "^6.3.0" - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.2" -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.2: + version "3.15.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz#e52c62923140b2655ad2472f6f29cfb83bacf5b8" + integrity sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== +vscode-languageserver-types@3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== vscode-nls@^4.1.1: version "4.1.1" diff --git a/extensions/html/build/update-grammar.js b/extensions/html/build/update-grammar.js new file mode 100644 index 0000000000000..3277cb16ccafc --- /dev/null +++ b/extensions/html/build/update-grammar.js @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// @ts-check +'use strict'; + +var updateGrammar = require('../../../build/npm/update-grammar'); + +function patchGrammar(grammar) { + let patchCount = 0; + + let visit = function (rule, parent) { + if (rule.name === 'source.js' || rule.name === 'source.css') { + if (parent.parent && parent.parent.property === 'endCaptures') { + rule.name = rule.name + '-ignored-vscode'; + patchCount++; + } + } + for (let property in rule) { + let value = rule[property]; + if (typeof value === 'object') { + visit(value, { node: rule, property: property, parent: parent }); + } + } + }; + + let repository = grammar.repository; + for (let key in repository) { + visit(repository[key], { node: repository, property: key, parent: undefined }); + } + if (patchCount !== 6) { + console.warn(`Expected to patch 6 occurrences of source.js & source.css: Was ${patchCount}`); + } + + + return grammar; +} + +const tsGrammarRepo = 'textmate/html.tmbundle'; +const grammarPath = 'Syntaxes/HTML.plist'; +updateGrammar.update(tsGrammarRepo, grammarPath, './syntaxes/html.tmLanguage.json', grammar => patchGrammar(grammar)); + + diff --git a/extensions/html/package.json b/extensions/html/package.json index 1b28ff2e5eb1d..065eb26669bee 100644 --- a/extensions/html/package.json +++ b/extensions/html/package.json @@ -9,7 +9,7 @@ "vscode": "0.10.x" }, "scripts": { - "update-grammar": "node ../../build/npm/update-grammar.js textmate/html.tmbundle Syntaxes/HTML.plist ./syntaxes/html.tmLanguage.json Syntaxes/HTML%20%28Derivative%29.tmLanguage ./syntaxes/html-derivative.tmLanguage.json" + "update-grammar": "node ./build/update-grammar.js" }, "contributes": { "languages": [ diff --git a/extensions/html/syntaxes/html.tmLanguage.json b/extensions/html/syntaxes/html.tmLanguage.json index a071d90a9e319..1e1c85c899f05 100644 --- a/extensions/html/syntaxes/html.tmLanguage.json +++ b/extensions/html/syntaxes/html.tmLanguage.json @@ -108,7 +108,7 @@ "name": "punctuation.definition.string.end.html" }, "1": { - "name": "source.css" + "name": "source.css-ignored-vscode" } }, "name": "string.quoted.double.html", @@ -132,7 +132,7 @@ "name": "punctuation.definition.string.end.html" }, "1": { - "name": "source.css" + "name": "source.css-ignored-vscode" } }, "name": "string.quoted.single.html", @@ -207,7 +207,7 @@ "name": "punctuation.definition.string.end.html" }, "1": { - "name": "source.js" + "name": "source.js-ignored-vscode" } }, "name": "string.quoted.double.html", @@ -265,7 +265,7 @@ "name": "punctuation.definition.string.end.html" }, "1": { - "name": "source.js" + "name": "source.js-ignored-vscode" } }, "name": "string.quoted.single.html", @@ -1785,7 +1785,7 @@ "name": "punctuation.definition.tag.begin.html" }, "2": { - "name": "source.css" + "name": "source.css-ignored-vscode" }, "3": { "name": "entity.name.tag.html" @@ -1892,7 +1892,7 @@ "name": "punctuation.definition.tag.begin.html" }, "2": { - "name": "source.js" + "name": "source.js-ignored-vscode" } }, "patterns": [ diff --git a/extensions/html/test/colorize-fixtures/test-embedding.html b/extensions/html/test/colorize-fixtures/test-embedding.html new file mode 100644 index 0000000000000..87f92b6264ba4 --- /dev/null +++ b/extensions/html/test/colorize-fixtures/test-embedding.html @@ -0,0 +1,6 @@ + + + +
+
+
diff --git a/extensions/html/test/colorize-results/12750_html.json b/extensions/html/test/colorize-results/12750_html.json index c70c7afdb8bef..a4f0184b51c32 100644 --- a/extensions/html/test/colorize-results/12750_html.json +++ b/extensions/html/test/colorize-results/12750_html.json @@ -210,7 +210,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -397,7 +397,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/html/test/colorize-results/25920_html.json b/extensions/html/test/colorize-results/25920_html.json index 4f4b04e21f551..9aa58b607aac7 100644 --- a/extensions/html/test/colorize-results/25920_html.json +++ b/extensions/html/test/colorize-results/25920_html.json @@ -499,9 +499,9 @@ "t": "text.html.derivative meta.embedded.block.html source.js meta.var.expr.js constant.numeric.decimal.js", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -518,7 +518,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1011,4 +1011,4 @@ "hc_black": "punctuation.definition.tag: #808080" } } -] \ No newline at end of file +] diff --git a/extensions/html/test/colorize-results/test-embedding_html.json b/extensions/html/test/colorize-results/test-embedding_html.json new file mode 100644 index 0000000000000..1931950a02cae --- /dev/null +++ b/extensions/html/test/colorize-results/test-embedding_html.json @@ -0,0 +1,1003 @@ +[ + { + "c": "<", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "script", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "console", + "t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.class.console.js", + "r": { + "dark_plus": "support.class: #4EC9B0", + "light_plus": "support.class: #267F99", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "support.class: #4EC9B0" + } + }, + { + "c": ".", + "t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js punctuation.accessor.js", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "log", + "t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.function.console.js", + "r": { + "dark_plus": "support.function: #DCDCAA", + "light_plus": "support.function: #795E26", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "support.function: #DCDCAA" + } + }, + { + "c": "(", + "t": "text.html.derivative meta.embedded.block.html source.js meta.brace.round.js", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.embedded.block.html source.js string.quoted.single.js punctuation.definition.string.begin.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "x", + "t": "text.html.derivative meta.embedded.block.html source.js string.quoted.single.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.embedded.block.html source.js string.quoted.single.js punctuation.definition.string.end.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": ")", + "t": "text.html.derivative meta.embedded.block.html source.js meta.brace.round.js", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "/", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "script", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "style", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "test", + "t": "text.html.derivative meta.embedded.block.html source.css meta.selector.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.embedded.block.html source.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "{", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css punctuation.section.property-list.begin.bracket.curly.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "display", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css meta.property-name.css support.type.property-name.css", + "r": { + "dark_plus": "support.type.property-name: #9CDCFE", + "light_plus": "support.type.property-name: #FF0000", + "dark_vs": "support.type.property-name: #9CDCFE", + "light_vs": "support.type.property-name: #FF0000", + "hc_black": "support.type.property-name: #D4D4D4" + } + }, + { + "c": ":", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css punctuation.separator.key-value.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "none", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css meta.property-value.css support.constant.property-value.css", + "r": { + "dark_plus": "support.constant.property-value: #CE9178", + "light_plus": "support.constant.property-value: #0451A5", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "support.constant.property-value: #0451A5", + "hc_black": "support.constant.property-value: #CE9178" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "}", + "t": "text.html.derivative meta.embedded.block.html source.css meta.property-list.css punctuation.section.property-list.end.bracket.curly.css", + "r": { + "dark_plus": "meta.embedded: #D4D4D4", + "light_plus": "meta.embedded: #000000", + "dark_vs": "meta.embedded: #D4D4D4", + "light_vs": "meta.embedded: #000000", + "hc_black": "meta.embedded: #FFFFFF" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css-ignored-vscode", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "/", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "style", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.tag.inline.a.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "a", + "t": "text.html.derivative meta.tag.inline.a.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.inline.a.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "onblur", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "\"", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html meta.embedded.line.js string.quoted.double.html punctuation.definition.string.begin.html", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "doBlur", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html meta.embedded.line.js string.quoted.double.html source.js meta.function-call.js entity.name.function.js", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "()", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html meta.embedded.line.js string.quoted.double.html source.js meta.brace.round.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "\"", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.blur.html meta.embedded.line.js string.quoted.double.html punctuation.definition.string.end.html source.js-ignored-vscode", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.inline.a.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "onclick", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.single.html punctuation.definition.string.begin.html", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "doClick", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.single.html source.js meta.function-call.js entity.name.function.js", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "()", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.single.html source.js meta.brace.round.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.single.html punctuation.definition.string.end.html source.js-ignored-vscode", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.inline.a.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "ondrag", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.drag.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.drag.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "doDrag", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.drag.html meta.embedded.line.js string.unquoted.html meta.function-call.js entity.name.function.js", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "string: #CE9178", + "light_vs": "string.unquoted.html: #0000FF", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "()", + "t": "text.html.derivative meta.tag.inline.a.start.html meta.attribute.event-handler.drag.html meta.embedded.line.js string.unquoted.html meta.brace.round.js", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.unquoted.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.unquoted.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.tag.inline.a.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "", + "t": "text.html.derivative meta.tag.inline.a.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "div", + "t": "text.html.derivative meta.tag.structure.div.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.structure.div.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "style", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "\"", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.double.html punctuation.definition.string.begin.html", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "x { }", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.double.html source.css", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "\"", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.double.html punctuation.definition.string.end.html source.css-ignored-vscode", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.double.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.double.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "", + "t": "text.html.derivative meta.tag.structure.div.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "div", + "t": "text.html.derivative meta.tag.structure.div.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.structure.div.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "style", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.single.html punctuation.definition.string.begin.html", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "y { }", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.single.html source.css", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": "'", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.quoted.single.html punctuation.definition.string.end.html source.css-ignored-vscode", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.quoted.single.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.quoted.single.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "", + "t": "text.html.derivative meta.tag.structure.div.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "div", + "t": "text.html.derivative meta.tag.structure.div.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": " ", + "t": "text.html.derivative meta.tag.structure.div.start.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "style", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": "=", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html punctuation.separator.key-value.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "z{}", + "t": "text.html.derivative meta.tag.structure.div.start.html meta.attribute.style.html meta.embedded.line.css string.unquoted.html source.css", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string.unquoted.html: #0000FF", + "dark_vs": "string: #CE9178", + "light_vs": "string.unquoted.html: #0000FF", + "hc_black": "string: #CE9178" + } + }, + { + "c": ">", + "t": "text.html.derivative meta.tag.structure.div.start.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "", + "t": "text.html.derivative meta.tag.structure.div.end.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + } +] \ No newline at end of file diff --git a/extensions/html/test/colorize-results/test_html.json b/extensions/html/test/colorize-results/test_html.json index 970d4214a7419..dd8a4aa2043c1 100644 --- a/extensions/html/test/colorize-results/test_html.json +++ b/extensions/html/test/colorize-results/test_html.json @@ -782,7 +782,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1200,7 +1200,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1354,7 +1354,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2212,7 +2212,7 @@ }, { "c": "<", - "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.derivative meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3189,4 +3189,4 @@ "hc_black": "punctuation.definition.tag: #808080" } } -] +] \ No newline at end of file diff --git a/extensions/image-preview/README.md b/extensions/image-preview/README.md index ccb5ac3954af6..d3f0bd6cb6c64 100644 --- a/extensions/image-preview/README.md +++ b/extensions/image-preview/README.md @@ -13,5 +13,4 @@ Supported image formats: - `*.bmp` - `*.gif` - `*.ico` -- `*.tga` - `*.webp` diff --git a/extensions/image-preview/media/main.css b/extensions/image-preview/media/main.css index ff3e6d0f0d2e3..49a01b8d9694b 100644 --- a/extensions/image-preview/media/main.css +++ b/extensions/image-preview/media/main.css @@ -94,16 +94,16 @@ body img { } .loading-indicator, -.image-load-error-message { +.image-load-error { display: none; } .loading .loading-indicator, -.error .image-load-error-message { +.error .image-load-error { display: block; } -.image-load-error-message { +.image-load-error { margin: 1em; } diff --git a/extensions/image-preview/media/main.js b/extensions/image-preview/media/main.js index bc1e25a4bdf61..394511aa8ef8d 100644 --- a/extensions/image-preview/media/main.js +++ b/extensions/image-preview/media/main.js @@ -303,7 +303,13 @@ document.body.classList.remove('loading'); }); - image.src = decodeURI(settings.src); + image.src = settings.src; + + document.querySelector('.open-file-link').addEventListener('click', () => { + vscode.postMessage({ + type: 'reopen-as-text', + }); + }); window.addEventListener('message', e => { switch (e.data.type) { diff --git a/extensions/image-preview/package.json b/extensions/image-preview/package.json index 1ad08ffa55e9d..a0664f98e3d5a 100644 --- a/extensions/image-preview/package.json +++ b/extensions/image-preview/package.json @@ -2,7 +2,7 @@ "name": "image-preview", "displayName": "%displayName%", "description": "%description%", - "extensionKind": "ui", + "extensionKind": ["ui", "workspace"], "version": "1.0.0", "publisher": "vscode", "icon": "icon.png", @@ -29,8 +29,7 @@ "priority": "builtin", "selector": [ { - "filenamePattern": "*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp}", - "mime": "image/*" + "filenamePattern": "*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp}" } ] } @@ -45,11 +44,6 @@ "command": "imagePreview.zoomOut", "title": "%command.zoomOut%", "category": "Image Preview" - }, - { - "command": "imagePreview.testing.makeEdit", - "title": "Make test edit", - "category": "Image Preview" } ], "menus": { @@ -63,11 +57,6 @@ "command": "imagePreview.zoomOut", "when": "imagePreviewFocus", "group": "1_imagePreview" - }, - { - "command": "imagePreview.testing.makeEdit", - "when": "imagePreviewTestMode", - "group": "1_imagePreview" } ] } diff --git a/extensions/image-preview/src/binarySizeStatusBarEntry.ts b/extensions/image-preview/src/binarySizeStatusBarEntry.ts new file mode 100644 index 0000000000000..0c983d37cd216 --- /dev/null +++ b/extensions/image-preview/src/binarySizeStatusBarEntry.ts @@ -0,0 +1,57 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as nls from 'vscode-nls'; +import { PreviewStatusBarEntry } from './ownedStatusBarEntry'; + +const localize = nls.loadMessageBundle(); + +class BinarySize { + static readonly KB = 1024; + static readonly MB = BinarySize.KB * BinarySize.KB; + static readonly GB = BinarySize.MB * BinarySize.KB; + static readonly TB = BinarySize.GB * BinarySize.KB; + + static formatSize(size: number): string { + if (size < BinarySize.KB) { + return localize('sizeB', "{0}B", size); + } + + if (size < BinarySize.MB) { + return localize('sizeKB', "{0}KB", (size / BinarySize.KB).toFixed(2)); + } + + if (size < BinarySize.GB) { + return localize('sizeMB', "{0}MB", (size / BinarySize.MB).toFixed(2)); + } + + if (size < BinarySize.TB) { + return localize('sizeGB', "{0}GB", (size / BinarySize.GB).toFixed(2)); + } + + return localize('sizeTB', "{0}TB", (size / BinarySize.TB).toFixed(2)); + } +} + +export class BinarySizeStatusBarEntry extends PreviewStatusBarEntry { + + constructor() { + super({ + id: 'imagePreview.binarySize', + name: localize('sizeStatusBar.name', "Image Binary Size"), + alignment: vscode.StatusBarAlignment.Right, + priority: 100, + }); + } + + public show(owner: string, size: number | undefined) { + if (typeof size === 'number') { + super.showItem(owner, BinarySize.formatSize(size)); + } else { + this.hide(owner); + } + } +} diff --git a/extensions/image-preview/src/extension.ts b/extensions/image-preview/src/extension.ts index 49563c75ee561..dc0d5c3395690 100644 --- a/extensions/image-preview/src/extension.ts +++ b/extensions/image-preview/src/extension.ts @@ -6,6 +6,7 @@ import * as vscode from 'vscode'; import { PreviewManager } from './preview'; import { SizeStatusBarEntry } from './sizeStatusBarEntry'; +import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry'; import { ZoomStatusBarEntry } from './zoomStatusBarEntry'; export function activate(context: vscode.ExtensionContext) { @@ -14,18 +15,15 @@ export function activate(context: vscode.ExtensionContext) { const sizeStatusBarEntry = new SizeStatusBarEntry(); context.subscriptions.push(sizeStatusBarEntry); + const binarySizeStatusBarEntry = new BinarySizeStatusBarEntry(); + context.subscriptions.push(binarySizeStatusBarEntry); + const zoomStatusBarEntry = new ZoomStatusBarEntry(); context.subscriptions.push(zoomStatusBarEntry); - const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, zoomStatusBarEntry); + const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, binarySizeStatusBarEntry, zoomStatusBarEntry); - context.subscriptions.push(vscode.window.registerWebviewEditorProvider( - PreviewManager.viewType, - { - async resolveWebviewEditor({ resource }, editor: vscode.WebviewPanel): Promise { - return previewManager.resolve(resource, editor); - } - })); + context.subscriptions.push(vscode.window.registerWebviewCustomEditorProvider(PreviewManager.viewType, previewManager)); context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomIn', () => { previewManager.activePreview?.zoomIn(); @@ -34,20 +32,5 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomOut', () => { previewManager.activePreview?.zoomOut(); })); - - context.subscriptions.push(vscode.commands.registerCommand('imagePreview.testing.makeEdit', () => { - previewManager.activePreview?.test_makeEdit(); - })); - - context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => { - if (e.affectsConfiguration('imagePreview.customEditorTestMode')) { - updateTestMode(); - } - })); - updateTestMode(); } -function updateTestMode() { - const isInTestMode = vscode.workspace.getConfiguration('imagePreview').get('customEditorTestMode', false); - vscode.commands.executeCommand('setContext', 'imagePreviewTestMode', isInTestMode); -} diff --git a/extensions/image-preview/src/ownedStatusBarEntry.ts b/extensions/image-preview/src/ownedStatusBarEntry.ts new file mode 100644 index 0000000000000..7be0ec30f7178 --- /dev/null +++ b/extensions/image-preview/src/ownedStatusBarEntry.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { Disposable } from './dispose'; + +export abstract class PreviewStatusBarEntry extends Disposable { + private _showOwner: string | undefined; + + protected readonly entry: vscode.StatusBarItem; + + constructor(options: vscode.window.StatusBarItemOptions) { + super(); + this.entry = this._register(vscode.window.createStatusBarItem(options)); + } + + protected showItem(owner: string, text: string) { + this._showOwner = owner; + this.entry.text = text; + this.entry.show(); + } + + public hide(owner: string) { + if (owner === this._showOwner) { + this.entry.hide(); + this._showOwner = undefined; + } + } +} diff --git a/extensions/image-preview/src/preview.ts b/extensions/image-preview/src/preview.ts index 8aa6d1fe395d7..5e733b13cc230 100644 --- a/extensions/image-preview/src/preview.ts +++ b/extensions/image-preview/src/preview.ts @@ -8,11 +8,12 @@ import * as nls from 'vscode-nls'; import { Disposable } from './dispose'; import { SizeStatusBarEntry } from './sizeStatusBarEntry'; import { Scale, ZoomStatusBarEntry } from './zoomStatusBarEntry'; +import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry'; const localize = nls.loadMessageBundle(); -export class PreviewManager { +export class PreviewManager implements vscode.WebviewCustomEditorProvider { public static readonly viewType = 'imagePreview.previewEditor'; @@ -22,14 +23,15 @@ export class PreviewManager { constructor( private readonly extensionRoot: vscode.Uri, private readonly sizeStatusBarEntry: SizeStatusBarEntry, + private readonly binarySizeStatusBarEntry: BinarySizeStatusBarEntry, private readonly zoomStatusBarEntry: ZoomStatusBarEntry, ) { } - public resolve( + public async resolveWebviewEditor( resource: vscode.Uri, webviewEditor: vscode.WebviewPanel, - ): vscode.WebviewEditorCapabilities { - const preview = new Preview(this.extensionRoot, resource, webviewEditor, this.sizeStatusBarEntry, this.zoomStatusBarEntry); + ): Promise { + const preview = new Preview(this.extensionRoot, resource, webviewEditor, this.sizeStatusBarEntry, this.binarySizeStatusBarEntry, this.zoomStatusBarEntry); this._previews.add(preview); this.setActivePreview(preview); @@ -42,10 +44,6 @@ export class PreviewManager { this.setActivePreview(undefined); } }); - - return { - editingCapability: preview - }; } public get activePreview() { return this._activePreview; } @@ -66,19 +64,23 @@ const enum PreviewState { Active, } -class Preview extends Disposable implements vscode.WebviewEditorEditingCapability { +class Preview extends Disposable { private readonly id: string = `${Date.now()}-${Math.random().toString()}`; private _previewState = PreviewState.Visible; private _imageSize: string | undefined; + private _imageBinarySize: number | undefined; private _imageZoom: Scale | undefined; + private readonly emptyPngDataUri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg=='; + constructor( private readonly extensionRoot: vscode.Uri, private readonly resource: vscode.Uri, private readonly webviewEditor: vscode.WebviewPanel, private readonly sizeStatusBarEntry: SizeStatusBarEntry, + private readonly binarySizeStatusBarEntry: BinarySizeStatusBarEntry, private readonly zoomStatusBarEntry: ZoomStatusBarEntry, ) { super(); @@ -108,6 +110,12 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit this.update(); break; } + + case 'reopen-as-text': + { + vscode.commands.executeCommand('vscode.openWith', resource, 'default', webviewEditor.viewColumn); + break; + } } })); @@ -125,6 +133,7 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit this._register(webviewEditor.onDidDispose(() => { if (this._previewState === PreviewState.Active) { this.sizeStatusBarEntry.hide(this.id); + this.binarySizeStatusBarEntry.hide(this.id); this.zoomStatusBarEntry.hide(this.id); } this._previewState = PreviewState.Disposed; @@ -142,6 +151,11 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit } })); + vscode.workspace.fs.stat(resource).then(({ size }) => { + this._imageBinarySize = size; + this.update(); + }); + this.render(); this.update(); this.webviewEditor.webview.postMessage({ type: 'setActive', value: this.webviewEditor.active }); @@ -159,9 +173,9 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit } } - private render() { + private async render() { if (this._previewState !== PreviewState.Disposed) { - this.webviewEditor.webview.html = this.getWebiewContents(); + this.webviewEditor.webview.html = await this.getWebiewContents(); } } @@ -173,21 +187,23 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit if (this.webviewEditor.active) { this._previewState = PreviewState.Active; this.sizeStatusBarEntry.show(this.id, this._imageSize || ''); + this.binarySizeStatusBarEntry.show(this.id, this._imageBinarySize); this.zoomStatusBarEntry.show(this.id, this._imageZoom || 'fit'); } else { if (this._previewState === PreviewState.Active) { this.sizeStatusBarEntry.hide(this.id); + this.binarySizeStatusBarEntry.hide(this.id); this.zoomStatusBarEntry.hide(this.id); } this._previewState = PreviewState.Visible; } } - private getWebiewContents(): string { + private async getWebiewContents(): Promise { const version = Date.now().toString(); const settings = { isMac: process.platform === 'darwin', - src: this.getResourcePath(this.webviewEditor, this.resource, version), + src: await this.getResourcePath(this.webviewEditor, this.resource, version), }; const nonce = Date.now().toString(); @@ -210,28 +226,28 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit
-
${localize('preview.imageLoadError', "An error occurred while loading the image")}
+
+

${localize('preview.imageLoadError', "An error occurred while loading the image.")}

+ ${localize('preview.imageLoadErrorLink', "Open file using VS Code's standard text/binary editor?")} +
`; } - private getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string) { - switch (resource.scheme) { - case 'data': - return encodeURI(resource.toString(true)); - - case 'git': - // Show blank image - return encodeURI('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg=='); - - default: - // Avoid adding cache busting if there is already a query string - if (resource.query) { - return encodeURI(webviewEditor.webview.asWebviewUri(resource).toString(true)); - } - return encodeURI(webviewEditor.webview.asWebviewUri(resource).toString(true) + `?version=${version}`); + private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise { + if (resource.scheme === 'git') { + const stat = await vscode.workspace.fs.stat(resource); + if (stat.size === 0) { + return this.emptyPngDataUri; + } } + + // Avoid adding cache busting if there is already a query string + if (resource.query) { + return webviewEditor.webview.asWebviewUri(resource).toString(true); + } + return webviewEditor.webview.asWebviewUri(resource).with({ query: `version=${version}` }).toString(true); } private extensionResource(path: string) { @@ -239,24 +255,6 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit path: this.extensionRoot.path + path })); } - - //#region WebviewEditorCapabilities - private readonly _onEdit = this._register(new vscode.EventEmitter<{ now: number }>()); - public readonly onEdit = this._onEdit.event; - - async save() { } - - async hotExit() { } - - async applyEdits(_edits: any[]) { } - - async undoEdits(edits: any[]) { console.log('undo', edits); } - - //#endregion - - public test_makeEdit() { - this._onEdit.fire({ now: Date.now() }); - } } function escapeAttribute(value: string | vscode.Uri): string { diff --git a/extensions/image-preview/src/sizeStatusBarEntry.ts b/extensions/image-preview/src/sizeStatusBarEntry.ts index 6b2bff746cfdc..e74eea0fe6032 100644 --- a/extensions/image-preview/src/sizeStatusBarEntry.ts +++ b/extensions/image-preview/src/sizeStatusBarEntry.ts @@ -4,36 +4,23 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { Disposable } from './dispose'; import * as nls from 'vscode-nls'; +import { PreviewStatusBarEntry } from './ownedStatusBarEntry'; const localize = nls.loadMessageBundle(); -export class SizeStatusBarEntry extends Disposable { - private readonly _entry: vscode.StatusBarItem; - - private _showingOwner: string | undefined; +export class SizeStatusBarEntry extends PreviewStatusBarEntry { constructor() { - super(); - this._entry = this._register(vscode.window.createStatusBarItem({ + super({ id: 'imagePreview.size', name: localize('sizeStatusBar.name', "Image Size"), alignment: vscode.StatusBarAlignment.Right, priority: 101 /* to the left of editor status (100) */, - })); + }); } public show(owner: string, text: string) { - this._showingOwner = owner; - this._entry.text = text; - this._entry.show(); - } - - public hide(owner: string) { - if (owner === this._showingOwner) { - this._entry.hide(); - this._showingOwner = undefined; - } + this.showItem(owner, text); } } diff --git a/extensions/image-preview/src/zoomStatusBarEntry.ts b/extensions/image-preview/src/zoomStatusBarEntry.ts index dc102a48d6498..18adc19d6d2bc 100644 --- a/extensions/image-preview/src/zoomStatusBarEntry.ts +++ b/extensions/image-preview/src/zoomStatusBarEntry.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import { Disposable } from './dispose'; +import { PreviewStatusBarEntry as OwnedStatusBarEntry } from './ownedStatusBarEntry'; const localize = nls.loadMessageBundle(); @@ -13,22 +13,18 @@ const selectZoomLevelCommandId = '_imagePreview.selectZoomLevel'; export type Scale = number | 'fit'; -export class ZoomStatusBarEntry extends Disposable { - private readonly _entry: vscode.StatusBarItem; +export class ZoomStatusBarEntry extends OwnedStatusBarEntry { private readonly _onDidChangeScale = this._register(new vscode.EventEmitter<{ scale: Scale }>()); public readonly onDidChangeScale = this._onDidChangeScale.event; - private _showOwner: string | undefined; - constructor() { - super(); - this._entry = this._register(vscode.window.createStatusBarItem({ + super({ id: 'imagePreview.zoom', name: localize('zoomStatusBar.name', "Image Zoom"), alignment: vscode.StatusBarAlignment.Right, priority: 102 /* to the left of editor size entry (101) */, - })); + }); this._register(vscode.commands.registerCommand(selectZoomLevelCommandId, async () => { type MyPickItem = vscode.QuickPickItem & { scale: Scale }; @@ -47,20 +43,11 @@ export class ZoomStatusBarEntry extends Disposable { } })); - this._entry.command = selectZoomLevelCommandId; + this.entry.command = selectZoomLevelCommandId; } public show(owner: string, scale: Scale) { - this._showOwner = owner; - this._entry.text = this.zoomLabel(scale); - this._entry.show(); - } - - public hide(owner: string) { - if (owner === this._showOwner) { - this._entry.hide(); - this._showOwner = undefined; - } + this.showItem(owner, this.zoomLabel(scale)); } private zoomLabel(scale: Scale): string { diff --git a/extensions/ini/ini.language-configuration.json b/extensions/ini/ini.language-configuration.json index 93cfa1ce3b9d2..c688aee426d69 100644 --- a/extensions/ini/ini.language-configuration.json +++ b/extensions/ini/ini.language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -22,4 +22,4 @@ ["\"", "\""], ["'", "'"] ] -} \ No newline at end of file +} diff --git a/extensions/ini/properties.language-configuration.json b/extensions/ini/properties.language-configuration.json index 85b401f07676c..7dd2e4ebe2e81 100644 --- a/extensions/ini/properties.language-configuration.json +++ b/extensions/ini/properties.language-configuration.json @@ -12,7 +12,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -21,4 +21,4 @@ ["\"", "\""], ["'", "'"] ] -} \ No newline at end of file +} diff --git a/extensions/jake/src/main.ts b/extensions/jake/src/main.ts index b8c6d5e734446..93fa1aa285b8d 100644 --- a/extensions/jake/src/main.ts +++ b/extensions/jake/src/main.ts @@ -269,7 +269,7 @@ class TaskDetector { private updateProvider(): void { if (!this.taskProvider && this.detectors.size > 0) { const thisCapture = this; - this.taskProvider = vscode.workspace.registerTaskProvider('jake', { + this.taskProvider = vscode.tasks.registerTaskProvider('jake', { provideTasks(): Promise { return thisCapture.getTasks(); }, diff --git a/extensions/java/cgmanifest.json b/extensions/java/cgmanifest.json index 762917e98024f..b7090d4a45cde 100644 --- a/extensions/java/cgmanifest.json +++ b/extensions/java/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "atom/language-java", "repositoryUrl": "https://github.com/atom/language-java", - "commitHash": "123beb50115b0bfb0db8f2325df6d05fb8a016a8" + "commitHash": "0facf7cbe02cda460db1160fd730f2e57bf15c36" } }, "license": "MIT", - "version": "0.31.3" + "version": "0.31.4" } ], "version": 1 diff --git a/extensions/java/language-configuration.json b/extensions/java/language-configuration.json index a2909abb800e9..e19d2d749f875 100644 --- a/extensions/java/language-configuration.json +++ b/extensions/java/language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"], + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, { "open": "/**", "close": " */", "notIn": ["string"] } ], "surroundingPairs": [ diff --git a/extensions/java/syntaxes/java.tmLanguage.json b/extensions/java/syntaxes/java.tmLanguage.json index f806edf7b6d8a..7dad7d72837c6 100644 --- a/extensions/java/syntaxes/java.tmLanguage.json +++ b/extensions/java/syntaxes/java.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-java/commit/123beb50115b0bfb0db8f2325df6d05fb8a016a8", + "version": "https://github.com/atom/language-java/commit/0facf7cbe02cda460db1160fd730f2e57bf15c36", "name": "Java", "scopeName": "source.java", "patterns": [ @@ -209,7 +209,7 @@ "name": "keyword.control.new.java" } }, - "end": "(?=;|\\)|,|:|}|\\+|\\-|\\*|\\/|%|!|&|\\||=)", + "end": "(?=;|\\)|\\]|\\.|,|\\?|:|}|\\+|\\-|\\*|\\/(?!\\/|\\*)|%|!|&|\\||\\^|=)", "patterns": [ { "include": "#comments" @@ -269,7 +269,7 @@ ] }, "class": { - "begin": "(?=\\w?[\\w\\s]*\\b(?:class|(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "match": "(?x)(\\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\\?)|(\\!))?(?=\\s*\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", "captures": { "1": { "name": "meta.definition.property.js entity.name.function.js" @@ -1123,7 +1123,7 @@ }, { "name": "meta.definition.property.js variable.object.property.js", - "match": "[_$[:alpha:]][_$[:alnum:]]*" + "match": "\\#?[_$[:alpha:]][_$[:alnum:]]*" }, { "name": "keyword.operator.optional.js", @@ -1825,7 +1825,7 @@ }, "access-modifier": { "name": "storage.modifier.js", - "match": "(?)", + "patterns": [ + { + "include": "#type-parameters" + } + ] + }, + { + "begin": "(?<=\\>)\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, { "include": "#possibly-arrow-return-type" }, @@ -2788,20 +2836,20 @@ ] }, "function-call": { - "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", - "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "name": "meta.function-call.js", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "include": "#support-function-call-identifiers" }, { "name": "entity.name.function.js", - "match": "([_$[:alpha:]][_$[:alnum:]]*)" + "match": "(\\#?[_$[:alpha:]][_$[:alnum:]]*)" } ] }, @@ -2986,7 +3034,7 @@ } }, { - "match": "(?x)(?:(?=|<>|<|>" }, + { + "match": "(\\!)\\s*(/)(?![/*])", + "captures": { + "1": { + "name": "keyword.operator.logical.js" + }, + "2": { + "name": "keyword.operator.arithmetic.js" + } + } + }, { "name": "keyword.operator.logical.js", "match": "\\!|&&|\\|\\||\\?\\?" @@ -3582,7 +3641,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", "captures": { "1": { "name": "punctuation.accessor.js" @@ -3596,7 +3655,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.js" @@ -3626,7 +3685,7 @@ "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\??\\.\\s*prototype\\b(?!\\$))" }, { - "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n (\\#?[[:upper:]][_$[:digit:][:upper:]]*) |\n (\\#?[_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.js" @@ -3643,7 +3702,7 @@ } }, { - "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "variable.other.constant.object.js" @@ -4483,12 +4542,12 @@ "patterns": [ { "name": "string.template.js", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "end": "(?=`)", "patterns": [ { "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "end": "(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "patterns": [ { "include": "#support-function-call-identifiers" @@ -4506,7 +4565,7 @@ }, { "name": "string.template.js", - "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", "beginCaptures": { "1": { "name": "entity.name.function.tagged-template.js" @@ -4572,7 +4631,7 @@ "patterns": [ { "name": "string.regexp.js", - "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/[gimsuy]*(?!\\s*[a-zA-Z0-9_$]))", + "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/([gimsuy]+|(?![\\/\\*])|(?=\\/\\*))(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.js" @@ -4595,7 +4654,7 @@ }, { "name": "string.regexp.js", - "begin": "((?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "match": "(?x)(\\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\\?)|(\\!))?(?=\\s*\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", "captures": { "1": { "name": "meta.definition.property.js.jsx entity.name.function.js.jsx" @@ -1123,7 +1123,7 @@ }, { "name": "meta.definition.property.js.jsx variable.object.property.js.jsx", - "match": "[_$[:alpha:]][_$[:alnum:]]*" + "match": "\\#?[_$[:alpha:]][_$[:alnum:]]*" }, { "name": "keyword.operator.optional.js.jsx", @@ -1825,7 +1825,7 @@ }, "access-modifier": { "name": "storage.modifier.js.jsx", - "match": "(?)", + "patterns": [ + { + "include": "#type-parameters" + } + ] + }, + { + "begin": "(?<=\\>)\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "meta.brace.round.js.jsx" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js.jsx" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, { "include": "#possibly-arrow-return-type" }, @@ -2788,20 +2836,20 @@ ] }, "function-call": { - "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", - "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "name": "meta.function-call.js.jsx", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "include": "#support-function-call-identifiers" }, { "name": "entity.name.function.js.jsx", - "match": "([_$[:alpha:]][_$[:alnum:]]*)" + "match": "(\\#?[_$[:alpha:]][_$[:alnum:]]*)" } ] }, @@ -2986,7 +3034,7 @@ } }, { - "match": "(?x)(?:(?=|<>|<|>" }, + { + "match": "(\\!)\\s*(/)(?![/*])", + "captures": { + "1": { + "name": "keyword.operator.logical.js.jsx" + }, + "2": { + "name": "keyword.operator.arithmetic.js.jsx" + } + } + }, { "name": "keyword.operator.logical.js.jsx", "match": "\\!|&&|\\|\\||\\?\\?" @@ -3582,7 +3641,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", "captures": { "1": { "name": "punctuation.accessor.js.jsx" @@ -3596,7 +3655,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.js.jsx" @@ -3626,7 +3685,7 @@ "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\??\\.\\s*prototype\\b(?!\\$))" }, { - "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n (\\#?[[:upper:]][_$[:digit:][:upper:]]*) |\n (\\#?[_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.js.jsx" @@ -3643,7 +3702,7 @@ } }, { - "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "variable.other.constant.object.js.jsx" @@ -4483,12 +4542,12 @@ "patterns": [ { "name": "string.template.js.jsx", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "end": "(?=`)", "patterns": [ { "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "end": "(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "patterns": [ { "include": "#support-function-call-identifiers" @@ -4506,7 +4565,7 @@ }, { "name": "string.template.js.jsx", - "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", "beginCaptures": { "1": { "name": "entity.name.function.tagged-template.js.jsx" @@ -4572,7 +4631,7 @@ "patterns": [ { "name": "string.regexp.js.jsx", - "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/[gimsuy]*(?!\\s*[a-zA-Z0-9_$]))", + "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/([gimsuy]+|(?![\\/\\*])|(?=\\/\\*))(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.js.jsx" @@ -4595,7 +4654,7 @@ }, { "name": "string.regexp.js.jsx", - "begin": "((? = new NotificationType('json/schemaAssociations'); } +namespace ResultLimitReachedNotification { + export const type: NotificationType = new NotificationType('json/resultLimitReached'); +} + interface IPackageInfo { name: string; version: string; @@ -64,29 +76,29 @@ let telemetryReporter: TelemetryReporter | undefined; export function activate(context: ExtensionContext) { - let toDispose = context.subscriptions; + const toDispose = context.subscriptions; let rangeFormatting: Disposable | undefined = undefined; - let packageInfo = getPackageInfo(context); + const packageInfo = getPackageInfo(context); telemetryReporter = packageInfo && new TelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey); - let serverMain = readJSONFile(context.asAbsolutePath('./server/package.json')).main; - let serverModule = context.asAbsolutePath(path.join('server', serverMain)); + const serverMain = readJSONFile(context.asAbsolutePath('./server/package.json')).main; + const serverModule = context.asAbsolutePath(path.join('server', serverMain)); // The debug options for the server - let debugOptions = { execArgv: ['--nolazy', '--inspect=' + (9000 + Math.round(Math.random() * 10000))] }; + const debugOptions = { execArgv: ['--nolazy', '--inspect=' + (9000 + Math.round(Math.random() * 10000))] }; // If the extension is launch in debug mode the debug server options are use // Otherwise the run options are used - let serverOptions: ServerOptions = { + const serverOptions: ServerOptions = { run: { module: serverModule, transport: TransportKind.ipc }, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions } }; - let documentSelector = ['json', 'jsonc']; + const documentSelector = ['json', 'jsonc']; - let schemaResolutionErrorStatusBarItem = window.createStatusBarItem({ + const schemaResolutionErrorStatusBarItem = window.createStatusBarItem({ id: 'status.json.resolveError', name: localize('json.resolveError', "JSON: Schema Resolution Error"), alignment: StatusBarAlignment.Right, @@ -97,15 +109,16 @@ export function activate(context: ExtensionContext) { schemaResolutionErrorStatusBarItem.text = '$(alert)'; toDispose.push(schemaResolutionErrorStatusBarItem); - let fileSchemaErrors = new Map(); + const fileSchemaErrors = new Map(); // Options to control the language client - let clientOptions: LanguageClientOptions = { + const clientOptions: LanguageClientOptions = { // Register the server for json documents documentSelector, initializationOptions: { handledSchemaProtocols: ['file'], // language server only loads file-URI. Fetching schemas with other protocols ('http'...) are made on the client. - provideFormatter: false // tell the server to not provide formatting capability and ignore the `json.format.enable` setting. + provideFormatter: false, // tell the server to not provide formatting capability and ignore the `json.format.enable` setting. + customCapabilities: { rangeFormatting: { editLimit: 1000 } } }, synchronize: { // Synchronize the setting section 'json' to the server @@ -132,22 +145,44 @@ export function activate(context: ExtensionContext) { } next(uri, diagnostics); + }, + // testing the replace / insert mode + provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult { + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range = { inserting: new Range(range.start, position), replacing: range }; + } + } + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); } } }; // Create the language client and start the client. - let client = new LanguageClient('json', localize('jsonserver.name', 'JSON Language Server'), serverOptions, clientOptions); + const client = new LanguageClient('json', localize('jsonserver.name', 'JSON Language Server'), serverOptions, clientOptions); client.registerProposedFeatures(); - let disposable = client.start(); + const disposable = client.start(); toDispose.push(disposable); client.onReady().then(() => { const schemaDocuments: { [uri: string]: boolean } = {}; // handle content request client.onRequest(VSCodeContentRequest.type, (uriPath: string) => { - let uri = Uri.parse(uriPath); + const uri = Uri.parse(uriPath); if (uri.scheme !== 'http' && uri.scheme !== 'https') { return workspace.openTextDocument(uri).then(doc => { schemaDocuments[uri.toString()] = true; @@ -177,7 +212,7 @@ export function activate(context: ExtensionContext) { } }); - let handleContentChange = (uriString: string) => { + const handleContentChange = (uriString: string) => { if (schemaDocuments[uriString]) { client.sendNotification(SchemaContentChangeNotification.type, uriString); return true; @@ -185,7 +220,7 @@ export function activate(context: ExtensionContext) { return false; }; - let handleActiveEditorChange = (activeEditor?: TextEditor) => { + const handleActiveEditorChange = (activeEditor?: TextEditor) => { if (!activeEditor) { return; } @@ -209,7 +244,7 @@ export function activate(context: ExtensionContext) { })); toDispose.push(window.onDidChangeActiveTextEditor(handleActiveEditorChange)); - let handleRetryResolveSchemaCommand = () => { + const handleRetryResolveSchemaCommand = () => { if (window.activeTextEditor) { schemaResolutionErrorStatusBarItem.text = '$(watch)'; const activeDocUri = window.activeTextEditor.document.uri.toString(); @@ -239,9 +274,15 @@ export function activate(context: ExtensionContext) { updateFormatterRegistration(); toDispose.push({ dispose: () => rangeFormatting && rangeFormatting.dispose() }); toDispose.push(workspace.onDidChangeConfiguration(e => e.affectsConfiguration('html.format.enable') && updateFormatterRegistration())); + + + client.onNotification(ResultLimitReachedNotification.type, message => { + window.showInformationMessage(`${message}\nUse setting 'json.maxItemsComputed' to configure the limit.`); + }); + }); - let languageConfiguration: LanguageConfiguration = { + const languageConfiguration: LanguageConfiguration = { wordPattern: /("(?:[^\\\"]*(?:\\.)?)*"?)|[^\s{}\[\],:]+/, indentationRules: { increaseIndentPattern: /({+(?=([^"]*"[^"]*")*[^"}]*$))|(\[+(?=([^"]*"[^"]*")*[^"\]]*$))/, @@ -259,7 +300,7 @@ export function activate(context: ExtensionContext) { } else if (formatEnabled && !rangeFormatting) { rangeFormatting = languages.registerDocumentRangeFormattingEditProvider(documentSelector, { provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult { - let params: DocumentRangeFormattingParams = { + const params: DocumentRangeFormattingParams = { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), range: client.code2ProtocolConverter.asRange(range), options: client.code2ProtocolConverter.asFormattingOptions(options) @@ -284,11 +325,11 @@ export function deactivate(): Promise { } function getSchemaAssociation(_context: ExtensionContext): ISchemaAssociations { - let associations: ISchemaAssociations = {}; + const associations: ISchemaAssociations = {}; extensions.all.forEach(extension => { - let packageJSON = extension.packageJSON; + const packageJSON = extension.packageJSON; if (packageJSON && packageJSON.contributes && packageJSON.contributes.jsonValidation) { - let jsonValidation = packageJSON.contributes.jsonValidation; + const jsonValidation = packageJSON.contributes.jsonValidation; if (Array.isArray(jsonValidation)) { jsonValidation.forEach(jv => { let { fileMatch, url } = jv; @@ -318,22 +359,32 @@ function getSchemaAssociation(_context: ExtensionContext): ISchemaAssociations { } function getSettings(): Settings { - let httpSettings = workspace.getConfiguration('http'); + const httpSettings = workspace.getConfiguration('http'); - let settings: Settings = { + const resultLimit: number = Math.trunc(Math.max(0, Number(workspace.getConfiguration().get('json.maxItemsComputed')))) || 5000; + + const settings: Settings = { http: { proxy: httpSettings.get('proxy'), proxyStrictSSL: httpSettings.get('proxyStrictSSL') }, json: { schemas: [], - resultLimit: 5000 + resultLimit } }; - let schemaSettingsById: { [schemaId: string]: JSONSchemaSettings } = Object.create(null); - let collectSchemaSettings = (schemaSettings: JSONSchemaSettings[], rootPath?: string, fileMatchPrefix?: string) => { - for (let setting of schemaSettings) { - let url = getSchemaId(setting, rootPath); + const schemaSettingsById: { [schemaId: string]: JSONSchemaSettings } = Object.create(null); + const collectSchemaSettings = (schemaSettings: JSONSchemaSettings[], folderUri?: Uri, isMultiRoot?: boolean) => { + + let fileMatchPrefix = undefined; + if (folderUri && isMultiRoot) { + fileMatchPrefix = folderUri.toString(); + if (fileMatchPrefix[fileMatchPrefix.length - 1] === '/') { + fileMatchPrefix = fileMatchPrefix.substr(0, fileMatchPrefix.length - 1); + } + } + for (const setting of schemaSettings) { + const url = getSchemaId(setting, folderUri); if (!url) { continue; } @@ -342,69 +393,78 @@ function getSettings(): Settings { schemaSetting = schemaSettingsById[url] = { url, fileMatch: [] }; settings.json!.schemas!.push(schemaSetting); } - let fileMatches = setting.fileMatch; - let resultingFileMatches = schemaSetting.fileMatch!; + const fileMatches = setting.fileMatch; if (Array.isArray(fileMatches)) { - if (fileMatchPrefix) { - for (let fileMatch of fileMatches) { + const resultingFileMatches = schemaSetting.fileMatch || []; + schemaSetting.fileMatch = resultingFileMatches; + const addMatch = (pattern: string) => { // filter duplicates + if (resultingFileMatches.indexOf(pattern) === -1) { + resultingFileMatches.push(pattern); + } + }; + for (const fileMatch of fileMatches) { + if (fileMatchPrefix) { if (fileMatch[0] === '/') { - resultingFileMatches.push(fileMatchPrefix + fileMatch); - resultingFileMatches.push(fileMatchPrefix + '/*' + fileMatch); + addMatch(fileMatchPrefix + fileMatch); + addMatch(fileMatchPrefix + '/*' + fileMatch); } else { - resultingFileMatches.push(fileMatchPrefix + '/' + fileMatch); - resultingFileMatches.push(fileMatchPrefix + '/*/' + fileMatch); + addMatch(fileMatchPrefix + '/' + fileMatch); + addMatch(fileMatchPrefix + '/*/' + fileMatch); } + } else { + addMatch(fileMatch); } - } else { - resultingFileMatches.push(...fileMatches); } - } - if (setting.schema) { + if (setting.schema && !schemaSetting.schema) { schemaSetting.schema = setting.schema; } } }; + const folders = workspace.workspaceFolders; + // merge global and folder settings. Qualify all file matches with the folder path. - let globalSettings = workspace.getConfiguration('json', null).get('schemas'); + const globalSettings = workspace.getConfiguration('json', null).get('schemas'); if (Array.isArray(globalSettings)) { - collectSchemaSettings(globalSettings, workspace.rootPath); + if (!folders) { + collectSchemaSettings(globalSettings); + } } - let folders = workspace.workspaceFolders; if (folders) { - for (let folder of folders) { - let folderUri = folder.uri; + const isMultiRoot = folders.length > 1; + for (const folder of folders) { + const folderUri = folder.uri; - let schemaConfigInfo = workspace.getConfiguration('json', folderUri).inspect('schemas'); + const schemaConfigInfo = workspace.getConfiguration('json', folderUri).inspect('schemas'); - let folderSchemas = schemaConfigInfo!.workspaceFolderValue; + const folderSchemas = schemaConfigInfo!.workspaceFolderValue; if (Array.isArray(folderSchemas)) { - let folderPath = folderUri.toString(); - if (folderPath[folderPath.length - 1] === '/') { - folderPath = folderPath.substr(0, folderPath.length - 1); - } - collectSchemaSettings(folderSchemas, folderUri.fsPath, folderPath); + collectSchemaSettings(folderSchemas, folderUri, isMultiRoot); } + if (Array.isArray(globalSettings)) { + collectSchemaSettings(globalSettings, folderUri, isMultiRoot); + } + } } return settings; } -function getSchemaId(schema: JSONSchemaSettings, rootPath?: string) { +function getSchemaId(schema: JSONSchemaSettings, folderUri?: Uri) { let url = schema.url; if (!url) { if (schema.schema) { url = schema.schema.id || `vscode://schemas/custom/${encodeURIComponent(hash(schema.schema).toString(16))}`; } - } else if (rootPath && (url[0] === '.' || url[0] === '/')) { - url = Uri.file(path.normalize(path.join(rootPath, url))).toString(); + } else if (folderUri && (url[0] === '.' || url[0] === '/')) { + url = folderUri.with({ path: path.posix.join(folderUri.path, url) }).toString(); } return url; } function getPackageInfo(context: ExtensionContext): IPackageInfo | undefined { - let extensionPackage = readJSONFile(context.asAbsolutePath('./package.json')); + const extensionPackage = readJSONFile(context.asAbsolutePath('./package.json')); if (extensionPackage) { return { name: extensionPackage.name, @@ -422,5 +482,4 @@ function readJSONFile(location: string) { console.log(`Problems reading ${location}: ${e}`); return {}; } - } diff --git a/extensions/json-language-features/extension.webpack.config.js b/extensions/json-language-features/extension.webpack.config.js index a4d4ff955d70e..39e5e567a7afb 100644 --- a/extensions/json-language-features/extension.webpack.config.js +++ b/extensions/json-language-features/extension.webpack.config.js @@ -9,7 +9,7 @@ const withDefaults = require('../shared.webpack.config'); const path = require('path'); -var webpack = require('webpack'); +const webpack = require('webpack'); const config = withDefaults({ context: path.join(__dirname, 'client'), @@ -25,4 +25,4 @@ const config = withDefaults({ // add plugin, don't replace inherited config.plugins.push(new webpack.IgnorePlugin(/vertx/)); // request-light dependency -module.exports = config; \ No newline at end of file +module.exports = config; diff --git a/extensions/json-language-features/package.json b/extensions/json-language-features/package.json index 833059f3c839b..8a12ff009c31e 100644 --- a/extensions/json-language-features/package.json +++ b/extensions/json-language-features/package.json @@ -1,113 +1,131 @@ { - "name": "json-language-features", - "displayName": "%displayName%", - "description": "%description%", - "version": "1.0.0", - "publisher": "vscode", - "license": "MIT", - "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", - "engines": { - "vscode": "0.10.x" - }, - "icon": "icons/json.png", - "activationEvents": [ - "onLanguage:json", - "onLanguage:jsonc" - ], - "main": "./client/out/jsonMain", - "enableProposedApi": true, - "scripts": { - "compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server", - "watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server", - "postinstall": "cd server && yarn install", - "install-client-next": "yarn add vscode-languageclient@next" - }, - "categories": [ - "Programming Languages" - ], - "contributes": { - "configuration": { - "id": "json", - "order": 20, - "type": "object", - "title": "JSON", - "properties": { - "json.schemas": { - "type": "array", - "scope": "resource", - "description": "%json.schemas.desc%", - "items": { + "name": "json-language-features", + "displayName": "%displayName%", + "description": "%description%", + "version": "1.0.0", + "publisher": "vscode", + "license": "MIT", + "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", + "engines": { + "vscode": "0.10.x" + }, + "icon": "icons/json.png", + "activationEvents": [ + "onLanguage:json", + "onLanguage:jsonc" + ], + "main": "./client/out/jsonMain", + "enableProposedApi": true, + "scripts": { + "compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server", + "watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server", + "postinstall": "cd server && yarn install", + "install-client-next": "yarn add vscode-languageclient@next" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "configuration": { + "id": "json", + "order": 20, "type": "object", - "default": { - "fileMatch": [ - "/myfile" - ], - "url": "schemaURL" - }, + "title": "JSON", "properties": { - "url": { - "type": "string", - "default": "/user.schema.json", - "description": "%json.schemas.url.desc%" - }, - "fileMatch": { - "type": "array", - "items": { - "type": "string", - "default": "MyFile.json", - "description": "%json.schemas.fileMatch.item.desc%" + "json.schemas": { + "type": "array", + "scope": "resource", + "description": "%json.schemas.desc%", + "items": { + "type": "object", + "default": { + "fileMatch": [ + "/myfile" + ], + "url": "schemaURL" + }, + "properties": { + "url": { + "type": "string", + "default": "/user.schema.json", + "description": "%json.schemas.url.desc%" + }, + "fileMatch": { + "type": "array", + "items": { + "type": "string", + "default": "MyFile.json", + "description": "%json.schemas.fileMatch.item.desc%" + }, + "minItems": 1, + "description": "%json.schemas.fileMatch.desc%" + }, + "schema": { + "$ref": "http://json-schema.org/draft-07/schema#", + "description": "%json.schemas.schema.desc%" + } + } + } + }, + "json.format.enable": { + "type": "boolean", + "scope": "window", + "default": true, + "description": "%json.format.enable.desc%" }, - "minItems": 1, - "description": "%json.schemas.fileMatch.desc%" - }, - "schema": { - "$ref": "http://json-schema.org/draft-07/schema#", - "description": "%json.schemas.schema.desc%" - } + "json.trace.server": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "%json.tracing.desc%" + }, + "json.colorDecorators.enable": { + "type": "boolean", + "scope": "window", + "default": true, + "description": "%json.colorDecorators.enable.desc%", + "deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%" + }, + "json.maxItemsComputed": { + "type": "number", + "default": 5000, + "description": "%json.maxItemsComputed.desc%" + } } - } - }, - "json.format.enable": { - "type": "boolean", - "scope": "window", - "default": true, - "description": "%json.format.enable.desc%" }, - "json.trace.server": { - "type": "string", - "scope": "window", - "enum": [ - "off", - "messages", - "verbose" - ], - "default": "off", - "description": "%json.tracing.desc%" + "configurationDefaults": { + "[json]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace" + }, + "[jsonc]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace" + } }, - "json.colorDecorators.enable": { - "type": "boolean", - "scope": "window", - "default": true, - "description": "%json.colorDecorators.enable.desc%", - "deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%" - } - } + "jsonValidation": [ + { + "fileMatch": "*.schema.json", + "url": "http://json-schema.org/draft-07/schema#" + } + ] + }, + "dependencies": { + "request-light": "^0.2.5", + "vscode-extension-telemetry": "0.1.1", + "vscode-languageclient": "^6.1.1", + "vscode-nls": "^4.1.1" }, - "configurationDefaults": { - "[json]": { - "editor.quickSuggestions": { - "strings": true - } - } + "devDependencies": { + "@types/node": "^12.11.7" } - }, - "dependencies": { - "request-light": "^0.2.5", - "vscode-extension-telemetry": "0.1.1", - "vscode-languageclient": "^6.0.0-next.3", - "vscode-nls": "^4.1.1" - }, - "devDependencies": { - "@types/node": "^12.11.7" - } } diff --git a/extensions/json-language-features/package.nls.json b/extensions/json-language-features/package.nls.json index c61e7b70e8f5c..5d132ccd776e0 100644 --- a/extensions/json-language-features/package.nls.json +++ b/extensions/json-language-features/package.nls.json @@ -11,5 +11,6 @@ "json.colorDecorators.enable.desc": "Enables or disables color decorators", "json.colorDecorators.enable.deprecationMessage": "The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.", "json.schemaResolutionErrorMessage": "Unable to resolve schema.", - "json.clickToRetry": "Click to retry." + "json.clickToRetry": "Click to retry.", + "json.maxItemsComputed.desc": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)." } diff --git a/extensions/json-language-features/server/README.md b/extensions/json-language-features/server/README.md index 71356e3c4415e..43cc04837d577 100644 --- a/extensions/json-language-features/server/README.md +++ b/extensions/json-language-features/server/README.md @@ -46,6 +46,8 @@ The client can send the following initialization options to the server: - `provideFormatter: boolean | undefined`. If defined, the value defines whether the server provides the `documentRangeFormattingProvider` capability on initialization. If undefined, the setting `json.format.enable` is used to determine whether formatting is provided. The formatter will then be registered through dynamic registration. If the client does not support dynamic registration, no formatter will be available. - `handledSchemaProtocols`: The URI schemas handles by the server. See section `Schema configuration` below. +- `customCapabilities`: Additional non-LSP client capabilities: + - `rangeFormatting: { editLimit: x } }`: For performance reasons, limit the number of edits returned by the range formatter to `x`. ### Settings @@ -63,6 +65,7 @@ The server supports the following settings: - `fileMatch`: an array of file names or paths (separated by `/`). `*` can be used as a wildcard. - `url`: The URL of the schema, optional when also a schema is provided. - `schema`: The schema content. + - `resultLimit`: The max number foldig ranges and otline symbols to be computed (for performance reasons) ```json { @@ -153,6 +156,16 @@ Notification: - method: 'json/schemaContent' - params: `string` the URL of the schema that has changed. +### Item Limit + +If the setting `resultLimit` is set, the JSON language server will limit the number of folding ranges and document symbols computed. +When the limit is reached, a notification `json/resultLimitReached` is sent that can be shown that camn be shown to the user. + +Notification: +- method: 'json/resultLimitReached' +- params: a human readable string to show to the user. + + ## Try The JSON language server is shipped with [Visual Studio Code](https://code.visualstudio.com/) as part of the built-in VSCode extension `json-language-features`. The server is started when the first JSON file is opened. The [VSCode JSON documentation](https://code.visualstudio.com/docs/languages/json) for detailed information on the user experience and has more information on how to configure the language support. diff --git a/extensions/json-language-features/server/extension.webpack.config.js b/extensions/json-language-features/server/extension.webpack.config.js index 22b23c1d94bc2..2c90a0b075164 100644 --- a/extensions/json-language-features/server/extension.webpack.config.js +++ b/extensions/json-language-features/server/extension.webpack.config.js @@ -9,7 +9,7 @@ const withDefaults = require('../../shared.webpack.config'); const path = require('path'); -var webpack = require('webpack'); +const webpack = require('webpack'); const config = withDefaults({ context: path.join(__dirname), diff --git a/extensions/json-language-features/server/package.json b/extensions/json-language-features/server/package.json index 6dc132cc742af..ae5b4a9e07372 100644 --- a/extensions/json-language-features/server/package.json +++ b/extensions/json-language-features/server/package.json @@ -1,7 +1,7 @@ { "name": "vscode-json-languageserver", "description": "JSON language server", - "version": "1.2.2", + "version": "1.2.3", "author": "Microsoft Corporation", "license": "MIT", "engines": { @@ -12,10 +12,10 @@ }, "main": "./out/jsonServerMain", "dependencies": { - "jsonc-parser": "^2.2.0", + "jsonc-parser": "^2.2.1", "request-light": "^0.2.5", - "vscode-json-languageservice": "^3.4.7", - "vscode-languageserver": "^6.0.0-next.3", + "vscode-json-languageservice": "^3.5.1", + "vscode-languageserver": "^6.1.1", "vscode-uri": "^2.1.1" }, "devDependencies": { diff --git a/extensions/json-language-features/server/src/jsonServerMain.ts b/extensions/json-language-features/server/src/jsonServerMain.ts index 975f27b481dac..4f40bd5a3fd73 100644 --- a/extensions/json-language-features/server/src/jsonServerMain.ts +++ b/extensions/json-language-features/server/src/jsonServerMain.ts @@ -6,7 +6,7 @@ import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, NotificationType, RequestType, - DocumentRangeFormattingRequest, Disposable, ServerCapabilities, TextDocumentSyncKind + DocumentRangeFormattingRequest, Disposable, ServerCapabilities, TextDocumentSyncKind, TextEdit } from 'vscode-languageserver'; import { xhr, XHRResponse, configure as configureHttpRequests, getErrorStatusDescription } from 'request-light'; @@ -16,7 +16,7 @@ import * as URL from 'url'; import { posix } from 'path'; import { setTimeout, clearTimeout } from 'timers'; import { formatError, runSafe, runSafeAsync } from './utils/runner'; -import { TextDocument, JSONDocument, JSONSchema, getLanguageService, DocumentLanguageSettings, SchemaConfiguration, ClientCapabilities, SchemaRequestService, Diagnostic } from 'vscode-json-languageservice'; +import { TextDocument, JSONDocument, JSONSchema, getLanguageService, DocumentLanguageSettings, SchemaConfiguration, ClientCapabilities, SchemaRequestService, Diagnostic, Range, Position } from 'vscode-json-languageservice'; import { getLanguageModelCache } from './languageModelCache'; interface ISchemaAssociations { @@ -35,6 +35,10 @@ namespace SchemaContentChangeNotification { export const type: NotificationType = new NotificationType('json/schemaContent'); } +namespace ResultLimitReachedNotification { + export const type: NotificationType = new NotificationType('json/resultLimitReached'); +} + namespace ForceValidateRequest { export const type: RequestType = new RequestType('json/validate'); } @@ -122,12 +126,13 @@ let hierarchicalDocumentSymbolSupport = false; let foldingRangeLimitDefault = Number.MAX_VALUE; let foldingRangeLimit = Number.MAX_VALUE; let resultLimit = Number.MAX_VALUE; +let formatterMaxNumberOfEdits = Number.MAX_VALUE; // After the server has started the client sends an initialize request. The server receives // in the passed params the rootPath of the workspace plus the client capabilities. connection.onInitialize((params: InitializeParams): InitializeResult => { - const handledProtocols = params.initializationOptions && params.initializationOptions['handledSchemaProtocols']; + const handledProtocols = params.initializationOptions?.handledSchemaProtocols; languageService = getLanguageService({ schemaRequestService: getSchemaRequestService(handledProtocols), @@ -149,9 +154,10 @@ connection.onInitialize((params: InitializeParams): InitializeResult => { } clientSnippetSupport = getClientCapability('textDocument.completion.completionItem.snippetSupport', false); - dynamicFormatterRegistration = getClientCapability('textDocument.rangeFormatting.dynamicRegistration', false) && (typeof params.initializationOptions.provideFormatter !== 'boolean'); + dynamicFormatterRegistration = getClientCapability('textDocument.rangeFormatting.dynamicRegistration', false) && (typeof params.initializationOptions?.provideFormatter !== 'boolean'); foldingRangeLimitDefault = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE); hierarchicalDocumentSymbolSupport = getClientCapability('textDocument.documentSymbol.hierarchicalDocumentSymbolSupport', false); + formatterMaxNumberOfEdits = params.initializationOptions?.customCapabilities?.rangeFormatting?.editLimit || Number.MAX_VALUE; const capabilities: ServerCapabilities = { textDocumentSync: TextDocumentSyncKind.Incremental, completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : undefined, @@ -211,7 +217,7 @@ namespace LimitExceededWarnings { } else { warning = { features: { [name]: name } }; warning.timeout = setTimeout(() => { - connection.window.showInformationMessage(`${posix.basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`); + connection.sendNotification(ResultLimitReachedNotification.type, `${posix.basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`); warning.timeout = undefined; }, 2000); pendingWarnings[uri] = warning; @@ -323,7 +329,7 @@ documents.onDidClose(event => { }); const pendingValidationRequests: { [uri: string]: NodeJS.Timer; } = {}; -const validationDelayMs = 500; +const validationDelayMs = 300; function cleanPendingValidation(textDocument: TextDocument): void { const request = pendingValidationRequests[textDocument.uri]; @@ -357,12 +363,12 @@ function validateTextDocument(textDocument: TextDocument, callback?: (diagnostic const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' }; languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => { - setTimeout(() => { + setImmediate(() => { const currDocument = documents.get(textDocument.uri); if (currDocument && currDocument.version === version) { respond(diagnostics); // Send the computed diagnostics to VSCode. } - }, 100); + }); }, error => { connection.console.error(formatError(`Error while validating ${textDocument.uri}`, error)); }); @@ -441,7 +447,12 @@ connection.onDocumentRangeFormatting((formatParams, token) => { return runSafe(() => { const document = documents.get(formatParams.textDocument.uri); if (document) { - return languageService.format(document, formatParams.range, formatParams.options); + const edits = languageService.format(document, formatParams.range, formatParams.options); + if (edits.length > formatterMaxNumberOfEdits) { + const newText = TextDocument.applyEdits(document, edits); + return [TextEdit.replace(Range.create(Position.create(0, 0), document.positionAt(document.getText().length)), newText)]; + } + return edits; } return []; }, [], `Error while formatting range for ${formatParams.textDocument.uri}`, token); diff --git a/extensions/json-language-features/server/yarn.lock b/extensions/json-language-features/server/yarn.lock index f0fde79ab0cbe..f6b78986f8f1e 100644 --- a/extensions/json-language-features/server/yarn.lock +++ b/extensions/json-language-features/server/yarn.lock @@ -61,10 +61,10 @@ https-proxy-agent@^2.2.3: agent-base "^4.3.0" debug "^3.1.0" -jsonc-parser@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.0.tgz#f206f87f9d49d644b7502052c04e82dd6392e9ef" - integrity sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA== +jsonc-parser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== ms@2.0.0: version "2.0.0" @@ -80,57 +80,52 @@ request-light@^0.2.5: https-proxy-agent "^2.2.3" vscode-nls "^4.1.1" -vscode-json-languageservice@^3.4.7: - version "3.4.7" - resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.4.7.tgz#8d85f3c1d46a1e58e9867d747552fb8c83d934fd" - integrity sha512-y3MN2+/yph3yoIHGmHu4ScYpm285L58XVvfGkd49xTQzLja4apxSbwzsYcP9QsqS0W7KuvoyiPhqksiudoMwjg== +vscode-json-languageservice@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.5.1.tgz#75779d466107cbc8c4cc9828df100df71c1870f8" + integrity sha512-F8jPqcAC1mbQOMKvGYS4dGEw9JCZxVEi7tc5ASZLfcfwKq2URZKB4fOtdy1GEsTLsrW11tVrBjEPntpXzqp/NA== dependencies: - jsonc-parser "^2.2.0" - vscode-languageserver-textdocument "^1.0.0-next.4" - vscode-languageserver-types "^3.15.0-next.6" + jsonc-parser "^2.2.1" + vscode-languageserver-textdocument "^1.0.1" + vscode-languageserver-types "^3.15.1" vscode-nls "^4.1.1" - vscode-uri "^2.1.0" + vscode-uri "^2.1.1" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.3: + version "3.15.3" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz#3fa9a0702d742cf7883cb6182a6212fcd0a1d8bb" + integrity sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" - -vscode-languageserver-textdocument@^1.0.0-next.4: - version "1.0.0-next.4" - resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.0-next.4.tgz#8f7afdfe3e81411f57baaa29bb3214d1907160cd" - integrity sha512-LJ5WfoBO54nqinjlLJKnjoo2Im4bIvPJ8bFT7R0C84ZI36iK8M29ddslfe5jUeWNSTtCda7YuKdKsDIq38HpgA== - -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== - -vscode-languageserver@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.0.0-next.3.tgz#41e2fda6417939792f6a19fc19ecbb2f080e2072" - integrity sha512-Q6T+KwYuoXV9KRHD6x7RfTU13pV0xAX2BtcuvSC/LBCiVAnEIOe7jKZjzya+B9gDvSk4hpfvhPefy5IdQK1mpQ== + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" + +vscode-languageserver-textdocument@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz#178168e87efad6171b372add1dea34f53e5d330f" + integrity sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA== + +vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== + +vscode-languageserver@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-6.1.1.tgz#d76afc68172c27d4327ee74332b468fbc740d762" + integrity sha512-DueEpkUAkD5XTR4MLYNr6bQIp/UFR0/IPApgXU3YfCBCB08u2sm9hRCs6DxYZELkk++STPjpcjksR2H8qI3cDQ== dependencies: - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.3" vscode-nls@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A== -vscode-uri@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.0.tgz#475a4269e63edbc13914b40c84bc1416e3398156" - integrity sha512-3voe44nOhb6OdKlpZShVsmVvY2vFQHMe6REP3Ky9RVJuPyM/XidsjH6HncCIDdSmbcF5YQHrTC/Q+Q2loJGkOw== - vscode-uri@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.1.tgz#5aa1803391b6ebdd17d047f51365cf62c38f6e90" diff --git a/extensions/json-language-features/yarn.lock b/extensions/json-language-features/yarn.lock index 27e4f7cf883d0..cbda171084d20 100644 --- a/extensions/json-language-features/yarn.lock +++ b/extensions/json-language-features/yarn.lock @@ -120,31 +120,31 @@ vscode-extension-telemetry@0.1.1: dependencies: applicationinsights "1.0.8" -vscode-jsonrpc@^5.0.0-next.2: - version "5.0.0-next.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.2.tgz#a44bc03f67069e53f8d8beb88b96c0cacbfefbca" - integrity sha512-Q3/jabZUNviCG9hhF6hHWjhrABevPF9mv0aiE2j8BYCAP2k+aHTpjMyk+04MzaAqWYwXdQuZkLSbcYCCqbzJLg== - -vscode-languageclient@^6.0.0-next.3: - version "6.0.0-next.3" - resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.0.0-next.3.tgz#41b701d963fc7affc01e9279532a747fcd4f3810" - integrity sha512-SuSaG9xjqkROm4Ie0jQig0CFDuU/WxHERegl3kRsFHDbhMSK4dH45ZeBY5zMWUgZ+LrIrEbwf8qWNlrTRBlUgg== +vscode-jsonrpc@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz#9bab9c330d89f43fc8c1e8702b5c36e058a01794" + integrity sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A== + +vscode-languageclient@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz#91b62e416c5abbf2013ae3726f314a19c22a8457" + integrity sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA== dependencies: semver "^6.3.0" - vscode-languageserver-protocol "^3.15.0-next.10" + vscode-languageserver-protocol "^3.15.3" -vscode-languageserver-protocol@^3.15.0-next.10: - version "3.15.0-next.10" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.10.tgz#f1382f0c270ae5d0c2c7e552483285fb75810914" - integrity sha512-TmbBhKrBoYNX+/pQGwoXmy2qlOfjGBUhwUGIzQoWpj8qtDzYuLof8bi19rGLZ9sVuSHh3anvIyVpGJEqT0QODQ== +vscode-languageserver-protocol@^3.15.3: + version "3.15.3" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz#3fa9a0702d742cf7883cb6182a6212fcd0a1d8bb" + integrity sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw== dependencies: - vscode-jsonrpc "^5.0.0-next.2" - vscode-languageserver-types "^3.15.0-next.6" + vscode-jsonrpc "^5.0.1" + vscode-languageserver-types "3.15.1" -vscode-languageserver-types@^3.15.0-next.6: - version "3.15.0-next.6" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.6.tgz#7a990d00c39ad4e744335afb4cc422a3e687ff25" - integrity sha512-+4jfvmZ26oFMSX6EgPRB75PWHoT8pzyWuSSWk0erC4hTzmJq2gWxVLh20bZutZjMmiivawvPshtM3XZhX2SttA== +vscode-languageserver-types@3.15.1: + version "3.15.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de" + integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ== vscode-nls@^4.1.1: version "4.1.1" diff --git a/extensions/json/package.json b/extensions/json/package.json index e66955770bce3..8f34baf1484c9 100644 --- a/extensions/json/package.json +++ b/extensions/json/package.json @@ -67,12 +67,6 @@ "scopeName": "source.json.comments", "path": "./syntaxes/JSONC.tmLanguage.json" } - ], - "jsonValidation": [ - { - "fileMatch": "*.schema.json", - "url": "http://json-schema.org/draft-07/schema#" - } ] } } diff --git a/extensions/json/test/colorize-results/test_json.json b/extensions/json/test/colorize-results/test_json.json index 75561c366d70a..fc3dec2172171 100644 --- a/extensions/json/test/colorize-results/test_json.json +++ b/extensions/json/test/colorize-results/test_json.json @@ -279,9 +279,9 @@ "t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json constant.numeric.json", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -488,9 +488,9 @@ "t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json constant.numeric.json", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -686,9 +686,9 @@ "t": "source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.array.json constant.numeric.json", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1165,4 +1165,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/less/test/colorize-results/test-cssvariables_less.json b/extensions/less/test/colorize-results/test-cssvariables_less.json index 1c9b8658a0adf..41db8bdaf48ab 100644 --- a/extensions/less/test/colorize-results/test-cssvariables_less.json +++ b/extensions/less/test/colorize-results/test-cssvariables_less.json @@ -103,9 +103,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -114,9 +114,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -202,9 +202,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -422,9 +422,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -521,9 +521,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css meta.function.variable.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -532,9 +532,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css meta.function.variable.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -582,4 +582,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/less/test/colorize-results/test_less.json b/extensions/less/test/colorize-results/test_less.json index d6b39257feb6b..7c48bc0681e90 100644 --- a/extensions/less/test/colorize-results/test_less.json +++ b/extensions/less/test/colorize-results/test_less.json @@ -829,9 +829,9 @@ "t": "source.css.less constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -840,9 +840,9 @@ "t": "source.css.less constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1082,9 +1082,9 @@ "t": "source.css.less meta.property-list.css meta.function.color.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1115,9 +1115,9 @@ "t": "source.css.less meta.property-list.css meta.function.color.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1148,9 +1148,9 @@ "t": "source.css.less meta.property-list.css meta.function.color.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1390,9 +1390,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1401,9 +1401,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1544,9 +1544,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1555,9 +1555,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1665,9 +1665,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1687,9 +1687,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1709,9 +1709,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1720,9 +1720,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1764,9 +1764,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1775,9 +1775,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1973,9 +1973,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1984,9 +1984,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2182,9 +2182,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2193,9 +2193,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2435,9 +2435,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2446,9 +2446,9 @@ "t": "source.css.less meta.property-list.css meta.property-list.css meta.property-list.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2578,9 +2578,9 @@ "t": "source.css.less constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2589,9 +2589,9 @@ "t": "source.css.less constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2897,9 +2897,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3117,9 +3117,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3458,9 +3458,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3469,9 +3469,9 @@ "t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -3508,4 +3508,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/log/cgmanifest.json b/extensions/log/cgmanifest.json index 56318ba0e84d7..d84272fbe3264 100644 --- a/extensions/log/cgmanifest.json +++ b/extensions/log/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "vscode-logfile-highlighter", "repositoryUrl": "https://github.com/emilast/vscode-logfile-highlighter", - "commitHash": "e90aa2554b439827f125fd60ff6d7773fc582fcc" + "commitHash": "fbe9797ea7889ee55def6da8dee86ba625ca9759" } }, "license": "MIT", - "version": "2.5.0" + "version": "2.6.0" } ], "version": 1 diff --git a/extensions/log/syntaxes/log.tmLanguage.json b/extensions/log/syntaxes/log.tmLanguage.json index b0f144a67fe62..0c511935ad3c2 100644 --- a/extensions/log/syntaxes/log.tmLanguage.json +++ b/extensions/log/syntaxes/log.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/emilast/vscode-logfile-highlighter/commit/e90aa2554b439827f125fd60ff6d7773fc582fcc", + "version": "https://github.com/emilast/vscode-logfile-highlighter/commit/fbe9797ea7889ee55def6da8dee86ba625ca9759", "name": "Log file", "scopeName": "text.log", "patterns": [ @@ -33,7 +33,7 @@ "name": "markup.changed log.debug" }, { - "match": "\\b(HINT|INFO|INFORMATION|Info|NOTICE)\\b|(?i)\\b(info|information)\\:", + "match": "\\b(HINT|INFO|INFORMATION|Info|NOTICE|II)\\b|(?i)\\b(info|information)\\:", "name": "markup.inserted log.info" }, { @@ -45,7 +45,7 @@ "name": "markup.inserted log.info" }, { - "match": "\\b(WARNING|WARN|Warn)\\b|(?i)\\b(warning)\\:", + "match": "\\b(WARNING|WARN|Warn|WW)\\b|(?i)\\b(warning)\\:", "name": "markup.deleted log.warning" }, { @@ -57,7 +57,7 @@ "name": "markup.deleted log.warning" }, { - "match": "\\b(ALERT|CRITICAL|EMERGENCY|ERROR|FAILURE|FAIL|Fatal|Error)\\b|(?i)\\b(error)\\:", + "match": "\\b(ALERT|CRITICAL|EMERGENCY|ERROR|FAILURE|FAIL|Fatal|FATAL|Error|EE)\\b|(?i)\\b(error)\\:", "name": "string.regexp, strong log.error" }, { diff --git a/extensions/lua/language-configuration.json b/extensions/lua/language-configuration.json index 89e5c45b9ff01..5e5e0ab447706 100644 --- a/extensions/lua/language-configuration.json +++ b/extensions/lua/language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], diff --git a/extensions/lua/test/colorize-results/test_lua.json b/extensions/lua/test/colorize-results/test_lua.json index 21c3d794e5b81..16117e5a94a73 100644 --- a/extensions/lua/test/colorize-results/test_lua.json +++ b/extensions/lua/test/colorize-results/test_lua.json @@ -180,9 +180,9 @@ "t": "source.lua constant.numeric.integer.lua", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -246,9 +246,9 @@ "t": "source.lua constant.numeric.integer.lua", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -367,9 +367,9 @@ "t": "source.lua constant.numeric.integer.lua", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -681,4 +681,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json b/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json index 0e2578d4bddfb..1babbfd546d05 100644 --- a/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json +++ b/extensions/markdown-basics/syntaxes/markdown.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/e3091a421bdcad527018c897652ded47585cbd12", + "version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/8fbbc11a6bb917f287bbe21d0573454020599547", "name": "Markdown", "scopeName": "text.html.markdown", "patterns": [ @@ -957,7 +957,7 @@ ] }, "fenced_code_block_js": { - "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs|\\{\\.js.+?\\})((\\s+|:|\\{)[^`~]*)?$)", + "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(js|jsx|javascript|es6|mjs|cjs|\\{\\.js.+?\\})((\\s+|:|\\{)[^`~]*)?$)", "name": "markup.fenced_code.block.markdown", "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", "beginCaptures": { diff --git a/extensions/markdown-basics/test/colorize-results/test_md.json b/extensions/markdown-basics/test/colorize-results/test_md.json index 9bc9aa7595f75..6963f66e79768 100644 --- a/extensions/markdown-basics/test/colorize-results/test_md.json +++ b/extensions/markdown-basics/test/colorize-results/test_md.json @@ -1134,7 +1134,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/markdown-language-features/package.json b/extensions/markdown-language-features/package.json index 303bd99f70227..fa3f06ca1cf0f 100644 --- a/extensions/markdown-language-features/package.json +++ b/extensions/markdown-language-features/package.json @@ -332,7 +332,7 @@ "dependencies": { "highlight.js": "9.15.10", "markdown-it": "^10.0.0", - "markdown-it-front-matter": "^0.1.2", + "markdown-it-front-matter": "^0.2.1", "vscode-extension-telemetry": "0.1.1", "vscode-nls": "^4.0.0" }, @@ -345,7 +345,7 @@ "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", "ts-loader": "^6.2.1", - "typescript": "^3.7.2", + "typescript": "^3.7.3", "vscode": "^1.1.10", "webpack": "^4.41.2", "webpack-cli": "^3.3.0" diff --git a/extensions/markdown-language-features/preview-src/index.ts b/extensions/markdown-language-features/preview-src/index.ts index 311c40b62d672..092148e19a4cd 100644 --- a/extensions/markdown-language-features/preview-src/index.ts +++ b/extensions/markdown-language-features/preview-src/index.ts @@ -10,7 +10,7 @@ import { getEditorLineNumberForPageOffset, scrollToRevealSourceLine, getLineElem import { getSettings, getData } from './settings'; import throttle = require('lodash.throttle'); -declare var acquireVsCodeApi: any; +declare let acquireVsCodeApi: any; let scrollDisabled = true; const marker = new ActiveLineMarker(); diff --git a/extensions/markdown-language-features/preview-src/tsconfig.json b/extensions/markdown-language-features/preview-src/tsconfig.json index 85159a000d958..e19cd4a675d7d 100644 --- a/extensions/markdown-language-features/preview-src/tsconfig.json +++ b/extensions/markdown-language-features/preview-src/tsconfig.json @@ -2,6 +2,11 @@ "extends": "../../shared.tsconfig.json", "compilerOptions": { "outDir": "./dist/", - "jsx": "react" + "jsx": "react", + "lib": [ + "es2018", + "DOM", + "DOM.Iterable" + ] } } diff --git a/extensions/markdown-language-features/schemas/package.schema.json b/extensions/markdown-language-features/schemas/package.schema.json index e76ce046c27f7..5591d0b0032c0 100644 --- a/extensions/markdown-language-features/schemas/package.schema.json +++ b/extensions/markdown-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "Markdown contributions to package.json", "type": "object", "properties": { @@ -29,4 +29,4 @@ } } } -} \ No newline at end of file +} diff --git a/extensions/markdown-language-features/src/extension.ts b/extensions/markdown-language-features/src/extension.ts index 7180f0a69c84a..0bcc8473745e4 100644 --- a/extensions/markdown-language-features/src/extension.ts +++ b/extensions/markdown-language-features/src/extension.ts @@ -49,14 +49,13 @@ function registerMarkdownLanguageFeatures( symbolProvider: MDDocumentSymbolProvider, engine: MarkdownEngine ): vscode.Disposable { - const selector: vscode.DocumentSelector = [ - { language: 'markdown', scheme: 'file' }, - { language: 'markdown', scheme: 'untitled' } - ]; + const selector: vscode.DocumentSelector = { language: 'markdown', scheme: '*' }; + + const charPattern = '(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})'; return vscode.Disposable.from( vscode.languages.setLanguageConfiguration('markdown', { - wordPattern: new RegExp('(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})+', 'ug'), + wordPattern: new RegExp(`${charPattern}((${charPattern}|[_])?${charPattern})*`, 'ug'), }), vscode.languages.registerDocumentSymbolProvider(selector, symbolProvider), vscode.languages.registerDocumentLinkProvider(selector, new LinkProvider()), diff --git a/extensions/markdown-language-features/src/features/preview.ts b/extensions/markdown-language-features/src/features/preview.ts index 2fbf35d8b2034..ad8edc1c2ad5a 100644 --- a/extensions/markdown-language-features/src/features/preview.ts +++ b/extensions/markdown-language-features/src/features/preview.ts @@ -490,6 +490,9 @@ export class DynamicMarkdownPreview extends Disposable { } private async onDidClickPreview(line: number): Promise { + // fix #82457, find currently opened but unfocused source tab + await vscode.commands.executeCommand('markdown.showSource'); + for (const visibleEditor of vscode.window.visibleTextEditors) { if (this.isPreviewOf(visibleEditor.document.uri)) { const editor = await vscode.window.showTextDocument(visibleEditor.document, visibleEditor.viewColumn); diff --git a/extensions/markdown-language-features/src/features/previewManager.ts b/extensions/markdown-language-features/src/features/previewManager.ts index 95b21eba50010..333a0651a448f 100644 --- a/extensions/markdown-language-features/src/features/previewManager.ts +++ b/extensions/markdown-language-features/src/features/previewManager.ts @@ -52,7 +52,7 @@ class PreviewStore extends Disposable { } } -export class MarkdownPreviewManager extends Disposable implements vscode.WebviewPanelSerializer, vscode.WebviewEditorProvider { +export class MarkdownPreviewManager extends Disposable implements vscode.WebviewPanelSerializer, vscode.WebviewCustomEditorProvider { private static readonly markdownPreviewActiveContextKey = 'markdownPreviewFocus'; private readonly _topmostLineMonitor = new TopmostLineMonitor(); @@ -70,7 +70,7 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview ) { super(); this._register(vscode.window.registerWebviewPanelSerializer(DynamicMarkdownPreview.viewType, this)); - this._register(vscode.window.registerWebviewEditorProvider('vscode.markdown.preview.editor', this)); + this._register(vscode.window.registerWebviewCustomEditorProvider('vscode.markdown.preview.editor', this)); } public refresh() { @@ -149,11 +149,11 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview } public async resolveWebviewEditor( - input: { readonly resource: vscode.Uri; }, + resource: vscode.Uri, webview: vscode.WebviewPanel - ): Promise { + ): Promise { const preview = DynamicMarkdownPreview.revive( - { resource: input.resource, locked: false, resourceColumn: vscode.ViewColumn.One }, + { resource, locked: false, resourceColumn: vscode.ViewColumn.One }, webview, this._contentProvider, this._previewConfigurations, @@ -161,7 +161,6 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview this._topmostLineMonitor, this._contributions); this.registerStaticPreview(preview); - return {}; } private createNewDynamicPreview( diff --git a/extensions/markdown-language-features/src/logger.ts b/extensions/markdown-language-features/src/logger.ts index 4ee89cbb811a9..2136a0530840a 100644 --- a/extensions/markdown-language-features/src/logger.ts +++ b/extensions/markdown-language-features/src/logger.ts @@ -41,13 +41,21 @@ export class Logger { public log(message: string, data?: any): void { if (this.trace === Trace.Verbose) { - this.appendLine(`[Log - ${(new Date().toLocaleTimeString())}] ${message}`); + this.appendLine(`[Log - ${this.now()}] ${message}`); if (data) { this.appendLine(Logger.data2String(data)); } } } + + private now(): string { + const now = new Date(); + return padLeft(now.getUTCHours() + '', 2, '0') + + ':' + padLeft(now.getMinutes() + '', 2, '0') + + ':' + padLeft(now.getUTCSeconds() + '', 2, '0') + '.' + now.getMilliseconds(); + } + public updateConfiguration() { this.trace = this.readTrace(); } @@ -73,3 +81,7 @@ export class Logger { return JSON.stringify(data, undefined, 2); } } + +function padLeft(s: string, n: number, pad = ' ') { + return pad.repeat(Math.max(0, n - s.length)) + s; +} diff --git a/extensions/markdown-language-features/src/markdownEngine.ts b/extensions/markdown-language-features/src/markdownEngine.ts index d3b88f06c42e7..33cb220b449db 100644 --- a/extensions/markdown-language-features/src/markdownEngine.ts +++ b/extensions/markdown-language-features/src/markdownEngine.ts @@ -242,8 +242,11 @@ export class MarkdownEngine { if (uri.path[0] === '/') { const root = vscode.workspace.getWorkspaceFolder(this.currentDocument!); if (root) { - uri = uri.with({ - path: path.join(root.uri.fsPath, uri.path), + const fileUri = vscode.Uri.file(path.join(root.uri.fsPath, uri.fsPath)); + uri = fileUri.with({ + scheme: uri.scheme, + fragment: uri.fragment, + query: uri.query, }); } } diff --git a/extensions/markdown-language-features/src/test/test-fixtures/marker.txt b/extensions/markdown-language-features/src/test/test-fixtures/marker.txt new file mode 100644 index 0000000000000..a4c9ad4073651 --- /dev/null +++ b/extensions/markdown-language-features/src/test/test-fixtures/marker.txt @@ -0,0 +1 @@ +DO NOT DELETE, USED BY INTEGRATION TESTS diff --git a/extensions/markdown-language-features/yarn.lock b/extensions/markdown-language-features/yarn.lock index 956c457152387..5c7a22c74f0ef 100644 --- a/extensions/markdown-language-features/yarn.lock +++ b/extensions/markdown-language-features/yarn.lock @@ -2821,10 +2821,10 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -markdown-it-front-matter@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.1.2.tgz#e50bf56e77e6a4f5ac4ffa894d4d45ccd9896b20" - integrity sha1-5Qv1bnfmpPWsT/qJTU1FzNmJayA= +markdown-it-front-matter@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.2.1.tgz#dca49a827bb3cebb0528452c1d87dff276eb28dc" + integrity sha512-ydUIqlKfDscRpRUTRcA3maeeUKn3Cl5EaKZSA+I/f0KOGCBurW7e+bbz59sxqkC3FA9Q2S2+t4mpkH9T0BCM6A== markdown-it@^10.0.0: version "10.0.0" @@ -4528,10 +4528,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@^3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== uc.micro@^1.0.1: version "1.0.3" diff --git a/extensions/merge-conflict/src/documentMergeConflict.ts b/extensions/merge-conflict/src/documentMergeConflict.ts index 560c7ed8c7282..d3d421f22d12a 100644 --- a/extensions/merge-conflict/src/documentMergeConflict.ts +++ b/extensions/merge-conflict/src/documentMergeConflict.ts @@ -35,7 +35,7 @@ export class DocumentMergeConflict implements interfaces.IDocumentMergeConflict public applyEdit(type: interfaces.CommitType, document: vscode.TextDocument, edit: { replace(range: vscode.Range, newText: string): void; }): void { // Each conflict is a set of ranges as follows, note placements or newlines - // which may not in in spans + // which may not in spans // [ Conflict Range -- (Entire content below) // [ Current Header ]\n -- >>>>> Header // [ Current Content ] -- (content) @@ -75,4 +75,4 @@ export class DocumentMergeConflict implements interfaces.IDocumentMergeConflict private isNewlineOnly(text: string) { return text === '\n' || text === '\r\n'; } -} \ No newline at end of file +} diff --git a/extensions/npm/extension.webpack.config.js b/extensions/npm/extension.webpack.config.js index d50d9966f639c..56a1589f46022 100644 --- a/extensions/npm/extension.webpack.config.js +++ b/extensions/npm/extension.webpack.config.js @@ -19,7 +19,7 @@ module.exports = withDefaults({ output: { filename: 'main.js', path: path.join(__dirname, 'dist'), - libraryTarget: "commonjs", + libraryTarget: 'commonjs', }, resolve: { mainFields: ['module', 'main'], diff --git a/extensions/npm/package.json b/extensions/npm/package.json index cbd9645341a31..79a95f7fc1bf8 100644 --- a/extensions/npm/package.json +++ b/extensions/npm/package.json @@ -18,10 +18,10 @@ "watch": "gulp watch-extension:npm" }, "dependencies": { - "jsonc-parser": "^2.1.1", + "jsonc-parser": "^2.2.1", "minimatch": "^3.0.4", "request-light": "^0.2.5", - "vscode-nls": "^4.0.0" + "vscode-nls": "^4.1.1" }, "devDependencies": { "@types/minimatch": "^3.0.3", diff --git a/extensions/npm/package.nls.json b/extensions/npm/package.nls.json index 014010a8425d1..51756d241f14a 100644 --- a/extensions/npm/package.nls.json +++ b/extensions/npm/package.nls.json @@ -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 npm scripts explorer: `open` or `run`, the default is `open`.", - "config.npm.enableRunFromFolder": "Enable running NPM scripts contained in a folder from the Explorer context menu.", + "config.npm.enableRunFromFolder": "Enable running npm scripts contained in a folder from the Explorer context menu.", "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.", diff --git a/extensions/npm/src/features/jsonContributions.ts b/extensions/npm/src/features/jsonContributions.ts index e59b7866ec367..4a255baf82334 100644 --- a/extensions/npm/src/features/jsonContributions.ts +++ b/extensions/npm/src/features/jsonContributions.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Location, getLocation, createScanner, SyntaxKind, ScanError } from 'jsonc-parser'; +import { Location, getLocation, createScanner, SyntaxKind, ScanError, JSONScanner } from 'jsonc-parser'; import { basename } from 'path'; import { BowerJSONContribution } from './bowerJSONContribution'; import { PackageJSONContribution } from './packageJSONContribution'; @@ -111,7 +111,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { add: (suggestion: CompletionItem) => { if (!proposed[suggestion.label]) { proposed[suggestion.label] = true; - suggestion.range = overwriteRange; + suggestion.range = { replacing: overwriteRange, inserting: new Range(overwriteRange.start, overwriteRange.start) }; items.push(suggestion); } }, @@ -123,8 +123,9 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { let collectPromise: Thenable | null = null; if (location.isAtPropertyKey) { - const addValue = !location.previousNode || !location.previousNode.colonOffset; - const isLast = this.isLast(document, position); + const scanner = createScanner(document.getText(), true); + const addValue = !location.previousNode || !this.hasColonAfter(scanner, location.previousNode.offset + location.previousNode.length); + const isLast = this.isLast(scanner, document.offsetAt(position)); collectPromise = this.jsonContribution.collectPropertySuggestions(fileName, location, currentWord, addValue, isLast, collector); } else { if (location.path.length === 0) { @@ -153,15 +154,19 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { return text.substring(i + 1, position.character); } - private isLast(document: TextDocument, position: Position): boolean { - const scanner = createScanner(document.getText(), true); - scanner.setPosition(document.offsetAt(position)); + private isLast(scanner: JSONScanner, offset: number): boolean { + scanner.setPosition(offset); let nextToken = scanner.scan(); if (nextToken === SyntaxKind.StringLiteral && scanner.getTokenError() === ScanError.UnexpectedEndOfString) { nextToken = scanner.scan(); } return nextToken === SyntaxKind.CloseBraceToken || nextToken === SyntaxKind.EOF; } + private hasColonAfter(scanner: JSONScanner, offset: number): boolean { + scanner.setPosition(offset); + return scanner.scan() === SyntaxKind.ColonToken; + } + } export const xhrDisabled = () => Promise.reject({ responseText: 'Use of online resources is disabled.' }); diff --git a/extensions/npm/src/main.ts b/extensions/npm/src/main.ts index 3777f39375737..b79638ed1f0da 100644 --- a/extensions/npm/src/main.ts +++ b/extensions/npm/src/main.ts @@ -21,7 +21,7 @@ export async function activate(context: vscode.ExtensionContext): Promise configureHttpRequest(); let d = vscode.workspace.onDidChangeConfiguration((e) => { configureHttpRequest(); - if (e.affectsConfiguration('npm.exclude')) { + if (e.affectsConfiguration('npm.exclude') || e.affectsConfiguration('npm.autoDetect')) { invalidateTasksCache(); if (treeDataProvider) { treeDataProvider.refresh(); @@ -70,7 +70,7 @@ function registerTaskProvider(context: vscode.ExtensionContext): vscode.Disposab context.subscriptions.push(workspaceWatcher); let provider: vscode.TaskProvider = new NpmTaskProvider(); - let disposable = vscode.workspace.registerTaskProvider('npm', provider); + let disposable = vscode.tasks.registerTaskProvider('npm', provider); context.subscriptions.push(disposable); return disposable; } diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts index b5234c5fc1b44..03933d0a4c511 100644 --- a/extensions/npm/src/npmView.ts +++ b/extensions/npm/src/npmView.ts @@ -12,7 +12,7 @@ import { import { visit, JSONVisitor } from 'jsonc-parser'; import { NpmTaskDefinition, getPackageJsonUriFromTask, getScripts, - isWorkspaceFolder, getTaskName, createTask, extractDebugArgFromScript, startDebugging + isWorkspaceFolder, getTaskName, createTask, extractDebugArgFromScript, startDebugging, isAutoDetectionEnabled } from './tasks'; import * as nls from 'vscode-nls'; @@ -119,8 +119,8 @@ class NpmScript extends TreeItem { } class NoScripts extends TreeItem { - constructor() { - super(localize('noScripts', 'No scripts found'), TreeItemCollapsibleState.None); + constructor(message: string) { + super(message, TreeItemCollapsibleState.None); this.contextValue = 'noscripts'; } } @@ -260,7 +260,11 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { if (taskItems) { this.taskTree = this.buildTaskTree(taskItems); if (this.taskTree.length === 0) { - this.taskTree = [new NoScripts()]; + let message = localize('noScripts', 'No scripts found.'); + if (!isAutoDetectionEnabled()) { + message = localize('autoDetectIsOff', 'The setting "npm.autoDetect" is "off".'); + } + this.taskTree = [new NoScripts(message)]; } } } diff --git a/extensions/npm/src/tasks.ts b/extensions/npm/src/tasks.ts index c8a1eb852360e..661796a375607 100644 --- a/extensions/npm/src/tasks.ts +++ b/extensions/npm/src/tasks.ts @@ -144,7 +144,7 @@ async function detectNpmScripts(): Promise { for (const folder of folders) { if (isAutoDetectionEnabled(folder)) { let relativePattern = new RelativePattern(folder, '**/package.json'); - let paths = await workspace.findFiles(relativePattern, '**/node_modules/**'); + let paths = await workspace.findFiles(relativePattern, '**/{node_modules,.vscode-test}/**'); for (const path of paths) { if (!isExcluded(folder, path) && !visitedPackageJsonFiles.has(path.fsPath)) { let tasks = await provideNpmScriptsForFolder(path); @@ -190,8 +190,8 @@ export async function provideNpmScripts(): Promise { return cachedTasks; } -function isAutoDetectionEnabled(folder: WorkspaceFolder): boolean { - return workspace.getConfiguration('npm', folder.uri).get('autoDetect') === 'on'; +export function isAutoDetectionEnabled(folder?: WorkspaceFolder): boolean { + return workspace.getConfiguration('npm', folder?.uri).get('autoDetect') === 'on'; } function isExcluded(folder: WorkspaceFolder, packageJsonUri: Uri) { diff --git a/extensions/npm/yarn.lock b/extensions/npm/yarn.lock index 4c6c723c3cb6d..9b8a23c926417 100644 --- a/extensions/npm/yarn.lock +++ b/extensions/npm/yarn.lock @@ -79,10 +79,10 @@ https-proxy-agent@^2.2.3: agent-base "^4.3.0" debug "^3.1.0" -jsonc-parser@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" - integrity sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g== +jsonc-parser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== minimatch@^3.0.4: version "3.0.4" @@ -105,11 +105,6 @@ request-light@^0.2.5: https-proxy-agent "^2.2.3" vscode-nls "^4.1.1" -vscode-nls@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" - integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== - vscode-nls@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" diff --git a/extensions/objective-c/cgmanifest.json b/extensions/objective-c/cgmanifest.json index 9ff092c2ab098..fc4983b457aaa 100644 --- a/extensions/objective-c/cgmanifest.json +++ b/extensions/objective-c/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "bc7dedd28eebe52b374744d3fb34d77ff441569e" + "commitHash": "d62c0002b4c36c1c5add356ecc6f478bc2d416e1" } }, "license": "MIT", diff --git a/extensions/objective-c/language-configuration.json b/extensions/objective-c/language-configuration.json index e4656d0babb69..a81a8864a5127 100644 --- a/extensions/objective-c/language-configuration.json +++ b/extensions/objective-c/language-configuration.json @@ -12,8 +12,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -22,4 +22,4 @@ ["\"", "\""], ["'", "'"] ] -} \ No newline at end of file +} diff --git a/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json b/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json index 2510f2dc7438d..429d532610414 100644 --- a/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json +++ b/extensions/objective-c/syntaxes/objective-c++.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/bc7dedd28eebe52b374744d3fb34d77ff441569e", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/d62c0002b4c36c1c5add356ecc6f478bc2d416e1", "name": "Objective-C++", "scopeName": "source.objcpp", "patterns": [ diff --git a/extensions/objective-c/syntaxes/objective-c.tmLanguage.json b/extensions/objective-c/syntaxes/objective-c.tmLanguage.json index c4f19d8db544c..626678f5295f2 100644 --- a/extensions/objective-c/syntaxes/objective-c.tmLanguage.json +++ b/extensions/objective-c/syntaxes/objective-c.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/bc7dedd28eebe52b374744d3fb34d77ff441569e", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/d62c0002b4c36c1c5add356ecc6f478bc2d416e1", "name": "Objective-C", "scopeName": "source.objc", "patterns": [ diff --git a/extensions/objective-c/test/colorize-results/test_m.json b/extensions/objective-c/test/colorize-results/test_m.json index 5923e3433da51..d0a8eb93dd31d 100644 --- a/extensions/objective-c/test/colorize-results/test_m.json +++ b/extensions/objective-c/test/colorize-results/test_m.json @@ -752,9 +752,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracket.square.access.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1731,9 +1731,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.other.unit.hexadecimal.objc", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1742,9 +1742,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.hexadecimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1819,9 +1819,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1830,9 +1830,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.point.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1841,9 +1841,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1896,9 +1896,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1907,9 +1907,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.point.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1918,9 +1918,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1929,9 +1929,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.other.unit.exponent.decimal.objc", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1940,9 +1940,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.exponent.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1995,9 +1995,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2006,9 +2006,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.point.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2017,9 +2017,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2028,9 +2028,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.other.unit.exponent.decimal.objc", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2039,9 +2039,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.operator.minus.exponent.decimal.objc", "r": { "dark_plus": "keyword.operator.minus.exponent: #B5CEA8", - "light_plus": "keyword.operator.minus.exponent: #09885A", + "light_plus": "keyword.operator.minus.exponent: #098658", "dark_vs": "keyword.operator.minus.exponent: #B5CEA8", - "light_vs": "keyword.operator.minus.exponent: #09885A", + "light_vs": "keyword.operator.minus.exponent: #098658", "hc_black": "keyword.operator: #D4D4D4" } }, @@ -2050,9 +2050,9 @@ "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.exponent.decimal.objc", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3090,4 +3090,4 @@ "hc_black": "storage.type: #569CD6" } } -] \ No newline at end of file +] diff --git a/extensions/objective-c/test/colorize-results/test_mm.json b/extensions/objective-c/test/colorize-results/test_mm.json index 6134c33a619be..e724c6022ffc8 100644 --- a/extensions/objective-c/test/colorize-results/test_mm.json +++ b/extensions/objective-c/test/colorize-results/test_mm.json @@ -752,9 +752,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.bracket.square.access.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1731,9 +1731,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.other.unit.hexadecimal.objcpp", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1742,9 +1742,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.hexadecimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1819,9 +1819,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1830,9 +1830,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.point.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1841,9 +1841,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1896,9 +1896,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1907,9 +1907,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.point.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1918,9 +1918,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1929,9 +1929,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.other.unit.exponent.decimal.objcpp", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1940,9 +1940,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.exponent.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1995,9 +1995,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2006,9 +2006,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.point.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2017,9 +2017,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2028,9 +2028,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.other.unit.exponent.decimal.objcpp", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2039,9 +2039,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.minus.exponent.decimal.objcpp", "r": { "dark_plus": "keyword.operator.minus.exponent: #B5CEA8", - "light_plus": "keyword.operator.minus.exponent: #09885A", + "light_plus": "keyword.operator.minus.exponent: #098658", "dark_vs": "keyword.operator.minus.exponent: #B5CEA8", - "light_vs": "keyword.operator.minus.exponent: #09885A", + "light_vs": "keyword.operator.minus.exponent: #098658", "hc_black": "keyword.operator: #D4D4D4" } }, @@ -2050,9 +2050,9 @@ "t": "source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.exponent.decimal.objcpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3090,4 +3090,4 @@ "hc_black": "storage.type: #569CD6" } } -] \ No newline at end of file +] diff --git a/extensions/package.json b/extensions/package.json index 688a5c05063c8..b8e304b2343dd 100644 --- a/extensions/package.json +++ b/extensions/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "Dependencies shared by all extensions", "dependencies": { - "typescript": "3.7.2" + "typescript": "3.8.2" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/perl/perl.language-configuration.json b/extensions/perl/perl.language-configuration.json index 6cf6295b7985e..4d18f1fbaa485 100644 --- a/extensions/perl/perl.language-configuration.json +++ b/extensions/perl/perl.language-configuration.json @@ -11,9 +11,9 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"], - ["`", "`"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "`", "close": "`", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -25,8 +25,8 @@ ], "folding": { "markers": { - "start": "^=pod\\s*$", - "end": "^=cut\\s*$" + "start": "^(?:(?:=pod\\s*$)|(?:\\s*#region\\b))", + "end": "^(?:(?:=cut\\s*$)|(?:\\s*#endregion\\b))" } } -} \ No newline at end of file +} diff --git a/extensions/perl/perl6.language-configuration.json b/extensions/perl/perl6.language-configuration.json index 01b6a8a28239e..be52105cbdf14 100644 --- a/extensions/perl/perl6.language-configuration.json +++ b/extensions/perl/perl6.language-configuration.json @@ -11,9 +11,9 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"], - ["`", "`"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "`", "close": "`", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -23,4 +23,4 @@ ["'", "'"], ["`", "`"] ] -} \ No newline at end of file +} diff --git a/extensions/php-language-features/src/features/validationProvider.ts b/extensions/php-language-features/src/features/validationProvider.ts index 122c108ac378b..5c9d34afb5944 100644 --- a/extensions/php-language-features/src/features/validationProvider.ts +++ b/extensions/php-language-features/src/features/validationProvider.ts @@ -247,7 +247,7 @@ export default class PHPValidationProvider { } }; - let options = vscode.workspace.rootPath ? { cwd: vscode.workspace.rootPath } : undefined; + let options = (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[0]) ? { cwd: vscode.workspace.workspaceFolders[0].uri.fsPath } : undefined; let args: string[]; if (this.trigger === RunTrigger.onSave) { args = PHPValidationProvider.FileArgs.slice(0); diff --git a/extensions/php/cgmanifest.json b/extensions/php/cgmanifest.json index 71caf1a84da4f..5b4050cdcd042 100644 --- a/extensions/php/cgmanifest.json +++ b/extensions/php/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "language-php", "repositoryUrl": "https://github.com/atom/language-php", - "commitHash": "43a7b842fb58ac7561184db142344a1b127e0d52" + "commitHash": "96368115562c38ab3a203a03c4e26cca80fa2a10" } }, "license": "MIT", - "version": "0.44.2" + "version": "0.44.4" } ], "version": 1 diff --git a/extensions/php/syntaxes/php.tmLanguage.json b/extensions/php/syntaxes/php.tmLanguage.json index 2b9370f917cfb..08fb0a9eb5fd9 100644 --- a/extensions/php/syntaxes/php.tmLanguage.json +++ b/extensions/php/syntaxes/php.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-php/commit/43a7b842fb58ac7561184db142344a1b127e0d52", + "version": "https://github.com/atom/language-php/commit/96368115562c38ab3a203a03c4e26cca80fa2a10", "scopeName": "source.php", "patterns": [ { @@ -230,7 +230,7 @@ ] }, { - "begin": "(?i)(?:^|(?<=}))\\s*(?:(abstract|final)\\s+)?(class)\\s+([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*)", + "begin": "(?ix)\n(?:\n (?:^|(?<=}))\\s*(?:(abstract|final)\\s+)?(class)\\s+([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*)\n |\\b(new)\\s+(class)\\b # anonymous class\n)", "beginCaptures": { "1": { "name": "storage.modifier.${1:/downcase}.php" @@ -240,6 +240,12 @@ }, "3": { "name": "entity.name.type.class.php" + }, + "4": { + "name": "keyword.other.new.php" + }, + "5": { + "name": "storage.type.class.php" } }, "end": "}|(?=\\?>)", @@ -439,22 +445,25 @@ "name": "keyword.control.exception.php" }, { - "begin": "(?i)\\b(function)\\s*(?=\\()", + "begin": "(?i)\\b(function)\\s*(?=&?\\s*\\()", "beginCaptures": { "1": { "name": "storage.type.function.php" } }, - "end": "(?={)", + "end": "(?=\\s*{)", "name": "meta.function.closure.php", "patterns": [ { "include": "#comments" }, { - "begin": "\\(", + "begin": "(&)?\\s*(\\()", "beginCaptures": { - "0": { + "1": { + "name": "storage.modifier.reference.php" + }, + "2": { "name": "punctuation.definition.parameters.begin.bracket.round.php" } }, @@ -504,11 +513,79 @@ "name": "meta.function.closure.use.php" } ] + }, + { + "match": "(:)\\s*(\\?)?\\s*((?:\\\\?[a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*)+)", + "captures": { + "1": { + "name": "keyword.operator.return-value.php" + }, + "2": { + "name": "keyword.operator.nullable-type.php" + }, + "3": { + "name": "storage.type.php" + } + } + } + ] + }, + { + "begin": "(?i)\\b(fn)\\s*(?=&?\\s*\\()", + "beginCaptures": { + "1": { + "name": "storage.type.function.php" + } + }, + "end": "=>", + "endCaptures": { + "0": { + "name": "punctuation.definition.arrow.php" + } + }, + "name": "meta.function.closure.php", + "patterns": [ + { + "begin": "(&)?\\s*(\\()", + "beginCaptures": { + "1": { + "name": "storage.modifier.reference.php" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "contentName": "meta.function.parameters.php", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "#function-parameters" + } + ] + }, + { + "match": "(:)\\s*(\\?)?\\s*((?:\\\\?[a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*)+)\\s*", + "captures": { + "1": { + "name": "keyword.operator.return-value.php" + }, + "2": { + "name": "keyword.operator.nullable-type.php" + }, + "3": { + "name": "storage.type.php" + } + } } ] }, { - "begin": "(?x)\n((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n(function)\\s+\n(?i:\n (__(?:call|construct|debugInfo|destruct|get|set|isset|unset|toString|\n clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n |([a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*)\n)\n\\s*(\\()", + "begin": "(?x)\n((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n(function)\\s+\n(?i:\n (__(?:call|construct|debugInfo|destruct|get|set|isset|unset|toString|\n clone|set_state|sleep|wakeup|autoload|invoke|callStatic|serialize|unserialize))\n |(?:(&)?\\s*([a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*))\n)\n\\s*(\\()", "beginCaptures": { "1": { "patterns": [ @@ -525,14 +602,17 @@ "name": "support.function.magic.php" }, "4": { - "name": "entity.name.function.php" + "name": "storage.modifier.reference.php" }, "5": { + "name": "entity.name.function.php" + }, + "6": { "name": "punctuation.definition.parameters.begin.bracket.round.php" } }, "contentName": "meta.function.parameters.php", - "end": "(\\))(?:\\s*(:)\\s*(\\?)?\\s*([a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*))?", + "end": "(\\))(?:\\s*(:)\\s*(\\?)?\\s*((?:\\\\?[a-zA-Z_\\x{7f}-\\x{7fffffff}][a-zA-Z0-9_\\x{7f}-\\x{7fffffff}]*)+))?", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.bracket.round.php" @@ -554,6 +634,44 @@ } ] }, + { + "match": "(?xi)\n((?:(?:public|private|protected|static)(?:\\s+|(?=\\?)))+) # At least one modifier\n(?:(\\?)?\\s* # Optional nullable\n (\\\\?(?:[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*\\\\)*) # Optional namespace\n ([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*))? # Typehinted class name\n\\s+((\\$)[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*) # Variable name", + "captures": { + "1": { + "patterns": [ + { + "match": "public|private|protected|static", + "name": "storage.modifier.php" + } + ] + }, + "2": { + "name": "keyword.operator.nullable-type.php" + }, + "3": { + "name": "support.other.namespace.php", + "patterns": [ + { + "match": "(?i)[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*", + "name": "storage.type.php" + }, + { + "match": "\\\\", + "name": "punctuation.separator.inheritance.php" + } + ] + }, + "4": { + "name": "storage.type.php" + }, + "5": { + "name": "variable.other.php" + }, + "6": { + "name": "punctuation.definition.variable.php" + } + } + }, { "include": "#invoke-call" }, @@ -647,6 +765,10 @@ "match": "(?i)\\bclone\\b", "name": "keyword.other.clone.php" }, + { + "match": "\\.\\.\\.", + "name": "keyword.operator.spread.php" + }, { "match": "\\.=?", "name": "keyword.operator.string.php" @@ -678,7 +800,7 @@ "name": "keyword.operator.comparison.php" }, { - "match": "=|\\+=|\\-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=", + "match": "=|\\+=|\\-=|\\*\\*?=|/=|%=|&=|\\|=|\\^=|<<=|>>=|\\?\\?=", "name": "keyword.operator.assignment.php" }, { @@ -690,7 +812,7 @@ "name": "keyword.operator.increment-decrement.php" }, { - "match": "\\-|\\+|\\*|/|%", + "match": "\\-|\\+|\\*\\*?|/|%", "name": "keyword.operator.arithmetic.php" }, { @@ -1939,7 +2061,7 @@ ] }, "instantiation": { - "begin": "(?i)(new)\\s+", + "begin": "(?i)(new)\\s+(?!class\\b)", "beginCaptures": { "1": { "name": "keyword.other.new.php" @@ -2046,19 +2168,19 @@ "numbers": { "patterns": [ { - "match": "0[xX][0-9a-fA-F]+", + "match": "0[xX][0-9a-fA-F]+(?:_[0-9a-fA-F]+)*", "name": "constant.numeric.hex.php" }, { - "match": "0[bB][01]+", + "match": "0[bB][01]+(?:_[01]+)*", "name": "constant.numeric.binary.php" }, { - "match": "0[0-7]+", + "match": "0(?:_?[0-7]+)+", "name": "constant.numeric.octal.php" }, { - "match": "(?x)\n(?:\n [0-9]*(\\.)[0-9]+(?:[eE][+-]?[0-9]+)?|\n [0-9]+(\\.)[0-9]*(?:[eE][+-]?[0-9]+)?|\n [0-9]+[eE][+-]?[0-9]+\n)", + "match": "(?x)\n(?:\n (?:[0-9]+(?:_[0-9]+)*)?(\\.)[0-9]+(?:_[0-9]+)*(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # .3\n [0-9]+(?:_[0-9]+)*(\\.)(?:[0-9]+(?:_[0-9]+)*)?(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # 3.\n [0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)* # 2e-3\n)", "name": "constant.numeric.decimal.php", "captures": { "1": { @@ -2070,7 +2192,7 @@ } }, { - "match": "0|[1-9][0-9]*", + "match": "0|[1-9](?:_?[0-9]+)*", "name": "constant.numeric.decimal.php" } ] diff --git a/extensions/php/test/colorize-results/issue-28354_php.json b/extensions/php/test/colorize-results/issue-28354_php.json index 3a34ef9deb8db..27983076fa71d 100644 --- a/extensions/php/test/colorize-results/issue-28354_php.json +++ b/extensions/php/test/colorize-results/issue-28354_php.json @@ -1,4 +1,5 @@ -[{ +[ + { "c": "<", "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", "r": { @@ -495,7 +496,7 @@ }, { "c": "<", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/php/test/colorize-results/test_php.json b/extensions/php/test/colorize-results/test_php.json index 277428ac11b70..62c1b712679c9 100644 --- a/extensions/php/test/colorize-results/test_php.json +++ b/extensions/php/test/colorize-results/test_php.json @@ -1137,9 +1137,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1225,9 +1225,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2490,9 +2490,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2776,9 +2776,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2864,9 +2864,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3062,9 +3062,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3172,9 +3172,9 @@ "t": "text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3629,4 +3629,4 @@ "hc_black": "punctuation.definition.tag: #808080" } } -] \ No newline at end of file +] diff --git a/extensions/powershell/test/colorize-results/test_ps1.json b/extensions/powershell/test/colorize-results/test_ps1.json index 67380ce77b6ff..d12f004fb9faf 100644 --- a/extensions/powershell/test/colorize-results/test_ps1.json +++ b/extensions/powershell/test/colorize-results/test_ps1.json @@ -950,9 +950,9 @@ "t": "source.powershell meta.scriptblock.powershell interpolated.simple.source.powershell meta.attribute.powershell constant.numeric.integer.powershell", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1522,9 +1522,9 @@ "t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell constant.numeric.integer.powershell", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1599,9 +1599,9 @@ "t": "source.powershell meta.scriptblock.powershell meta.scriptblock.powershell meta.scriptblock.powershell interpolated.simple.source.powershell constant.numeric.integer.powershell", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2892,4 +2892,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/pug/language-configuration.json b/extensions/pug/language-configuration.json index 00f4885d46e8a..98a2b77ca27d3 100644 --- a/extensions/pug/language-configuration.json +++ b/extensions/pug/language-configuration.json @@ -11,8 +11,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["'", "'"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -24,4 +24,4 @@ "folding": { "offSide": true } -} \ No newline at end of file +} diff --git a/extensions/pug/test/colorize-results/test_pug.json b/extensions/pug/test/colorize-results/test_pug.json index a022fd80cd057..b23f1fca31f0d 100644 --- a/extensions/pug/test/colorize-results/test_pug.json +++ b/extensions/pug/test/colorize-results/test_pug.json @@ -158,9 +158,9 @@ "t": "text.pug meta.tag.other attribute_value constant.numeric.decimal.js", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -180,9 +180,9 @@ "t": "text.pug meta.tag.other attribute_value constant.numeric.decimal.js", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -455,9 +455,9 @@ "t": "text.pug meta.tag.other attribute_value constant.numeric.decimal.js", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -477,9 +477,9 @@ "t": "text.pug meta.tag.other attribute_value constant.numeric.decimal.js", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1704,4 +1704,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/python/package.json b/extensions/python/package.json index 645cba2bae386..1a7a65b2dee30 100644 --- a/extensions/python/package.json +++ b/extensions/python/package.json @@ -8,13 +8,14 @@ "engines": { "vscode": "*" }, "activationEvents": ["onLanguage:python"], "main": "./out/pythonMain", + "extensionKind": [ "ui", "workspace" ], "contributes": { "languages": [{ "id": "python", "extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".pyi", ".ipy"], "aliases": [ "Python", "py" ], "filenames": [ "Snakefile" ], - "firstLine": "^#!\\s*/.*\\bpython[0-9.-]*\\b", + "firstLine": "^#!\\s*/?.*\\bpython[0-9.-]*\\b", "configuration": "./language-configuration.json" }], "grammars": [{ diff --git a/extensions/python/test/colorize-results/test_py.json b/extensions/python/test/colorize-results/test_py.json index 2c3126586250e..c61d2db7611c9 100644 --- a/extensions/python/test/colorize-results/test_py.json +++ b/extensions/python/test/colorize-results/test_py.json @@ -169,9 +169,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -565,9 +565,9 @@ "t": "source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.float.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1137,9 +1137,9 @@ "t": "source.python meta.function.python meta.function.parameters.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1214,9 +1214,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1280,9 +1280,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1324,9 +1324,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1390,9 +1390,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1456,9 +1456,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1522,9 +1522,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1566,9 +1566,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1632,9 +1632,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1698,9 +1698,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1764,9 +1764,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1808,9 +1808,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1874,9 +1874,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1962,9 +1962,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2424,9 +2424,9 @@ "t": "source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2446,9 +2446,9 @@ "t": "source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2468,9 +2468,9 @@ "t": "source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2490,9 +2490,9 @@ "t": "source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2985,9 +2985,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3359,9 +3359,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3414,9 +3414,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3480,9 +3480,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3568,9 +3568,9 @@ "t": "source.python constant.numeric.float.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3601,9 +3601,9 @@ "t": "source.python constant.numeric.float.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3656,9 +3656,9 @@ "t": "source.python constant.numeric.float.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3722,9 +3722,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3854,9 +3854,9 @@ "t": "source.python constant.numeric.float.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3898,9 +3898,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6252,9 +6252,9 @@ "t": "source.python constant.numeric.dec.python", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6797,4 +6797,4 @@ "hc_black": "string: #CE9178" } } -] \ No newline at end of file +] diff --git a/extensions/r/cgmanifest.json b/extensions/r/cgmanifest.json index 0781a1507229b..7cf785d7140b3 100644 --- a/extensions/r/cgmanifest.json +++ b/extensions/r/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "Ikuyadeu/vscode-R", "repositoryUrl": "https://github.com/Ikuyadeu/vscode-R", - "commitHash": "1cd3d42a6b2e54276ef2d71fe33bb3fefb1d6cff" + "commitHash": "bc79e9245682ee09b4f0b742b927a37702d91b82" } }, "license": "MIT", - "version": "0.5.5" + "version": "1.1.8" } ], "version": 1 diff --git a/extensions/r/language-configuration.json b/extensions/r/language-configuration.json index 6293d4d61a694..dd691e2a6d4c4 100644 --- a/extensions/r/language-configuration.json +++ b/extensions/r/language-configuration.json @@ -11,12 +11,14 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + ["\"", "\""], + ["'", "'"] ] -} \ No newline at end of file +} diff --git a/extensions/r/syntaxes/r.tmLanguage.json b/extensions/r/syntaxes/r.tmLanguage.json index db37b8421fe1e..2b6c4368da97f 100644 --- a/extensions/r/syntaxes/r.tmLanguage.json +++ b/extensions/r/syntaxes/r.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Ikuyadeu/vscode-R/commit/1cd3d42a6b2e54276ef2d71fe33bb3fefb1d6cff", + "version": "https://github.com/Ikuyadeu/vscode-R/commit/bc79e9245682ee09b4f0b742b927a37702d91b82", "name": "R", "scopeName": "source.r", "patterns": [ @@ -417,7 +417,7 @@ "end": "(\\))", "endCaptures": { "1": { - "name": "punctuation.definition.parameters.r" + "name": "punctuation.section.parens.end.r" } }, "name": "meta.function-call.r", diff --git a/extensions/r/test/colorize-results/test_r.json b/extensions/r/test/colorize-results/test_r.json index 2cba70d079bfc..3ecd0091ce5a6 100644 --- a/extensions/r/test/colorize-results/test_r.json +++ b/extensions/r/test/colorize-results/test_r.json @@ -554,9 +554,9 @@ "t": "source.r meta.function-call.r meta.function-call.arguments.r constant.numeric.float.decimal.r", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -598,9 +598,9 @@ "t": "source.r meta.function-call.r meta.function-call.arguments.r constant.numeric.float.decimal.r", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -631,15 +631,15 @@ "t": "source.r meta.function-call.r meta.function-call.arguments.r constant.numeric.float.decimal.r", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, { "c": ")", - "t": "source.r meta.function-call.r punctuation.definition.parameters.r", + "t": "source.r meta.function-call.r punctuation.section.parens.end.r", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -675,9 +675,9 @@ "t": "source.r meta.function-call.r meta.function-call.arguments.r constant.numeric.float.decimal.r", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -708,15 +708,15 @@ "t": "source.r meta.function-call.r meta.function-call.arguments.r constant.numeric.float.decimal.r", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, { "c": ")", - "t": "source.r meta.function-call.r punctuation.definition.parameters.r", + "t": "source.r meta.function-call.r punctuation.section.parens.end.r", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/razor/test/colorize-results/test_cshtml.json b/extensions/razor/test/colorize-results/test_cshtml.json index 37e1a3d66d12f..e542974ce4268 100644 --- a/extensions/razor/test/colorize-results/test_cshtml.json +++ b/extensions/razor/test/colorize-results/test_cshtml.json @@ -92,9 +92,9 @@ "t": "text.html.cshtml constant.numeric.decimal.cs", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3695,4 +3695,4 @@ "hc_black": "punctuation.definition.tag: #808080" } } -] \ No newline at end of file +] diff --git a/extensions/ruby/language-configuration.json b/extensions/ruby/language-configuration.json index 47c434deffafa..81fdee540f216 100644 --- a/extensions/ruby/language-configuration.json +++ b/extensions/ruby/language-configuration.json @@ -12,15 +12,17 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "`", "close": "`", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"], ["\"", "\""], - ["'", "'"] + ["'", "'"], + ["`", "`"] ], "indentationRules": { "increaseIndentPattern": "^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|(\"|'|\/).*\\4)*(#.*)?$", diff --git a/extensions/ruby/test/colorize-results/test_rb.json b/extensions/ruby/test/colorize-results/test_rb.json index c53ee5970e20f..66468920c9962 100644 --- a/extensions/ruby/test/colorize-results/test_rb.json +++ b/extensions/ruby/test/colorize-results/test_rb.json @@ -2017,9 +2017,9 @@ "t": "source.ruby constant.numeric.integer.ruby", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2666,9 +2666,9 @@ "t": "source.ruby constant.numeric.integer.ruby", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2837,4 +2837,4 @@ "hc_black": "keyword.control: #C586C0" } } -] \ No newline at end of file +] diff --git a/extensions/rust/language-configuration.json b/extensions/rust/language-configuration.json index bd4cbb8d8f079..5d4f16d26a650 100644 --- a/extensions/rust/language-configuration.json +++ b/extensions/rust/language-configuration.json @@ -12,14 +12,13 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + ["\"", "\""] ], "indentationRules": { "increaseIndentPattern": "^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$", diff --git a/extensions/scss/test/colorize-results/test-cssvariables_scss.json b/extensions/scss/test/colorize-results/test-cssvariables_scss.json index e51a05d345fb1..c2862cddcb8ec 100644 --- a/extensions/scss/test/colorize-results/test-cssvariables_scss.json +++ b/extensions/scss/test/colorize-results/test-cssvariables_scss.json @@ -92,9 +92,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -103,9 +103,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -180,9 +180,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -400,9 +400,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -499,9 +499,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -510,9 +510,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -549,4 +549,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/scss/test/colorize-results/test_scss.json b/extensions/scss/test/colorize-results/test_scss.json index 2515405079572..a95d72d9e1615 100644 --- a/extensions/scss/test/colorize-results/test_scss.json +++ b/extensions/scss/test/colorize-results/test_scss.json @@ -290,9 +290,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -301,9 +301,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -433,9 +433,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -444,9 +444,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -708,9 +708,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -719,9 +719,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1335,9 +1335,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1346,9 +1346,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1368,9 +1368,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1379,9 +1379,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1500,9 +1500,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1511,9 +1511,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -1874,9 +1874,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1962,9 +1962,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1973,9 +1973,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -2182,9 +2182,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2303,9 +2303,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2886,9 +2886,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -2897,9 +2897,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -3106,9 +3106,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3117,9 +3117,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -3249,9 +3249,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3260,9 +3260,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -3326,9 +3326,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3337,9 +3337,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -3909,9 +3909,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3942,9 +3942,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -3975,9 +3975,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4008,9 +4008,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4184,9 +4184,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4195,9 +4195,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4239,9 +4239,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4250,9 +4250,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4305,9 +4305,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4624,9 +4624,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4635,9 +4635,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4679,9 +4679,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4690,9 +4690,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -4811,9 +4811,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss string.quoted.double.scss variable.interpolation.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4855,9 +4855,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss string.quoted.double.scss variable.interpolation.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -4976,9 +4976,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5009,9 +5009,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5020,9 +5020,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5053,9 +5053,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5064,9 +5064,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5196,9 +5196,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5262,9 +5262,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5273,9 +5273,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5339,9 +5339,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5350,9 +5350,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5460,9 +5460,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5471,9 +5471,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5526,9 +5526,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -5537,9 +5537,9 @@ "t": "source.css.scss meta.definition.variable.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -5845,9 +5845,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.return.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6043,9 +6043,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6769,9 +6769,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -6780,9 +6780,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7022,9 +7022,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7033,9 +7033,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7209,9 +7209,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7220,9 +7220,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7528,9 +7528,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7539,9 +7539,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -7825,9 +7825,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -7836,9 +7836,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8507,9 +8507,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8518,9 +8518,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -8892,9 +8892,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -8903,9 +8903,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -9343,9 +9343,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9387,9 +9387,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9431,9 +9431,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9508,9 +9508,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9519,9 +9519,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -9629,9 +9629,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9673,9 +9673,9 @@ "t": "source.css.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9750,9 +9750,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9761,9 +9761,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -9926,9 +9926,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -9937,9 +9937,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -10564,9 +10564,9 @@ "t": "source.css.scss meta.at-rule.for.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10608,9 +10608,9 @@ "t": "source.css.scss meta.at-rule.for.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10773,9 +10773,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -10784,9 +10784,9 @@ "t": "source.css.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -11367,9 +11367,9 @@ "t": "source.css.scss meta.at-rule.each.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -11466,9 +11466,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -11631,9 +11631,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -11642,9 +11642,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.em.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -11818,9 +11818,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -12104,9 +12104,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.for.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -12456,9 +12456,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.at-rule.if.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -12544,9 +12544,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -12555,9 +12555,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -13039,9 +13039,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -13050,9 +13050,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -13402,9 +13402,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -13413,9 +13413,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -13589,9 +13589,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.at-rule.mixin.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -13600,9 +13600,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.at-rule.mixin.scss constant.numeric.css keyword.other.unit.in.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14535,9 +14535,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14546,9 +14546,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14568,9 +14568,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14579,9 +14579,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14601,9 +14601,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14612,9 +14612,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14667,9 +14667,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14678,9 +14678,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14700,9 +14700,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14711,9 +14711,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -14733,9 +14733,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -14744,9 +14744,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.include.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -16559,9 +16559,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -16570,9 +16570,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.cm.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -16636,9 +16636,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -16647,9 +16647,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.cm.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -16878,9 +16878,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -16889,9 +16889,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -17483,9 +17483,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.at-rule.extend.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -17604,9 +17604,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -18066,9 +18066,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -18077,9 +18077,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -18187,9 +18187,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -18198,9 +18198,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css keyword.other.unit.px.css", "r": { "dark_plus": "keyword.other.unit: #B5CEA8", - "light_plus": "keyword.other.unit: #09885A", + "light_plus": "keyword.other.unit: #098658", "dark_vs": "keyword.other.unit: #B5CEA8", - "light_vs": "keyword.other.unit: #09885A", + "light_vs": "keyword.other.unit: #098658", "hc_black": "keyword.other.unit: #B5CEA8" } }, @@ -18880,9 +18880,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -18979,9 +18979,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19111,9 +19111,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19221,9 +19221,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19419,9 +19419,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19551,9 +19551,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19738,9 +19738,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -19870,9 +19870,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -20057,9 +20057,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -20167,9 +20167,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.property-list.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -20376,9 +20376,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -20508,9 +20508,9 @@ "t": "source.css.scss meta.at-rule.each.scss meta.at-rule.while.scss meta.property-list.scss meta.at-rule.keyframes.scss meta.property-list.scss meta.property-value.scss constant.numeric.css", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -21020,4 +21020,4 @@ "hc_black": "comment: #7CA668" } } -] \ No newline at end of file +] diff --git a/extensions/search-result/README.md b/extensions/search-result/README.md new file mode 100644 index 0000000000000..c3e1b53525c99 --- /dev/null +++ b/extensions/search-result/README.md @@ -0,0 +1,5 @@ +# Language Features for Search Result files + +**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled. + +This extension provides Syntax Highlighting, Symbol Infomation, Result Highlighting, and Go to Definition capabilities for the Search Results Editor. diff --git a/extensions/search-result/extension.webpack.config.js b/extensions/search-result/extension.webpack.config.js new file mode 100644 index 0000000000000..de88398eca0d3 --- /dev/null +++ b/extensions/search-result/extension.webpack.config.js @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); + +module.exports = withDefaults({ + context: __dirname, + resolve: { + mainFields: ['module', 'main'] + }, + entry: { + extension: './src/extension.ts', + } +}); diff --git a/extensions/search-result/package.json b/extensions/search-result/package.json new file mode 100644 index 0000000000000..6a55968bda16a --- /dev/null +++ b/extensions/search-result/package.json @@ -0,0 +1,50 @@ +{ + "name": "search-result", + "displayName": "%displayName%", + "description": "%description%", + "version": "1.0.0", + "publisher": "vscode", + "license": "MIT", + "engines": { + "vscode": "^1.39.0" + }, + "categories": [ + "Programming Languages" + ], + "main": "./out/extension.js", + "activationEvents": [ + "*" + ], + "scripts": { + "generate-grammar": "node ./syntaxes/generateTMLanguage.js", + "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:search-result ./tsconfig.json" + }, + "contributes": { + "configurationDefaults": { + "[search-result]": { + "editor.lineNumbers": "off" + } + }, + "languages": [ + { + "id": "search-result", + "extensions": [ + ".code-search" + ], + "aliases": [ + "Search Result" + ] + } + ], + "grammars": [ + { + "language": "search-result", + "scopeName": "text.searchResult", + "path": "./syntaxes/searchResult.tmLanguage.json" + } + ] + }, + "devDependencies": { + "vscode": "^1.1.36" + } +} diff --git a/extensions/search-result/package.nls.json b/extensions/search-result/package.nls.json new file mode 100644 index 0000000000000..324fd97bcd297 --- /dev/null +++ b/extensions/search-result/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Search Result", + "description": "Provides syntax highlighting and language features for tabbed search results." +} diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts new file mode 100644 index 0000000000000..abb85dac20123 --- /dev/null +++ b/extensions/search-result/src/extension.ts @@ -0,0 +1,225 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as pathUtils from 'path'; + +const FILE_LINE_REGEX = /^(\S.*):$/; +const RESULT_LINE_REGEX = /^(\s+)(\d+)(:| )(\s+)(.*)$/; +const SEARCH_RESULT_SELECTOR = { language: 'search-result' }; +const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:']; +const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch']; + +let cachedLastParse: { version: number, parse: ParsedSearchResults, uri: vscode.Uri } | undefined; +let documentChangeListener: vscode.Disposable | undefined; + + +export function activate(context: vscode.ExtensionContext) { + + const contextLineDecorations = vscode.window.createTextEditorDecorationType({ opacity: '0.7' }); + const matchLineDecorations = vscode.window.createTextEditorDecorationType({ fontWeight: 'bold' }); + + const decorate = (editor: vscode.TextEditor) => { + const parsed = parseSearchResults(editor.document).filter(isResultLine); + const contextRanges = parsed.filter(line => line.isContext).map(line => line.prefixRange); + const matchRanges = parsed.filter(line => !line.isContext).map(line => line.prefixRange); + editor.setDecorations(contextLineDecorations, contextRanges); + editor.setDecorations(matchLineDecorations, matchRanges); + }; + + if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.languageId === 'search-result') { + decorate(vscode.window.activeTextEditor); + } + + context.subscriptions.push( + + vscode.languages.registerDocumentSymbolProvider(SEARCH_RESULT_SELECTOR, { + provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.DocumentSymbol[] { + const results = parseSearchResults(document, token) + .filter(isFileLine) + .map(line => new vscode.DocumentSymbol( + line.path, + '', + vscode.SymbolKind.File, + line.allLocations.map(({ originSelectionRange }) => originSelectionRange!).reduce((p, c) => p.union(c), line.location.originSelectionRange!), + line.location.originSelectionRange!, + )); + + return results; + } + }), + + vscode.languages.registerCompletionItemProvider(SEARCH_RESULT_SELECTOR, { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position): vscode.CompletionItem[] { + + const line = document.lineAt(position.line); + if (position.line > 3) { return []; } + if (position.character === 0 || (position.character === 1 && line.text === '#')) { + const header = Array.from({ length: DIRECTIVES.length }).map((_, i) => document.lineAt(i).text); + + return DIRECTIVES + .filter(suggestion => header.every(line => line.indexOf(suggestion) === -1)) + .map(flag => ({ label: flag, insertText: (flag.slice(position.character)) + ' ' })); + } + + if (line.text.indexOf('# Flags:') === -1) { return []; } + + return FLAGS + .filter(flag => line.text.indexOf(flag) === -1) + .map(flag => ({ label: flag, insertText: flag + ' ' })); + } + }, '#'), + + vscode.languages.registerDefinitionProvider(SEARCH_RESULT_SELECTOR, { + provideDefinition(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.DefinitionLink[] { + const lineResult = parseSearchResults(document, token)[position.line]; + if (!lineResult) { return []; } + if (lineResult.type === 'file') { + return lineResult.allLocations; + } + + const translateRangeSidewaysBy = (r: vscode.Range, n: number) => + r.with({ start: new vscode.Position(r.start.line, Math.max(0, n - r.start.character)), end: new vscode.Position(r.end.line, Math.max(0, n - r.end.character)) }); + + return [{ + ...lineResult.location, + targetSelectionRange: translateRangeSidewaysBy(lineResult.location.targetSelectionRange!, position.character - 1) + }]; + } + }), + + vscode.languages.registerDocumentLinkProvider(SEARCH_RESULT_SELECTOR, { + async provideDocumentLinks(document: vscode.TextDocument, token: vscode.CancellationToken): Promise { + return parseSearchResults(document, token) + .filter(({ type }) => type === 'file') + .map(({ location }) => ({ range: location.originSelectionRange!, target: location.targetUri })); + } + }), + + vscode.window.onDidChangeActiveTextEditor(editor => { + if (editor?.document.languageId === 'search-result') { + // Clear the parse whenever we open a new editor. + // Conservative because things like the URI might remain constant even if the contents change, and re-parsing even large files is relatively fast. + cachedLastParse = undefined; + + documentChangeListener?.dispose(); + documentChangeListener = vscode.workspace.onDidChangeTextDocument(doc => { + if (doc.document.uri === editor.document.uri) { + decorate(editor); + } + }); + + decorate(editor); + } + }), + + { dispose() { cachedLastParse = undefined; documentChangeListener?.dispose(); } } + ); +} + + +function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | undefined { + if (pathUtils.isAbsolute(path)) { return vscode.Uri.file(path); } + if (path.indexOf('~/') === 0) { + return vscode.Uri.file(pathUtils.join(process.env.HOME!, path.slice(2))); + } + + + if (vscode.workspace.workspaceFolders) { + const multiRootFormattedPath = /^(.*) • (.*)$/.exec(path); + if (multiRootFormattedPath) { + const [, workspaceName, workspacePath] = multiRootFormattedPath; + const folder = vscode.workspace.workspaceFolders.filter(wf => wf.name === workspaceName)[0]; + if (folder) { + return vscode.Uri.file(pathUtils.join(folder.uri.fsPath, workspacePath)); + } + } + + else if (vscode.workspace.workspaceFolders.length === 1) { + return vscode.Uri.file(pathUtils.join(vscode.workspace.workspaceFolders[0].uri.fsPath, path)); + } else if (resultsUri.scheme !== 'untitled') { + // We're in a multi-root workspace, but the path is not multi-root formatted + // Possibly a saved search from a single root session. Try checking if the search result document's URI is in a current workspace folder. + const prefixMatch = vscode.workspace.workspaceFolders.filter(wf => resultsUri.toString().startsWith(wf.uri.toString()))[0]; + if (prefixMatch) { return vscode.Uri.file(pathUtils.join(prefixMatch.uri.fsPath, path)); } + } + } + + console.error(`Unable to resolve path ${path}`); + return undefined; +} + +type ParsedSearchFileLine = { type: 'file', location: vscode.LocationLink, allLocations: vscode.LocationLink[], path: string }; +type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink, isContext: boolean, prefixRange: vscode.Range }; +type ParsedSearchResults = Array; +const isFileLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchFileLine => line.type === 'file'; +const isResultLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchResultLine => line.type === 'result'; + + +function parseSearchResults(document: vscode.TextDocument, token?: vscode.CancellationToken): ParsedSearchResults { + + if (cachedLastParse && cachedLastParse.uri === document.uri && cachedLastParse.version === document.version) { + return cachedLastParse.parse; + } + + const lines = document.getText().split(/\r?\n/); + const links: ParsedSearchResults = []; + + let currentTarget: vscode.Uri | undefined = undefined; + let currentTargetLocations: vscode.LocationLink[] | undefined = undefined; + + for (let i = 0; i < lines.length; i++) { + // TODO: This is probably always false, given we're pegging the thread... + if (token?.isCancellationRequested) { return []; } + const line = lines[i]; + + const fileLine = FILE_LINE_REGEX.exec(line); + if (fileLine) { + const [, path] = fileLine; + + currentTarget = relativePathToUri(path, document.uri); + if (!currentTarget) { continue; } + currentTargetLocations = []; + + const location: vscode.LocationLink = { + targetRange: new vscode.Range(0, 0, 0, 1), + targetUri: currentTarget, + originSelectionRange: new vscode.Range(i, 0, i, line.length), + }; + + + links[i] = { type: 'file', location, allLocations: currentTargetLocations, path }; + } + + if (!currentTarget) { continue; } + + const resultLine = RESULT_LINE_REGEX.exec(line); + if (resultLine) { + const [, indentation, _lineNumber, seperator, resultIndentation] = resultLine; + const lineNumber = +_lineNumber - 1; + const resultStart = (indentation + _lineNumber + seperator + resultIndentation).length; + const metadataOffset = (indentation + _lineNumber + seperator).length; + + const location: vscode.LocationLink = { + targetRange: new vscode.Range(Math.max(lineNumber - 3, 0), 0, lineNumber + 3, line.length), + targetSelectionRange: new vscode.Range(lineNumber, metadataOffset, lineNumber, metadataOffset), + targetUri: currentTarget, + originSelectionRange: new vscode.Range(i, resultStart, i, line.length), + }; + + currentTargetLocations?.push(location); + + links[i] = { type: 'result', location, isContext: seperator === ' ', prefixRange: new vscode.Range(i, 0, i, metadataOffset) }; + } + } + + cachedLastParse = { + version: document.version, + parse: links, + uri: document.uri + }; + + return links; +} diff --git a/extensions/search-result/src/media/refresh-dark.svg b/extensions/search-result/src/media/refresh-dark.svg new file mode 100644 index 0000000000000..e1f05aadeebdf --- /dev/null +++ b/extensions/search-result/src/media/refresh-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/extensions/search-result/src/media/refresh-light.svg b/extensions/search-result/src/media/refresh-light.svg new file mode 100644 index 0000000000000..9b1d910840919 --- /dev/null +++ b/extensions/search-result/src/media/refresh-light.svg @@ -0,0 +1,4 @@ + + + + diff --git a/extensions/search-result/src/typings/refs.d.ts b/extensions/search-result/src/typings/refs.d.ts new file mode 100644 index 0000000000000..c9849d48e083f --- /dev/null +++ b/extensions/search-result/src/typings/refs.d.ts @@ -0,0 +1,7 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// diff --git a/extensions/search-result/syntaxes/generateTMLanguage.js b/extensions/search-result/syntaxes/generateTMLanguage.js new file mode 100644 index 0000000000000..7a9eb9204f62e --- /dev/null +++ b/extensions/search-result/syntaxes/generateTMLanguage.js @@ -0,0 +1,244 @@ +// @ts-check + +const mappings = [ + ['bat', 'source.batchfile'], + ['c', 'source.c'], + ['cc', 'source.cpp'], + ['clj', 'source.clojure'], + ['coffee', 'source.coffee'], + ['cpp', 'source.cpp'], + ['cs', 'source.cs'], + ['cshtml', 'text.html.cshtml'], + ['css', 'source.css'], + ['dart', 'source.dart'], + ['diff', 'source.diff'], + ['dockerfile', 'source.dockerfile', '(?:dockerfile|Dockerfile)'], + ['fs', 'source.fsharp'], + ['go', 'source.go'], + ['groovy', 'source.groovy'], + ['h', 'source.objc'], + ['handlebars', 'text.html.handlebars'], + ['hbs', 'text.html.handlebars'], + ['hlsl', 'source.hlsl'], + ['hpp', 'source.objcpp'], + ['html', 'text.html.basic'], + ['ini', 'source.ini'], + ['java', 'source.java'], + ['js', 'source.js'], + ['json', 'source.json.comments'], + ['jsx', 'source.js.jsx'], + ['less', 'source.css.less'], + ['log', 'text.log'], + ['lua', 'source.lua'], + ['m', 'source.objc'], + ['makefile', 'source.makefile', '(?:makefile|Makefile)(?:\\..*)?'], + ['md', 'text.html.markdown'], + ['mm', 'source.objcpp'], + ['p6', 'source.perl.6'], + ['perl', 'source.perl'], + ['php', 'source.php'], + ['pl', 'source.perl'], + ['pm', 'source.perl'], + ['ps1', 'source.powershell'], + ['pug', 'text.pug'], + ['py', 'source.python'], + ['r', 'source.r'], + ['rb', 'source.ruby'], + ['rs', 'source.rust'], + ['scala', 'source.scala'], + ['scss', 'source.css.scss'], + ['sh', 'source.shell'], + ['sql', 'source.sql'], + ['swift', 'source.swift'], + ['ts', 'source.ts'], + ['tsx', 'source.tsx'], + ['vb', 'source.asp.vb.net'], + ['xml', 'text.xml'], + ['yaml', 'source.yaml'], +]; + +const scopes = { + root: 'text.searchResult', + header: { + meta: 'meta.header.search keyword.operator.word.search', + key: 'entity.other.attribute-name', + value: 'entity.other.attribute-value string.unquoted', + flags: { + keyword: 'keyword.other', + }, + contextLines: { + number: 'constant.numeric.integer', + invalid: 'invalid.illegal', + }, + query: { + escape: 'constant.character.escape', + invalid: 'invalid.illegal', + } + }, + resultBlock: { + meta: 'meta.resultBlock.search', + path: { + meta: 'string meta.path.search', + dirname: 'meta.path.dirname.search', + basename: 'meta.path.basename.search', + colon: 'punctuation.separator', + }, + result: { + meta: 'meta.resultLine.search', + metaSingleLine: 'meta.resultLine.singleLine.search', + metaMultiLine: 'meta.resultLine.multiLine.search', + prefix: { + meta: 'constant.numeric.integer meta.resultLinePrefix.search', + metaContext: 'meta.resultLinePrefix.contextLinePrefix.search', + metaMatch: 'meta.resultLinePrefix.matchLinePrefix.search', + lineNumber: 'meta.resultLinePrefix.lineNumber.search', + colon: 'punctuation.separator', + } + } + } +}; + +const repository = {}; +mappings.forEach(([ext, scope, regexp]) => + repository[ext] = { + name: scopes.resultBlock.meta, + begin: `^(?!\\s)(.*?)([^\\\\\\/\\n]*${regexp || `\\.${ext}`})(:)$`, + end: '^(?!\\s)', + beginCaptures: { + '0': { name: scopes.resultBlock.path.meta }, + '1': { name: scopes.resultBlock.path.dirname }, + '2': { name: scopes.resultBlock.path.basename }, + '3': { name: scopes.resultBlock.path.colon }, + }, + patterns: [ + { + name: [scopes.resultBlock.result.meta, scopes.resultBlock.result.metaMultiLine].join(' '), + begin: '^ ((\\d+) )', + while: '^ (?:((\\d+)(:))|((\\d+) ))', + beginCaptures: { + '0': { name: scopes.resultBlock.result.prefix.meta }, + '1': { name: scopes.resultBlock.result.prefix.metaContext }, + '2': { name: scopes.resultBlock.result.prefix.lineNumber }, + }, + whileCaptures: { + '0': { name: scopes.resultBlock.result.prefix.meta }, + '1': { name: scopes.resultBlock.result.prefix.metaMatch }, + '2': { name: scopes.resultBlock.result.prefix.lineNumber }, + '3': { name: scopes.resultBlock.result.prefix.colon }, + + '4': { name: scopes.resultBlock.result.prefix.metaContext }, + '5': { name: scopes.resultBlock.result.prefix.lineNumber }, + }, + patterns: [{ include: scope }] + }, + { + begin: '^ ((\\d+)(:))', + while: '(?=not)possible', + name: [scopes.resultBlock.result.meta, scopes.resultBlock.result.metaSingleLine].join(' '), + beginCaptures: { + '0': { name: scopes.resultBlock.result.prefix.meta }, + '1': { name: scopes.resultBlock.result.prefix.metaMatch }, + '2': { name: scopes.resultBlock.result.prefix.lineNumber }, + '3': { name: scopes.resultBlock.result.prefix.colon }, + }, + patterns: [{ include: scope }] + } + ] + }); + +const header = [ + { + begin: '^(# Query): ', + end: '\n', + name: scopes.header.meta, + beginCaptures: { '1': { name: scopes.header.key }, }, + patterns: [ + { + match: '(\\\\n)|(\\\\\\\\)', + name: [scopes.header.value, scopes.header.query.escape].join(' ') + }, + { + match: '\\\\.|\\\\$', + name: [scopes.header.value, scopes.header.query.invalid].join(' ') + }, + { + match: '[^\\\\\\\n]+', + name: [scopes.header.value].join(' ') + }, + ] + }, + { + begin: '^(# Flags): ', + end: '\n', + name: scopes.header.meta, + beginCaptures: { '1': { name: scopes.header.key }, }, + patterns: [ + { + match: '(RegExp|CaseSensitive|IgnoreExcludeSettings|WordMatch)', + name: [scopes.header.value, 'keyword.other'].join(' ') + }, + { match: '.' }, + ] + }, + { + begin: '^(# ContextLines): ', + end: '\n', + name: scopes.header.meta, + beginCaptures: { '1': { name: scopes.header.key }, }, + patterns: [ + { + match: '\\d', + name: [scopes.header.value, scopes.header.contextLines.number].join(' ') + }, + { match: '.', name: scopes.header.contextLines.invalid }, + ] + }, + { + match: '^(# (?:Including|Excluding)): (.*)$', + name: scopes.header.meta, + captures: { + '1': { name: scopes.header.key }, + '2': { name: scopes.header.value } + } + }, +]; + +const plainText = [ + { + match: '^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$', + name: [scopes.resultBlock.meta, scopes.resultBlock.path.meta].join(' '), + captures: { + '1': { name: scopes.resultBlock.path.dirname }, + '2': { name: scopes.resultBlock.path.basename }, + '3': { name: scopes.resultBlock.path.colon } + } + }, + { + match: '^ (?:((\\d+)(:))|((\\d+)( ))(.*))', + name: [scopes.resultBlock.meta, scopes.resultBlock.result.meta].join(' '), + captures: { + '1': { name: [scopes.resultBlock.result.prefix.meta, scopes.resultBlock.result.prefix.metaMatch].join(' ') }, + '2': { name: scopes.resultBlock.result.prefix.lineNumber }, + '3': { name: scopes.resultBlock.result.prefix.colon }, + + '4': { name: [scopes.resultBlock.result.prefix.meta, scopes.resultBlock.result.prefix.metaContext].join(' ') }, + '5': { name: scopes.resultBlock.result.prefix.lineNumber }, + } + } +]; + +const tmLanguage = { + 'information_for_contributors': 'This file is generated from ./generateTMLanguage.js.', + name: 'Search Results', + scopeName: scopes.root, + patterns: [ + ...header, + ...mappings.map(([ext]) => ({ include: `#${ext}` })), + ...plainText + ], + repository +}; + +require('fs').writeFileSync( + require('path').join(__dirname, './searchResult.tmLanguage.json'), + JSON.stringify(tmLanguage, null, 2)); diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json new file mode 100644 index 0000000000000..8edb4a7f89ae6 --- /dev/null +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -0,0 +1,4926 @@ +{ + "information_for_contributors": "This file is generated from ./generateTMLanguage.js.", + "name": "Search Results", + "scopeName": "text.searchResult", + "patterns": [ + { + "begin": "^(# Query): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "(\\\\n)|(\\\\\\\\)", + "name": "entity.other.attribute-value string.unquoted constant.character.escape" + }, + { + "match": "\\\\.|\\\\$", + "name": "entity.other.attribute-value string.unquoted invalid.illegal" + }, + { + "match": "[^\\\\\\\n]+", + "name": "entity.other.attribute-value string.unquoted" + } + ] + }, + { + "begin": "^(# Flags): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "(RegExp|CaseSensitive|IgnoreExcludeSettings|WordMatch)", + "name": "entity.other.attribute-value string.unquoted keyword.other" + }, + { + "match": "." + } + ] + }, + { + "begin": "^(# ContextLines): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "\\d", + "name": "entity.other.attribute-value string.unquoted constant.numeric.integer" + }, + { + "match": ".", + "name": "invalid.illegal" + } + ] + }, + { + "match": "^(# (?:Including|Excluding)): (.*)$", + "name": "meta.header.search keyword.operator.word.search", + "captures": { + "1": { + "name": "entity.other.attribute-name" + }, + "2": { + "name": "entity.other.attribute-value string.unquoted" + } + } + }, + { + "include": "#bat" + }, + { + "include": "#c" + }, + { + "include": "#cc" + }, + { + "include": "#clj" + }, + { + "include": "#coffee" + }, + { + "include": "#cpp" + }, + { + "include": "#cs" + }, + { + "include": "#cshtml" + }, + { + "include": "#css" + }, + { + "include": "#dart" + }, + { + "include": "#diff" + }, + { + "include": "#dockerfile" + }, + { + "include": "#fs" + }, + { + "include": "#go" + }, + { + "include": "#groovy" + }, + { + "include": "#h" + }, + { + "include": "#handlebars" + }, + { + "include": "#hbs" + }, + { + "include": "#hlsl" + }, + { + "include": "#hpp" + }, + { + "include": "#html" + }, + { + "include": "#ini" + }, + { + "include": "#java" + }, + { + "include": "#js" + }, + { + "include": "#json" + }, + { + "include": "#jsx" + }, + { + "include": "#less" + }, + { + "include": "#log" + }, + { + "include": "#lua" + }, + { + "include": "#m" + }, + { + "include": "#makefile" + }, + { + "include": "#md" + }, + { + "include": "#mm" + }, + { + "include": "#p6" + }, + { + "include": "#perl" + }, + { + "include": "#php" + }, + { + "include": "#pl" + }, + { + "include": "#pm" + }, + { + "include": "#ps1" + }, + { + "include": "#pug" + }, + { + "include": "#py" + }, + { + "include": "#r" + }, + { + "include": "#rb" + }, + { + "include": "#rs" + }, + { + "include": "#scala" + }, + { + "include": "#scss" + }, + { + "include": "#sh" + }, + { + "include": "#sql" + }, + { + "include": "#swift" + }, + { + "include": "#ts" + }, + { + "include": "#tsx" + }, + { + "include": "#vb" + }, + { + "include": "#xml" + }, + { + "include": "#yaml" + }, + { + "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", + "name": "meta.resultBlock.search string meta.path.search", + "captures": { + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + } + }, + { + "match": "^ (?:((\\d+)(:))|((\\d+)( ))(.*))", + "name": "meta.resultBlock.search meta.resultLine.search", + "captures": { + "1": { + "name": "constant.numeric.integer meta.resultLinePrefix.search meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "constant.numeric.integer meta.resultLinePrefix.search meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + } + } + ], + "repository": { + "bat": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.bat)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.batchfile" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.batchfile" + } + ] + } + ] + }, + "c": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.c)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.c" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.c" + } + ] + } + ] + }, + "cc": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cc)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + } + ] + }, + "clj": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.clj)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.clojure" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.clojure" + } + ] + } + ] + }, + "coffee": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.coffee)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.coffee" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.coffee" + } + ] + } + ] + }, + "cpp": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cpp)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + } + ] + }, + "cs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.cs" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.cs" + } + ] + } + ] + }, + "cshtml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cshtml)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.cshtml" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.cshtml" + } + ] + } + ] + }, + "css": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.css)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.css" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.css" + } + ] + } + ] + }, + "dart": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.dart)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.dart" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.dart" + } + ] + } + ] + }, + "diff": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.diff)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.diff" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.diff" + } + ] + } + ] + }, + "dockerfile": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*(?:dockerfile|Dockerfile))(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.dockerfile" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.dockerfile" + } + ] + } + ] + }, + "fs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.fs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.fsharp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.fsharp" + } + ] + } + ] + }, + "go": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.go)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.go" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.go" + } + ] + } + ] + }, + "groovy": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.groovy)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.groovy" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.groovy" + } + ] + } + ] + }, + "h": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.h)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.objc" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.objc" + } + ] + } + ] + }, + "handlebars": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.handlebars)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + } + ] + }, + "hbs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hbs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + } + ] + }, + "hlsl": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hlsl)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.hlsl" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.hlsl" + } + ] + } + ] + }, + "hpp": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hpp)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] + } + ] + }, + "html": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.html)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.basic" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.basic" + } + ] + } + ] + }, + "ini": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ini)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.ini" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.ini" + } + ] + } + ] + }, + "java": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.java)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.java" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.java" + } + ] + } + ] + }, + "js": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.js)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.js" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.js" + } + ] + } + ] + }, + "json": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.json)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.json.comments" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.json.comments" + } + ] + } + ] + }, + "jsx": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.jsx)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.js.jsx" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.js.jsx" + } + ] + } + ] + }, + "less": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.less)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.css.less" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.css.less" + } + ] + } + ] + }, + "log": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.log)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.log" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.log" + } + ] + } + ] + }, + "lua": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.lua)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.lua" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.lua" + } + ] + } + ] + }, + "m": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.m)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.objc" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.objc" + } + ] + } + ] + }, + "makefile": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*(?:makefile|Makefile)(?:\\..*)?)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.makefile" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.makefile" + } + ] + } + ] + }, + "md": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.md)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.markdown" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.markdown" + } + ] + } + ] + }, + "mm": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.mm)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] + } + ] + }, + "p6": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.p6)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.perl.6" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.perl.6" + } + ] + } + ] + }, + "perl": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.perl)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + } + ] + }, + "php": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.php)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.php" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.php" + } + ] + } + ] + }, + "pl": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.pl)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + } + ] + }, + "pm": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.pm)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.perl" + } + ] + } + ] + }, + "ps1": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ps1)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.powershell" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.powershell" + } + ] + } + ] + }, + "pug": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.pug)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.pug" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.pug" + } + ] + } + ] + }, + "py": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.py)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.python" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.python" + } + ] + } + ] + }, + "r": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.r)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.r" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.r" + } + ] + } + ] + }, + "rb": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.rb)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.ruby" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.ruby" + } + ] + } + ] + }, + "rs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.rs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.rust" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.rust" + } + ] + } + ] + }, + "scala": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.scala)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.scala" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.scala" + } + ] + } + ] + }, + "scss": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.scss)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.css.scss" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.css.scss" + } + ] + } + ] + }, + "sh": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.sh)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.shell" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.shell" + } + ] + } + ] + }, + "sql": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.sql)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.sql" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.sql" + } + ] + } + ] + }, + "swift": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.swift)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.swift" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.swift" + } + ] + } + ] + }, + "ts": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ts)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.ts" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.ts" + } + ] + } + ] + }, + "tsx": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.tsx)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.tsx" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.tsx" + } + ] + } + ] + }, + "vb": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.vb)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.asp.vb.net" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.asp.vb.net" + } + ] + } + ] + }, + "xml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.xml)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.xml" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.xml" + } + ] + } + ] + }, + "yaml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.yaml)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ (?:((\\d+)(:))|((\\d+) ))", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.yaml" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.yaml" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/extensions/search-result/tsconfig.json b/extensions/search-result/tsconfig.json new file mode 100644 index 0000000000000..16ed233f6e8f6 --- /dev/null +++ b/extensions/search-result/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../shared.tsconfig.json", + "compilerOptions": { + "outDir": "./out", + }, + "include": [ + "src/**/*" + ] +} diff --git a/extensions/search-result/yarn.lock b/extensions/search-result/yarn.lock new file mode 100644 index 0000000000000..4ff83ab98bbfd --- /dev/null +++ b/extensions/search-result/yarn.lock @@ -0,0 +1,602 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + +ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= + dependencies: + es6-promise "^4.0.3" + +escape-string-regexp@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.1.2: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= + +http-proxy-agent@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== + dependencies: + agent-base "4" + debug "3.1.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +https-proxy-agent@^2.2.1: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +mime-db@1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + dependencies: + mime-db "1.40.0" + +minimatch@3.0.4, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +mkdirp@0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +mocha@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" + integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ== + dependencies: + browser-stdout "1.3.1" + commander "2.15.1" + debug "3.1.0" + diff "3.5.0" + escape-string-regexp "1.0.5" + glob "7.1.2" + growl "1.10.5" + he "1.1.1" + minimatch "3.0.4" + mkdirp "0.5.1" + supports-color "5.4.0" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +psl@^1.1.24: + version "1.4.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" + integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +querystringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== + +request@^2.88.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.0" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +semver@^5.4.1: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +source-map-support@^0.5.0: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +supports-color@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== + dependencies: + has-flag "^3.0.0" + +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +url-parse@^1.4.4: + version "1.4.7" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" + integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +uuid@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vscode-test@^0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/vscode-test/-/vscode-test-0.4.3.tgz#461ebf25fc4bc93d77d982aed556658a2e2b90b8" + integrity sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w== + dependencies: + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.1" + +vscode@^1.1.36: + version "1.1.36" + resolved "https://registry.yarnpkg.com/vscode/-/vscode-1.1.36.tgz#5e1a0d1bf4977d0c7bc5159a9a13d5b104d4b1b6" + integrity sha512-cGFh9jmGLcTapCpPCKvn8aG/j9zVQ+0x5hzYJq5h5YyUXVGa1iamOaB2M2PZXoumQPES4qeAP1FwkI0b6tL4bQ== + dependencies: + glob "^7.1.2" + mocha "^5.2.0" + request "^2.88.0" + semver "^5.4.1" + source-map-support "^0.5.0" + url-parse "^1.4.4" + vscode-test "^0.4.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= diff --git a/extensions/shaderlab/language-configuration.json b/extensions/shaderlab/language-configuration.json index 8d91e91a89e40..6af8237672646 100644 --- a/extensions/shaderlab/language-configuration.json +++ b/extensions/shaderlab/language-configuration.json @@ -12,7 +12,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -20,4 +20,4 @@ ["(", ")"], ["\"", "\""] ] -} \ No newline at end of file +} diff --git a/extensions/shaderlab/test/colorize-results/test_shader.json b/extensions/shaderlab/test/colorize-results/test_shader.json index 7f731af089fd2..fac0a925a41d5 100644 --- a/extensions/shaderlab/test/colorize-results/test_shader.json +++ b/extensions/shaderlab/test/colorize-results/test_shader.json @@ -452,12 +452,12 @@ }, { "c": "1", - "t": "source.shaderlab meta.cgblock constant.numeric.hlsl", + "t": "source.shaderlab meta.cgblock constant.numeric.decimal.hlsl", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, diff --git a/extensions/shared.tsconfig.json b/extensions/shared.tsconfig.json index bb42dd479cfad..a84d7a1cc03d1 100644 --- a/extensions/shared.tsconfig.json +++ b/extensions/shared.tsconfig.json @@ -1,6 +1,9 @@ { "compilerOptions": { "target": "es2018", + "lib": [ + "es2018" + ], "module": "commonjs", "strict": true, "alwaysStrict": true, @@ -9,4 +12,4 @@ "noUnusedLocals": true, "noUnusedParameters": true } -} \ No newline at end of file +} diff --git a/extensions/shared.webpack.config.js b/extensions/shared.webpack.config.js index 2fba65c92bd12..2bcb6c47474da 100644 --- a/extensions/shared.webpack.config.js +++ b/extensions/shared.webpack.config.js @@ -49,7 +49,7 @@ module.exports = function withDefaults(/**@type WebpackConfig*/extConfig) { loader: 'ts-loader', options: { compilerOptions: { - "sourceMap": true, + 'sourceMap': true, } } }] @@ -63,7 +63,7 @@ module.exports = function withDefaults(/**@type WebpackConfig*/extConfig) { // packaging depends on that and this must always be like it filename: '[name].js', path: path.join(extConfig.context, 'dist'), - libraryTarget: "commonjs", + libraryTarget: 'commonjs', }, // yes, really source maps devtool: 'source-map', diff --git a/extensions/shellscript/language-configuration.json b/extensions/shellscript/language-configuration.json index 964623ac4cc15..8421a3817a275 100644 --- a/extensions/shellscript/language-configuration.json +++ b/extensions/shellscript/language-configuration.json @@ -11,9 +11,9 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"], - ["`", "`"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "`", "close": "`", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], diff --git a/extensions/shellscript/package.json b/extensions/shellscript/package.json index 211401a070c23..207ae27aa1b35 100644 --- a/extensions/shellscript/package.json +++ b/extensions/shellscript/package.json @@ -12,10 +12,14 @@ "contributes": { "languages": [{ "id": "shellscript", - "aliases": ["Shell Script", "shellscript", "bash", "sh", "zsh", "ksh"], - "extensions": [".sh", ".bash", ".bashrc", ".bash_aliases", ".bash_profile", ".bash_login", ".ebuild", ".install", ".profile", ".bash_logout", ".zsh", ".zshrc", ".zprofile", ".zlogin", ".zlogout", ".zshenv", ".zsh-theme", ".ksh"], - "filenames": ["APKBUILD", "PKGBUILD"], - "firstLine": "^#!.*\\b(bash|zsh|sh|tcsh|ksh|ash|qsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-", + "aliases": ["Shell Script", "shellscript", "bash", "sh", "zsh", "ksh", "csh"], + "extensions": [".sh", ".bash", ".bashrc", ".bash_aliases", ".bash_profile", ".bash_login", ".ebuild", ".install", ".profile", ".bash_logout", ".zsh", ".zshrc", ".zprofile", ".zlogin", ".zlogout", ".zshenv", ".zsh-theme", ".ksh", ".csh", ".cshrc"], + "filenames": [ + "APKBUILD", + "PKGBUILD", + ".envrc" + ], + "firstLine": "^#!.*\\b(bash|zsh|sh|tcsh|ksh|ash|qsh|csh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-", "configuration": "./language-configuration.json", "mimetypes": ["text/x-shellscript"] }], diff --git a/extensions/sql/test/colorize-results/test_sql.json b/extensions/sql/test/colorize-results/test_sql.json index da116cea9c3f2..4bc7ff281520e 100644 --- a/extensions/sql/test/colorize-results/test_sql.json +++ b/extensions/sql/test/colorize-results/test_sql.json @@ -136,9 +136,9 @@ "t": "source.sql constant.numeric.sql", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -180,9 +180,9 @@ "t": "source.sql constant.numeric.sql", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -213,9 +213,9 @@ "t": "source.sql constant.numeric.sql", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -268,9 +268,9 @@ "t": "source.sql constant.numeric.sql", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -290,9 +290,9 @@ "t": "source.sql constant.numeric.sql", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -318,4 +318,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/swift/language-configuration.json b/extensions/swift/language-configuration.json index 2bdc27527498e..54095ef5212e2 100644 --- a/extensions/swift/language-configuration.json +++ b/extensions/swift/language-configuration.json @@ -12,9 +12,9 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"], - ["`", "`"] + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "`", "close": "`", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -24,4 +24,4 @@ ["'", "'"], ["`", "`"] ] -} \ No newline at end of file +} diff --git a/extensions/swift/test/colorize-results/test_swift.json b/extensions/swift/test/colorize-results/test_swift.json index 8512da234c9df..977818bdec72a 100644 --- a/extensions/swift/test/colorize-results/test_swift.json +++ b/extensions/swift/test/colorize-results/test_swift.json @@ -48,9 +48,9 @@ "t": "source.swift constant.numeric.integer.decimal.swift", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -802,4 +802,4 @@ "hc_black": "default: #FFFFFF" } } -] \ No newline at end of file +] diff --git a/extensions/theme-defaults/themes/dark_plus.json b/extensions/theme-defaults/themes/dark_plus.json index f8a0ff5b7c515..03e62612d62f7 100644 --- a/extensions/theme-defaults/themes/dark_plus.json +++ b/extensions/theme-defaults/themes/dark_plus.json @@ -9,7 +9,8 @@ "entity.name.function", "support.function", "support.constant.handlebars", - "source.powershell variable.other.member" + "source.powershell variable.other.member", + "entity.name.operator.custom-literal" // See https://en.cppreference.com/w/cpp/language/user_literal ], "settings": { "foreground": "#DCDCAA" diff --git a/extensions/theme-defaults/themes/dark_vs.json b/extensions/theme-defaults/themes/dark_vs.json index 479b5fd8988d8..6e5f4c25f80e3 100644 --- a/extensions/theme-defaults/themes/dark_vs.json +++ b/extensions/theme-defaults/themes/dark_vs.json @@ -171,7 +171,8 @@ }, { "scope": [ - "meta.preprocessor" + "meta.preprocessor", + "entity.name.function.preprocessor" ], "settings": { "foreground": "#569cd6" @@ -226,6 +227,7 @@ "scope": [ "string", "entity.name.operator.custom-literal.string", + "meta.embedded.assembly" ], "settings": { "foreground": "#ce9178" diff --git a/extensions/theme-defaults/themes/hc_black.json b/extensions/theme-defaults/themes/hc_black.json index f76d7bb960f26..73309c34b4430 100644 --- a/extensions/theme-defaults/themes/hc_black.json +++ b/extensions/theme-defaults/themes/hc_black.json @@ -114,6 +114,13 @@ "settings": { "foreground": "#CE9178" } + }, + { + "name": "HC Search Editor context line override", + "scope": "meta.resultLinePrefix.contextLinePrefix.search", + "settings": { + "foreground": "#CBEDCB", + } } ] } diff --git a/extensions/theme-defaults/themes/light_defaults.json b/extensions/theme-defaults/themes/light_defaults.json index e28c9b8ed0b2f..018da38e9396c 100644 --- a/extensions/theme-defaults/themes/light_defaults.json +++ b/extensions/theme-defaults/themes/light_defaults.json @@ -13,9 +13,10 @@ "sideBarTitle.foreground": "#6F6F6F", "list.hoverBackground": "#E8E8E8", "input.placeholderForeground": "#767676", + "searchEditor.textInputBorder": "#CECECE", "settings.textInputBorder": "#CECECE", "settings.numberInputBorder": "#CECECE", "statusBarItem.remoteForeground": "#FFF", "statusBarItem.remoteBackground": "#16825D" } -} \ No newline at end of file +} diff --git a/extensions/theme-defaults/themes/light_plus.json b/extensions/theme-defaults/themes/light_plus.json index c7599d60d57a8..faa2b836c2d2a 100644 --- a/extensions/theme-defaults/themes/light_plus.json +++ b/extensions/theme-defaults/themes/light_plus.json @@ -9,7 +9,8 @@ "entity.name.function", "support.function", "support.constant.handlebars", - "source.powershell variable.other.member" + "source.powershell variable.other.member", + "entity.name.operator.custom-literal" // See https://en.cppreference.com/w/cpp/language/user_literal ], "settings": { "foreground": "#795E26" diff --git a/extensions/theme-defaults/themes/light_vs.json b/extensions/theme-defaults/themes/light_vs.json index 886d1175c8b6f..cbf19b22988c8 100644 --- a/extensions/theme-defaults/themes/light_vs.json +++ b/extensions/theme-defaults/themes/light_vs.json @@ -51,7 +51,7 @@ "keyword.operator.minus.exponent" ], "settings": { - "foreground": "#09885a" + "foreground": "#098658" } }, { @@ -130,7 +130,7 @@ { "scope": "markup.inserted", "settings": { - "foreground": "#09885a" + "foreground": "#098658" } }, { @@ -169,7 +169,8 @@ }, { "scope": [ - "meta.preprocessor" + "meta.preprocessor", + "entity.name.function.preprocessor" ], "settings": { "foreground": "#0000ff" @@ -184,7 +185,7 @@ { "scope": "meta.preprocessor.numeric", "settings": { - "foreground": "#09885a" + "foreground": "#098658" } }, { @@ -218,6 +219,7 @@ "scope": [ "string", "entity.name.operator.custom-literal.string", + "meta.embedded.assembly" ], "settings": { "foreground": "#a31515" @@ -344,7 +346,7 @@ { "scope": "keyword.other.unit", "settings": { - "foreground": "#09885a" + "foreground": "#098658" } }, { @@ -365,7 +367,7 @@ { "scope": "constant.sha.git-rebase", "settings": { - "foreground": "#09885a" + "foreground": "#098658" } }, { diff --git a/extensions/theme-monokai/themes/monokai-color-theme.json b/extensions/theme-monokai/themes/monokai-color-theme.json index 6bc2e84ce98c1..c695640f2997f 100644 --- a/extensions/theme-monokai/themes/monokai-color-theme.json +++ b/extensions/theme-monokai/themes/monokai-color-theme.json @@ -382,7 +382,66 @@ "name": "Markup Setext Header", "scope": "markup.heading.setext", "settings": { - "fontStyle": "", + "foreground": "#A6E22E", + "fontStyle": "bold" + } + }, + { + "name": "Markup Headings", + "scope": "markup.heading.markdown", + "settings": { + "fontStyle": "bold" + } + }, + { + "name": "Markdown Quote", + "scope": "markup.quote.markdown", + "settings": { + "fontStyle": "italic", + "foreground": "#75715E" + } + }, + { + "name": "Markdown Bold", + "scope": "markup.bold.markdown", + "settings": { + "fontStyle": "bold" + } + }, + { + "name": "Markdown Link Title/Description", + "scope": "string.other.link.title.markdown,string.other.link.description.markdown", + "settings": { + "foreground": "#AE81FF" + } + }, + { + "name": "Markdown Underline Link/Image", + "scope": "markup.underline.link.markdown,markup.underline.link.image.markdown", + "settings": { + "foreground": "#E6DB74" + } + }, + { + "name": "Markdown Emphasis", + "scope": "markup.italic.markdown", + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Markdown Punctuation Definition Link", + "scope": "markup.list.unnumbered.markdown, markup.list.numbered.markdown", + "settings": { + "foreground": "#f8f8f2" + } + }, + { + "name": "Markdown List Punctuation", + "scope": [ + "punctuation.definition.list.begin.markdown" + ], + "settings": { "foreground": "#A6E22E" } }, diff --git a/extensions/theme-seti/cgmanifest.json b/extensions/theme-seti/cgmanifest.json index 1c86b8bcb2bc5..5ee7c0f5d5281 100644 --- a/extensions/theme-seti/cgmanifest.json +++ b/extensions/theme-seti/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "seti-ui", "repositoryUrl": "https://github.com/jesseweed/seti-ui", - "commitHash": "85a222708824c6f19bbecbec71633d2c97077dad" + "commitHash": "4b3e0a3d0ca8999430bc3aa9f2c8324e6922b3de" } }, "version": "0.1.0" diff --git a/extensions/theme-seti/icons/seti.woff b/extensions/theme-seti/icons/seti.woff index b85727d01e463..85f6ee76a5bec 100644 Binary files a/extensions/theme-seti/icons/seti.woff and b/extensions/theme-seti/icons/seti.woff differ diff --git a/extensions/theme-seti/icons/vs-seti-icon-theme.json b/extensions/theme-seti/icons/vs-seti-icon-theme.json index 825ac52ee830c..3c3edcba96f3c 100644 --- a/extensions/theme-seti/icons/vs-seti-icon-theme.json +++ b/extensions/theme-seti/icons/vs-seti-icon-theme.json @@ -166,1191 +166,1199 @@ "fontCharacter": "\\E012", "fontColor": "#8dc149" }, - "_coffee_light": { + "_code-search_light": { + "fontCharacter": "\\E013", + "fontColor": "#9068b0" + }, + "_code-search": { "fontCharacter": "\\E013", + "fontColor": "#a074c4" + }, + "_coffee_light": { + "fontCharacter": "\\E014", "fontColor": "#b7b73b" }, "_coffee": { - "fontCharacter": "\\E013", + "fontCharacter": "\\E014", "fontColor": "#cbcb41" }, "_coldfusion_light": { - "fontCharacter": "\\E015", + "fontCharacter": "\\E016", "fontColor": "#498ba7" }, "_coldfusion": { - "fontCharacter": "\\E015", + "fontCharacter": "\\E016", "fontColor": "#519aba" }, "_config_light": { - "fontCharacter": "\\E016", + "fontCharacter": "\\E017", "fontColor": "#627379" }, "_config": { - "fontCharacter": "\\E016", + "fontCharacter": "\\E017", "fontColor": "#6d8086" }, "_cpp_light": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#498ba7" }, "_cpp": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#519aba" }, "_cpp_1_light": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#9068b0" }, "_cpp_1": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#a074c4" }, "_cpp_2_light": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#b7b73b" }, "_cpp_2": { - "fontCharacter": "\\E017", + "fontCharacter": "\\E018", "fontColor": "#cbcb41" }, "_crystal_light": { - "fontCharacter": "\\E018", + "fontCharacter": "\\E019", "fontColor": "#bfc2c1" }, "_crystal": { - "fontCharacter": "\\E018", + "fontCharacter": "\\E019", "fontColor": "#d4d7d6" }, "_crystal_embedded_light": { - "fontCharacter": "\\E019", + "fontCharacter": "\\E01A", "fontColor": "#bfc2c1" }, "_crystal_embedded": { - "fontCharacter": "\\E019", + "fontCharacter": "\\E01A", "fontColor": "#d4d7d6" }, "_css_light": { - "fontCharacter": "\\E01A", + "fontCharacter": "\\E01B", "fontColor": "#498ba7" }, "_css": { - "fontCharacter": "\\E01A", + "fontCharacter": "\\E01B", "fontColor": "#519aba" }, "_csv_light": { - "fontCharacter": "\\E01B", + "fontCharacter": "\\E01C", "fontColor": "#7fae42" }, "_csv": { - "fontCharacter": "\\E01B", + "fontCharacter": "\\E01C", "fontColor": "#8dc149" }, "_d_light": { - "fontCharacter": "\\E01C", + "fontCharacter": "\\E01D", "fontColor": "#b8383d" }, "_d": { - "fontCharacter": "\\E01C", + "fontCharacter": "\\E01D", "fontColor": "#cc3e44" }, "_dart_light": { - "fontCharacter": "\\E01D", + "fontCharacter": "\\E01E", "fontColor": "#498ba7" }, "_dart": { - "fontCharacter": "\\E01D", + "fontCharacter": "\\E01E", "fontColor": "#519aba" }, "_db_light": { - "fontCharacter": "\\E01E", + "fontCharacter": "\\E01F", "fontColor": "#dd4b78" }, "_db": { - "fontCharacter": "\\E01E", + "fontCharacter": "\\E01F", "fontColor": "#f55385" }, "_default_light": { - "fontCharacter": "\\E01F", + "fontCharacter": "\\E020", "fontColor": "#bfc2c1" }, "_default": { - "fontCharacter": "\\E01F", + "fontCharacter": "\\E020", "fontColor": "#d4d7d6" }, "_docker_light": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#498ba7" }, "_docker": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#519aba" }, "_docker_1_light": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#455155" }, "_docker_1": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#4d5a5e" }, "_docker_2_light": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#7fae42" }, "_docker_2": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#8dc149" }, "_docker_3_light": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#dd4b78" }, "_docker_3": { - "fontCharacter": "\\E021", + "fontCharacter": "\\E022", "fontColor": "#f55385" }, "_ejs_light": { - "fontCharacter": "\\E023", + "fontCharacter": "\\E024", "fontColor": "#b7b73b" }, "_ejs": { - "fontCharacter": "\\E023", + "fontCharacter": "\\E024", "fontColor": "#cbcb41" }, "_elixir_light": { - "fontCharacter": "\\E024", + "fontCharacter": "\\E025", "fontColor": "#9068b0" }, "_elixir": { - "fontCharacter": "\\E024", + "fontCharacter": "\\E025", "fontColor": "#a074c4" }, "_elixir_script_light": { - "fontCharacter": "\\E025", + "fontCharacter": "\\E026", "fontColor": "#9068b0" }, "_elixir_script": { - "fontCharacter": "\\E025", + "fontCharacter": "\\E026", "fontColor": "#a074c4" }, "_elm_light": { - "fontCharacter": "\\E026", + "fontCharacter": "\\E027", "fontColor": "#498ba7" }, "_elm": { - "fontCharacter": "\\E026", + "fontCharacter": "\\E027", "fontColor": "#519aba" }, "_eslint_light": { - "fontCharacter": "\\E028", + "fontCharacter": "\\E029", "fontColor": "#9068b0" }, "_eslint": { - "fontCharacter": "\\E028", + "fontCharacter": "\\E029", "fontColor": "#a074c4" }, "_eslint_1_light": { - "fontCharacter": "\\E028", + "fontCharacter": "\\E029", "fontColor": "#455155" }, "_eslint_1": { - "fontCharacter": "\\E028", + "fontCharacter": "\\E029", "fontColor": "#4d5a5e" }, "_ethereum_light": { - "fontCharacter": "\\E029", + "fontCharacter": "\\E02A", "fontColor": "#498ba7" }, "_ethereum": { - "fontCharacter": "\\E029", + "fontCharacter": "\\E02A", "fontColor": "#519aba" }, "_f-sharp_light": { - "fontCharacter": "\\E02A", + "fontCharacter": "\\E02B", "fontColor": "#498ba7" }, "_f-sharp": { - "fontCharacter": "\\E02A", + "fontCharacter": "\\E02B", "fontColor": "#519aba" }, "_favicon_light": { - "fontCharacter": "\\E02B", + "fontCharacter": "\\E02C", "fontColor": "#b7b73b" }, "_favicon": { - "fontCharacter": "\\E02B", + "fontCharacter": "\\E02C", "fontColor": "#cbcb41" }, "_firebase_light": { - "fontCharacter": "\\E02C", + "fontCharacter": "\\E02D", "fontColor": "#cc6d2e" }, "_firebase": { - "fontCharacter": "\\E02C", + "fontCharacter": "\\E02D", "fontColor": "#e37933" }, "_firefox_light": { - "fontCharacter": "\\E02D", + "fontCharacter": "\\E02E", "fontColor": "#cc6d2e" }, "_firefox": { - "fontCharacter": "\\E02D", + "fontCharacter": "\\E02E", "fontColor": "#e37933" }, "_font_light": { - "fontCharacter": "\\E02F", + "fontCharacter": "\\E030", "fontColor": "#b8383d" }, "_font": { - "fontCharacter": "\\E02F", + "fontCharacter": "\\E030", "fontColor": "#cc3e44" }, "_git_light": { - "fontCharacter": "\\E030", + "fontCharacter": "\\E031", "fontColor": "#3b4b52" }, "_git": { - "fontCharacter": "\\E030", + "fontCharacter": "\\E031", "fontColor": "#41535b" }, "_go_light": { - "fontCharacter": "\\E034", + "fontCharacter": "\\E035", "fontColor": "#498ba7" }, "_go": { - "fontCharacter": "\\E034", + "fontCharacter": "\\E035", "fontColor": "#519aba" }, "_go2_light": { - "fontCharacter": "\\E035", + "fontCharacter": "\\E036", "fontColor": "#498ba7" }, "_go2": { - "fontCharacter": "\\E035", + "fontCharacter": "\\E036", "fontColor": "#519aba" }, "_gradle_light": { - "fontCharacter": "\\E036", + "fontCharacter": "\\E037", "fontColor": "#7fae42" }, "_gradle": { - "fontCharacter": "\\E036", + "fontCharacter": "\\E037", "fontColor": "#8dc149" }, "_grails_light": { - "fontCharacter": "\\E037", + "fontCharacter": "\\E038", "fontColor": "#7fae42" }, "_grails": { - "fontCharacter": "\\E037", + "fontCharacter": "\\E038", "fontColor": "#8dc149" }, "_graphql_light": { - "fontCharacter": "\\E038", + "fontCharacter": "\\E039", "fontColor": "#dd4b78" }, "_graphql": { - "fontCharacter": "\\E038", + "fontCharacter": "\\E039", "fontColor": "#f55385" }, "_grunt_light": { - "fontCharacter": "\\E039", + "fontCharacter": "\\E03A", "fontColor": "#cc6d2e" }, "_grunt": { - "fontCharacter": "\\E039", + "fontCharacter": "\\E03A", "fontColor": "#e37933" }, "_gulp_light": { - "fontCharacter": "\\E03A", + "fontCharacter": "\\E03B", "fontColor": "#b8383d" }, "_gulp": { - "fontCharacter": "\\E03A", + "fontCharacter": "\\E03B", "fontColor": "#cc3e44" }, "_haml_light": { - "fontCharacter": "\\E03C", + "fontCharacter": "\\E03D", "fontColor": "#b8383d" }, "_haml": { - "fontCharacter": "\\E03C", + "fontCharacter": "\\E03D", "fontColor": "#cc3e44" }, "_happenings_light": { - "fontCharacter": "\\E03D", + "fontCharacter": "\\E03E", "fontColor": "#498ba7" }, "_happenings": { - "fontCharacter": "\\E03D", + "fontCharacter": "\\E03E", "fontColor": "#519aba" }, "_haskell_light": { - "fontCharacter": "\\E03E", + "fontCharacter": "\\E03F", "fontColor": "#9068b0" }, "_haskell": { - "fontCharacter": "\\E03E", + "fontCharacter": "\\E03F", "fontColor": "#a074c4" }, "_haxe_light": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#cc6d2e" }, "_haxe": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#e37933" }, "_haxe_1_light": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#b7b73b" }, "_haxe_1": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#cbcb41" }, "_haxe_2_light": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#498ba7" }, "_haxe_2": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#519aba" }, "_haxe_3_light": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#9068b0" }, "_haxe_3": { - "fontCharacter": "\\E03F", + "fontCharacter": "\\E040", "fontColor": "#a074c4" }, "_heroku_light": { - "fontCharacter": "\\E040", + "fontCharacter": "\\E041", "fontColor": "#9068b0" }, "_heroku": { - "fontCharacter": "\\E040", + "fontCharacter": "\\E041", "fontColor": "#a074c4" }, "_hex_light": { - "fontCharacter": "\\E041", + "fontCharacter": "\\E042", "fontColor": "#b8383d" }, "_hex": { - "fontCharacter": "\\E041", + "fontCharacter": "\\E042", "fontColor": "#cc3e44" }, "_html_light": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#498ba7" }, "_html": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#519aba" }, "_html_1_light": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#7fae42" }, "_html_1": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#8dc149" }, "_html_2_light": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#b7b73b" }, "_html_2": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#cbcb41" }, "_html_3_light": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#cc6d2e" }, "_html_3": { - "fontCharacter": "\\E042", + "fontCharacter": "\\E043", "fontColor": "#e37933" }, "_html_erb_light": { - "fontCharacter": "\\E043", + "fontCharacter": "\\E044", "fontColor": "#b8383d" }, "_html_erb": { - "fontCharacter": "\\E043", + "fontCharacter": "\\E044", "fontColor": "#cc3e44" }, "_ignored_light": { - "fontCharacter": "\\E044", + "fontCharacter": "\\E045", "fontColor": "#3b4b52" }, "_ignored": { - "fontCharacter": "\\E044", + "fontCharacter": "\\E045", "fontColor": "#41535b" }, "_illustrator_light": { - "fontCharacter": "\\E045", + "fontCharacter": "\\E046", "fontColor": "#b7b73b" }, "_illustrator": { - "fontCharacter": "\\E045", + "fontCharacter": "\\E046", "fontColor": "#cbcb41" }, "_image_light": { - "fontCharacter": "\\E046", + "fontCharacter": "\\E047", "fontColor": "#9068b0" }, "_image": { - "fontCharacter": "\\E046", + "fontCharacter": "\\E047", "fontColor": "#a074c4" }, "_info_light": { - "fontCharacter": "\\E047", + "fontCharacter": "\\E048", "fontColor": "#498ba7" }, "_info": { - "fontCharacter": "\\E047", + "fontCharacter": "\\E048", "fontColor": "#519aba" }, "_ionic_light": { - "fontCharacter": "\\E048", + "fontCharacter": "\\E049", "fontColor": "#498ba7" }, "_ionic": { - "fontCharacter": "\\E048", + "fontCharacter": "\\E049", "fontColor": "#519aba" }, "_jade_light": { - "fontCharacter": "\\E049", + "fontCharacter": "\\E04A", "fontColor": "#b8383d" }, "_jade": { - "fontCharacter": "\\E049", + "fontCharacter": "\\E04A", "fontColor": "#cc3e44" }, "_java_light": { - "fontCharacter": "\\E04A", + "fontCharacter": "\\E04B", "fontColor": "#b8383d" }, "_java": { - "fontCharacter": "\\E04A", + "fontCharacter": "\\E04B", "fontColor": "#cc3e44" }, "_javascript_light": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#b7b73b" }, "_javascript": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#cbcb41" }, "_javascript_1_light": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#cc6d2e" }, "_javascript_1": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#e37933" }, "_javascript_2_light": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#498ba7" }, "_javascript_2": { - "fontCharacter": "\\E04B", + "fontCharacter": "\\E04C", "fontColor": "#519aba" }, "_jenkins_light": { - "fontCharacter": "\\E04C", + "fontCharacter": "\\E04D", "fontColor": "#b8383d" }, "_jenkins": { - "fontCharacter": "\\E04C", + "fontCharacter": "\\E04D", "fontColor": "#cc3e44" }, "_jinja_light": { - "fontCharacter": "\\E04D", + "fontCharacter": "\\E04E", "fontColor": "#b8383d" }, "_jinja": { - "fontCharacter": "\\E04D", + "fontCharacter": "\\E04E", "fontColor": "#cc3e44" }, "_json_light": { - "fontCharacter": "\\E04F", + "fontCharacter": "\\E050", "fontColor": "#b7b73b" }, "_json": { - "fontCharacter": "\\E04F", + "fontCharacter": "\\E050", "fontColor": "#cbcb41" }, "_json_1_light": { - "fontCharacter": "\\E04F", + "fontCharacter": "\\E050", "fontColor": "#7fae42" }, "_json_1": { - "fontCharacter": "\\E04F", + "fontCharacter": "\\E050", "fontColor": "#8dc149" }, "_julia_light": { - "fontCharacter": "\\E050", + "fontCharacter": "\\E051", "fontColor": "#9068b0" }, "_julia": { - "fontCharacter": "\\E050", + "fontCharacter": "\\E051", "fontColor": "#a074c4" }, "_karma_light": { - "fontCharacter": "\\E051", + "fontCharacter": "\\E052", "fontColor": "#7fae42" }, "_karma": { - "fontCharacter": "\\E051", + "fontCharacter": "\\E052", "fontColor": "#8dc149" }, "_kotlin_light": { - "fontCharacter": "\\E052", + "fontCharacter": "\\E053", "fontColor": "#cc6d2e" }, "_kotlin": { - "fontCharacter": "\\E052", + "fontCharacter": "\\E053", "fontColor": "#e37933" }, "_less_light": { - "fontCharacter": "\\E053", + "fontCharacter": "\\E054", "fontColor": "#498ba7" }, "_less": { - "fontCharacter": "\\E053", + "fontCharacter": "\\E054", "fontColor": "#519aba" }, "_license_light": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#b7b73b" }, "_license": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#cbcb41" }, "_license_1_light": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#cc6d2e" }, "_license_1": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#e37933" }, "_license_2_light": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#b8383d" }, "_license_2": { - "fontCharacter": "\\E054", + "fontCharacter": "\\E055", "fontColor": "#cc3e44" }, "_liquid_light": { - "fontCharacter": "\\E055", + "fontCharacter": "\\E056", "fontColor": "#7fae42" }, "_liquid": { - "fontCharacter": "\\E055", + "fontCharacter": "\\E056", "fontColor": "#8dc149" }, "_livescript_light": { - "fontCharacter": "\\E056", + "fontCharacter": "\\E057", "fontColor": "#498ba7" }, "_livescript": { - "fontCharacter": "\\E056", + "fontCharacter": "\\E057", "fontColor": "#519aba" }, "_lock_light": { - "fontCharacter": "\\E057", + "fontCharacter": "\\E058", "fontColor": "#7fae42" }, "_lock": { - "fontCharacter": "\\E057", + "fontCharacter": "\\E058", "fontColor": "#8dc149" }, "_lua_light": { - "fontCharacter": "\\E058", + "fontCharacter": "\\E059", "fontColor": "#498ba7" }, "_lua": { - "fontCharacter": "\\E058", + "fontCharacter": "\\E059", "fontColor": "#519aba" }, "_makefile_light": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#cc6d2e" }, "_makefile": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#e37933" }, "_makefile_1_light": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#9068b0" }, "_makefile_1": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#a074c4" }, "_makefile_2_light": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#627379" }, "_makefile_2": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#6d8086" }, "_makefile_3_light": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#498ba7" }, "_makefile_3": { - "fontCharacter": "\\E059", + "fontCharacter": "\\E05A", "fontColor": "#519aba" }, "_markdown_light": { - "fontCharacter": "\\E05A", + "fontCharacter": "\\E05B", "fontColor": "#498ba7" }, "_markdown": { - "fontCharacter": "\\E05A", + "fontCharacter": "\\E05B", "fontColor": "#519aba" }, "_maven_light": { - "fontCharacter": "\\E05B", + "fontCharacter": "\\E05C", "fontColor": "#b8383d" }, "_maven": { - "fontCharacter": "\\E05B", + "fontCharacter": "\\E05C", "fontColor": "#cc3e44" }, "_mdo_light": { - "fontCharacter": "\\E05C", + "fontCharacter": "\\E05D", "fontColor": "#b8383d" }, "_mdo": { - "fontCharacter": "\\E05C", + "fontCharacter": "\\E05D", "fontColor": "#cc3e44" }, "_mustache_light": { - "fontCharacter": "\\E05D", + "fontCharacter": "\\E05E", "fontColor": "#cc6d2e" }, "_mustache": { - "fontCharacter": "\\E05D", + "fontCharacter": "\\E05E", "fontColor": "#e37933" }, "_npm_light": { - "fontCharacter": "\\E05F", + "fontCharacter": "\\E060", "fontColor": "#3b4b52" }, "_npm": { - "fontCharacter": "\\E05F", + "fontCharacter": "\\E060", "fontColor": "#41535b" }, "_npm_1_light": { - "fontCharacter": "\\E05F", + "fontCharacter": "\\E060", "fontColor": "#b8383d" }, "_npm_1": { - "fontCharacter": "\\E05F", + "fontCharacter": "\\E060", "fontColor": "#cc3e44" }, "_npm_ignored_light": { - "fontCharacter": "\\E060", + "fontCharacter": "\\E061", "fontColor": "#3b4b52" }, "_npm_ignored": { - "fontCharacter": "\\E060", + "fontCharacter": "\\E061", "fontColor": "#41535b" }, "_nunjucks_light": { - "fontCharacter": "\\E061", + "fontCharacter": "\\E062", "fontColor": "#7fae42" }, "_nunjucks": { - "fontCharacter": "\\E061", + "fontCharacter": "\\E062", "fontColor": "#8dc149" }, "_ocaml_light": { - "fontCharacter": "\\E062", + "fontCharacter": "\\E063", "fontColor": "#cc6d2e" }, "_ocaml": { - "fontCharacter": "\\E062", + "fontCharacter": "\\E063", "fontColor": "#e37933" }, "_odata_light": { - "fontCharacter": "\\E063", + "fontCharacter": "\\E064", "fontColor": "#cc6d2e" }, "_odata": { - "fontCharacter": "\\E063", + "fontCharacter": "\\E064", "fontColor": "#e37933" }, "_pddl_light": { - "fontCharacter": "\\E064", + "fontCharacter": "\\E065", "fontColor": "#9068b0" }, "_pddl": { - "fontCharacter": "\\E064", + "fontCharacter": "\\E065", "fontColor": "#a074c4" }, "_pdf_light": { - "fontCharacter": "\\E065", + "fontCharacter": "\\E066", "fontColor": "#b8383d" }, "_pdf": { - "fontCharacter": "\\E065", + "fontCharacter": "\\E066", "fontColor": "#cc3e44" }, "_perl_light": { - "fontCharacter": "\\E066", + "fontCharacter": "\\E067", "fontColor": "#498ba7" }, "_perl": { - "fontCharacter": "\\E066", + "fontCharacter": "\\E067", "fontColor": "#519aba" }, "_photoshop_light": { - "fontCharacter": "\\E067", + "fontCharacter": "\\E068", "fontColor": "#498ba7" }, "_photoshop": { - "fontCharacter": "\\E067", + "fontCharacter": "\\E068", "fontColor": "#519aba" }, "_php_light": { - "fontCharacter": "\\E068", + "fontCharacter": "\\E069", "fontColor": "#9068b0" }, "_php": { - "fontCharacter": "\\E068", + "fontCharacter": "\\E069", "fontColor": "#a074c4" }, "_plan_light": { - "fontCharacter": "\\E069", + "fontCharacter": "\\E06A", "fontColor": "#7fae42" }, "_plan": { - "fontCharacter": "\\E069", + "fontCharacter": "\\E06A", "fontColor": "#8dc149" }, "_platformio_light": { - "fontCharacter": "\\E06A", + "fontCharacter": "\\E06B", "fontColor": "#cc6d2e" }, "_platformio": { - "fontCharacter": "\\E06A", + "fontCharacter": "\\E06B", "fontColor": "#e37933" }, "_powershell_light": { - "fontCharacter": "\\E06B", + "fontCharacter": "\\E06C", "fontColor": "#498ba7" }, "_powershell": { - "fontCharacter": "\\E06B", + "fontCharacter": "\\E06C", "fontColor": "#519aba" }, "_pug_light": { - "fontCharacter": "\\E06D", + "fontCharacter": "\\E06E", "fontColor": "#b8383d" }, "_pug": { - "fontCharacter": "\\E06D", + "fontCharacter": "\\E06E", "fontColor": "#cc3e44" }, "_puppet_light": { - "fontCharacter": "\\E06E", + "fontCharacter": "\\E06F", "fontColor": "#b7b73b" }, "_puppet": { - "fontCharacter": "\\E06E", + "fontCharacter": "\\E06F", "fontColor": "#cbcb41" }, "_python_light": { - "fontCharacter": "\\E06F", + "fontCharacter": "\\E070", "fontColor": "#498ba7" }, "_python": { - "fontCharacter": "\\E06F", + "fontCharacter": "\\E070", "fontColor": "#519aba" }, "_react_light": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#498ba7" }, "_react": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#519aba" }, "_react_1_light": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#cc6d2e" }, "_react_1": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#e37933" }, "_react_2_light": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#b7b73b" }, "_react_2": { - "fontCharacter": "\\E071", + "fontCharacter": "\\E072", "fontColor": "#cbcb41" }, "_reasonml_light": { - "fontCharacter": "\\E072", + "fontCharacter": "\\E073", "fontColor": "#b8383d" }, "_reasonml": { - "fontCharacter": "\\E072", + "fontCharacter": "\\E073", "fontColor": "#cc3e44" }, "_rollup_light": { - "fontCharacter": "\\E073", + "fontCharacter": "\\E074", "fontColor": "#b8383d" }, "_rollup": { - "fontCharacter": "\\E073", + "fontCharacter": "\\E074", "fontColor": "#cc3e44" }, "_ruby_light": { - "fontCharacter": "\\E074", + "fontCharacter": "\\E075", "fontColor": "#b8383d" }, "_ruby": { - "fontCharacter": "\\E074", + "fontCharacter": "\\E075", "fontColor": "#cc3e44" }, "_rust_light": { - "fontCharacter": "\\E075", + "fontCharacter": "\\E076", "fontColor": "#627379" }, "_rust": { - "fontCharacter": "\\E075", + "fontCharacter": "\\E076", "fontColor": "#6d8086" }, "_salesforce_light": { - "fontCharacter": "\\E076", + "fontCharacter": "\\E077", "fontColor": "#498ba7" }, "_salesforce": { - "fontCharacter": "\\E076", + "fontCharacter": "\\E077", "fontColor": "#519aba" }, "_sass_light": { - "fontCharacter": "\\E077", + "fontCharacter": "\\E078", "fontColor": "#dd4b78" }, "_sass": { - "fontCharacter": "\\E077", + "fontCharacter": "\\E078", "fontColor": "#f55385" }, "_sbt_light": { - "fontCharacter": "\\E078", + "fontCharacter": "\\E079", "fontColor": "#498ba7" }, "_sbt": { - "fontCharacter": "\\E078", + "fontCharacter": "\\E079", "fontColor": "#519aba" }, "_scala_light": { - "fontCharacter": "\\E079", + "fontCharacter": "\\E07A", "fontColor": "#b8383d" }, "_scala": { - "fontCharacter": "\\E079", + "fontCharacter": "\\E07A", "fontColor": "#cc3e44" }, "_shell_light": { - "fontCharacter": "\\E07C", + "fontCharacter": "\\E07D", "fontColor": "#455155" }, "_shell": { - "fontCharacter": "\\E07C", + "fontCharacter": "\\E07D", "fontColor": "#4d5a5e" }, "_slim_light": { - "fontCharacter": "\\E07D", + "fontCharacter": "\\E07E", "fontColor": "#cc6d2e" }, "_slim": { - "fontCharacter": "\\E07D", + "fontCharacter": "\\E07E", "fontColor": "#e37933" }, "_smarty_light": { - "fontCharacter": "\\E07E", + "fontCharacter": "\\E07F", "fontColor": "#b7b73b" }, "_smarty": { - "fontCharacter": "\\E07E", + "fontCharacter": "\\E07F", "fontColor": "#cbcb41" }, "_spring_light": { - "fontCharacter": "\\E07F", + "fontCharacter": "\\E080", "fontColor": "#7fae42" }, "_spring": { - "fontCharacter": "\\E07F", + "fontCharacter": "\\E080", "fontColor": "#8dc149" }, "_stylelint_light": { - "fontCharacter": "\\E080", + "fontCharacter": "\\E081", "fontColor": "#bfc2c1" }, "_stylelint": { - "fontCharacter": "\\E080", + "fontCharacter": "\\E081", "fontColor": "#d4d7d6" }, "_stylelint_1_light": { - "fontCharacter": "\\E080", + "fontCharacter": "\\E081", "fontColor": "#455155" }, "_stylelint_1": { - "fontCharacter": "\\E080", + "fontCharacter": "\\E081", "fontColor": "#4d5a5e" }, "_stylus_light": { - "fontCharacter": "\\E081", + "fontCharacter": "\\E082", "fontColor": "#7fae42" }, "_stylus": { - "fontCharacter": "\\E081", + "fontCharacter": "\\E082", "fontColor": "#8dc149" }, "_sublime_light": { - "fontCharacter": "\\E082", + "fontCharacter": "\\E083", "fontColor": "#cc6d2e" }, "_sublime": { - "fontCharacter": "\\E082", + "fontCharacter": "\\E083", "fontColor": "#e37933" }, "_svg_light": { - "fontCharacter": "\\E083", + "fontCharacter": "\\E084", "fontColor": "#9068b0" }, "_svg": { - "fontCharacter": "\\E083", + "fontCharacter": "\\E084", "fontColor": "#a074c4" }, "_svg_1_light": { - "fontCharacter": "\\E083", + "fontCharacter": "\\E084", "fontColor": "#498ba7" }, "_svg_1": { - "fontCharacter": "\\E083", + "fontCharacter": "\\E084", "fontColor": "#519aba" }, "_swift_light": { - "fontCharacter": "\\E084", + "fontCharacter": "\\E085", "fontColor": "#cc6d2e" }, "_swift": { - "fontCharacter": "\\E084", + "fontCharacter": "\\E085", "fontColor": "#e37933" }, "_terraform_light": { - "fontCharacter": "\\E085", + "fontCharacter": "\\E086", "fontColor": "#9068b0" }, "_terraform": { - "fontCharacter": "\\E085", + "fontCharacter": "\\E086", "fontColor": "#a074c4" }, "_tex_light": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#498ba7" }, "_tex": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#519aba" }, "_tex_1_light": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#b7b73b" }, "_tex_1": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#cbcb41" }, "_tex_2_light": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#cc6d2e" }, "_tex_2": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#e37933" }, "_tex_3_light": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#bfc2c1" }, "_tex_3": { - "fontCharacter": "\\E086", + "fontCharacter": "\\E087", "fontColor": "#d4d7d6" }, "_todo": { - "fontCharacter": "\\E088" + "fontCharacter": "\\E089" }, "_tsconfig_light": { - "fontCharacter": "\\E089", + "fontCharacter": "\\E08A", "fontColor": "#498ba7" }, "_tsconfig": { - "fontCharacter": "\\E089", + "fontCharacter": "\\E08A", "fontColor": "#519aba" }, "_twig_light": { - "fontCharacter": "\\E08A", + "fontCharacter": "\\E08B", "fontColor": "#7fae42" }, "_twig": { - "fontCharacter": "\\E08A", + "fontCharacter": "\\E08B", "fontColor": "#8dc149" }, "_typescript_light": { - "fontCharacter": "\\E08B", + "fontCharacter": "\\E08C", "fontColor": "#498ba7" }, "_typescript": { - "fontCharacter": "\\E08B", + "fontCharacter": "\\E08C", "fontColor": "#519aba" }, "_typescript_1_light": { - "fontCharacter": "\\E08B", + "fontCharacter": "\\E08C", "fontColor": "#b7b73b" }, "_typescript_1": { - "fontCharacter": "\\E08B", + "fontCharacter": "\\E08C", "fontColor": "#cbcb41" }, "_vala_light": { - "fontCharacter": "\\E08C", + "fontCharacter": "\\E08D", "fontColor": "#627379" }, "_vala": { - "fontCharacter": "\\E08C", + "fontCharacter": "\\E08D", "fontColor": "#6d8086" }, "_video_light": { - "fontCharacter": "\\E08D", + "fontCharacter": "\\E08E", "fontColor": "#dd4b78" }, "_video": { - "fontCharacter": "\\E08D", + "fontCharacter": "\\E08E", "fontColor": "#f55385" }, "_vue_light": { - "fontCharacter": "\\E08E", + "fontCharacter": "\\E08F", "fontColor": "#7fae42" }, "_vue": { - "fontCharacter": "\\E08E", + "fontCharacter": "\\E08F", "fontColor": "#8dc149" }, "_wasm_light": { - "fontCharacter": "\\E08F", + "fontCharacter": "\\E090", "fontColor": "#9068b0" }, "_wasm": { - "fontCharacter": "\\E08F", + "fontCharacter": "\\E090", "fontColor": "#a074c4" }, "_wat_light": { - "fontCharacter": "\\E090", + "fontCharacter": "\\E091", "fontColor": "#9068b0" }, "_wat": { - "fontCharacter": "\\E090", + "fontCharacter": "\\E091", "fontColor": "#a074c4" }, "_webpack_light": { - "fontCharacter": "\\E091", + "fontCharacter": "\\E092", "fontColor": "#498ba7" }, "_webpack": { - "fontCharacter": "\\E091", + "fontCharacter": "\\E092", "fontColor": "#519aba" }, "_wgt_light": { - "fontCharacter": "\\E092", + "fontCharacter": "\\E093", "fontColor": "#498ba7" }, "_wgt": { - "fontCharacter": "\\E092", + "fontCharacter": "\\E093", "fontColor": "#519aba" }, "_windows_light": { - "fontCharacter": "\\E093", + "fontCharacter": "\\E094", "fontColor": "#498ba7" }, "_windows": { - "fontCharacter": "\\E093", + "fontCharacter": "\\E094", "fontColor": "#519aba" }, "_word_light": { - "fontCharacter": "\\E094", + "fontCharacter": "\\E095", "fontColor": "#498ba7" }, "_word": { - "fontCharacter": "\\E094", + "fontCharacter": "\\E095", "fontColor": "#519aba" }, "_xls_light": { - "fontCharacter": "\\E095", + "fontCharacter": "\\E096", "fontColor": "#7fae42" }, "_xls": { - "fontCharacter": "\\E095", + "fontCharacter": "\\E096", "fontColor": "#8dc149" }, "_xml_light": { - "fontCharacter": "\\E096", + "fontCharacter": "\\E097", "fontColor": "#cc6d2e" }, "_xml": { - "fontCharacter": "\\E096", + "fontCharacter": "\\E097", "fontColor": "#e37933" }, "_yarn_light": { - "fontCharacter": "\\E097", + "fontCharacter": "\\E098", "fontColor": "#498ba7" }, "_yarn": { - "fontCharacter": "\\E097", + "fontCharacter": "\\E098", "fontColor": "#519aba" }, "_yml_light": { - "fontCharacter": "\\E098", + "fontCharacter": "\\E099", "fontColor": "#9068b0" }, "_yml": { - "fontCharacter": "\\E098", + "fontCharacter": "\\E099", "fontColor": "#a074c4" }, "_zip_light": { - "fontCharacter": "\\E099", + "fontCharacter": "\\E09A", "fontColor": "#b8383d" }, "_zip": { - "fontCharacter": "\\E099", + "fontCharacter": "\\E09A", "fontColor": "#cc3e44" }, "_zip_1_light": { - "fontCharacter": "\\E099", + "fontCharacter": "\\E09A", "fontColor": "#627379" }, "_zip_1": { - "fontCharacter": "\\E099", + "fontCharacter": "\\E09A", "fontColor": "#6d8086" } }, @@ -1643,6 +1651,7 @@ "ruby": "_ruby", "rust": "_rust", "scss": "_sass", + "search-result": "_code-search", "shellscript": "_shell", "sql": "_db", "swift": "_swift", @@ -1906,6 +1915,7 @@ "ruby": "_ruby_light", "rust": "_rust_light", "scss": "_sass_light", + "search-result": "_code-search_light", "shellscript": "_shell_light", "sql": "_db_light", "swift": "_swift_light", @@ -1986,5 +1996,5 @@ "npm-debug.log": "_npm_ignored_light" } }, - "version": "https://github.com/jesseweed/seti-ui/commit/85a222708824c6f19bbecbec71633d2c97077dad" + "version": "https://github.com/jesseweed/seti-ui/commit/4b3e0a3d0ca8999430bc3aa9f2c8324e6922b3de" } \ No newline at end of file diff --git a/src/typings/vscode-windows-registry.d.ts b/extensions/types/lib.textEncoder.d.ts similarity index 56% rename from src/typings/vscode-windows-registry.d.ts rename to extensions/types/lib.textEncoder.d.ts index 9be14daa4b244..99a5b2271d630 100644 --- a/src/typings/vscode-windows-registry.d.ts +++ b/extensions/types/lib.textEncoder.d.ts @@ -3,7 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare module 'vscode-windows-registry' { - export type HKEY = "HKEY_CURRENT_USER" | "HKEY_LOCAL_MACHINE" | "HKEY_CLASSES_ROOT" | "HKEY_USERS" | "HKEY_CURRENT_CONFIG"; - export function GetStringRegKey(hive: HKEY, path: string, name: string): string | undefined; -} \ No newline at end of file +// Define TextEncoder + TextDecoder globals for both browser and node runtimes +// +// Proper fix: https://github.com/microsoft/TypeScript/issues/31535 + +declare var TextDecoder: typeof import('util').TextDecoder; +declare var TextEncoder: typeof import('util').TextEncoder; diff --git a/src/typings/sudo-prompt.d.ts b/extensions/types/lib.url.d.ts similarity index 65% rename from src/typings/sudo-prompt.d.ts rename to extensions/types/lib.url.d.ts index 85f9783d0a669..5dbe0fdc5053c 100644 --- a/src/typings/sudo-prompt.d.ts +++ b/extensions/types/lib.url.d.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare module 'sudo-prompt' { +// Define Url global for both browser and node runtimes +// +// Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960 - export function exec(cmd: string, options: { name?: string, icns?: string }, callback: (error: string, stdout: string, stderr: string) => void): void; -} \ No newline at end of file +declare const URL: typeof import('url').URL; diff --git a/extensions/typescript-basics/build/update-grammars.js b/extensions/typescript-basics/build/update-grammars.js index 527fa2c1d43e4..1839ad6367439 100644 --- a/extensions/typescript-basics/build/update-grammars.js +++ b/extensions/typescript-basics/build/update-grammars.js @@ -33,7 +33,7 @@ function patchGrammar(grammar) { function adaptToJavaScript(grammar, replacementScope) { grammar.name = 'JavaScript (with React support)'; - grammar.fileTypes = ['.js', '.jsx', '.es6', '.mjs']; + grammar.fileTypes = ['.js', '.jsx', '.es6', '.mjs', '.cjs']; grammar.scopeName = `source${replacementScope}`; var fixScopeNames = function (rule) { diff --git a/extensions/typescript-basics/cgmanifest.json b/extensions/typescript-basics/cgmanifest.json index 6323be5b029a2..4136543a84f31 100644 --- a/extensions/typescript-basics/cgmanifest.json +++ b/extensions/typescript-basics/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "TypeScript-TmLanguage", "repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage", - "commitHash": "477c1b17e273b64af13040c064c9ed62c8b32fba" + "commitHash": "f065e7e88d1c20160c5ec92455aad99a1016284f" } }, "license": "MIT", diff --git a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json index ccdd30167e394..4edc3b8285e6b 100644 --- a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/477c1b17e273b64af13040c064c9ed62c8b32fba", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/f065e7e88d1c20160c5ec92455aad99a1016284f", "name": "TypeScript", "scopeName": "source.ts", "patterns": [ @@ -27,12 +27,6 @@ "repository": { "statements": { "patterns": [ - { - "include": "#string" - }, - { - "include": "#comment" - }, { "include": "#declaration" }, @@ -53,6 +47,12 @@ }, { "include": "#punctuation-semicolon" + }, + { + "include": "#string" + }, + { + "include": "#comment" } ] }, @@ -1078,13 +1078,13 @@ }, "field-declaration": { "name": "meta.field.declaration.ts", - "begin": "(?x)(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "match": "(?x)(\\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\\?)|(\\!))?(?=\\s*\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", "captures": { "1": { "name": "meta.definition.property.ts entity.name.function.ts" @@ -1120,7 +1120,7 @@ }, { "name": "meta.definition.property.ts variable.object.property.ts", - "match": "[_$[:alpha:]][_$[:alnum:]]*" + "match": "\\#?[_$[:alpha:]][_$[:alnum:]]*" }, { "name": "keyword.operator.optional.ts", @@ -1822,7 +1822,7 @@ }, "access-modifier": { "name": "storage.modifier.ts", - "match": "(?)", + "patterns": [ + { + "include": "#type-parameters" + } + ] + }, + { + "begin": "(?<=\\>)\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "meta.brace.round.ts" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.ts" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, { "include": "#possibly-arrow-return-type" }, @@ -2785,20 +2833,20 @@ ] }, "function-call": { - "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", - "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "name": "meta.function-call.ts", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "include": "#support-function-call-identifiers" }, { "name": "entity.name.function.ts", - "match": "([_$[:alpha:]][_$[:alnum:]]*)" + "match": "(\\#?[_$[:alpha:]][_$[:alnum:]]*)" } ] }, @@ -2983,7 +3031,7 @@ } }, { - "match": "(?x)(?:(?=|<>|<|>" }, + { + "match": "(\\!)\\s*(/)(?![/*])", + "captures": { + "1": { + "name": "keyword.operator.logical.ts" + }, + "2": { + "name": "keyword.operator.arithmetic.ts" + } + } + }, { "name": "keyword.operator.logical.ts", "match": "\\!|&&|\\|\\||\\?\\?" @@ -3631,7 +3690,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", "captures": { "1": { "name": "punctuation.accessor.ts" @@ -3645,7 +3704,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.ts" @@ -3675,7 +3734,7 @@ "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\??\\.\\s*prototype\\b(?!\\$))" }, { - "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n (\\#?[[:upper:]][_$[:digit:][:upper:]]*) |\n (\\#?[_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.ts" @@ -3692,7 +3751,7 @@ } }, { - "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "variable.other.constant.object.ts" @@ -4532,12 +4591,12 @@ "patterns": [ { "name": "string.template.ts", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "end": "(?=`)", "patterns": [ { "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "end": "(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "patterns": [ { "include": "#support-function-call-identifiers" @@ -4555,7 +4614,7 @@ }, { "name": "string.template.ts", - "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", "beginCaptures": { "1": { "name": "entity.name.function.tagged-template.ts" @@ -4621,7 +4680,7 @@ "patterns": [ { "name": "string.regexp.ts", - "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/[gimsuy]*(?!\\s*[a-zA-Z0-9_$]))", + "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/([gimsuy]+|(?![\\/\\*])|(?=\\/\\*))(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.ts" @@ -4644,7 +4703,7 @@ }, { "name": "string.regexp.ts", - "begin": "((?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "match": "(?x)(\\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\\?)|(\\!))?(?=\\s*\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", "captures": { "1": { "name": "meta.definition.property.tsx entity.name.function.tsx" @@ -1123,7 +1123,7 @@ }, { "name": "meta.definition.property.tsx variable.object.property.tsx", - "match": "[_$[:alpha:]][_$[:alnum:]]*" + "match": "\\#?[_$[:alpha:]][_$[:alnum:]]*" }, { "name": "keyword.operator.optional.tsx", @@ -1825,7 +1825,7 @@ }, "access-modifier": { "name": "storage.modifier.tsx", - "match": "(?)", + "patterns": [ + { + "include": "#type-parameters" + } + ] + }, + { + "begin": "(?<=\\>)\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<[^<>]+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "meta.brace.round.tsx" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.tsx" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, { "include": "#possibly-arrow-return-type" }, @@ -2788,20 +2836,20 @@ ] }, "function-call": { - "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", - "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "name": "meta.function-call.tsx", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\()", "patterns": [ { "include": "#support-function-call-identifiers" }, { "name": "entity.name.function.tsx", - "match": "([_$[:alpha:]][_$[:alnum:]]*)" + "match": "(\\#?[_$[:alpha:]][_$[:alnum:]]*)" } ] }, @@ -2986,7 +3034,7 @@ } }, { - "match": "(?x)(?:(?=|<>|<|>" }, + { + "match": "(\\!)\\s*(/)(?![/*])", + "captures": { + "1": { + "name": "keyword.operator.logical.tsx" + }, + "2": { + "name": "keyword.operator.arithmetic.tsx" + } + } + }, { "name": "keyword.operator.logical.tsx", "match": "\\!|&&|\\|\\||\\?\\?" @@ -3582,7 +3641,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", "captures": { "1": { "name": "punctuation.accessor.tsx" @@ -3596,7 +3655,7 @@ } }, { - "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.tsx" @@ -3626,7 +3685,7 @@ "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\??\\.\\s*prototype\\b(?!\\$))" }, { - "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n (\\#?[[:upper:]][_$[:digit:][:upper:]]*) |\n (\\#?[_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.tsx" @@ -3643,7 +3702,7 @@ } }, { - "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "variable.other.constant.object.tsx" @@ -4483,12 +4542,12 @@ "patterns": [ { "name": "string.template.tsx", - "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "end": "(?=`)", "patterns": [ { "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", - "end": "(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "end": "(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", "patterns": [ { "include": "#support-function-call-identifiers" @@ -4506,7 +4565,7 @@ }, { "name": "string.template.tsx", - "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", "beginCaptures": { "1": { "name": "entity.name.function.tagged-template.tsx" @@ -4572,7 +4631,7 @@ "patterns": [ { "name": "string.regexp.tsx", - "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/[gimsuy]*(?!\\s*[a-zA-Z0-9_$]))", + "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/([gimsuy]+|(?![\\/\\*])|(?=\\/\\*))(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.tsx" @@ -4595,7 +4654,7 @@ }, { "name": "string.regexp.tsx", - "begin": "((? x.serviceClient)))); + context.subscriptions.push(vscode.tasks.registerTaskProvider('typescript', new TscTaskProvider(lazyClientHost.map(x => x.serviceClient)))); context.subscriptions.push(new LanguageConfigurationManager()); import('./features/tsconfig').then(module => { @@ -70,8 +69,6 @@ function createLazyClientHost( context.subscriptions.push(clientHost); - context.subscriptions.push(new Surveyor(context.globalState, clientHost.serviceClient)); - clientHost.serviceClient.onReady(() => { context.subscriptions.push( ProjectStatus.create( @@ -99,7 +96,6 @@ function lazilyActivateClient( if (!hasActivated && isSupportedDocument(supportedLanguage, textDocument)) { hasActivated = true; // Force activation - // tslint:disable-next-line:no-unused-expression void lazyClientHost.value; disposables.push(new ManagedFileContextManager(resource => { diff --git a/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts b/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts index d5f2f0538d07e..f63853d9ec822 100644 --- a/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts +++ b/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import { escapeRegExp } from '../utils/regexp'; import * as typeConverters from '../utils/typeConverters'; diff --git a/extensions/typescript-language-features/src/features/bufferSyncSupport.ts b/extensions/typescript-language-features/src/features/bufferSyncSupport.ts index 28e201352061e..7110e69c69690 100644 --- a/extensions/typescript-language-features/src/features/bufferSyncSupport.ts +++ b/extensions/typescript-language-features/src/features/bufferSyncSupport.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { coalesce } from '../utils/arrays'; @@ -36,27 +36,31 @@ function mode2ScriptKind(mode: string): 'TS' | 'TSX' | 'JS' | 'JSX' | undefined return undefined; } +const enum BufferOperationType { Close, Open, Change } + class CloseOperation { - readonly type = 'close'; + readonly type = BufferOperationType.Close; constructor( public readonly args: string ) { } } class OpenOperation { - readonly type = 'open'; + readonly type = BufferOperationType.Open; constructor( public readonly args: Proto.OpenRequestArgs ) { } } class ChangeOperation { - readonly type = 'change'; + readonly type = BufferOperationType.Change; constructor( public readonly args: Proto.FileCodeEdits ) { } } +type BufferOperation = CloseOperation | OpenOperation | ChangeOperation; + /** * Manages synchronization of buffers with the TS server. * @@ -64,7 +68,7 @@ class ChangeOperation { */ class BufferSynchronizer { - private readonly _pending = new ResourceMap(); + private readonly _pending = new ResourceMap(); constructor( private readonly client: ITypeScriptServiceClient @@ -72,9 +76,7 @@ class BufferSynchronizer { public open(resource: vscode.Uri, args: Proto.OpenRequestArgs) { if (this.supportsBatching) { - this.updatePending(resource, pending => { - pending.set(resource, new OpenOperation(args)); - }); + this.updatePending(resource, new OpenOperation(args)); } else { this.client.executeWithoutWaitingForResponse('open', args); } @@ -82,9 +84,7 @@ class BufferSynchronizer { public close(resource: vscode.Uri, filepath: string) { if (this.supportsBatching) { - this.updatePending(resource, pending => { - pending.set(resource, new CloseOperation(filepath)); - }); + this.updatePending(resource, new CloseOperation(filepath)); } else { const args: Proto.FileRequestArgs = { file: filepath }; this.client.executeWithoutWaitingForResponse('close', args); @@ -97,16 +97,14 @@ class BufferSynchronizer { } if (this.supportsBatching) { - this.updatePending(resource, pending => { - pending.set(resource, new ChangeOperation({ - fileName: filepath, - textChanges: events.map((change): Proto.CodeEdit => ({ - newText: change.text, - start: typeConverters.Position.toLocation(change.range.start), - end: typeConverters.Position.toLocation(change.range.end), - })).reverse(), // Send the edits end-of-document to start-of-document order - })); - }); + this.updatePending(resource, new ChangeOperation({ + fileName: filepath, + textChanges: events.map((change): Proto.CodeEdit => ({ + newText: change.text, + start: typeConverters.Position.toLocation(change.range.start), + end: typeConverters.Position.toLocation(change.range.end), + })).reverse(), // Send the edits end-of-document to start-of-document order + })); } else { for (const { range, text } of events) { const args: Proto.ChangeRequestArgs = { @@ -143,9 +141,9 @@ class BufferSynchronizer { const changedFiles: Proto.FileCodeEdits[] = []; for (const change of this._pending.values) { switch (change.type) { - case 'change': changedFiles.push(change.args); break; - case 'open': openFiles.push(change.args); break; - case 'close': closedFiles.push(change.args); break; + case BufferOperationType.Change: changedFiles.push(change.args); break; + case BufferOperationType.Open: openFiles.push(change.args); break; + case BufferOperationType.Close: closedFiles.push(change.args); break; } } this.client.execute('updateOpen', { changedFiles, closedFiles, openFiles }, nulToken, { nonRecoverable: true }); @@ -157,12 +155,23 @@ class BufferSynchronizer { return this.client.apiVersion.gte(API.v340); } - private updatePending(resource: vscode.Uri, f: (pending: ResourceMap) => void): void { + private updatePending(resource: vscode.Uri, op: BufferOperation): void { + switch (op.type) { + case BufferOperationType.Close: + const existing = this._pending.get(resource); + switch (existing?.type) { + case BufferOperationType.Open: + this._pending.delete(resource); + return; // Open then close. No need to do anything + } + break; + } + if (this._pending.has(resource)) { // we saw this file before, make sure we flush before working with it again this.flush(); } - f(this._pending); + this._pending.set(resource, op); } } @@ -280,19 +289,25 @@ class GetErrRequest { public readonly files: ResourceMap, onDone: () => void ) { - const args: Proto.GeterrRequestArgs = { - delay: 0, - files: coalesce(Array.from(files.entries).map(entry => client.normalizedPath(entry.resource))) - }; + const allFiles = coalesce(Array.from(files.entries).map(entry => client.normalizedPath(entry.resource))); + if (!allFiles.length) { + this._done = true; + onDone(); + } else { + const request = client.configuration.enableProjectDiagnostics + // Note that geterrForProject is almost certainly not the api we want here as it ends up computing far + // too many diagnostics + ? client.executeAsync('geterrForProject', { delay: 0, file: allFiles[0] }, this._token.token) + : client.executeAsync('geterr', { delay: 0, files: allFiles }, this._token.token); - client.executeAsync('geterr', args, this._token.token) - .finally(() => { + request.finally(() => { if (this._done) { return; } this._done = true; onDone(); }); + } } public cancel(): any { @@ -320,7 +335,7 @@ export default class BufferSyncSupport extends Disposable { constructor( client: ITypeScriptServiceClient, - modeIds: string[] + modeIds: readonly string[] ) { super(); this.client = client; @@ -401,7 +416,10 @@ export default class BufferSyncSupport extends Disposable { this.pendingGetErr?.cancel(); this.pendingDiagnostics.clear(); this.synchronizer.reset(); + } + public reinitialize(): void { + this.reset(); for (const buffer of this.syncedBuffers.allBuffers) { buffer.open(); } @@ -442,7 +460,9 @@ export default class BufferSyncSupport extends Disposable { } public interuptGetErr(f: () => R): R { - if (!this.pendingGetErr) { + if (!this.pendingGetErr + || this.client.configuration.enableProjectDiagnostics // `geterr` happens on seperate server so no need to cancel it. + ) { return f(); } @@ -535,6 +555,8 @@ export default class BufferSyncSupport extends Disposable { orderedFileSet.set(resource, undefined); } } + + this.pendingGetErr = undefined; } // Add all open TS buffers to the geterr request. They might be visible diff --git a/extensions/typescript-language-features/src/features/callHierarchy.ts b/extensions/typescript-language-features/src/features/callHierarchy.ts new file mode 100644 index 0000000000000..a76d8a6bea846 --- /dev/null +++ b/extensions/typescript-language-features/src/features/callHierarchy.ts @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { ITypeScriptServiceClient } from '../typescriptService'; +import * as typeConverters from '../utils/typeConverters'; +import API from '../utils/api'; +import { VersionDependentRegistration } from '../utils/dependentRegistration'; +import type * as Proto from '../protocol'; +import * as path from 'path'; +import * as PConst from '../protocol.const'; + +class TypeScriptCallHierarchySupport implements vscode.CallHierarchyProvider { + public static readonly minVersion = API.v380; + + public constructor( + private readonly client: ITypeScriptServiceClient + ) { } + + public async prepareCallHierarchy( + document: vscode.TextDocument, + position: vscode.Position, + token: vscode.CancellationToken + ): Promise { + const filepath = this.client.toOpenedFilePath(document); + if (!filepath) { + return undefined; + } + + const args = typeConverters.Position.toFileLocationRequestArgs(filepath, position); + const response = await this.client.execute('prepareCallHierarchy', args, token); + if (response.type !== 'response' || !response.body) { + return undefined; + } + + return Array.isArray(response.body) + ? response.body.map(fromProtocolCallHierarchyItem) + : fromProtocolCallHierarchyItem(response.body); + } + + public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise { + const filepath = this.client.toPath(item.uri); + if (!filepath) { + return undefined; + } + + const args = typeConverters.Position.toFileLocationRequestArgs(filepath, item.selectionRange.start); + const response = await this.client.execute('provideCallHierarchyIncomingCalls', args, token); + if (response.type !== 'response' || !response.body) { + return undefined; + } + + return response.body.map(fromProtocolCallHierchyIncomingCall); + } + + public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise { + const filepath = this.client.toPath(item.uri); + if (!filepath) { + return undefined; + } + + const args = typeConverters.Position.toFileLocationRequestArgs(filepath, item.selectionRange.start); + const response = await this.client.execute('provideCallHierarchyOutgoingCalls', args, token); + if (response.type !== 'response' || !response.body) { + return undefined; + } + + return response.body.map(fromProtocolCallHierchyOutgoingCall); + } +} + +function isSourceFileItem(item: Proto.CallHierarchyItem) { + return item.kind === PConst.Kind.script || item.kind === PConst.Kind.module && item.selectionSpan.start.line === 1 && item.selectionSpan.start.offset === 1; +} + +function fromProtocolCallHierarchyItem(item: Proto.CallHierarchyItem): vscode.CallHierarchyItem { + const useFileName = isSourceFileItem(item); + const name = useFileName ? path.basename(item.file) : item.name; + const detail = useFileName ? vscode.workspace.asRelativePath(path.dirname(item.file)) : ''; + return new vscode.CallHierarchyItem( + typeConverters.SymbolKind.fromProtocolScriptElementKind(item.kind), + name, + detail, + vscode.Uri.file(item.file), + typeConverters.Range.fromTextSpan(item.span), + typeConverters.Range.fromTextSpan(item.selectionSpan) + ); +} + +function fromProtocolCallHierchyIncomingCall(item: Proto.CallHierarchyIncomingCall): vscode.CallHierarchyIncomingCall { + return new vscode.CallHierarchyIncomingCall( + fromProtocolCallHierarchyItem(item.from), + item.fromSpans.map(typeConverters.Range.fromTextSpan) + ); +} + +function fromProtocolCallHierchyOutgoingCall(item: Proto.CallHierarchyOutgoingCall): vscode.CallHierarchyOutgoingCall { + return new vscode.CallHierarchyOutgoingCall( + fromProtocolCallHierarchyItem(item.to), + item.fromSpans.map(typeConverters.Range.fromTextSpan) + ); +} + +export function register( + selector: vscode.DocumentSelector, + client: ITypeScriptServiceClient +) { + return new VersionDependentRegistration(client, TypeScriptCallHierarchySupport.minVersion, + () => vscode.languages.registerCallHierarchyProvider(selector, + new TypeScriptCallHierarchySupport(client))); +} diff --git a/extensions/typescript-language-features/src/features/completions.ts b/extensions/typescript-language-features/src/features/completions.ts index dde8a7f2f68a1..52e82adf2a8ae 100644 --- a/extensions/typescript-language-features/src/features/completions.ts +++ b/extensions/typescript-language-features/src/features/completions.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import * as PConst from '../protocol.const'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; import API from '../utils/api'; @@ -16,7 +16,7 @@ import { ConfigurationDependentRegistration } from '../utils/dependentRegistrati import { memoize } from '../utils/memoize'; import * as Previewer from '../utils/previewer'; import { snippetForFunctionCall } from '../utils/snippetForFunctionCall'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import * as typeConverters from '../utils/typeConverters'; import TypingsStatus from '../utils/typingsStatus'; import FileConfigurationManager from './fileConfigurationManager'; @@ -66,17 +66,19 @@ class MyCompletionItem extends vscode.CompletionItem { this.useCodeSnippet = useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method); if (tsEntry.replacementSpan) { - this.range = typeConverters.Range.fromTextSpan(tsEntry.replacementSpan); + let replaceRange = typeConverters.Range.fromTextSpan(tsEntry.replacementSpan); // Make sure we only replace a single line at most - if (!this.range.isSingleLine) { - this.range = new vscode.Range(this.range.start.line, this.range.start.character, this.range.start.line, line.length); + if (!replaceRange.isSingleLine) { + replaceRange = new vscode.Range(replaceRange.start.line, replaceRange.start.character, replaceRange.start.line, line.length); } + this.range = { + inserting: new vscode.Range(replaceRange.start, position), + replacing: replaceRange, + }; } this.insertText = tsEntry.insertText; - // Set filterText for intelliCode and bracket accessors , but not for `this.` completions since it results in - // them being overly prioritized. #74164 - this.filterText = tsEntry.insertText && !/^this\./.test(tsEntry.insertText) ? tsEntry.insertText : undefined; + this.filterText = this.getFilterText(line, tsEntry.insertText); if (completionContext.isMemberCompletion && completionContext.dotAccessorContext) { this.filterText = completionContext.dotAccessorContext.text + (this.insertText || this.label); @@ -119,29 +121,68 @@ class MyCompletionItem extends vscode.CompletionItem { this.resolveRange(line); } + private getFilterText(line: string, insertText: string | undefined): string | undefined { + // Handle private field completions + if (this.tsEntry.name.startsWith('#')) { + const wordRange = this.document.getWordRangeAtPosition(this.position); + const wordStart = wordRange ? line.charAt(wordRange.start.character) : undefined; + if (insertText) { + if (insertText.startsWith('this.#')) { + return wordStart === '#' ? insertText : insertText.replace(/^this\.#/, ''); + } else { + return insertText; + } + } else { + return wordStart === '#' ? undefined : this.tsEntry.name.replace(/^#/, ''); + } + return undefined; + } + + // For `this.` completions, generally don't set the filter text since we don't want them to be overly prioritized. #74164 + if (insertText?.startsWith('this.')) { + return undefined; + } + // Handle the case: + // ``` + // const xyz = { 'ab c': 1 }; + // xyz.ab| + // ``` + // In which case we want to insert a bracket accessor but should use `.abc` as the filter text instead of + // the bracketed insert text. + else if (insertText?.startsWith('[')) { + return insertText.replace(/^\[['"](.+)[['"]\]$/, '.$1'); + } + + // In all other cases, fallback to using the insertText + return insertText; + } + private resolveRange(line: string): void { if (this.range) { return; } - const wordRange = this.document.getWordRangeAtPosition(this.position); - if (wordRange) { - // TODO: Reverted next line due to https://github.com/Microsoft/vscode/issues/66187 - // this.range = wordRange; - } + let replaceRange = wordRange; // Try getting longer, prefix based range for completions that span words const text = line.slice(Math.max(0, this.position.character - this.label.length), this.position.character).toLowerCase(); const entryName = this.label.toLowerCase(); for (let i = entryName.length; i >= 0; --i) { if (text.endsWith(entryName.substr(0, i)) && (!wordRange || wordRange.start.character > this.position.character - i)) { - this.range = new vscode.Range( + replaceRange = new vscode.Range( new vscode.Position(this.position.line, Math.max(0, this.position.character - i)), this.position); break; } } + + if (replaceRange) { + this.range = { + inserting: new vscode.Range(replaceRange.start, this.position), + replacing: replaceRange + }; + } } private static convertKind(kind: string): vscode.CompletionItemKind { @@ -150,17 +191,18 @@ class MyCompletionItem extends vscode.CompletionItem { case PConst.Kind.keyword: return vscode.CompletionItemKind.Keyword; case PConst.Kind.const: - return vscode.CompletionItemKind.Constant; case PConst.Kind.let: case PConst.Kind.variable: case PConst.Kind.localVariable: case PConst.Kind.alias: + case PConst.Kind.parameter: return vscode.CompletionItemKind.Variable; case PConst.Kind.memberVariable: case PConst.Kind.memberGetAccessor: case PConst.Kind.memberSetAccessor: return vscode.CompletionItemKind.Field; case PConst.Kind.function: + case PConst.Kind.localFunction: return vscode.CompletionItemKind.Function; case PConst.Kind.memberFunction: case PConst.Kind.constructSignature: @@ -169,6 +211,8 @@ class MyCompletionItem extends vscode.CompletionItem { return vscode.CompletionItemKind.Method; case PConst.Kind.enum: return vscode.CompletionItemKind.Enum; + case PConst.Kind.enumMember: + return vscode.CompletionItemKind.EnumMember; case PConst.Kind.module: case PConst.Kind.externalModuleName: return vscode.CompletionItemKind.Module; @@ -328,7 +372,7 @@ namespace CompletionConfiguration { class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider { - public static readonly triggerCharacters = ['.', '"', '\'', '`', '/', '@', '<']; + public static readonly triggerCharacters = ['.', '"', '\'', '`', '/', '@', '<', '#']; constructor( private readonly client: ITypeScriptServiceClient, @@ -402,15 +446,17 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider "duration" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, "type" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, "count" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, + "updateGraphDurationMs" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, "${include}": [ "${TypeScriptCommonProperties}" ] } */ this.telemetryReporter.logTelemetry('completions.execute', { - duration: duration + '', - type: response ? response.type : 'unknown', - count: (response && response.type === 'response' && response.body ? response.body.entries.length : 0) + '' + duration: duration, + type: response?.type ?? 'unknown', + count: response?.type === 'response' && response.body ? response.body.entries.length : 0, + updateGraphDurationMs: response?.type === 'response' ? response.performanceData?.updateGraphDurationMs : undefined, }); } @@ -454,14 +500,23 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider } private getTsTriggerCharacter(context: vscode.CompletionContext): Proto.CompletionsTriggerCharacter | undefined { - // Workaround for https://github.com/Microsoft/TypeScript/issues/27321 - if (context.triggerCharacter === '@' - && this.client.apiVersion.gte(API.v310) && this.client.apiVersion.lt(API.v320) - ) { - return undefined; + switch (context.triggerCharacter) { + case '@': // Workaround for https://github.com/Microsoft/TypeScript/issues/27321 + return this.client.apiVersion.gte(API.v310) && this.client.apiVersion.lt(API.v320) ? undefined : '@'; + + case '#': // Workaround for https://github.com/microsoft/TypeScript/issues/36367 + return this.client.apiVersion.lt(API.v381) ? undefined : '#'; + + case '.': + case '"': + case '\'': + case '`': + case '/': + case '<': + return context.triggerCharacter; } - return context.triggerCharacter as Proto.CompletionsTriggerCharacter; + return undefined; } public async resolveCompletionItem( @@ -507,7 +562,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider } item.additionalTextEdits = codeAction.additionalTextEdits; - if (detail && item.useCodeSnippet) { + if (item.useCodeSnippet) { const shouldCompleteFunction = await this.isValidFunctionCompletionContext(filepath, item.position, item.document, token); if (shouldCompleteFunction) { const { snippet, parameterCount } = snippetForFunctionCall(item, detail.displayParts); @@ -589,7 +644,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider ): boolean { if (this.client.apiVersion.lt(API.v320)) { // Workaround for https://github.com/Microsoft/TypeScript/issues/27742 - // Only enable dot completions when previous character not a dot preceeded by whitespace. + // Only enable dot completions when previous character not a dot preceded by whitespace. // Prevents incorrectly completing while typing spread operators. if (position.character > 1) { const preText = document.getText(new vscode.Range( diff --git a/extensions/typescript-language-features/src/features/documentHighlight.ts b/extensions/typescript-language-features/src/features/documentHighlight.ts index 970a265f218ad..61477e0674930 100644 --- a/extensions/typescript-language-features/src/features/documentHighlight.ts +++ b/extensions/typescript-language-features/src/features/documentHighlight.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import { flatten } from '../utils/arrays'; import * as typeConverters from '../utils/typeConverters'; @@ -53,4 +53,4 @@ export function register( ) { return vscode.languages.registerDocumentHighlightProvider(selector, new TypeScriptDocumentHighlightProvider(client)); -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/features/documentSymbol.ts b/extensions/typescript-language-features/src/features/documentSymbol.ts index abcd43238a12b..02c1be917d396 100644 --- a/extensions/typescript-language-features/src/features/documentSymbol.ts +++ b/extensions/typescript-language-features/src/features/documentSymbol.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import * as PConst from '../protocol.const'; import { ITypeScriptServiceClient } from '../typescriptService'; import * as typeConverters from '../utils/typeConverters'; @@ -32,6 +32,7 @@ const getSymbolKind = (kind: string): vscode.SymbolKind => { }; class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider { + public constructor( private readonly client: ITypeScriptServiceClient, private cachedResponse: CachedResponse, @@ -45,33 +46,38 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider const args: Proto.FileRequestArgs = { file }; const response = await this.cachedResponse.execute(document, () => this.client.execute('navtree', args, token)); - if (response.type !== 'response' || !response.body) { + if (response.type !== 'response' || !response.body?.childItems) { return undefined; } - let tree = response.body; - if (tree && tree.childItems) { - // The root represents the file. Ignore this when showing in the UI - const result: vscode.DocumentSymbol[] = []; - tree.childItems.forEach(item => TypeScriptDocumentSymbolProvider.convertNavTree(document.uri, result, item)); - return result; + // The root represents the file. Ignore this when showing in the UI + const result: vscode.DocumentSymbol[] = []; + for (const item of response.body.childItems) { + TypeScriptDocumentSymbolProvider.convertNavTree(document.uri, result, item); } - - return undefined; + return result; } - private static convertNavTree(resource: vscode.Uri, bucket: vscode.DocumentSymbol[], item: Proto.NavigationTree): boolean { + private static convertNavTree( + resource: vscode.Uri, + output: vscode.DocumentSymbol[], + item: Proto.NavigationTree, + ): boolean { let shouldInclude = TypeScriptDocumentSymbolProvider.shouldInclueEntry(item); + if (!shouldInclude && !item.childItems?.length) { + return false; + } const children = new Set(item.childItems || []); for (const span of item.spans) { const range = typeConverters.Range.fromTextSpan(span); + const selectionRange = item.nameSpan ? typeConverters.Range.fromTextSpan(item.nameSpan) : range; const symbolInfo = new vscode.DocumentSymbol( item.text, '', getSymbolKind(item.kind), range, - range); + range.contains(selectionRange) ? selectionRange : range); for (const child of children) { if (child.spans.some(span => !!range.intersection(typeConverters.Range.fromTextSpan(span)))) { @@ -82,7 +88,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider } if (shouldInclude) { - bucket.push(symbolInfo); + output.push(symbolInfo); } } @@ -97,7 +103,6 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider } } - export function register( selector: vscode.DocumentSelector, client: ITypeScriptServiceClient, diff --git a/extensions/typescript-language-features/src/features/fileConfigurationManager.ts b/extensions/typescript-language-features/src/features/fileConfigurationManager.ts index ff9245b4a5e17..cad4e5196b9cc 100644 --- a/extensions/typescript-language-features/src/features/fileConfigurationManager.ts +++ b/extensions/typescript-language-features/src/features/fileConfigurationManager.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { isTypeScriptDocument } from '../utils/languageModeIds'; diff --git a/extensions/typescript-language-features/src/features/fixAll.ts b/extensions/typescript-language-features/src/features/fixAll.ts index d9461442e51df..0f2e0cc78d2f7 100644 --- a/extensions/typescript-language-features/src/features/fixAll.ts +++ b/extensions/typescript-language-features/src/features/fixAll.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { ConfigurationDependentRegistration, VersionDependentRegistration } from '../utils/dependentRegistration'; @@ -82,6 +82,10 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider { return undefined; } const { edit, fixedDiagnostics } = autoFixResponse; + if (!edit.size) { + return undefined; + } + const codeAction = new vscode.CodeAction( localize('autoFix.label', 'Auto fix'), TypeScriptAutoFixProvider.kind); @@ -105,11 +109,11 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider { }; const response = await this.client.execute('getCodeFixes', args, token); if (response.type !== 'response' || !response.body || response.body.length > 1) { - return undefined; + continue; } const fix = response.body[0]; - if (new Set(['fixClassIncorrectlyImplementsInterface', 'spelling']).has(fix.fixName)) { + if (['fixClassIncorrectlyImplementsInterface', 'spelling'].includes(fix.fixName)) { typeConverters.WorkspaceEdit.withFileCodeEdits(edit, this.client, fix.changes); fixedDiagnostics.push(diagnostic); } diff --git a/extensions/typescript-language-features/src/features/folding.ts b/extensions/typescript-language-features/src/features/folding.ts index 079db3c66cb66..f9f04296bddcc 100644 --- a/extensions/typescript-language-features/src/features/folding.ts +++ b/extensions/typescript-language-features/src/features/folding.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { coalesce } from '../utils/arrays'; diff --git a/extensions/typescript-language-features/src/features/formatting.ts b/extensions/typescript-language-features/src/features/formatting.ts index d64effd1a324a..fbe1db881e063 100644 --- a/extensions/typescript-language-features/src/features/formatting.ts +++ b/extensions/typescript-language-features/src/features/formatting.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import { ConfigurationDependentRegistration } from '../utils/dependentRegistration'; import * as typeConverters from '../utils/typeConverters'; @@ -60,12 +60,9 @@ class TypeScriptFormattingProvider implements vscode.DocumentRangeFormattingEdit if (response.type !== 'response' || !response.body) { return []; } - const edits = response.body; + const result: vscode.TextEdit[] = []; - if (!edits) { - return result; - } - for (const edit of edits) { + for (const edit of response.body) { const textEdit = typeConverters.TextEdit.fromCodeEdit(edit); const range = textEdit.range; // Work around for https://github.com/Microsoft/TypeScript/issues/6700. @@ -99,4 +96,4 @@ export function register( vscode.languages.registerDocumentRangeFormattingEditProvider(selector, formattingProvider), ); }); -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/features/hover.ts b/extensions/typescript-language-features/src/features/hover.ts index 5077f9648a0f3..2ff92d6e30805 100644 --- a/extensions/typescript-language-features/src/features/hover.ts +++ b/extensions/typescript-language-features/src/features/hover.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; -import { tagsMarkdownPreview } from '../utils/previewer'; +import { markdownDocumentation } from '../utils/previewer'; import * as typeConverters from '../utils/typeConverters'; @@ -45,9 +45,7 @@ class TypeScriptHoverProvider implements vscode.HoverProvider { if (data.displayString) { parts.push({ language: 'typescript', value: data.displayString }); } - - const tags = tagsMarkdownPreview(data.tags); - parts.push(data.documentation + (tags ? '\n\n' + tags : '')); + parts.push(markdownDocumentation(data.documentation, data.tags)); return parts; } } @@ -58,4 +56,4 @@ export function register( ): vscode.Disposable { return vscode.languages.registerHoverProvider(selector, new TypeScriptHoverProvider(client)); -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/features/implementationsCodeLens.ts b/extensions/typescript-language-features/src/features/implementationsCodeLens.ts index 0ab2ae8719c61..f7e325c819da2 100644 --- a/extensions/typescript-language-features/src/features/implementationsCodeLens.ts +++ b/extensions/typescript-language-features/src/features/implementationsCodeLens.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import * as PConst from '../protocol.const'; import { ITypeScriptServiceClient } from '../typescriptService'; import { ConfigurationDependentRegistration } from '../utils/dependentRegistration'; diff --git a/extensions/typescript-language-features/src/features/jsDocCompletions.ts b/extensions/typescript-language-features/src/features/jsDocCompletions.ts index 82aacc8927a1d..80b0e219705a6 100644 --- a/extensions/typescript-language-features/src/features/jsDocCompletions.ts +++ b/extensions/typescript-language-features/src/features/jsDocCompletions.ts @@ -27,9 +27,8 @@ class JsDocCompletionItem extends vscode.CompletionItem { const prefix = line.slice(0, position.character).match(/\/\**\s*$/); const suffix = line.slice(position.character).match(/^\s*\**\//); const start = position.translate(0, prefix ? -prefix[0].length : 0); - this.range = new vscode.Range( - start, - position.translate(0, suffix ? suffix[0].length : 0)); + const range = new vscode.Range(start, position.translate(0, suffix ? suffix[0].length : 0)); + this.range = { inserting: range, replacing: range }; } } diff --git a/extensions/typescript-language-features/src/features/languageConfiguration.ts b/extensions/typescript-language-features/src/features/languageConfiguration.ts index 59fefa1007b7d..91cb4a36c91b3 100644 --- a/extensions/typescript-language-features/src/features/languageConfiguration.ts +++ b/extensions/typescript-language-features/src/features/languageConfiguration.ts @@ -17,7 +17,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = { decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/, increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/ }, - wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, onEnterRules: [ { // e.g. /** | */ diff --git a/extensions/typescript-language-features/src/features/organizeImports.ts b/extensions/typescript-language-features/src/features/organizeImports.ts index bb7880800a609..b5d492063f96e 100644 --- a/extensions/typescript-language-features/src/features/organizeImports.ts +++ b/extensions/typescript-language-features/src/features/organizeImports.ts @@ -5,14 +5,14 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { Command, CommandManager } from '../utils/commandManager'; import { VersionDependentRegistration } from '../utils/dependentRegistration'; import * as typeconverts from '../utils/typeConverters'; import FileConfigurationManager from './fileConfigurationManager'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import { nulToken } from '../utils/cancellation'; const localize = nls.loadMessageBundle(); diff --git a/extensions/typescript-language-features/src/features/quickFix.ts b/extensions/typescript-language-features/src/features/quickFix.ts index 1b1ad27da858d..5edaaa6b5df2d 100644 --- a/extensions/typescript-language-features/src/features/quickFix.ts +++ b/extensions/typescript-language-features/src/features/quickFix.ts @@ -5,14 +5,14 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { nulToken } from '../utils/cancellation'; import { applyCodeActionCommands, getEditForCodeAction } from '../utils/codeAction'; import { Command, CommandManager } from '../utils/commandManager'; import { memoize } from '../utils/memoize'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import * as typeConverters from '../utils/typeConverters'; import { DiagnosticsManager } from './diagnostics'; import FileConfigurationManager from './fileConfigurationManager'; diff --git a/extensions/typescript-language-features/src/features/refactor.ts b/extensions/typescript-language-features/src/features/refactor.ts index a55236781b6cb..e863cf03bd989 100644 --- a/extensions/typescript-language-features/src/features/refactor.ts +++ b/extensions/typescript-language-features/src/features/refactor.ts @@ -5,16 +5,17 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import { LearnMoreAboutRefactoringsCommand } from '../commands/learnMoreAboutRefactorings'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { nulToken } from '../utils/cancellation'; import { Command, CommandManager } from '../utils/commandManager'; import { VersionDependentRegistration } from '../utils/dependentRegistration'; -import TelemetryReporter from '../utils/telemetry'; +import * as fileSchemes from '../utils/fileSchemes'; +import { TelemetryReporter } from '../utils/telemetry'; import * as typeConverters from '../utils/typeConverters'; import FormattingOptionsManager from './fileConfigurationManager'; -import * as fileSchemes from '../utils/fileSchemes'; const localize = nls.loadMessageBundle(); @@ -209,6 +210,15 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { vscode.CodeActionKind.Refactor, ...allKnownCodeActionKinds.map(x => x.kind), ], + documentation: [ + { + kind: vscode.CodeActionKind.Refactor, + command: { + command: LearnMoreAboutRefactoringsCommand.id, + title: localize('refactor.documentation.title', "Learn more about JS/TS refactorings") + } + } + ] }; public async provideCodeActions( @@ -238,9 +248,14 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { return undefined; } - return this.convertApplicableRefactors(response.body, document, rangeOrSelection); + const actions = this.convertApplicableRefactors(response.body, document, rangeOrSelection); + if (!context.only) { + return actions; + } + return this.appendInvalidActions(actions); } + private convertApplicableRefactors( body: Proto.ApplicableRefactorInfo[], document: vscode.TextDocument, @@ -305,6 +320,33 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { } return false; } + + private appendInvalidActions(actions: vscode.CodeAction[]): vscode.CodeAction[] { + if (!actions.some(action => action.kind && Extract_Constant.kind.contains(action.kind))) { + const disabledAction = new vscode.CodeAction( + localize('extractConstant.disabled.title', "Extract to constant"), + Extract_Constant.kind); + + disabledAction.disabled = { + reason: localize('extractConstant.disabled.reason', "The current selection cannot be extracted"), + }; + disabledAction.isPreferred = true; + + actions.push(disabledAction); + } + + if (!actions.some(action => action.kind && Extract_Function.kind.contains(action.kind))) { + const disabledAction = new vscode.CodeAction( + localize('extractFunction.disabled.title', "Extract to function"), + Extract_Function.kind); + + disabledAction.disabled = { + reason: localize('extractFunction.disabled.reason', "The current selection cannot be extracted"), + }; + actions.push(disabledAction); + } + return actions; + } } export function register( diff --git a/extensions/typescript-language-features/src/features/referencesCodeLens.ts b/extensions/typescript-language-features/src/features/referencesCodeLens.ts index b926f6058ac17..7aa228f8f8e43 100644 --- a/extensions/typescript-language-features/src/features/referencesCodeLens.ts +++ b/extensions/typescript-language-features/src/features/referencesCodeLens.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import * as PConst from '../protocol.const'; import { CachedResponse } from '../tsServer/cachedResponse'; import { ITypeScriptServiceClient } from '../typescriptService'; @@ -15,7 +15,15 @@ import { getSymbolRange, ReferencesCodeLens, TypeScriptBaseCodeLensProvider } fr const localize = nls.loadMessageBundle(); -class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvider { +export class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvider { + public constructor( + protected client: ITypeScriptServiceClient, + protected _cachedResponse: CachedResponse, + private modeId: string + ) { + super(client, _cachedResponse); + } + public async resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise { const codeLens = inputCodeLens as ReferencesCodeLens; const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start); @@ -59,31 +67,54 @@ class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvide } switch (item.kind) { + case PConst.Kind.function: + const showOnAllFunctions = vscode.workspace.getConfiguration(this.modeId).get('referencesCodeLens.showOnAllFunctions'); + if (showOnAllFunctions) { + return getSymbolRange(document, item); + } + // fallthrough + case PConst.Kind.const: case PConst.Kind.let: case PConst.Kind.variable: - case PConst.Kind.function: // Only show references for exported variables - if (!item.kindModifiers.match(/\bexport\b/)) { - break; + if (/\bexport\b/.test(item.kindModifiers)) { + return getSymbolRange(document, item); } - // fallthrough + break; case PConst.Kind.class: if (item.text === '') { break; } - // fallthrough + return getSymbolRange(document, item); - case PConst.Kind.memberFunction: - case PConst.Kind.memberVariable: - case PConst.Kind.memberGetAccessor: - case PConst.Kind.memberSetAccessor: - case PConst.Kind.constructorImplementation: case PConst.Kind.interface: case PConst.Kind.type: case PConst.Kind.enum: return getSymbolRange(document, item); + + case PConst.Kind.memberFunction: + case PConst.Kind.memberGetAccessor: + case PConst.Kind.memberSetAccessor: + case PConst.Kind.constructorImplementation: + case PConst.Kind.memberVariable: + // Don't show if child and parent have same start + // For https://github.com/microsoft/vscode/issues/90396 + if (parent && + typeConverters.Position.fromLocation(parent.spans[0].start).isEqual(typeConverters.Position.fromLocation(item.spans[0].start)) + ) { + return null; + } + + // Only show if parent is a class type object (not a literal) + switch (parent?.kind) { + case PConst.Kind.class: + case PConst.Kind.interface: + case PConst.Kind.type: + return getSymbolRange(document, item); + } + break; } return null; @@ -98,6 +129,6 @@ export function register( ) { return new ConfigurationDependentRegistration(modeId, 'referencesCodeLens.enabled', () => { return vscode.languages.registerCodeLensProvider(selector, - new TypeScriptReferencesCodeLensProvider(client, cachedResponse)); + new TypeScriptReferencesCodeLensProvider(client, cachedResponse, modeId)); }); } diff --git a/extensions/typescript-language-features/src/features/rename.ts b/extensions/typescript-language-features/src/features/rename.ts index aff2c508c5309..886cf420b7475 100644 --- a/extensions/typescript-language-features/src/features/rename.ts +++ b/extensions/typescript-language-features/src/features/rename.ts @@ -6,7 +6,7 @@ import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; import API from '../utils/api'; import * as typeConverters from '../utils/typeConverters'; diff --git a/extensions/typescript-language-features/src/features/semanticTokens.ts b/extensions/typescript-language-features/src/features/semanticTokens.ts new file mode 100644 index 0000000000000..3a80ea9d6f77a --- /dev/null +++ b/extensions/typescript-language-features/src/features/semanticTokens.ts @@ -0,0 +1,253 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { ITypeScriptServiceClient, ExecConfig, ServerResponse } from '../typescriptService'; +import * as Proto from '../protocol'; +import { VersionDependentRegistration } from '../utils/dependentRegistration'; +import API from '../utils/api'; + +// all constants are const +import { TokenType, TokenModifier, TokenEncodingConsts, VersionRequirement } from 'typescript-vscode-sh-plugin/lib/constants'; + +const minTypeScriptVersion = API.fromVersionString(`${VersionRequirement.major}.${VersionRequirement.minor}`); + +export function register(selector: vscode.DocumentSelector, client: ITypeScriptServiceClient) { + return new VersionDependentRegistration(client, minTypeScriptVersion, () => { + const provider = new DocumentSemanticTokensProvider(client); + return vscode.Disposable.from( + vscode.languages.registerDocumentSemanticTokensProvider(selector, provider, provider.getLegend()), + vscode.languages.registerDocumentRangeSemanticTokensProvider(selector, provider, provider.getLegend()), + ); + }); +} + +/** + * Prototype of a DocumentSemanticTokensProvider, relying on the experimental `encodedSemanticClassifications-full` request from the TypeScript server. + * As the results retured by the TypeScript server are limited, we also add a Typescript plugin (typescript-vscode-sh-plugin) to enrich the returned token. + * See https://github.com/aeschli/typescript-vscode-sh-plugin. + */ +class DocumentSemanticTokensProvider implements vscode.DocumentSemanticTokensProvider, vscode.DocumentRangeSemanticTokensProvider { + + constructor(private readonly client: ITypeScriptServiceClient) { + } + + getLegend(): vscode.SemanticTokensLegend { + return new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); + } + + async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken): Promise { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return null; + } + return this._provideSemanticTokens(document, { file, start: 0, length: document.getText().length }, token); + } + + async provideDocumentRangeSemanticTokens(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return null; + } + const start = document.offsetAt(range.start); + const length = document.offsetAt(range.end) - start; + return this._provideSemanticTokens(document, { file, start, length }, token); + } + + async _provideSemanticTokens(document: vscode.TextDocument, requestArg: ExperimentalProtocol.EncodedSemanticClassificationsRequestArgs, token: vscode.CancellationToken): Promise { + const file = this.client.toOpenedFilePath(document); + if (!file) { + return null; + } + + const versionBeforeRequest = document.version; + + const response = await (this.client as ExperimentalProtocol.IExtendedTypeScriptServiceClient).execute('encodedSemanticClassifications-full', requestArg, token); + if (response.type !== 'response' || !response.body) { + return null; + } + + const versionAfterRequest = document.version; + + if (versionBeforeRequest !== versionAfterRequest) { + // cannot convert result's offsets to (line;col) values correctly + // a new request will come in soon... + // + // here we cannot return null, because returning null would remove all semantic tokens. + // we must throw to indicate that the semantic tokens should not be removed. + // using the string busy here because it is not logged to error telemetry if the error text contains busy. + throw new Error('busy'); + } + + const tokenSpan = response.body.spans; + + const builder = new vscode.SemanticTokensBuilder(); + let i = 0; + while (i < tokenSpan.length) { + const offset = tokenSpan[i++]; + const length = tokenSpan[i++]; + const tsClassification = tokenSpan[i++]; + + let tokenModifiers = 0; + let tokenType = getTokenTypeFromClassification(tsClassification); + if (tokenType !== undefined) { + // it's a classification as returned by the typescript-vscode-sh-plugin + tokenModifiers = getTokenModifierFromClassification(tsClassification); + } else { + // typescript-vscode-sh-plugin is not present + tokenType = tokenTypeMap[tsClassification]; + if (tokenType === undefined) { + continue; + } + } + + // we can use the document's range conversion methods because the result is at the same version as the document + const startPos = document.positionAt(offset); + const endPos = document.positionAt(offset + length); + + for (let line = startPos.line; line <= endPos.line; line++) { + const startCharacter = (line === startPos.line ? startPos.character : 0); + const endCharacter = (line === endPos.line ? endPos.character : document.lineAt(line).text.length); + builder.push(line, startCharacter, endCharacter - startCharacter, tokenType, tokenModifiers); + } + } + return new vscode.SemanticTokens(builder.build()); + } +} + +// typescript-vscode-sh-plugin encodes type and modifiers in the classification: +// TSClassification = (TokenType + 1) << 8 + TokenModifier + +function getTokenTypeFromClassification(tsClassification: number): number | undefined { + if (tsClassification > TokenEncodingConsts.modifierMask) { + return (tsClassification >> TokenEncodingConsts.typeOffset) - 1; + } + return undefined; +} + +function getTokenModifierFromClassification(tsClassification: number) { + return tsClassification & TokenEncodingConsts.modifierMask; +} + +const tokenTypes: string[] = []; +tokenTypes[TokenType.class] = 'class'; +tokenTypes[TokenType.enum] = 'enum'; +tokenTypes[TokenType.interface] = 'interface'; +tokenTypes[TokenType.namespace] = 'namespace'; +tokenTypes[TokenType.typeParameter] = 'typeParameter'; +tokenTypes[TokenType.type] = 'type'; +tokenTypes[TokenType.parameter] = 'parameter'; +tokenTypes[TokenType.variable] = 'variable'; +tokenTypes[TokenType.enumMember] = 'enumMember'; +tokenTypes[TokenType.property] = 'property'; +tokenTypes[TokenType.function] = 'function'; +tokenTypes[TokenType.member] = 'member'; + +const tokenModifiers: string[] = []; +tokenModifiers[TokenModifier.async] = 'async'; +tokenModifiers[TokenModifier.declaration] = 'declaration'; +tokenModifiers[TokenModifier.readonly] = 'readonly'; +tokenModifiers[TokenModifier.static] = 'static'; +tokenModifiers[TokenModifier.local] = 'local'; + +// make sure token types and modifiers are complete +if (tokenTypes.filter(t => !!t).length !== TokenType._) { + console.warn('typescript-vscode-sh-plugin has added new tokens types.'); +} +if (tokenModifiers.filter(t => !!t).length !== TokenModifier._) { + console.warn('typescript-vscode-sh-plugin has added new tokens modifiers.'); +} + +// mapping for the original ExperimentalProtocol.ClassificationType from TypeScript (only used when plugin is not available) +const tokenTypeMap: number[] = []; +tokenTypeMap[ExperimentalProtocol.ClassificationType.className] = TokenType.class; +tokenTypeMap[ExperimentalProtocol.ClassificationType.enumName] = TokenType.enum; +tokenTypeMap[ExperimentalProtocol.ClassificationType.interfaceName] = TokenType.interface; +tokenTypeMap[ExperimentalProtocol.ClassificationType.moduleName] = TokenType.namespace; +tokenTypeMap[ExperimentalProtocol.ClassificationType.typeParameterName] = TokenType.typeParameter; +tokenTypeMap[ExperimentalProtocol.ClassificationType.typeAliasName] = TokenType.type; +tokenTypeMap[ExperimentalProtocol.ClassificationType.parameterName] = TokenType.parameter; + +namespace ExperimentalProtocol { + + export interface IExtendedTypeScriptServiceClient { + execute( + command: K, + args: ExperimentalProtocol.ExtendedTsServerRequests[K][0], + token: vscode.CancellationToken, + config?: ExecConfig + ): Promise>; + } + + /** + * A request to get encoded semantic classifications for a span in the file + */ + export interface EncodedSemanticClassificationsRequest extends Proto.FileRequest { + arguments: EncodedSemanticClassificationsRequestArgs; + } + + /** + * Arguments for EncodedSemanticClassificationsRequest request. + */ + export interface EncodedSemanticClassificationsRequestArgs extends Proto.FileRequestArgs { + /** + * Start position of the span. + */ + start: number; + /** + * Length of the span. + */ + length: number; + } + + export const enum EndOfLineState { + None, + InMultiLineCommentTrivia, + InSingleQuoteStringLiteral, + InDoubleQuoteStringLiteral, + InTemplateHeadOrNoSubstitutionTemplate, + InTemplateMiddleOrTail, + InTemplateSubstitutionPosition, + } + + export const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, + docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, + bigintLiteral = 25, + } + + export interface EncodedSemanticClassificationsResponse extends Proto.Response { + body?: { + endOfLineState: EndOfLineState; + spans: number[]; + }; + } + + export interface ExtendedTsServerRequests { + 'encodedSemanticClassifications-full': [ExperimentalProtocol.EncodedSemanticClassificationsRequestArgs, ExperimentalProtocol.EncodedSemanticClassificationsResponse]; + } +} diff --git a/extensions/typescript-language-features/src/features/signatureHelp.ts b/extensions/typescript-language-features/src/features/signatureHelp.ts index f7ad9ad7ee969..0f79a2aef8edd 100644 --- a/extensions/typescript-language-features/src/features/signatureHelp.ts +++ b/extensions/typescript-language-features/src/features/signatureHelp.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import * as Previewer from '../utils/previewer'; import * as typeConverters from '../utils/typeConverters'; diff --git a/extensions/typescript-language-features/src/features/smartSelect.ts b/extensions/typescript-language-features/src/features/smartSelect.ts index 3d05d1309a238..651535c5bcfa1 100644 --- a/extensions/typescript-language-features/src/features/smartSelect.ts +++ b/extensions/typescript-language-features/src/features/smartSelect.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { VersionDependentRegistration } from '../utils/dependentRegistration'; @@ -54,4 +54,4 @@ export function register( ) { return new VersionDependentRegistration(client, SmartSelection.minVersion, () => vscode.languages.registerSelectionRangeProvider(selector, new SmartSelection(client))); -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/features/tagClosing.ts b/extensions/typescript-language-features/src/features/tagClosing.ts index 1123b17553111..03b65c4ea2a69 100644 --- a/extensions/typescript-language-features/src/features/tagClosing.ts +++ b/extensions/typescript-language-features/src/features/tagClosing.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { ConditionalRegistration, ConfigurationDependentRegistration, VersionDependentRegistration } from '../utils/dependentRegistration'; diff --git a/extensions/typescript-language-features/src/features/task.ts b/extensions/typescript-language-features/src/features/task.ts index 59044029b69f1..b63ff25019f74 100644 --- a/extensions/typescript-language-features/src/features/task.ts +++ b/extensions/typescript-language-features/src/features/task.ts @@ -20,7 +20,8 @@ type AutoDetect = 'on' | 'off' | 'build' | 'watch'; const exists = async (resource: vscode.Uri): Promise => { try { const stat = await vscode.workspace.fs.stat(resource); - return stat.type === vscode.FileType.File; + // stat.type is an enum flag + return !!(stat.type & vscode.FileType.File); } catch { return false; } @@ -71,32 +72,31 @@ export default class TscTaskProvider implements vscode.TaskProvider { return tasks; } - public async resolveTask(_task: vscode.Task): Promise { - const definition = _task.definition; - const badTsconfig = /\\tsconfig.*\.json/; - if (badTsconfig.exec(definition.tsconfig) !== null) { + public async resolveTask(task: vscode.Task): Promise { + const definition = task.definition; + if (/\\tsconfig.*\.json/.test(definition.tsconfig)) { // Warn that the task has the wrong slash type vscode.window.showWarningMessage(localize('badTsConfig', "TypeScript Task in tasks.json contains \"\\\\\". TypeScript tasks tsconfig must use \"/\"")); return undefined; } - const typescriptTask = (_task.definition).tsconfig; - if (typescriptTask) { - if (_task.scope === undefined || _task.scope === vscode.TaskScope.Global || _task.scope === vscode.TaskScope.Workspace) { - // scope is required to be a WorkspaceFolder for resolveTask - return undefined; - } - const kind: TypeScriptTaskDefinition = (_task.definition); - const tsconfigUri: vscode.Uri = _task.scope.uri.with({ path: _task.scope.uri.path + '/' + kind.tsconfig }); - const tsconfig: TSConfig = { - uri: tsconfigUri, - fsPath: tsconfigUri.fsPath, - posixPath: tsconfigUri.path, - workspaceFolder: _task.scope - }; - return this.getTasksForProjectAndDefinition(tsconfig, kind); + const tsconfigPath = definition.tsconfig; + if (!tsconfigPath) { + return undefined; } - return undefined; + + if (task.scope === undefined || task.scope === vscode.TaskScope.Global || task.scope === vscode.TaskScope.Workspace) { + // scope is required to be a WorkspaceFolder for resolveTask + return undefined; + } + const tsconfigUri = task.scope.uri.with({ path: task.scope.uri.path + '/' + tsconfigPath }); + const tsconfig: TSConfig = { + uri: tsconfigUri, + fsPath: tsconfigUri.fsPath, + posixPath: tsconfigUri.path, + workspaceFolder: task.scope + }; + return this.getTasksForProjectAndDefinition(tsconfig, definition); } private async getAllTsConfigs(token: vscode.CancellationToken): Promise { diff --git a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts index 8dad613683cb1..16b764d525625 100644 --- a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts +++ b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts @@ -6,7 +6,7 @@ import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import API from '../utils/api'; import { Delayer } from '../utils/async'; @@ -58,7 +58,7 @@ class UpdateImportsOnFileRenameHandler extends Disposable { super(); this._register(vscode.workspace.onDidRenameFiles(async (e) => { - const [{ newUri, oldUri }] = e.renamed; + const [{ newUri, oldUri }] = e.files; const newFilePath = this.client.toPath(newUri); if (!newFilePath) { return; diff --git a/extensions/typescript-language-features/src/features/workspaceSymbols.ts b/extensions/typescript-language-features/src/features/workspaceSymbols.ts index 857969be00899..eb46f166df9f0 100644 --- a/extensions/typescript-language-features/src/features/workspaceSymbols.ts +++ b/extensions/typescript-language-features/src/features/workspaceSymbols.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import * as fileSchemes from '../utils/fileSchemes'; import { doesResourceLookLikeAJavaScriptFile, doesResourceLookLikeATypeScriptFile } from '../utils/languageDescription'; diff --git a/extensions/typescript-language-features/src/languageProvider.ts b/extensions/typescript-language-features/src/languageProvider.ts index 4210ba2ba20fd..644eed4044196 100644 --- a/extensions/typescript-language-features/src/languageProvider.ts +++ b/extensions/typescript-language-features/src/languageProvider.ts @@ -14,7 +14,7 @@ import { Disposable } from './utils/dispose'; import * as fileSchemes from './utils/fileSchemes'; import { LanguageDescription } from './utils/languageDescription'; import { memoize } from './utils/memoize'; -import TelemetryReporter from './utils/telemetry'; +import { TelemetryReporter } from './utils/telemetry'; import TypingsStatus from './utils/typingsStatus'; @@ -78,6 +78,8 @@ export default class LanguageProvider extends Disposable { import('./features/signatureHelp').then(provider => this._register(provider.register(selector, this.client))), import('./features/tagClosing').then(provider => this._register(provider.register(selector, this.description.id, this.client))), import('./features/typeDefinitions').then(provider => this._register(provider.register(selector, this.client))), + import('./features/semanticTokens').then(provider => this._register(provider.register(selector, this.client))), + import('./features/callHierarchy').then(provider => this._register(provider.register(selector, this.client))), ]); } @@ -141,4 +143,4 @@ export default class LanguageProvider extends Disposable { private get _diagnosticLanguage() { return this.description.diagnosticLanguage; } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/protocol.const.ts b/extensions/typescript-language-features/src/protocol.const.ts index efded538f7708..a44c175f295fc 100644 --- a/extensions/typescript-language-features/src/protocol.const.ts +++ b/extensions/typescript-language-features/src/protocol.const.ts @@ -12,6 +12,7 @@ export class Kind { public static readonly constructSignature = 'construct'; public static readonly directory = 'directory'; public static readonly enum = 'enum'; + public static readonly enumMember = 'enum member'; public static readonly externalModuleName = 'external module name'; public static readonly function = 'function'; public static readonly indexSignature = 'index'; @@ -32,6 +33,7 @@ export class Kind { public static readonly warning = 'warning'; public static readonly string = 'string'; public static readonly parameter = 'parameter'; + public static readonly typeParameter = 'type parameter'; } @@ -69,4 +71,4 @@ export class DisplayPartKind { public static readonly propertyName = 'propertyName'; public static readonly punctuation = 'punctuation'; public static readonly text = 'text'; -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/test/cachedResponse.test.ts b/extensions/typescript-language-features/src/test/cachedResponse.test.ts index 919d5d4d03cce..ae05f5d442654 100644 --- a/extensions/typescript-language-features/src/test/cachedResponse.test.ts +++ b/extensions/typescript-language-features/src/test/cachedResponse.test.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import 'mocha'; import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { CachedResponse } from '../tsServer/cachedResponse'; import { ServerResponse } from '../typescriptService'; diff --git a/extensions/typescript-language-features/src/test/completions.test.ts b/extensions/typescript-language-features/src/test/completions.test.ts index f35d0cae73c9a..20afd43678e1e 100644 --- a/extensions/typescript-language-features/src/test/completions.test.ts +++ b/extensions/typescript-language-features/src/test/completions.test.ts @@ -3,38 +3,23 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as assert from 'assert'; import 'mocha'; import * as vscode from 'vscode'; import { disposeAll } from '../utils/dispose'; -import { createTestEditor, joinLines, wait } from './testUtils'; import { acceptFirstSuggestion, typeCommitCharacter } from './suggestTestHelpers'; +import { assertEditorContents, Config, createTestEditor, joinLines, updateConfig, VsCodeConfiguration, wait, enumerateConfig } from './testUtils'; const testDocumentUri = vscode.Uri.parse('untitled:test.ts'); -type VsCodeConfiguration = { [key: string]: any }; - -async function updateConfig(newConfig: VsCodeConfiguration): Promise { - const oldConfig: VsCodeConfiguration = {}; - const config = vscode.workspace.getConfiguration(undefined, testDocumentUri); - for (const configKey of Object.keys(newConfig)) { - oldConfig[configKey] = config.get(configKey); - await new Promise((resolve, reject) => - config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) - .then(() => resolve(), reject)); - } - return oldConfig; -} - -namespace Config { - export const suggestSelection = 'editor.suggestSelection'; - export const completeFunctionCalls = 'typescript.suggest.completeFunctionCalls'; -} +const insertModes = Object.freeze(['insert', 'replace']); suite('TypeScript Completions', () => { const configDefaults: VsCodeConfiguration = Object.freeze({ - [Config.suggestSelection]: 'first', + [Config.autoClosingBrackets]: 'always', [Config.completeFunctionCalls]: false, + [Config.insertMode]: 'insert', + [Config.snippetSuggestions]: 'none', + [Config.suggestSelection]: 'first', }); const _disposables: vscode.Disposable[] = []; @@ -44,76 +29,87 @@ suite('TypeScript Completions', () => { await wait(100); // Save off config and apply defaults - oldConfig = await updateConfig(configDefaults); + oldConfig = await updateConfig(testDocumentUri, configDefaults); }); teardown(async () => { disposeAll(_disposables); // Restore config - await updateConfig(oldConfig); + await updateConfig(testDocumentUri, oldConfig); return vscode.commands.executeCommand('workbench.action.closeAllEditors'); }); test('Basic var completion', async () => { - await createTestEditor(testDocumentUri, - `const abcdef = 123;`, - `ab$0;` - ); - - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), - joinLines( + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, `const abcdef = 123;`, - `abcdef;` - )); + `ab$0;` + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `const abcdef = 123;`, + `abcdef;` + ), + `config: ${config}` + ); + }); }); test('Should treat period as commit character for var completions', async () => { - await createTestEditor(testDocumentUri, - `const abcdef = 123;`, - `ab$0;` - ); - - const document = await typeCommitCharacter(testDocumentUri, '.', _disposables); - assert.strictEqual( - document.getText(), - joinLines( + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, `const abcdef = 123;`, - `abcdef.;` - )); + `ab$0;` + ); + + await typeCommitCharacter(testDocumentUri, '.', _disposables); + + assertEditorContents(editor, + joinLines( + `const abcdef = 123;`, + `abcdef.;` + ), + `config: ${config}`); + }); }); test('Should treat paren as commit character for function completions', async () => { - await createTestEditor(testDocumentUri, - `function abcdef() {};`, - `ab$0;` - ); - - const document = await typeCommitCharacter(testDocumentUri, '(', _disposables); - assert.strictEqual( - document.getText(), - joinLines( + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, `function abcdef() {};`, - `abcdef();` - )); + `ab$0;` + ); + + await typeCommitCharacter(testDocumentUri, '(', _disposables); + + assertEditorContents(editor, + joinLines( + `function abcdef() {};`, + `abcdef();` + ), `config: ${config}`); + }); }); test('Should insert backets when completing dot properties with spaces in name', async () => { - await createTestEditor(testDocumentUri, - 'const x = { "hello world": 1 };', - 'x.$0' - ); - - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), - joinLines( + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, 'const x = { "hello world": 1 };', - 'x["hello world"]' - )); + 'x.$0' + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + 'const x = { "hello world": 1 };', + 'x["hello world"]' + ), `config: ${config}`); + }); }); test('Should allow commit characters for backet completions', async () => { @@ -121,14 +117,14 @@ suite('TypeScript Completions', () => { { char: '.', insert: '.' }, { char: '(', insert: '()' }, ]) { - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, 'const x = { "hello world2": 1 };', 'x.$0' ); - const document = await typeCommitCharacter(testDocumentUri, char, _disposables); - assert.strictEqual( - document.getText(), + await typeCommitCharacter(testDocumentUri, char, _disposables); + + assertEditorContents(editor, joinLines( 'const x = { "hello world2": 1 };', `x["hello world2"]${insert}` @@ -140,23 +136,26 @@ suite('TypeScript Completions', () => { }); test('Should not prioritize bracket accessor completions. #63100', async () => { - // 'a' should be first entry in completion list - await createTestEditor(testDocumentUri, - 'const x = { "z-z": 1, a: 1 };', - 'x.$0' - ); - - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), - joinLines( + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + // 'a' should be first entry in completion list + const editor = await createTestEditor(testDocumentUri, 'const x = { "z-z": 1, a: 1 };', - 'x.a' - )); + 'x.$0' + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + 'const x = { "z-z": 1, a: 1 };', + 'x.a' + ), + `config: ${config}`); + }); }); test('Accepting a string completion should replace the entire string. #53962', async () => { - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, 'interface TFunction {', ` (_: 'abc.abc2', __ ?: {}): string;`, ` (_: 'abc.abc', __?: {}): string;`, @@ -165,9 +164,9 @@ suite('TypeScript Completions', () => { `f('abc.abc$0')` ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables, { useLineRange: true }); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( 'interface TFunction {', ` (_: 'abc.abc2', __ ?: {}): string;`, @@ -178,35 +177,18 @@ suite('TypeScript Completions', () => { )); }); - test.skip('Accepting a member completion should result in valid code. #58597', async () => { - await createTestEditor(testDocumentUri, - `const abc = 123;`, - `ab$0c` - ); - - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), - joinLines( - `const abc = 123;`, - `abc` - )); - }); - test('completeFunctionCalls should complete function parameters when at end of word', async () => { - await updateConfig({ - [Config.completeFunctionCalls]: true, - }); + await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true }); // Complete with-in word - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, `function abcdef(x, y, z) { }`, `abcdef$0` ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( `function abcdef(x, y, z) { }`, `abcdef(x, y, z)` @@ -214,18 +196,16 @@ suite('TypeScript Completions', () => { }); test.skip('completeFunctionCalls should complete function parameters when within word', async () => { - await updateConfig({ - [Config.completeFunctionCalls]: true, - }); + await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true }); - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, `function abcdef(x, y, z) { }`, `abcd$0ef` ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( `function abcdef(x, y, z) { }`, `abcdef(x, y, z)` @@ -233,18 +213,16 @@ suite('TypeScript Completions', () => { }); test('completeFunctionCalls should not complete function parameters at end of word if we are already in something that looks like a function call, #18131', async () => { - await updateConfig({ - [Config.completeFunctionCalls]: true, - }); + await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true }); - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, `function abcdef(x, y, z) { }`, `abcdef$0(1, 2, 3)` ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( `function abcdef(x, y, z) { }`, `abcdef(1, 2, 3)` @@ -252,45 +230,396 @@ suite('TypeScript Completions', () => { }); test.skip('completeFunctionCalls should not complete function parameters within word if we are already in something that looks like a function call, #18131', async () => { - await updateConfig({ - [Config.completeFunctionCalls]: true, - }); + await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true }); - await createTestEditor(testDocumentUri, + const editor = await createTestEditor(testDocumentUri, `function abcdef(x, y, z) { }`, `abcd$0ef(1, 2, 3)` ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( `function abcdef(x, y, z) { }`, `abcdef(1, 2, 3)` )); }); - test('should not de-prioritized this.member suggestion, #74164', async () => { - await createTestEditor(testDocumentUri, - `class A {`, - ` private detail = '';`, + test('should not de-prioritize `this.member` suggestion, #74164', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` private detail = '';`, + ` foo() {`, + ` det$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` private detail = '';`, + ` foo() {`, + ` this.detail`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Member completions for string property name should insert `this.` and use brackets', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` ['xyz 123'] = 1`, + ` foo() {`, + ` xyz$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` ['xyz 123'] = 1`, + ` foo() {`, + ` this["xyz 123"]`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Member completions for string property name already using `this.` should add brackets', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` ['xyz 123'] = 1`, + ` foo() {`, + ` this.xyz$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` ['xyz 123'] = 1`, + ` foo() {`, + ` this["xyz 123"]`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Accepting a completion in word using `insert` mode should insert', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'insert' }); + + const editor = await createTestEditor(testDocumentUri, + `const abc = 123;`, + `ab$0c` + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `const abc = 123;`, + `abcc` + )); + }); + + test('Accepting a completion in word using `replace` mode should replace', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'replace' }); + + const editor = await createTestEditor(testDocumentUri, + `const abc = 123;`, + `ab$0c` + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `const abc = 123;`, + `abc` + )); + }); + + test('Accepting a member completion in word using `insert` mode add `this.` and insert', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'insert' }); + + const editor = await createTestEditor(testDocumentUri, + `class Foo {`, + ` abc = 1;`, ` foo() {`, - ` det$0`, + ` ab$0c`, ` }`, `}`, ); - const document = await acceptFirstSuggestion(testDocumentUri, _disposables); - assert.strictEqual( - document.getText(), + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, joinLines( + `class Foo {`, + ` abc = 1;`, + ` foo() {`, + ` this.abcc`, + ` }`, + `}`, + )); + }); + + test('Accepting a member completion in word using `replace` mode should add `this.` and replace', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'replace' }); + + const editor = await createTestEditor(testDocumentUri, + `class Foo {`, + ` abc = 1;`, + ` foo() {`, + ` ab$0c`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class Foo {`, + ` abc = 1;`, + ` foo() {`, + ` this.abc`, + ` }`, + `}`, + )); + }); + + test('Accepting string completion inside string using `insert` mode should insert', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'insert' }); + + const editor = await createTestEditor(testDocumentUri, + `const abc = { 'xy z': 123 }`, + `abc["x$0y w"]` + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `const abc = { 'xy z': 123 }`, + `abc["xy zy w"]` + )); + }); + + // Waiting on https://github.com/microsoft/TypeScript/issues/35602 + test.skip('Accepting string completion inside string using insert mode should insert', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'replace' }); + + const editor = await createTestEditor(testDocumentUri, + `const abc = { 'xy z': 123 }`, + `abc["x$0y w"]` + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `const abc = { 'xy z': 123 }`, + `abc["xy w"]` + )); + }); + + test('Private field completions on `this.#` should work', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, `class A {`, - ` private detail = '';`, + ` #xyz = 1;`, + ` foo() {`, + ` this.#$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` this.#xyz`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Private field completions on `#` should insert `this.`', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` #xyz = 1;`, ` foo() {`, - ` this.detail`, + ` #$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` this.#xyz`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Private field completions should not require strict prefix match (#89556)', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` this.xyz$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` this.#xyz`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Private field completions without `this.` should not require strict prefix match (#89556)', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` xyz$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` #xyz = 1;`, + ` foo() {`, + ` this.#xyz`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); + + test('Accepting a completion for async property in `insert` mode should insert and add await', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'insert' }); + + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` xyz = Promise.resolve({ 'abc': 1 });`, + ` async foo() {`, + ` this.xyz.ab$0c`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` xyz = Promise.resolve({ 'abc': 1 });`, + ` async foo() {`, + ` (await this.xyz).abcc`, + ` }`, + `}`, + )); + }); + + test('Accepting a completion for async property in `replace` mode should replace and add await', async () => { + await updateConfig(testDocumentUri, { [Config.insertMode]: 'replace' }); + + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` xyz = Promise.resolve({ 'abc': 1 });`, + ` async foo() {`, + ` this.xyz.ab$0c`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` xyz = Promise.resolve({ 'abc': 1 });`, + ` async foo() {`, + ` (await this.xyz).abc`, ` }`, `}`, )); }); -}); + test.skip('Accepting a completion for async string property should add await plus brackets', async () => { + await enumerateConfig(testDocumentUri, Config.insertMode, insertModes, async config => { + const editor = await createTestEditor(testDocumentUri, + `class A {`, + ` xyz = Promise.resolve({ 'ab c': 1 });`, + ` async foo() {`, + ` this.xyz.ab$0`, + ` }`, + `}`, + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `class A {`, + ` xyz = Promise.resolve({ 'abc': 1 });`, + ` async foo() {`, + ` (await this.xyz)["ab c"]`, + ` }`, + `}`, + ), + `Config: ${config}`); + }); + }); +}); diff --git a/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts b/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts index e053719f3d4e4..1289b87b4bc19 100644 --- a/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts +++ b/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts @@ -3,6 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +// todo@matt +/* eslint code-no-unexternalized-strings: 0 */ + import * as assert from 'assert'; import 'mocha'; import * as vscode from 'vscode'; diff --git a/extensions/typescript-language-features/src/test/index.ts b/extensions/typescript-language-features/src/test/index.ts index 4c3a74b15b88e..1a5f741905998 100644 --- a/extensions/typescript-language-features/src/test/index.ts +++ b/extensions/typescript-language-features/src/test/index.ts @@ -22,7 +22,7 @@ const testRunner = require('vscode/lib/testrunner'); testRunner.configure({ ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle) - timeout: 60000 + timeout: 60000, }); export = testRunner; diff --git a/extensions/typescript-language-features/src/test/jsDocCompletions.test.ts b/extensions/typescript-language-features/src/test/jsDocCompletions.test.ts index ffd836f5ab3e7..63d3f144f9a90 100644 --- a/extensions/typescript-language-features/src/test/jsDocCompletions.test.ts +++ b/extensions/typescript-language-features/src/test/jsDocCompletions.test.ts @@ -3,42 +3,59 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as assert from 'assert'; import 'mocha'; import * as vscode from 'vscode'; import { disposeAll } from '../utils/dispose'; -import { createTestEditor, joinLines, wait } from './testUtils'; import { acceptFirstSuggestion } from './suggestTestHelpers'; +import { assertEditorContents, Config, createTestEditor, CURSOR, enumerateConfig, insertModesValues, joinLines, updateConfig, VsCodeConfiguration, wait } from './testUtils'; const testDocumentUri = vscode.Uri.parse('untitled:test.ts'); suite('JSDoc Completions', () => { const _disposables: vscode.Disposable[] = []; + const configDefaults: VsCodeConfiguration = Object.freeze({ + [Config.snippetSuggestions]: 'inline', + }); + + let oldConfig: { [key: string]: any } = {}; + setup(async () => { await wait(100); + + // Save off config and apply defaults + oldConfig = await updateConfig(testDocumentUri, configDefaults); }); teardown(async () => { disposeAll(_disposables); + + // Restore config + await updateConfig(testDocumentUri, oldConfig); + + return vscode.commands.executeCommand('workbench.action.closeAllEditors'); }); test('Should complete jsdoc inside single line comment', async () => { - await createTestEditor(testDocumentUri, - `/**$0 */`, - `function abcdef(x, y) { }`, - ); - - const document = await acceptFirstSuggestion(testDocumentUri, _disposables, { useLineRange: true}); - assert.strictEqual( - document.getText(), - joinLines( - `/**`, - ` *`, - ` * @param {*} x `, - ` * @param {*} y `, - ` */`, + await enumerateConfig(testDocumentUri, Config.insertMode, insertModesValues, async config => { + + const editor = await createTestEditor(testDocumentUri, + `/**$0 */`, `function abcdef(x, y) { }`, - )); + ); + + await acceptFirstSuggestion(testDocumentUri, _disposables); + + assertEditorContents(editor, + joinLines( + `/**`, + ` * `, + ` * @param x ${CURSOR}`, + ` * @param y `, + ` */`, + `function abcdef(x, y) { }`, + ), + `Config: ${config}`); + }); }); }); diff --git a/extensions/typescript-language-features/src/test/previewer.test.ts b/extensions/typescript-language-features/src/test/previewer.test.ts index 011187b2af4de..b92c001963102 100644 --- a/extensions/typescript-language-features/src/test/previewer.test.ts +++ b/extensions/typescript-language-features/src/test/previewer.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import 'mocha'; -import { tagsMarkdownPreview } from '../utils/previewer'; +import { tagsMarkdownPreview, markdownDocumentation } from '../utils/previewer'; suite('typescript.previewer', () => { test('Should ignore hyphens after a param tag', async () => { @@ -18,5 +18,51 @@ suite('typescript.previewer', () => { ]), '*@param* `a` — b'); }); + + test('Should parse url jsdoc @link', async () => { + assert.strictEqual( + markdownDocumentation('x {@link http://www.example.com/foo} y {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} z', []).value, + 'x [http://www.example.com/foo](http://www.example.com/foo) y [https://api.jquery.com/bind/#bind-eventType-eventData-handler](https://api.jquery.com/bind/#bind-eventType-eventData-handler) z'); + }); + + test('Should parse url jsdoc @link with text', async () => { + assert.strictEqual( + markdownDocumentation('x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z', []).value, + 'x [abc xyz](http://www.example.com/foo) y [b a z](http://www.example.com/bar) z'); + }); + + test('Should treat @linkcode jsdocs links as monospace', async () => { + assert.strictEqual( + markdownDocumentation('x {@linkcode http://www.example.com/foo} y {@linkplain http://www.example.com/bar} z', []).value, + 'x [`http://www.example.com/foo`](http://www.example.com/foo) y [http://www.example.com/bar](http://www.example.com/bar) z'); + }); + + test('Should parse url jsdoc @link in param tag', async () => { + assert.strictEqual( + tagsMarkdownPreview([ + { + name: 'param', + text: 'a x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z' + } + ]), + '*@param* `a` — x [abc xyz](http://www.example.com/foo) y [b a z](http://www.example.com/bar) z'); + }); + + test('Should ignore unclosed jsdocs @link', async () => { + assert.strictEqual( + markdownDocumentation('x {@link http://www.example.com/foo y {@link http://www.example.com/bar bar} z', []).value, + 'x {@link http://www.example.com/foo y [bar](http://www.example.com/bar) z'); + }); + + test('Should support non-ascii characters in parameter name (#90108)', async () => { + assert.strictEqual( + tagsMarkdownPreview([ + { + name: 'param', + text: 'parámetroConDiacríticos this will not' + } + ]), + '*@param* `parámetroConDiacríticos` — this will not'); + }); }); diff --git a/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts new file mode 100644 index 0000000000000..89689d57ae680 --- /dev/null +++ b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import 'mocha'; +import * as vscode from 'vscode'; +import { disposeAll } from '../utils/dispose'; +import { createTestEditor, wait } from './testUtils'; + + +type VsCodeConfiguration = { [key: string]: any }; + +async function updateConfig(newConfig: VsCodeConfiguration): Promise { + const oldConfig: VsCodeConfiguration = {}; + const config = vscode.workspace.getConfiguration(undefined); + for (const configKey of Object.keys(newConfig)) { + oldConfig[configKey] = config.get(configKey); + await new Promise((resolve, reject) => + config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) + .then(() => resolve(), reject)); + } + return oldConfig; +} + +namespace Config { + export const referencesCodeLens = 'typescript.referencesCodeLens.enabled'; +} + +suite('TypeScript References', () => { + const configDefaults: VsCodeConfiguration = Object.freeze({ + [Config.referencesCodeLens]: true, + }); + + const _disposables: vscode.Disposable[] = []; + let oldConfig: { [key: string]: any } = {}; + + setup(async () => { + await wait(100); + + // Save off config and apply defaults + oldConfig = await updateConfig(configDefaults); + }); + + teardown(async () => { + disposeAll(_disposables); + + // Restore config + await updateConfig(oldConfig); + + return vscode.commands.executeCommand('workbench.action.closeAllEditors'); + }); + + test('Should show on basic class', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test1.ts'); + await createTestEditor(testDocumentUri, + `class Foo {}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 1); + assert.strictEqual(codeLenses?.[0].range.start.line, 0); + }); + + test('Should show on basic class properties', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test2.ts'); + await createTestEditor(testDocumentUri, + `class Foo {`, + ` prop: number;`, + ` meth(): void {}`, + `}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 3); + assert.strictEqual(codeLenses?.[0].range.start.line, 0); + assert.strictEqual(codeLenses?.[1].range.start.line, 1); + assert.strictEqual(codeLenses?.[2].range.start.line, 2); + }); + + test('Should not show on const property', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test3.ts'); + await createTestEditor(testDocumentUri, + `const foo = {`, + ` prop: 1;`, + ` meth(): void {}`, + `}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 0); + }); + + test('Should not show duplicate references on ES5 class (https://github.com/microsoft/vscode/issues/90396)', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test3.js'); + await createTestEditor(testDocumentUri, + `function A() {`, + ` console.log("hi");`, + `}`, + `A.x = {};`, + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 1); + }); +}); + +function getCodeLenses(document: vscode.Uri): Thenable { + return vscode.commands.executeCommand('vscode.executeCodeLensProvider', document, 100); +} + diff --git a/extensions/typescript-language-features/src/test/server.test.ts b/extensions/typescript-language-features/src/test/server.test.ts index 651967fc12c02..6803701e67898 100644 --- a/extensions/typescript-language-features/src/test/server.test.ts +++ b/extensions/typescript-language-features/src/test/server.test.ts @@ -9,9 +9,9 @@ import * as stream from 'stream'; import { PipeRequestCanceller, TsServerProcess, ProcessBasedTsServer } from '../tsServer/server'; import { nulToken } from '../utils/cancellation'; import Logger from '../utils/logger'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import Tracer from '../utils/tracer'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; const NoopTelemetryReporter = new class implements TelemetryReporter { diff --git a/extensions/typescript-language-features/src/test/suggestTestHelpers.ts b/extensions/typescript-language-features/src/test/suggestTestHelpers.ts index 7c64a26ad5c1b..2a5f4368d74a8 100644 --- a/extensions/typescript-language-features/src/test/suggestTestHelpers.ts +++ b/extensions/typescript-language-features/src/test/suggestTestHelpers.ts @@ -7,23 +7,18 @@ import 'mocha'; import * as vscode from 'vscode'; import { wait } from './testUtils'; -export async function acceptFirstSuggestion(uri: vscode.Uri, _disposables: vscode.Disposable[], options?: { useLineRange?: boolean }) { +export async function acceptFirstSuggestion(uri: vscode.Uri, _disposables: vscode.Disposable[]) { const didChangeDocument = onChangedDocument(uri, _disposables); - const didSuggest = onDidSuggest(_disposables, options); await vscode.commands.executeCommand('editor.action.triggerSuggest'); - await didSuggest; - // TODO: depends on reverting fix for https://github.com/Microsoft/vscode/issues/64257 - // Make sure we have time to resolve the suggestion because `acceptSelectedSuggestion` doesn't - await wait(40); + await wait(1000); // Give time for suggestions to show await vscode.commands.executeCommand('acceptSelectedSuggestion'); - return await didChangeDocument; + return didChangeDocument; } export async function typeCommitCharacter(uri: vscode.Uri, character: string, _disposables: vscode.Disposable[]) { const didChangeDocument = onChangedDocument(uri, _disposables); - const didSuggest = onDidSuggest(_disposables); await vscode.commands.executeCommand('editor.action.triggerSuggest'); - await didSuggest; + await wait(1000); // Give time for suggestions to show await vscode.commands.executeCommand('type', { text: character }); return await didChangeDocument; } @@ -35,29 +30,3 @@ export function onChangedDocument(documentUri: vscode.Uri, disposables: vscode.D } }, undefined, disposables)); } - - -function onDidSuggest(disposables: vscode.Disposable[], options?: { useLineRange?: boolean }) { - return new Promise(resolve => - disposables.push(vscode.languages.registerCompletionItemProvider('typescript', new class implements vscode.CompletionItemProvider { - provideCompletionItems(doc: vscode.TextDocument, position: vscode.Position): vscode.ProviderResult { - // Return a fake item that will come first - const range = options && options.useLineRange - ? new vscode.Range(new vscode.Position(position.line, 0), position) - : doc.getWordRangeAtPosition(position.translate({ characterDelta: -1 })); - return [{ - label: '🦄', - insertText: doc.getText(range), - filterText: doc.getText(range), - preselect: true, - sortText: 'a', - range: range - }]; - } - async resolveCompletionItem(item: vscode.CompletionItem) { - await vscode.commands.executeCommand('selectNextSuggestion'); - resolve(); - return item; - } - }))); -} diff --git a/extensions/typescript-language-features/src/test/testUtils.ts b/extensions/typescript-language-features/src/test/testUtils.ts index 753814a99bd4b..7b2c95dcf1c58 100644 --- a/extensions/typescript-language-features/src/test/testUtils.ts +++ b/extensions/typescript-language-features/src/test/testUtils.ts @@ -3,10 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscode from 'vscode'; +import * as assert from 'assert'; import * as fs from 'fs'; import * as os from 'os'; import { join } from 'path'; +import * as vscode from 'vscode'; function rndName() { return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10); @@ -73,11 +74,62 @@ export const joinLines = (...args: string[]) => args.join('\n'); export async function createTestEditor(uri: vscode.Uri, ...lines: string[]) { const document = await vscode.workspace.openTextDocument(uri); - await vscode.window.showTextDocument(document); - const activeEditor = vscode.window.activeTextEditor; - if (!activeEditor) { - throw new Error('no active editor'); + const editor = await vscode.window.showTextDocument(document); + await editor.insertSnippet(new vscode.SnippetString(joinLines(...lines)), new vscode.Range(0, 0, 1000, 0)); + return editor; +} + +export function assertEditorContents(editor: vscode.TextEditor, expectedDocContent: string, message?: string): void { + const cursorIndex = expectedDocContent.indexOf(CURSOR); + + assert.strictEqual( + editor.document.getText(), + expectedDocContent.replace(CURSOR, ''), + message); + + if (cursorIndex >= 0) { + const expectedCursorPos = editor.document.positionAt(cursorIndex); + assert.deepEqual( + { line: editor.selection.active.line, character: editor.selection.active.line }, + { line: expectedCursorPos.line, character: expectedCursorPos.line }, + 'Cursor position' + ); + } +} + +export type VsCodeConfiguration = { [key: string]: any }; + +export async function updateConfig(documentUri: vscode.Uri, newConfig: VsCodeConfiguration): Promise { + const oldConfig: VsCodeConfiguration = {}; + const config = vscode.workspace.getConfiguration(undefined, documentUri); + for (const configKey of Object.keys(newConfig)) { + oldConfig[configKey] = config.get(configKey); + await new Promise((resolve, reject) => + config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) + .then(() => resolve(), reject)); } + return oldConfig; +} - await activeEditor.insertSnippet(new vscode.SnippetString(joinLines(...lines)), new vscode.Range(0, 0, 1000, 0)); +export const Config = Object.freeze({ + autoClosingBrackets: 'editor.autoClosingBrackets', + completeFunctionCalls: 'typescript.suggest.completeFunctionCalls', + insertMode: 'editor.suggest.insertMode', + snippetSuggestions: 'editor.snippetSuggestions', + suggestSelection: 'editor.suggestSelection', +} as const); + +export const insertModesValues = Object.freeze(['insert', 'replace']); + +export async function enumerateConfig( + documentUri: vscode.Uri, + configKey: string, + values: readonly string[], + f: (message: string) => Promise +): Promise { + for (const value of values) { + const newConfig = { [configKey]: value }; + await updateConfig(documentUri, newConfig); + await f(JSON.stringify(newConfig)); + } } diff --git a/extensions/typescript-language-features/src/tsServer/cachedResponse.ts b/extensions/typescript-language-features/src/tsServer/cachedResponse.ts index 2fb9b54228160..baa1a87a88ad2 100644 --- a/extensions/typescript-language-features/src/tsServer/cachedResponse.ts +++ b/extensions/typescript-language-features/src/tsServer/cachedResponse.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ServerResponse } from '../typescriptService'; type Resolve = () => Promise>; diff --git a/extensions/typescript-language-features/src/tsServer/callbackMap.ts b/extensions/typescript-language-features/src/tsServer/callbackMap.ts index 7f96de571598c..4e0ec375ddc2f 100644 --- a/extensions/typescript-language-features/src/tsServer/callbackMap.ts +++ b/extensions/typescript-language-features/src/tsServer/callbackMap.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ServerResponse } from '../typescriptService'; export interface CallbackItem { readonly onSuccess: (value: R) => void; readonly onError: (err: Error) => void; - readonly startTime: number; + readonly queuingStartTime: number; readonly isAsync: boolean; } @@ -48,4 +48,4 @@ export class CallbackMap { this._asyncCallbacks.delete(seq); } } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/tsServer/requestQueue.ts b/extensions/typescript-language-features/src/tsServer/requestQueue.ts index 33dceef83f207..4b75833a1e972 100644 --- a/extensions/typescript-language-features/src/tsServer/requestQueue.ts +++ b/extensions/typescript-language-features/src/tsServer/requestQueue.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; export enum RequestQueueingType { /** @@ -78,4 +78,4 @@ export class RequestQueue { arguments: args }; } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/tsServer/server.ts b/extensions/typescript-language-features/src/tsServer/server.ts index e4f9acd19759c..9eef0fc7b6208 100644 --- a/extensions/typescript-language-features/src/tsServer/server.ts +++ b/extensions/typescript-language-features/src/tsServer/server.ts @@ -6,10 +6,10 @@ import * as fs from 'fs'; import * as stream from 'stream'; import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ServerResponse, TypeScriptRequests } from '../typescriptService'; import { Disposable } from '../utils/dispose'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import Tracer from '../utils/tracer'; import { TypeScriptVersion } from '../utils/versionProvider'; import { Reader } from '../utils/wireProtocol'; @@ -60,7 +60,7 @@ export interface ITypeScriptServer { } export interface TsServerDelegate { - onFatalError(command: string): void; + onFatalError(command: string, error: Error): void; } export interface TsServerProcess { @@ -140,10 +140,10 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe const event = message as Proto.Event; if (event.event === 'requestCompleted') { const seq = (event as Proto.RequestCompletedEvent).body.request_seq; - const p = this._callbacks.fetch(seq); - if (p) { - this._tracer.traceRequestCompleted(this._serverId, 'requestCompleted', seq, p.startTime); - p.onSuccess(undefined); + const callback = this._callbacks.fetch(seq); + if (callback) { + this._tracer.traceRequestCompleted(this._serverId, 'requestCompleted', seq, callback); + callback.onSuccess(undefined); } } else { this._tracer.traceEvent(this._serverId, event); @@ -186,7 +186,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe return; } - this._tracer.traceResponse(this._serverId, response, callback.startTime); + this._tracer.traceResponse(this._serverId, response, callback); if (response.success) { callback.onSuccess(response); } else if (response.message === 'No content available.') { @@ -210,7 +210,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe let result: Promise> | undefined; if (executeInfo.expectsResult) { result = new Promise>((resolve, reject) => { - this._callbacks.add(request.seq, { onSuccess: resolve, onError: reject, startTime: Date.now(), isAsync: executeInfo.isAsync }, executeInfo.isAsync); + this._callbacks.add(request.seq, { onSuccess: resolve, onError: reject, queuingStartTime: Date.now(), isAsync: executeInfo.isAsync }, executeInfo.isAsync); if (executeInfo.token) { executeInfo.token.onCancellationRequested(() => { @@ -222,21 +222,13 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe if (!executeInfo.token || !executeInfo.token.isCancellationRequested) { /* __GDPR__ "languageServiceErrorResponse" : { - "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "message" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, - "stack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, - "errortext" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, "${include}": [ - "${TypeScriptCommonProperties}" + "${TypeScriptCommonProperties}", + "${TypeScriptRequestErrorProperties}" ] } */ - this._telemetryReporter.logTelemetry('languageServiceErrorResponse', { - command: err.serverCommand, - message: err.serverMessage || '', - stack: err.serverStack || '', - errortext: err.serverErrorText || '', - }); + this._telemetryReporter.logTelemetry('languageServiceErrorResponse', err.telemetry); } } @@ -305,22 +297,128 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe } +class RequestRouter { + + private static readonly sharedCommands = new Set([ + 'change', + 'close', + 'open', + 'updateOpen', + 'configure', + 'configurePlugin', + ]); + + constructor( + private readonly servers: ReadonlyArray<{ readonly server: ITypeScriptServer, readonly preferredCommands?: ReadonlySet }>, + private readonly delegate: TsServerDelegate, + ) { } + + public execute(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise> | undefined { + if (RequestRouter.sharedCommands.has(command)) { + // Dispatch shared commands to all server but only return from first one one + + const requestStates: RequestState.State[] = this.servers.map(() => RequestState.Unresolved); + + // Also make sure we never cancel requests to just one server + let token: vscode.CancellationToken | undefined = undefined; + if (executeInfo.token) { + const source = new vscode.CancellationTokenSource(); + executeInfo.token.onCancellationRequested(() => { + if (requestStates.some(state => state === RequestState.Resolved)) { + // Don't cancel. + // One of the servers completed this request so we don't want to leave the other + // in a different state. + return; + } + source.cancel(); + }); + token = source.token; + } + + let firstRequest: Promise> | undefined; + + for (let serverIndex = 0; serverIndex < this.servers.length; ++serverIndex) { + const server = this.servers[serverIndex].server; + + const request = server.executeImpl(command, args, { ...executeInfo, token }); + if (serverIndex === 0) { + firstRequest = request; + } + if (request) { + request + .then(result => { + requestStates[serverIndex] = RequestState.Resolved; + const erroredRequest = requestStates.find(state => state.type === RequestState.Type.Errored) as RequestState.Errored | undefined; + if (erroredRequest) { + // We've gone out of sync + this.delegate.onFatalError(command, erroredRequest.err); + } + return result; + }, err => { + requestStates[serverIndex] = new RequestState.Errored(err); + if (requestStates.some(state => state === RequestState.Resolved)) { + // We've gone out of sync + this.delegate.onFatalError(command, err); + } + throw err; + }); + } + } + + return firstRequest; + } + + for (const { preferredCommands, server } of this.servers) { + if (!preferredCommands || preferredCommands.has(command)) { + return server.executeImpl(command, args, executeInfo); + } + } + + throw new Error(`Could not find server for command: '${command}'`); + } +} + + export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServer { + + private static readonly syntaxCommands = new Set([ + 'navtree', + 'getOutliningSpans', + 'jsxClosingTag', + 'selectionRange', + 'format', + 'formatonkey', + 'docCommentTemplate', + ]); + + private readonly syntaxServer: ITypeScriptServer; + private readonly semanticServer: ITypeScriptServer; + private readonly router: RequestRouter; + public constructor( - private readonly syntaxServer: ITypeScriptServer, - private readonly semanticServer: ITypeScriptServer, - private readonly _delegate: TsServerDelegate, + servers: { syntax: ITypeScriptServer, semantic: ITypeScriptServer }, + delegate: TsServerDelegate, ) { super(); - this._register(syntaxServer.onEvent(e => this._onEvent.fire(e))); - this._register(semanticServer.onEvent(e => this._onEvent.fire(e))); + this.syntaxServer = servers.syntax; + this.semanticServer = servers.semantic; - this._register(semanticServer.onExit(e => { + this.router = new RequestRouter( + [ + { server: this.syntaxServer, preferredCommands: SyntaxRoutingTsServer.syntaxCommands }, + { server: this.semanticServer, preferredCommands: undefined /* gets all other commands */ } + ], + delegate); + + this._register(this.syntaxServer.onEvent(e => this._onEvent.fire(e))); + this._register(this.semanticServer.onEvent(e => this._onEvent.fire(e))); + + this._register(this.semanticServer.onExit(e => { this._onExit.fire(e); this.syntaxServer.kill(); })); - this._register(semanticServer.onError(e => this._onError.fire(e))); + this._register(this.semanticServer.onError(e => this._onError.fire(e))); } private readonly _onEvent = this._register(new vscode.EventEmitter()); @@ -341,95 +439,105 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ this.semanticServer.kill(); } - private static readonly syntaxCommands = new Set([ - 'navtree', - 'getOutliningSpans', - 'jsxClosingTag', - 'selectionRange', - 'format', - 'formatonkey', - 'docCommentTemplate', - ]); - private static readonly sharedCommands = new Set([ - 'change', - 'close', - 'open', - 'updateOpen', - 'configure', - 'configurePlugin', - ]); - public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: false, lowPriority?: boolean }): undefined; public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise>; public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise> | undefined { - if (SyntaxRoutingTsServer.syntaxCommands.has(command)) { - return this.syntaxServer.executeImpl(command, args, executeInfo); - } else if (SyntaxRoutingTsServer.sharedCommands.has(command)) { - // Dispatch to both server but only return from syntax one + return this.router.execute(command, args, executeInfo); + } +} - const enum RequestState { Unresolved, Resolved, Errored } - let syntaxRequestState = RequestState.Unresolved; - let semanticRequestState = RequestState.Unresolved; - // Also make sure we never cancel requests to just one server - let token: vscode.CancellationToken | undefined = undefined; - if (executeInfo.token) { - const source = new vscode.CancellationTokenSource(); - executeInfo.token.onCancellationRequested(() => { - if (syntaxRequestState !== RequestState.Unresolved && semanticRequestState === RequestState.Unresolved - || syntaxRequestState === RequestState.Unresolved && semanticRequestState !== RequestState.Unresolved - ) { - // Don't cancel. - // One of the servers completed this request so we don't want to leave the other - // in a different state - return; - } - source.cancel(); - }); - token = source.token; - } +export class GetErrRoutingTsServer extends Disposable implements ITypeScriptServer { - const semanticRequest = this.semanticServer.executeImpl(command, args, { ...executeInfo, token }); - if (semanticRequest) { - semanticRequest - .then(result => { - semanticRequestState = RequestState.Resolved; - if (syntaxRequestState === RequestState.Errored) { - // We've gone out of sync - this._delegate.onFatalError(command); - } - return result; - }, err => { - semanticRequestState = RequestState.Errored; - if (syntaxRequestState === RequestState.Resolved) { - // We've gone out of sync - this._delegate.onFatalError(command); - } - throw err; - }); + private static readonly diagnosticEvents = new Set([ + 'configFileDiag', + 'syntaxDiag', + 'semanticDiag', + 'suggestionDiag' + ]); + + private readonly getErrServer: ITypeScriptServer; + private readonly mainServer: ITypeScriptServer; + private readonly router: RequestRouter; + + public constructor( + servers: { getErr: ITypeScriptServer, primary: ITypeScriptServer }, + delegate: TsServerDelegate, + ) { + super(); + + this.getErrServer = servers.getErr; + this.mainServer = servers.primary; + + this.router = new RequestRouter( + [ + { server: this.getErrServer, preferredCommands: new Set(['geterr', 'geterrForProject']) }, + { server: this.mainServer, preferredCommands: undefined /* gets all other commands */ } + ], + delegate); + + this._register(this.getErrServer.onEvent(e => { + if (GetErrRoutingTsServer.diagnosticEvents.has(e.event)) { + this._onEvent.fire(e); } - const syntaxRequest = this.syntaxServer.executeImpl(command, args, { ...executeInfo, token }); - if (syntaxRequest) { - syntaxRequest - .then(result => { - syntaxRequestState = RequestState.Resolved; - if (semanticRequestState === RequestState.Errored) { - // We've gone out of sync - this._delegate.onFatalError(command); - } - return result; - }, err => { - syntaxRequestState = RequestState.Errored; - if (semanticRequestState === RequestState.Resolved) { - // We've gone out of sync - this._delegate.onFatalError(command); - } - throw err; - }); + // Ignore all other events + })); + this._register(this.mainServer.onEvent(e => { + if (!GetErrRoutingTsServer.diagnosticEvents.has(e.event)) { + this._onEvent.fire(e); } - return syntaxRequest; - } else { - return this.semanticServer.executeImpl(command, args, executeInfo); - } + // Ignore all other events + })); + + this._register(this.getErrServer.onError(e => this._onError.fire(e))); + this._register(this.mainServer.onError(e => this._onError.fire(e))); + + this._register(this.mainServer.onExit(e => { + this._onExit.fire(e); + this.getErrServer.kill(); + })); + } + + private readonly _onEvent = this._register(new vscode.EventEmitter()); + public readonly onEvent = this._onEvent.event; + + private readonly _onExit = this._register(new vscode.EventEmitter()); + public readonly onExit = this._onExit.event; + + private readonly _onError = this._register(new vscode.EventEmitter()); + public readonly onError = this._onError.event; + + public get onReaderError() { return this.mainServer.onReaderError; } + + public get tsServerLogFile() { return this.mainServer.tsServerLogFile; } + + public kill(): void { + this.getErrServer.kill(); + this.mainServer.kill(); + } + + public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: false, lowPriority?: boolean }): undefined; + public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise>; + public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise> | undefined { + return this.router.execute(command, args, executeInfo); } } + + +namespace RequestState { + export const enum Type { Unresolved, Resolved, Errored } + + export const Unresolved = { type: Type.Unresolved } as const; + + export const Resolved = { type: Type.Resolved } as const; + + export class Errored { + readonly type = Type.Errored; + + constructor( + public readonly err: Error + ) { } + } + + export type State = typeof Unresolved | typeof Resolved | Errored; +} diff --git a/extensions/typescript-language-features/src/tsServer/serverError.ts b/extensions/typescript-language-features/src/tsServer/serverError.ts index 7f58aa6b0f5a6..6f4c8f6bf35ae 100644 --- a/extensions/typescript-language-features/src/tsServer/serverError.ts +++ b/extensions/typescript-language-features/src/tsServer/serverError.ts @@ -3,10 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { escapeRegExp } from '../utils/regexp'; import { TypeScriptVersion } from '../utils/versionProvider'; + export class TypeScriptServerError extends Error { public static create( serverId: string, @@ -19,7 +20,7 @@ export class TypeScriptServerError extends Error { private constructor( serverId: string, - version: TypeScriptVersion, + public readonly version: TypeScriptVersion, private readonly response: Proto.Response, public readonly serverMessage: string | undefined, public readonly serverStack: string | undefined @@ -31,6 +32,23 @@ export class TypeScriptServerError extends Error { public get serverCommand() { return this.response.command; } + public get telemetry() { + /* __GDPR__FRAGMENT__ + "TypeScriptRequestErrorProperties" : { + "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "message" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, + "stack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, + "errortext" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" } + } + */ + return { + command: this.serverCommand, + message: this.serverMessage || '', + stack: this.serverStack || '', + errortext: this.serverErrorText || '', + } as const; + } + /** * Given a `errorText` from a tsserver request indicating failure in handling a request, * prepares a payload for telemetry-logging. diff --git a/extensions/typescript-language-features/src/tsServer/spawner.ts b/extensions/typescript-language-features/src/tsServer/spawner.ts index 171f204703eaf..89e4261fb054e 100644 --- a/extensions/typescript-language-features/src/tsServer/spawner.ts +++ b/extensions/typescript-language-features/src/tsServer/spawner.ts @@ -7,7 +7,7 @@ import * as child_process from 'child_process'; import * as path from 'path'; import * as stream from 'stream'; import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import API from '../utils/api'; import { TsServerLogLevel, TypeScriptServiceConfiguration } from '../utils/configuration'; import * as electron from '../utils/electron'; @@ -15,12 +15,17 @@ import LogDirectoryProvider from '../utils/logDirectoryProvider'; import Logger from '../utils/logger'; import { TypeScriptPluginPathsProvider } from '../utils/pluginPathsProvider'; import { PluginManager } from '../utils/plugins'; -import TelemetryReporter from '../utils/telemetry'; +import { TelemetryReporter } from '../utils/telemetry'; import Tracer from '../utils/tracer'; import { TypeScriptVersion, TypeScriptVersionProvider } from '../utils/versionProvider'; -import { ITypeScriptServer, PipeRequestCanceller, ProcessBasedTsServer, SyntaxRoutingTsServer, TsServerProcess, TsServerDelegate } from './server'; +import { ITypeScriptServer, PipeRequestCanceller, ProcessBasedTsServer, SyntaxRoutingTsServer, TsServerProcess, TsServerDelegate, GetErrRoutingTsServer } from './server'; -type ServerKind = 'main' | 'syntax' | 'semantic'; +const enum ServerKind { + Main = 'main', + Syntax = 'syntax', + Semantic = 'semantic', + Diagnostics = 'diagnostics' +} export class TypeScriptServerSpawner { public constructor( @@ -38,13 +43,24 @@ export class TypeScriptServerSpawner { pluginManager: PluginManager, delegate: TsServerDelegate, ): ITypeScriptServer { + let primaryServer: ITypeScriptServer; if (this.shouldUseSeparateSyntaxServer(version, configuration)) { - const syntaxServer = this.spawnTsServer('syntax', version, configuration, pluginManager); - const semanticServer = this.spawnTsServer('semantic', version, configuration, pluginManager); - return new SyntaxRoutingTsServer(syntaxServer, semanticServer, delegate); + primaryServer = new SyntaxRoutingTsServer({ + syntax: this.spawnTsServer(ServerKind.Syntax, version, configuration, pluginManager), + semantic: this.spawnTsServer(ServerKind.Semantic, version, configuration, pluginManager) + }, delegate); + } else { + primaryServer = this.spawnTsServer(ServerKind.Main, version, configuration, pluginManager); } - return this.spawnTsServer('main', version, configuration, pluginManager); + if (this.shouldUseSeparateDiagnosticsServer(configuration)) { + return new GetErrRoutingTsServer({ + getErr: this.spawnTsServer(ServerKind.Diagnostics, version, configuration, pluginManager), + primary: primaryServer, + }, delegate); + } + + return primaryServer; } private shouldUseSeparateSyntaxServer( @@ -54,6 +70,12 @@ export class TypeScriptServerSpawner { return configuration.useSeparateSyntaxServer && !!version.apiVersion && version.apiVersion.gte(API.v340); } + private shouldUseSeparateDiagnosticsServer( + configuration: TypeScriptServiceConfiguration, + ): boolean { + return configuration.enableProjectDiagnostics; + } + private spawnTsServer( kind: ServerKind, version: TypeScriptVersion, @@ -107,7 +129,7 @@ export class TypeScriptServerSpawner { const args: string[] = []; let tsServerLogFile: string | undefined; - if (kind === 'syntax') { + if (kind === ServerKind.Syntax) { args.push('--syntaxOnly'); } @@ -117,11 +139,11 @@ export class TypeScriptServerSpawner { args.push('--useSingleInferredProject'); } - if (configuration.disableAutomaticTypeAcquisition || kind === 'syntax') { + if (configuration.disableAutomaticTypeAcquisition || kind === ServerKind.Syntax || kind === ServerKind.Diagnostics) { args.push('--disableAutomaticTypingAcquisition'); } - if (kind !== 'syntax') { + if (kind === ServerKind.Semantic || kind === ServerKind.Main) { args.push('--enableTelemetry'); } diff --git a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts index c0c1d6edc172d..e427aa59216fa 100644 --- a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts +++ b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts @@ -55,18 +55,6 @@ export default class TypeScriptServiceClientHost extends Disposable { onCompletionAccepted: (item: vscode.CompletionItem) => void, ) { super(); - const handleProjectCreateOrDelete = () => { - this.triggerAllDiagnostics(); - }; - const handleProjectChange = () => { - setTimeout(() => { - this.triggerAllDiagnostics(); - }, 1500); - }; - const configFileWatcher = this._register(vscode.workspace.createFileSystemWatcher('**/[tj]sconfig.json')); - configFileWatcher.onDidCreate(handleProjectCreateOrDelete, this, this._disposables); - configFileWatcher.onDidDelete(handleProjectCreateOrDelete, this, this._disposables); - configFileWatcher.onDidChange(handleProjectChange, this, this._disposables); const allModeIds = this.getAllModeIds(descriptions, pluginManager); this.client = this._register(new TypeScriptServiceClient( @@ -182,8 +170,6 @@ export default class TypeScriptServiceClientHost extends Disposable { private populateService(): void { this.fileConfigurationManager.reset(); - this.client.bufferSyncSupport.reset(); - this.client.bufferSyncSupport.requestAllDiagnostics(); // See https://github.com/Microsoft/TypeScript/issues/5530 vscode.workspace.saveAll(false).then(() => { diff --git a/extensions/typescript-language-features/src/typescriptService.ts b/extensions/typescript-language-features/src/typescriptService.ts index 3b5a139cd0af2..51e5cab5c5b3c 100644 --- a/extensions/typescript-language-features/src/typescriptService.ts +++ b/extensions/typescript-language-features/src/typescriptService.ts @@ -58,6 +58,9 @@ interface StandardTsServerRequests { 'signatureHelp': [Proto.SignatureHelpRequestArgs, Proto.SignatureHelpResponse]; 'typeDefinition': [Proto.FileLocationRequestArgs, Proto.TypeDefinitionResponse]; 'updateOpen': [Proto.UpdateOpenRequestArgs, Proto.Response]; + 'prepareCallHierarchy': [Proto.FileLocationRequestArgs, Proto.PrepareCallHierarchyResponse]; + 'provideCallHierarchyIncomingCalls': [Proto.FileLocationRequestArgs, Proto.ProvideCallHierarchyIncomingCallsResponse]; + 'provideCallHierarchyOutgoingCalls': [Proto.FileLocationRequestArgs, Proto.ProvideCallHierarchyOutgoingCallsResponse]; } interface NoResponseTsServerRequests { @@ -71,6 +74,7 @@ interface NoResponseTsServerRequests { interface AsyncTsServerRequests { 'geterr': [Proto.GeterrRequestArgs, Proto.Response]; + 'geterrForProject': [Proto.GeterrForProjectRequestArgs, Proto.Response]; } export type TypeScriptRequests = StandardTsServerRequests & NoResponseTsServerRequests & AsyncTsServerRequests; @@ -134,7 +138,11 @@ export interface ITypeScriptServiceClient { args: NoResponseTsServerRequests[K][0] ): void; - executeAsync(command: 'geterr', args: Proto.GeterrRequestArgs, token: vscode.CancellationToken): Promise>; + executeAsync( + command: K, + args: AsyncTsServerRequests[K][0], + token: vscode.CancellationToken + ): Promise>; /** * Cancel on going geterr requests and re-queue them after `f` has been evaluated. diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index 51bf7d9568dc9..6be28453e0e7f 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -11,7 +11,9 @@ import BufferSyncSupport from './features/bufferSyncSupport'; import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics'; import * as Proto from './protocol'; import { ITypeScriptServer } from './tsServer/server'; -import { ITypeScriptServiceClient, ServerResponse, TypeScriptRequests, ExecConfig } from './typescriptService'; +import { TypeScriptServerError } from './tsServer/serverError'; +import { TypeScriptServerSpawner } from './tsServer/spawner'; +import { ExecConfig, ITypeScriptServiceClient, ServerResponse, TypeScriptRequests } from './typescriptService'; import API from './utils/api'; import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration'; import { Disposable } from './utils/dispose'; @@ -20,12 +22,11 @@ import LogDirectoryProvider from './utils/logDirectoryProvider'; import Logger from './utils/logger'; import { TypeScriptPluginPathsProvider } from './utils/pluginPathsProvider'; import { PluginManager } from './utils/plugins'; -import TelemetryReporter, { VSCodeTelemetryReporter } from './utils/telemetry'; +import { TelemetryReporter, VSCodeTelemetryReporter, TelemetryProperties } from './utils/telemetry'; import Tracer from './utils/tracer'; -import { inferredProjectConfig } from './utils/tsconfig'; +import { inferredProjectCompilerOptions } from './utils/tsconfig'; import { TypeScriptVersionPicker } from './utils/versionPicker'; import { TypeScriptVersion, TypeScriptVersionProvider } from './utils/versionProvider'; -import { TypeScriptServerSpawner } from './tsServer/spawner'; const localize = nls.loadMessageBundle(); @@ -51,6 +52,7 @@ namespace ServerState { export class Running { readonly type = Type.Running; + constructor( public readonly server: ITypeScriptServer, @@ -67,6 +69,14 @@ namespace ServerState { ) { } public readonly toCancelOnResourceChange = new Set(); + + updateTsserverVersion(tsserverVersion: string) { + this.tsserverVersion = tsserverVersion; + } + + updateLangaugeServiceEnabled(enabled: boolean) { + this.langaugeServiceEnabled = enabled; + } } export class Errored { @@ -82,7 +92,8 @@ namespace ServerState { export default class TypeScriptServiceClient extends Disposable implements ITypeScriptServiceClient { private static readonly WALK_THROUGH_SNIPPET_SCHEME_COLON = `${fileSchemes.walkThroughSnippet}:`; - private pathSeparator: string; + private readonly pathSeparator: string; + private readonly inMemoryResourcePrefix = '^'; private _onReady?: { promise: Promise; resolve: () => void; reject: () => void; }; private _configuration: TypeScriptServiceConfiguration; @@ -110,13 +121,13 @@ export default class TypeScriptServiceClient extends Disposable implements IType private readonly onDidChangeTypeScriptVersion: (version: TypeScriptVersion) => void, public readonly pluginManager: PluginManager, private readonly logDirectoryProvider: LogDirectoryProvider, - allModeIds: string[] + allModeIds: readonly string[] ) { super(); this.pathSeparator = path.sep; this.lastStart = Date.now(); - // tslint:disable-next-line: no-var-keyword + // eslint-disable-next-line no-var var p = new Promise((resolve, reject) => { this._onReady = { promise: p, resolve, reject }; }); @@ -171,7 +182,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType return this.serverState.tsserverVersion; } } - return this.apiVersion.version; + return this.apiVersion.fullVersionString; })); this.typescriptServerSpawner = new TypeScriptServerSpawner(this.versionProvider, this.logDirectoryProvider, this.pluginPathsProvider, this.logger, this.telemetryReporter, this.tracer); @@ -269,7 +280,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType this.logger.error(message, data); } - private logTelemetry(eventName: string, properties?: { readonly [prop: string]: string }) { + private logTelemetry(eventName: string, properties?: TelemetryProperties) { this.telemetryReporter.logTelemetry(eventName, properties); } @@ -313,7 +324,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType this.onDidChangeTypeScriptVersion(currentVersion); let mytoken = ++this.token; const handle = this.typescriptServerSpawner.spawn(currentVersion, this.configuration, this.pluginManager, { - onFatalError: (command) => this.fatalError(command), + onFatalError: (command, err) => this.fatalError(command, err), }); this.serverState = new ServerState.Running(handle, apiVersion, undefined, true); this.lastStart = Date.now(); @@ -403,15 +414,14 @@ export default class TypeScriptServiceClient extends Disposable implements IType } public onVersionStatusClicked(): Thenable { - return this.showVersionPicker(false); + return this.showVersionPicker(); } - private showVersionPicker(firstRun: boolean): Thenable { - return this.versionPicker.show(firstRun).then(change => { - if (firstRun || !change.newVersion || !change.oldVersion || change.oldVersion.path === change.newVersion.path) { - return; + private showVersionPicker(): Thenable { + return this.versionPicker.show().then(change => { + if (change.newVersion && change.oldVersion && change.oldVersion.eq(change.newVersion)) { + this.restartTsServer(); } - this.restartTsServer(); }); } @@ -464,17 +474,26 @@ export default class TypeScriptServiceClient extends Disposable implements IType } private serviceStarted(resendModels: boolean): void { + this.bufferSyncSupport.reset(); + + const watchOptions = this.apiVersion.gte(API.v380) + ? vscode.workspace.getConfiguration('typescript').get('tsserver.watchOptions') + : undefined; + const configureOptions: Proto.ConfigureRequestArguments = { hostInfo: 'vscode', preferences: { providePrefixAndSuffixTextForRename: true, allowRenameOfImportPath: true, - } + }, + watchOptions }; this.executeWithoutWaitingForResponse('configure', configureOptions); this.setCompilerOptionsForInferredProjects(this._configuration); if (resendModels) { this._onResendModelsRequested.fire(); + this.bufferSyncSupport.reinitialize(); + this.bufferSyncSupport.requestAllDiagnostics(); } // Reconfigure any plugins @@ -492,7 +511,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType private getCompilerOptionsForInferredProjects(configuration: TypeScriptServiceConfiguration): Proto.ExternalProjectCompilerOptions { return { - ...inferredProjectConfig(configuration), + ...inferredProjectCompilerOptions(true, configuration), allowJs: true, allowSyntheticDefaultImports: true, allowNonTsExtensions: true, @@ -510,7 +529,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType id: MessageAction; } + const previousState = this.serverState; this.serverState = ServerState.None; + if (restart) { const diff = Date.now() - this.lastStart; this.numberRestarts++; @@ -546,8 +567,11 @@ export default class TypeScriptServiceClient extends Disposable implements IType } if (prompt) { prompt.then(item => { - if (item && item.id === MessageAction.reportIssue) { - return vscode.commands.executeCommand('workbench.action.reportIssues'); + if (item?.id === MessageAction.reportIssue) { + const args = previousState.type === ServerState.Type.Errored && previousState.error instanceof TypeScriptServerError + ? getReportIssueArgsForError(previousState.error) + : undefined; + return vscode.commands.executeCommand('workbench.action.openIssueReporter', args); } return undefined; }); @@ -570,11 +594,15 @@ export default class TypeScriptServiceClient extends Disposable implements IType return undefined; } - const result = resource.fsPath; + let result = resource.fsPath; if (!result) { return undefined; } + if (resource.scheme === fileSchemes.file) { + result = path.normalize(result); + } + // Both \ and / must be escaped in regular expressions return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/'); } @@ -591,23 +619,18 @@ export default class TypeScriptServiceClient extends Disposable implements IType return this.toPath(document.uri) || undefined; } - private get inMemoryResourcePrefix(): string { - return this.apiVersion.gte(API.v270) ? '^' : ''; - } - public toResource(filepath: string): vscode.Uri { if (filepath.startsWith(TypeScriptServiceClient.WALK_THROUGH_SNIPPET_SCHEME_COLON) || (filepath.startsWith(fileSchemes.untitled + ':')) ) { let resource = vscode.Uri.parse(filepath); - if (this.inMemoryResourcePrefix) { - const dirName = path.dirname(resource.path); - const fileName = path.basename(resource.path); - if (fileName.startsWith(this.inMemoryResourcePrefix)) { - resource = resource.with({ - path: path.posix.join(dirName, fileName.slice(this.inMemoryResourcePrefix.length)) - }); - } + const dirName = path.dirname(resource.path); + const fileName = path.basename(resource.path); + if (fileName.startsWith(this.inMemoryResourcePrefix)) { + resource = resource.with({ + path: path.posix.join(dirName, fileName.slice(this.inMemoryResourcePrefix.length)) + }); } + return this.bufferSyncSupport.toVsCodeResource(resource); } @@ -615,7 +638,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType } public getWorkspaceRootForResource(resource: vscode.Uri): string | undefined { - const roots = vscode.workspace.workspaceFolders; + const roots = vscode.workspace.workspaceFolders ? Array.from(vscode.workspace.workspaceFolders) : undefined; if (!roots || !roots.length) { return undefined; } @@ -666,7 +689,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType } if (config?.nonRecoverable) { - execution.catch(() => this.fatalError(command)); + execution.catch(err => this.fatalError(command, err)); } return execution; @@ -700,19 +723,28 @@ export default class TypeScriptServiceClient extends Disposable implements IType return this.bufferSyncSupport.interuptGetErr(f); } - private fatalError(command: string): void { + private fatalError(command: string, error: unknown): void { /* __GDPR__ "fatalError" : { - "${include}": [ "${TypeScriptCommonProperties}" ], + "${include}": [ + "${TypeScriptCommonProperties}", + "${TypeScriptRequestErrorProperties}" + ], "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } } */ - this.logTelemetry('fatalError', { command }); + this.logTelemetry('fatalError', { command, ...(error instanceof TypeScriptServerError ? error.telemetry : {}) }); console.error(`A non-recoverable error occured while executing tsserver command: ${command}`); + if (error instanceof TypeScriptServerError && error.serverErrorText) { + console.error(error.serverErrorText); + } if (this.serverState.type === ServerState.Type.Running) { this.info('Killing TS Server'); this.serverState.server.kill(); + if (error instanceof TypeScriptServerError) { + this.serverState = new ServerState.Errored(error); + } } } @@ -748,10 +780,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType { const body = (event as Proto.ProjectLanguageServiceStateEvent).body!; if (this.serverState.type === ServerState.Type.Running) { - this.serverState = { - ...this.serverState, - langaugeServiceEnabled: body.languageServiceEnabled, - }; + this.serverState.updateLangaugeServiceEnabled(body.languageServiceEnabled); } this._onProjectLanguageServiceStateChanged.fire(body); break; @@ -820,10 +849,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType } if (telemetryData.telemetryEventName === 'projectInfo') { if (this.serverState.type === ServerState.Type.Running) { - this.serverState = { - ...this.serverState, - tsserverVersion: properties['version'] - }; + this.serverState.updateTsserverVersion(properties['version']); } } @@ -848,6 +874,32 @@ export default class TypeScriptServiceClient extends Disposable implements IType } } +function getReportIssueArgsForError(error: TypeScriptServerError): { issueTitle: string, issueBody: string } | undefined { + if (!error.serverStack || !error.serverMessage) { + return undefined; + } + + // Note these strings are intentionally not localized + // as we want users to file issues in english + return { + issueTitle: `TS Server fatal error: ${error.serverMessage}`, + + issueBody: `**TypeScript Version:** ${error.version.apiVersion?.fullVersionString} + +**Steps to reproduce crash** + +1. +2. +3. + +**TS Server Error Stack** + +\`\`\` +${error.serverStack} +\`\`\``, + }; +} + function getDignosticsKind(event: Proto.Event) { switch (event.event) { case 'syntaxDiag': return DiagnosticKind.Syntax; diff --git a/extensions/typescript-language-features/src/typings/ref.d.ts b/extensions/typescript-language-features/src/typings/ref.d.ts index c9849d48e083f..43a9cadf25022 100644 --- a/extensions/typescript-language-features/src/typings/ref.d.ts +++ b/extensions/typescript-language-features/src/typings/ref.d.ts @@ -3,5 +3,4 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/// /// diff --git a/extensions/typescript-language-features/src/utils/api.ts b/extensions/typescript-language-features/src/utils/api.ts index c30bee16c7e1c..25be4b5e5161c 100644 --- a/extensions/typescript-language-features/src/utils/api.ts +++ b/extensions/typescript-language-features/src/utils/api.ts @@ -10,7 +10,7 @@ const localize = nls.loadMessageBundle(); export default class API { private static fromSimpleString(value: string): API { - return new API(value, value); + return new API(value, value, value); } public static readonly defaultVersion = API.fromSimpleString('1.0.0'); @@ -31,11 +31,13 @@ export default class API { public static readonly v340 = API.fromSimpleString('3.4.0'); public static readonly v345 = API.fromSimpleString('3.4.5'); public static readonly v350 = API.fromSimpleString('3.5.0'); + public static readonly v380 = API.fromSimpleString('3.8.0'); + public static readonly v381 = API.fromSimpleString('3.8.1'); public static fromVersionString(versionString: string): API { let version = semver.valid(versionString); if (!version) { - return new API(localize('invalidVersion', 'invalid version'), '1.0.0'); + return new API(localize('invalidVersion', 'invalid version'), '1.0.0', '1.0.0'); } // Cut off any prerelease tag since we sometimes consume those on purpose. @@ -43,14 +45,30 @@ export default class API { if (index >= 0) { version = version.substr(0, index); } - return new API(versionString, version); + return new API(versionString, version, versionString); } private constructor( + /** + * Human readable string for the current version. Displayed in the UI + */ public readonly displayName: string, - public readonly version: string + + /** + * Semver version, e.g. '3.9.0' + */ + public readonly version: string, + + /** + * Full version string including pre-release tags, e.g. '3.9.0-beta' + */ + public readonly fullVersionString: string, ) { } + public eq(other: API): boolean { + return semver.eq(this.version, other.version); + } + public gte(other: API): boolean { return semver.gte(this.version, other.version); } diff --git a/extensions/typescript-language-features/src/utils/cancellation.ts b/extensions/typescript-language-features/src/utils/cancellation.ts index 10933baa9393d..72672663ad275 100644 --- a/extensions/typescript-language-features/src/utils/cancellation.ts +++ b/extensions/typescript-language-features/src/utils/cancellation.ts @@ -5,6 +5,9 @@ import * as vscode from 'vscode'; -const nulTokenSource = new vscode.CancellationTokenSource(); +const noopDisposable = vscode.Disposable.from(); -export const nulToken = nulTokenSource.token; \ No newline at end of file +export const nulToken: vscode.CancellationToken = { + isCancellationRequested: false, + onCancellationRequested: () => noopDisposable +}; diff --git a/extensions/typescript-language-features/src/utils/codeAction.ts b/extensions/typescript-language-features/src/utils/codeAction.ts index c45379e611ae4..df345e3351771 100644 --- a/extensions/typescript-language-features/src/utils/codeAction.ts +++ b/extensions/typescript-language-features/src/utils/codeAction.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { ITypeScriptServiceClient } from '../typescriptService'; import * as typeConverters from './typeConverters'; @@ -42,4 +42,4 @@ export async function applyCodeActionCommands( } } return true; -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/utils/configuration.ts b/extensions/typescript-language-features/src/utils/configuration.ts index 54c3a19b00141..25315feab3cb2 100644 --- a/extensions/typescript-language-features/src/utils/configuration.ts +++ b/extensions/typescript-language-features/src/utils/configuration.ts @@ -55,6 +55,7 @@ export class TypeScriptServiceConfiguration { public readonly experimentalDecorators: boolean; public readonly disableAutomaticTypeAcquisition: boolean; public readonly useSeparateSyntaxServer: boolean; + public readonly enableProjectDiagnostics: boolean; public readonly maxTsServerMemory: number; public static loadFromWorkspace(): TypeScriptServiceConfiguration { @@ -74,6 +75,7 @@ export class TypeScriptServiceConfiguration { this.experimentalDecorators = TypeScriptServiceConfiguration.readExperimentalDecorators(configuration); this.disableAutomaticTypeAcquisition = TypeScriptServiceConfiguration.readDisableAutomaticTypeAcquisition(configuration); this.useSeparateSyntaxServer = TypeScriptServiceConfiguration.readUseSeparateSyntaxServer(configuration); + this.enableProjectDiagnostics = TypeScriptServiceConfiguration.readEnableProjectDiagnostics(configuration); this.maxTsServerMemory = TypeScriptServiceConfiguration.readMaxTsServerMemory(configuration); } @@ -88,6 +90,7 @@ export class TypeScriptServiceConfiguration { && this.disableAutomaticTypeAcquisition === other.disableAutomaticTypeAcquisition && arrays.equals(this.tsServerPluginPaths, other.tsServerPluginPaths) && this.useSeparateSyntaxServer === other.useSeparateSyntaxServer + && this.enableProjectDiagnostics === other.enableProjectDiagnostics && this.maxTsServerMemory === other.maxTsServerMemory; } @@ -150,6 +153,10 @@ export class TypeScriptServiceConfiguration { return configuration.get('typescript.tsserver.useSeparateSyntaxServer', true); } + private static readEnableProjectDiagnostics(configuration: vscode.WorkspaceConfiguration): boolean { + return configuration.get('typescript.tsserver.experimental.enableProjectDiagnostics', false); + } + private static readMaxTsServerMemory(configuration: vscode.WorkspaceConfiguration): number { const defaultMaxMemory = 3072; const minimumMaxMemory = 128; diff --git a/extensions/typescript-language-features/src/utils/logger.ts b/extensions/typescript-language-features/src/utils/logger.ts index 991e9d52be373..18317e58e0051 100644 --- a/extensions/typescript-language-features/src/utils/logger.ts +++ b/extensions/typescript-language-features/src/utils/logger.ts @@ -41,9 +41,20 @@ export default class Logger { } public logLevel(level: LogLevel, message: string, data?: any): void { - this.output.appendLine(`[${level} - ${(new Date().toLocaleTimeString())}] ${message}`); + this.output.appendLine(`[${level} - ${this.now()}] ${message}`); if (data) { this.output.appendLine(this.data2String(data)); } } -} \ No newline at end of file + + private now(): string { + const now = new Date(); + return padLeft(now.getUTCHours() + '', 2, '0') + + ':' + padLeft(now.getMinutes() + '', 2, '0') + + ':' + padLeft(now.getUTCSeconds() + '', 2, '0') + '.' + now.getMilliseconds(); + } +} + +function padLeft(s: string, n: number, pad = ' ') { + return pad.repeat(Math.max(0, n - s.length)) + s; +} diff --git a/extensions/typescript-language-features/src/utils/previewer.ts b/extensions/typescript-language-features/src/utils/previewer.ts index 5ad230d662e0e..3d059dca331ef 100644 --- a/extensions/typescript-language-features/src/utils/previewer.ts +++ b/extensions/typescript-language-features/src/utils/previewer.ts @@ -4,7 +4,25 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; + +function replaceLinks(text: string): string { + return text + // Http(s) links + .replace(/\{@(link|linkplain|linkcode) (https?:\/\/[^ |}]+?)(?:[| ]([^{}\n]+?))?\}/gi, (_, tag: string, link: string, text?: string) => { + switch (tag) { + case 'linkcode': + return `[\`${text ? text.trim() : link}\`](${link})`; + + default: + return `[${text ? text.trim() : link}](${link})`; + } + }); +} + +function processInlineTags(text: string): string { + return replaceLinks(text); +} function getTagBodyText(tag: Proto.JSDocTagInfo): string | undefined { if (!tag.text) { @@ -28,12 +46,20 @@ function getTagBodyText(tag: Proto.JSDocTagInfo): string | undefined { } else { return makeCodeblock(tag.text); } + case 'author': + // fix obsucated email address, #80898 + const emailMatch = tag.text.match(/(.+)\s<([-.\w]+@[-.\w]+)>/); + if (emailMatch === null) { + return tag.text; + } else { + return `${emailMatch[1]} ${emailMatch[2]}`; + } case 'default': return makeCodeblock(tag.text); } - return tag.text; + return processInlineTags(tag.text); } function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined { @@ -42,15 +68,15 @@ function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined { case 'extends': case 'param': case 'template': - const body = (tag.text || '').split(/^([\w\.]+)\s*-?\s*/); - if (body && body.length === 3) { + const body = (tag.text || '').split(/^(\S+)\s*-?\s*/); + if (body?.length === 3) { const param = body[1]; const doc = body[2]; const label = `*@${tag.name}* \`${param}\``; if (!doc) { return label; } - return label + (doc.match(/\r\n|\n/g) ? ' \n' + doc : ` — ${doc}`); + return label + (doc.match(/\r\n|\n/g) ? ' \n' + processInlineTags(doc) : ` — ${processInlineTags(doc)}`); } } @@ -63,21 +89,19 @@ function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined { return label + (text.match(/\r\n|\n/g) ? ' \n' + text : ` — ${text}`); } -export function plain(parts: Proto.SymbolDisplayPart[]): string { - if (!parts) { - return ''; - } - return parts.map(part => part.text).join(''); +export function plain(parts: Proto.SymbolDisplayPart[] | string): string { + return processInlineTags( + typeof parts === 'string' + ? parts + : parts.map(part => part.text).join('')); } export function tagsMarkdownPreview(tags: Proto.JSDocTagInfo[]): string { - return (tags || []) - .map(getTagDocumentation) - .join(' \n\n'); + return tags.map(getTagDocumentation).join(' \n\n'); } export function markdownDocumentation( - documentation: Proto.SymbolDisplayPart[], + documentation: Proto.SymbolDisplayPart[] | string, tags: Proto.JSDocTagInfo[] ): vscode.MarkdownString { const out = new vscode.MarkdownString(); @@ -87,7 +111,7 @@ export function markdownDocumentation( export function addMarkdownDocumentation( out: vscode.MarkdownString, - documentation: Proto.SymbolDisplayPart[] | undefined, + documentation: Proto.SymbolDisplayPart[] | string | undefined, tags: Proto.JSDocTagInfo[] | undefined ): vscode.MarkdownString { if (documentation) { diff --git a/extensions/typescript-language-features/src/utils/projectStatus.ts b/extensions/typescript-language-features/src/utils/projectStatus.ts index 15aa72a80d09c..b9a3b2328c7bf 100644 --- a/extensions/typescript-language-features/src/utils/projectStatus.ts +++ b/extensions/typescript-language-features/src/utils/projectStatus.ts @@ -6,7 +6,7 @@ import * as vscode from 'vscode'; import { loadMessageBundle } from 'vscode-nls'; import { ITypeScriptServiceClient } from '../typescriptService'; -import TelemetryReporter from './telemetry'; +import { TelemetryReporter } from './telemetry'; import { isImplicitProjectConfigFile, openOrCreateConfigFile } from './tsconfig'; const localize = loadMessageBundle(); diff --git a/extensions/typescript-language-features/src/utils/resourceMap.ts b/extensions/typescript-language-features/src/utils/resourceMap.ts index a10fbd91636a2..e942fae458354 100644 --- a/extensions/typescript-language-features/src/utils/resourceMap.ts +++ b/extensions/typescript-language-features/src/utils/resourceMap.ts @@ -101,5 +101,5 @@ export class ResourceMap { } export function isWindowsPath(path: string): boolean { - return /^[a-zA-Z]:\\/.test(path); + return /^[a-zA-Z]:[\/\\]/.test(path); } diff --git a/extensions/typescript-language-features/src/utils/snippetForFunctionCall.ts b/extensions/typescript-language-features/src/utils/snippetForFunctionCall.ts index fbf2868d101eb..6faf19eff48ad 100644 --- a/extensions/typescript-language-features/src/utils/snippetForFunctionCall.ts +++ b/extensions/typescript-language-features/src/utils/snippetForFunctionCall.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import * as PConst from '../protocol.const'; export function snippetForFunctionCall( diff --git a/extensions/typescript-language-features/src/utils/surveyor.ts b/extensions/typescript-language-features/src/utils/surveyor.ts deleted file mode 100644 index a98e84f7c3351..0000000000000 --- a/extensions/typescript-language-features/src/utils/surveyor.ts +++ /dev/null @@ -1,214 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as vscode from 'vscode'; -import * as nls from 'vscode-nls'; -import TypeScriptServiceClient from '../typescriptServiceClient'; -import { Disposable } from './dispose'; -import { memoize } from './memoize'; - -const localize = nls.loadMessageBundle(); - -interface SurveyData { - /** - * Internal id of the survey. Comes from TypeScript. - */ - readonly id: string; - - /** - * Text displayed to the user when survey is triggered. - */ - readonly prompt: string; - - /** - * Number of times to trigger with `surveyReady` before showing the survey. - * - * This is cumulative and shared across workspaces. - */ - readonly globalTriggerThreshold: number; - - /** - * Survey link. - */ - readonly url: vscode.Uri; - - /** - * Milliseconds to wait after 'Remind later' is chosen before trying to prompt again. - */ - readonly remindLaterDelayInMilliseconds: number; -} - -const allSurveys: ReadonlyArray = [ - { - id: 'checkJs', - prompt: localize('survey.checkJs.prompt', "Help improve VS Code's support for [checkJs](https://code.visualstudio.com/Docs/languages/javascript#_type-checking) in JavaScript! Since you have been using this feature, would you consider taking a short survey about your experience?"), - globalTriggerThreshold: 10, - url: vscode.Uri.parse('https://www.surveymonkey.com/r/FH8PZQ3'), - remindLaterDelayInMilliseconds: 3 * 24 * 60 * 60 * 1000 // 3 days - } -]; - -class Survey { - - private _hasShownInThisSession = false; - - public constructor( - private readonly data: SurveyData, - private readonly memento: vscode.Memento - ) { } - - public get id(): string { return this.data.id; } - - public get prompt(): string { return this.data.prompt; } - - public get isActive(): boolean { - return !this._hasShownInThisSession && !this.memento.get(this.isCompletedMementoKey); - } - - public open(): void { - this.markComplete(); - vscode.commands.executeCommand('vscode.open', this.data.url); - } - - public remindLater(): void { - // Make sure we don't show again in this session (but don't persist as completed) - this._hasShownInThisSession = true; - - // And save off prompt time. - this.memento.update(this.lastPromptTimeMementoKey, Date.now()); - } - - public trigger(): boolean { - const triggerCount = this.triggerCount + 1; - this.memento.update(this.triggerCountMementoKey, triggerCount); - if (triggerCount >= this.data.globalTriggerThreshold) { - const lastPromptTime = this.memento.get(this.lastPromptTimeMementoKey); - if (!lastPromptTime || isNaN(+lastPromptTime)) { - return true; - } - return (lastPromptTime + this.data.remindLaterDelayInMilliseconds < Date.now()); - } - return false; - } - - public willShow() { - this._hasShownInThisSession = true; - } - - public markComplete() { - this._hasShownInThisSession = true; - this.memento.update(this.isCompletedMementoKey, true); - } - - private get triggerCount(): number { - const count = this.memento.get(this.triggerCountMementoKey); - return !count || isNaN(+count) ? 0 : +count; - } - - private getMementoKey(part: string): string { - return `survey.v0.${this.id}.${part}`; - } - - private get isCompletedMementoKey(): string { - return this.getMementoKey('isComplete'); - } - - private get lastPromptTimeMementoKey(): string { - return this.getMementoKey('lastPromptTime'); - } - - private get triggerCountMementoKey(): string { - return this.getMementoKey('globalTriggerCount'); - } -} - -export class Surveyor extends Disposable { - - public constructor( - private readonly memento: vscode.Memento, - serviceClient: TypeScriptServiceClient, - ) { - super(); - - this._register(serviceClient.onSurveyReady(e => this.surveyReady(e.surveyId))); - } - - @memoize - private get surveys(): Map { - return new Map( - allSurveys.map(data => [data.id, new Survey(data, this.memento)] as [string, Survey])); - } - - private surveyReady(surveyId: string): void { - const survey = this.tryGetActiveSurvey(surveyId); - if (survey && survey.trigger()) { - survey.willShow(); - this.showSurveyToUser(survey); - } - } - - private async showSurveyToUser(survey: Survey): Promise { - enum Choice { - GoToSurvey = 1, - RemindLater = 2, - NeverAgain = 3, - } - - interface MessageItem extends vscode.MessageItem { - readonly choice: Choice; - } - - const response = await vscode.window.showInformationMessage(survey.prompt, - { - title: localize('takeShortSurvey', "Take Short Survey"), - choice: Choice.GoToSurvey - }, { - title: localize('remindLater', "Remind Me Later"), - choice: Choice.RemindLater - }, { - title: localize('neverAgain', "Disable JS/TS Surveys"), - choice: Choice.NeverAgain - }); - - switch (response && response.choice) { - case Choice.GoToSurvey: - survey.open(); - break; - - case Choice.NeverAgain: - survey.markComplete(); - this.disableSurveys(); - break; - - case Choice.RemindLater: - default: // If user just closes the notification, treat this as a remind later. - survey.remindLater(); - break; - } - } - - private tryGetActiveSurvey(surveyId: string): Survey | undefined { - const survey = this.surveys.get(surveyId); - if (!survey) { - return undefined; - } - - if (this.areSurveysEnabled() && survey.isActive) { - return survey; - } - - return undefined; - } - - private areSurveysEnabled() { - const config = vscode.workspace.getConfiguration('typescript'); - return config.get('surveys.enabled', true); - } - - private disableSurveys() { - const config = vscode.workspace.getConfiguration('typescript'); - config.update('surveys.enabled', false); - } -} diff --git a/extensions/typescript-language-features/src/utils/telemetry.ts b/extensions/typescript-language-features/src/utils/telemetry.ts index e17e0188e6d91..13527cae12503 100644 --- a/extensions/typescript-language-features/src/utils/telemetry.ts +++ b/extensions/typescript-language-features/src/utils/telemetry.ts @@ -13,8 +13,12 @@ interface PackageInfo { readonly aiKey: string; } -export default interface TelemetryReporter { - logTelemetry(eventName: string, properties?: { readonly [prop: string]: string }): void; +export interface TelemetryProperties { + readonly [prop: string]: string | number | undefined; +} + +export interface TelemetryReporter { + logTelemetry(eventName: string, properties?: TelemetryProperties): void; dispose(): void; } @@ -26,22 +30,20 @@ export class VSCodeTelemetryReporter implements TelemetryReporter { private readonly clientVersionDelegate: () => string ) { } - public logTelemetry(eventName: string, properties?: { [prop: string]: string }) { + public logTelemetry(eventName: string, properties: { [prop: string]: string } = {}) { const reporter = this.reporter; - if (reporter) { - if (!properties) { - properties = {}; - } + if (!reporter) { + return; + } - /* __GDPR__FRAGMENT__ - "TypeScriptCommonProperties" : { - "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - properties['version'] = this.clientVersionDelegate(); + /* __GDPR__FRAGMENT__ + "TypeScriptCommonProperties" : { + "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + properties['version'] = this.clientVersionDelegate(); - reporter.sendTelemetryEvent(eventName, properties); - } + reporter.sendTelemetryEvent(eventName, properties); } public dispose() { diff --git a/extensions/typescript-language-features/src/utils/tracer.ts b/extensions/typescript-language-features/src/utils/tracer.ts index f7ca0d674e3e9..134ae13d5dedf 100644 --- a/extensions/typescript-language-features/src/utils/tracer.ts +++ b/extensions/typescript-language-features/src/utils/tracer.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import Logger from './logger'; enum Trace { @@ -29,6 +29,10 @@ namespace Trace { } } +interface RequestExecutionMetadata { + readonly queuingStartTime: number +} + export default class Tracer { private trace?: Trace; @@ -61,7 +65,7 @@ export default class Tracer { this.logTrace(serverId, `Sending request: ${request.command} (${request.seq}). Response expected: ${responseExpected ? 'yes' : 'no'}. Current queue length: ${queueLength}`, data); } - public traceResponse(serverId: string, response: Proto.Response, startTime: number): void { + public traceResponse(serverId: string, response: Proto.Response, meta: RequestExecutionMetadata): void { if (this.trace === Trace.Off) { return; } @@ -69,14 +73,14 @@ export default class Tracer { if (this.trace === Trace.Verbose && response.body) { data = `Result: ${JSON.stringify(response.body, null, 4)}`; } - this.logTrace(serverId, `Response received: ${response.command} (${response.request_seq}). Request took ${Date.now() - startTime} ms. Success: ${response.success} ${!response.success ? '. Message: ' + response.message : ''}`, data); + this.logTrace(serverId, `Response received: ${response.command} (${response.request_seq}). Request took ${Date.now() - meta.queuingStartTime} ms. Success: ${response.success} ${!response.success ? '. Message: ' + response.message : ''}`, data); } - public traceRequestCompleted(serverId: string, command: string, request_seq: number, startTime: number): any { + public traceRequestCompleted(serverId: string, command: string, request_seq: number, meta: RequestExecutionMetadata): any { if (this.trace === Trace.Off) { return; } - this.logTrace(serverId, `Async response received: ${command} (${request_seq}). Request took ${Date.now() - startTime} ms.`); + this.logTrace(serverId, `Async response received: ${command} (${request_seq}). Request took ${Date.now() - meta.queuingStartTime} ms.`); } public traceEvent(serverId: string, event: Proto.Event): void { @@ -95,4 +99,4 @@ export default class Tracer { this.logger.logLevel('Trace', `<${serverId}> ${message}`, data); } } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/utils/tsconfig.ts b/extensions/typescript-language-features/src/utils/tsconfig.ts index 994292dd62108..b22b4e31aefc0 100644 --- a/extensions/typescript-language-features/src/utils/tsconfig.ts +++ b/extensions/typescript-language-features/src/utils/tsconfig.ts @@ -5,37 +5,46 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; import { TypeScriptServiceConfiguration } from './configuration'; export function isImplicitProjectConfigFile(configFileName: string) { - return configFileName.indexOf('/dev/null/') === 0; + return configFileName.startsWith('/dev/null/'); } -export function inferredProjectConfig( - config: TypeScriptServiceConfiguration +export function inferredProjectCompilerOptions( + isTypeScriptProject: boolean, + serviceConfig: TypeScriptServiceConfiguration, ): Proto.ExternalProjectCompilerOptions { - const base: Proto.ExternalProjectCompilerOptions = { + const projectConfig: Proto.ExternalProjectCompilerOptions = { module: 'commonjs' as Proto.ModuleKind, target: 'es2016' as Proto.ScriptTarget, - jsx: 'preserve' as Proto.JsxEmit + jsx: 'preserve' as Proto.JsxEmit, }; - if (config.checkJs) { - base.checkJs = true; + if (serviceConfig.checkJs) { + projectConfig.checkJs = true; + if (isTypeScriptProject) { + projectConfig.allowJs = true; + } } - if (config.experimentalDecorators) { - base.experimentalDecorators = true; + if (serviceConfig.experimentalDecorators) { + projectConfig.experimentalDecorators = true; } - return base; + if (isTypeScriptProject) { + projectConfig.sourceMap = true; + } + + return projectConfig; } function inferredProjectConfigSnippet( + isTypeScriptProject: boolean, config: TypeScriptServiceConfiguration ) { - const baseConfig = inferredProjectConfig(config); + const baseConfig = inferredProjectCompilerOptions(isTypeScriptProject, config); const compilerOptions = Object.keys(baseConfig).map(key => `"${key}": ${JSON.stringify(baseConfig[key])}`); return new vscode.SnippetString(`{ "compilerOptions": { @@ -62,8 +71,8 @@ export async function openOrCreateConfigFile( const doc = await vscode.workspace.openTextDocument(configFile.with({ scheme: 'untitled' })); const editor = await vscode.window.showTextDocument(doc, col); if (editor.document.getText().length === 0) { - await editor.insertSnippet(inferredProjectConfigSnippet(config)); + await editor.insertSnippet(inferredProjectConfigSnippet(isTypeScriptProject, config)); } return editor; } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/utils/tsconfigProvider.ts b/extensions/typescript-language-features/src/utils/tsconfigProvider.ts index 04843d0058a38..e77dfb306a9b1 100644 --- a/extensions/typescript-language-features/src/utils/tsconfigProvider.ts +++ b/extensions/typescript-language-features/src/utils/tsconfigProvider.ts @@ -18,7 +18,7 @@ export default class TsConfigProvider { return []; } const configs = new Map(); - for (const config of await vscode.workspace.findFiles('**/tsconfig*.json', '**/node_modules/**')) { + for (const config of await vscode.workspace.findFiles('**/tsconfig*.json', '**/{node_modules,.*}/**')) { const root = vscode.workspace.getWorkspaceFolder(config); if (root) { configs.set(config.fsPath, { diff --git a/extensions/typescript-language-features/src/utils/typeConverters.ts b/extensions/typescript-language-features/src/utils/typeConverters.ts index 37947b38810d5..0026eaa123200 100644 --- a/extensions/typescript-language-features/src/utils/typeConverters.ts +++ b/extensions/typescript-language-features/src/utils/typeConverters.ts @@ -8,13 +8,19 @@ */ import * as vscode from 'vscode'; -import * as Proto from '../protocol'; +import type * as Proto from '../protocol'; +import * as PConst from '../protocol.const'; import { ITypeScriptServiceClient } from '../typescriptService'; export namespace Range { export const fromTextSpan = (span: Proto.TextSpan): vscode.Range => fromLocations(span.start, span.end); + export const toTextSpan = (range: vscode.Range): Proto.TextSpan => ({ + start: Position.toLocation(range.start), + end: Position.toLocation(range.end) + }); + export const fromLocations = (start: Proto.Location, end: Proto.Location): vscode.Range => new vscode.Range( Math.max(0, start.line - 1), Math.max(start.offset - 1, 0), @@ -90,3 +96,33 @@ export namespace WorkspaceEdit { return workspaceEdit; } } + +export namespace SymbolKind { + export function fromProtocolScriptElementKind(kind: Proto.ScriptElementKind) { + switch (kind) { + case PConst.Kind.module: return vscode.SymbolKind.Module; + case PConst.Kind.class: return vscode.SymbolKind.Class; + case PConst.Kind.enum: return vscode.SymbolKind.Enum; + case PConst.Kind.enumMember: return vscode.SymbolKind.EnumMember; + case PConst.Kind.interface: return vscode.SymbolKind.Interface; + case PConst.Kind.indexSignature: return vscode.SymbolKind.Method; + case PConst.Kind.callSignature: return vscode.SymbolKind.Method; + case PConst.Kind.memberFunction: return vscode.SymbolKind.Method; + case PConst.Kind.memberVariable: return vscode.SymbolKind.Property; + case PConst.Kind.memberGetAccessor: return vscode.SymbolKind.Property; + case PConst.Kind.memberSetAccessor: return vscode.SymbolKind.Property; + case PConst.Kind.variable: return vscode.SymbolKind.Variable; + case PConst.Kind.let: return vscode.SymbolKind.Variable; + case PConst.Kind.const: return vscode.SymbolKind.Variable; + case PConst.Kind.localVariable: return vscode.SymbolKind.Variable; + case PConst.Kind.alias: return vscode.SymbolKind.Variable; + case PConst.Kind.function: return vscode.SymbolKind.Function; + case PConst.Kind.localFunction: return vscode.SymbolKind.Function; + case PConst.Kind.constructSignature: return vscode.SymbolKind.Constructor; + case PConst.Kind.constructorImplementation: return vscode.SymbolKind.Constructor; + case PConst.Kind.typeParameter: return vscode.SymbolKind.TypeParameter; + case PConst.Kind.string: return vscode.SymbolKind.String; + default: return vscode.SymbolKind.Variable; + } + } +} diff --git a/extensions/typescript-language-features/src/utils/versionPicker.ts b/extensions/typescript-language-features/src/utils/versionPicker.ts index 20bae2ab64d6c..de042b3b01a22 100644 --- a/extensions/typescript-language-features/src/utils/versionPicker.ts +++ b/extensions/typescript-language-features/src/utils/versionPicker.ts @@ -66,7 +66,7 @@ export class TypeScriptVersionPicker { for (const version of this.versionProvider.localVersions) { pickOptions.push({ - label: (this.useWorkspaceTsdkSetting && this.currentVersion.path === version.path + label: (this.useWorkspaceTsdkSetting && this.currentVersion.eq(version) ? '• ' : '') + localize('useWorkspaceVersionOption', "Use Workspace Version"), description: version.displayName, diff --git a/extensions/typescript-language-features/src/utils/versionProvider.ts b/extensions/typescript-language-features/src/utils/versionProvider.ts index 2864d9f927389..8023631c46d9f 100644 --- a/extensions/typescript-language-features/src/utils/versionProvider.ts +++ b/extensions/typescript-language-features/src/utils/versionProvider.ts @@ -21,11 +21,16 @@ export const enum TypeScriptVersionSource { } export class TypeScriptVersion { + + public readonly apiVersion: API | undefined; + constructor( public readonly source: TypeScriptVersionSource, public readonly path: string, private readonly _pathLabel?: string - ) { } + ) { + this.apiVersion = TypeScriptVersion.getApiVersion(this.tsServerPath); + } public get tsServerPath(): string { return path.join(this.path, 'tsserver.js'); @@ -39,8 +44,28 @@ export class TypeScriptVersion { return this.apiVersion !== undefined; } - public get apiVersion(): API | undefined { - const version = this.getTypeScriptVersion(this.tsServerPath); + public eq(other: TypeScriptVersion): boolean { + if (this.path !== other.path) { + return false; + } + + if (this.apiVersion === other.apiVersion) { + return true; + } + if (!this.apiVersion || !other.apiVersion) { + return false; + } + return this.apiVersion.eq(other.apiVersion); + } + + public get displayName(): string { + const version = this.apiVersion; + return version ? version.displayName : localize( + 'couldNotLoadTsVersion', 'Could not load the TypeScript version at this path'); + } + + public static getApiVersion(serverPath: string): API | undefined { + const version = TypeScriptVersion.getTypeScriptVersion(serverPath); if (version) { return version; } @@ -54,13 +79,7 @@ export class TypeScriptVersion { return undefined; } - public get displayName(): string { - const version = this.apiVersion; - return version ? version.displayName : localize( - 'couldNotLoadTsVersion', 'Could not load the TypeScript version at this path'); - } - - private getTypeScriptVersion(serverPath: string): API | undefined { + private static getTypeScriptVersion(serverPath: string): API | undefined { if (!fs.existsSync(serverPath)) { return undefined; } diff --git a/extensions/typescript-language-features/tsconfig.json b/extensions/typescript-language-features/tsconfig.json index d83a081792034..7a2eafbfa8461 100644 --- a/extensions/typescript-language-features/tsconfig.json +++ b/extensions/typescript-language-features/tsconfig.json @@ -2,9 +2,16 @@ "extends": "../shared.tsconfig.json", "compilerOptions": { "outDir": "./out", - "experimentalDecorators": true + "experimentalDecorators": true, + // https://github.com/microsoft/TypeScript/issues/31869#issuecomment-515167432 + "baseUrl": "src/\u0000", + "paths": { + "vscode": [ + "../../../../src/vs/vscode.d.ts" + ] + } }, "include": [ "src/**/*" ] -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/yarn.lock b/extensions/typescript-language-features/yarn.lock index a45e26290c6ec..82daf1829dd65 100644 --- a/extensions/typescript-language-features/yarn.lock +++ b/extensions/typescript-language-features/yarn.lock @@ -22,14 +22,14 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*": - version "12.0.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.2.tgz#3452a24edf9fea138b48fad4a0a028a683da1e40" - integrity sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA== + version "13.1.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.6.tgz#076028d0b0400be8105b89a0a55550c86684ffec" + integrity "sha1-B2Ao0LBAC+gQW4mgpVVQyGaE/+w= sha512-Jg1F+bmxcpENHP23sVKkNuU3uaxPnsBMW0cLjleiikFKomJQbsn0Cqk2yDvQArqzZN6ABfBkZ0To7pQ8sLdWDg==" "@types/node@^12.11.7": - version "12.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.11.7.tgz#57682a9771a3f7b09c2497f28129a0462966524a" - integrity sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA== + version "12.12.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.24.tgz#d4606afd8cf6c609036b854360367d1b2c78931f" + integrity "sha1-1GBq/Yz2xgkDa4VDYDZ9Gyx4kx8= sha512-1Ciqv9pqwVtW6FsIUKSZNB82E5Cu1I2bBTj1xuIHXLe/1zYLl3956Nbhg2MzSYHVfl9/rmanjbQIb7LibfCnug==" "@types/rimraf@2.0.2": version "2.0.2" @@ -44,51 +44,22 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ== -ajv@^5.1.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" - integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" + es6-promisify "^5.0.0" -ansi-cyan@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" - integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= +ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== dependencies: - ansi-wrap "0.1.0" - -ansi-gray@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" - integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= - dependencies: - ansi-wrap "0.1.0" - -ansi-red@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" - integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= - dependencies: - ansi-wrap "0.1.0" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= - -ansi-wrap@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" - integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" applicationinsights@1.0.8: version "1.0.8" @@ -99,67 +70,12 @@ applicationinsights@1.0.8: diagnostic-channel-publishers "0.2.1" zone.js "0.7.6" -arr-diff@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" - integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo= - dependencies: - arr-flatten "^1.0.1" - array-slice "^0.2.3" - -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= - dependencies: - arr-flatten "^1.0.1" - -arr-flatten@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^2.0.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d" - integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0= - -array-differ@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" - integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= - -array-slice@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" - integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU= - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1, array-uniq@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= - -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" - integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= - asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" - integrity sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y= + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" @@ -176,10 +92,10 @@ aws-sign2@~0.7.0: resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= -aws4@^1.6.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289" - integrity sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w== +aws4@^1.8.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c" + integrity "sha1-JDkOatYThrCnRyZXVNKhchnehiw= sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==" balanced-match@^1.0.0: version "1.0.0" @@ -187,38 +103,12 @@ balanced-match@^1.0.0: integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" - integrity sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40= + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" -beeper@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809" - integrity sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak= - -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= - dependencies: - inherits "~2.0.0" - -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - integrity sha1-T4owBctKfjiJ90kDD9JbluAdLjE= - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - integrity sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw== - dependencies: - hoek "4.x.x" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -227,129 +117,43 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" - integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= - -buffer-crc32@~0.2.3: - version "0.2.13" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" - integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== buffer-from@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531" - integrity sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA== + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -clone-buffer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" - integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= - -clone-stats@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" - integrity sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE= - -clone-stats@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" - integrity sha1-s3gt/4u1R04Yuba/D9/ngvh3doA= - -clone@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/clone/-/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f" - integrity sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8= - -clone@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= - -clone@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" - integrity sha1-0hfR6WERjjrJpLi7oyhVU79kfNs= - -cloneable-readable@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.2.tgz#d591dee4a8f8bc15da43ce97dceeba13d43e2a65" - integrity sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg== - dependencies: - inherits "^2.0.1" - process-nextick-args "^2.0.0" - readable-stream "^2.3.5" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -color-support@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" - integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== - -combined-stream@1.0.6, combined-stream@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" - integrity sha1-cj599ugBrFYTETp+RFqbactjKBg= +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" - integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== +commander@2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -convert-source-map@^1.1.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" - integrity sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU= - -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - integrity sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4= - dependencies: - boom "5.x.x" - dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -357,11 +161,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -dateformat@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.2.0.tgz#4065e2013cf9fb916ddfd82efb506ad4c6769062" - integrity sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI= - debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -369,12 +168,12 @@ debug@3.1.0: dependencies: ms "2.0.0" -deep-assign@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-1.0.0.tgz#b092743be8427dc621ea0067cdec7e70dd19f37b" - integrity sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s= +debug@^3.1.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: - is-obj "^1.0.0" + ms "^2.1.1" delayed-stream@~1.0.0: version "1.0.0" @@ -393,104 +192,40 @@ diagnostic-channel@0.2.0: dependencies: semver "^5.3.0" -diff@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" - integrity sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww== - -duplexer2@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" - integrity sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds= - dependencies: - readable-stream "~1.1.9" - -duplexer@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" - integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= - -duplexify@^3.2.0: - version "3.5.4" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.4.tgz#4bb46c1796eabebeec4ca9a2e66b808cb7a3d8b4" - integrity sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA== - dependencies: - end-of-stream "^1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" - integrity sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU= + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" + safer-buffer "^2.1.0" -end-of-stream@^1.0.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" - integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= dependencies: - once "^1.4.0" + es6-promise "^4.0.3" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2: +escape-string-regexp@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -event-stream@^3.3.1, event-stream@^3.3.4, event-stream@~3.3.4: - version "3.3.4" - resolved "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" - integrity sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE= - dependencies: - duplexer "~0.1.1" - from "~0" - map-stream "~0.1.0" - pause-stream "0.0.11" - split "0.3" - stream-combiner "~0.0.4" - through "~2.3.1" - -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= - dependencies: - is-posix-bracket "^0.1.0" - -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= - dependencies: - fill-range "^2.1.0" - -extend-shallow@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071" - integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE= - dependencies: - kind-of "^1.1.0" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= - dependencies: - is-extendable "^0.1.0" - -extend@^3.0.0, extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - integrity sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ= - -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= - dependencies: - is-extglob "^1.0.0" +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== extsprintf@1.3.0: version "1.3.0" @@ -502,99 +237,35 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fancy-log@^1.1.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1" - integrity sha1-9BEl49hPLn2JpD0G2VjI94vha+E= - dependencies: - ansi-gray "^0.1.1" - color-support "^1.1.3" - time-stamp "^1.0.0" - -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" - integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= - -fd-slicer@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" - integrity sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU= - dependencies: - pend "~1.2.0" - -filename-regex@^2.0.0: +fast-deep-equal@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" - integrity sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM= - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^1.1.3" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - -first-chunk-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz#59bfb50cd905f60d7c394cd3d9acaab4e6ad934e" - integrity sha1-Wb+1DNkF9g18OUzT2ayqtOatk04= - -for-in@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= - -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= - dependencies: - for-in "^1.0.1" +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM= sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= -form-data@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" - integrity sha1-SXBJi+YEwgwAXU9cI67NIda0kJk= +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" - combined-stream "1.0.6" + combined-stream "^1.0.6" mime-types "^2.1.12" -from@~0: - version "0.1.7" - resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" - integrity sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4= - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" - integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" - getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -602,44 +273,7 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= - dependencies: - is-glob "^2.0.0" - -glob-parent@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" - integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= - dependencies: - is-glob "^3.1.0" - path-dirname "^1.0.0" - -glob-stream@^5.3.2: - version "5.3.5" - resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-5.3.5.tgz#a55665a9a8ccdc41915a87c701e32d4e016fad22" - integrity sha1-pVZlqajM3EGRWofHAeMtTgFvrSI= - dependencies: - extend "^3.0.0" - glob "^5.0.3" - glob-parent "^3.0.0" - micromatch "^2.3.7" - ordered-read-streams "^0.3.0" - through2 "^0.6.0" - to-absolute-glob "^0.1.1" - unique-stream "^2.0.2" - -glob@7.1.2, glob@^7.0.5, glob@^7.1.2: +glob@7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== @@ -651,21 +285,10 @@ glob@7.1.2, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^5.0.3: - version "5.0.15" - resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" - integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E= - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.1.3: - version "7.1.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" - integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== +glob@^7.1.2, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -674,187 +297,41 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glogg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.1.tgz#dcf758e44789cc3f3d32c1f3562a3676e6a34810" - integrity sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw== - dependencies: - sparkles "^1.0.0" - -graceful-fs@^4.0.0, 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= - -growl@1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" - integrity sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q== - -gulp-chmod@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/gulp-chmod/-/gulp-chmod-2.0.0.tgz#00c390b928a0799b251accf631aa09e01cc6299c" - integrity sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw= - dependencies: - deep-assign "^1.0.0" - stat-mode "^0.2.0" - through2 "^2.0.0" - -gulp-filter@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/gulp-filter/-/gulp-filter-5.1.0.tgz#a05e11affb07cf7dcf41a7de1cb7b63ac3783e73" - integrity sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM= - dependencies: - multimatch "^2.0.0" - plugin-error "^0.1.2" - streamfilter "^1.0.5" - -gulp-gunzip@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gulp-gunzip/-/gulp-gunzip-1.0.0.tgz#15b741145e83a9c6f50886241b57cc5871f151a9" - integrity sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak= - dependencies: - through2 "~0.6.5" - vinyl "~0.4.6" - -gulp-remote-src-vscode@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/gulp-remote-src-vscode/-/gulp-remote-src-vscode-0.5.0.tgz#71785553bc491880088ad971f90910c4b2d80a99" - integrity sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ== - dependencies: - event-stream "^3.3.4" - node.extend "^1.1.2" - request "^2.79.0" - through2 "^2.0.3" - vinyl "^2.0.1" - -gulp-sourcemaps@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz#b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c" - integrity sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw= - dependencies: - convert-source-map "^1.1.1" - graceful-fs "^4.1.2" - strip-bom "^2.0.0" - through2 "^2.0.0" - vinyl "^1.0.0" - -gulp-symdest@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/gulp-symdest/-/gulp-symdest-1.1.0.tgz#c165320732d192ce56fd94271ffa123234bf2ae0" - integrity sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA= - dependencies: - event-stream "^3.3.1" - mkdirp "^0.5.1" - queue "^3.1.0" - vinyl-fs "^2.4.3" - -gulp-untar@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/gulp-untar/-/gulp-untar-0.0.6.tgz#d6bdefde7e9a8e054c9f162385a0782c4be74000" - integrity sha1-1r3v3n6ajgVMnxYjhaB4LEvnQAA= - dependencies: - event-stream "~3.3.4" - gulp-util "~3.0.8" - streamifier "~0.1.1" - tar "^2.2.1" - through2 "~2.0.3" - -gulp-util@~3.0.8: - version "3.0.8" - resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" - integrity sha1-AFTh50RQLifATBh8PsxQXdVLu08= - dependencies: - array-differ "^1.0.0" - array-uniq "^1.0.2" - beeper "^1.0.0" - chalk "^1.0.0" - dateformat "^2.0.0" - fancy-log "^1.1.0" - gulplog "^1.0.0" - has-gulplog "^0.1.0" - lodash._reescape "^3.0.0" - lodash._reevaluate "^3.0.0" - lodash._reinterpolate "^3.0.0" - lodash.template "^3.0.0" - minimist "^1.1.0" - multipipe "^0.1.2" - object-assign "^3.0.0" - replace-ext "0.0.1" - through2 "^2.0.0" - vinyl "^0.5.0" - -gulp-vinyl-zip@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.0.tgz#24e40685dc05b7149995245099e0590263be8dad" - integrity sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0= - dependencies: - event-stream "^3.3.1" - queue "^4.2.1" - through2 "^2.0.3" - vinyl "^2.0.2" - vinyl-fs "^2.0.0" - yauzl "^2.2.1" - yazl "^2.2.1" - -gulplog@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" - integrity sha1-4oxNRdBey77YGDY86PnFkmIp/+U= - dependencies: - glogg "^1.0.0" +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - integrity sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0= +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: - ajv "^5.1.0" + ajv "^6.5.5" har-schema "^2.0.0" -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - dependencies: - ansi-regex "^2.0.0" - -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - integrity sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= - -has-gulplog@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" - integrity sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4= - dependencies: - sparkles "^1.0.0" - -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - integrity sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ== - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" - integrity sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA== +http-proxy-agent@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== + dependencies: + agent-base "4" + debug "3.1.0" http-signature@~1.2.0: version "1.2.0" @@ -865,6 +342,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +https-proxy-agent@^2.2.1: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -873,128 +358,16 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= - dependencies: - is-primitive "^2.0.0" - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= - -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= - -is-extglob@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= - -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= - dependencies: - is-extglob "^1.0.0" - -is-glob@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" - integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= - dependencies: - is-extglob "^2.1.0" - -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= - dependencies: - kind-of "^3.0.2" - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= - dependencies: - kind-of "^3.0.2" - -is-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" - integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= - -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= - -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= - -is-valid-glob@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-0.3.0.tgz#d4b55c69f51886f9b65c70d6c2622d37e29f48fe" - integrity sha1-1LVcafUYhvm2XHDWwmItN+KfSP4= - -is@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/is/-/is-3.2.1.tgz#d0ac2ad55eb7b0bec926a5266f6c662aaa83dca5" - integrity sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU= - -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= - -isarray@1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= - dependencies: - isarray "1.0.0" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -1005,37 +378,25 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= -json-stable-stringify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= - dependencies: - jsonify "~0.0.0" - json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -jsonc-parser@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" - integrity sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g== - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= +jsonc-parser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== jsprim@^1.2.2: version "1.4.1" @@ -1047,180 +408,19 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -kind-of@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" - integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ= - -kind-of@^3.0.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= - dependencies: - is-buffer "^1.1.5" - -lazystream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" - integrity sha1-9plf4PggOS9hOWvolGJAe7dxaOQ= - dependencies: - readable-stream "^2.0.5" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - integrity sha1-jaDmqHbPNEwK2KVIghEd08XHyjY= - -lodash._basetostring@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" - integrity sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U= - -lodash._basevalues@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" - integrity sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc= - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - integrity sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw= - -lodash._reescape@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._reescape/-/lodash._reescape-3.0.0.tgz#2b1d6f5dfe07c8a355753e5f27fac7f1cde1616a" - integrity sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo= - -lodash._reevaluate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz#58bc74c40664953ae0b124d806996daca431e2ed" - integrity sha1-WLx0xAZklTrgsSTYBpltrKQx4u0= - -lodash._reinterpolate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" - integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= - -lodash._root@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" - integrity sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI= - -lodash.escape@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698" - integrity sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg= - dependencies: - lodash._root "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - integrity sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo= - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - integrity sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U= - -lodash.isequal@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - integrity sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo= - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - -lodash.restparam@^3.0.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= - -lodash.template@^3.0.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f" - integrity sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8= - dependencies: - lodash._basecopy "^3.0.0" - lodash._basetostring "^3.0.0" - lodash._basevalues "^3.0.0" - lodash._isiterateecall "^3.0.0" - lodash._reinterpolate "^3.0.0" - lodash.escape "^3.0.0" - lodash.keys "^3.0.0" - lodash.restparam "^3.0.0" - lodash.templatesettings "^3.0.0" - -lodash.templatesettings@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5" - integrity sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU= - dependencies: - lodash._reinterpolate "^3.0.0" - lodash.escape "^3.0.0" - -map-stream@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" - integrity sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ= - -merge-stream@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" - integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= - dependencies: - readable-stream "^2.0.1" +mime-db@1.43.0: + version "1.43.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" + integrity "sha1-ChLgUCZQ5HPXNVNQUOfI9OtPrlg= sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" -micromatch@^2.3.7: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.26" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06" + integrity "sha1-nJIfwJt+FJpl39wNpNIJlyALCgY= sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==" dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - -mime-db@~1.33.0: - version "1.33.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" - integrity sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ== - -mime-types@^2.1.12, mime-types@~2.1.17: - version "2.1.18" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" - integrity sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ== - dependencies: - mime-db "~1.33.0" + mime-db "1.43.0" -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.4: +minimatch@3.0.4, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -1232,319 +432,134 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" -mocha@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.1.0.tgz#7d86cfbcf35cb829e2754c32e17355ec05338794" - integrity sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA== +mocha@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" + integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ== dependencies: - browser-stdout "1.3.0" - commander "2.11.0" + browser-stdout "1.3.1" + commander "2.15.1" debug "3.1.0" - diff "3.3.1" + diff "3.5.0" escape-string-regexp "1.0.5" glob "7.1.2" - growl "1.10.3" + growl "1.10.5" he "1.1.1" + minimatch "3.0.4" mkdirp "0.5.1" - supports-color "4.4.0" + supports-color "5.4.0" ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -multimatch@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" - integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= - dependencies: - array-differ "^1.0.0" - array-union "^1.0.1" - arrify "^1.0.0" - minimatch "^3.0.0" +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multipipe@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" - integrity sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s= - dependencies: - duplexer2 "0.0.2" - -node.extend@^1.1.2: - version "1.1.6" - resolved "https://registry.yarnpkg.com/node.extend/-/node.extend-1.1.6.tgz#a7b882c82d6c93a4863a5504bd5de8ec86258b96" - integrity sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y= - dependencies: - is "^3.1.0" - -normalize-path@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= - dependencies: - remove-trailing-separator "^1.0.1" +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" - integrity sha1-Rqarfwrq2N6unsBWV4C31O/rnUM= - -object-assign@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" - integrity sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I= - -object-assign@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - -once@^1.3.0, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" -ordered-read-streams@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz#7137e69b3298bb342247a1bbee3881c80e2fd78b" - integrity sha1-cTfmmzKYuzQiR6G77jiByA4v14s= - dependencies: - is-stream "^1.0.1" - readable-stream "^2.0.1" - -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" - -path-dirname@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" - integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= - path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -pause-stream@0.0.11: - version "0.0.11" - resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" - integrity sha1-/lo0sMvOErWqaitAPuLnO2AvFEU= - dependencies: - through "~2.3" - -pend@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" - integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -plugin-error@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace" - integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4= - dependencies: - ansi-cyan "^0.1.1" - ansi-red "^0.1.1" - arr-diff "^1.0.1" - arr-union "^2.0.1" - extend-shallow "^1.1.2" - -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= - -process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== +psl@^1.1.24: + version "1.7.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.7.0.tgz#f1c4c47a8ef97167dea5d6bbf4816d736e884a3c" + integrity "sha1-8cTEeo75cWfepda79IFtc26ISjw= sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - integrity sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A== - -querystringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.0.0.tgz#fa3ed6e68eb15159457c89b37bc6472833195755" - integrity sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw== - -queue@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/queue/-/queue-3.1.0.tgz#6c49d01f009e2256788789f2bffac6b8b9990585" - integrity sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU= - dependencies: - inherits "~2.0.0" - -queue@^4.2.1: - version "4.4.2" - resolved "https://registry.yarnpkg.com/queue/-/queue-4.4.2.tgz#5a9733d9a8b8bd1b36e934bc9c55ab89b28e29c7" - integrity sha512-fSMRXbwhMwipcDZ08enW2vl+YDmAmhcNcr43sCJL8DIg+CFOsoRLG23ctxA+fwNk1w55SePSiS7oqQQSgQoVJQ== - dependencies: - inherits "~2.0.0" - -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" - integrity sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how== - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -"readable-stream@>=1.0.33-1 <1.1.0-0": - version "1.0.34" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" - integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - -readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.1.5, readable-stream@^2.3.5: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@~1.1.9: - version "1.1.14" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" - integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== - dependencies: - is-equal-shallow "^0.1.3" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= - -repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" - integrity sha1-7wiaF40Ug7quTZPrmLT55OEdmQo= - -repeat-string@^1.5.2: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -replace-ext@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" - integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ= +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -replace-ext@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" - integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= +querystringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== -request@^2.79.0, request@^2.83.0: - version "2.85.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa" - integrity sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg== +request@^2.88.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== dependencies: aws-sign2 "~0.7.0" - aws4 "^1.6.0" + aws4 "^1.8.0" caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" + combined-stream "~1.0.6" + extend "~3.0.2" forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" + form-data "~2.3.2" + har-validator "~5.1.0" http-signature "~1.2.0" is-typedarray "~1.0.0" isstream "~0.1.2" json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" + mime-types "~2.1.19" + oauth-sign "~0.9.0" performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" tunnel-agent "^0.6.0" - uuid "^3.1.0" + uuid "^3.3.2" requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= -rimraf@2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - integrity sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== - dependencies: - glob "^7.0.5" - rimraf@^2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== dependencies: glob "^7.1.3" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== semver@5.5.1: version "5.5.1" @@ -1552,21 +567,14 @@ semver@5.5.1: integrity sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw== semver@^5.3.0, semver@^5.4.1: - version "5.5.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" - integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== - -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - integrity sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg== - dependencies: - hoek "4.x.x" + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== source-map-support@^0.5.0: - version "0.5.5" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.5.tgz#0d4af9e00493e855402e8ec36ebed2d266fceb90" - integrity sha512-mR7/Nd5l1z6g99010shcXJiNEaf3fEtmLhRB/sBcQVJGodcHCULPp2y4Sfa43Kv2zq7T+Izmfp/WHCR6dYkQCA== + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -1576,168 +584,34 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -sparkles@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" - integrity sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM= - -split@0.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" - integrity sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8= - dependencies: - through "2" - sshpk@^1.7.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb" - integrity sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s= + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" ecc-jsbn "~0.1.1" + getpass "^0.1.1" jsbn "~0.1.0" + safer-buffer "^2.0.2" tweetnacl "~0.14.0" -stat-mode@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-0.2.2.tgz#e6c80b623123d7d80cf132ce538f346289072502" - integrity sha1-5sgLYjEj19gM8TLOU480YokHJQI= - -stream-combiner@~0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" - integrity sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ= - dependencies: - duplexer "~0.1.1" - -stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= - -streamfilter@^1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/streamfilter/-/streamfilter-1.0.7.tgz#ae3e64522aa5a35c061fd17f67620c7653c643c9" - integrity sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ== - dependencies: - readable-stream "^2.0.2" - -streamifier@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/streamifier/-/streamifier-0.1.1.tgz#97e98d8fa4d105d62a2691d1dc07e820db8dfc4f" - integrity sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8= - -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - integrity sha1-TkhM1N5aC7vuGORjB3EKioFiGHg= - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" - -strip-bom-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz#e7144398577d51a6bed0fa1994fa05f43fd988ee" - integrity sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4= - dependencies: - first-chunk-stream "^1.0.0" - strip-bom "^2.0.0" - -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= - dependencies: - is-utf8 "^0.2.0" - -supports-color@4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" - integrity sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ== +supports-color@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== dependencies: - has-flag "^2.0.0" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= - -tar@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" - integrity sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE= - dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" + has-flag "^3.0.0" -through2-filter@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" - integrity sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw= - dependencies: - through2 "~2.0.0" - xtend "~4.0.0" - -through2@^0.6.0, through2@~0.6.5: - version "0.6.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" - integrity sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg= - dependencies: - readable-stream ">=1.0.33-1 <1.1.0-0" - xtend ">=4.0.0 <4.1.0-0" - -through2@^2.0.0, through2@^2.0.3, through2@~2.0.0, through2@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" - integrity sha1-AARWmzfHx0ujnEPzzteNGtlBQL4= - dependencies: - readable-stream "^2.1.5" - xtend "~4.0.1" - -through@2, through@~2.3, through@~2.3.1: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - -time-stamp@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" - integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= - -to-absolute-glob@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz#1cdfa472a9ef50c239ee66999b662ca0eb39937f" - integrity sha1-HN+kcqnvUMI57maZm2YsoOs5k38= - dependencies: - extend-shallow "^2.0.1" - -tough-cookie@~2.3.3: - version "2.3.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" - integrity sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA== +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== dependencies: + psl "^1.1.24" punycode "^1.4.1" tunnel-agent@^0.6.0: @@ -1752,36 +626,30 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= -unique-stream@^2.0.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.2.1.tgz#5aa003cfbe94c5ff866c4e7d668bb1c4dbadb369" - integrity sha1-WqADz76Uxf+GbE59ZouxxNuts2k= +typescript-vscode-sh-plugin@^0.6.8: + version "0.6.8" + resolved "https://registry.yarnpkg.com/typescript-vscode-sh-plugin/-/typescript-vscode-sh-plugin-0.6.8.tgz#60d5025f2ab814496824ee997b5e9fc12c5b7f1a" + integrity sha512-XEh/GwBRsZKWQjPTODqWWiW8o8DyF7Yzfp/xvq1vyK5Z9JykFKAkx95BEmALv9x9dpc2RcLZHgVsKFXrtDABCw== + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== dependencies: - json-stable-stringify "^1.0.0" - through2-filter "^2.0.0" + punycode "^2.1.0" -url-parse@^1.1.9: - version "1.4.0" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.0.tgz#6bfdaad60098c7fe06f623e42b22de62de0d3d75" - integrity sha512-ERuGxDiQ6Xw/agN4tuoCRbmwRuZP0cJ1lJxJubXr5Q/5cDa78+Dc4wfvtxzhzhkm5VvmW6Mf8EVj9SPGN4l8Lg== +url-parse@^1.4.4: + version "1.4.7" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" + integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== dependencies: - querystringify "^2.0.0" + querystringify "^2.1.1" requires-port "^1.0.0" -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -uuid@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" - integrity sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA== - -vali-date@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6" - integrity sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY= +uuid@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== verror@1.10.0: version "1.10.0" @@ -1792,75 +660,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vinyl-fs@^2.0.0, vinyl-fs@^2.4.3: - version "2.4.4" - resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-2.4.4.tgz#be6ff3270cb55dfd7d3063640de81f25d7532239" - integrity sha1-vm/zJwy1Xf19MGNkDegfJddTIjk= - dependencies: - duplexify "^3.2.0" - glob-stream "^5.3.2" - graceful-fs "^4.0.0" - gulp-sourcemaps "1.6.0" - is-valid-glob "^0.3.0" - lazystream "^1.0.0" - lodash.isequal "^4.0.0" - merge-stream "^1.0.0" - mkdirp "^0.5.0" - object-assign "^4.0.0" - readable-stream "^2.0.4" - strip-bom "^2.0.0" - strip-bom-stream "^1.0.0" - through2 "^2.0.0" - through2-filter "^2.0.0" - vali-date "^1.0.0" - vinyl "^1.0.0" - -vinyl-source-stream@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vinyl-source-stream/-/vinyl-source-stream-1.1.2.tgz#62b53a135610a896e98ca96bee3a87f008a8e780" - integrity sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A= - dependencies: - through2 "^2.0.3" - vinyl "^0.4.3" - -vinyl@^0.4.3, vinyl@~0.4.6: - version "0.4.6" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.4.6.tgz#2f356c87a550a255461f36bbeb2a5ba8bf784847" - integrity sha1-LzVsh6VQolVGHza76ypbqL94SEc= - dependencies: - clone "^0.2.0" - clone-stats "^0.0.1" - -vinyl@^0.5.0: - version "0.5.3" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.5.3.tgz#b0455b38fc5e0cf30d4325132e461970c2091cde" - integrity sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4= - dependencies: - clone "^1.0.0" - clone-stats "^0.0.1" - replace-ext "0.0.1" - -vinyl@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" - integrity sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ= - dependencies: - clone "^1.0.0" - clone-stats "^0.0.1" - replace-ext "0.0.1" - -vinyl@^2.0.1, vinyl@^2.0.2: - version "2.1.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c" - integrity sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw= - dependencies: - clone "^2.1.1" - clone-buffer "^1.0.0" - clone-stats "^1.0.0" - cloneable-readable "^1.0.0" - remove-trailing-separator "^1.0.1" - replace-ext "^1.0.0" - vscode-extension-telemetry@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.1.tgz#91387e06b33400c57abd48979b0e790415ae110b" @@ -1868,56 +667,37 @@ vscode-extension-telemetry@0.1.1: dependencies: applicationinsights "1.0.8" -vscode-nls@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" - integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== +vscode-nls@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c" + integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A== + +vscode-test@^0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/vscode-test/-/vscode-test-0.4.3.tgz#461ebf25fc4bc93d77d982aed556658a2e2b90b8" + integrity sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w== + dependencies: + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.1" -vscode@^1.1.10: - version "1.1.17" - resolved "https://registry.yarnpkg.com/vscode/-/vscode-1.1.17.tgz#cc2a61731e925301f03f003c009cbf454022cd83" - integrity sha512-yNMyrgEua2qyW7+trNNYhA6PeldRrBcwtLtlazkdtzcmkHMKECM/08bPF8HF2ZFuwHgD+8FQsdqd/DvJYQYjJg== +vscode@^1.1.36: + version "1.1.36" + resolved "https://registry.yarnpkg.com/vscode/-/vscode-1.1.36.tgz#5e1a0d1bf4977d0c7bc5159a9a13d5b104d4b1b6" + integrity sha512-cGFh9jmGLcTapCpPCKvn8aG/j9zVQ+0x5hzYJq5h5YyUXVGa1iamOaB2M2PZXoumQPES4qeAP1FwkI0b6tL4bQ== dependencies: glob "^7.1.2" - gulp-chmod "^2.0.0" - gulp-filter "^5.0.1" - gulp-gunzip "1.0.0" - gulp-remote-src-vscode "^0.5.0" - gulp-symdest "^1.1.0" - gulp-untar "^0.0.6" - gulp-vinyl-zip "^2.1.0" - mocha "^4.0.1" - request "^2.83.0" + mocha "^5.2.0" + request "^2.88.0" semver "^5.4.1" source-map-support "^0.5.0" - url-parse "^1.1.9" - vinyl-source-stream "^1.1.0" + url-parse "^1.4.4" + vscode-test "^0.4.1" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -"xtend@>=4.0.0 <4.1.0-0", xtend@~4.0.0, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= - -yauzl@^2.2.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.9.1.tgz#a81981ea70a57946133883f029c5821a89359a7f" - integrity sha1-qBmB6nCleUYTOIPwKcWCGok1mn8= - dependencies: - buffer-crc32 "~0.2.3" - fd-slicer "~1.0.1" - -yazl@^2.2.1: - version "2.4.3" - resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.4.3.tgz#ec26e5cc87d5601b9df8432dbdd3cd2e5173a071" - integrity sha1-7CblzIfVYBud+EMtvdPNLlFzoHE= - dependencies: - buffer-crc32 "~0.2.3" - zone.js@0.7.6: version "0.7.6" resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.6.tgz#fbbc39d3e0261d0986f1ba06306eb3aeb0d22009" diff --git a/extensions/vb/language-configuration.json b/extensions/vb/language-configuration.json index d9a6b21014a9b..a31b67bec0fe0 100644 --- a/extensions/vb/language-configuration.json +++ b/extensions/vb/language-configuration.json @@ -12,7 +12,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + { "open": "\"", "close": "\"", "notIn": ["string"] } ], "surroundingPairs": [ ["{", "}"], @@ -27,4 +27,4 @@ "end": "^\\s*#End Region\\b" } } -} \ No newline at end of file +} diff --git a/extensions/vscode-account/.vscodeignore b/extensions/vscode-account/.vscodeignore new file mode 100644 index 0000000000000..ed3f9d37c1f24 --- /dev/null +++ b/extensions/vscode-account/.vscodeignore @@ -0,0 +1,10 @@ +.vscode/** +.vscode-test/** +out/test/** +src/** +.gitignore +vsc-extension-quickstart.md +**/tsconfig.json +**/tslint.json +**/*.map +**/*.ts \ No newline at end of file diff --git a/extensions/vscode-account/extension.webpack.config.js b/extensions/vscode-account/extension.webpack.config.js new file mode 100644 index 0000000000000..a513ac5c3b511 --- /dev/null +++ b/extensions/vscode-account/extension.webpack.config.js @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); + +module.exports = withDefaults({ + context: __dirname, + entry: { + extension: './src/extension.ts', + }, + externals: { + 'keytar': 'commonjs keytar' + } +}); diff --git a/extensions/vscode-account/media/auth.css b/extensions/vscode-account/media/auth.css new file mode 100644 index 0000000000000..e87a6372763f5 --- /dev/null +++ b/extensions/vscode-account/media/auth.css @@ -0,0 +1,100 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +html { + height: 100%; +} + +body { + box-sizing: border-box; + min-height: 100%; + margin: 0; + padding: 15px 30px; + display: flex; + flex-direction: column; + color: white; + font-family: "Segoe UI","Helvetica Neue","Helvetica",Arial,sans-serif; + background-color: #373277; +} + +.branding { + background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGRlZnM+PHN0eWxlPi5pY29uLWNhbnZhcy10cmFuc3BhcmVudHtmaWxsOiNmNmY2ZjY7b3BhY2l0eTowO30uaWNvbi13aGl0ZXtmaWxsOiNmZmY7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5CcmFuZFZpc3VhbFN0dWRpb0NvZGUyMDE3UlRXXzI0eF93aGl0ZV8yNHg8L3RpdGxlPjxwYXRoIGNsYXNzPSJpY29uLWNhbnZhcy10cmFuc3BhcmVudCIgZD0iTTI0LDBWMjRIMFYwWiIvPjxwYXRoIGNsYXNzPSJpY29uLXdoaXRlIiBkPSJNMjQsMi41VjIxLjVMMTgsMjQsMCwxOC41di0uNTYxbDE4LDEuNTQ1VjBaTTEsMTMuMTExLDQuMzg1LDEwLDEsNi44ODlsMS40MTgtLjgyN0w1Ljg1Myw4LjY1LDEyLDNsMywxLjQ1NlYxNS41NDRMMTIsMTcsNS44NTMsMTEuMzUsMi40MTksMTMuOTM5Wk03LjY0NCwxMCwxMiwxMy4yODNWNi43MTdaIi8+PC9zdmc+"); + background-size: 24px; + background-repeat: no-repeat; + background-position: left 50%; + padding-left: 36px; + font-size: 20px; + letter-spacing: -0.04rem; + font-weight: 400; + color: white; + text-decoration: none; +} + +.message-container { + flex-grow: 1; + display: flex; + align-items: center; + justify-content: center; + margin: 0 30px; +} + +.message { + font-weight: 300; + font-size: 1.3rem; +} + +body.error .message { + display: none; +} + +body.error .error-message { + display: block; +} + +.error-message { + display: none; + font-weight: 300; + font-size: 1.3rem; +} + +.error-text { + color: red; + font-size: 1rem; +} + +@font-face { + font-family: 'Segoe UI'; + src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot?#iefix") format("embedded-opentype"); + src: local("Segoe UI Light"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.svg#web") format("svg"); + font-weight: 200 +} + +@font-face { + font-family: 'Segoe UI'; + src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot?#iefix") format("embedded-opentype"); + src: local("Segoe UI Semilight"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.svg#web") format("svg"); + font-weight: 300 +} + +@font-face { + font-family: 'Segoe UI'; + src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot?#iefix") format("embedded-opentype"); + src: local("Segoe UI"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.svg#web") format("svg"); + font-weight: 400 +} + +@font-face { + font-family: 'Segoe UI'; + src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot?#iefix") format("embedded-opentype"); + src: local("Segoe UI Semibold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.svg#web") format("svg"); + font-weight: 600 +} + +@font-face { + font-family: 'Segoe UI'; + src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot?#iefix") format("embedded-opentype"); + src: local("Segoe UI Bold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.svg#web") format("svg"); + font-weight: 700 +} diff --git a/extensions/vscode-account/media/auth.html b/extensions/vscode-account/media/auth.html new file mode 100644 index 0000000000000..0fcba4e3c625b --- /dev/null +++ b/extensions/vscode-account/media/auth.html @@ -0,0 +1,38 @@ + + + + + + + + Azure Account - Sign In + + + + + + + Visual Studio Code + +
+
+ You are signed in now and can close this page. +
+
+ An error occurred while signing in: +
+
+
+ + + + diff --git a/extensions/vscode-account/package.json b/extensions/vscode-account/package.json new file mode 100644 index 0000000000000..c4df52ce7327a --- /dev/null +++ b/extensions/vscode-account/package.json @@ -0,0 +1,43 @@ +{ + "name": "vscode-account", + "publisher": "vscode", + "displayName": "%displayName%", + "description": "%description%", + "version": "0.0.1", + "engines": { + "vscode": "^1.42.0" + }, + "categories": [ + "Other" + ], + "enableProposedApi": true, + "activationEvents": [ + "*" + ], + "main": "./out/extension.js", + "contributes": { + "commands": [ + { + "command": "microsoft.signin", + "title": "%signIn%", + "category": "%displayName%" + }, + { + "command": "microsoft.signout", + "title": "%signOut%", + "category": "%displayName%" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "gulp compile-extension:vscode-account", + "watch": "gulp watch-extension:vscode-account" + }, + "devDependencies": { + "typescript": "^3.7.4", + "tslint": "^5.12.1", + "@types/node": "^10.12.21", + "@types/keytar": "^4.0.1" + } +} diff --git a/extensions/vscode-account/package.nls.json b/extensions/vscode-account/package.nls.json new file mode 100644 index 0000000000000..8211a3f6e9c6c --- /dev/null +++ b/extensions/vscode-account/package.nls.json @@ -0,0 +1,6 @@ +{ + "displayName": "Microsoft Account", + "description": "Microsoft authentication provider", + "signIn": "Sign in", + "signOut": "Sign out" +} diff --git a/extensions/vscode-account/src/AADHelper.ts b/extensions/vscode-account/src/AADHelper.ts new file mode 100644 index 0000000000000..94bc3695dc481 --- /dev/null +++ b/extensions/vscode-account/src/AADHelper.ts @@ -0,0 +1,590 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as crypto from 'crypto'; +import * as https from 'https'; +import * as querystring from 'querystring'; +import * as vscode from 'vscode'; +import { createServer, startServer } from './authServer'; +import { keychain } from './keychain'; +import Logger from './logger'; +import { toBase64UrlEncoding } from './utils'; + +const redirectUrl = 'https://vscode-redirect.azurewebsites.net/'; +const loginEndpointUrl = 'https://login.microsoftonline.com/'; +const clientId = 'aebc6443-996d-45c2-90f0-388ff96faa56'; +const tenant = 'organizations'; + +interface IToken { + accessToken?: string; // When unable to refresh due to network problems, the access token becomes undefined + + expiresIn?: string; // How long access token is valid, in seconds + expiresAt?: number; // UNIX epoch time at which token will expire + refreshToken: string; + + accountName: string; + scope: string; + sessionId: string; // The account id + the scope +} + +interface ITokenClaims { + tid: string; + email?: string; + unique_name?: string; + oid?: string; + altsecid?: string; + ipd?: string; + scp: string; +} + +interface IStoredSession { + id: string; + refreshToken: string; + scope: string; // Scopes are alphabetized and joined with a space + accountName: string; +} + +function parseQuery(uri: vscode.Uri) { + return uri.query.split('&').reduce((prev: any, current) => { + const queryString = current.split('='); + prev[queryString[0]] = queryString[1]; + return prev; + }, {}); +} + +export const onDidChangeSessions = new vscode.EventEmitter(); + +export const REFRESH_NETWORK_FAILURE = 'Network failure'; + +class UriEventHandler extends vscode.EventEmitter implements vscode.UriHandler { + public handleUri(uri: vscode.Uri) { + this.fire(uri); + } +} + +export class AzureActiveDirectoryService { + private _tokens: IToken[] = []; + private _refreshTimeouts: Map = new Map(); + private _uriHandler: UriEventHandler; + + constructor() { + this._uriHandler = new UriEventHandler(); + vscode.window.registerUriHandler(this._uriHandler); + } + + public async initialize(): Promise { + const storedData = await keychain.getToken(); + if (storedData) { + try { + const sessions = this.parseStoredData(storedData); + const refreshes = sessions.map(async session => { + try { + await this.refreshToken(session.refreshToken, session.scope); + } catch (e) { + if (e.message === REFRESH_NETWORK_FAILURE) { + const didSucceedOnRetry = await this.handleRefreshNetworkError(session.id, session.refreshToken, session.scope); + if (!didSucceedOnRetry) { + this._tokens.push({ + accessToken: undefined, + refreshToken: session.refreshToken, + accountName: session.accountName, + scope: session.scope, + sessionId: session.id + }); + this.pollForReconnect(session.id, session.refreshToken, session.scope); + } + } else { + await this.logout(session.id); + } + } + }); + + await Promise.all(refreshes); + } catch (e) { + await this.clearSessions(); + } + } + + this.pollForChange(); + } + + private parseStoredData(data: string): IStoredSession[] { + return JSON.parse(data); + } + + private async storeTokenData(): Promise { + const serializedData: IStoredSession[] = this._tokens.map(token => { + return { + id: token.sessionId, + refreshToken: token.refreshToken, + scope: token.scope, + accountName: token.accountName + }; + }); + + await keychain.setToken(JSON.stringify(serializedData)); + } + + private pollForChange() { + setTimeout(async () => { + let didChange = false; + const storedData = await keychain.getToken(); + if (storedData) { + try { + const sessions = this.parseStoredData(storedData); + let promises = sessions.map(async session => { + const matchesExisting = this._tokens.some(token => token.scope === session.scope && token.sessionId === session.id); + if (!matchesExisting) { + try { + await this.refreshToken(session.refreshToken, session.scope); + didChange = true; + } catch (e) { + if (e.message === REFRESH_NETWORK_FAILURE) { + // Ignore, will automatically retry on next poll. + } else { + await this.logout(session.id); + } + } + } + }); + + promises = promises.concat(this._tokens.map(async token => { + const matchesExisting = sessions.some(session => token.scope === session.scope && token.sessionId === session.id); + if (!matchesExisting) { + await this.logout(token.sessionId); + didChange = true; + } + })); + + await Promise.all(promises); + } catch (e) { + Logger.error(e.message); + // if data is improperly formatted, remove all of it and send change event + this.clearSessions(); + didChange = true; + } + } else { + if (this._tokens.length) { + // Log out all + await this.clearSessions(); + didChange = true; + } + } + + if (didChange) { + onDidChangeSessions.fire(); + } + + this.pollForChange(); + }, 1000 * 30); + } + + private convertToSession(token: IToken): vscode.AuthenticationSession { + return { + id: token.sessionId, + accessToken: () => this.resolveAccessToken(token), + accountName: token.accountName, + scopes: token.scope.split(' ') + }; + } + + private async resolveAccessToken(token: IToken): Promise { + if (token.accessToken && (!token.expiresAt || token.expiresAt > Date.now())) { + Logger.info('Token available from cache'); + return Promise.resolve(token.accessToken); + } + + try { + Logger.info('Token expired or unavailable, trying refresh'); + const refreshedToken = await this.refreshToken(token.refreshToken, token.scope); + if (refreshedToken.accessToken) { + Promise.resolve(token.accessToken); + } else { + throw new Error(); + } + } catch (e) { + throw new Error('Unavailable due to network problems'); + } + + throw new Error('Unavailable due to network problems'); + } + + private getTokenClaims(accessToken: string): ITokenClaims { + try { + return JSON.parse(Buffer.from(accessToken.split('.')[1], 'base64').toString()); + } catch (e) { + Logger.error(e.message); + throw new Error('Unable to read token claims'); + } + } + + get sessions(): vscode.AuthenticationSession[] { + return this._tokens.map(token => this.convertToSession(token)); + } + + public async login(scope: string): Promise { + Logger.info('Logging in...'); + + if (vscode.env.uiKind === vscode.UIKind.Web) { + await this.loginWithoutLocalServer(scope); + return; + } + + const nonce = crypto.randomBytes(16).toString('base64'); + const { server, redirectPromise, codePromise } = createServer(nonce); + + let token: IToken | undefined; + try { + const port = await startServer(server); + vscode.env.openExternal(vscode.Uri.parse(`http://localhost:${port}/signin?nonce=${encodeURIComponent(nonce)}`)); + + const redirectReq = await redirectPromise; + if ('err' in redirectReq) { + const { err, res } = redirectReq; + res.writeHead(302, { Location: `/?error=${encodeURIComponent(err && err.message || 'Unknown error')}` }); + res.end(); + throw err; + } + + const host = redirectReq.req.headers.host || ''; + const updatedPortStr = (/^[^:]+:(\d+)$/.exec(Array.isArray(host) ? host[0] : host) || [])[1]; + const updatedPort = updatedPortStr ? parseInt(updatedPortStr, 10) : port; + + const state = `${updatedPort},${encodeURIComponent(nonce)}`; + + const codeVerifier = toBase64UrlEncoding(crypto.randomBytes(32).toString('base64')); + const codeChallenge = toBase64UrlEncoding(crypto.createHash('sha256').update(codeVerifier).digest('base64')); + const loginUrl = `${loginEndpointUrl}${tenant}/oauth2/v2.0/authorize?response_type=code&response_mode=query&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUrl)}&state=${state}&scope=${encodeURIComponent(scope)}&prompt=select_account&code_challenge_method=S256&code_challenge=${codeChallenge}`; + + await redirectReq.res.writeHead(302, { Location: loginUrl }); + redirectReq.res.end(); + + const codeRes = await codePromise; + const res = codeRes.res; + + try { + if ('err' in codeRes) { + throw codeRes.err; + } + token = await this.exchangeCodeForToken(codeRes.code, codeVerifier, scope); + this.setToken(token, scope); + Logger.info('Login successful'); + res.writeHead(302, { Location: '/' }); + res.end(); + } catch (err) { + res.writeHead(302, { Location: `/?error=${encodeURIComponent(err && err.message || 'Unknown error')}` }); + res.end(); + throw new Error(err.message); + } + } catch (e) { + Logger.error(e.message); + + // If the error was about starting the server, try directly hitting the login endpoint instead + if (e.message === 'Error listening to server' || e.message === 'Closed' || e.message === 'Timeout waiting for port') { + await this.loginWithoutLocalServer(scope); + } + throw new Error(e.message); + } finally { + setTimeout(() => { + server.close(); + }, 5000); + } + } + + private getCallbackEnvironment(callbackUri: vscode.Uri): string { + switch (callbackUri.authority) { + case 'online.visualstudio.com,': + return 'vso'; + case 'online-ppe.core.vsengsaas.visualstudio.com': + return 'vsoppe,'; + case 'online.dev.core.vsengsaas.visualstudio.com': + return 'vsodev,'; + default: + return ''; + } + } + + private async loginWithoutLocalServer(scope: string): Promise { + const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.vscode-account`)); + const nonce = crypto.randomBytes(16).toString('base64'); + const port = (callbackUri.authority.match(/:([0-9]*)$/) || [])[1] || (callbackUri.scheme === 'https' ? 443 : 80); + const callbackEnvironment = this.getCallbackEnvironment(callbackUri); + const state = `${callbackEnvironment}${port},${encodeURIComponent(nonce)},${encodeURIComponent(callbackUri.query)}`; + const signInUrl = `${loginEndpointUrl}${tenant}/oauth2/v2.0/authorize`; + let uri = vscode.Uri.parse(signInUrl); + const codeVerifier = toBase64UrlEncoding(crypto.randomBytes(32).toString('base64')); + const codeChallenge = toBase64UrlEncoding(crypto.createHash('sha256').update(codeVerifier).digest('base64')); + uri = uri.with({ + query: `response_type=code&client_id=${encodeURIComponent(clientId)}&response_mode=query&redirect_uri=${redirectUrl}&state=${state}&scope=${scope}&prompt=select_account&code_challenge_method=S256&code_challenge=${codeChallenge}` + }); + vscode.env.openExternal(uri); + + const timeoutPromise = new Promise((_: (value: IToken) => void, reject) => { + const wait = setTimeout(() => { + clearTimeout(wait); + reject('Login timed out.'); + }, 1000 * 60 * 5); + }); + + return Promise.race([this.handleCodeResponse(state, codeVerifier, scope), timeoutPromise]); + } + + private async handleCodeResponse(state: string, codeVerifier: string, scope: string) { + let uriEventListener: vscode.Disposable; + return new Promise((resolve: (value: IToken) => void, reject) => { + uriEventListener = this._uriHandler.event(async (uri: vscode.Uri) => { + try { + const query = parseQuery(uri); + const code = query.code; + + if (query.state !== state) { + throw new Error('State does not match.'); + } + + const token = await this.exchangeCodeForToken(code, codeVerifier, scope); + this.setToken(token, scope); + + resolve(token); + } catch (err) { + reject(err); + } + }); + }).then(result => { + uriEventListener.dispose(); + return result; + }).catch(err => { + uriEventListener.dispose(); + throw err; + }); + } + + private async setToken(token: IToken, scope: string): Promise { + const existingTokenIndex = this._tokens.findIndex(t => t.sessionId === token.sessionId); + if (existingTokenIndex > -1) { + this._tokens.splice(existingTokenIndex, 1, token); + } else { + this._tokens.push(token); + } + + this.clearSessionTimeout(token.sessionId); + + if (token.expiresIn) { + this._refreshTimeouts.set(token.sessionId, setTimeout(async () => { + try { + await this.refreshToken(token.refreshToken, scope); + onDidChangeSessions.fire(); + } catch (e) { + if (e.message === REFRESH_NETWORK_FAILURE) { + const didSucceedOnRetry = await this.handleRefreshNetworkError(token.sessionId, token.refreshToken, scope); + if (!didSucceedOnRetry) { + this.pollForReconnect(token.sessionId, token.refreshToken, token.scope); + } + } else { + await this.logout(token.sessionId); + onDidChangeSessions.fire(); + } + } + }, 1000 * (parseInt(token.expiresIn) - 30))); + } + + this.storeTokenData(); + } + + private getTokenFromResponse(buffer: Buffer[], scope: string): IToken { + const json = JSON.parse(Buffer.concat(buffer).toString()); + const claims = this.getTokenClaims(json.access_token); + return { + expiresIn: json.expires_in, + expiresAt: Date.now() + json.expires_in * 1000, + accessToken: json.access_token, + refreshToken: json.refresh_token, + scope, + sessionId: `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}/${scope}`, + accountName: claims.email || claims.unique_name || 'user@example.com' + }; + } + + private async exchangeCodeForToken(code: string, codeVerifier: string, scope: string): Promise { + return new Promise((resolve: (value: IToken) => void, reject) => { + Logger.info('Exchanging login code for token'); + try { + const postData = querystring.stringify({ + grant_type: 'authorization_code', + code: code, + client_id: clientId, + scope: scope, + code_verifier: codeVerifier, + redirect_uri: redirectUrl + }); + + const tokenUrl = vscode.Uri.parse(`${loginEndpointUrl}${tenant}/oauth2/v2.0/token`); + + const post = https.request({ + host: tokenUrl.authority, + path: tokenUrl.path, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Length': postData.length + } + }, result => { + const buffer: Buffer[] = []; + result.on('data', (chunk: Buffer) => { + buffer.push(chunk); + }); + result.on('end', () => { + if (result.statusCode === 200) { + Logger.info('Exchanging login code for token success'); + resolve(this.getTokenFromResponse(buffer, scope)); + } else { + Logger.error('Exchanging login code for token failed'); + reject(new Error('Unable to login.')); + } + }); + }); + + post.write(postData); + + post.end(); + post.on('error', err => { + reject(err); + }); + + } catch (e) { + Logger.error(e.message); + reject(e); + } + }); + } + + private async refreshToken(refreshToken: string, scope: string): Promise { + return new Promise((resolve: (value: IToken) => void, reject) => { + Logger.info('Refreshing token...'); + const postData = querystring.stringify({ + refresh_token: refreshToken, + client_id: clientId, + grant_type: 'refresh_token', + scope: scope + }); + + const post = https.request({ + host: 'login.microsoftonline.com', + path: `/${tenant}/oauth2/v2.0/token`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Length': postData.length + } + }, result => { + const buffer: Buffer[] = []; + result.on('data', (chunk: Buffer) => { + buffer.push(chunk); + }); + result.on('end', async () => { + if (result.statusCode === 200) { + const token = this.getTokenFromResponse(buffer, scope); + this.setToken(token, scope); + Logger.info('Token refresh success'); + resolve(token); + } else { + Logger.error('Refreshing token failed'); + reject(new Error('Refreshing token failed.')); + } + }); + }); + + post.write(postData); + + post.end(); + post.on('error', err => { + Logger.error(err.message); + reject(new Error(REFRESH_NETWORK_FAILURE)); + }); + }); + } + + private clearSessionTimeout(sessionId: string): void { + const timeout = this._refreshTimeouts.get(sessionId); + if (timeout) { + clearTimeout(timeout); + this._refreshTimeouts.delete(sessionId); + } + } + + private removeInMemorySessionData(sessionId: string) { + const tokenIndex = this._tokens.findIndex(token => token.sessionId === sessionId); + if (tokenIndex > -1) { + this._tokens.splice(tokenIndex, 1); + } + + this.clearSessionTimeout(sessionId); + } + + private pollForReconnect(sessionId: string, refreshToken: string, scope: string): void { + this.clearSessionTimeout(sessionId); + + this._refreshTimeouts.set(sessionId, setTimeout(async () => { + try { + await this.refreshToken(refreshToken, scope); + } catch (e) { + this.pollForReconnect(sessionId, refreshToken, scope); + } + }, 1000 * 60 * 30)); + } + + private handleRefreshNetworkError(sessionId: string, refreshToken: string, scope: string, attempts: number = 1): Promise { + return new Promise((resolve, _) => { + if (attempts === 3) { + Logger.error('Token refresh failed after 3 attempts'); + return resolve(false); + } + + if (attempts === 1) { + const token = this._tokens.find(token => token.sessionId === sessionId); + if (token) { + token.accessToken = undefined; + } + + onDidChangeSessions.fire(); + } + + const delayBeforeRetry = 5 * attempts * attempts; + + this.clearSessionTimeout(sessionId); + + this._refreshTimeouts.set(sessionId, setTimeout(async () => { + try { + await this.refreshToken(refreshToken, scope); + return resolve(true); + } catch (e) { + return resolve(await this.handleRefreshNetworkError(sessionId, refreshToken, scope, attempts + 1)); + } + }, 1000 * delayBeforeRetry)); + }); + } + + public async logout(sessionId: string) { + Logger.info(`Logging out of session '${sessionId}'`); + this.removeInMemorySessionData(sessionId); + + if (this._tokens.length === 0) { + await keychain.deleteToken(); + } else { + this.storeTokenData(); + } + } + + public async clearSessions() { + Logger.info('Logging out of all sessions'); + this._tokens = []; + await keychain.deleteToken(); + + this._refreshTimeouts.forEach(timeout => { + clearTimeout(timeout); + }); + + this._refreshTimeouts.clear(); + } +} diff --git a/extensions/vscode-account/src/authServer.ts b/extensions/vscode-account/src/authServer.ts new file mode 100644 index 0000000000000..c75247e0a78b0 --- /dev/null +++ b/extensions/vscode-account/src/authServer.ts @@ -0,0 +1,197 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as http from 'http'; +import * as url from 'url'; +import * as fs from 'fs'; +import * as net from 'net'; +import * as path from 'path'; + +interface Deferred { + resolve: (result: T | Promise) => void; + reject: (reason: any) => void; +} + +const _typeof = { + number: 'number', + string: 'string', + undefined: 'undefined', + object: 'object', + function: 'function' +}; + +/** + * @returns whether the provided parameter is undefined. + */ +export function isUndefined(obj: any): obj is undefined { + return typeof (obj) === _typeof.undefined; +} + +/** + * @returns whether the provided parameter is undefined or null. + */ +export function isUndefinedOrNull(obj: any): obj is undefined | null { + return isUndefined(obj) || obj === null; +} + +/** + * Asserts that the argument passed in is neither undefined nor null. + */ +export function assertIsDefined(arg: T | null | undefined): T { + if (isUndefinedOrNull(arg)) { + throw new Error('Assertion Failed: argument is undefined or null'); + } + + return arg; +} + +export function createTerminateServer(server: http.Server) { + const sockets: Record = {}; + let socketCount = 0; + server.on('connection', socket => { + const id = socketCount++; + sockets[id] = socket; + socket.on('close', () => { + delete sockets[id]; + }); + }); + return async () => { + const result = new Promise(resolve => server.close(resolve)); + for (const id in sockets) { + sockets[id].destroy(); + } + return result; + }; +} + +export async function startServer(server: http.Server): Promise { + let portTimer: NodeJS.Timer; + + function cancelPortTimer() { + clearTimeout(portTimer); + } + + const port = new Promise((resolve, reject) => { + portTimer = setTimeout(() => { + reject(new Error('Timeout waiting for port')); + }, 5000); + + server.on('listening', () => { + const address = server.address(); + if (typeof address === 'string') { + resolve(address); + } else { + resolve(assertIsDefined(address).port.toString()); + } + }); + + server.on('error', _ => { + reject(new Error('Error listening to server')); + }); + + server.on('close', () => { + reject(new Error('Closed')); + }); + + server.listen(0); + }); + + port.then(cancelPortTimer, cancelPortTimer); + return port; +} + +function sendFile(res: http.ServerResponse, filepath: string, contentType: string) { + fs.readFile(filepath, (err, body) => { + if (err) { + console.error(err); + res.writeHead(404); + res.end(); + } else { + res.writeHead(200, { + 'Content-Length': body.length, + 'Content-Type': contentType + }); + res.end(body); + } + }); +} + +async function callback(nonce: string, reqUrl: url.Url): Promise { + const query = reqUrl.query; + if (!query || typeof query === 'string') { + throw new Error('No query received.'); + } + + let error = query.error_description || query.error; + + if (!error) { + const state = (query.state as string) || ''; + const receivedNonce = (state.split(',')[1] || '').replace(/ /g, '+'); + if (receivedNonce !== nonce) { + error = 'Nonce does not match.'; + } + } + + const code = query.code as string; + if (!error && code) { + return code; + } + + throw new Error((error as string) || 'No code received.'); +} + +export function createServer(nonce: string) { + type RedirectResult = { req: http.IncomingMessage; res: http.ServerResponse; } | { err: any; res: http.ServerResponse; }; + let deferredRedirect: Deferred; + const redirectPromise = new Promise((resolve, reject) => deferredRedirect = { resolve, reject }); + + type CodeResult = { code: string; res: http.ServerResponse; } | { err: any; res: http.ServerResponse; }; + let deferredCode: Deferred; + const codePromise = new Promise((resolve, reject) => deferredCode = { resolve, reject }); + + const codeTimer = setTimeout(() => { + deferredCode.reject(new Error('Timeout waiting for code')); + }, 5 * 60 * 1000); + + function cancelCodeTimer() { + clearTimeout(codeTimer); + } + + const server = http.createServer(function (req, res) { + const reqUrl = url.parse(req.url!, /* parseQueryString */ true); + switch (reqUrl.pathname) { + case '/signin': + const receivedNonce = ((reqUrl.query.nonce as string) || '').replace(/ /g, '+'); + if (receivedNonce === nonce) { + deferredRedirect.resolve({ req, res }); + } else { + const err = new Error('Nonce does not match.'); + deferredRedirect.resolve({ err, res }); + } + break; + case '/': + sendFile(res, path.join(__dirname, '../media/auth.html'), 'text/html; charset=utf-8'); + break; + case '/auth.css': + sendFile(res, path.join(__dirname, '../media/auth.css'), 'text/css; charset=utf-8'); + break; + case '/callback': + deferredCode.resolve(callback(nonce, reqUrl) + .then(code => ({ code, res }), err => ({ err, res }))); + break; + default: + res.writeHead(404); + res.end(); + break; + } + }); + + codePromise.then(cancelCodeTimer, cancelCodeTimer); + return { + server, + redirectPromise, + codePromise + }; +} diff --git a/extensions/vscode-account/src/extension.ts b/extensions/vscode-account/src/extension.ts new file mode 100644 index 0000000000000..88f5f3133ed5d --- /dev/null +++ b/extensions/vscode-account/src/extension.ts @@ -0,0 +1,69 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { AzureActiveDirectoryService, onDidChangeSessions } from './AADHelper'; + +export const DEFAULT_SCOPES = 'https://management.core.windows.net/.default offline_access'; + +export async function activate(context: vscode.ExtensionContext) { + + const loginService = new AzureActiveDirectoryService(); + + await loginService.initialize(); + + context.subscriptions.push(vscode.authentication.registerAuthenticationProvider({ + id: 'MSA', + displayName: 'Microsoft', + onDidChangeSessions: onDidChangeSessions.event, + getSessions: () => Promise.resolve(loginService.sessions), + login: async (scopes: string[]) => { + try { + await loginService.login(scopes.sort().join(' ')); + return loginService.sessions[0]!; + } catch (e) { + throw e; + } + }, + logout: async (id: string) => { + return loginService.logout(id); + } + })); + + context.subscriptions.push(vscode.commands.registerCommand('microsoft.signin', () => { + return loginService.login(DEFAULT_SCOPES); + })); + + context.subscriptions.push(vscode.commands.registerCommand('microsoft.signout', async () => { + const sessions = loginService.sessions; + if (sessions.length === 0) { + return; + } + + if (sessions.length === 1) { + await loginService.logout(loginService.sessions[0].id); + onDidChangeSessions.fire(); + return; + } + + const selectedSession = await vscode.window.showQuickPick(sessions.map(session => { + return { + id: session.id, + label: session.accountName + }; + })); + + if (selectedSession) { + await loginService.logout(selectedSession.id); + onDidChangeSessions.fire(); + return; + } + })); + + return; +} + +// this method is called when your extension is deactivated +export function deactivate() { } diff --git a/extensions/vscode-account/src/keychain.ts b/extensions/vscode-account/src/keychain.ts new file mode 100644 index 0000000000000..465a160fef78e --- /dev/null +++ b/extensions/vscode-account/src/keychain.ts @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// keytar depends on a native module shipped in vscode, so this is +// how we load it +import * as keytarType from 'keytar'; +import { env } from 'vscode'; +import Logger from './logger'; + +function getKeytar(): Keytar | undefined { + try { + return require('keytar'); + } catch (err) { + console.log(err); + } + + return undefined; +} + +export type Keytar = { + getPassword: typeof keytarType['getPassword']; + setPassword: typeof keytarType['setPassword']; + deletePassword: typeof keytarType['deletePassword']; +}; + +const SERVICE_ID = `${env.uriScheme}-vscode.login`; +const ACCOUNT_ID = 'account'; + +export class Keychain { + private keytar: Keytar; + + constructor() { + const keytar = getKeytar(); + if (!keytar) { + throw new Error('System keychain unavailable'); + } + + this.keytar = keytar; + } + + async setToken(token: string): Promise { + try { + return await this.keytar.setPassword(SERVICE_ID, ACCOUNT_ID, token); + } catch (e) { + // Ignore + Logger.error(`Setting token failed: ${e}`); + } + } + + async getToken(): Promise { + try { + return await this.keytar.getPassword(SERVICE_ID, ACCOUNT_ID); + } catch (e) { + // Ignore + Logger.error(`Getting token failed: ${e}`); + return Promise.resolve(undefined); + } + } + + async deleteToken(): Promise { + try { + return await this.keytar.deletePassword(SERVICE_ID, ACCOUNT_ID); + } catch (e) { + // Ignore + Logger.error(`Deleting token failed: ${e}`); + return Promise.resolve(undefined); + } + } +} + +export const keychain = new Keychain(); diff --git a/extensions/vscode-account/src/logger.ts b/extensions/vscode-account/src/logger.ts new file mode 100644 index 0000000000000..7fdbff51432f0 --- /dev/null +++ b/extensions/vscode-account/src/logger.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; + +type LogLevel = 'Trace' | 'Info' | 'Error'; + +class Log { + private output: vscode.OutputChannel; + + constructor() { + this.output = vscode.window.createOutputChannel('Account'); + } + + private data2String(data: any): string { + if (data instanceof Error) { + return data.stack || data.message; + } + if (data.success === false && data.message) { + return data.message; + } + return data.toString(); + } + + public info(message: string, data?: any): void { + this.logLevel('Info', message, data); + } + + public error(message: string, data?: any): void { + this.logLevel('Error', message, data); + } + + public logLevel(level: LogLevel, message: string, data?: any): void { + this.output.appendLine(`[${level} - ${this.now()}] ${message}`); + if (data) { + this.output.appendLine(this.data2String(data)); + } + } + + private now(): string { + const now = new Date(); + return padLeft(now.getUTCHours() + '', 2, '0') + + ':' + padLeft(now.getMinutes() + '', 2, '0') + + ':' + padLeft(now.getUTCSeconds() + '', 2, '0') + '.' + now.getMilliseconds(); + } +} + +function padLeft(s: string, n: number, pad = ' ') { + return pad.repeat(Math.max(0, n - s.length)) + s; +} + +const Logger = new Log(); +export default Logger; diff --git a/extensions/vscode-account/src/typings/refs.d.ts b/extensions/vscode-account/src/typings/refs.d.ts new file mode 100644 index 0000000000000..c9849d48e083f --- /dev/null +++ b/extensions/vscode-account/src/typings/refs.d.ts @@ -0,0 +1,7 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// diff --git a/src/typings/windows-mutex.d.ts b/extensions/vscode-account/src/utils.ts similarity index 66% rename from src/typings/windows-mutex.d.ts rename to extensions/vscode-account/src/utils.ts index 07c5908def2f7..164f2236221b6 100644 --- a/src/typings/windows-mutex.d.ts +++ b/extensions/vscode-account/src/utils.ts @@ -3,12 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare module 'windows-mutex' { - export class Mutex { - constructor(name: string); - isActive(): boolean; - release(): void; - } - - export function isActive(name: string): boolean; +export function toBase64UrlEncoding(base64string: string) { + return base64string.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); // Need to use base64url encoding } diff --git a/extensions/vscode-account/tsconfig.json b/extensions/vscode-account/tsconfig.json new file mode 100644 index 0000000000000..1225709307b01 --- /dev/null +++ b/extensions/vscode-account/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../shared.tsconfig.json", + "compilerOptions": { + "outDir": "./out", + "experimentalDecorators": true, + "typeRoots": [ + "./node_modules/@types" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/extensions/vscode-account/yarn.lock b/extensions/vscode-account/yarn.lock new file mode 100644 index 0000000000000..3acdda242e971 --- /dev/null +++ b/extensions/vscode-account/yarn.lock @@ -0,0 +1,653 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" + integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== + dependencies: + "@babel/highlight" "^7.8.3" + +"@babel/highlight@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" + integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@types/keytar@^4.0.1": + version "4.4.2" + resolved "https://registry.yarnpkg.com/@types/keytar/-/keytar-4.4.2.tgz#49ef917d6cbb4f19241c0ab50cd35097b5729b32" + integrity sha512-xtQcDj9ruGnMwvSu1E2BH4SFa5Dv2PvSPd0CKEBLN5hEj/v5YpXJY+B6hAfuKIbvEomD7vJTc/P1s1xPNh2kRw== + dependencies: + keytar "*" + +"@types/node@^10.12.21": + version "10.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" + integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +bl@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-3.0.0.tgz#3611ec00579fd18561754360b21e9f784500ff88" + integrity sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A== + dependencies: + readable-stream "^3.0.1" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +builtin-modules@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= + +chalk@^2.0.0, chalk@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chownr@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +commander@^2.12.1: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +decompress-response@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" + integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== + dependencies: + mimic-response "^2.0.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= + +glob@^7.1.1: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +keytar@*: + version "5.0.0" + resolved "https://registry.yarnpkg.com/keytar/-/keytar-5.0.0.tgz#c89b6b7a4608fd7af633d9f8474b1a7eb97cbe6f" + integrity sha512-a5UheK59YOlJf9i+2Osaj/kkH6mK0RCHVMtJ84u6ZfbfRIbOJ/H4b5VlOF/LgNHF6s78dRSBzZnvIuPiBKv6wg== + dependencies: + nan "2.14.0" + prebuild-install "5.3.3" + +mimic-response@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46" + integrity sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +nan@2.14.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +napi-build-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.1.tgz#1381a0f92c39d66bf19852e7873432fc2123e508" + integrity sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA== + +node-abi@^2.7.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.13.0.tgz#e2f2ec444d0aca3ea1b3874b6de41d1665828f63" + integrity sha512-9HrZGFVTR5SOu3PZAnAY2hLO36aW1wmA+FDsVkr85BTST32TLCA1H/AEcatVRAsWLyXS3bqUDYCAjq5/QGuSTA== + dependencies: + semver "^5.4.1" + +noop-logger@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" + integrity sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= + +npmlog@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +prebuild-install@5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.3.tgz#ef4052baac60d465f5ba6bf003c9c1de79b9da8e" + integrity sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g== + dependencies: + detect-libc "^1.0.3" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.0" + mkdirp "^0.5.1" + napi-build-utils "^1.0.1" + node-abi "^2.7.0" + noop-logger "^0.1.1" + npmlog "^4.0.1" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^3.0.3" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + which-pm-runs "^1.0.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^2.0.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.0.1, readable-stream@^3.1.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +resolve@^1.3.2: + version "1.14.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2" + integrity sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ== + dependencies: + path-parse "^1.0.6" + +safe-buffer@^5.0.1, safe-buffer@~5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +semver@^5.3.0, semver@^5.4.1: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +simple-concat@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +simple-get@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" + integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== + dependencies: + decompress-response "^4.2.0" + once "^1.3.1" + simple-concat "^1.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +tar-fs@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad" + integrity sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA== + dependencies: + chownr "^1.1.1" + mkdirp "^0.5.1" + pump "^3.0.0" + tar-stream "^2.0.0" + +tar-stream@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3" + integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw== + dependencies: + bl "^3.0.0" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +tslib@^1.8.0, tslib@^1.8.1: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + +tslint@^5.12.1: + version "5.20.1" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.20.1.tgz#e401e8aeda0152bc44dd07e614034f3f80c67b7d" + integrity sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg== + dependencies: + "@babel/code-frame" "^7.0.0" + builtin-modules "^1.1.1" + chalk "^2.3.0" + commander "^2.12.1" + diff "^4.0.1" + glob "^7.1.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + mkdirp "^0.5.1" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.8.0" + tsutils "^2.29.0" + +tsutils@^2.29.0: + version "2.29.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" + integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== + dependencies: + tslib "^1.8.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +typescript@^3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= diff --git a/extensions/vscode-api-tests/.vscode/launch.json b/extensions/vscode-api-tests/.vscode/launch.json index 8f8a11a2a5e9f..dfce85c8eea63 100644 --- a/extensions/vscode-api-tests/.vscode/launch.json +++ b/extensions/vscode-api-tests/.vscode/launch.json @@ -6,12 +6,16 @@ "name": "Launch Tests", "type": "extensionHost", "request": "launch", - "runtimeExecutable": "${execPath}", - "args": ["${workspaceFolder}/../../", "${workspaceFolder}/testWorkspace", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "out", + "args": [ + "${workspaceFolder}/../../", + "${workspaceFolder}/testWorkspace", + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionTestsPath=${workspaceFolder}/out" + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ], "preLaunchTask": "npm" } ] -} \ No newline at end of file +} diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json index 6ed66a3932b4a..8ac6b2806ca0c 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -7,7 +7,8 @@ "enableProposedApi": true, "private": true, "activationEvents": [ - "onFileSystem:memfs" + "onFileSystem:memfs", + "onDebug" ], "main": "./out/extension", "engines": { @@ -46,23 +47,70 @@ } }, "taskDefinitions": [ - { - "type": "custombuildscript", - "required": [ - "flavor" - ], - "properties": { - "flavor": { - "type": "string", - "description": "The build flavor. Should be either '32' or '64'." - }, - "flags": { - "type": "array", - "description": "Additional build flags." - } + { + "type": "custombuildscript", + "required": [ + "flavor" + ], + "properties": { + "flavor": { + "type": "string", + "description": "The build flavor. Should be either '32' or '64'." + }, + "flags": { + "type": "array", + "description": "Additional build flags." } } - ] + } + ], + "breakpoints": [ + { + "language": "markdown" + } + ], + "debuggers": [ + { + "type": "mock", + "label": "Mock Debug", + "languages": [ + "markdown" + ], + + "configurationAttributes": { + "launch": { + "required": [ + "program" + ], + "properties": { + "program": { + "type": "string", + "description": "Absolute path to a text file.", + "default": "${workspaceFolder}/file.md" + }, + "stopOnEntry": { + "type": "boolean", + "description": "Automatically stop after launch.", + "default": true + }, + "trace": { + "type": "boolean", + "description": "Enable logging of the Debug Adapter Protocol.", + "default": true + } + } + } + }, + "initialConfigurations": [ + { + "type": "mock", + "request": "launch", + "name": "Debug file.md", + "program": "${workspaceFolder}/file.md" + } + ] + } + ] }, "scripts": { "compile": "node ./node_modules/vscode/bin/compile -watch -p ./", diff --git a/extensions/vscode-api-tests/src/extension.ts b/extensions/vscode-api-tests/src/extension.ts index 7d345d9ae9555..5bd7ba43ad648 100644 --- a/extensions/vscode-api-tests/src/extension.ts +++ b/extensions/vscode-api-tests/src/extension.ts @@ -14,16 +14,21 @@ import * as vscode from 'vscode'; +declare const window: unknown; + const textEncoder = new TextEncoder(); const SCHEME = 'memfs'; export function activate(context: vscode.ExtensionContext) { - const memFs = enableFs(context); - enableProblems(context); - enableSearch(context, memFs); - enableTasks(); + if (typeof window !== 'undefined') { // do not run under node.js + const memFs = enableFs(context); + enableProblems(context); + enableSearch(context, memFs); + enableTasks(); + enableDebug(context, memFs); - vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(`memfs:/sample-folder/large.ts`)); + vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(`memfs:/sample-folder/large.ts`)); + } } function enableFs(context: vscode.ExtensionContext): MemFS { @@ -40,7 +45,7 @@ function enableFs(context: vscode.ExtensionContext): MemFS { memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.json`), textEncoder.encode('{ "json": true }'), { create: true, overwrite: true }); memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.ts`), textEncoder.encode('console.log("TypeScript")'), { create: true, overwrite: true }); memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.css`), textEncoder.encode('* { color: green; }'), { create: true, overwrite: true }); - memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.md`), textEncoder.encode('Hello _World_'), { create: true, overwrite: true }); + memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.md`), textEncoder.encode(getDebuggableFile()), { create: true, overwrite: true }); memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.xml`), textEncoder.encode(''), { create: true, overwrite: true }); memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.py`), textEncoder.encode('import base64, sys; base64.decode(open(sys.argv[1], "rb"), open(sys.argv[2], "wb"))'), { create: true, overwrite: true }); memFs.writeFile(vscode.Uri.parse(`memfs:/sample-folder/file.php`), textEncoder.encode('&1\'); ?>'), { create: true, overwrite: true }); @@ -316,6 +321,50 @@ module Mankala { `; } + function getDebuggableFile(): string { + return `# VS Code Mock Debug + +This is a starter sample for developing VS Code debug adapters. + +**Mock Debug** simulates a debug adapter for Visual Studio Code. +It supports *step*, *continue*, *breakpoints*, *exceptions*, and +*variable access* but it is not connected to any real debugger. + +The sample is meant as an educational piece showing how to implement a debug +adapter for VS Code. It can be used as a starting point for developing a real adapter. + +More information about how to develop a new debug adapter can be found +[here](https://code.visualstudio.com/docs/extensions/example-debuggers). +Or discuss debug adapters on Gitter: +[![Gitter Chat](https://img.shields.io/badge/chat-online-brightgreen.svg)](https://gitter.im/Microsoft/vscode) + +## Using Mock Debug + +* Install the **Mock Debug** extension in VS Code. +* Create a new 'program' file 'readme.md' and enter several lines of arbitrary text. +* Switch to the debug viewlet and press the gear dropdown. +* Select the debug environment "Mock Debug". +* Press the green 'play' button to start debugging. + +You can now 'step through' the 'readme.md' file, set and hit breakpoints, and run into exceptions (if the word exception appears in a line). + +![Mock Debug](images/mock-debug.gif) + +## Build and Run + +[![build status](https://travis-ci.org/Microsoft/vscode-mock-debug.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-mock-debug) +[![build status](https://ci.appveyor.com/api/projects/status/empmw5q1tk6h1fly/branch/master?svg=true)](https://ci.appveyor.com/project/weinand/vscode-mock-debug) + + +* Clone the project [https://github.com/Microsoft/vscode-mock-debug.git](https://github.com/Microsoft/vscode-mock-debug.git) +* Open the project folder in VS Code. +* Press 'F5' to build and launch Mock Debug in another VS Code window. In that window: + * Open a new workspace, create a new 'program' file 'readme.md' and enter several lines of arbitrary text. + * Switch to the debug viewlet and press the gear dropdown. + * Select the debug environment "Mock Debug". + * Press 'F5' to start debugging.`; + } + return memFs; } @@ -845,3 +894,3721 @@ export class MemFS implements vscode.FileSystemProvider, vscode.FileSearchProvid return result; } } + +//--------------------------------------------------------------------------- +// DEBUG +//--------------------------------------------------------------------------- + +function enableDebug(context: vscode.ExtensionContext, memFs: MemFS): void { + context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('mock', new MockConfigurationProvider())); + context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('mock', new MockDebugAdapterDescriptorFactory(memFs))); +} + +/** + * Declaration module describing the VS Code debug protocol. + * Auto-generated from json schema. Do not edit manually. + */ +declare module DebugProtocol { + + /** Base class of requests, responses, and events. */ + export interface ProtocolMessage { + /** Sequence number (also known as message ID). For protocol messages of type 'request' this ID can be used to cancel the request. */ + seq: number; + /** Message type. + Values: 'request', 'response', 'event', etc. + */ + type: string; + } + + /** A client or debug adapter initiated request. */ + export interface Request extends ProtocolMessage { + // type: 'request'; + /** The command to execute. */ + command: string; + /** Object containing arguments for the command. */ + arguments?: any; + } + + /** A debug adapter initiated event. */ + export interface Event extends ProtocolMessage { + // type: 'event'; + /** Type of event. */ + event: string; + /** Event-specific information. */ + body?: any; + } + + /** Response for a request. */ + export interface Response extends ProtocolMessage { + // type: 'response'; + /** Sequence number of the corresponding request. */ + request_seq: number; + /** Outcome of the request. + If true, the request was successful and the 'body' attribute may contain the result of the request. + If the value is false, the attribute 'message' contains the error in short form and the 'body' may contain additional information (see 'ErrorResponse.body.error'). + */ + success: boolean; + /** The command requested. */ + command: string; + /** Contains the raw error in short form if 'success' is false. + This raw error might be interpreted by the frontend and is not shown in the UI. + Some predefined values exist. + Values: + 'cancelled': request was cancelled. + etc. + */ + message?: string; + /** Contains request result if success is true and optional error details if success is false. */ + body?: any; + } + + /** On error (whenever 'success' is false), the body can provide more details. */ + export interface ErrorResponse extends Response { + body: { + /** An optional, structured error message. */ + error?: Message; + }; + } + + /** Cancel request; value of command field is 'cancel'. + The 'cancel' request is used by the frontend to indicate that it is no longer interested in the result produced by a specific request issued earlier. + This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honouring this request but there are no guarantees. + The 'cancel' request may return an error if it could not cancel an operation but a frontend should refrain from presenting this error to end users. + A frontend client should only call this request if the capability 'supportsCancelRequest' is true. + The request that got canceled still needs to send a response back. + This can either be a normal result ('success' attribute true) or an error response ('success' attribute false and the 'message' set to 'cancelled'). + Returning partial results from a cancelled request is possible but please note that a frontend client has no generic way for detecting that a response is partial or not. + */ + export interface CancelRequest extends Request { + // command: 'cancel'; + arguments?: CancelArguments; + } + + /** Arguments for 'cancel' request. */ + export interface CancelArguments { + /** The ID (attribute 'seq') of the request to cancel. */ + requestId?: number; + } + + /** Response to 'cancel' request. This is just an acknowledgement, so no body field is required. */ + export interface CancelResponse extends Response { + } + + /** Event message for 'initialized' event type. + This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest). + A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the 'initialize' request has finished). + The sequence of events/requests is as follows: + - adapters sends 'initialized' event (after the 'initialize' request has returned) + - frontend sends zero or more 'setBreakpoints' requests + - frontend sends one 'setFunctionBreakpoints' request + - frontend sends a 'setExceptionBreakpoints' request if one or more 'exceptionBreakpointFilters' have been defined (or if 'supportsConfigurationDoneRequest' is not defined or false) + - frontend sends other future configuration requests + - frontend sends one 'configurationDone' request to indicate the end of the configuration. + */ + export interface InitializedEvent extends Event { + // event: 'initialized'; + } + + /** Event message for 'stopped' event type. + The event indicates that the execution of the debuggee has stopped due to some condition. + This can be caused by a break point previously set, a stepping action has completed, by executing a debugger statement etc. + */ + export interface StoppedEvent extends Event { + // event: 'stopped'; + body: { + /** The reason for the event. + For backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated). + Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', etc. + */ + reason: string; + /** The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and must be translated. */ + description?: string; + /** The thread which was stopped. */ + threadId?: number; + /** A value of true hints to the frontend that this event should not change the focus. */ + preserveFocusHint?: boolean; + /** Additional information. E.g. if reason is 'exception', text contains the exception name. This string is shown in the UI. */ + text?: string; + /** If 'allThreadsStopped' is true, a debug adapter can announce that all threads have stopped. + - The client should use this information to enable that all threads can be expanded to access their stacktraces. + - If the attribute is missing or false, only the thread with the given threadId can be expanded. + */ + allThreadsStopped?: boolean; + }; + } + + /** Event message for 'continued' event type. + The event indicates that the execution of the debuggee has continued. + Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. 'launch' or 'continue'. + It is only necessary to send a 'continued' event if there was no previous request that implied this. + */ + export interface ContinuedEvent extends Event { + // event: 'continued'; + body: { + /** The thread which was continued. */ + threadId: number; + /** If 'allThreadsContinued' is true, a debug adapter can announce that all threads have continued. */ + allThreadsContinued?: boolean; + }; + } + + /** Event message for 'exited' event type. + The event indicates that the debuggee has exited and returns its exit code. + */ + export interface ExitedEvent extends Event { + // event: 'exited'; + body: { + /** The exit code returned from the debuggee. */ + exitCode: number; + }; + } + + /** Event message for 'terminated' event type. + The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited. + */ + export interface TerminatedEvent extends Event { + // event: 'terminated'; + body?: { + /** A debug adapter may set 'restart' to true (or to an arbitrary object) to request that the front end restarts the session. + The value is not interpreted by the client and passed unmodified as an attribute '__restart' to the 'launch' and 'attach' requests. + */ + restart?: any; + }; + } + + /** Event message for 'thread' event type. + The event indicates that a thread has started or exited. + */ + export interface ThreadEvent extends Event { + // event: 'thread'; + body: { + /** The reason for the event. + Values: 'started', 'exited', etc. + */ + reason: string; + /** The identifier of the thread. */ + threadId: number; + }; + } + + /** Event message for 'output' event type. + The event indicates that the target has produced some output. + */ + export interface OutputEvent extends Event { + // event: 'output'; + body: { + /** The output category. If not specified, 'console' is assumed. + Values: 'console', 'stdout', 'stderr', 'telemetry', etc. + */ + category?: string; + /** The output to report. */ + output: string; + /** If an attribute 'variablesReference' exists and its value is > 0, the output contains objects which can be retrieved by passing 'variablesReference' to the 'variables' request. The value should be less than or equal to 2147483647 (2^31 - 1). */ + variablesReference?: number; + /** An optional source location where the output was produced. */ + source?: Source; + /** An optional source location line where the output was produced. */ + line?: number; + /** An optional source location column where the output was produced. */ + column?: number; + /** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */ + data?: any; + }; + } + + /** Event message for 'breakpoint' event type. + The event indicates that some information about a breakpoint has changed. + */ + export interface BreakpointEvent extends Event { + // event: 'breakpoint'; + body: { + /** The reason for the event. + Values: 'changed', 'new', 'removed', etc. + */ + reason: string; + /** The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values. */ + breakpoint: Breakpoint; + }; + } + + /** Event message for 'module' event type. + The event indicates that some information about a module has changed. + */ + export interface ModuleEvent extends Event { + // event: 'module'; + body: { + /** The reason for the event. */ + reason: 'new' | 'changed' | 'removed'; + /** The new, changed, or removed module. In case of 'removed' only the module id is used. */ + module: Module; + }; + } + + /** Event message for 'loadedSource' event type. + The event indicates that some source has been added, changed, or removed from the set of all loaded sources. + */ + export interface LoadedSourceEvent extends Event { + // event: 'loadedSource'; + body: { + /** The reason for the event. */ + reason: 'new' | 'changed' | 'removed'; + /** The new, changed, or removed source. */ + source: Source; + }; + } + + /** Event message for 'process' event type. + The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to. + */ + export interface ProcessEvent extends Event { + // event: 'process'; + body: { + /** The logical name of the process. This is usually the full path to process's executable file. Example: /home/example/myproj/program.js. */ + name: string; + /** The system process id of the debugged process. This property will be missing for non-system processes. */ + systemProcessId?: number; + /** If true, the process is running on the same computer as the debug adapter. */ + isLocalProcess?: boolean; + /** Describes how the debug engine started debugging this process. + 'launch': Process was launched under the debugger. + 'attach': Debugger attached to an existing process. + 'attachForSuspendedLaunch': A project launcher component has launched a new process in a suspended state and then asked the debugger to attach. + */ + startMethod?: 'launch' | 'attach' | 'attachForSuspendedLaunch'; + /** The size of a pointer or address for this process, in bits. This value may be used by clients when formatting addresses for display. */ + pointerSize?: number; + }; + } + + /** Event message for 'capabilities' event type. + The event indicates that one or more capabilities have changed. + Since the capabilities are dependent on the frontend and its UI, it might not be possible to change that at random times (or too late). + Consequently this event has a hint characteristic: a frontend can only be expected to make a 'best effort' in honouring individual capabilities but there are no guarantees. + Only changed capabilities need to be included, all other capabilities keep their values. + */ + export interface CapabilitiesEvent extends Event { + // event: 'capabilities'; + body: { + /** The set of updated capabilities. */ + capabilities: Capabilities; + }; + } + + /** RunInTerminal request; value of command field is 'runInTerminal'. + This request is sent from the debug adapter to the client to run a command in a terminal. This is typically used to launch the debuggee in a terminal provided by the client. + */ + export interface RunInTerminalRequest extends Request { + // command: 'runInTerminal'; + arguments: RunInTerminalRequestArguments; + } + + /** Arguments for 'runInTerminal' request. */ + export interface RunInTerminalRequestArguments { + /** What kind of terminal to launch. */ + kind?: 'integrated' | 'external'; + /** Optional title of the terminal. */ + title?: string; + /** Working directory of the command. */ + cwd: string; + /** List of arguments. The first argument is the command to run. */ + args: string[]; + /** Environment key-value pairs that are added to or removed from the default environment. */ + env?: { [key: string]: string | null; }; + } + + /** Response to 'runInTerminal' request. */ + export interface RunInTerminalResponse extends Response { + body: { + /** The process ID. The value should be less than or equal to 2147483647 (2^31 - 1). */ + processId?: number; + /** The process ID of the terminal shell. The value should be less than or equal to 2147483647 (2^31 - 1). */ + shellProcessId?: number; + }; + } + + /** Initialize request; value of command field is 'initialize'. + The 'initialize' request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. + Until the debug adapter has responded to with an 'initialize' response, the client must not send any additional requests or events to the debug adapter. In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an 'initialize' response. + The 'initialize' request may only be sent once. + */ + export interface InitializeRequest extends Request { + // command: 'initialize'; + arguments: InitializeRequestArguments; + } + + /** Arguments for 'initialize' request. */ + export interface InitializeRequestArguments { + /** The ID of the (frontend) client using this adapter. */ + clientID?: string; + /** The human readable name of the (frontend) client using this adapter. */ + clientName?: string; + /** The ID of the debug adapter. */ + adapterID: string; + /** The ISO-639 locale of the (frontend) client using this adapter, e.g. en-US or de-CH. */ + locale?: string; + /** If true all line numbers are 1-based (default). */ + linesStartAt1?: boolean; + /** If true all column numbers are 1-based (default). */ + columnsStartAt1?: boolean; + /** Determines in what format paths are specified. The default is 'path', which is the native format. + Values: 'path', 'uri', etc. + */ + pathFormat?: string; + /** Client supports the optional type attribute for variables. */ + supportsVariableType?: boolean; + /** Client supports the paging of variables. */ + supportsVariablePaging?: boolean; + /** Client supports the runInTerminal request. */ + supportsRunInTerminalRequest?: boolean; + /** Client supports memory references. */ + supportsMemoryReferences?: boolean; + } + + /** Response to 'initialize' request. */ + export interface InitializeResponse extends Response { + /** The capabilities of this debug adapter. */ + body?: Capabilities; + } + + /** ConfigurationDone request; value of command field is 'configurationDone'. + The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the 'initialized' event). + */ + export interface ConfigurationDoneRequest extends Request { + // command: 'configurationDone'; + arguments?: ConfigurationDoneArguments; + } + + /** Arguments for 'configurationDone' request. */ + export interface ConfigurationDoneArguments { + } + + /** Response to 'configurationDone' request. This is just an acknowledgement, so no body field is required. */ + export interface ConfigurationDoneResponse extends Response { + } + + /** Launch request; value of command field is 'launch'. + The launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if 'noDebug' is true). Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. + */ + export interface LaunchRequest extends Request { + // command: 'launch'; + arguments: LaunchRequestArguments; + } + + /** Arguments for 'launch' request. Additional attributes are implementation specific. */ + export interface LaunchRequestArguments { + /** If noDebug is true the launch request should launch the program without enabling debugging. */ + noDebug?: boolean; + /** Optional data from the previous, restarted session. + The data is sent as the 'restart' attribute of the 'terminated' event. + The client should leave the data intact. + */ + __restart?: any; + } + + /** Response to 'launch' request. This is just an acknowledgement, so no body field is required. */ + export interface LaunchResponse extends Response { + } + + /** Attach request; value of command field is 'attach'. + The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running. Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. + */ + export interface AttachRequest extends Request { + // command: 'attach'; + arguments: AttachRequestArguments; + } + + /** Arguments for 'attach' request. Additional attributes are implementation specific. */ + export interface AttachRequestArguments { + /** Optional data from the previous, restarted session. + The data is sent as the 'restart' attribute of the 'terminated' event. + The client should leave the data intact. + */ + __restart?: any; + } + + /** Response to 'attach' request. This is just an acknowledgement, so no body field is required. */ + export interface AttachResponse extends Response { + } + + /** Restart request; value of command field is 'restart'. + Restarts a debug session. If the capability 'supportsRestartRequest' is missing or has the value false, + the client will implement 'restart' by terminating the debug adapter first and then launching it anew. + A debug adapter can override this default behaviour by implementing a restart request + and setting the capability 'supportsRestartRequest' to true. + */ + export interface RestartRequest extends Request { + // command: 'restart'; + arguments?: RestartArguments; + } + + /** Arguments for 'restart' request. */ + export interface RestartArguments { + } + + /** Response to 'restart' request. This is just an acknowledgement, so no body field is required. */ + export interface RestartResponse extends Response { + } + + /** Disconnect request; value of command field is 'disconnect'. + The 'disconnect' request is sent from the client to the debug adapter in order to stop debugging. It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter. If the debuggee has been started with the 'launch' request, the 'disconnect' request terminates the debuggee. If the 'attach' request was used to connect to the debuggee, 'disconnect' does not terminate the debuggee. This behavior can be controlled with the 'terminateDebuggee' argument (if supported by the debug adapter). + */ + export interface DisconnectRequest extends Request { + // command: 'disconnect'; + arguments?: DisconnectArguments; + } + + /** Arguments for 'disconnect' request. */ + export interface DisconnectArguments { + /** A value of true indicates that this 'disconnect' request is part of a restart sequence. */ + restart?: boolean; + /** Indicates whether the debuggee should be terminated when the debugger is disconnected. + If unspecified, the debug adapter is free to do whatever it thinks is best. + A client can only rely on this attribute being properly honored if a debug adapter returns true for the 'supportTerminateDebuggee' capability. + */ + terminateDebuggee?: boolean; + } + + /** Response to 'disconnect' request. This is just an acknowledgement, so no body field is required. */ + export interface DisconnectResponse extends Response { + } + + /** Terminate request; value of command field is 'terminate'. + The 'terminate' request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself. + */ + export interface TerminateRequest extends Request { + // command: 'terminate'; + arguments?: TerminateArguments; + } + + /** Arguments for 'terminate' request. */ + export interface TerminateArguments { + /** A value of true indicates that this 'terminate' request is part of a restart sequence. */ + restart?: boolean; + } + + /** Response to 'terminate' request. This is just an acknowledgement, so no body field is required. */ + export interface TerminateResponse extends Response { + } + + /** BreakpointLocations request; value of command field is 'breakpointLocations'. + The 'breakpointLocations' request returns all possible locations for source breakpoints in a given range. + */ + export interface BreakpointLocationsRequest extends Request { + // command: 'breakpointLocations'; + arguments?: BreakpointLocationsArguments; + } + + /** Arguments for 'breakpointLocations' request. */ + export interface BreakpointLocationsArguments { + /** The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. */ + source: Source; + /** Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line. */ + line: number; + /** Optional start column of range to search possible breakpoint locations in. If no start column is given, the first column in the start line is assumed. */ + column?: number; + /** Optional end line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line. */ + endLine?: number; + /** Optional end column of range to search possible breakpoint locations in. If no end column is given, then it is assumed to be in the last column of the end line. */ + endColumn?: number; + } + + /** Response to 'breakpointLocations' request. + Contains possible locations for source breakpoints. + */ + export interface BreakpointLocationsResponse extends Response { + body: { + /** Sorted set of possible breakpoint locations. */ + breakpoints: BreakpointLocation[]; + }; + } + + /** SetBreakpoints request; value of command field is 'setBreakpoints'. + Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. + To clear all breakpoint for a source, specify an empty array. + When a breakpoint is hit, a 'stopped' event (with reason 'breakpoint') is generated. + */ + export interface SetBreakpointsRequest extends Request { + // command: 'setBreakpoints'; + arguments: SetBreakpointsArguments; + } + + /** Arguments for 'setBreakpoints' request. */ + export interface SetBreakpointsArguments { + /** The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. */ + source: Source; + /** The code locations of the breakpoints. */ + breakpoints?: SourceBreakpoint[]; + /** Deprecated: The code locations of the breakpoints. */ + lines?: number[]; + /** A value of true indicates that the underlying source has been modified which results in new breakpoint locations. */ + sourceModified?: boolean; + } + + /** Response to 'setBreakpoints' request. + Returned is information about each breakpoint created by this request. + This includes the actual code location and whether the breakpoint could be verified. + The breakpoints returned are in the same order as the elements of the 'breakpoints' + (or the deprecated 'lines') array in the arguments. + */ + export interface SetBreakpointsResponse extends Response { + body: { + /** Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') array in the arguments. */ + breakpoints: Breakpoint[]; + }; + } + + /** SetFunctionBreakpoints request; value of command field is 'setFunctionBreakpoints'. + Replaces all existing function breakpoints with new function breakpoints. + To clear all function breakpoints, specify an empty array. + When a function breakpoint is hit, a 'stopped' event (with reason 'function breakpoint') is generated. + */ + export interface SetFunctionBreakpointsRequest extends Request { + // command: 'setFunctionBreakpoints'; + arguments: SetFunctionBreakpointsArguments; + } + + /** Arguments for 'setFunctionBreakpoints' request. */ + export interface SetFunctionBreakpointsArguments { + /** The function names of the breakpoints. */ + breakpoints: FunctionBreakpoint[]; + } + + /** Response to 'setFunctionBreakpoints' request. + Returned is information about each breakpoint created by this request. + */ + export interface SetFunctionBreakpointsResponse extends Response { + body: { + /** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */ + breakpoints: Breakpoint[]; + }; + } + + /** SetExceptionBreakpoints request; value of command field is 'setExceptionBreakpoints'. + The request configures the debuggers response to thrown exceptions. If an exception is configured to break, a 'stopped' event is fired (with reason 'exception'). + */ + export interface SetExceptionBreakpointsRequest extends Request { + // command: 'setExceptionBreakpoints'; + arguments: SetExceptionBreakpointsArguments; + } + + /** Arguments for 'setExceptionBreakpoints' request. */ + export interface SetExceptionBreakpointsArguments { + /** IDs of checked exception options. The set of IDs is returned via the 'exceptionBreakpointFilters' capability. */ + filters: string[]; + /** Configuration options for selected exceptions. */ + exceptionOptions?: ExceptionOptions[]; + } + + /** Response to 'setExceptionBreakpoints' request. This is just an acknowledgement, so no body field is required. */ + export interface SetExceptionBreakpointsResponse extends Response { + } + + /** DataBreakpointInfo request; value of command field is 'dataBreakpointInfo'. + Obtains information on a possible data breakpoint that could be set on an expression or variable. + */ + export interface DataBreakpointInfoRequest extends Request { + // command: 'dataBreakpointInfo'; + arguments: DataBreakpointInfoArguments; + } + + /** Arguments for 'dataBreakpointInfo' request. */ + export interface DataBreakpointInfoArguments { + /** Reference to the Variable container if the data breakpoint is requested for a child of the container. */ + variablesReference?: number; + /** The name of the Variable's child to obtain data breakpoint information for. If variableReference isn’t provided, this can be an expression. */ + name: string; + } + + /** Response to 'dataBreakpointInfo' request. */ + export interface DataBreakpointInfoResponse extends Response { + body: { + /** An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available. */ + dataId: string | null; + /** UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. */ + description: string; + /** Optional attribute listing the available access types for a potential data breakpoint. A UI frontend could surface this information. */ + accessTypes?: DataBreakpointAccessType[]; + /** Optional attribute indicating that a potential data breakpoint could be persisted across sessions. */ + canPersist?: boolean; + }; + } + + /** SetDataBreakpoints request; value of command field is 'setDataBreakpoints'. + Replaces all existing data breakpoints with new data breakpoints. + To clear all data breakpoints, specify an empty array. + When a data breakpoint is hit, a 'stopped' event (with reason 'data breakpoint') is generated. + */ + export interface SetDataBreakpointsRequest extends Request { + // command: 'setDataBreakpoints'; + arguments: SetDataBreakpointsArguments; + } + + /** Arguments for 'setDataBreakpoints' request. */ + export interface SetDataBreakpointsArguments { + /** The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. */ + breakpoints: DataBreakpoint[]; + } + + /** Response to 'setDataBreakpoints' request. + Returned is information about each breakpoint created by this request. + */ + export interface SetDataBreakpointsResponse extends Response { + body: { + /** Information about the data breakpoints. The array elements correspond to the elements of the input argument 'breakpoints' array. */ + breakpoints: Breakpoint[]; + }; + } + + /** Continue request; value of command field is 'continue'. + The request starts the debuggee to run again. + */ + export interface ContinueRequest extends Request { + // command: 'continue'; + arguments: ContinueArguments; + } + + /** Arguments for 'continue' request. */ + export interface ContinueArguments { + /** Continue execution for the specified thread (if possible). If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true. */ + threadId: number; + } + + /** Response to 'continue' request. */ + export interface ContinueResponse extends Response { + body: { + /** If true, the 'continue' request has ignored the specified thread and continued all threads instead. If this attribute is missing a value of 'true' is assumed for backward compatibility. */ + allThreadsContinued?: boolean; + }; + } + + /** Next request; value of command field is 'next'. + The request starts the debuggee to run again for one step. + The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. + */ + export interface NextRequest extends Request { + // command: 'next'; + arguments: NextArguments; + } + + /** Arguments for 'next' request. */ + export interface NextArguments { + /** Execute 'next' for this thread. */ + threadId: number; + } + + /** Response to 'next' request. This is just an acknowledgement, so no body field is required. */ + export interface NextResponse extends Response { + } + + /** StepIn request; value of command field is 'stepIn'. + The request starts the debuggee to step into a function/method if possible. + If it cannot step into a target, 'stepIn' behaves like 'next'. + The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. + If there are multiple function/method calls (or other targets) on the source line, + the optional argument 'targetId' can be used to control into which target the 'stepIn' should occur. + The list of possible targets for a given source line can be retrieved via the 'stepInTargets' request. + */ + export interface StepInRequest extends Request { + // command: 'stepIn'; + arguments: StepInArguments; + } + + /** Arguments for 'stepIn' request. */ + export interface StepInArguments { + /** Execute 'stepIn' for this thread. */ + threadId: number; + /** Optional id of the target to step into. */ + targetId?: number; + } + + /** Response to 'stepIn' request. This is just an acknowledgement, so no body field is required. */ + export interface StepInResponse extends Response { + } + + /** StepOut request; value of command field is 'stepOut'. + The request starts the debuggee to run again for one step. + The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. + */ + export interface StepOutRequest extends Request { + // command: 'stepOut'; + arguments: StepOutArguments; + } + + /** Arguments for 'stepOut' request. */ + export interface StepOutArguments { + /** Execute 'stepOut' for this thread. */ + threadId: number; + } + + /** Response to 'stepOut' request. This is just an acknowledgement, so no body field is required. */ + export interface StepOutResponse extends Response { + } + + /** StepBack request; value of command field is 'stepBack'. + The request starts the debuggee to run one step backwards. + The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. Clients should only call this request if the capability 'supportsStepBack' is true. + */ + export interface StepBackRequest extends Request { + // command: 'stepBack'; + arguments: StepBackArguments; + } + + /** Arguments for 'stepBack' request. */ + export interface StepBackArguments { + /** Execute 'stepBack' for this thread. */ + threadId: number; + } + + /** Response to 'stepBack' request. This is just an acknowledgement, so no body field is required. */ + export interface StepBackResponse extends Response { + } + + /** ReverseContinue request; value of command field is 'reverseContinue'. + The request starts the debuggee to run backward. Clients should only call this request if the capability 'supportsStepBack' is true. + */ + export interface ReverseContinueRequest extends Request { + // command: 'reverseContinue'; + arguments: ReverseContinueArguments; + } + + /** Arguments for 'reverseContinue' request. */ + export interface ReverseContinueArguments { + /** Execute 'reverseContinue' for this thread. */ + threadId: number; + } + + /** Response to 'reverseContinue' request. This is just an acknowledgement, so no body field is required. */ + export interface ReverseContinueResponse extends Response { + } + + /** RestartFrame request; value of command field is 'restartFrame'. + The request restarts execution of the specified stackframe. + The debug adapter first sends the response and then a 'stopped' event (with reason 'restart') after the restart has completed. + */ + export interface RestartFrameRequest extends Request { + // command: 'restartFrame'; + arguments: RestartFrameArguments; + } + + /** Arguments for 'restartFrame' request. */ + export interface RestartFrameArguments { + /** Restart this stackframe. */ + frameId: number; + } + + /** Response to 'restartFrame' request. This is just an acknowledgement, so no body field is required. */ + export interface RestartFrameResponse extends Response { + } + + /** Goto request; value of command field is 'goto'. + The request sets the location where the debuggee will continue to run. + This makes it possible to skip the execution of code or to executed code again. + The code between the current location and the goto target is not executed but skipped. + The debug adapter first sends the response and then a 'stopped' event with reason 'goto'. + */ + export interface GotoRequest extends Request { + // command: 'goto'; + arguments: GotoArguments; + } + + /** Arguments for 'goto' request. */ + export interface GotoArguments { + /** Set the goto target for this thread. */ + threadId: number; + /** The location where the debuggee will continue to run. */ + targetId: number; + } + + /** Response to 'goto' request. This is just an acknowledgement, so no body field is required. */ + export interface GotoResponse extends Response { + } + + /** Pause request; value of command field is 'pause'. + The request suspends the debuggee. + The debug adapter first sends the response and then a 'stopped' event (with reason 'pause') after the thread has been paused successfully. + */ + export interface PauseRequest extends Request { + // command: 'pause'; + arguments: PauseArguments; + } + + /** Arguments for 'pause' request. */ + export interface PauseArguments { + /** Pause execution for this thread. */ + threadId: number; + } + + /** Response to 'pause' request. This is just an acknowledgement, so no body field is required. */ + export interface PauseResponse extends Response { + } + + /** StackTrace request; value of command field is 'stackTrace'. + The request returns a stacktrace from the current execution state. + */ + export interface StackTraceRequest extends Request { + // command: 'stackTrace'; + arguments: StackTraceArguments; + } + + /** Arguments for 'stackTrace' request. */ + export interface StackTraceArguments { + /** Retrieve the stacktrace for this thread. */ + threadId: number; + /** The index of the first frame to return; if omitted frames start at 0. */ + startFrame?: number; + /** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */ + levels?: number; + /** Specifies details on how to format the stack frames. */ + format?: StackFrameFormat; + } + + /** Response to 'stackTrace' request. */ + export interface StackTraceResponse extends Response { + body: { + /** The frames of the stackframe. If the array has length zero, there are no stackframes available. + This means that there is no location information available. + */ + stackFrames: StackFrame[]; + /** The total number of frames available. */ + totalFrames?: number; + }; + } + + /** Scopes request; value of command field is 'scopes'. + The request returns the variable scopes for a given stackframe ID. + */ + export interface ScopesRequest extends Request { + // command: 'scopes'; + arguments: ScopesArguments; + } + + /** Arguments for 'scopes' request. */ + export interface ScopesArguments { + /** Retrieve the scopes for this stackframe. */ + frameId: number; + } + + /** Response to 'scopes' request. */ + export interface ScopesResponse extends Response { + body: { + /** The scopes of the stackframe. If the array has length zero, there are no scopes available. */ + scopes: Scope[]; + }; + } + + /** Variables request; value of command field is 'variables'. + Retrieves all child variables for the given variable reference. + An optional filter can be used to limit the fetched children to either named or indexed children. + */ + export interface VariablesRequest extends Request { + // command: 'variables'; + arguments: VariablesArguments; + } + + /** Arguments for 'variables' request. */ + export interface VariablesArguments { + /** The Variable reference. */ + variablesReference: number; + /** Optional filter to limit the child variables to either named or indexed. If omitted, both types are fetched. */ + filter?: 'indexed' | 'named'; + /** The index of the first variable to return; if omitted children start at 0. */ + start?: number; + /** The number of variables to return. If count is missing or 0, all variables are returned. */ + count?: number; + /** Specifies details on how to format the Variable values. */ + format?: ValueFormat; + } + + /** Response to 'variables' request. */ + export interface VariablesResponse extends Response { + body: { + /** All (or a range) of variables for the given variable reference. */ + variables: Variable[]; + }; + } + + /** SetVariable request; value of command field is 'setVariable'. + Set the variable with the given name in the variable container to a new value. + */ + export interface SetVariableRequest extends Request { + // command: 'setVariable'; + arguments: SetVariableArguments; + } + + /** Arguments for 'setVariable' request. */ + export interface SetVariableArguments { + /** The reference of the variable container. */ + variablesReference: number; + /** The name of the variable in the container. */ + name: string; + /** The value of the variable. */ + value: string; + /** Specifies details on how to format the response value. */ + format?: ValueFormat; + } + + /** Response to 'setVariable' request. */ + export interface SetVariableResponse extends Response { + body: { + /** The new value of the variable. */ + value: string; + /** The type of the new value. Typically shown in the UI when hovering over the value. */ + type?: string; + /** If variablesReference is > 0, the new value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. The value should be less than or equal to 2147483647 (2^31 - 1). */ + variablesReference?: number; + /** The number of named child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + namedVariables?: number; + /** The number of indexed child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + indexedVariables?: number; + }; + } + + /** Source request; value of command field is 'source'. + The request retrieves the source code for a given source reference. + */ + export interface SourceRequest extends Request { + // command: 'source'; + arguments: SourceArguments; + } + + /** Arguments for 'source' request. */ + export interface SourceArguments { + /** Specifies the source content to load. Either source.path or source.sourceReference must be specified. */ + source?: Source; + /** The reference to the source. This is the same as source.sourceReference. This is provided for backward compatibility since old backends do not understand the 'source' attribute. */ + sourceReference: number; + } + + /** Response to 'source' request. */ + export interface SourceResponse extends Response { + body: { + /** Content of the source reference. */ + content: string; + /** Optional content type (mime type) of the source. */ + mimeType?: string; + }; + } + + /** Threads request; value of command field is 'threads'. + The request retrieves a list of all threads. + */ + export interface ThreadsRequest extends Request { + // command: 'threads'; + } + + /** Response to 'threads' request. */ + export interface ThreadsResponse extends Response { + body: { + /** All threads. */ + threads: Thread[]; + }; + } + + /** TerminateThreads request; value of command field is 'terminateThreads'. + The request terminates the threads with the given ids. + */ + export interface TerminateThreadsRequest extends Request { + // command: 'terminateThreads'; + arguments: TerminateThreadsArguments; + } + + /** Arguments for 'terminateThreads' request. */ + export interface TerminateThreadsArguments { + /** Ids of threads to be terminated. */ + threadIds?: number[]; + } + + /** Response to 'terminateThreads' request. This is just an acknowledgement, so no body field is required. */ + export interface TerminateThreadsResponse extends Response { + } + + /** Modules request; value of command field is 'modules'. + Modules can be retrieved from the debug adapter with the ModulesRequest which can either return all modules or a range of modules to support paging. + */ + export interface ModulesRequest extends Request { + // command: 'modules'; + arguments: ModulesArguments; + } + + /** Arguments for 'modules' request. */ + export interface ModulesArguments { + /** The index of the first module to return; if omitted modules start at 0. */ + startModule?: number; + /** The number of modules to return. If moduleCount is not specified or 0, all modules are returned. */ + moduleCount?: number; + } + + /** Response to 'modules' request. */ + export interface ModulesResponse extends Response { + body: { + /** All modules or range of modules. */ + modules: Module[]; + /** The total number of modules available. */ + totalModules?: number; + }; + } + + /** LoadedSources request; value of command field is 'loadedSources'. + Retrieves the set of all sources currently loaded by the debugged process. + */ + export interface LoadedSourcesRequest extends Request { + // command: 'loadedSources'; + arguments?: LoadedSourcesArguments; + } + + /** Arguments for 'loadedSources' request. */ + export interface LoadedSourcesArguments { + } + + /** Response to 'loadedSources' request. */ + export interface LoadedSourcesResponse extends Response { + body: { + /** Set of loaded sources. */ + sources: Source[]; + }; + } + + /** Evaluate request; value of command field is 'evaluate'. + Evaluates the given expression in the context of the top most stack frame. + The expression has access to any variables and arguments that are in scope. + */ + export interface EvaluateRequest extends Request { + // command: 'evaluate'; + arguments: EvaluateArguments; + } + + /** Arguments for 'evaluate' request. */ + export interface EvaluateArguments { + /** The expression to evaluate. */ + expression: string; + /** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */ + frameId?: number; + /** The context in which the evaluate request is run. + Values: + 'watch': evaluate is run in a watch. + 'repl': evaluate is run from REPL console. + 'hover': evaluate is run from a data hover. + etc. + */ + context?: string; + /** Specifies details on how to format the Evaluate result. */ + format?: ValueFormat; + } + + /** Response to 'evaluate' request. */ + export interface EvaluateResponse extends Response { + body: { + /** The result of the evaluate request. */ + result: string; + /** The optional type of the evaluate result. */ + type?: string; + /** Properties of a evaluate result that can be used to determine how to render the result in the UI. */ + presentationHint?: VariablePresentationHint; + /** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. The value should be less than or equal to 2147483647 (2^31 - 1). */ + variablesReference: number; + /** The number of named child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + namedVariables?: number; + /** The number of indexed child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + indexedVariables?: number; + /** Memory reference to a location appropriate for this result. For pointer type eval results, this is generally a reference to the memory address contained in the pointer. */ + memoryReference?: string; + }; + } + + /** SetExpression request; value of command field is 'setExpression'. + Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value. + The expressions have access to any variables and arguments that are in scope of the specified frame. + */ + export interface SetExpressionRequest extends Request { + // command: 'setExpression'; + arguments: SetExpressionArguments; + } + + /** Arguments for 'setExpression' request. */ + export interface SetExpressionArguments { + /** The l-value expression to assign to. */ + expression: string; + /** The value expression to assign to the l-value expression. */ + value: string; + /** Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. */ + frameId?: number; + /** Specifies how the resulting value should be formatted. */ + format?: ValueFormat; + } + + /** Response to 'setExpression' request. */ + export interface SetExpressionResponse extends Response { + body: { + /** The new value of the expression. */ + value: string; + /** The optional type of the value. */ + type?: string; + /** Properties of a value that can be used to determine how to render the result in the UI. */ + presentationHint?: VariablePresentationHint; + /** If variablesReference is > 0, the value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. The value should be less than or equal to 2147483647 (2^31 - 1). */ + variablesReference?: number; + /** The number of named child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + namedVariables?: number; + /** The number of indexed child variables. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. The value should be less than or equal to 2147483647 (2^31 - 1). + */ + indexedVariables?: number; + }; + } + + /** StepInTargets request; value of command field is 'stepInTargets'. + This request retrieves the possible stepIn targets for the specified stack frame. + These targets can be used in the 'stepIn' request. + The StepInTargets may only be called if the 'supportsStepInTargetsRequest' capability exists and is true. + */ + export interface StepInTargetsRequest extends Request { + // command: 'stepInTargets'; + arguments: StepInTargetsArguments; + } + + /** Arguments for 'stepInTargets' request. */ + export interface StepInTargetsArguments { + /** The stack frame for which to retrieve the possible stepIn targets. */ + frameId: number; + } + + /** Response to 'stepInTargets' request. */ + export interface StepInTargetsResponse extends Response { + body: { + /** The possible stepIn targets of the specified source location. */ + targets: StepInTarget[]; + }; + } + + /** GotoTargets request; value of command field is 'gotoTargets'. + This request retrieves the possible goto targets for the specified source location. + These targets can be used in the 'goto' request. + The GotoTargets request may only be called if the 'supportsGotoTargetsRequest' capability exists and is true. + */ + export interface GotoTargetsRequest extends Request { + // command: 'gotoTargets'; + arguments: GotoTargetsArguments; + } + + /** Arguments for 'gotoTargets' request. */ + export interface GotoTargetsArguments { + /** The source location for which the goto targets are determined. */ + source: Source; + /** The line location for which the goto targets are determined. */ + line: number; + /** An optional column location for which the goto targets are determined. */ + column?: number; + } + + /** Response to 'gotoTargets' request. */ + export interface GotoTargetsResponse extends Response { + body: { + /** The possible goto targets of the specified location. */ + targets: GotoTarget[]; + }; + } + + /** Completions request; value of command field is 'completions'. + Returns a list of possible completions for a given caret position and text. + The CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true. + */ + export interface CompletionsRequest extends Request { + // command: 'completions'; + arguments: CompletionsArguments; + } + + /** Arguments for 'completions' request. */ + export interface CompletionsArguments { + /** Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. */ + frameId?: number; + /** One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion. */ + text: string; + /** The character position for which to determine the completion proposals. */ + column: number; + /** An optional line for which to determine the completion proposals. If missing the first line of the text is assumed. */ + line?: number; + } + + /** Response to 'completions' request. */ + export interface CompletionsResponse extends Response { + body: { + /** The possible completions for . */ + targets: CompletionItem[]; + }; + } + + /** ExceptionInfo request; value of command field is 'exceptionInfo'. + Retrieves the details of the exception that caused this event to be raised. + */ + export interface ExceptionInfoRequest extends Request { + // command: 'exceptionInfo'; + arguments: ExceptionInfoArguments; + } + + /** Arguments for 'exceptionInfo' request. */ + export interface ExceptionInfoArguments { + /** Thread for which exception information should be retrieved. */ + threadId: number; + } + + /** Response to 'exceptionInfo' request. */ + export interface ExceptionInfoResponse extends Response { + body: { + /** ID of the exception that was thrown. */ + exceptionId: string; + /** Descriptive text for the exception provided by the debug adapter. */ + description?: string; + /** Mode that caused the exception notification to be raised. */ + breakMode: ExceptionBreakMode; + /** Detailed information about the exception. */ + details?: ExceptionDetails; + }; + } + + /** ReadMemory request; value of command field is 'readMemory'. + Reads bytes from memory at the provided location. + */ + export interface ReadMemoryRequest extends Request { + // command: 'readMemory'; + arguments: ReadMemoryArguments; + } + + /** Arguments for 'readMemory' request. */ + export interface ReadMemoryArguments { + /** Memory reference to the base location from which data should be read. */ + memoryReference: string; + /** Optional offset (in bytes) to be applied to the reference location before reading data. Can be negative. */ + offset?: number; + /** Number of bytes to read at the specified location and offset. */ + count: number; + } + + /** Response to 'readMemory' request. */ + export interface ReadMemoryResponse extends Response { + body?: { + /** The address of the first byte of data returned. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. */ + address: string; + /** The number of unreadable bytes encountered after the last successfully read byte. This can be used to determine the number of bytes that must be skipped before a subsequent 'readMemory' request will succeed. */ + unreadableBytes?: number; + /** The bytes read from memory, encoded using base64. */ + data?: string; + }; + } + + /** Disassemble request; value of command field is 'disassemble'. + Disassembles code stored at the provided location. + */ + export interface DisassembleRequest extends Request { + // command: 'disassemble'; + arguments: DisassembleArguments; + } + + /** Arguments for 'disassemble' request. */ + export interface DisassembleArguments { + /** Memory reference to the base location containing the instructions to disassemble. */ + memoryReference: string; + /** Optional offset (in bytes) to be applied to the reference location before disassembling. Can be negative. */ + offset?: number; + /** Optional offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative. */ + instructionOffset?: number; + /** Number of instructions to disassemble starting at the specified location and offset. An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. */ + instructionCount: number; + /** If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. */ + resolveSymbols?: boolean; + } + + /** Response to 'disassemble' request. */ + export interface DisassembleResponse extends Response { + body?: { + /** The list of disassembled instructions. */ + instructions: DisassembledInstruction[]; + }; + } + + /** Information about the capabilities of a debug adapter. */ + export interface Capabilities { + /** The debug adapter supports the 'configurationDone' request. */ + supportsConfigurationDoneRequest?: boolean; + /** The debug adapter supports function breakpoints. */ + supportsFunctionBreakpoints?: boolean; + /** The debug adapter supports conditional breakpoints. */ + supportsConditionalBreakpoints?: boolean; + /** The debug adapter supports breakpoints that break execution after a specified number of hits. */ + supportsHitConditionalBreakpoints?: boolean; + /** The debug adapter supports a (side effect free) evaluate request for data hovers. */ + supportsEvaluateForHovers?: boolean; + /** Available filters or options for the setExceptionBreakpoints request. */ + exceptionBreakpointFilters?: ExceptionBreakpointsFilter[]; + /** The debug adapter supports stepping back via the 'stepBack' and 'reverseContinue' requests. */ + supportsStepBack?: boolean; + /** The debug adapter supports setting a variable to a value. */ + supportsSetVariable?: boolean; + /** The debug adapter supports restarting a frame. */ + supportsRestartFrame?: boolean; + /** The debug adapter supports the 'gotoTargets' request. */ + supportsGotoTargetsRequest?: boolean; + /** The debug adapter supports the 'stepInTargets' request. */ + supportsStepInTargetsRequest?: boolean; + /** The debug adapter supports the 'completions' request. */ + supportsCompletionsRequest?: boolean; + /** The set of characters that should trigger completion in a REPL. If not specified, the UI should assume the '.' character. */ + completionTriggerCharacters?: string[]; + /** The debug adapter supports the 'modules' request. */ + supportsModulesRequest?: boolean; + /** The set of additional module information exposed by the debug adapter. */ + additionalModuleColumns?: ColumnDescriptor[]; + /** Checksum algorithms supported by the debug adapter. */ + supportedChecksumAlgorithms?: ChecksumAlgorithm[]; + /** The debug adapter supports the 'restart' request. In this case a client should not implement 'restart' by terminating and relaunching the adapter but by calling the RestartRequest. */ + supportsRestartRequest?: boolean; + /** The debug adapter supports 'exceptionOptions' on the setExceptionBreakpoints request. */ + supportsExceptionOptions?: boolean; + /** The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest. */ + supportsValueFormattingOptions?: boolean; + /** The debug adapter supports the 'exceptionInfo' request. */ + supportsExceptionInfoRequest?: boolean; + /** The debug adapter supports the 'terminateDebuggee' attribute on the 'disconnect' request. */ + supportTerminateDebuggee?: boolean; + /** The debug adapter supports the delayed loading of parts of the stack, which requires that both the 'startFrame' and 'levels' arguments and the 'totalFrames' result of the 'StackTrace' request are supported. */ + supportsDelayedStackTraceLoading?: boolean; + /** The debug adapter supports the 'loadedSources' request. */ + supportsLoadedSourcesRequest?: boolean; + /** The debug adapter supports logpoints by interpreting the 'logMessage' attribute of the SourceBreakpoint. */ + supportsLogPoints?: boolean; + /** The debug adapter supports the 'terminateThreads' request. */ + supportsTerminateThreadsRequest?: boolean; + /** The debug adapter supports the 'setExpression' request. */ + supportsSetExpression?: boolean; + /** The debug adapter supports the 'terminate' request. */ + supportsTerminateRequest?: boolean; + /** The debug adapter supports data breakpoints. */ + supportsDataBreakpoints?: boolean; + /** The debug adapter supports the 'readMemory' request. */ + supportsReadMemoryRequest?: boolean; + /** The debug adapter supports the 'disassemble' request. */ + supportsDisassembleRequest?: boolean; + /** The debug adapter supports the 'cancel' request. */ + supportsCancelRequest?: boolean; + /** The debug adapter supports the 'breakpointLocations' request. */ + supportsBreakpointLocationsRequest?: boolean; + } + + /** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */ + export interface ExceptionBreakpointsFilter { + /** The internal ID of the filter. This value is passed to the setExceptionBreakpoints request. */ + filter: string; + /** The name of the filter. This will be shown in the UI. */ + label: string; + /** Initial value of the filter. If not specified a value 'false' is assumed. */ + default?: boolean; + } + + /** A structured message object. Used to return errors from requests. */ + export interface Message { + /** Unique identifier for the message. */ + id: number; + /** A format string for the message. Embedded variables have the form '{name}'. + If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. + */ + format: string; + /** An object used as a dictionary for looking up the variables in the format string. */ + variables?: { [key: string]: string; }; + /** If true send to telemetry. */ + sendTelemetry?: boolean; + /** If true show user. */ + showUser?: boolean; + /** An optional url where additional information about this message can be found. */ + url?: string; + /** An optional label that is presented to the user as the UI for opening the url. */ + urlLabel?: string; + } + + /** A Module object represents a row in the modules view. + Two attributes are mandatory: an id identifies a module in the modules view and is used in a ModuleEvent for identifying a module for adding, updating or deleting. + The name is used to minimally render the module in the UI. + + Additional attributes can be added to the module. They will show up in the module View if they have a corresponding ColumnDescriptor. + + To avoid an unnecessary proliferation of additional attributes with similar semantics but different names + we recommend to re-use attributes from the 'recommended' list below first, and only introduce new attributes if nothing appropriate could be found. + */ + export interface Module { + /** Unique identifier for the module. */ + id: number | string; + /** A name of the module. */ + name: string; + /** optional but recommended attributes. + always try to use these first before introducing additional attributes. + + Logical full path to the module. The exact definition is implementation defined, but usually this would be a full path to the on-disk file for the module. + */ + path?: string; + /** True if the module is optimized. */ + isOptimized?: boolean; + /** True if the module is considered 'user code' by a debugger that supports 'Just My Code'. */ + isUserCode?: boolean; + /** Version of Module. */ + version?: string; + /** User understandable description of if symbols were found for the module (ex: 'Symbols Loaded', 'Symbols not found', etc. */ + symbolStatus?: string; + /** Logical full path to the symbol file. The exact definition is implementation defined. */ + symbolFilePath?: string; + /** Module created or modified. */ + dateTimeStamp?: string; + /** Address range covered by this module. */ + addressRange?: string; + } + + /** A ColumnDescriptor specifies what module attribute to show in a column of the ModulesView, how to format it, and what the column's label should be. + It is only used if the underlying UI actually supports this level of customization. + */ + export interface ColumnDescriptor { + /** Name of the attribute rendered in this column. */ + attributeName: string; + /** Header UI label of column. */ + label: string; + /** Format to use for the rendered values in this column. TBD how the format strings looks like. */ + format?: string; + /** Datatype of values in this column. Defaults to 'string' if not specified. */ + type?: 'string' | 'number' | 'boolean' | 'unixTimestampUTC'; + /** Width of this column in characters (hint only). */ + width?: number; + } + + /** The ModulesViewDescriptor is the container for all declarative configuration options of a ModuleView. + For now it only specifies the columns to be shown in the modules view. + */ + export interface ModulesViewDescriptor { + columns: ColumnDescriptor[]; + } + + /** A Thread */ + export interface Thread { + /** Unique identifier for the thread. */ + id: number; + /** A name of the thread. */ + name: string; + } + + /** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */ + export interface Source { + /** The short name of the source. Every source returned from the debug adapter has a name. When sending a source to the debug adapter this name is optional. */ + name?: string; + /** The path of the source to be shown in the UI. It is only used to locate and load the content of the source if no sourceReference is specified (or its value is 0). */ + path?: string; + /** If sourceReference > 0 the contents of the source must be retrieved through the SourceRequest (even if a path is specified). A sourceReference is only valid for a session, so it must not be used to persist a source. The value should be less than or equal to 2147483647 (2^31 - 1). */ + sourceReference?: number; + /** An optional hint for how to present the source in the UI. A value of 'deemphasize' can be used to indicate that the source is not available or that it is skipped on stepping. */ + presentationHint?: 'normal' | 'emphasize' | 'deemphasize'; + /** The (optional) origin of this source: possible values 'internal module', 'inlined content from source map', etc. */ + origin?: string; + /** An optional list of sources that are related to this source. These may be the source that generated this source. */ + sources?: Source[]; + /** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */ + adapterData?: any; + /** The checksums associated with this file. */ + checksums?: Checksum[]; + } + + /** A Stackframe contains the source location. */ + export interface StackFrame { + /** An identifier for the stack frame. It must be unique across all threads. This id can be used to retrieve the scopes of the frame with the 'scopesRequest' or to restart the execution of a stackframe. */ + id: number; + /** The name of the stack frame, typically a method name. */ + name: string; + /** The optional source of the frame. */ + source?: Source; + /** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */ + line: number; + /** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */ + column: number; + /** An optional end line of the range covered by the stack frame. */ + endLine?: number; + /** An optional end column of the range covered by the stack frame. */ + endColumn?: number; + /** Optional memory reference for the current instruction pointer in this frame. */ + instructionPointerReference?: string; + /** The module associated with this frame, if any. */ + moduleId?: number | string; + /** An optional hint for how to present this frame in the UI. A value of 'label' can be used to indicate that the frame is an artificial frame that is used as a visual label or separator. A value of 'subtle' can be used to change the appearance of a frame in a 'subtle' way. */ + presentationHint?: 'normal' | 'label' | 'subtle'; + } + + /** A Scope is a named container for variables. Optionally a scope can map to a source or a range within a source. */ + export interface Scope { + /** Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This string is shown in the UI as is and can be translated. */ + name: string; + /** An optional hint for how to present this scope in the UI. If this attribute is missing, the scope is shown with a generic UI. + Values: + 'arguments': Scope contains method arguments. + 'locals': Scope contains local variables. + 'registers': Scope contains registers. Only a single 'registers' scope should be returned from a 'scopes' request. + etc. + */ + presentationHint?: string; + /** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */ + variablesReference: number; + /** The number of named variables in this scope. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + */ + namedVariables?: number; + /** The number of indexed variables in this scope. + The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + */ + indexedVariables?: number; + /** If true, the number of variables in this scope is large or expensive to retrieve. */ + expensive: boolean; + /** Optional source for this scope. */ + source?: Source; + /** Optional start line of the range covered by this scope. */ + line?: number; + /** Optional start column of the range covered by this scope. */ + column?: number; + /** Optional end line of the range covered by this scope. */ + endLine?: number; + /** Optional end column of the range covered by this scope. */ + endColumn?: number; + } + + /** A Variable is a name/value pair. + Optionally a variable can have a 'type' that is shown if space permits or when hovering over the variable's name. + An optional 'kind' is used to render additional properties of the variable, e.g. different icons can be used to indicate that a variable is public or private. + If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest. + If the number of named or indexed children is large, the numbers should be returned via the optional 'namedVariables' and 'indexedVariables' attributes. + The client can use this optional information to present the children in a paged UI and fetch them in chunks. + */ + export interface Variable { + /** The variable's name. */ + name: string; + /** The variable's value. This can be a multi-line text, e.g. for a function the body of a function. */ + value: string; + /** The type of the variable's value. Typically shown in the UI when hovering over the value. */ + type?: string; + /** Properties of a variable that can be used to determine how to render the variable in the UI. */ + presentationHint?: VariablePresentationHint; + /** Optional evaluatable name of this variable which can be passed to the 'EvaluateRequest' to fetch the variable's value. */ + evaluateName?: string; + /** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */ + variablesReference: number; + /** The number of named child variables. + The client can use this optional information to present the children in a paged UI and fetch them in chunks. + */ + namedVariables?: number; + /** The number of indexed child variables. + The client can use this optional information to present the children in a paged UI and fetch them in chunks. + */ + indexedVariables?: number; + /** Optional memory reference for the variable if the variable represents executable code, such as a function pointer. */ + memoryReference?: string; + } + + /** Optional properties of a variable that can be used to determine how to render the variable in the UI. */ + export interface VariablePresentationHint { + /** The kind of variable. Before introducing additional values, try to use the listed values. + Values: + 'property': Indicates that the object is a property. + 'method': Indicates that the object is a method. + 'class': Indicates that the object is a class. + 'data': Indicates that the object is data. + 'event': Indicates that the object is an event. + 'baseClass': Indicates that the object is a base class. + 'innerClass': Indicates that the object is an inner class. + 'interface': Indicates that the object is an interface. + 'mostDerivedClass': Indicates that the object is the most derived class. + 'virtual': Indicates that the object is virtual, that means it is a synthetic object introduced by the adapter for rendering purposes, e.g. an index range for large arrays. + 'dataBreakpoint': Indicates that a data breakpoint is registered for the object. + etc. + */ + kind?: string; + /** Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values. + Values: + 'static': Indicates that the object is static. + 'constant': Indicates that the object is a constant. + 'readOnly': Indicates that the object is read only. + 'rawString': Indicates that the object is a raw string. + 'hasObjectId': Indicates that the object can have an Object ID created for it. + 'canHaveObjectId': Indicates that the object has an Object ID associated with it. + 'hasSideEffects': Indicates that the evaluation had side effects. + etc. + */ + attributes?: string[]; + /** Visibility of variable. Before introducing additional values, try to use the listed values. + Values: 'public', 'private', 'protected', 'internal', 'final', etc. + */ + visibility?: string; + } + + /** Properties of a breakpoint location returned from the 'breakpointLocations' request. */ + export interface BreakpointLocation { + /** Start line of breakpoint location. */ + line: number; + /** Optional start column of breakpoint location. */ + column?: number; + /** Optional end line of breakpoint location if the location covers a range. */ + endLine?: number; + /** Optional end column of breakpoint location if the location covers a range. */ + endColumn?: number; + } + + /** Properties of a breakpoint or logpoint passed to the setBreakpoints request. */ + export interface SourceBreakpoint { + /** The source line of the breakpoint or logpoint. */ + line: number; + /** An optional source column of the breakpoint. */ + column?: number; + /** An optional expression for conditional breakpoints. */ + condition?: string; + /** An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. */ + hitCondition?: string; + /** If this attribute exists and is non-empty, the backend must not 'break' (stop) but log the message instead. Expressions within {} are interpolated. */ + logMessage?: string; + } + + /** Properties of a breakpoint passed to the setFunctionBreakpoints request. */ + export interface FunctionBreakpoint { + /** The name of the function. */ + name: string; + /** An optional expression for conditional breakpoints. */ + condition?: string; + /** An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. */ + hitCondition?: string; + } + + /** This enumeration defines all possible access types for data breakpoints. */ + export type DataBreakpointAccessType = 'read' | 'write' | 'readWrite'; + + /** Properties of a data breakpoint passed to the setDataBreakpoints request. */ + export interface DataBreakpoint { + /** An id representing the data. This id is returned from the dataBreakpointInfo request. */ + dataId: string; + /** The access type of the data. */ + accessType?: DataBreakpointAccessType; + /** An optional expression for conditional breakpoints. */ + condition?: string; + /** An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. */ + hitCondition?: string; + } + + /** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints. */ + export interface Breakpoint { + /** An optional identifier for the breakpoint. It is needed if breakpoint events are used to update or remove breakpoints. */ + id?: number; + /** If true breakpoint could be set (but not necessarily at the desired location). */ + verified: boolean; + /** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */ + message?: string; + /** The source where the breakpoint is located. */ + source?: Source; + /** The start line of the actual range covered by the breakpoint. */ + line?: number; + /** An optional start column of the actual range covered by the breakpoint. */ + column?: number; + /** An optional end line of the actual range covered by the breakpoint. */ + endLine?: number; + /** An optional end column of the actual range covered by the breakpoint. If no end line is given, then the end column is assumed to be in the start line. */ + endColumn?: number; + } + + /** A StepInTarget can be used in the 'stepIn' request and determines into which single target the stepIn request should step. */ + export interface StepInTarget { + /** Unique identifier for a stepIn target. */ + id: number; + /** The name of the stepIn target (shown in the UI). */ + label: string; + } + + /** A GotoTarget describes a code location that can be used as a target in the 'goto' request. + The possible goto targets can be determined via the 'gotoTargets' request. + */ + export interface GotoTarget { + /** Unique identifier for a goto target. This is used in the goto request. */ + id: number; + /** The name of the goto target (shown in the UI). */ + label: string; + /** The line of the goto target. */ + line: number; + /** An optional column of the goto target. */ + column?: number; + /** An optional end line of the range covered by the goto target. */ + endLine?: number; + /** An optional end column of the range covered by the goto target. */ + endColumn?: number; + /** Optional memory reference for the instruction pointer value represented by this target. */ + instructionPointerReference?: string; + } + + /** CompletionItems are the suggestions returned from the CompletionsRequest. */ + export interface CompletionItem { + /** The label of this completion item. By default this is also the text that is inserted when selecting this completion. */ + label: string; + /** If text is not falsy then it is inserted instead of the label. */ + text?: string; + /** A string that should be used when comparing this item with other items. When `falsy` the label is used. */ + sortText?: string; + /** The item's type. Typically the client uses this information to render the item in the UI with an icon. */ + type?: CompletionItemType; + /** This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added. + If missing the text is added at the location specified by the CompletionsRequest's 'column' attribute. + */ + start?: number; + /** This value determines how many characters are overwritten by the completion text. + If missing the value 0 is assumed which results in the completion text being inserted. + */ + length?: number; + } + + /** Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them. */ + export type CompletionItemType = 'method' | 'function' | 'constructor' | 'field' | 'variable' | 'class' | 'interface' | 'module' | 'property' | 'unit' | 'value' | 'enum' | 'keyword' | 'snippet' | 'text' | 'color' | 'file' | 'reference' | 'customcolor'; + + /** Names of checksum algorithms that may be supported by a debug adapter. */ + export type ChecksumAlgorithm = 'MD5' | 'SHA1' | 'SHA256' | 'timestamp'; + + /** The checksum of an item calculated by the specified algorithm. */ + export interface Checksum { + /** The algorithm used to calculate this checksum. */ + algorithm: ChecksumAlgorithm; + /** Value of the checksum. */ + checksum: string; + } + + /** Provides formatting information for a value. */ + export interface ValueFormat { + /** Display the value in hex. */ + hex?: boolean; + } + + /** Provides formatting information for a stack frame. */ + export interface StackFrameFormat extends ValueFormat { + /** Displays parameters for the stack frame. */ + parameters?: boolean; + /** Displays the types of parameters for the stack frame. */ + parameterTypes?: boolean; + /** Displays the names of parameters for the stack frame. */ + parameterNames?: boolean; + /** Displays the values of parameters for the stack frame. */ + parameterValues?: boolean; + /** Displays the line number of the stack frame. */ + line?: boolean; + /** Displays the module of the stack frame. */ + module?: boolean; + /** Includes all stack frames, including those the debug adapter might otherwise hide. */ + includeAll?: boolean; + } + + /** An ExceptionOptions assigns configuration options to a set of exceptions. */ + export interface ExceptionOptions { + /** A path that selects a single or multiple exceptions in a tree. If 'path' is missing, the whole tree is selected. By convention the first segment of the path is a category that is used to group exceptions in the UI. */ + path?: ExceptionPathSegment[]; + /** Condition when a thrown exception should result in a break. */ + breakMode: ExceptionBreakMode; + } + + /** This enumeration defines all possible conditions when a thrown exception should result in a break. + never: never breaks, + always: always breaks, + unhandled: breaks when exception unhandled, + userUnhandled: breaks if the exception is not handled by user code. + */ + export type ExceptionBreakMode = 'never' | 'always' | 'unhandled' | 'userUnhandled'; + + /** An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in a tree of exceptions. If a segment consists of more than one name, it matches the names provided if 'negate' is false or missing or it matches anything except the names provided if 'negate' is true. */ + export interface ExceptionPathSegment { + /** If false or missing this segment matches the names provided, otherwise it matches anything except the names provided. */ + negate?: boolean; + /** Depending on the value of 'negate' the names that should match or not match. */ + names: string[]; + } + + /** Detailed information about an exception that has occurred. */ + export interface ExceptionDetails { + /** Message contained in the exception. */ + message?: string; + /** Short type name of the exception object. */ + typeName?: string; + /** Fully-qualified type name of the exception object. */ + fullTypeName?: string; + /** Optional expression that can be evaluated in the current scope to obtain the exception object. */ + evaluateName?: string; + /** Stack trace at the time the exception was thrown. */ + stackTrace?: string; + /** Details of the exception contained by this exception, if any. */ + innerException?: ExceptionDetails[]; + } + + /** Represents a single disassembled instruction. */ + export interface DisassembledInstruction { + /** The address of the instruction. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. */ + address: string; + /** Optional raw bytes representing the instruction and its operands, in an implementation-defined format. */ + instructionBytes?: string; + /** Text representing the instruction and its operands, in an implementation-defined format. */ + instruction: string; + /** Name of the symbol that corresponds with the location of this instruction, if any. */ + symbol?: string; + /** Source location that corresponds to this instruction, if any. Should always be set (if available) on the first instruction returned, but can be omitted afterwards if this instruction maps to the same source file as the previous instruction. */ + location?: Source; + /** The line within the source location that corresponds to this instruction, if any. */ + line?: number; + /** The column within the line that corresponds to this instruction, if any. */ + column?: number; + /** The end line of the range that corresponds to this instruction, if any. */ + endLine?: number; + /** The end column of the range that corresponds to this instruction, if any. */ + endColumn?: number; + } +} + +//------------------------------------------------------------------------------------------------------------------------------ + +export class Message implements DebugProtocol.ProtocolMessage { + seq: number; + type: string; + + public constructor(type: string) { + this.seq = 0; + this.type = type; + } +} + +export class Response extends Message implements DebugProtocol.Response { + request_seq: number; + success: boolean; + command: string; + + public constructor(request: DebugProtocol.Request, message?: string) { + super('response'); + this.request_seq = request.seq; + this.command = request.command; + if (message) { + this.success = false; + (this).message = message; + } else { + this.success = true; + } + } +} + +export class Event extends Message implements DebugProtocol.Event { + event: string; + + public constructor(event: string, body?: any) { + super('event'); + this.event = event; + if (body) { + (this).body = body; + } + } +} + +//-------------------------------------------------------------------------------------------------------------------------------- + +export class ProtocolServer implements vscode.DebugAdapter { + + private close = new vscode.EventEmitter(); + onClose: vscode.Event = this.close.event; + + private error = new vscode.EventEmitter(); + onError: vscode.Event = this.error.event; + + private sendMessage = new vscode.EventEmitter(); + readonly onDidSendMessage: vscode.Event = this.sendMessage.event; + + private _sequence: number = 1; + private _pendingRequests = new Map void>(); + + + public handleMessage(message: DebugProtocol.ProtocolMessage): void { + this.dispatch(message); + } + + public dispose() { + } + + public sendEvent(event: DebugProtocol.Event): void { + this._send('event', event); + } + + public sendResponse(response: DebugProtocol.Response): void { + if (response.seq > 0) { + console.error(`attempt to send more than one response for command ${response.command}`); + } else { + this._send('response', response); + } + } + + public sendRequest(command: string, args: any, timeout: number, cb: (response: DebugProtocol.Response) => void): void { + + const request: any = { + command: command + }; + if (args && Object.keys(args).length > 0) { + request.arguments = args; + } + + this._send('request', request); + + if (cb) { + this._pendingRequests.set(request.seq, cb); + + const timer = setTimeout(() => { + clearTimeout(timer); + const clb = this._pendingRequests.get(request.seq); + if (clb) { + this._pendingRequests.delete(request.seq); + clb(new Response(request, 'timeout')); + } + }, timeout); + } + } + + // ---- protected ---------------------------------------------------------- + + protected dispatchRequest(_request: DebugProtocol.Request): void { + } + + // ---- private ------------------------------------------------------------ + + private dispatch(msg: DebugProtocol.ProtocolMessage) { + if (msg.type === 'request') { + this.dispatchRequest(msg); + } else if (msg.type === 'response') { + const response = msg; + const clb = this._pendingRequests.get(response.request_seq); + if (clb) { + this._pendingRequests.delete(response.request_seq); + clb(response); + } + } + } + + private _send(typ: 'request' | 'response' | 'event', message: DebugProtocol.ProtocolMessage): void { + + message.type = typ; + message.seq = this._sequence++; + + this.sendMessage.fire(message); + } +} + +//------------------------------------------------------------------------------------------------------------------------------- + +export class Source implements DebugProtocol.Source { + name: string; + path?: string; + sourceReference: number; + + public constructor(name: string, path?: string, id: number = 0, origin?: string, data?: any) { + this.name = name; + this.path = path; + this.sourceReference = id; + if (origin) { + (this).origin = origin; + } + if (data) { + (this).adapterData = data; + } + } +} + +export class Scope implements DebugProtocol.Scope { + name: string; + variablesReference: number; + expensive: boolean; + + public constructor(name: string, reference: number, expensive: boolean = false) { + this.name = name; + this.variablesReference = reference; + this.expensive = expensive; + } +} + +export class StackFrame implements DebugProtocol.StackFrame { + id: number; + source?: Source; + line: number; + column: number; + name: string; + + public constructor(i: number, nm: string, src?: Source, ln: number = 0, col: number = 0) { + this.id = i; + this.source = src; + this.line = ln; + this.column = col; + this.name = nm; + } +} + +export class Thread implements DebugProtocol.Thread { + id: number; + name: string; + + public constructor(id: number, name: string) { + this.id = id; + if (name) { + this.name = name; + } else { + this.name = 'Thread #' + id; + } + } +} + +export class Variable implements DebugProtocol.Variable { + name: string; + value: string; + variablesReference: number; + + public constructor(name: string, value: string, ref: number = 0, indexedVariables?: number, namedVariables?: number) { + this.name = name; + this.value = value; + this.variablesReference = ref; + if (typeof namedVariables === 'number') { + (this).namedVariables = namedVariables; + } + if (typeof indexedVariables === 'number') { + (this).indexedVariables = indexedVariables; + } + } +} + +export class Breakpoint implements DebugProtocol.Breakpoint { + verified: boolean; + + public constructor(verified: boolean, line?: number, column?: number, source?: Source) { + this.verified = verified; + const e: DebugProtocol.Breakpoint = this; + if (typeof line === 'number') { + e.line = line; + } + if (typeof column === 'number') { + e.column = column; + } + if (source) { + e.source = source; + } + } +} + +export class Module implements DebugProtocol.Module { + id: number | string; + name: string; + + public constructor(id: number | string, name: string) { + this.id = id; + this.name = name; + } +} + +export class CompletionItem implements DebugProtocol.CompletionItem { + label: string; + start: number; + length: number; + + public constructor(label: string, start: number, length: number = 0) { + this.label = label; + this.start = start; + this.length = length; + } +} + +export class StoppedEvent extends Event implements DebugProtocol.StoppedEvent { + body: { + reason: string; + }; + + public constructor(reason: string, threadId?: number, exceptionText?: string) { + super('stopped'); + this.body = { + reason: reason + }; + if (typeof threadId === 'number') { + (this as DebugProtocol.StoppedEvent).body.threadId = threadId; + } + if (typeof exceptionText === 'string') { + (this as DebugProtocol.StoppedEvent).body.text = exceptionText; + } + } +} + +export class ContinuedEvent extends Event implements DebugProtocol.ContinuedEvent { + body: { + threadId: number; + }; + + public constructor(threadId: number, allThreadsContinued?: boolean) { + super('continued'); + this.body = { + threadId: threadId + }; + + if (typeof allThreadsContinued === 'boolean') { + (this).body.allThreadsContinued = allThreadsContinued; + } + } +} + +export class InitializedEvent extends Event implements DebugProtocol.InitializedEvent { + public constructor() { + super('initialized'); + } +} + +export class TerminatedEvent extends Event implements DebugProtocol.TerminatedEvent { + public constructor(restart?: any) { + super('terminated'); + if (typeof restart === 'boolean' || restart) { + const e: DebugProtocol.TerminatedEvent = this; + e.body = { + restart: restart + }; + } + } +} + +export class OutputEvent extends Event implements DebugProtocol.OutputEvent { + body: { + category: string, + output: string, + data?: any + }; + + public constructor(output: string, category: string = 'console', data?: any) { + super('output'); + this.body = { + category: category, + output: output + }; + if (data !== undefined) { + this.body.data = data; + } + } +} + +export class ThreadEvent extends Event implements DebugProtocol.ThreadEvent { + body: { + reason: string, + threadId: number + }; + + public constructor(reason: string, threadId: number) { + super('thread'); + this.body = { + reason: reason, + threadId: threadId + }; + } +} + +export class BreakpointEvent extends Event implements DebugProtocol.BreakpointEvent { + body: { + reason: string, + breakpoint: Breakpoint + }; + + public constructor(reason: string, breakpoint: Breakpoint) { + super('breakpoint'); + this.body = { + reason: reason, + breakpoint: breakpoint + }; + } +} + +export class ModuleEvent extends Event implements DebugProtocol.ModuleEvent { + body: { + reason: 'new' | 'changed' | 'removed', + module: Module + }; + + public constructor(reason: 'new' | 'changed' | 'removed', module: Module) { + super('module'); + this.body = { + reason: reason, + module: module + }; + } +} + +export class LoadedSourceEvent extends Event implements DebugProtocol.LoadedSourceEvent { + body: { + reason: 'new' | 'changed' | 'removed', + source: Source + }; + + public constructor(reason: 'new' | 'changed' | 'removed', source: Source) { + super('loadedSource'); + this.body = { + reason: reason, + source: source + }; + } +} + +export class CapabilitiesEvent extends Event implements DebugProtocol.CapabilitiesEvent { + body: { + capabilities: DebugProtocol.Capabilities + }; + + public constructor(capabilities: DebugProtocol.Capabilities) { + super('capabilities'); + this.body = { + capabilities: capabilities + }; + } +} + +export enum ErrorDestination { + User = 1, + Telemetry = 2 +} + +export class DebugSession extends ProtocolServer { + + private _debuggerLinesStartAt1: boolean; + private _debuggerColumnsStartAt1: boolean; + private _debuggerPathsAreURIs: boolean; + + private _clientLinesStartAt1: boolean; + private _clientColumnsStartAt1: boolean; + private _clientPathsAreURIs: boolean; + + protected _isServer: boolean; + + public constructor(obsolete_debuggerLinesAndColumnsStartAt1?: boolean, obsolete_isServer?: boolean) { + super(); + + const linesAndColumnsStartAt1 = typeof obsolete_debuggerLinesAndColumnsStartAt1 === 'boolean' ? obsolete_debuggerLinesAndColumnsStartAt1 : false; + this._debuggerLinesStartAt1 = linesAndColumnsStartAt1; + this._debuggerColumnsStartAt1 = linesAndColumnsStartAt1; + this._debuggerPathsAreURIs = false; + + this._clientLinesStartAt1 = true; + this._clientColumnsStartAt1 = true; + this._clientPathsAreURIs = false; + + this._isServer = typeof obsolete_isServer === 'boolean' ? obsolete_isServer : false; + + this.onClose(() => { + this.shutdown(); + }); + this.onError((_error) => { + this.shutdown(); + }); + } + + public setDebuggerPathFormat(format: string) { + this._debuggerPathsAreURIs = format !== 'path'; + } + + public setDebuggerLinesStartAt1(enable: boolean) { + this._debuggerLinesStartAt1 = enable; + } + + public setDebuggerColumnsStartAt1(enable: boolean) { + this._debuggerColumnsStartAt1 = enable; + } + + public setRunAsServer(enable: boolean) { + this._isServer = enable; + } + + public shutdown(): void { + if (this._isServer) { + // shutdown ignored in server mode + } else { + // TODO@AW + /* + // wait a bit before shutting down + setTimeout(() => { + process.exit(0); + }, 100); + */ + } + } + + protected sendErrorResponse(response: DebugProtocol.Response, codeOrMessage: number | DebugProtocol.Message, format?: string, variables?: any, dest: ErrorDestination = ErrorDestination.User): void { + + let msg: DebugProtocol.Message; + if (typeof codeOrMessage === 'number') { + msg = { + id: codeOrMessage, + format: format + }; + if (variables) { + msg.variables = variables; + } + if (dest & ErrorDestination.User) { + msg.showUser = true; + } + if (dest & ErrorDestination.Telemetry) { + msg.sendTelemetry = true; + } + } else { + msg = codeOrMessage; + } + + response.success = false; + response.message = DebugSession.formatPII(msg.format, true, msg.variables); + if (!response.body) { + response.body = {}; + } + response.body.error = msg; + + this.sendResponse(response); + } + + public runInTerminalRequest(args: DebugProtocol.RunInTerminalRequestArguments, timeout: number, cb: (response: DebugProtocol.Response) => void) { + this.sendRequest('runInTerminal', args, timeout, cb); + } + + protected dispatchRequest(request: DebugProtocol.Request): void { + + const response = new Response(request); + + try { + if (request.command === 'initialize') { + const args = request.arguments; + + if (typeof args.linesStartAt1 === 'boolean') { + this._clientLinesStartAt1 = args.linesStartAt1; + } + if (typeof args.columnsStartAt1 === 'boolean') { + this._clientColumnsStartAt1 = args.columnsStartAt1; + } + + if (args.pathFormat !== 'path') { + this.sendErrorResponse(response, 2018, 'debug adapter only supports native paths', null, ErrorDestination.Telemetry); + } else { + const initializeResponse = response; + initializeResponse.body = {}; + this.initializeRequest(initializeResponse, args); + } + + } else if (request.command === 'launch') { + this.launchRequest(response, request.arguments, request); + + } else if (request.command === 'attach') { + this.attachRequest(response, request.arguments, request); + + } else if (request.command === 'disconnect') { + this.disconnectRequest(response, request.arguments, request); + + } else if (request.command === 'terminate') { + this.terminateRequest(response, request.arguments, request); + + } else if (request.command === 'restart') { + this.restartRequest(response, request.arguments, request); + + } else if (request.command === 'setBreakpoints') { + this.setBreakPointsRequest(response, request.arguments, request); + + } else if (request.command === 'setFunctionBreakpoints') { + this.setFunctionBreakPointsRequest(response, request.arguments, request); + + } else if (request.command === 'setExceptionBreakpoints') { + this.setExceptionBreakPointsRequest(response, request.arguments, request); + + } else if (request.command === 'configurationDone') { + this.configurationDoneRequest(response, request.arguments, request); + + } else if (request.command === 'continue') { + this.continueRequest(response, request.arguments, request); + + } else if (request.command === 'next') { + this.nextRequest(response, request.arguments, request); + + } else if (request.command === 'stepIn') { + this.stepInRequest(response, request.arguments, request); + + } else if (request.command === 'stepOut') { + this.stepOutRequest(response, request.arguments, request); + + } else if (request.command === 'stepBack') { + this.stepBackRequest(response, request.arguments, request); + + } else if (request.command === 'reverseContinue') { + this.reverseContinueRequest(response, request.arguments, request); + + } else if (request.command === 'restartFrame') { + this.restartFrameRequest(response, request.arguments, request); + + } else if (request.command === 'goto') { + this.gotoRequest(response, request.arguments, request); + + } else if (request.command === 'pause') { + this.pauseRequest(response, request.arguments, request); + + } else if (request.command === 'stackTrace') { + this.stackTraceRequest(response, request.arguments, request); + + } else if (request.command === 'scopes') { + this.scopesRequest(response, request.arguments, request); + + } else if (request.command === 'variables') { + this.variablesRequest(response, request.arguments, request); + + } else if (request.command === 'setVariable') { + this.setVariableRequest(response, request.arguments, request); + + } else if (request.command === 'setExpression') { + this.setExpressionRequest(response, request.arguments, request); + + } else if (request.command === 'source') { + this.sourceRequest(response, request.arguments, request); + + } else if (request.command === 'threads') { + this.threadsRequest(response, request); + + } else if (request.command === 'terminateThreads') { + this.terminateThreadsRequest(response, request.arguments, request); + + } else if (request.command === 'evaluate') { + this.evaluateRequest(response, request.arguments, request); + + } else if (request.command === 'stepInTargets') { + this.stepInTargetsRequest(response, request.arguments, request); + + } else if (request.command === 'gotoTargets') { + this.gotoTargetsRequest(response, request.arguments, request); + + } else if (request.command === 'completions') { + this.completionsRequest(response, request.arguments, request); + + } else if (request.command === 'exceptionInfo') { + this.exceptionInfoRequest(response, request.arguments, request); + + } else if (request.command === 'loadedSources') { + this.loadedSourcesRequest(response, request.arguments, request); + + } else if (request.command === 'dataBreakpointInfo') { + this.dataBreakpointInfoRequest(response, request.arguments, request); + + } else if (request.command === 'setDataBreakpoints') { + this.setDataBreakpointsRequest(response, request.arguments, request); + + } else if (request.command === 'readMemory') { + this.readMemoryRequest(response, request.arguments, request); + + } else if (request.command === 'disassemble') { + this.disassembleRequest(response, request.arguments, request); + + } else if (request.command === 'cancel') { + this.cancelRequest(response, request.arguments, request); + + } else if (request.command === 'breakpointLocations') { + this.breakpointLocationsRequest(response, request.arguments, request); + + } else { + this.customRequest(request.command, response, request.arguments, request); + } + } catch (e) { + this.sendErrorResponse(response, 1104, '{_stack}', { _exception: e.message, _stack: e.stack }, ErrorDestination.Telemetry); + } + } + + protected initializeRequest(response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments): void { + + response.body = response.body || {}; + + // This default debug adapter does not support conditional breakpoints. + response.body.supportsConditionalBreakpoints = false; + + // This default debug adapter does not support hit conditional breakpoints. + response.body.supportsHitConditionalBreakpoints = false; + + // This default debug adapter does not support function breakpoints. + response.body.supportsFunctionBreakpoints = false; + + // This default debug adapter implements the 'configurationDone' request. + response.body.supportsConfigurationDoneRequest = true; + + // This default debug adapter does not support hovers based on the 'evaluate' request. + response.body.supportsEvaluateForHovers = false; + + // This default debug adapter does not support the 'stepBack' request. + response.body.supportsStepBack = false; + + // This default debug adapter does not support the 'setVariable' request. + response.body.supportsSetVariable = false; + + // This default debug adapter does not support the 'restartFrame' request. + response.body.supportsRestartFrame = false; + + // This default debug adapter does not support the 'stepInTargets' request. + response.body.supportsStepInTargetsRequest = false; + + // This default debug adapter does not support the 'gotoTargets' request. + response.body.supportsGotoTargetsRequest = false; + + // This default debug adapter does not support the 'completions' request. + response.body.supportsCompletionsRequest = false; + + // This default debug adapter does not support the 'restart' request. + response.body.supportsRestartRequest = false; + + // This default debug adapter does not support the 'exceptionOptions' attribute on the 'setExceptionBreakpoints' request. + response.body.supportsExceptionOptions = false; + + // This default debug adapter does not support the 'format' attribute on the 'variables', 'evaluate', and 'stackTrace' request. + response.body.supportsValueFormattingOptions = false; + + // This debug adapter does not support the 'exceptionInfo' request. + response.body.supportsExceptionInfoRequest = false; + + // This debug adapter does not support the 'TerminateDebuggee' attribute on the 'disconnect' request. + response.body.supportTerminateDebuggee = false; + + // This debug adapter does not support delayed loading of stack frames. + response.body.supportsDelayedStackTraceLoading = false; + + // This debug adapter does not support the 'loadedSources' request. + response.body.supportsLoadedSourcesRequest = false; + + // This debug adapter does not support the 'logMessage' attribute of the SourceBreakpoint. + response.body.supportsLogPoints = false; + + // This debug adapter does not support the 'terminateThreads' request. + response.body.supportsTerminateThreadsRequest = false; + + // This debug adapter does not support the 'setExpression' request. + response.body.supportsSetExpression = false; + + // This debug adapter does not support the 'terminate' request. + response.body.supportsTerminateRequest = false; + + // This debug adapter does not support data breakpoints. + response.body.supportsDataBreakpoints = false; + + /** This debug adapter does not support the 'readMemory' request. */ + response.body.supportsReadMemoryRequest = false; + + /** The debug adapter does not support the 'disassemble' request. */ + response.body.supportsDisassembleRequest = false; + + /** The debug adapter does not support the 'cancel' request. */ + response.body.supportsCancelRequest = false; + + /** The debug adapter does not support the 'breakpointLocations' request. */ + response.body.supportsBreakpointLocationsRequest = false; + + this.sendResponse(response); + } + + protected disconnectRequest(response: DebugProtocol.DisconnectResponse, _args: DebugProtocol.DisconnectArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + this.shutdown(); + } + + protected launchRequest(response: DebugProtocol.LaunchResponse, _args: DebugProtocol.LaunchRequestArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected attachRequest(response: DebugProtocol.AttachResponse, _args: DebugProtocol.AttachRequestArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected terminateRequest(response: DebugProtocol.TerminateResponse, _args: DebugProtocol.TerminateArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected restartRequest(response: DebugProtocol.RestartResponse, _args: DebugProtocol.RestartArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, _args: DebugProtocol.SetBreakpointsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse, _args: DebugProtocol.SetFunctionBreakpointsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setExceptionBreakPointsRequest(response: DebugProtocol.SetExceptionBreakpointsResponse, _args: DebugProtocol.SetExceptionBreakpointsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, _args: DebugProtocol.ConfigurationDoneArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected continueRequest(response: DebugProtocol.ContinueResponse, _args: DebugProtocol.ContinueArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected nextRequest(response: DebugProtocol.NextResponse, _args: DebugProtocol.NextArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected stepInRequest(response: DebugProtocol.StepInResponse, _args: DebugProtocol.StepInArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected stepOutRequest(response: DebugProtocol.StepOutResponse, _args: DebugProtocol.StepOutArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected stepBackRequest(response: DebugProtocol.StepBackResponse, _args: DebugProtocol.StepBackArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected reverseContinueRequest(response: DebugProtocol.ReverseContinueResponse, _args: DebugProtocol.ReverseContinueArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected restartFrameRequest(response: DebugProtocol.RestartFrameResponse, _args: DebugProtocol.RestartFrameArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected gotoRequest(response: DebugProtocol.GotoResponse, _args: DebugProtocol.GotoArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected pauseRequest(response: DebugProtocol.PauseResponse, _args: DebugProtocol.PauseArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected sourceRequest(response: DebugProtocol.SourceResponse, _args: DebugProtocol.SourceArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected threadsRequest(response: DebugProtocol.ThreadsResponse, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected terminateThreadsRequest(response: DebugProtocol.TerminateThreadsResponse, _args: DebugProtocol.TerminateThreadsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, _args: DebugProtocol.StackTraceArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected scopesRequest(response: DebugProtocol.ScopesResponse, _args: DebugProtocol.ScopesArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected variablesRequest(response: DebugProtocol.VariablesResponse, _args: DebugProtocol.VariablesArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setVariableRequest(response: DebugProtocol.SetVariableResponse, _args: DebugProtocol.SetVariableArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setExpressionRequest(response: DebugProtocol.SetExpressionResponse, _args: DebugProtocol.SetExpressionArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected evaluateRequest(response: DebugProtocol.EvaluateResponse, _args: DebugProtocol.EvaluateArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected stepInTargetsRequest(response: DebugProtocol.StepInTargetsResponse, _args: DebugProtocol.StepInTargetsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected gotoTargetsRequest(response: DebugProtocol.GotoTargetsResponse, _args: DebugProtocol.GotoTargetsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected completionsRequest(response: DebugProtocol.CompletionsResponse, _args: DebugProtocol.CompletionsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected exceptionInfoRequest(response: DebugProtocol.ExceptionInfoResponse, _args: DebugProtocol.ExceptionInfoArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected loadedSourcesRequest(response: DebugProtocol.LoadedSourcesResponse, _args: DebugProtocol.LoadedSourcesArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected dataBreakpointInfoRequest(response: DebugProtocol.DataBreakpointInfoResponse, _args: DebugProtocol.DataBreakpointInfoArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected setDataBreakpointsRequest(response: DebugProtocol.SetDataBreakpointsResponse, _args: DebugProtocol.SetDataBreakpointsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected readMemoryRequest(response: DebugProtocol.ReadMemoryResponse, _args: DebugProtocol.ReadMemoryArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected disassembleRequest(response: DebugProtocol.DisassembleResponse, _args: DebugProtocol.DisassembleArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected cancelRequest(response: DebugProtocol.CancelResponse, _args: DebugProtocol.CancelArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + protected breakpointLocationsRequest(response: DebugProtocol.BreakpointLocationsResponse, _args: DebugProtocol.BreakpointLocationsArguments, _request?: DebugProtocol.Request): void { + this.sendResponse(response); + } + + /** + * Override this hook to implement custom requests. + */ + protected customRequest(_command: string, response: DebugProtocol.Response, _args: any, _request?: DebugProtocol.Request): void { + this.sendErrorResponse(response, 1014, 'unrecognized request', null, ErrorDestination.Telemetry); + } + + //---- protected ------------------------------------------------------------------------------------------------- + + protected convertClientLineToDebugger(line: number): number { + if (this._debuggerLinesStartAt1) { + return this._clientLinesStartAt1 ? line : line + 1; + } + return this._clientLinesStartAt1 ? line - 1 : line; + } + + protected convertDebuggerLineToClient(line: number): number { + if (this._debuggerLinesStartAt1) { + return this._clientLinesStartAt1 ? line : line - 1; + } + return this._clientLinesStartAt1 ? line + 1 : line; + } + + protected convertClientColumnToDebugger(column: number): number { + if (this._debuggerColumnsStartAt1) { + return this._clientColumnsStartAt1 ? column : column + 1; + } + return this._clientColumnsStartAt1 ? column - 1 : column; + } + + protected convertDebuggerColumnToClient(column: number): number { + if (this._debuggerColumnsStartAt1) { + return this._clientColumnsStartAt1 ? column : column - 1; + } + return this._clientColumnsStartAt1 ? column + 1 : column; + } + + protected convertClientPathToDebugger(clientPath: string): string { + if (this._clientPathsAreURIs !== this._debuggerPathsAreURIs) { + if (this._clientPathsAreURIs) { + return DebugSession.uri2path(clientPath); + } else { + return DebugSession.path2uri(clientPath); + } + } + return clientPath; + } + + protected convertDebuggerPathToClient(debuggerPath: string): string { + if (this._debuggerPathsAreURIs !== this._clientPathsAreURIs) { + if (this._debuggerPathsAreURIs) { + return DebugSession.uri2path(debuggerPath); + } else { + return DebugSession.path2uri(debuggerPath); + } + } + return debuggerPath; + } + + //---- private ------------------------------------------------------------------------------- + + private static path2uri(path: string): string { + + path = encodeURI(path); + + let uri = new URL(`file:`); // ignore 'path' for now + uri.pathname = path; // now use 'path' to get the correct percent encoding (see https://url.spec.whatwg.org) + return uri.toString(); + } + + private static uri2path(sourceUri: string): string { + + let uri = new URL(sourceUri); + let s = decodeURIComponent(uri.pathname); + return s; + } + + private static _formatPIIRegexp = /{([^}]+)}/g; + + /* + * If argument starts with '_' it is OK to send its value to telemetry. + */ + private static formatPII(format: string, excludePII: boolean, args?: { [key: string]: string }): string { + return format.replace(DebugSession._formatPIIRegexp, function (match, paramName) { + if (excludePII && paramName.length > 0 && paramName[0] !== '_') { + return match; + } + return args && args[paramName] && args.hasOwnProperty(paramName) ? + args[paramName] : + match; + }); + } +} + +//--------------------------------------------------------------------------- + +export class Handles { + + private START_HANDLE = 1000; + + private _nextHandle: number; + private _handleMap = new Map(); + + public constructor(startHandle?: number) { + this._nextHandle = typeof startHandle === 'number' ? startHandle : this.START_HANDLE; + } + + public reset(): void { + this._nextHandle = this.START_HANDLE; + this._handleMap = new Map(); + } + + public create(value: T): number { + const handle = this._nextHandle++; + this._handleMap.set(handle, value); + return handle; + } + + public get(handle: number, dflt?: T): T | undefined { + return this._handleMap.get(handle) || dflt; + } +} + +//--------------------------------------------------------------------------- + +class MockConfigurationProvider implements vscode.DebugConfigurationProvider { + + /** + * Massage a debug configuration just before a debug session is being launched, + * e.g. add all missing attributes to the debug configuration. + */ + resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, _token?: vscode.CancellationToken): vscode.ProviderResult { + + // if launch.json is missing or empty + if (!config.type && !config.request && !config.name) { + const editor = vscode.window.activeTextEditor; + if (editor && editor.document.languageId === 'markdown') { + config.type = 'mock'; + config.name = 'Launch'; + config.request = 'launch'; + config.program = '${file}'; + config.stopOnEntry = true; + } + } + + if (!config.program) { + return vscode.window.showInformationMessage('Cannot find a program to debug').then(_ => { + return undefined; // abort launch + }); + } + + return config; + } +} + +export class MockDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory { + + constructor(private memfs: MemFS) { + } + + createDebugAdapterDescriptor(_session: vscode.DebugSession, _executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult { + return new vscode.DebugAdapterInlineImplementation(new MockDebugSession(this.memfs)); + } +} + +function basename(path: string): string { + const pos = path.lastIndexOf('/'); + if (pos >= 0) { + return path.substring(pos + 1); + } + return path; +} + +function timeout(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +/** + * This interface describes the mock-debug specific launch attributes + * (which are not part of the Debug Adapter Protocol). + * The schema for these attributes lives in the package.json of the mock-debug extension. + * The interface should always match this schema. + */ +interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments { + /** An absolute path to the "program" to debug. */ + program: string; + /** Automatically stop target after launch. If not specified, target does not stop. */ + stopOnEntry?: boolean; + /** enable logging the Debug Adapter Protocol */ + trace?: boolean; +} + +export class MockDebugSession extends DebugSession { + + // we don't support multiple threads, so we can use a hardcoded ID for the default thread + private static THREAD_ID = 1; + + // a Mock runtime (or debugger) + private _runtime: MockRuntime; + + private _variableHandles = new Handles(); + + //private _configurationDone = new Subject(); + + private promiseResolve?: () => void; + private _configurationDone = new Promise((r, _e) => { + this.promiseResolve = r; + setTimeout(r, 1000); + }); + + private _cancelationTokens = new Map(); + private _isLongrunning = new Map(); + + /** + * Creates a new debug adapter that is used for one debug session. + * We configure the default implementation of a debug adapter here. + */ + public constructor(memfs: MemFS) { + + super(); + + // this debugger uses zero-based lines and columns + this.setDebuggerLinesStartAt1(false); + this.setDebuggerColumnsStartAt1(false); + + this._runtime = new MockRuntime(memfs); + + // setup event handlers + this._runtime.onStopOnEntry(() => { + this.sendEvent(new StoppedEvent('entry', MockDebugSession.THREAD_ID)); + }); + this._runtime.onStopOnStep(() => { + this.sendEvent(new StoppedEvent('step', MockDebugSession.THREAD_ID)); + }); + this._runtime.onStopOnBreakpoint(() => { + this.sendEvent(new StoppedEvent('breakpoint', MockDebugSession.THREAD_ID)); + }); + this._runtime.onStopOnDataBreakpoint(() => { + this.sendEvent(new StoppedEvent('data breakpoint', MockDebugSession.THREAD_ID)); + }); + this._runtime.onStopOnException(() => { + this.sendEvent(new StoppedEvent('exception', MockDebugSession.THREAD_ID)); + }); + this._runtime.onBreakpointValidated((bp: MockBreakpoint) => { + this.sendEvent(new BreakpointEvent('changed', { verified: bp.verified, id: bp.id })); + }); + this._runtime.onOutput(oe => { + const e: DebugProtocol.OutputEvent = new OutputEvent(`${oe.text}\n`); + e.body.source = this.createSource(oe.filePath); + e.body.line = this.convertDebuggerLineToClient(oe.line); + e.body.column = this.convertDebuggerColumnToClient(oe.column); + this.sendEvent(e); + }); + this._runtime.onEnd(() => { + this.sendEvent(new TerminatedEvent()); + }); + } + + /** + * The 'initialize' request is the first request called by the frontend + * to interrogate the features the debug adapter provides. + */ + protected initializeRequest(response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments): void { + + // build and return the capabilities of this debug adapter: + response.body = response.body || {}; + + // the adapter implements the configurationDoneRequest. + response.body.supportsConfigurationDoneRequest = true; + + // make VS Code to use 'evaluate' when hovering over source + response.body.supportsEvaluateForHovers = true; + + // make VS Code to show a 'step back' button + response.body.supportsStepBack = true; + + // make VS Code to support data breakpoints + response.body.supportsDataBreakpoints = true; + + // make VS Code to support completion in REPL + response.body.supportsCompletionsRequest = true; + response.body.completionTriggerCharacters = ['.', '[']; + + // make VS Code to send cancelRequests + response.body.supportsCancelRequest = true; + + // make VS Code send the breakpointLocations request + response.body.supportsBreakpointLocationsRequest = true; + + this.sendResponse(response); + + // since this debug adapter can accept configuration requests like 'setBreakpoint' at any time, + // we request them early by sending an 'initializeRequest' to the frontend. + // The frontend will end the configuration sequence by calling 'configurationDone' request. + this.sendEvent(new InitializedEvent()); + } + + /** + * Called at the end of the configuration sequence. + * Indicates that all breakpoints etc. have been sent to the DA and that the 'launch' can start. + */ + protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments): void { + super.configurationDoneRequest(response, args); + + // notify the launchRequest that configuration has finished + //this._configurationDone.notify(); + if (this.promiseResolve) { + this.promiseResolve(); + } + } + + protected async launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments) { + + // make sure to 'Stop' the buffered logging if 'trace' is not set + //logger.setup(args.trace ? Logger.LogLevel.Verbose : Logger.LogLevel.Stop, false); + + // wait until configuration has finished (and configurationDoneRequest has been called) + await this._configurationDone; + + // start the program in the runtime + this._runtime.start(`memfs:${args.program}`, !!args.stopOnEntry); + + this.sendResponse(response); + } + + protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void { + + const path = args.source.path; + const clientLines = args.lines || []; + + // clear all breakpoints for this file + this._runtime.clearBreakpoints(path); + + // set and verify breakpoint locations + const actualBreakpoints = clientLines.map(l => { + let { verified, line, id } = this._runtime.setBreakPoint(path, this.convertClientLineToDebugger(l)); + const bp = new Breakpoint(verified, this.convertDebuggerLineToClient(line)); + bp.id = id; + return bp; + }); + + // send back the actual breakpoint positions + response.body = { + breakpoints: actualBreakpoints + }; + this.sendResponse(response); + } + + protected breakpointLocationsRequest(response: DebugProtocol.BreakpointLocationsResponse, args: DebugProtocol.BreakpointLocationsArguments, _request?: DebugProtocol.Request): void { + + if (args.source.path) { + const bps = this._runtime.getBreakpoints(args.source.path, this.convertClientLineToDebugger(args.line)); + response.body = { + breakpoints: bps.map(col => { + return { + line: args.line, + column: this.convertDebuggerColumnToClient(col) + }; + }) + }; + } else { + response.body = { + breakpoints: [] + }; + } + this.sendResponse(response); + } + + protected threadsRequest(response: DebugProtocol.ThreadsResponse): void { + + // runtime supports no threads so just return a default thread. + response.body = { + threads: [ + new Thread(MockDebugSession.THREAD_ID, 'thread 1') + ] + }; + this.sendResponse(response); + } + + protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments): void { + + const startFrame = typeof args.startFrame === 'number' ? args.startFrame : 0; + const maxLevels = typeof args.levels === 'number' ? args.levels : 1000; + const endFrame = startFrame + maxLevels; + + const stk = this._runtime.stack(startFrame, endFrame); + + response.body = { + stackFrames: stk.frames.map(f => new StackFrame(f.index, f.name, this.createSource(f.file), this.convertDebuggerLineToClient(f.line))), + totalFrames: stk.count + }; + this.sendResponse(response); + } + + protected scopesRequest(response: DebugProtocol.ScopesResponse, _args: DebugProtocol.ScopesArguments): void { + + response.body = { + scopes: [ + new Scope('Local', this._variableHandles.create('local'), false), + new Scope('Global', this._variableHandles.create('global'), true) + ] + }; + this.sendResponse(response); + } + + protected async variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments, request?: DebugProtocol.Request) { + + const variables: DebugProtocol.Variable[] = []; + + if (this._isLongrunning.get(args.variablesReference)) { + // long running + + if (request) { + this._cancelationTokens.set(request.seq, false); + } + + for (let i = 0; i < 100; i++) { + await timeout(1000); + variables.push({ + name: `i_${i}`, + type: 'integer', + value: `${i}`, + variablesReference: 0 + }); + if (request && this._cancelationTokens.get(request.seq)) { + break; + } + } + + if (request) { + this._cancelationTokens.delete(request.seq); + } + + } else { + + const id = this._variableHandles.get(args.variablesReference); + + if (id) { + variables.push({ + name: id + '_i', + type: 'integer', + value: '123', + variablesReference: 0 + }); + variables.push({ + name: id + '_f', + type: 'float', + value: '3.14', + variablesReference: 0 + }); + variables.push({ + name: id + '_s', + type: 'string', + value: 'hello world', + variablesReference: 0 + }); + variables.push({ + name: id + '_o', + type: 'object', + value: 'Object', + variablesReference: this._variableHandles.create(id + '_o') + }); + + // cancelation support for long running requests + const nm = id + '_long_running'; + const ref = this._variableHandles.create(id + '_lr'); + variables.push({ + name: nm, + type: 'object', + value: 'Object', + variablesReference: ref + }); + this._isLongrunning.set(ref, true); + } + } + + response.body = { + variables: variables + }; + this.sendResponse(response); + } + + protected continueRequest(response: DebugProtocol.ContinueResponse, _args: DebugProtocol.ContinueArguments): void { + this._runtime.continue(); + this.sendResponse(response); + } + + protected reverseContinueRequest(response: DebugProtocol.ReverseContinueResponse, _args: DebugProtocol.ReverseContinueArguments): void { + this._runtime.continue(true); + this.sendResponse(response); + } + + protected nextRequest(response: DebugProtocol.NextResponse, _args: DebugProtocol.NextArguments): void { + this._runtime.step(); + this.sendResponse(response); + } + + protected stepBackRequest(response: DebugProtocol.StepBackResponse, _args: DebugProtocol.StepBackArguments): void { + this._runtime.step(true); + this.sendResponse(response); + } + + protected evaluateRequest(response: DebugProtocol.EvaluateResponse, args: DebugProtocol.EvaluateArguments): void { + + let reply: string | undefined = undefined; + + if (args.context === 'repl') { + // 'evaluate' supports to create and delete breakpoints from the 'repl': + const matches = /new +([0-9]+)/.exec(args.expression); + if (matches && matches.length === 2) { + if (this._runtime.sourceFile) { + const mbp = this._runtime.setBreakPoint(this._runtime.sourceFile, this.convertClientLineToDebugger(parseInt(matches[1]))); + const bp = new Breakpoint(mbp.verified, this.convertDebuggerLineToClient(mbp.line), undefined, this.createSource(this._runtime.sourceFile)); + bp.id = mbp.id; + this.sendEvent(new BreakpointEvent('new', bp)); + reply = `breakpoint created`; + } + } else { + const matches = /del +([0-9]+)/.exec(args.expression); + if (matches && matches.length === 2) { + const mbp = this._runtime.sourceFile ? this._runtime.clearBreakPoint(this._runtime.sourceFile, this.convertClientLineToDebugger(parseInt(matches[1]))) : undefined; + if (mbp) { + const bp = new Breakpoint(false); + bp.id = mbp.id; + this.sendEvent(new BreakpointEvent('removed', bp)); + reply = `breakpoint deleted`; + } + } + } + } + + response.body = { + result: reply ? reply : `evaluate(context: '${args.context}', '${args.expression}')`, + variablesReference: 0 + }; + this.sendResponse(response); + } + + protected dataBreakpointInfoRequest(response: DebugProtocol.DataBreakpointInfoResponse, args: DebugProtocol.DataBreakpointInfoArguments): void { + + response.body = { + dataId: null, + description: 'cannot break on data access', + accessTypes: undefined, + canPersist: false + }; + + if (args.variablesReference && args.name) { + const id = this._variableHandles.get(args.variablesReference); + if (id && id.startsWith('global_')) { + response.body.dataId = args.name; + response.body.description = args.name; + response.body.accessTypes = ['read']; + response.body.canPersist = false; + } + } + + this.sendResponse(response); + } + + protected setDataBreakpointsRequest(response: DebugProtocol.SetDataBreakpointsResponse, args: DebugProtocol.SetDataBreakpointsArguments): void { + + // clear all data breakpoints + this._runtime.clearAllDataBreakpoints(); + + response.body = { + breakpoints: [] + }; + + for (let dbp of args.breakpoints) { + // assume that id is the "address" to break on + const ok = this._runtime.setDataBreakpoint(dbp.dataId); + response.body.breakpoints.push({ + verified: ok + }); + } + + this.sendResponse(response); + } + + protected completionsRequest(response: DebugProtocol.CompletionsResponse, _args: DebugProtocol.CompletionsArguments): void { + + response.body = { + targets: [ + { + label: 'item 10', + sortText: '10' + }, + { + label: 'item 1', + sortText: '01' + }, + { + label: 'item 2', + sortText: '02' + } + ] + }; + this.sendResponse(response); + } + + protected cancelRequest(_response: DebugProtocol.CancelResponse, args: DebugProtocol.CancelArguments) { + if (args.requestId) { + this._cancelationTokens.set(args.requestId, true); + } + } + + //---- helpers + + private createSource(filePath: string): Source { + return new Source(basename(filePath), this.convertDebuggerPathToClient(filePath), undefined, undefined, 'mock-adapter-data'); + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------ + + +/*--------------------------------------------------------- + * Copyright (C) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------*/ + +export interface MockBreakpoint { + id: number; + line: number; + verified: boolean; +} + +export interface MockOutputEvent { + text: string; + filePath: string; + line: number; + column: number; +} + +/** + * A Mock runtime with minimal debugger functionality. + */ +export class MockRuntime { + + private stopOnEntry = new vscode.EventEmitter(); + onStopOnEntry: vscode.Event = this.stopOnEntry.event; + + private stopOnStep = new vscode.EventEmitter(); + onStopOnStep: vscode.Event = this.stopOnStep.event; + + private stopOnBreakpoint = new vscode.EventEmitter(); + onStopOnBreakpoint: vscode.Event = this.stopOnBreakpoint.event; + + private stopOnDataBreakpoint = new vscode.EventEmitter(); + onStopOnDataBreakpoint: vscode.Event = this.stopOnDataBreakpoint.event; + + private stopOnException = new vscode.EventEmitter(); + onStopOnException: vscode.Event = this.stopOnException.event; + + private breakpointValidated = new vscode.EventEmitter(); + onBreakpointValidated: vscode.Event = this.breakpointValidated.event; + + private output = new vscode.EventEmitter(); + onOutput: vscode.Event = this.output.event; + + private end = new vscode.EventEmitter(); + onEnd: vscode.Event = this.end.event; + + + // the initial (and one and only) file we are 'debugging' + private _sourceFile?: string; + public get sourceFile() { + return this._sourceFile; + } + + // the contents (= lines) of the one and only file + private _sourceLines: string[] = []; + + // This is the next line that will be 'executed' + private _currentLine = 0; + + // maps from sourceFile to array of Mock breakpoints + private _breakPoints = new Map(); + + // since we want to send breakpoint events, we will assign an id to every event + // so that the frontend can match events with breakpoints. + private _breakpointId = 1; + + private _breakAddresses = new Set(); + + constructor(private memfs: MemFS) { + } + + /** + * Start executing the given program. + */ + public start(program: string, stopOnEntry: boolean) { + + this.loadSource(program); + this._currentLine = -1; + + if (this._sourceFile) { + this.verifyBreakpoints(this._sourceFile); + } + + if (stopOnEntry) { + // we step once + this.step(false, this.stopOnEntry); + } else { + // we just start to run until we hit a breakpoint or an exception + this.continue(); + } + } + + /** + * Continue execution to the end/beginning. + */ + public continue(reverse = false) { + this.run(reverse, undefined); + } + + /** + * Step to the next/previous non empty line. + */ + public step(reverse = false, event = this.stopOnStep) { + this.run(reverse, event); + } + + /** + * Returns a fake 'stacktrace' where every 'stackframe' is a word from the current line. + */ + public stack(startFrame: number, endFrame: number): { frames: any[], count: number } { + + const words = this._sourceLines[this._currentLine].trim().split(/\s+/); + + const frames = new Array(); + // every word of the current line becomes a stack frame. + for (let i = startFrame; i < Math.min(endFrame, words.length); i++) { + const name = words[i]; // use a word of the line as the stackframe name + frames.push({ + index: i, + name: `${name}(${i})`, + file: this._sourceFile, + line: this._currentLine + }); + } + return { + frames: frames, + count: words.length + }; + } + + public getBreakpoints(_path: string, line: number): number[] { + + const l = this._sourceLines[line]; + + let sawSpace = true; + const bps: number[] = []; + for (let i = 0; i < l.length; i++) { + if (l[i] !== ' ') { + if (sawSpace) { + bps.push(i); + sawSpace = false; + } + } else { + sawSpace = true; + } + } + + return bps; + } + + /* + * Set breakpoint in file with given line. + */ + public setBreakPoint(path: string, line: number): MockBreakpoint { + + const bp = { verified: false, line, id: this._breakpointId++ }; + let bps = this._breakPoints.get(path); + if (!bps) { + bps = new Array(); + this._breakPoints.set(path, bps); + } + bps.push(bp); + + this.verifyBreakpoints(path); + + return bp; + } + + /* + * Clear breakpoint in file with given line. + */ + public clearBreakPoint(path: string, line: number): MockBreakpoint | undefined { + let bps = this._breakPoints.get(path); + if (bps) { + const index = bps.findIndex(bp => bp.line === line); + if (index >= 0) { + const bp = bps[index]; + bps.splice(index, 1); + return bp; + } + } + return undefined; + } + + /* + * Clear all breakpoints for file. + */ + public clearBreakpoints(path: string): void { + this._breakPoints.delete(path); + } + + /* + * Set data breakpoint. + */ + public setDataBreakpoint(address: string): boolean { + if (address) { + this._breakAddresses.add(address); + return true; + } + return false; + } + + /* + * Clear all data breakpoints. + */ + public clearAllDataBreakpoints(): void { + this._breakAddresses.clear(); + } + + // private methods + + private loadSource(file: string) { + if (this._sourceFile !== file) { + this._sourceFile = file; + + const _textDecoder = new TextDecoder(); + + const uri = vscode.Uri.parse(file); + const content = _textDecoder.decode(this.memfs.readFile(uri)); + this._sourceLines = content.split('\n'); + + //this._sourceLines = readFileSync(this._sourceFile).toString().split('\n'); + } + } + + /** + * Run through the file. + * If stepEvent is specified only run a single step and emit the stepEvent. + */ + private run(reverse = false, stepEvent?: vscode.EventEmitter): void { + if (reverse) { + for (let ln = this._currentLine - 1; ln >= 0; ln--) { + if (this.fireEventsForLine(ln, stepEvent)) { + this._currentLine = ln; + return; + } + } + // no more lines: stop at first line + this._currentLine = 0; + this.stopOnEntry.fire(); + } else { + for (let ln = this._currentLine + 1; ln < this._sourceLines.length; ln++) { + if (this.fireEventsForLine(ln, stepEvent)) { + this._currentLine = ln; + return; + } + } + // no more lines: run to end + this.end.fire(); + } + } + + private verifyBreakpoints(path: string): void { + let bps = this._breakPoints.get(path); + if (bps) { + this.loadSource(path); + bps.forEach(bp => { + if (!bp.verified && bp.line < this._sourceLines.length) { + const srcLine = this._sourceLines[bp.line].trim(); + + // if a line is empty or starts with '+' we don't allow to set a breakpoint but move the breakpoint down + if (srcLine.length === 0 || srcLine.indexOf('+') === 0) { + bp.line++; + } + // if a line starts with '-' we don't allow to set a breakpoint but move the breakpoint up + if (srcLine.indexOf('-') === 0) { + bp.line--; + } + // don't set 'verified' to true if the line contains the word 'lazy' + // in this case the breakpoint will be verified 'lazy' after hitting it once. + if (srcLine.indexOf('lazy') < 0) { + bp.verified = true; + this.breakpointValidated.fire(bp); + } + } + }); + } + } + + /** + * Fire events if line has a breakpoint or the word 'exception' is found. + * Returns true is execution needs to stop. + */ + private fireEventsForLine(ln: number, stepEvent?: vscode.EventEmitter): boolean { + + const line = this._sourceLines[ln].trim(); + + // if 'log(...)' found in source -> send argument to debug console + const matches = /log\((.*)\)/.exec(line); + if (matches && matches.length === 2) { + if (this._sourceFile) { + this.output.fire({ text: matches[1], filePath: this._sourceFile, line: ln, column: matches.index }); + } + } + + // if a word in a line matches a data breakpoint, fire a 'dataBreakpoint' event + const words = line.split(' '); + for (let word of words) { + if (this._breakAddresses.has(word)) { + this.stopOnDataBreakpoint.fire(); + return true; + } + } + + // if word 'exception' found in source -> throw exception + if (line.indexOf('exception') >= 0) { + this.stopOnException.fire(); + return true; + } + + // is there a breakpoint? + const breakpoints = this._sourceFile ? this._breakPoints.get(this._sourceFile) : undefined; + if (breakpoints) { + const bps = breakpoints.filter(bp => bp.line === ln); + if (bps.length > 0) { + + // send 'stopped' event + this.stopOnBreakpoint.fire(); + + // the following shows the use of 'breakpoint' events to update properties of a breakpoint in the UI + // if breakpoint is not yet verified, verify it now and send a 'breakpoint' update event + if (!bps[0].verified) { + bps[0].verified = true; + this.breakpointValidated.fire(bps[0]); + } + return true; + } + } + + // non-empty line + if (stepEvent && line.length > 0) { + stepEvent.fire(); + return true; + } + + // nothing interesting found -> continue + return false; + } +} diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts index fba9348435c07..739ce38637174 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts @@ -105,7 +105,7 @@ suite('commands namespace tests', () => { }); test('api-command: vscode.open', function () { - let uri = Uri.parse(workspace.workspaceFolders![0].uri.toString() + '/image.png'); + let uri = Uri.parse(workspace.workspaceFolders![0].uri.toString() + '/far.js'); let a = commands.executeCommand('vscode.open', uri).then(() => assert.ok(true), () => assert.ok(false)); let b = commands.executeCommand('vscode.open', uri, ViewColumn.Two).then(() => assert.ok(true), () => assert.ok(false)); let c = commands.executeCommand('vscode.open').then(() => assert.ok(false), () => assert.ok(true)); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/debug.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/debug.test.ts new file mode 100644 index 0000000000000..a7f2f1867d036 --- /dev/null +++ b/extensions/vscode-api-tests/src/singlefolder-tests/debug.test.ts @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { debug, workspace, Disposable, commands, window } from 'vscode'; +import { disposeAll } from '../utils'; +import { basename } from 'path'; + +suite('Debug', function () { + + test('breakpoints', async function () { + assert.equal(debug.breakpoints.length, 0); + let onDidChangeBreakpointsCounter = 0; + const toDispose: Disposable[] = []; + + toDispose.push(debug.onDidChangeBreakpoints(() => { + onDidChangeBreakpointsCounter++; + })); + + debug.addBreakpoints([{ id: '1', enabled: true }, { id: '2', enabled: false, condition: '2 < 5' }]); + assert.equal(onDidChangeBreakpointsCounter, 1); + assert.equal(debug.breakpoints.length, 2); + assert.equal(debug.breakpoints[0].id, '1'); + assert.equal(debug.breakpoints[1].id, '2'); + assert.equal(debug.breakpoints[1].condition, '2 < 5'); + + debug.removeBreakpoints([{ id: '1', enabled: true }]); + assert.equal(onDidChangeBreakpointsCounter, 2); + assert.equal(debug.breakpoints.length, 1); + + debug.removeBreakpoints([{ id: '2', enabled: false }]); + assert.equal(onDidChangeBreakpointsCounter, 3); + assert.equal(debug.breakpoints.length, 0); + + disposeAll(toDispose); + }); + + // @isidor flakey test + test.skip('start debugging', async function () { + assert.equal(debug.activeDebugSession, undefined); + let stoppedEvents = 0; + let variablesReceived: () => void; + let initializedReceived: () => void; + let configurationDoneReceived: () => void; + + const firstVariablesRetrieved = new Promise(resolve => variablesReceived = resolve); + const toDispose: Disposable[] = []; + toDispose.push(debug.registerDebugAdapterTrackerFactory('*', { + createDebugAdapterTracker: () => ({ + onDidSendMessage: m => { + if (m.event === 'stopped') { + stoppedEvents++; + } + if (m.type === 'response' && m.command === 'variables') { + variablesReceived(); + } + if (m.event === 'initialized') { + initializedReceived(); + } + if (m.command === 'configurationDone') { + configurationDoneReceived(); + } + } + }) + })); + + const initializedPromise = new Promise(resolve => initializedReceived = resolve); + const configurationDonePromise = new Promise(resolve => configurationDoneReceived = resolve); + const success = await debug.startDebugging(workspace.workspaceFolders![0], 'Launch debug.js'); + assert.equal(success, true); + await initializedPromise; + await configurationDonePromise; + + await firstVariablesRetrieved; + assert.notEqual(debug.activeDebugSession, undefined); + assert.equal(stoppedEvents, 1); + + const secondVariablesRetrieved = new Promise(resolve => variablesReceived = resolve); + await commands.executeCommand('workbench.action.debug.stepOver'); + await secondVariablesRetrieved; + assert.equal(stoppedEvents, 2); + const editor = window.activeTextEditor; + assert.notEqual(editor, undefined); + assert.equal(basename(editor!.document.fileName), 'debug.js'); + + const thirdVariablesRetrieved = new Promise(resolve => variablesReceived = resolve); + await commands.executeCommand('workbench.action.debug.stepOver'); + await thirdVariablesRetrieved; + assert.equal(stoppedEvents, 3); + + const fourthVariablesRetrieved = new Promise(resolve => variablesReceived = resolve); + await commands.executeCommand('workbench.action.debug.stepInto'); + await fourthVariablesRetrieved; + assert.equal(stoppedEvents, 4); + + const fifthVariablesRetrieved = new Promise(resolve => variablesReceived = resolve); + await commands.executeCommand('workbench.action.debug.stepOut'); + await fifthVariablesRetrieved; + assert.equal(stoppedEvents, 5); + + let sessionTerminated: () => void; + toDispose.push(debug.onDidTerminateDebugSession(() => { + sessionTerminated(); + })); + const sessionTerminatedPromise = new Promise(resolve => sessionTerminated = resolve); + await commands.executeCommand('workbench.action.debug.stop'); + await sessionTerminatedPromise; + disposeAll(toDispose); + }); + + test('start debugging failure', async function () { + let errorCount = 0; + try { + await debug.startDebugging(workspace.workspaceFolders![0], 'non existent'); + } catch (e) { + errorCount++; + } + assert.equal(errorCount, 1); + }); +}); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts index 6431bad3635bd..ce5b0f44aa77f 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts @@ -55,7 +55,7 @@ suite('window namespace tests', () => { } terminal.processId.then(id => { try { - ok(id > 0); + ok(id && id > 0); } catch (e) { done(e); } @@ -378,7 +378,8 @@ suite('window namespace tests', () => { // const terminal = window.createTerminal({ name: 'foo', pty }); // }); - test('should respect dimension overrides', (done) => { + // https://github.com/microsoft/vscode/issues/90437 + test.skip('should respect dimension overrides', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(terminal, term); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts index e785f1d4afbe1..06d284c376224 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/webview.test.ts @@ -3,11 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import 'mocha'; import * as assert from 'assert'; -import * as vscode from 'vscode'; +import 'mocha'; +import * as os from 'os'; import { join } from 'path'; -import { closeAllEditors, disposeAll, conditionalTest } from '../utils'; +import * as vscode from 'vscode'; +import { closeAllEditors, conditionalTest, delay, disposeAll } from '../utils'; const webviewId = 'myWebview'; @@ -332,8 +333,30 @@ suite('Webview tests', () => { webview.webview.postMessage({ value: 1 }); await firstResponse; assert.strictEqual(webview.viewColumn, vscode.ViewColumn.One); - }); + + if (os.platform() === 'darwin') { + conditionalTest('webview can copy text from webview', async () => { + const expectedText = `webview text from: ${Date.now()}!`; + + const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true })); + const ready = getMesssage(webview); + + + webview.webview.html = createHtmlDocumentWithBody(/*html*/` + ${expectedText} + `); + await ready; + + await vscode.commands.executeCommand('editor.action.webvieweditor.copy'); + await delay(200); // Make sure copy has time to reach webview + assert.strictEqual(await vscode.env.clipboard.readText(), expectedText); + }); + } }); function createHtmlDocumentWithBody(body: string): string { diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts index c2ec4f13681f3..620ce762632e4 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts @@ -146,16 +146,19 @@ suite('window namespace tests', () => { }); test('active editor not always correct... #49125', async function () { + const randomFile1 = await createRandomFile(); + const randomFile2 = await createRandomFile(); + const [docA, docB] = await Promise.all([ - workspace.openTextDocument(await createRandomFile()), - workspace.openTextDocument(await createRandomFile()), + workspace.openTextDocument(randomFile1), + workspace.openTextDocument(randomFile2) ]); for (let c = 0; c < 4; c++) { let editorA = await window.showTextDocument(docA, ViewColumn.One); - assert(window.activeTextEditor === editorA); + assert.equal(window.activeTextEditor, editorA); let editorB = await window.showTextDocument(docB, ViewColumn.Two); - assert(window.activeTextEditor === editorB); + assert.equal(window.activeTextEditor, editorB); } }); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.event.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.event.test.ts index 070b6818d7282..58f0b48f126e8 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.event.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.event.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { createRandomFile } from '../utils'; +import { createRandomFile, withLogDisabled } from '../utils'; suite('workspace-event', () => { @@ -36,14 +36,58 @@ suite('workspace-event', () => { assert.ok(success); assert.ok(onWillCreate); - assert.equal(onWillCreate?.creating.length, 1); - assert.equal(onWillCreate?.creating[0].toString(), newUri.toString()); + assert.equal(onWillCreate?.files.length, 1); + assert.equal(onWillCreate?.files[0].toString(), newUri.toString()); assert.ok(onDidCreate); - assert.equal(onDidCreate?.created.length, 1); - assert.equal(onDidCreate?.created[0].toString(), newUri.toString()); + assert.equal(onDidCreate?.files.length, 1); + assert.equal(onDidCreate?.files[0].toString(), newUri.toString()); }); + test('onWillCreate/onDidCreate, make changes, edit another file', async function () { + + const base = await createRandomFile(); + const baseDoc = await vscode.workspace.openTextDocument(base); + + const newUri = base.with({ path: base.path + '-foo' }); + + disposables.push(vscode.workspace.onWillCreateFiles(e => { + const ws = new vscode.WorkspaceEdit(); + ws.insert(base, new vscode.Position(0, 0), 'HALLO_NEW'); + e.waitUntil(Promise.resolve(ws)); + })); + + const edit = new vscode.WorkspaceEdit(); + edit.createFile(newUri); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); + + assert.equal(baseDoc.getText(), 'HALLO_NEW'); + }); + + test('onWillCreate/onDidCreate, make changes, edit new file fails', withLogDisabled(async function () { + + const base = await createRandomFile(); + + const newUri = base.with({ path: base.path + '-foo' }); + + disposables.push(vscode.workspace.onWillCreateFiles(e => { + const ws = new vscode.WorkspaceEdit(); + ws.insert(e.files[0], new vscode.Position(0, 0), 'nope'); + e.waitUntil(Promise.resolve(ws)); + })); + + const edit = new vscode.WorkspaceEdit(); + edit.createFile(newUri); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); + + assert.equal((await vscode.workspace.fs.readFile(newUri)).toString(), ''); + assert.equal((await vscode.workspace.openTextDocument(newUri)).getText(), ''); + })); + test('onWillDelete/onDidDelete', async function () { const base = await createRandomFile(); @@ -61,12 +105,72 @@ suite('workspace-event', () => { assert.ok(success); assert.ok(onWilldelete); - assert.equal(onWilldelete?.deleting.length, 1); - assert.equal(onWilldelete?.deleting[0].toString(), base.toString()); + assert.equal(onWilldelete?.files.length, 1); + assert.equal(onWilldelete?.files[0].toString(), base.toString()); assert.ok(onDiddelete); - assert.equal(onDiddelete?.deleted.length, 1); - assert.equal(onDiddelete?.deleted[0].toString(), base.toString()); + assert.equal(onDiddelete?.files.length, 1); + assert.equal(onDiddelete?.files[0].toString(), base.toString()); + }); + + test('onWillDelete/onDidDelete, make changes', async function () { + + const base = await createRandomFile(); + const newUri = base.with({ path: base.path + '-NEW' }); + + disposables.push(vscode.workspace.onWillDeleteFiles(e => { + + const edit = new vscode.WorkspaceEdit(); + edit.createFile(newUri); + edit.insert(newUri, new vscode.Position(0, 0), 'hahah'); + e.waitUntil(Promise.resolve(edit)); + })); + + const edit = new vscode.WorkspaceEdit(); + edit.deleteFile(base); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); + }); + + test('onWillDelete/onDidDelete, make changes, del another file', async function () { + + const base = await createRandomFile(); + const base2 = await createRandomFile(); + disposables.push(vscode.workspace.onWillDeleteFiles(e => { + if (e.files[0].toString() === base.toString()) { + const edit = new vscode.WorkspaceEdit(); + edit.deleteFile(base2); + e.waitUntil(Promise.resolve(edit)); + } + })); + + const edit = new vscode.WorkspaceEdit(); + edit.deleteFile(base); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); + + + }); + + test('onWillDelete/onDidDelete, make changes, double delete', async function () { + + const base = await createRandomFile(); + let cnt = 0; + disposables.push(vscode.workspace.onWillDeleteFiles(e => { + if (++cnt === 0) { + const edit = new vscode.WorkspaceEdit(); + edit.deleteFile(e.files[0]); + e.waitUntil(Promise.resolve(edit)); + } + })); + + const edit = new vscode.WorkspaceEdit(); + edit.deleteFile(base); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); }); test('onWillRename/onDidRename', async function () { @@ -87,19 +191,39 @@ suite('workspace-event', () => { assert.ok(success); assert.ok(onWillRename); - assert.equal(onWillRename?.renaming.length, 1); - assert.equal(onWillRename?.renaming[0].oldUri.toString(), oldUri.toString()); - assert.equal(onWillRename?.renaming[0].newUri.toString(), newUri.toString()); + assert.equal(onWillRename?.files.length, 1); + assert.equal(onWillRename?.files[0].oldUri.toString(), oldUri.toString()); + assert.equal(onWillRename?.files[0].newUri.toString(), newUri.toString()); assert.ok(onDidRename); - assert.equal(onDidRename?.renamed.length, 1); - assert.equal(onDidRename?.renamed[0].oldUri.toString(), oldUri.toString()); - assert.equal(onDidRename?.renamed[0].newUri.toString(), newUri.toString()); + assert.equal(onDidRename?.files.length, 1); + assert.equal(onDidRename?.files[0].oldUri.toString(), oldUri.toString()); + assert.equal(onDidRename?.files[0].newUri.toString(), newUri.toString()); + }); + + test('onWillRename - make changes (saved file)', function () { + return testOnWillRename(false); + }); + + test('onWillRename - make changes (dirty file)', function () { + return testOnWillRename(true); }); - test('onWillRename - make changes', async function () { + async function testOnWillRename(withDirtyFile: boolean): Promise { const oldUri = await createRandomFile('BAR'); + + if (withDirtyFile) { + const edit = new vscode.WorkspaceEdit(); + edit.insert(oldUri, new vscode.Position(0, 0), 'BAR'); + + const success = await vscode.workspace.applyEdit(edit); + assert.ok(success); + + const oldDocument = await vscode.workspace.openTextDocument(oldUri); + assert.ok(oldDocument.isDirty); + } + const newUri = oldUri.with({ path: oldUri.path + '-NEW' }); const anotherFile = await createRandomFile('BAR'); @@ -109,7 +233,7 @@ suite('workspace-event', () => { disposables.push(vscode.workspace.onWillRenameFiles(e => { onWillRename = e; const edit = new vscode.WorkspaceEdit(); - edit.insert(e.renaming[0].oldUri, new vscode.Position(0, 0), 'FOO'); + edit.insert(e.files[0].oldUri, new vscode.Position(0, 0), 'FOO'); edit.replace(anotherFile, new vscode.Range(0, 0, 0, 3), 'FARBOO'); e.waitUntil(Promise.resolve(edit)); })); @@ -121,11 +245,17 @@ suite('workspace-event', () => { assert.ok(success); assert.ok(onWillRename); - assert.equal(onWillRename?.renaming.length, 1); - assert.equal(onWillRename?.renaming[0].oldUri.toString(), oldUri.toString()); - assert.equal(onWillRename?.renaming[0].newUri.toString(), newUri.toString()); + assert.equal(onWillRename?.files.length, 1); + assert.equal(onWillRename?.files[0].oldUri.toString(), oldUri.toString()); + assert.equal(onWillRename?.files[0].newUri.toString(), newUri.toString()); - assert.equal((await vscode.workspace.openTextDocument(newUri)).getText(), 'FOOBAR'); - assert.equal((await vscode.workspace.openTextDocument(anotherFile)).getText(), 'FARBOO'); - }); + const newDocument = await vscode.workspace.openTextDocument(newUri); + const anotherDocument = await vscode.workspace.openTextDocument(anotherFile); + + assert.equal(newDocument.getText(), withDirtyFile ? 'FOOBARBAR' : 'FOOBAR'); + assert.equal(anotherDocument.getText(), 'FARBOO'); + + assert.ok(newDocument.isDirty); + assert.ok(anotherDocument.isDirty); + } }); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts index 7d552df04a81b..f3c69fbbe67f8 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts @@ -140,4 +140,42 @@ suite('workspace-fs', () => { assert.equal(e.name, vscode.FileSystemError.Unavailable().name); } }); + + test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177', async function () { + const entries = await vscode.workspace.fs.readDirectory(root); + assert.ok(entries.length > 0); + + const someFolder = root.with({ path: posix.join(root.path, '6b1f9d664a92') }); + + try { + await vscode.workspace.fs.delete(someFolder, { recursive: true }); + assert.ok(false); + } catch (err) { + assert.ok(true); + } + }); + + test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177', async function () { + const entries = await vscode.workspace.fs.readDirectory(root); + assert.ok(entries.length > 0); + + const folder = root.with({ path: posix.join(root.path, 'folder') }); + const file = root.with({ path: posix.join(root.path, 'folder/file') }); + + await vscode.workspace.fs.createDirectory(folder); + await vscode.workspace.fs.writeFile(file, Buffer.from('FOO')); + + const someFolder = root.with({ path: posix.join(root.path, '6b1f9d664a92/a564c52da70a') }); + + try { + await vscode.workspace.fs.copy(folder, someFolder, { overwrite: true }); + assert.ok(true); + } catch (err) { + assert.ok(false, err); + + } finally { + await vscode.workspace.fs.delete(folder, { recursive: true, useTrash: false }); + await vscode.workspace.fs.delete(someFolder, { recursive: true, useTrash: false }); + } + }); }); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts index edb404b86532b..1f7a9c9319737 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts @@ -69,7 +69,64 @@ suite('workspace-namespace', () => { }, resolveTask(_task: Task): Task | undefined { try { - assert.fail('resolveTask should not trigger during the test'); + assert.fail('resolveTask should not trigger during the test'); + } catch (e) { + done(e); + } + return undefined; + } + })); + commands.executeCommand('workbench.action.tasks.runTask', `${taskType}: ${taskName}`); + }); + + test('sync CustomExecution task should flush all data on close', (done) => { + interface CustomTestingTaskDefinition extends TaskDefinition { + /** + * One of the task properties. This can be used to customize the task in the tasks.json + */ + customProp1: string; + } + const taskType: string = 'customTesting'; + const taskName = 'First custom task'; + disposables.push(window.onDidOpenTerminal(term => { + disposables.push(window.onDidWriteTerminalData(e => { + try { + assert.equal(e.data, 'exiting'); + } catch (e) { + done(e); + } + disposables.push(window.onDidCloseTerminal(() => done())); + term.dispose(); + })); + })); + disposables.push(tasks.registerTaskProvider(taskType, { + provideTasks: () => { + const result: Task[] = []; + const kind: CustomTestingTaskDefinition = { + type: taskType, + customProp1: 'testing task one' + }; + const writeEmitter = new EventEmitter(); + const closeEmitter = new EventEmitter(); + const execution = new CustomExecution((): Thenable => { + const pty: Pseudoterminal = { + onDidWrite: writeEmitter.event, + onDidClose: closeEmitter.event, + open: () => { + writeEmitter.fire('exiting'); + closeEmitter.fire(); + }, + close: () => {} + }; + return Promise.resolve(pty); + }); + const task = new Task2(kind, TaskScope.Workspace, taskName, taskType, execution); + result.push(task); + return result; + }, + resolveTask(_task: Task): Task | undefined { + try { + assert.fail('resolveTask should not trigger during the test'); } catch (e) { done(e); } diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts index 175ef8522d15c..c26c88671ddf4 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { createRandomFile, deleteFile, closeAllEditors, pathEquals, rndName, disposeAll, testFs, delay } from '../utils'; +import { createRandomFile, deleteFile, closeAllEditors, pathEquals, rndName, disposeAll, testFs, delay, withLogDisabled } from '../utils'; import { join, posix, basename } from 'path'; import * as fs from 'fs'; @@ -75,8 +75,8 @@ suite('workspace-namespace', () => { }); }); - test('openTextDocument, untitled is dirty', function () { - return vscode.workspace.openTextDocument(vscode.Uri.parse('untitled:' + join(vscode.workspace.workspaceFolders![0].uri.toString() || '', './newfile.txt'))).then(doc => { + test('openTextDocument, untitled is dirty', async function () { + return vscode.workspace.openTextDocument(vscode.workspace.workspaceFolders![0].uri.with({ scheme: 'untitled', path: posix.join(vscode.workspace.workspaceFolders![0].uri.path, 'newfile.txt') })).then(doc => { assert.equal(doc.uri.scheme, 'untitled'); assert.ok(doc.isDirty); }); @@ -214,99 +214,94 @@ suite('workspace-namespace', () => { }); }); - test('eol, change via onWillSave', () => { - + test('eol, change via onWillSave', async function () { let called = false; let sub = vscode.workspace.onWillSaveTextDocument(e => { called = true; e.waitUntil(Promise.resolve([vscode.TextEdit.setEndOfLine(vscode.EndOfLine.LF)])); }); - return createRandomFile('foo\r\nbar\r\nbar').then(file => { - return vscode.workspace.openTextDocument(file).then(doc => { - assert.equal(doc.eol, vscode.EndOfLine.CRLF); - const edit = new vscode.WorkspaceEdit(); - edit.set(file, [vscode.TextEdit.insert(new vscode.Position(0, 0), '-changes-')]); + const file = await createRandomFile('foo\r\nbar\r\nbar'); + const doc = await vscode.workspace.openTextDocument(file); + assert.equal(doc.eol, vscode.EndOfLine.CRLF); - return vscode.workspace.applyEdit(edit).then(success => { - assert.ok(success); - return doc.save(); + const edit = new vscode.WorkspaceEdit(); + edit.set(file, [vscode.TextEdit.insert(new vscode.Position(0, 0), '-changes-')]); + const successEdit = await vscode.workspace.applyEdit(edit); + assert.ok(successEdit); - }).then(success => { - assert.ok(success); - assert.ok(called); - assert.ok(!doc.isDirty); - assert.equal(doc.eol, vscode.EndOfLine.LF); - sub.dispose(); - }); - }); - }); + const successSave = await doc.save(); + assert.ok(successSave); + assert.ok(called); + assert.ok(!doc.isDirty); + assert.equal(doc.eol, vscode.EndOfLine.LF); + sub.dispose(); }); - test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => { - return createRandomFile().then(file => { - let disposables: vscode.Disposable[] = []; + function assertEqualPath(a: string, b: string): void { + assert.ok(pathEquals(a, b), `${a} <-> ${b}`); + } - let onDidOpenTextDocument = false; - disposables.push(vscode.workspace.onDidOpenTextDocument(e => { - assert.ok(pathEquals(e.uri.fsPath, file.fsPath)); - onDidOpenTextDocument = true; - })); + test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', async () => { + const file = await createRandomFile(); + let disposables: vscode.Disposable[] = []; - let onDidChangeTextDocument = false; - disposables.push(vscode.workspace.onDidChangeTextDocument(e => { - assert.ok(pathEquals(e.document.uri.fsPath, file.fsPath)); - onDidChangeTextDocument = true; - })); + await vscode.workspace.saveAll(); - let onDidSaveTextDocument = false; - disposables.push(vscode.workspace.onDidSaveTextDocument(e => { - assert.ok(pathEquals(e.uri.fsPath, file.fsPath)); - onDidSaveTextDocument = true; - })); + let pendingAsserts: Function[] = []; + let onDidOpenTextDocument = false; + disposables.push(vscode.workspace.onDidOpenTextDocument(e => { + pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath)); + onDidOpenTextDocument = true; + })); - return vscode.workspace.openTextDocument(file).then(doc => { - return vscode.window.showTextDocument(doc).then((editor) => { - return editor.edit((builder) => { - builder.insert(new vscode.Position(0, 0), 'Hello World'); - }).then(_applied => { - return doc.save().then(_saved => { - assert.ok(onDidOpenTextDocument); - assert.ok(onDidChangeTextDocument); - assert.ok(onDidSaveTextDocument); - - disposeAll(disposables); - - return deleteFile(file); - }); - }); - }); - }); + let onDidChangeTextDocument = false; + disposables.push(vscode.workspace.onDidChangeTextDocument(e => { + pendingAsserts.push(() => assertEqualPath(e.document.uri.fsPath, file.fsPath)); + onDidChangeTextDocument = true; + })); + + let onDidSaveTextDocument = false; + disposables.push(vscode.workspace.onDidSaveTextDocument(e => { + pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath)); + onDidSaveTextDocument = true; + })); + + const doc = await vscode.workspace.openTextDocument(file); + const editor = await vscode.window.showTextDocument(doc); + + await editor.edit((builder) => { + builder.insert(new vscode.Position(0, 0), 'Hello World'); }); - }); + await doc.save(); - test('events: onDidSaveTextDocument fires even for non dirty file when saved', () => { - return createRandomFile().then(file => { - let disposables: vscode.Disposable[] = []; + assert.ok(onDidOpenTextDocument); + assert.ok(onDidChangeTextDocument); + assert.ok(onDidSaveTextDocument); + pendingAsserts.forEach(assert => assert()); + disposeAll(disposables); + return deleteFile(file); + }); - let onDidSaveTextDocument = false; - disposables.push(vscode.workspace.onDidSaveTextDocument(e => { - assert.ok(pathEquals(e.uri.fsPath, file.fsPath)); - onDidSaveTextDocument = true; - })); + test('events: onDidSaveTextDocument fires even for non dirty file when saved', async () => { + const file = await createRandomFile(); + let disposables: vscode.Disposable[] = []; + let pendingAsserts: Function[] = []; - return vscode.workspace.openTextDocument(file).then(doc => { - return vscode.window.showTextDocument(doc).then(() => { - return vscode.commands.executeCommand('workbench.action.files.save').then(() => { - assert.ok(onDidSaveTextDocument); + let onDidSaveTextDocument = false; + disposables.push(vscode.workspace.onDidSaveTextDocument(e => { + pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath)); + onDidSaveTextDocument = true; + })); - disposeAll(disposables); + const doc = await vscode.workspace.openTextDocument(file); + await vscode.window.showTextDocument(doc); + await vscode.commands.executeCommand('workbench.action.files.save'); - return deleteFile(file); - }); - }); - }); - }); + assert.ok(onDidSaveTextDocument); + pendingAsserts.forEach(fn => fn()); + disposeAll(disposables); + return deleteFile(file); }); test('openTextDocument, with selection', function () { @@ -598,7 +593,7 @@ suite('workspace-namespace', () => { assert.equal(doc.isDirty, true); }); - test('applyEdit should fail when editing deleted resource', async () => { + test('applyEdit should fail when editing deleted resource', withLogDisabled(async () => { const resource = await createRandomFile(); const edit = new vscode.WorkspaceEdit(); @@ -607,9 +602,9 @@ suite('workspace-namespace', () => { let success = await vscode.workspace.applyEdit(edit); assert.equal(success, false); - }); + })); - test('applyEdit should fail when renaming deleted resource', async () => { + test('applyEdit should fail when renaming deleted resource', withLogDisabled(async () => { const resource = await createRandomFile(); const edit = new vscode.WorkspaceEdit(); @@ -618,9 +613,9 @@ suite('workspace-namespace', () => { let success = await vscode.workspace.applyEdit(edit); assert.equal(success, false); - }); + })); - test('applyEdit should fail when editing renamed from resource', async () => { + test('applyEdit should fail when editing renamed from resource', withLogDisabled(async () => { const resource = await createRandomFile(); const newResource = vscode.Uri.file(resource.fsPath + '.1'); const edit = new vscode.WorkspaceEdit(); @@ -629,7 +624,7 @@ suite('workspace-namespace', () => { let success = await vscode.workspace.applyEdit(edit); assert.equal(success, false); - }); + })); test('applyEdit "edit A -> rename A to B -> edit B"', async () => { await testEditRenameEdit(oldUri => oldUri.with({ path: oldUri.path + 'NEW' })); @@ -662,7 +657,7 @@ suite('workspace-namespace', () => { return uri.with({ path: posix.join(posix.dirname(uri.path), `_${posix.basename(uri.path)}`) }); } - test('WorkspaceEdit: applying edits before and after rename duplicates resource #42633', async function () { + test('WorkspaceEdit: applying edits before and after rename duplicates resource #42633', withLogDisabled(async function () { let docUri = await createRandomFile(); let newUri = nameWithUnderscore(docUri); @@ -675,9 +670,9 @@ suite('workspace-namespace', () => { assert.ok(await vscode.workspace.applyEdit(we)); let doc = await vscode.workspace.openTextDocument(newUri); assert.equal(doc.getText(), 'BarHelloFoo'); - }); + })); - test('WorkspaceEdit: Problem recreating a renamed resource #42634', async function () { + test('WorkspaceEdit: Problem recreating a renamed resource #42634', withLogDisabled(async function () { let docUri = await createRandomFile(); let newUri = nameWithUnderscore(docUri); @@ -695,9 +690,9 @@ suite('workspace-namespace', () => { assert.equal(newDoc.getText(), 'HelloFoo'); let doc = await vscode.workspace.openTextDocument(docUri); assert.equal(doc.getText(), 'Bar'); - }); + })); - test('WorkspaceEdit api - after saving a deleted file, it still shows up as deleted. #42667', async function () { + test('WorkspaceEdit api - after saving a deleted file, it still shows up as deleted. #42667', withLogDisabled(async function () { let docUri = await createRandomFile(); let we = new vscode.WorkspaceEdit(); we.deleteFile(docUri); @@ -710,7 +705,7 @@ suite('workspace-namespace', () => { } catch (e) { assert.ok(true); } - }); + })); test('WorkspaceEdit: edit and rename parent folder duplicates resource #42641', async function () { @@ -741,7 +736,7 @@ suite('workspace-namespace', () => { assert.equal(doc.getText(), 'Hello'); }); - test('WorkspaceEdit: rename resource followed by edit does not work #42638', async function () { + test('WorkspaceEdit: rename resource followed by edit does not work #42638', withLogDisabled(async function () { let docUri = await createRandomFile(); let newUri = nameWithUnderscore(docUri); @@ -753,9 +748,9 @@ suite('workspace-namespace', () => { let doc = await vscode.workspace.openTextDocument(newUri); assert.equal(doc.getText(), 'Hello'); - }); + })); - test('WorkspaceEdit: create & override', async function () { + test('WorkspaceEdit: create & override', withLogDisabled(async function () { let docUri = await createRandomFile('before'); @@ -768,9 +763,9 @@ suite('workspace-namespace', () => { we.createFile(docUri, { overwrite: true }); assert.ok(await vscode.workspace.applyEdit(we)); assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), ''); - }); + })); - test('WorkspaceEdit: create & ignoreIfExists', async function () { + test('WorkspaceEdit: create & ignoreIfExists', withLogDisabled(async function () { let docUri = await createRandomFile('before'); let we = new vscode.WorkspaceEdit(); @@ -782,9 +777,9 @@ suite('workspace-namespace', () => { we.createFile(docUri, { overwrite: true, ignoreIfExists: true }); assert.ok(await vscode.workspace.applyEdit(we)); assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), ''); - }); + })); - test('WorkspaceEdit: rename & ignoreIfExists', async function () { + test('WorkspaceEdit: rename & ignoreIfExists', withLogDisabled(async function () { let aUri = await createRandomFile('aaa'); let bUri = await createRandomFile('bbb'); @@ -803,9 +798,9 @@ suite('workspace-namespace', () => { we = new vscode.WorkspaceEdit(); we.renameFile(aUri, bUri, { overwrite: true, ignoreIfExists: true }); assert.ok(await vscode.workspace.applyEdit(we)); - }); + })); - test('WorkspaceEdit: delete & ignoreIfNotExists', async function () { + test('WorkspaceEdit: delete & ignoreIfNotExists', withLogDisabled(async function () { let docUri = await createRandomFile(); let we = new vscode.WorkspaceEdit(); @@ -819,7 +814,7 @@ suite('workspace-namespace', () => { we = new vscode.WorkspaceEdit(); we.deleteFile(docUri, { ignoreIfNotExists: true }); assert.ok(await vscode.workspace.applyEdit(we)); - }); + })); test('WorkspaceEdit: insert & rename multiple', async function () { @@ -916,4 +911,23 @@ suite('workspace-namespace', () => { const expected2 = 'import2;import1;'; assert.equal(document.getText(), expected2); }); + + test('The api workspace.applyEdit failed for some case of mixing resourceChange and textEdit #80688', async function () { + const file1 = await createRandomFile(); + const file2 = await createRandomFile(); + let we = new vscode.WorkspaceEdit(); + we.insert(file1, new vscode.Position(0, 0), 'import1;'); + we.insert(file1, new vscode.Position(0, 0), 'import2;'); + + const file2Name = basename(file2.fsPath); + const file2NewUri = vscode.Uri.parse(file2.toString().replace(file2Name, `new/${file2Name}`)); + we.renameFile(file2, file2NewUri); + + await vscode.workspace.applyEdit(we); + + const document = await vscode.workspace.openTextDocument(file1); + const expected = 'import1;import2;'; + // const expected2 = 'import2;import1;'; + assert.equal(document.getText(), expected); + }); }); diff --git a/extensions/vscode-api-tests/src/typings/ref.d.ts b/extensions/vscode-api-tests/src/typings/ref.d.ts index e3e47385d6634..9abc416f7e880 100644 --- a/extensions/vscode-api-tests/src/typings/ref.d.ts +++ b/extensions/vscode-api-tests/src/typings/ref.d.ts @@ -5,4 +5,6 @@ /// /// +/// +/// /// diff --git a/extensions/vscode-api-tests/src/utils.ts b/extensions/vscode-api-tests/src/utils.ts index 969a7cd00510a..e270cd73adfef 100644 --- a/extensions/vscode-api-tests/src/utils.ts +++ b/extensions/vscode-api-tests/src/utils.ts @@ -46,7 +46,6 @@ export function pathEquals(path1: string, path2: string): boolean { export function closeAllEditors(): Thenable { return vscode.commands.executeCommand('workbench.action.closeAllEditors'); - } export function disposeAll(disposables: vscode.Disposable[]) { @@ -71,3 +70,16 @@ function isTestTypeActive(): boolean { export function delay(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } + +export function withLogDisabled(runnable: () => Promise): () => Promise { + return async (): Promise => { + const logLevel = await vscode.commands.executeCommand('_extensionTests.getLogLevel'); + await vscode.commands.executeCommand('_extensionTests.setLogLevel', 6 /* critical */); + + try { + await runnable(); + } finally { + await vscode.commands.executeCommand('_extensionTests.setLogLevel', logLevel); + } + }; +} diff --git a/extensions/vscode-api-tests/testWorkspace/.vscode/launch.json b/extensions/vscode-api-tests/testWorkspace/.vscode/launch.json new file mode 100644 index 0000000000000..518e00c672474 --- /dev/null +++ b/extensions/vscode-api-tests/testWorkspace/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Launch debug.js", + "stopOnEntry": true, + "program": "${workspaceFolder}/debug.js" + } + ] +} diff --git a/src/typings/vsda.d.ts b/extensions/vscode-api-tests/testWorkspace/debug.js similarity index 82% rename from src/typings/vsda.d.ts rename to extensions/vscode-api-tests/testWorkspace/debug.js index 369e98483b61e..1ca212281c771 100644 --- a/src/typings/vsda.d.ts +++ b/extensions/vscode-api-tests/testWorkspace/debug.js @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -declare module 'vsda' { - export class signer { - sign(arg: any): any; - } +let y = 0; +for (let i = 0; i < 100; i++) { + console.log(y); + y = y + i; } diff --git a/extensions/vscode-colorize-tests/package.json b/extensions/vscode-colorize-tests/package.json index 6045e073d02e5..d99e050d3024d 100644 --- a/extensions/vscode-colorize-tests/package.json +++ b/extensions/vscode-colorize-tests/package.json @@ -5,16 +5,56 @@ "publisher": "vscode", "license": "MIT", "private": true, + "activationEvents": [ + "onLanguage:json" + ], + "main": "./out/colorizerTestMain", + "enableProposedApi": true, "engines": { "vscode": "*" }, "scripts": { "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json" }, + "dependencies": { + "jsonc-parser": "2.2.1" + }, "devDependencies": { "@types/node": "^12.11.7", "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", "vscode": "1.1.5" + }, + "contributes": { + "semanticTokenTypes": [ + { + "id": "testToken", + "description": "A test token" + } + ], + "semanticTokenModifiers": [ + { + "id": "testModifier", + "description": "A test modifier" + } + ], + "semanticTokenStyleDefaults": [ + { + "selector": "testToken", + "scope": [ "entity.name.function.special" ] + }, + { + "selector": "*.testModifier", + "light": { + "fontStyle": "bold" + }, + "dark": { + "fontStyle": "bold" + }, + "highContrast": { + "fontStyle": "bold" + } + } + ] } } diff --git a/extensions/vscode-colorize-tests/src/colorizer.test.ts b/extensions/vscode-colorize-tests/src/colorizer.test.ts index 82892577bdfa2..28a992573b9cd 100644 --- a/extensions/vscode-colorize-tests/src/colorizer.test.ts +++ b/extensions/vscode-colorize-tests/src/colorizer.test.ts @@ -56,7 +56,7 @@ function hasThemeChange(d: any, p: any) : boolean { } } return false; -}; +} suite('colorization', () => { let extensionsFolder = normalize(join(__dirname, '../../')); diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts new file mode 100644 index 0000000000000..a014275a7e65a --- /dev/null +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as jsoncParser from 'jsonc-parser'; + +export function activate(context: vscode.ExtensionContext): any { + + const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable', 'testToken']; + const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async', 'testModifier']; + + const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); + + const outputChannel = vscode.window.createOutputChannel('Semantic Tokens Test'); + + const documentSemanticHighlightProvider: vscode.DocumentSemanticTokensProvider = { + provideDocumentSemanticTokens(document: vscode.TextDocument): vscode.ProviderResult { + const builder = new vscode.SemanticTokensBuilder(); + + function addToken(value: string, startLine: number, startCharacter: number, length: number) { + const [type, ...modifiers] = value.split('.'); + + let tokenType = legend.tokenTypes.indexOf(type); + if (tokenType === -1) { + return; + } + + let tokenModifiers = 0; + for (let i = 0; i < modifiers.length; i++) { + const index = legend.tokenModifiers.indexOf(modifiers[i]); + if (index !== -1) { + tokenModifiers = tokenModifiers | 1 << index; + } + } + + + builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); + + const selectedModifiers = legend.tokenModifiers.filter((_val, bit) => tokenModifiers & (1 << bit)).join(' '); + outputChannel.appendLine(`line: ${startLine}, character: ${startCharacter}, length ${length}, ${legend.tokenTypes[tokenType]} (${tokenType}), ${selectedModifiers} ${tokenModifiers.toString(2)}`); + } + + outputChannel.appendLine('---'); + + const visitor: jsoncParser.JSONVisitor = { + onObjectProperty: (property: string, _offset: number, _length: number, startLine: number, startCharacter: number) => { + addToken(property, startLine, startCharacter, property.length + 2); + }, + onLiteralValue: (value: any, _offset: number, length: number, startLine: number, startCharacter: number) => { + if (typeof value === 'string') { + addToken(value, startLine, startCharacter, length); + } + } + }; + jsoncParser.visit(document.getText(), visitor); + + return new vscode.SemanticTokens(builder.build()); + } + }; + + + context.subscriptions.push(vscode.languages.registerDocumentSemanticTokensProvider({ pattern: '**/*semantic-test.json' }, documentSemanticHighlightProvider, legend)); + +} diff --git a/extensions/vscode-colorize-tests/src/typings/ref.d.ts b/extensions/vscode-colorize-tests/src/typings/ref.d.ts index a45a0c6353fe2..a17099ac50c08 100644 --- a/extensions/vscode-colorize-tests/src/typings/ref.d.ts +++ b/extensions/vscode-colorize-tests/src/typings/ref.d.ts @@ -3,5 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/// +/// /// -/// + diff --git a/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json new file mode 100644 index 0000000000000..c91ebc862e9c4 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "editor.tokenColorCustomizationsExperimental": { + "class": "#00b0b0", + "interface": "#845faf", + "function": "#ff00ff", + "*.declaration": { + "fontStyle": "underline" + }, + "*.declaration.member": { + "fontStyle": "italic bold", + } + } +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json new file mode 100644 index 0000000000000..b250b5d2bc1ce --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json @@ -0,0 +1,9 @@ +[ + "class", "function.member.declaration", + "parameterType.declaration", "type", "parameterType.declaration", "type", + "variable.declaration", "parameterNames", + "function.member.declaration", + "interface.declaration", + "function.member.declaration", "testToken.testModifier" + +] diff --git a/extensions/vscode-colorize-tests/yarn.lock b/extensions/vscode-colorize-tests/yarn.lock index 23ac03a3948f6..b8a66d65eff4e 100644 --- a/extensions/vscode-colorize-tests/yarn.lock +++ b/extensions/vscode-colorize-tests/yarn.lock @@ -1042,6 +1042,11 @@ json3@3.3.2: resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" integrity sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE= +jsonc-parser@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" diff --git a/extensions/vscode-test-resolver/package.json b/extensions/vscode-test-resolver/package.json index a458e14185d60..90e3e0e87eedc 100644 --- a/extensions/vscode-test-resolver/package.json +++ b/extensions/vscode-test-resolver/package.json @@ -8,7 +8,7 @@ "engines": { "vscode": "^1.25.0" }, - "extensionKind": "ui", + "extensionKind": [ "ui" ], "scripts": { "compile": "node ./node_modules/vscode/bin/compile -watch -p ./", "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-test-resolver ./tsconfig.json" diff --git a/extensions/xml/package.json b/extensions/xml/package.json index d76a632b10c29..77e36951b7ce5 100644 --- a/extensions/xml/package.json +++ b/extensions/xml/package.json @@ -43,6 +43,8 @@ ".publishsettings", ".pubxml", ".pubxml.user", + ".rbxlx", + ".rbxmx", ".rdf", ".rng", ".rss", diff --git a/extensions/xml/xml.language-configuration.json b/extensions/xml/xml.language-configuration.json index 702b6dc6eb724..15664cbb4f5f3 100644 --- a/extensions/xml/xml.language-configuration.json +++ b/extensions/xml/xml.language-configuration.json @@ -12,8 +12,8 @@ { "open": "{", "close": "}"}, { "open": "[", "close": "]"}, { "open": "(", "close": ")" }, - { "open": "'", "close": "'" }, - { "open": "\"", "close": "\"" }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] }, { "open": "", "notIn": [ "comment", "string" ]}, { "open": "", "notIn": [ "comment", "string" ]} ], diff --git a/extensions/yaml/package.json b/extensions/yaml/package.json index 5b12e0fbc5bfa..c7dec1b1b83e7 100644 --- a/extensions/yaml/package.json +++ b/extensions/yaml/package.json @@ -40,8 +40,8 @@ "[yaml]": { "editor.insertSpaces": true, "editor.tabSize": 2, - "editor.autoIndent": false + "editor.autoIndent": "advanced" } } } -} \ No newline at end of file +} diff --git a/extensions/yaml/test/colorize-results/issue-4008_yaml.json b/extensions/yaml/test/colorize-results/issue-4008_yaml.json index 10329df780e3b..c16426c590f67 100644 --- a/extensions/yaml/test/colorize-results/issue-4008_yaml.json +++ b/extensions/yaml/test/colorize-results/issue-4008_yaml.json @@ -257,10 +257,10 @@ "t": "source.yaml constant.numeric.integer.yaml", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } } -] \ No newline at end of file +] diff --git a/extensions/yaml/test/colorize-results/test_yaml.json b/extensions/yaml/test/colorize-results/test_yaml.json index 6c871b3220829..258202824fe9b 100644 --- a/extensions/yaml/test/colorize-results/test_yaml.json +++ b/extensions/yaml/test/colorize-results/test_yaml.json @@ -246,9 +246,9 @@ "t": "source.yaml constant.numeric.float.yaml", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -774,9 +774,9 @@ "t": "source.yaml meta.flow-mapping.yaml meta.flow-pair.yaml meta.flow-pair.value.yaml constant.numeric.integer.yaml", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -906,9 +906,9 @@ "t": "source.yaml constant.numeric.integer.yaml", "r": { "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", + "light_plus": "constant.numeric: #098658", "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", + "light_vs": "constant.numeric: #098658", "hc_black": "constant.numeric: #B5CEA8" } }, @@ -1132,4 +1132,4 @@ "hc_black": "string: #CE9178" } } -] \ No newline at end of file +] diff --git a/extensions/yarn.lock b/extensions/yarn.lock index 6cae6ac12deb4..43a70c058c22d 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@3.8.2: + version "3.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a" + integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ== diff --git a/package.json b/package.json index 50b466de9f6c4..8a295591a6e22 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", - "version": "1.41.0", - "distro": "be6ad88ea0214dfdb03b943bef28e7a5c9fc2e4b", + "version": "1.43.0", + "distro": "ce5d74deb336afe4dcce871e6c5b221aed44fb69", "author": { "name": "Microsoft Corporation" }, @@ -10,12 +10,13 @@ "private": true, "scripts": { "test": "mocha", + "test-browser": "node test/unit/browser/index.js", "preinstall": "node build/npm/preinstall.js", "postinstall": "node build/npm/postinstall.js", "compile": "gulp compile --max_old_space_size=4095", "watch": "gulp watch --max_old_space_size=4095", "watch-client": "gulp watch-client --max_old_space_size=4095", - "monaco-editor-test": "mocha --only-monaco-editor", + "mocha": "mocha test/unit/node/all.js --delay", "precommit": "node build/gulpfile.hygiene.js", "gulp": "gulp --max_old_space_size=8192", "electron": "node build/lib/electron", @@ -25,37 +26,41 @@ "smoketest": "cd test/smoke && node test/index.js", "download-builtin-extensions": "node build/lib/builtInExtensions.js", "monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit", - "strict-initialization-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictPropertyInitialization", + "valid-layers-check": "node build/lib/layersChecker.js", + "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", - "web": "node scripts/code-web.js" + "web": "node scripts/code-web.js", + "eslint": "eslint -c .eslintrc.json --rulesdir ./build/lib/eslint --ext .ts --ext .js ./src/vs ./extensions" }, "dependencies": { "applicationinsights": "1.0.8", "chokidar": "3.2.3", - "graceful-fs": "4.1.11", + "graceful-fs": "4.2.3", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^2.2.3", "iconv-lite": "0.5.0", "jschardet": "2.1.1", "keytar": "^4.11.0", "native-is-elevated": "0.4.1", - "native-keymap": "2.0.0", - "native-watchdog": "1.2.0", + "native-keymap": "2.1.1", + "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", - "onigasm-umd": "^2.2.2", - "semver-umd": "^5.5.3", + "onigasm-umd": "2.2.5", + "semver-umd": "^5.5.5", "spdlog": "^0.11.1", - "sudo-prompt": "9.0.0", + "sudo-prompt": "9.1.1", "v8-inspect-profiler": "^0.0.20", - "vscode-minimist": "^1.2.1", + "vscode-minimist": "^1.2.2", "vscode-nsfw": "1.2.8", "vscode-proxy-agent": "^0.5.2", - "vscode-ripgrep": "^1.5.7", + "vscode-ripgrep": "^1.5.8", "vscode-sqlite3": "4.0.9", - "vscode-textmate": "^4.3.0", - "xterm": "4.3.0-beta17", - "xterm-addon-search": "0.4.0-beta4", + "vscode-textmate": "4.4.0", + "xterm": "4.5.0-beta.4", + "xterm-addon-search": "0.5.0", + "xterm-addon-unicode11": "0.1.1", "xterm-addon-web-links": "0.2.1", + "xterm-addon-webgl": "0.5.0", "yauzl": "^2.9.2", "yazl": "^2.4.3" }, @@ -64,20 +69,24 @@ "@types/applicationinsights": "0.20.0", "@types/chokidar": "2.1.3", "@types/cookie": "^0.3.3", + "@types/debug": "^4.1.5", "@types/graceful-fs": "4.1.2", "@types/http-proxy-agent": "^2.0.1", "@types/iconv-lite": "0.0.1", "@types/keytar": "^4.4.0", "@types/mocha": "2.2.39", - "@types/node": "^10.12.12", - "@types/semver": "^5.5.0", + "@types/node": "^12.11.7", "@types/sinon": "^1.16.36", + "@types/vscode-windows-registry": "^1.0.0", "@types/webpack": "^4.4.10", "@types/windows-foreground-love": "^0.3.0", + "@types/windows-mutex": "^0.4.0", "@types/windows-process-tree": "^0.2.0", "@types/winreg": "^1.2.30", "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", + "@typescript-eslint/eslint-plugin": "2.3.2", + "@typescript-eslint/parser": "^2.12.0", "ansi-colors": "^3.2.3", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", @@ -86,8 +95,10 @@ "cson-parser": "^1.3.3", "css-loader": "^3.2.0", "debounce": "^1.0.0", + "electron": "7.1.11", + "eslint": "6.8.0", + "eslint-plugin-jsdoc": "^19.1.0", "event-stream": "3.3.4", - "express": "^4.13.1", "fancy-log": "^1.3.3", "fast-plist": "0.1.2", "file-loader": "^4.2.0", @@ -109,17 +120,16 @@ "gulp-replace": "^0.5.4", "gulp-shell": "^0.6.5", "gulp-tsb": "4.0.5", - "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", - "istanbul-lib-instrument": "^3.3.0", - "istanbul-lib-report": "^2.0.8", - "istanbul-lib-source-maps": "^3.0.6", - "istanbul-reports": "^2.2.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", "jsdom-no-contextify": "^3.1.0", "lazy.js": "^0.4.2", "merge-options": "^1.0.1", @@ -131,6 +141,7 @@ "opn": "^6.0.0", "optimist": "0.3.5", "p-all": "^1.0.0", + "playwright": "0.11.0", "pump": "^1.0.1", "queue": "3.0.6", "rcedit": "^1.1.0", @@ -139,8 +150,7 @@ "source-map": "^0.4.4", "style-loader": "^1.0.0", "ts-loader": "^4.4.2", - "tslint": "^5.16.0", - "typescript": "3.7.2", + "typescript": "3.8.2", "typescript-formatter": "7.1.0", "underscore": "^1.8.2", "vinyl": "^2.0.0", @@ -150,7 +160,8 @@ "vscode-nls-dev": "^3.3.1", "webpack": "^4.16.5", "webpack-cli": "^3.3.8", - "webpack-stream": "^5.1.1" + "webpack-stream": "^5.1.1", + "yaserver": "^0.2.0" }, "repository": { "type": "git", diff --git a/remote/package.json b/remote/package.json index ec299bfed0cdf..7d3a3755dd351 100644 --- a/remote/package.json +++ b/remote/package.json @@ -5,24 +5,26 @@ "applicationinsights": "1.0.8", "chokidar": "3.2.3", "cookie": "^0.4.0", - "graceful-fs": "4.1.11", + "graceful-fs": "4.2.3", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^2.2.3", "iconv-lite": "0.5.0", "jschardet": "2.1.1", - "native-watchdog": "1.2.0", + "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", - "onigasm-umd": "^2.2.2", - "semver-umd": "^5.5.3", + "onigasm-umd": "2.2.5", + "semver-umd": "^5.5.5", "spdlog": "^0.11.1", - "vscode-minimist": "^1.2.1", + "vscode-minimist": "^1.2.2", "vscode-nsfw": "1.2.8", "vscode-proxy-agent": "^0.5.2", - "vscode-ripgrep": "^1.5.7", - "vscode-textmate": "^4.3.0", - "xterm": "4.3.0-beta17", - "xterm-addon-search": "0.4.0-beta4", + "vscode-ripgrep": "^1.5.8", + "vscode-textmate": "4.4.0", + "xterm": "4.5.0-beta.4", + "xterm-addon-search": "0.5.0", + "xterm-addon-unicode11": "0.1.1", "xterm-addon-web-links": "0.2.1", + "xterm-addon-webgl": "0.5.0", "yauzl": "^2.9.2", "yazl": "^2.4.3" }, diff --git a/remote/web/package.json b/remote/web/package.json index 9889d010fab87..ffcd7add2805a 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -2,11 +2,13 @@ "name": "vscode-web", "version": "0.0.0", "dependencies": { - "onigasm-umd": "^2.2.2", - "semver-umd": "^5.5.3", - "vscode-textmate": "^4.3.0", - "xterm": "4.3.0-beta17", - "xterm-addon-search": "0.4.0-beta4", - "xterm-addon-web-links": "0.2.1" + "onigasm-umd": "2.2.5", + "semver-umd": "^5.5.5", + "vscode-textmate": "4.4.0", + "xterm": "4.5.0-beta.4", + "xterm-addon-search": "0.5.0", + "xterm-addon-unicode11": "0.1.1", + "xterm-addon-web-links": "0.2.1", + "xterm-addon-webgl": "0.5.0" } } diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 45a2296934f01..c9f5c9ebb953c 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -7,10 +7,10 @@ nan@^2.14.0: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== -onigasm-umd@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.2.tgz#b989d762df61f899a3052ac794a50bd93fe20257" - integrity sha512-v2eMOJu7iE444L2iJN+U6s6s5S0y7oj/N0DAkrd6wokRtTVoq/v/yaDI1lIqFrTeJbNtqNzYvguDF5yNzW3Rvw== +onigasm-umd@2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.5.tgz#f104247334a543accd3f8d641a4d99b3d908d6a1" + integrity sha512-R3qD7hq6i2bBklF+QyjqZl/G4fe7GwtukI28YLH2vuiatqx52tb9vpg2sxwemKc3nF76SgkeyOKJLchBmTm0Aw== oniguruma@^7.2.0: version "7.2.0" @@ -19,29 +19,39 @@ oniguruma@^7.2.0: dependencies: nan "^2.14.0" -semver-umd@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e" - integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw== +semver-umd@^5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.5.tgz#a2e4280d0e92a2b27695c18811f0e939e144d86f" + integrity sha512-8rUq0nnTzlexpAdYmm8UDYsLkBn0MnBkfrGWPmyDBDDzv71dPOH07szOOaLj/5hO3BYmumYwS+wp3C60zLzh5g== -vscode-textmate@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.3.0.tgz#6e1f0f273d84148cfa1e9c7ed85bd16c974f9f61" - integrity sha512-MhEZ3hvxOVuYGsrRzW/PZLDR2VdtG2+V6TIKPvmE9JT+RAq/OtPlrFd1+ZQwBefoHEhjRNuRJ0OktcFezuxPmg== +vscode-textmate@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305" + integrity sha512-dFpm2eK0HwEjeFSD1DDh3j0q47bDSVuZt20RiJWxGqjtm73Wu2jip3C2KaZI3dQx/fSeeXCr/uEN4LNaNj7Ytw== dependencies: oniguruma "^7.2.0" -xterm-addon-search@0.4.0-beta4: - version "0.4.0-beta4" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.4.0-beta4.tgz#7762ea342c6b4f5e824d83466bd93793c9d7d779" - integrity sha512-TIbEBVhydGIxcyu/CfKJbD+BKHisMGbkAfaWlCPaWis2Xmw8yE7CKrCPn+lhZYl1MdjDVEmb8lQI6WetbC2OZA== +xterm-addon-search@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.5.0.tgz#cd3a2f8056084c28e236d4e732da37682010bcc2" + integrity sha512-zLVqVTrg5w2nk9fRj3UuVKCPo/dmFe/cLf3EM9Is5Dm6cgOoXmeo9eq2KgD8A0gquAflTFTf0ya2NaFmShHwyg== + +xterm-addon-unicode11@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.1.1.tgz#b209ef137db38096f68636af4ef4d0c0acba85ad" + integrity sha512-z6vJTL+dpNljwAYzYoyDjJP8A2XjZuEosl0sRa+FGRf3jEyEVWquDM53MfUd1ztVdAPQ839qR6eYK1BXV04Bhw== xterm-addon-web-links@0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2" integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ== -xterm@4.3.0-beta17: - version "4.3.0-beta17" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta17.tgz#c038cc00cb5be33d2a5f083255c329d9ed186565" - integrity sha512-Lgz7vL12MBKJSgK/UXJF22Yw+uEXEE7YZDWfUD+/jbHAKN4geLQJ/Y/b3gxjLL020dnYZuayfKOr2KWdhKsmCA== +xterm-addon-webgl@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.5.0.tgz#c1031dc7599cce3509824643ab5f15361c928e3e" + integrity sha512-hQrvabKCnwXFaEZ+YtoJM9Pm0CIBXL5KSwoU+RiGStU3KYTAcqYP2GsH3dWdvKX6kTWhWLS81dtDsGkfbOciuA== + +xterm@4.5.0-beta.4: + version "4.5.0-beta.4" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.5.0-beta.4.tgz#701f05553b643236d3fcd8bb7f14045bd4537c92" + integrity sha512-Yv1Bf60LTLBMaig1rv033hPz8hQGXZN6VYW2oe/409t2NbJXPg5xZgf47qyaWFV7a5k1BFiwjayJCWaL2nYBew== diff --git a/remote/yarn.lock b/remote/yarn.lock index 1aab9f6a9c0ef..d576786f98285 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -155,12 +155,7 @@ glob-parent@~5.1.0: dependencies: is-glob "^4.0.1" -graceful-fs@4.1.11: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg= - -graceful-fs@^4.1.2, graceful-fs@^4.1.6: +graceful-fs@4.2.3, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.2.3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== @@ -261,10 +256,10 @@ nan@^2.10.0, nan@^2.14.0: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== -native-watchdog@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/native-watchdog/-/native-watchdog-1.2.0.tgz#9c710093ac6e9e60b19517cb1ef4ac9d7c997395" - integrity sha512-jOOoA3PLSxt1adaeuEW7ymV9cApZiDxn4y4iFs7b4sP73EG+5Lsz+OgUNFcGMyrtznTw6ZvlLcilIN4jeAIgaQ== +native-watchdog@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/native-watchdog/-/native-watchdog-1.3.0.tgz#88cee94c9dc766b85c8506eda14c8bd8c9618e27" + integrity sha512-WOjGRNGkYZ5MXsntcvCYrKtSYMaewlbCFplbcUVo9bE80LPVt8TAVFHYWB8+a6fWCGYheq21+Wtt6CJrUaCJhw== node-addon-api@1.6.2: version "1.6.2" @@ -283,10 +278,10 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -onigasm-umd@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.2.tgz#b989d762df61f899a3052ac794a50bd93fe20257" - integrity sha512-v2eMOJu7iE444L2iJN+U6s6s5S0y7oj/N0DAkrd6wokRtTVoq/v/yaDI1lIqFrTeJbNtqNzYvguDF5yNzW3Rvw== +onigasm-umd@2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.5.tgz#f104247334a543accd3f8d641a4d99b3d908d6a1" + integrity sha512-R3qD7hq6i2bBklF+QyjqZl/G4fe7GwtukI28YLH2vuiatqx52tb9vpg2sxwemKc3nF76SgkeyOKJLchBmTm0Aw== oniguruma@^7.2.0: version "7.2.0" @@ -317,10 +312,10 @@ readdirp@~3.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver-umd@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e" - integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw== +semver-umd@^5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.5.tgz#a2e4280d0e92a2b27695c18811f0e939e144d86f" + integrity sha512-8rUq0nnTzlexpAdYmm8UDYsLkBn0MnBkfrGWPmyDBDDzv71dPOH07szOOaLj/5hO3BYmumYwS+wp3C60zLzh5g== semver@^5.3.0: version "5.6.0" @@ -369,10 +364,10 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -vscode-minimist@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/vscode-minimist/-/vscode-minimist-1.2.1.tgz#e63d3f4a9bf3680dcb8f9304eed612323fd6926a" - integrity sha512-cmB72+qDoiCFJ1UKnGUBdGYfXzdpJ3bQM/D/+XhkVk5v7uZgLbYiCz5JcwVyk7NC7hSi5VGtQ4wihzmi12NeXw== +vscode-minimist@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/vscode-minimist/-/vscode-minimist-1.2.2.tgz#65403f44f0c6010d259b2271d36eb5c6f4ad8aab" + integrity sha512-DXMNG2QgrXn1jOP12LzjVfvxVkzxv/0Qa27JrMBj/XP2esj+fJ/wP2T4YUH5derj73Lc96dC8F25WyfDUbTpxQ== vscode-nsfw@1.2.8: version "1.2.8" @@ -394,15 +389,15 @@ vscode-proxy-agent@^0.5.2: https-proxy-agent "^2.2.3" socks-proxy-agent "^4.0.1" -vscode-ripgrep@^1.5.7: - version "1.5.7" - resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce" - integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ== +vscode-ripgrep@^1.5.8: + version "1.5.8" + resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.8.tgz#32cb33da6d1a9ca8f5de8c2813ed5114fd55fc11" + integrity sha512-l6Pv/t1Jk63RU+kEkMO04XxnNRYdyzuesizj9AzFpcfrUxxpAjEJBK1qO9Mov30UUGZl7uDUBn+uCv9koaHPPA== -vscode-textmate@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.3.0.tgz#6e1f0f273d84148cfa1e9c7ed85bd16c974f9f61" - integrity sha512-MhEZ3hvxOVuYGsrRzW/PZLDR2VdtG2+V6TIKPvmE9JT+RAq/OtPlrFd1+ZQwBefoHEhjRNuRJ0OktcFezuxPmg== +vscode-textmate@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305" + integrity sha512-dFpm2eK0HwEjeFSD1DDh3j0q47bDSVuZt20RiJWxGqjtm73Wu2jip3C2KaZI3dQx/fSeeXCr/uEN4LNaNj7Ytw== dependencies: oniguruma "^7.2.0" @@ -418,20 +413,30 @@ 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.4.0-beta4: - version "0.4.0-beta4" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.4.0-beta4.tgz#7762ea342c6b4f5e824d83466bd93793c9d7d779" - integrity sha512-TIbEBVhydGIxcyu/CfKJbD+BKHisMGbkAfaWlCPaWis2Xmw8yE7CKrCPn+lhZYl1MdjDVEmb8lQI6WetbC2OZA== +xterm-addon-search@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.5.0.tgz#cd3a2f8056084c28e236d4e732da37682010bcc2" + integrity sha512-zLVqVTrg5w2nk9fRj3UuVKCPo/dmFe/cLf3EM9Is5Dm6cgOoXmeo9eq2KgD8A0gquAflTFTf0ya2NaFmShHwyg== + +xterm-addon-unicode11@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.1.1.tgz#b209ef137db38096f68636af4ef4d0c0acba85ad" + integrity sha512-z6vJTL+dpNljwAYzYoyDjJP8A2XjZuEosl0sRa+FGRf3jEyEVWquDM53MfUd1ztVdAPQ839qR6eYK1BXV04Bhw== xterm-addon-web-links@0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2" integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ== -xterm@4.3.0-beta17: - version "4.3.0-beta17" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta17.tgz#c038cc00cb5be33d2a5f083255c329d9ed186565" - integrity sha512-Lgz7vL12MBKJSgK/UXJF22Yw+uEXEE7YZDWfUD+/jbHAKN4geLQJ/Y/b3gxjLL020dnYZuayfKOr2KWdhKsmCA== +xterm-addon-webgl@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.5.0.tgz#c1031dc7599cce3509824643ab5f15361c928e3e" + integrity sha512-hQrvabKCnwXFaEZ+YtoJM9Pm0CIBXL5KSwoU+RiGStU3KYTAcqYP2GsH3dWdvKX6kTWhWLS81dtDsGkfbOciuA== + +xterm@4.5.0-beta.4: + version "4.5.0-beta.4" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.5.0-beta.4.tgz#701f05553b643236d3fcd8bb7f14045bd4537c92" + integrity sha512-Yv1Bf60LTLBMaig1rv033hPz8hQGXZN6VYW2oe/409t2NbJXPg5xZgf47qyaWFV7a5k1BFiwjayJCWaL2nYBew== yauzl@^2.9.2: version "2.10.0" diff --git a/scripts/code-web.js b/scripts/code-web.js index 123d8261a9ed8..4556e7d7e6dcb 100755 --- a/scripts/code-web.js +++ b/scripts/code-web.js @@ -20,17 +20,35 @@ const EXTENSIONS_ROOT = path.join(APP_ROOT, 'extensions'); const WEB_MAIN = path.join(APP_ROOT, 'src', 'vs', 'code', 'browser', 'workbench', 'workbench-dev.html'); const args = minimist(process.argv, { - string: [ + boolean: [ 'no-launch', + 'help' + ], + string: [ 'scheme', - 'host' + 'host', + 'port', + 'local_port' ], - number: [ - 'port' - ] }); +if (args.help) { + console.log( + 'yarn web [options]\n' + + ' --no-launch Do not open VSCode web in the browser\n' + + ' --scheme Protocol (https or http)\n' + + ' --host Remote host\n' + + ' --port Remote/Local port\n' + + ' --local_port Local port override\n' + + ' --help\n' + + '[Example]\n' + + ' yarn web --scheme https --host example.com --port 8080 --local_port 30000' + ); + process.exit(0); +} + const PORT = args.port || process.env.PORT || 8080; +const LOCAL_PORT = args.local_port || process.env.LOCAL_PORT || PORT; const SCHEME = args.scheme || process.env.VSCODE_SCHEME || 'http'; const HOST = args.host || 'localhost'; const AUTHORITY = process.env.VSCODE_AUTHORITY || `${HOST}:${PORT}`; @@ -44,6 +62,17 @@ const server = http.createServer((req, res) => { // favicon return serveFile(req, res, path.join(APP_ROOT, 'resources', 'win32', 'code.ico')); } + if (pathname === '/manifest.json') { + // manifest + res.writeHead(200, { 'Content-Type': 'application/json' }); + return res.end(JSON.stringify({ + 'name': 'Code Web - OSS', + 'short_name': 'Code Web - OSS', + 'start_url': '/', + 'lang': 'en-US', + 'display': 'standalone' + })); + } if (/^\/static\//.test(pathname)) { // static requests return handleStatic(req, res, parsedUrl); @@ -65,8 +94,11 @@ const server = http.createServer((req, res) => { } }); -server.listen(PORT, () => { - console.log(`Web UI available at ${SCHEME}://${AUTHORITY}`); +server.listen(LOCAL_PORT, () => { + if (LOCAL_PORT !== PORT) { + console.log(`Operating location at http://0.0.0.0:${LOCAL_PORT}`); + } + console.log(`Web UI available at ${SCHEME}://${AUTHORITY}`); }); server.on('error', err => { @@ -121,7 +153,7 @@ async function handleRoot(req, res) { return; // seems to fail to JSON.parse()?! } - packageJSON.extensionKind = 'web'; // enable for Web + packageJSON.extensionKind = ['web']; // enable for Web mapExtensionFolderToExtensionPackageJSON.set(extensionFolder, packageJSON); } catch (error) { @@ -206,6 +238,14 @@ function getMediaMime(forPath) { */ async function serveFile(req, res, filePath, responseHeaders = Object.create(null)) { try { + + // Sanity checks + filePath = path.normalize(filePath); // ensure no "." and ".." + if (filePath.indexOf(`${APP_ROOT}${path.sep}`) !== 0) { + // invalid location outside of APP_ROOT + return serveError(req, res, 400, `Bad request.`); + } + const stat = await util.promisify(fs.stat)(filePath); // Check if file modified since diff --git a/scripts/code.bat b/scripts/code.bat index 0eb0eb0b342b8..770d37b7aece2 100644 --- a/scripts/code.bat +++ b/scripts/code.bat @@ -13,9 +13,8 @@ set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" -:: Download Electron if needed -node build\lib\electron.js -if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron +:: Get electron +call yarn electron :: Manage built-in extensions if "%1"=="--builtin" goto builtin diff --git a/scripts/code.sh b/scripts/code.sh index 4ba1a00b9f7c6..0afe96bfcb6a5 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -50,7 +50,7 @@ function code() { export VSCODE_LOGS= # Launch Code - exec "$CODE" . "$@" + exec "$CODE" . --no-sandbox "$@" } function code-wsl() diff --git a/scripts/test-integration.bat b/scripts/test-integration.bat index 946cf383914a5..cb7271a91523b 100644 --- a/scripts/test-integration.bat +++ b/scripts/test-integration.bat @@ -3,7 +3,7 @@ setlocal pushd %~dp0\.. -set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5% +set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2% :: Figure out which Electron to use for running tests if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" ( @@ -12,18 +12,26 @@ if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" ( set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1 - echo "Running integration tests out of sources." + echo Running integration tests out of sources. ) else ( :: Run from a built: need to compile all test extensions - call yarn gulp compile-extension:vscode-api-tests - call yarn gulp compile-extension:vscode-colorize-tests - call yarn gulp compile-extension:markdown-language-features - call yarn gulp compile-extension:emmet - call yarn gulp compile-extension:css-language-features-server - call yarn gulp compile-extension:html-language-features-server - call yarn gulp compile-extension:json-language-features-server - - echo "Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build." + :: because we run extension tests from their source folders + :: and the build bundles extensions into .build webpacked + call yarn gulp compile-extension:vscode-api-tests^ + compile-extension:vscode-colorize-tests^ + compile-extension:markdown-language-features^ + compile-extension:emmet^ + compile-extension:css-language-features-server^ + compile-extension:html-language-features-server^ + compile-extension:json-language-features-server^ + compile-extension:git + + :: Configuration for more verbose output + set VSCODE_CLI=1 + set ELECTRON_ENABLE_LOGGING=1 + set ELECTRON_ENABLE_STACK_DUMPING=1 + + echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build. ) :: Integration & performance tests in AMD @@ -41,17 +49,22 @@ 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% if %errorlevel% neq 0 exit /b %errorlevel% -call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% . +call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\markdown-language-features\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --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\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% . +if %errorlevel% neq 0 exit /b %errorlevel% + +for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i +set GITWORKSPACE=%TEMPDIR%\git-%RANDOM% +mkdir %GITWORKSPACE% +call "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% if %errorlevel% neq 0 exit /b %errorlevel% :: Tests in commonJS (HTML, CSS, JSON language server tests...) call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js if %errorlevel% neq 0 exit /b %errorlevel% -if exist ".\resources\server\test\test-remote-integration.bat" ( - call .\resources\server\test\test-remote-integration.bat -) - rmdir /s /q %VSCODEUSERDATADIR% popd diff --git a/scripts/test-integration.sh b/scripts/test-integration.sh index 21652b632cf32..6659549f001f0 100755 --- a/scripts/test-integration.sh +++ b/scripts/test-integration.sh @@ -4,13 +4,12 @@ set -e if [[ "$OSTYPE" == "darwin"* ]]; then realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } ROOT=$(dirname $(dirname $(realpath "$0"))) - VSCODEUSERDATADIR=`mktemp -d -t 'myuserdatadir'` else ROOT=$(dirname $(dirname $(readlink -f $0))) - VSCODEUSERDATADIR=`mktemp -d 2>/dev/null` LINUX_NO_SANDBOX="--no-sandbox" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox. fi +VSCODEUSERDATADIR=`mktemp -d 2>/dev/null` cd $ROOT # Figure out which Electron to use for running tests @@ -22,13 +21,21 @@ then echo "Running integration tests out of sources." else # Run from a built: need to compile all test extensions - yarn gulp compile-extension:vscode-api-tests - yarn gulp compile-extension:vscode-colorize-tests - yarn gulp compile-extension:markdown-language-features - yarn gulp compile-extension:emmet - yarn gulp compile-extension:css-language-features-server - yarn gulp compile-extension:html-language-features-server - yarn gulp compile-extension:json-language-features-server + # because we run extension tests from their source folders + # and the build bundles extensions into .build webpacked + yarn gulp compile-extension:vscode-api-tests \ + compile-extension:vscode-colorize-tests \ + compile-extension:markdown-language-features \ + compile-extension:emmet \ + compile-extension:css-language-features-server \ + compile-extension:html-language-features-server \ + compile-extension:json-language-features-server \ + compile-extension:git + + # Configuration for more verbose output + export VSCODE_CLI=1 + export ELECTRON_ENABLE_STACK_DUMPING=1 + export ELECTRON_ENABLE_LOGGING=1 echo "Running integration tests with '$INTEGRATION_TEST_ELECTRON_PATH' as build." fi @@ -40,17 +47,9 @@ fi "$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 -rm -rf $ROOT/extensions/emmet/test-fixtures - -# Remote Integration Tests -if [ -f ./resources/server/test/test-remote-integration.sh ]; then - ./resources/server/test/test-remote-integration.sh -fi +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/markdown-language-features/out/test/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/emmet/out/test/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 +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --user-data-dir=$VSCODEUSERDATADIR # Tests in commonJS cd $ROOT/extensions/css-language-features/server && $ROOT/scripts/node-electron.sh test/index.js diff --git a/scripts/test.bat b/scripts/test.bat index 0d1350a79ece2..089973f9e38b9 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -17,7 +17,7 @@ if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron :: Run tests set ELECTRON_ENABLE_LOGGING=1 -%CODE% .\test\electron\index.js %* +%CODE% .\test\unit\electron\index.js %* popd diff --git a/scripts/test.sh b/scripts/test.sh index 2829899329568..651cffb88f504 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -29,10 +29,10 @@ if [[ "$OSTYPE" == "darwin"* ]]; then cd $ROOT ; ulimit -n 4096 ; \ ELECTRON_ENABLE_LOGGING=1 \ "$CODE" \ - test/electron/index.js "$@" + test/unit/electron/index.js "$@" else cd $ROOT ; \ ELECTRON_ENABLE_LOGGING=1 \ "$CODE" \ - test/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox. + test/unit/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox. fi diff --git a/src/.eslintrc b/src/.eslintrc deleted file mode 100644 index c25b0d558c2c3..0000000000000 --- a/src/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6 - }, - "env": { - "node": true, - "es6": true, - "browser": true, - "amd": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": "error", - "no-extra-semi": "error", - "semi": "error", - "no-inner-declarations": 0 - } -} \ No newline at end of file diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index 0336f9eb70034..0ab195f924f23 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -212,7 +212,7 @@ function onUnexpectedError(error, enableDeveloperTools) { console.error('[uncaught exception]: ' + error); - if (error.stack) { + if (error && error.stack) { console.error(error.stack); } } diff --git a/src/main.js b/src/main.js index 7242b0cb156a3..f8aa90f9c8c9b 100644 --- a/src/main.js +++ b/src/main.js @@ -82,7 +82,7 @@ app.once('ready', function () { traceOptions: args['trace-options'] || 'record-until-full,enable-sampling' }; - contentTracing.startRecording(traceOptions, () => onReady()); + contentTracing.startRecording(traceOptions).finally(() => onReady()); } else { onReady(); } @@ -131,8 +131,15 @@ function configureCommandlineSwitchesSync(cliArgs) { 'disable-hardware-acceleration', // provided by Electron - 'disable-color-correct-rendering' + 'disable-color-correct-rendering', + + // override for the color profile to use + 'force-color-profile' ]; + + if (process.platform === 'linux') { + SUPPORTED_ELECTRON_SWITCHES.push('force-renderer-accessibility'); + } // Read argv config const argvConfig = readArgvConfigSync(); @@ -144,7 +151,16 @@ function configureCommandlineSwitchesSync(cliArgs) { } const argvValue = argvConfig[argvKey]; - if (argvValue === true || argvValue === 'true') { + + // Color profile + if (argvKey === 'force-color-profile') { + if (argvValue) { + app.commandLine.appendSwitch(argvKey, argvValue); + } + } + + // Others + else if (argvValue === true || argvValue === 'true') { if (argvKey === 'disable-hardware-acceleration') { app.disableHardwareAcceleration(); // needs to be called explicitly } else { @@ -159,6 +175,9 @@ function configureCommandlineSwitchesSync(cliArgs) { app.commandLine.appendSwitch('js-flags', jsFlags); } + // TODO@Ben TODO@Deepak Electron 7 workaround for https://github.com/microsoft/vscode/issues/88873 + app.commandLine.appendSwitch('disable-features', 'LayoutNG'); + return argvConfig; } diff --git a/src/tsconfig.base.json b/src/tsconfig.base.json index 44595cf5246db..73985c6c9afdf 100644 --- a/src/tsconfig.base.json +++ b/src/tsconfig.base.json @@ -2,15 +2,10 @@ "compilerOptions": { "module": "amd", "moduleResolution": "node", - "noImplicitAny": true, "experimentalDecorators": true, "noImplicitReturns": true, "noUnusedLocals": true, - "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, + "strict": true, "forceConsistentCasingInFileNames": true, "baseUrl": ".", "paths": { diff --git a/src/tsconfig.json b/src/tsconfig.json index 8917d57336d6a..b8cc1caf2cd43 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -24,9 +24,6 @@ "./vs" ], "exclude": [ - "./typings/require-monaco.d.ts", - "./typings/xterm.d.ts", - "./typings/xterm-addon-search.d.ts", - "./typings/xterm-addon-web-links.d.ts" + "./typings/es6-promise.d.ts" ] } diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts deleted file mode 100644 index e4c3221c6eb7b..0000000000000 --- a/src/typings/electron.d.ts +++ /dev/null @@ -1,10730 +0,0 @@ -// Type definitions for Electron 6.1.4 -// Project: http://electronjs.org/ -// Definitions by: The Electron Team -// Definitions: https://github.com/electron/electron-typescript-definitions - -/// - -type GlobalEvent = Event; - -declare namespace Electron { - // TODO: Replace this declaration with NodeJS.EventEmitter - class EventEmitter { - addListener(event: string, listener: Function): this; - on(event: string, listener: Function): this; - once(event: string, listener: Function): this; - removeListener(event: string, listener: Function): this; - removeAllListeners(event?: string): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - listenerCount(type: string): number; - prependListener(event: string, listener: Function): this; - prependOnceListener(event: string, listener: Function): this; - eventNames(): Array<(string | symbol)>; - } - - class Accelerator extends String { - - } - - interface CommonInterface { - clipboard: Clipboard; - crashReporter: CrashReporter; - nativeImage: typeof NativeImage; - shell: Shell; - } - - interface MainInterface extends CommonInterface { - app: App; - autoUpdater: AutoUpdater; - BrowserView: typeof BrowserView; - BrowserWindow: typeof BrowserWindow; - ClientRequest: typeof ClientRequest; - contentTracing: ContentTracing; - Cookies: typeof Cookies; - Debugger: typeof Debugger; - dialog: Dialog; - DownloadItem: typeof DownloadItem; - globalShortcut: GlobalShortcut; - inAppPurchase: InAppPurchase; - IncomingMessage: typeof IncomingMessage; - ipcMain: IpcMain; - Menu: typeof Menu; - MenuItem: typeof MenuItem; - net: Net; - netLog: NetLog; - Notification: typeof Notification; - powerMonitor: PowerMonitor; - powerSaveBlocker: PowerSaveBlocker; - protocol: Protocol; - screen: Screen; - session: typeof Session; - systemPreferences: SystemPreferences; - TouchBar: typeof TouchBar; - Tray: typeof Tray; - webContents: typeof WebContents; - WebRequest: typeof WebRequest; - } - - interface RendererInterface extends CommonInterface { - BrowserWindowProxy: typeof BrowserWindowProxy; - contextBridge: ContextBridge; - desktopCapturer: DesktopCapturer; - ipcRenderer: IpcRenderer; - remote: Remote; - webFrame: WebFrame; - webviewTag: WebviewTag; - } - - interface AllElectron extends MainInterface, RendererInterface { } - - const app: App; - const autoUpdater: AutoUpdater; - const clipboard: Clipboard; - const contentTracing: ContentTracing; - const contextBridge: ContextBridge; - const crashReporter: CrashReporter; - const desktopCapturer: DesktopCapturer; - const dialog: Dialog; - const globalShortcut: GlobalShortcut; - const inAppPurchase: InAppPurchase; - const ipcMain: IpcMain; - const ipcRenderer: IpcRenderer; - type nativeImage = NativeImage; - const nativeImage: typeof NativeImage; - const net: Net; - const netLog: NetLog; - const powerMonitor: PowerMonitor; - const powerSaveBlocker: PowerSaveBlocker; - const protocol: Protocol; - // const remote: Remote; ### VSCODE CHANGE (we do not want to use remote) - const screen: Screen; - type session = Session; - const session: typeof Session; - const shell: Shell; - const systemPreferences: SystemPreferences; - type webContents = WebContents; - const webContents: typeof WebContents; - const webFrame: WebFrame; - const webviewTag: WebviewTag; - - interface App extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/app - - /** - * Emitted when Chrome's accessibility support changes. This event fires when - * assistive technologies, such as screen readers, are enabled or disabled. See - * https://www.chromium.org/developers/design-documents/accessibility for more - * details. - */ - on(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - once(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - addListener(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - removeListener(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - /** - * Emitted when the application is activated. Various actions can trigger this - * event, such as launching the application for the first time, attempting to - * re-launch the application when it's already running, or clicking on the - * application's dock or taskbar icon. - */ - on(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - once(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - addListener(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - removeListener(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - /** - * Emitted during Handoff after an activity from this device was successfully - * resumed on another one. - */ - on(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - once(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - addListener(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - removeListener(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - /** - * Emitted before the application starts closing its windows. Calling - * event.preventDefault() will prevent the default behavior, which is terminating - * the application. Note: If application quit was initiated by - * autoUpdater.quitAndInstall(), then before-quit is emitted after emitting close - * event on all windows and closing them. Note: On Windows, this event will not be - * emitted if the app is closed due to a shutdown/restart of the system or a user - * logout. - */ - on(event: 'before-quit', listener: (event: Event) => void): this; - once(event: 'before-quit', listener: (event: Event) => void): this; - addListener(event: 'before-quit', listener: (event: Event) => void): this; - removeListener(event: 'before-quit', listener: (event: Event) => void): this; - /** - * Emitted when a browserWindow gets blurred. - */ - on(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when a new browserWindow is created. - */ - on(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when a browserWindow gets focused. - */ - on(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when failed to verify the certificate for url, to trust the certificate - * you should prevent the default behavior with event.preventDefault() and call - * callback(true). - */ - on(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - /** - * Emitted during Handoff when an activity from a different device wants to be - * resumed. You should call event.preventDefault() if you want to handle this - * event. A user activity can be continued only in an app that has the same - * developer Team ID as the activity's source app and that supports the activity's - * type. Supported activity types are specified in the app's Info.plist under the - * NSUserActivityTypes key. - */ - on(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - once(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - addListener(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - removeListener(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - /** - * Emitted during Handoff when an activity from a different device fails to be - * resumed. - */ - on(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - once(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - addListener(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - removeListener(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - /** - * Emitted when desktopCapturer.getSources() is called in the renderer process of - * webContents. Calling event.preventDefault() will make it return empty sources. - */ - on(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when the gpu process crashes or is killed. - */ - on(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - once(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - addListener(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - removeListener(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - /** - * Emitted when webContents wants to do basic auth. The default behavior is to - * cancel all authentications. To override this you should prevent the default - * behavior with event.preventDefault() and call callback(username, password) with - * the credentials. - */ - on(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when the user clicks the native macOS new tab button. The new tab button - * is only visible if the current BrowserWindow has a tabbingIdentifier - */ - on(event: 'new-window-for-tab', listener: (event: Event) => void): this; - once(event: 'new-window-for-tab', listener: (event: Event) => void): this; - addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; - removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; - /** - * Emitted when the user wants to open a file with the application. The open-file - * event is usually emitted when the application is already open and the OS wants - * to reuse the application to open the file. open-file is also emitted when a file - * is dropped onto the dock and the application is not yet running. Make sure to - * listen for the open-file event very early in your application startup to handle - * this case (even before the ready event is emitted). You should call - * event.preventDefault() if you want to handle this event. On Windows, you have to - * parse process.argv (in the main process) to get the filepath. - */ - on(event: 'open-file', listener: (event: Event, - path: string) => void): this; - once(event: 'open-file', listener: (event: Event, - path: string) => void): this; - addListener(event: 'open-file', listener: (event: Event, - path: string) => void): this; - removeListener(event: 'open-file', listener: (event: Event, - path: string) => void): this; - /** - * Emitted when the user wants to open a URL with the application. Your - * application's Info.plist file must define the url scheme within the - * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should - * call event.preventDefault() if you want to handle this event. - */ - on(event: 'open-url', listener: (event: Event, - url: string) => void): this; - once(event: 'open-url', listener: (event: Event, - url: string) => void): this; - addListener(event: 'open-url', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'open-url', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when the application is quitting. Note: On Windows, this event will not - * be emitted if the app is closed due to a shutdown/restart of the system or a - * user logout. - */ - on(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - once(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - addListener(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - removeListener(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - /** - * Emitted when Electron has finished initializing. On macOS, launchInfo holds the - * userInfo of the NSUserNotification that was used to open the application, if it - * was launched from Notification Center. You can call app.isReady() to check if - * this event has already fired. - */ - on(event: 'ready', listener: (launchInfo: any) => void): this; - once(event: 'ready', listener: (launchInfo: any) => void): this; - addListener(event: 'ready', listener: (launchInfo: any) => void): this; - removeListener(event: 'ready', listener: (launchInfo: any) => void): this; - /** - * Emitted when remote.getBuiltin() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the module from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - once(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - addListener(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - removeListener(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - /** - * Emitted when remote.getCurrentWebContents() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when remote.getCurrentWindow() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when remote.getGlobal() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the global from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - once(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - addListener(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - removeListener(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - /** - * Emitted when .getWebContents() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - once(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - addListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - /** - * Emitted when remote.require() is called in the renderer process of webContents. - * Calling event.preventDefault() will prevent the module from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - once(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - addListener(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - removeListener(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - /** - * Emitted when the renderer process of webContents crashes or is killed. - */ - on(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - once(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - addListener(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - removeListener(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - /** - * This event will be emitted inside the primary instance of your application when - * a second instance has been executed and calls app.requestSingleInstanceLock(). - * argv is an Array of the second instance's command line arguments, and - * workingDirectory is its current working directory. Usually applications respond - * to this by making their primary window focused and non-minimized. This event is - * guaranteed to be emitted after the ready event of app gets emitted. Note: Extra - * command line arguments might be added by Chromium, such as - * --original-process-start-time. - */ - on(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - once(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - addListener(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - removeListener(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - /** - * Emitted when a client certificate is requested. The url corresponds to the - * navigation entry requesting the client certificate and callback can be called - * with an entry filtered from the list. Using event.preventDefault() prevents the - * application from using the first certificate from the store. - */ - on(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - /** - * Emitted when Electron has created a new session. - */ - on(event: 'session-created', listener: (session: Session) => void): this; - once(event: 'session-created', listener: (session: Session) => void): this; - addListener(event: 'session-created', listener: (session: Session) => void): this; - removeListener(event: 'session-created', listener: (session: Session) => void): this; - /** - * Emitted when Handoff is about to be resumed on another device. If you need to - * update the state to be transferred, you should call event.preventDefault() - * immediately, construct a new userInfo dictionary and call - * app.updateCurrentActiviy() in a timely manner. Otherwise, the operation will - * fail and continue-activity-error will be called. - */ - on(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - once(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - addListener(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - removeListener(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - /** - * Emitted when a new webContents is created. - */ - on(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted during Handoff before an activity from a different device wants to be - * resumed. You should call event.preventDefault() if you want to handle this - * event. - */ - on(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - once(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - addListener(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - removeListener(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - /** - * Emitted when the application has finished basic startup. On Windows and Linux, - * the will-finish-launching event is the same as the ready event; on macOS, this - * event represents the applicationWillFinishLaunching notification of - * NSApplication. You would usually set up listeners for the open-file and open-url - * events here, and start the crash reporter and auto updater. In most cases, you - * should do everything in the ready event handler. - */ - on(event: 'will-finish-launching', listener: Function): this; - once(event: 'will-finish-launching', listener: Function): this; - addListener(event: 'will-finish-launching', listener: Function): this; - removeListener(event: 'will-finish-launching', listener: Function): this; - /** - * Emitted when all windows have been closed and the application will quit. Calling - * event.preventDefault() will prevent the default behaviour, which is terminating - * the application. See the description of the window-all-closed event for the - * differences between the will-quit and window-all-closed events. Note: On - * Windows, this event will not be emitted if the app is closed due to a - * shutdown/restart of the system or a user logout. - */ - on(event: 'will-quit', listener: (event: Event) => void): this; - once(event: 'will-quit', listener: (event: Event) => void): this; - addListener(event: 'will-quit', listener: (event: Event) => void): this; - removeListener(event: 'will-quit', listener: (event: Event) => void): this; - /** - * Emitted when all windows have been closed. If you do not subscribe to this event - * and all windows are closed, the default behavior is to quit the app; however, if - * you subscribe, you control whether the app quits or not. If the user pressed Cmd - * + Q, or the developer called app.quit(), Electron will first try to close all - * the windows and then emit the will-quit event, and in this case the - * window-all-closed event would not be emitted. - */ - on(event: 'window-all-closed', listener: Function): this; - once(event: 'window-all-closed', listener: Function): this; - addListener(event: 'window-all-closed', listener: Function): this; - removeListener(event: 'window-all-closed', listener: Function): this; - /** - * Adds path to the recent documents list. This list is managed by the OS. On - * Windows, you can visit the list from the task bar, and on macOS, you can visit - * it from dock menu. - */ - addRecentDocument(path: string): void; - /** - * Clears the recent documents list. - */ - clearRecentDocuments(): void; - /** - * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain - * basis if the GPU processes crashes too frequently. This function disables that - * behaviour. This method can only be called before app is ready. - */ - disableDomainBlockingFor3DAPIs(): void; - /** - * Disables hardware acceleration for current app. This method can only be called - * before app is ready. - */ - disableHardwareAcceleration(): void; - /** - * Enables full sandbox mode on the app. This method can only be called before app - * is ready. - */ - enableSandbox(): void; - /** - * Exits immediately with exitCode. exitCode defaults to 0. All windows will be - * closed immediately without asking the user, and the before-quit and will-quit - * events will not be emitted. - */ - exit(exitCode?: number): void; - /** - * On Linux, focuses on the first visible window. On macOS, makes the application - * the active app. On Windows, focuses on the application's first window. - */ - focus(): void; - getAppMetrics(): ProcessMetric[]; - getAppPath(): string; - getBadgeCount(): number; - getCurrentActivityType(): string; - /** - * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux - * and macOS, icons depend on the application associated with file mime type. - */ - getFileIcon(path: string, options?: FileIconOptions): Promise; - /** - * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On - * Linux and macOS, icons depend on the application associated with file mime type. - * Deprecated Soon - */ - getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; - /** - * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On - * Linux and macOS, icons depend on the application associated with file mime type. - * Deprecated Soon - */ - getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; - getGPUFeatureStatus(): GPUFeatureStatus; - /** - * For infoType equal to complete: Promise is fulfilled with Object containing all - * the GPU Information as in chromium's GPUInfo object. This includes the version - * and driver information that's shown on chrome://gpu page. For infoType equal to - * basic: Promise is fulfilled with Object containing fewer attributes than when - * requested with complete. Here's an example of basic response: Using basic should - * be preferred if only basic information like vendorId or driverId is needed. - */ - getGPUInfo(infoType: string): Promise; - getJumpListSettings(): JumpListSettings; - /** - * To set the locale, you'll want to use a command line switch at app startup, - * which may be found here. Note: When distributing your packaged app, you have to - * also ship the locales folder. Note: On Windows, you have to call it after the - * ready events gets emitted. - */ - getLocale(): string; - /** - * Note: When unable to detect locale country code, it returns empty string. - */ - getLocaleCountryCode(): string; - /** - * If you provided path and args options to app.setLoginItemSettings, then you need - * to pass the same arguments here for openAtLogin to be set correctly. - */ - getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings; - /** - * Usually the name field of package.json is a short lowercased name, according to - * the npm modules spec. You should usually also specify a productName field, which - * is your application's full capitalized name, and which will be preferred over - * name by Electron. - */ - getName(): string; - /** - * You can request the following paths by the name: - */ - getPath(name: string): string; - getVersion(): string; - /** - * This method returns whether or not this instance of your app is currently - * holding the single instance lock. You can request the lock with - * app.requestSingleInstanceLock() and release with app.releaseSingleInstanceLock() - */ - hasSingleInstanceLock(): boolean; - /** - * Hides all application windows without minimizing them. - */ - hide(): void; - /** - * Imports the certificate in pkcs12 format into the platform certificate store. - * callback is called with the result of import operation, a value of 0 indicates - * success while any other value indicates failure according to Chromium - * net_error_list. - */ - importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; - /** - * Invalidates the current Handoff user activity. - */ - invalidateCurrentActivity(type: string): void; - /** - * Deprecated Soon - */ - isAccessibilitySupportEnabled(): boolean; - /** - * This method checks if the current executable is the default handler for a - * protocol (aka URI scheme). If so, it will return true. Otherwise, it will return - * false. Note: On macOS, you can use this method to check if the app has been - * registered as the default protocol handler for a protocol. You can also verify - * this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the - * macOS machine. Please refer to Apple's documentation for details. The API uses - * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. - */ - isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - isEmojiPanelSupported(): boolean; - isInApplicationsFolder(): boolean; - isReady(): boolean; - isUnityRunning(): boolean; - /** - * No confirmation dialog will be presented by default. If you wish to allow the - * user to confirm the operation, you may do so using the dialog API. NOTE: This - * method throws errors if anything other than the user causes the move to fail. - * For instance if the user cancels the authorization dialog, this method returns - * false. If we fail to perform the copy, then this method will throw an error. The - * message in the error should be informative and tell you exactly what went wrong - */ - moveToApplicationsFolder(): boolean; - /** - * Try to close all windows. The before-quit event will be emitted first. If all - * windows are successfully closed, the will-quit event will be emitted and by - * default the application will terminate. This method guarantees that all - * beforeunload and unload event handlers are correctly executed. It is possible - * that a window cancels the quitting by returning false in the beforeunload event - * handler. - */ - quit(): void; - /** - * Relaunches the app when current instance exits. By default, the new instance - * will use the same working directory and command line arguments with current - * instance. When args is specified, the args will be passed as command line - * arguments instead. When execPath is specified, the execPath will be executed for - * relaunch instead of current app. Note that this method does not quit the app - * when executed, you have to call app.quit or app.exit after calling app.relaunch - * to make the app restart. When app.relaunch is called for multiple times, - * multiple instances will be started after current instance exited. An example of - * restarting current instance immediately and adding a new command line argument - * to the new instance: - */ - relaunch(options?: RelaunchOptions): void; - /** - * Releases all locks that were created by requestSingleInstanceLock. This will - * allow multiple instances of the application to once again run side by side. - */ - releaseSingleInstanceLock(): void; - /** - * This method checks if the current executable as the default handler for a - * protocol (aka URI scheme). If so, it will remove the app as the default handler. - */ - removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - /** - * The return value of this method indicates whether or not this instance of your - * application successfully obtained the lock. If it failed to obtain the lock, - * you can assume that another instance of your application is already running with - * the lock and exit immediately. I.e. This method returns true if your process is - * the primary instance of your application and your app should continue loading. - * It returns false if your process should immediately quit as it has sent its - * parameters to another instance that has already acquired the lock. On macOS, the - * system enforces single instance automatically when users try to open a second - * instance of your app in Finder, and the open-file and open-url events will be - * emitted for that. However when users start your app in command line, the - * system's single instance mechanism will be bypassed, and you have to use this - * method to ensure single instance. An example of activating the window of primary - * instance when a second instance starts: - */ - requestSingleInstanceLock(): boolean; - /** - * Set the about panel options. This will override the values defined in the app's - * .plist file on MacOS. See the Apple docs for more details. On Linux, values must - * be set in order to be shown; there are no defaults. - */ - setAboutPanelOptions(options: AboutPanelOptionsOptions): void; - /** - * Manually enables Chrome's accessibility support, allowing to expose - * accessibility switch to users in application settings. See Chromium's - * accessibility docs for more details. Disabled by default. This API must be - * called after the ready event is emitted. Note: Rendering accessibility tree can - * significantly affect the performance of your app. It should not be enabled by - * default. Deprecated Soon - */ - setAccessibilitySupportEnabled(enabled: boolean): void; - /** - * Sets or creates a directory your app's logs which can then be manipulated with - * app.getPath() or app.setPath(pathName, newPath). Calling app.setAppLogsPath() - * without a path parameter will result in this directory being set to - * /Library/Logs/YourAppName on macOS, and inside the userData directory on Linux - * and Windows. - */ - setAppLogsPath(path?: string): void; - /** - * Changes the Application User Model ID to id. - */ - setAppUserModelId(id: string): void; - /** - * This method sets the current executable as the default handler for a protocol - * (aka URI scheme). It allows you to integrate your app deeper into the operating - * system. Once registered, all links with your-protocol:// will be opened with the - * current executable. The whole link, including protocol, will be passed to your - * application as a parameter. On Windows, you can provide optional parameters - * path, the path to your executable, and args, an array of arguments to be passed - * to your executable when it launches. Note: On macOS, you can only register - * protocols that have been added to your app's info.plist, which can not be - * modified at runtime. You can however change the file with a simple text editor - * or script during build time. Please refer to Apple's documentation for details. - * Note: In a Windows Store environment (when packaged as an appx) this API will - * return true for all calls but the registry key it sets won't be accessible by - * other applications. In order to register your Windows Store application as a - * default protocol handler you must declare the protocol in your manifest. The API - * uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally. - */ - setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - /** - * Sets the counter badge for current app. Setting the count to 0 will hide the - * badge. On macOS, it shows on the dock icon. On Linux, it only works for Unity - * launcher. Note: Unity launcher requires the existence of a .desktop file to - * work, for more information please read Desktop Environment Integration. - */ - setBadgeCount(count: number): boolean; - /** - * Sets or removes a custom Jump List for the application, and returns one of the - * following strings: If categories is null the previously set custom Jump List (if - * any) will be replaced by the standard Jump List for the app (managed by - * Windows). Note: If a JumpListCategory object has neither the type nor the name - * property set then its type is assumed to be tasks. If the name property is set - * but the type property is omitted then the type is assumed to be custom. Note: - * Users can remove items from custom categories, and Windows will not allow a - * removed item to be added back into a custom category until after the next - * successful call to app.setJumpList(categories). Any attempt to re-add a removed - * item to a custom category earlier than that will result in the entire custom - * category being omitted from the Jump List. The list of removed items can be - * obtained using app.getJumpListSettings(). Here's a very simple example of - * creating a custom Jump List: - */ - setJumpList(categories: JumpListCategory[]): void; - /** - * Set the app's login item settings. To work with Electron's autoUpdater on - * Windows, which uses Squirrel, you'll want to set the launch path to Update.exe, - * and pass arguments that specify your application name. For example: - */ - setLoginItemSettings(settings: Settings): void; - /** - * Overrides the current application's name. - */ - setName(name: string): void; - /** - * Overrides the path to a special directory or file associated with name. If the - * path specifies a directory that does not exist, an Error is thrown. In that - * case, the directory should be created with fs.mkdirSync or similar. You can only - * override paths of a name defined in app.getPath. By default, web pages' cookies - * and caches will be stored under the userData directory. If you want to change - * this location, you have to override the userData path before the ready event of - * the app module is emitted. - */ - setPath(name: string, path: string): void; - /** - * Creates an NSUserActivity and sets it as the current activity. The activity is - * eligible for Handoff to another device afterward. - */ - setUserActivity(type: string, userInfo: any, webpageURL?: string): void; - /** - * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array - * of Task objects. Note: If you'd like to customize the Jump List even more use - * app.setJumpList(categories) instead. - */ - setUserTasks(tasks: Task[]): boolean; - /** - * Shows application windows after they were hidden. Does not automatically focus - * them. - */ - show(): void; - /** - * Show the app's about panel options. These options can be overridden with - * app.setAboutPanelOptions(options). - */ - showAboutPanel(): void; - /** - * Show the platform's native emoji picker. - */ - showEmojiPanel(): void; - /** - * Start accessing a security scoped resource. With this method Electron - * applications that are packaged for the Mac App Store may reach outside their - * sandbox to access files chosen by the user. See Apple's documentation for a - * description of how this system works. - */ - startAccessingSecurityScopedResource(bookmarkData: string): Function; - /** - * Updates the current activity if its type matches type, merging the entries from - * userInfo into its current userInfo dictionary. - */ - updateCurrentActivity(type: string, userInfo: any): void; - whenReady(): Promise; - /** - * A Boolean property that's true if Chrome's accessibility support is enabled, - * false otherwise. This property will be true if the use of assistive - * technologies, such as screen readers, has been detected. Setting this property - * to true manually enables Chrome's accessibility support, allowing developers to - * expose accessibility switch to users in application settings. See Chromium's - * accessibility docs for more details. Disabled by default. This API must be - * called after the ready event is emitted. Note: Rendering accessibility tree can - * significantly affect the performance of your app. It should not be enabled by - * default. - */ - accessibilitySupportEnabled?: boolean; - /** - * A Boolean which when true disables the overrides that Electron has in place to - * ensure renderer processes are restarted on every navigation. The current - * default value for this property is false. The intention is for these overrides - * to become disabled by default and then at some point in the future this property - * will be removed. This property impacts which native modules you can use in the - * renderer process. For more information on the direction Electron is going with - * renderer process restarts and usage of native modules in the renderer process - * please check out this Tracking Issue. - */ - allowRendererProcessReuse?: boolean; - /** - * A Menu property that return Menu if one has been set and null otherwise. Users - * can pass a Menu to set this property. - */ - applicationMenu?: Menu; - commandLine: CommandLine; - dock: Dock; - /** - * A Boolean property that returns true if the app is packaged, false otherwise. - * For many apps, this property can be used to distinguish development and - * production environments. - */ - isPackaged?: boolean; - /** - * A String which is the user agent string Electron will use as a global fallback. - * This is the user agent that will be used when no user agent is set at the - * webContents or session level. Useful for ensuring your entire app has the same - * user agent. Set to a custom value as early as possible in your apps - * initialization to ensure that your overridden value is used. - */ - userAgentFallback?: string; - } - - interface AutoUpdater extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/auto-updater - - /** - * This event is emitted after a user calls quitAndInstall(). When this API is - * called, the before-quit event is not emitted before all windows are closed. As a - * result you should listen to this event if you wish to perform actions before the - * windows are closed while a process is quitting, as well as listening to - * before-quit. - */ - on(event: 'before-quit-for-update', listener: Function): this; - once(event: 'before-quit-for-update', listener: Function): this; - addListener(event: 'before-quit-for-update', listener: Function): this; - removeListener(event: 'before-quit-for-update', listener: Function): this; - /** - * Emitted when checking if an update has started. - */ - on(event: 'checking-for-update', listener: Function): this; - once(event: 'checking-for-update', listener: Function): this; - addListener(event: 'checking-for-update', listener: Function): this; - removeListener(event: 'checking-for-update', listener: Function): this; - /** - * Emitted when there is an error while updating. - */ - on(event: 'error', listener: (error: Error) => void): this; - once(event: 'error', listener: (error: Error) => void): this; - addListener(event: 'error', listener: (error: Error) => void): this; - removeListener(event: 'error', listener: (error: Error) => void): this; - /** - * Emitted when there is an available update. The update is downloaded - * automatically. - */ - on(event: 'update-available', listener: Function): this; - once(event: 'update-available', listener: Function): this; - addListener(event: 'update-available', listener: Function): this; - removeListener(event: 'update-available', listener: Function): this; - /** - * Emitted when an update has been downloaded. On Windows only releaseName is - * available. Note: It is not strictly necessary to handle this event. A - * successfully downloaded update will still be applied the next time the - * application starts. - */ - on(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - once(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - addListener(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - removeListener(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - /** - * Emitted when there is no available update. - */ - on(event: 'update-not-available', listener: Function): this; - once(event: 'update-not-available', listener: Function): this; - addListener(event: 'update-not-available', listener: Function): this; - removeListener(event: 'update-not-available', listener: Function): this; - /** - * Asks the server whether there is an update. You must call setFeedURL before - * using this API. - */ - checkForUpdates(): void; - getFeedURL(): string; - /** - * Restarts the app and installs the update after it has been downloaded. It should - * only be called after update-downloaded has been emitted. Under the hood calling - * autoUpdater.quitAndInstall() will close all application windows first, and - * automatically call app.quit() after all windows have been closed. Note: It is - * not strictly necessary to call this function to apply an update, as a - * successfully downloaded update will always be applied the next time the - * application starts. - */ - quitAndInstall(): void; - /** - * Sets the url and initialize the auto updater. - */ - setFeedURL(options: FeedURLOptions): void; - } - - interface BluetoothDevice { - - // Docs: http://electronjs.org/docs/api/structures/bluetooth-device - - deviceId: string; - deviceName: string; - } - - class BrowserView extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-view - - constructor(options?: BrowserViewConstructorOptions); - static fromId(id: number): BrowserView; - static fromWebContents(webContents: WebContents): (BrowserView) | (null); - static getAllViews(): BrowserView[]; - /** - * Force closing the view, the unload and beforeunload events won't be emitted for - * the web page. After you're done with a view, call this function in order to free - * memory and other resources as soon as possible. - */ - destroy(): void; - isDestroyed(): boolean; - setAutoResize(options: AutoResizeOptions): void; - setBackgroundColor(color: string): void; - /** - * Resizes and moves the view to the supplied bounds relative to the window. - */ - setBounds(bounds: Rectangle): void; - id: number; - webContents: WebContents; - } - - class BrowserWindow extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-window - - /** - * Emitted when the window is set or unset to show always on top of other windows. - */ - on(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - once(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - addListener(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - removeListener(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - /** - * Emitted when an App Command is invoked. These are typically related to keyboard - * media keys or browser commands, as well as the "Back" button built into some - * mice on Windows. Commands are lowercased, underscores are replaced with hyphens, - * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is - * emitted as browser-backward. The following app commands are explictly supported - * on Linux: - */ - on(event: 'app-command', listener: (event: Event, - command: string) => void): this; - once(event: 'app-command', listener: (event: Event, - command: string) => void): this; - addListener(event: 'app-command', listener: (event: Event, - command: string) => void): this; - removeListener(event: 'app-command', listener: (event: Event, - command: string) => void): this; - /** - * Emitted when the window loses focus. - */ - on(event: 'blur', listener: Function): this; - once(event: 'blur', listener: Function): this; - addListener(event: 'blur', listener: Function): this; - removeListener(event: 'blur', listener: Function): this; - /** - * Emitted when the window is going to be closed. It's emitted before the - * beforeunload and unload event of the DOM. Calling event.preventDefault() will - * cancel the close. Usually you would want to use the beforeunload handler to - * decide whether the window should be closed, which will also be called when the - * window is reloaded. In Electron, returning any value other than undefined would - * cancel the close. For example: Note: There is a subtle difference between the - * behaviors of window.onbeforeunload = handler and - * window.addEventListener('beforeunload', handler). It is recommended to always - * set the event.returnValue explicitly, instead of only returning a value, as the - * former works more consistently within Electron. - */ - on(event: 'close', listener: (event: Event) => void): this; - once(event: 'close', listener: (event: Event) => void): this; - addListener(event: 'close', listener: (event: Event) => void): this; - removeListener(event: 'close', listener: (event: Event) => void): this; - /** - * Emitted when the window is closed. After you have received this event you should - * remove the reference to the window and avoid using it any more. - */ - on(event: 'closed', listener: Function): this; - once(event: 'closed', listener: Function): this; - addListener(event: 'closed', listener: Function): this; - removeListener(event: 'closed', listener: Function): this; - /** - * Emitted when the window enters a full-screen state. - */ - on(event: 'enter-full-screen', listener: Function): this; - once(event: 'enter-full-screen', listener: Function): this; - addListener(event: 'enter-full-screen', listener: Function): this; - removeListener(event: 'enter-full-screen', listener: Function): this; - /** - * Emitted when the window enters a full-screen state triggered by HTML API. - */ - on(event: 'enter-html-full-screen', listener: Function): this; - once(event: 'enter-html-full-screen', listener: Function): this; - addListener(event: 'enter-html-full-screen', listener: Function): this; - removeListener(event: 'enter-html-full-screen', listener: Function): this; - /** - * Emitted when the window gains focus. - */ - on(event: 'focus', listener: Function): this; - once(event: 'focus', listener: Function): this; - addListener(event: 'focus', listener: Function): this; - removeListener(event: 'focus', listener: Function): this; - /** - * Emitted when the window is hidden. - */ - on(event: 'hide', listener: Function): this; - once(event: 'hide', listener: Function): this; - addListener(event: 'hide', listener: Function): this; - removeListener(event: 'hide', listener: Function): this; - /** - * Emitted when the window leaves a full-screen state. - */ - on(event: 'leave-full-screen', listener: Function): this; - once(event: 'leave-full-screen', listener: Function): this; - addListener(event: 'leave-full-screen', listener: Function): this; - removeListener(event: 'leave-full-screen', listener: Function): this; - /** - * Emitted when the window leaves a full-screen state triggered by HTML API. - */ - on(event: 'leave-html-full-screen', listener: Function): this; - once(event: 'leave-html-full-screen', listener: Function): this; - addListener(event: 'leave-html-full-screen', listener: Function): this; - removeListener(event: 'leave-html-full-screen', listener: Function): this; - /** - * Emitted when window is maximized. - */ - on(event: 'maximize', listener: Function): this; - once(event: 'maximize', listener: Function): this; - addListener(event: 'maximize', listener: Function): this; - removeListener(event: 'maximize', listener: Function): this; - /** - * Emitted when the window is minimized. - */ - on(event: 'minimize', listener: Function): this; - once(event: 'minimize', listener: Function): this; - addListener(event: 'minimize', listener: Function): this; - removeListener(event: 'minimize', listener: Function): this; - /** - * Emitted when the window is being moved to a new position. Note: On macOS this - * event is an alias of moved. - */ - on(event: 'move', listener: Function): this; - once(event: 'move', listener: Function): this; - addListener(event: 'move', listener: Function): this; - removeListener(event: 'move', listener: Function): this; - /** - * Emitted once when the window is moved to a new position. - */ - on(event: 'moved', listener: Function): this; - once(event: 'moved', listener: Function): this; - addListener(event: 'moved', listener: Function): this; - removeListener(event: 'moved', listener: Function): this; - /** - * Emitted when the native new tab button is clicked. - */ - on(event: 'new-window-for-tab', listener: Function): this; - once(event: 'new-window-for-tab', listener: Function): this; - addListener(event: 'new-window-for-tab', listener: Function): this; - removeListener(event: 'new-window-for-tab', listener: Function): this; - /** - * Emitted when the document changed its title, calling event.preventDefault() will - * prevent the native window's title from changing. explicitSet is false when title - * is synthesized from file url. - */ - on(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - once(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - addListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - removeListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - /** - * Emitted when the web page has been rendered (while not being shown) and window - * can be displayed without a visual flash. - */ - on(event: 'ready-to-show', listener: Function): this; - once(event: 'ready-to-show', listener: Function): this; - addListener(event: 'ready-to-show', listener: Function): this; - removeListener(event: 'ready-to-show', listener: Function): this; - /** - * Emitted after the window has been resized. - */ - on(event: 'resize', listener: Function): this; - once(event: 'resize', listener: Function): this; - addListener(event: 'resize', listener: Function): this; - removeListener(event: 'resize', listener: Function): this; - /** - * Emitted when the unresponsive web page becomes responsive again. - */ - on(event: 'responsive', listener: Function): this; - once(event: 'responsive', listener: Function): this; - addListener(event: 'responsive', listener: Function): this; - removeListener(event: 'responsive', listener: Function): this; - /** - * Emitted when the window is restored from a minimized state. - */ - on(event: 'restore', listener: Function): this; - once(event: 'restore', listener: Function): this; - addListener(event: 'restore', listener: Function): this; - removeListener(event: 'restore', listener: Function): this; - /** - * Emitted when scroll wheel event phase has begun. - */ - on(event: 'scroll-touch-begin', listener: Function): this; - once(event: 'scroll-touch-begin', listener: Function): this; - addListener(event: 'scroll-touch-begin', listener: Function): this; - removeListener(event: 'scroll-touch-begin', listener: Function): this; - /** - * Emitted when scroll wheel event phase filed upon reaching the edge of element. - */ - on(event: 'scroll-touch-edge', listener: Function): this; - once(event: 'scroll-touch-edge', listener: Function): this; - addListener(event: 'scroll-touch-edge', listener: Function): this; - removeListener(event: 'scroll-touch-edge', listener: Function): this; - /** - * Emitted when scroll wheel event phase has ended. - */ - on(event: 'scroll-touch-end', listener: Function): this; - once(event: 'scroll-touch-end', listener: Function): this; - addListener(event: 'scroll-touch-end', listener: Function): this; - removeListener(event: 'scroll-touch-end', listener: Function): this; - /** - * Emitted when window session is going to end due to force shutdown or machine - * restart or session log off. - */ - on(event: 'session-end', listener: Function): this; - once(event: 'session-end', listener: Function): this; - addListener(event: 'session-end', listener: Function): this; - removeListener(event: 'session-end', listener: Function): this; - /** - * Emitted when the window opens a sheet. - */ - on(event: 'sheet-begin', listener: Function): this; - once(event: 'sheet-begin', listener: Function): this; - addListener(event: 'sheet-begin', listener: Function): this; - removeListener(event: 'sheet-begin', listener: Function): this; - /** - * Emitted when the window has closed a sheet. - */ - on(event: 'sheet-end', listener: Function): this; - once(event: 'sheet-end', listener: Function): this; - addListener(event: 'sheet-end', listener: Function): this; - removeListener(event: 'sheet-end', listener: Function): this; - /** - * Emitted when the window is shown. - */ - on(event: 'show', listener: Function): this; - once(event: 'show', listener: Function): this; - addListener(event: 'show', listener: Function): this; - removeListener(event: 'show', listener: Function): this; - /** - * Emitted on 3-finger swipe. Possible directions are up, right, down, left. - */ - on(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - once(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - addListener(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - removeListener(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - /** - * Emitted when the window exits from a maximized state. - */ - on(event: 'unmaximize', listener: Function): this; - once(event: 'unmaximize', listener: Function): this; - addListener(event: 'unmaximize', listener: Function): this; - removeListener(event: 'unmaximize', listener: Function): this; - /** - * Emitted when the web page becomes unresponsive. - */ - on(event: 'unresponsive', listener: Function): this; - once(event: 'unresponsive', listener: Function): this; - addListener(event: 'unresponsive', listener: Function): this; - removeListener(event: 'unresponsive', listener: Function): this; - /** - * Emitted before the window is moved. Calling event.preventDefault() will prevent - * the window from being moved. Note that this is only emitted when the window is - * being resized manually. Resizing the window with setBounds/setSize will not emit - * this event. - */ - on(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - once(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - addListener(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - removeListener(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - /** - * Emitted before the window is resized. Calling event.preventDefault() will - * prevent the window from being resized. Note that this is only emitted when the - * window is being resized manually. Resizing the window with setBounds/setSize - * will not emit this event. - */ - on(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - once(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - addListener(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - removeListener(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - constructor(options?: BrowserWindowConstructorOptions); - /** - * Adds DevTools extension located at path, and returns extension's name. The - * extension will be remembered so you only need to call this API once, this API is - * not for programming use. If you try to add an extension that has already been - * loaded, this method will not return and instead log a warning to the console. - * The method will also not return if the extension's manifest is missing or - * incomplete. Note: This API cannot be called before the ready event of the app - * module is emitted. - */ - static addDevToolsExtension(path: string): void; - /** - * Adds Chrome extension located at path, and returns extension's name. The method - * will also not return if the extension's manifest is missing or incomplete. Note: - * This API cannot be called before the ready event of the app module is emitted. - */ - static addExtension(path: string): void; - static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null); - static fromId(id: number): BrowserWindow; - static fromWebContents(webContents: WebContents): BrowserWindow; - static getAllWindows(): BrowserWindow[]; - /** - * To check if a DevTools extension is installed you can run the following: Note: - * This API cannot be called before the ready event of the app module is emitted. - */ - static getDevToolsExtensions(): DevToolsExtensions; - /** - * Note: This API cannot be called before the ready event of the app module is - * emitted. - */ - static getExtensions(): Extensions; - static getFocusedWindow(): (BrowserWindow) | (null); - /** - * Remove a DevTools extension by name. Note: This API cannot be called before the - * ready event of the app module is emitted. - */ - static removeDevToolsExtension(name: string): void; - /** - * Remove a Chrome extension by name. Note: This API cannot be called before the - * ready event of the app module is emitted. - */ - static removeExtension(name: string): void; - /** - * Replacement API for setBrowserView supporting work with multi browser views. - */ - addBrowserView(browserView: BrowserView): void; - /** - * Adds a window as a tab on this window, after the tab for the window instance. - */ - addTabbedWindow(browserWindow: BrowserWindow): void; - /** - * Removes focus from the window. - */ - blur(): void; - blurWebView(): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Moves window to the center of the screen. - */ - center(): void; - /** - * Try to close the window. This has the same effect as a user manually clicking - * the close button of the window. The web page may cancel the close though. See - * the close event. - */ - close(): void; - /** - * Closes the currently open Quick Look panel. - */ - closeFilePreview(): void; - /** - * Force closing the window, the unload and beforeunload event won't be emitted for - * the web page, and close event will also not be emitted for this window, but it - * guarantees the closed event will be emitted. - */ - destroy(): void; - /** - * Starts or stops flashing the window to attract user's attention. - */ - flashFrame(flag: boolean): void; - /** - * Focuses on the window. - */ - focus(): void; - focusOnWebView(): void; - getBounds(): Rectangle; - getBrowserView(): (BrowserView) | (null); - /** - * Returns array of BrowserView what was an attached with addBrowserView or - * setBrowserView. Note: The BrowserView API is currently experimental and may - * change or be removed in future Electron releases. - */ - getBrowserViews(): void; - getChildWindows(): BrowserWindow[]; - getContentBounds(): Rectangle; - getContentSize(): number[]; - getMaximumSize(): number[]; - getMinimumSize(): number[]; - /** - * The native type of the handle is HWND on Windows, NSView* on macOS, and Window - * (unsigned long) on Linux. - */ - getNativeWindowHandle(): Buffer; - /** - * Note: whatever the current state of the window : maximized, minimized or in - * fullscreen, this function always returns the position and size of the window in - * normal state. In normal state, getBounds and getNormalBounds returns the same - * Rectangle. - */ - getNormalBounds(): Rectangle; - getOpacity(): number; - getParentWindow(): BrowserWindow; - getPosition(): number[]; - getRepresentedFilename(): string; - getSize(): number[]; - /** - * Note: The title of the web page can be different from the title of the native - * window. - */ - getTitle(): string; - hasShadow(): boolean; - /** - * Hides the window. - */ - hide(): void; - /** - * Hooks a windows message. The callback is called when the message is received in - * the WndProc. - */ - hookWindowMessage(message: number, callback: Function): void; - isAlwaysOnTop(): boolean; - /** - * On Linux always returns true. - */ - isClosable(): boolean; - isDestroyed(): boolean; - isDocumentEdited(): boolean; - isFocused(): boolean; - isFullScreen(): boolean; - isFullScreenable(): boolean; - isKiosk(): boolean; - /** - * On Linux always returns true. - */ - isMaximizable(): boolean; - isMaximized(): boolean; - isMenuBarAutoHide(): boolean; - isMenuBarVisible(): boolean; - /** - * On Linux always returns true. - */ - isMinimizable(): boolean; - isMinimized(): boolean; - isModal(): boolean; - /** - * On Linux always returns true. - */ - isMovable(): boolean; - isNormal(): boolean; - isResizable(): boolean; - isSimpleFullScreen(): boolean; - isVisible(): boolean; - /** - * Note: This API always returns false on Windows. - */ - isVisibleOnAllWorkspaces(): boolean; - isWindowMessageHooked(message: number): boolean; - /** - * Same as webContents.loadFile, filePath should be a path to an HTML file relative - * to the root of your application. See the webContents docs for more information. - */ - loadFile(filePath: string, options?: LoadFileOptions): Promise; - /** - * Same as webContents.loadURL(url[, options]). The url can be a remote address - * (e.g. http://) or a path to a local HTML file using the file:// protocol. To - * ensure that file URLs are properly formatted, it is recommended to use Node's - * url.format method: You can load a URL using a POST request with URL-encoded data - * by doing the following: - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Maximizes the window. This will also show (but not focus) the window if it isn't - * being displayed already. - */ - maximize(): void; - /** - * Merges all windows into one window with multiple tabs when native tabs are - * enabled and there is more than one open window. - */ - mergeAllWindows(): void; - /** - * Minimizes the window. On some platforms the minimized window will be shown in - * the Dock. - */ - minimize(): void; - /** - * Moves the current tab into a new window if native tabs are enabled and there is - * more than one tab in the current window. - */ - moveTabToNewWindow(): void; - /** - * Moves window to top(z-order) regardless of focus - */ - moveTop(): void; - /** - * Uses Quick Look to preview a file at a given path. - */ - previewFile(path: string, displayName?: string): void; - /** - * Same as webContents.reload. - */ - reload(): void; - removeBrowserView(browserView: BrowserView): void; - /** - * Remove the window's menu bar. - */ - removeMenu(): void; - /** - * Restores the window from minimized state to its previous state. - */ - restore(): void; - /** - * Selects the next tab when native tabs are enabled and there are other tabs in - * the window. - */ - selectNextTab(): void; - /** - * Selects the previous tab when native tabs are enabled and there are other tabs - * in the window. - */ - selectPreviousTab(): void; - /** - * Sets whether the window should show always on top of other windows. After - * setting this, the window is still a normal window, not a toolbox window which - * can not be focused on. - */ - setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void; - /** - * Sets the properties for the window's taskbar button. Note: relaunchCommand and - * relaunchDisplayName must always be set together. If one of those properties is - * not set, then neither will be used. - */ - setAppDetails(options: AppDetailsOptions): void; - /** - * This will make a window maintain an aspect ratio. The extra size allows a - * developer to have space, specified in pixels, not included within the aspect - * ratio calculations. This API already takes into account the difference between a - * window's size and its content size. Consider a normal window with an HD video - * player and associated controls. Perhaps there are 15 pixels of controls on the - * left edge, 25 pixels of controls on the right edge and 50 pixels of controls - * below the player. In order to maintain a 16:9 aspect ratio (standard aspect - * ratio for HD @1920x1080) within the player itself we would call this function - * with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where - * the extra width and height are within the content view--only that they exist. - * Sum any extra width and height areas you have within the overall content view. - * Calling this function with a value of 0 will remove any previously set aspect - * ratios. - */ - setAspectRatio(aspectRatio: number, extraSize: Size): void; - /** - * Controls whether to hide cursor when typing. - */ - setAutoHideCursor(autoHide: boolean): void; - /** - * Sets whether the window menu bar should hide itself automatically. Once set the - * menu bar will only show when users press the single Alt key. If the menu bar is - * already visible, calling setAutoHideMenuBar(true) won't hide it immediately. - */ - setAutoHideMenuBar(hide: boolean): void; - /** - * Sets the background color of the window. See Setting backgroundColor. - */ - setBackgroundColor(backgroundColor: string): void; - /** - * Resizes and moves the window to the supplied bounds. Any properties that are not - * supplied will default to their current values. - */ - setBounds(bounds: Rectangle, animate?: boolean): void; - setBrowserView(browserView: BrowserView): void; - /** - * Sets whether the window can be manually closed by user. On Linux does nothing. - */ - setClosable(closable: boolean): void; - /** - * Resizes and moves the window's client area (e.g. the web page) to the supplied - * bounds. - */ - setContentBounds(bounds: Rectangle, animate?: boolean): void; - /** - * Prevents the window contents from being captured by other apps. On macOS it sets - * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls - * SetWindowDisplayAffinity with WDA_MONITOR. - */ - setContentProtection(enable: boolean): void; - /** - * Resizes the window's client area (e.g. the web page) to width and height. - */ - setContentSize(width: number, height: number, animate?: boolean): void; - /** - * Specifies whether the window’s document has been edited, and the icon in title - * bar will become gray when set to true. - */ - setDocumentEdited(edited: boolean): void; - /** - * Disable or enable the window. - */ - setEnabled(enable: boolean): void; - /** - * Changes whether the window can be focused. - */ - setFocusable(focusable: boolean): void; - /** - * Sets whether the window should be in fullscreen mode. - */ - setFullScreen(flag: boolean): void; - /** - * Sets whether the maximize/zoom window button toggles fullscreen mode or - * maximizes the window. - */ - setFullScreenable(fullscreenable: boolean): void; - /** - * Sets whether the window should have a shadow. - */ - setHasShadow(hasShadow: boolean): void; - /** - * Changes window icon. - */ - setIcon(icon: NativeImage): void; - /** - * Makes the window ignore all mouse events. All mouse events happened in this - * window will be passed to the window below this window, but if this window has - * focus, it will still receive keyboard events. - */ - setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void; - /** - * Enters or leaves the kiosk mode. - */ - setKiosk(flag: boolean): void; - /** - * Sets whether the window can be manually maximized by user. On Linux does - * nothing. - */ - setMaximizable(maximizable: boolean): void; - /** - * Sets the maximum size of window to width and height. - */ - setMaximumSize(width: number, height: number): void; - /** - * Sets the menu as the window's menu bar. - */ - setMenu(menu: (Menu) | (null)): void; - /** - * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users - * can still bring up the menu bar by pressing the single Alt key. - */ - setMenuBarVisibility(visible: boolean): void; - /** - * Sets whether the window can be manually minimized by user. On Linux does - * nothing. - */ - setMinimizable(minimizable: boolean): void; - /** - * Sets the minimum size of window to width and height. - */ - setMinimumSize(width: number, height: number): void; - /** - * Sets whether the window can be moved by user. On Linux does nothing. - */ - setMovable(movable: boolean): void; - /** - * Sets the opacity of the window. On Linux does nothing. - */ - setOpacity(opacity: number): void; - /** - * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to - * convey some sort of application status or to passively notify the user. - */ - setOverlayIcon(overlay: (NativeImage) | (null), description: string): void; - /** - * Sets parent as current window's parent window, passing null will turn current - * window into a top-level window. - */ - setParentWindow(parent: BrowserWindow): void; - /** - * Moves window to x and y. - */ - setPosition(x: number, y: number, animate?: boolean): void; - /** - * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress - * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux - * platform, only supports Unity desktop environment, you need to specify the - * *.desktop file name to desktopName field in package.json. By default, it will - * assume app.getName().desktop. On Windows, a mode can be passed. Accepted values - * are none, normal, indeterminate, error, and paused. If you call setProgressBar - * without a mode set (but with a value within the valid range), normal will be - * assumed. - */ - setProgressBar(progress: number, options?: ProgressBarOptions): void; - /** - * Sets the pathname of the file the window represents, and the icon of the file - * will show in window's title bar. - */ - setRepresentedFilename(filename: string): void; - /** - * Sets whether the window can be manually resized by user. - */ - setResizable(resizable: boolean): void; - /** - * Setting a window shape determines the area within the window where the system - * permits drawing and user interaction. Outside of the given region, no pixels - * will be drawn and no mouse events will be registered. Mouse events outside of - * the region will not be received by that window, but will fall through to - * whatever is behind the window. - */ - setShape(rects: Rectangle[]): void; - /** - * Changes the attachment point for sheets on macOS. By default, sheets are - * attached just below the window frame, but you may want to display them beneath a - * HTML-rendered toolbar. For example: - */ - setSheetOffset(offsetY: number, offsetX?: number): void; - /** - * Enters or leaves simple fullscreen mode. Simple fullscreen mode emulates the - * native fullscreen behavior found in versions of Mac OS X prior to Lion (10.7). - */ - setSimpleFullScreen(flag: boolean): void; - /** - * Resizes the window to width and height. If width or height are below any set - * minimum size constraints the window will snap to its minimum size. - */ - setSize(width: number, height: number, animate?: boolean): void; - /** - * Makes the window not show in the taskbar. - */ - setSkipTaskbar(skip: boolean): void; - /** - * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image - * of a window in a taskbar button layout. Returns a Boolean object indicates - * whether the thumbnail has been added successfully. The number of buttons in - * thumbnail toolbar should be no greater than 7 due to the limited room. Once you - * setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's - * limitation. But you can call the API with an empty array to clean the buttons. - * The buttons is an array of Button objects: The flags is an array that can - * include following Strings: - */ - setThumbarButtons(buttons: ThumbarButton[]): boolean; - /** - * Sets the region of the window to show as the thumbnail image displayed when - * hovering over the window in the taskbar. You can reset the thumbnail to be the - * entire window by specifying an empty region: { x: 0, y: 0, width: 0, height: 0 - * }. - */ - setThumbnailClip(region: Rectangle): void; - /** - * Sets the toolTip that is displayed when hovering over the window thumbnail in - * the taskbar. - */ - setThumbnailToolTip(toolTip: string): void; - /** - * Changes the title of native window to title. - */ - setTitle(title: string): void; - /** - * Sets the touchBar layout for the current window. Specifying null or undefined - * clears the touch bar. This method only has an effect if the machine has a touch - * bar and is running on macOS 10.12.1+. Note: The TouchBar API is currently - * experimental and may change or be removed in future Electron releases. - */ - setTouchBar(touchBar: TouchBar): void; - /** - * Adds a vibrancy effect to the browser window. Passing null or an empty string - * will remove the vibrancy effect on the window. - */ - setVibrancy(type: 'appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'): void; - /** - * Sets whether the window should be visible on all workspaces. Note: This API does - * nothing on Windows. - */ - setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void; - /** - * Sets whether the window traffic light buttons should be visible. This cannot be - * called when titleBarStyle is set to customButtonsOnHover. - */ - setWindowButtonVisibility(visible: boolean): void; - /** - * Shows and gives focus to the window. - */ - show(): void; - /** - * Same as webContents.showDefinitionForSelection(). - */ - showDefinitionForSelection(): void; - /** - * Shows the window but doesn't focus on it. - */ - showInactive(): void; - /** - * Toggles the visibility of the tab bar if native tabs are enabled and there is - * only one tab in the current window. - */ - toggleTabBar(): void; - /** - * Unhooks all of the window messages. - */ - unhookAllWindowMessages(): void; - /** - * Unhook the window message. - */ - unhookWindowMessage(message: number): void; - /** - * Unmaximizes the window. - */ - unmaximize(): void; - id: number; - webContents: WebContents; - } - - class BrowserWindowProxy extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-window-proxy - - /** - * Removes focus from the child window. - */ - blur(): void; - /** - * Forcefully closes the child window without calling its unload event. - */ - close(): void; - /** - * Evaluates the code in the child window. - */ - eval(code: string): void; - /** - * Focuses the child window (brings the window to front). - */ - focus(): void; - /** - * Sends a message to the child window with the specified origin or * for no origin - * preference. In addition to these methods, the child window implements - * window.opener object with no properties and a single method. - */ - postMessage(message: string, targetOrigin: string): void; - /** - * Invokes the print dialog on the child window. - */ - print(): void; - closed: boolean; - } - - interface Certificate { - - // Docs: http://electronjs.org/docs/api/structures/certificate - - /** - * PEM encoded data - */ - data: string; - /** - * Fingerprint of the certificate - */ - fingerprint: string; - /** - * Issuer principal - */ - issuer: CertificatePrincipal; - /** - * Issuer certificate (if not self-signed) - */ - issuerCert: Certificate; - /** - * Issuer's Common Name - */ - issuerName: string; - /** - * Hex value represented string - */ - serialNumber: string; - /** - * Subject principal - */ - subject: CertificatePrincipal; - /** - * Subject's Common Name - */ - subjectName: string; - /** - * End date of the certificate being valid in seconds - */ - validExpiry: number; - /** - * Start date of the certificate being valid in seconds - */ - validStart: number; - } - - interface CertificatePrincipal { - - // Docs: http://electronjs.org/docs/api/structures/certificate-principal - - /** - * Common Name. - */ - commonName: string; - /** - * Country or region. - */ - country: string; - /** - * Locality. - */ - locality: string; - /** - * Organization names. - */ - organizations: string[]; - /** - * Organization Unit names. - */ - organizationUnits: string[]; - /** - * State or province. - */ - state: string; - } - - class ClientRequest extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/client-request - - /** - * Emitted when the request is aborted. The abort event will not be fired if the - * request is already closed. - */ - on(event: 'abort', listener: Function): this; - once(event: 'abort', listener: Function): this; - addListener(event: 'abort', listener: Function): this; - removeListener(event: 'abort', listener: Function): this; - /** - * Emitted as the last event in the HTTP request-response transaction. The close - * event indicates that no more events will be emitted on either the request or - * response objects. - */ - on(event: 'close', listener: Function): this; - once(event: 'close', listener: Function): this; - addListener(event: 'close', listener: Function): this; - removeListener(event: 'close', listener: Function): this; - /** - * Emitted when the net module fails to issue a network request. Typically when the - * request object emits an error event, a close event will subsequently follow and - * no response object will be provided. - */ - on(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - once(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - addListener(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - removeListener(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - /** - * Emitted just after the last chunk of the request's data has been written into - * the request object. - */ - on(event: 'finish', listener: Function): this; - once(event: 'finish', listener: Function): this; - addListener(event: 'finish', listener: Function): this; - removeListener(event: 'finish', listener: Function): this; - /** - * Emitted when an authenticating proxy is asking for user credentials. The - * callback function is expected to be called back with user credentials: Providing - * empty credentials will cancel the request and report an authentication error on - * the response object: - */ - on(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when there is redirection and the mode is manual. Calling - * request.followRedirect will continue with the redirection. - */ - on(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - once(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - addListener(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - removeListener(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - on(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - once(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - addListener(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - removeListener(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - constructor(options: 'method' | 'url' | 'session' | 'partition' | 'protocol' | 'host' | 'hostname' | 'port' | 'path' | 'redirect'); - /** - * Cancels an ongoing HTTP transaction. If the request has already emitted the - * close event, the abort operation will have no effect. Otherwise an ongoing event - * will emit abort and close events. Additionally, if there is an ongoing response - * object,it will emit the aborted event. - */ - abort(): void; - /** - * Sends the last chunk of the request data. Subsequent write or end operations - * will not be allowed. The finish event is emitted just after the end operation. - */ - end(chunk?: (string) | (Buffer), encoding?: string, callback?: Function): void; - /** - * Continues any deferred redirection request when the redirection mode is manual. - */ - followRedirect(): void; - getHeader(name: string): Header; - /** - * You can use this method in conjunction with POST requests to get the progress of - * a file upload or other data transfer. - */ - getUploadProgress(): UploadProgress; - /** - * Removes a previously set extra header name. This method can be called only - * before first write. Trying to call it after the first write will throw an error. - */ - removeHeader(name: string): void; - /** - * Adds an extra HTTP header. The header name will issued as it is without - * lowercasing. It can be called only before first write. Calling this method after - * the first write will throw an error. If the passed value is not a String, its - * toString() method will be called to obtain the final value. - */ - setHeader(name: string, value: any): void; - /** - * callback is essentially a dummy function introduced in the purpose of keeping - * similarity with the Node.js API. It is called asynchronously in the next tick - * after chunk content have been delivered to the Chromium networking layer. - * Contrary to the Node.js implementation, it is not guaranteed that chunk content - * have been flushed on the wire before callback is called. Adds a chunk of data to - * the request body. The first write operation may cause the request headers to be - * issued on the wire. After the first write operation, it is not allowed to add or - * remove a custom header. - */ - write(chunk: (string) | (Buffer), encoding?: string, callback?: Function): void; - chunkedEncoding: boolean; - } - - interface Clipboard extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/clipboard - - availableFormats(type?: 'selection' | 'clipboard'): string[]; - /** - * Clears the clipboard content. - */ - clear(type?: 'selection' | 'clipboard'): void; - has(format: string, type?: 'selection' | 'clipboard'): boolean; - read(format: string): string; - /** - * Returns an Object containing title and url keys representing the bookmark in the - * clipboard. The title and url values will be empty strings when the bookmark is - * unavailable. - */ - readBookmark(): ReadBookmark; - readBuffer(format: string): Buffer; - /** - * This method uses synchronous IPC when called from the renderer process. The - * cached value is reread from the find pasteboard whenever the application is - * activated. - */ - readFindText(): string; - readHTML(type?: 'selection' | 'clipboard'): string; - readImage(type?: 'selection' | 'clipboard'): NativeImage; - readRTF(type?: 'selection' | 'clipboard'): string; - readText(type?: 'selection' | 'clipboard'): string; - /** - * Writes data to the clipboard. - */ - write(data: Data, type?: 'selection' | 'clipboard'): void; - /** - * Writes the title and url into the clipboard as a bookmark. Note: Most apps on - * Windows don't support pasting bookmarks into them so you can use clipboard.write - * to write both a bookmark and fallback text to the clipboard. - */ - writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes the buffer into the clipboard as format. - */ - writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the find pasteboard (the pasteboard that holds information - * about the current state of the active application’s find panel) as plain text. - * This method uses synchronous IPC when called from the renderer process. - */ - writeFindText(text: string): void; - /** - * Writes markup to the clipboard. - */ - writeHTML(markup: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes image to the clipboard. - */ - writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the clipboard in RTF. - */ - writeRTF(text: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the clipboard as plain text. - */ - writeText(text: string, type?: 'selection' | 'clipboard'): void; - } - - interface ContentTracing extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/content-tracing - - /** - * Get a set of category groups. The category groups can change as new code paths - * are reached. Once all child processes have acknowledged the getCategories - * request the callback is invoked with an array of category groups. Deprecated - * Soon - */ - getCategories(callback: (categories: string[]) => void): void; - /** - * Get a set of category groups. The category groups can change as new code paths - * are reached. - */ - getCategories(): Promise; - /** - * Get the maximum usage across processes of trace buffer as a percentage of the - * full state. When the TraceBufferUsage value is determined the callback is - * called. Deprecated Soon - */ - getTraceBufferUsage(callback: (value: number) => void): void; - /** - * Get the maximum usage across processes of trace buffer as a percentage of the - * full state. - */ - getTraceBufferUsage(): Promise; - /** - * Start recording on all processes. Recording begins immediately locally and - * asynchronously on child processes as soon as they receive the EnableRecording - * request. The callback will be called once all child processes have acknowledged - * the startRecording request. Deprecated Soon - */ - startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig), callback: Function): void; - /** - * Start recording on all processes. Recording begins immediately locally and - * asynchronously on child processes as soon as they receive the EnableRecording - * request. - */ - startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig)): Promise; - /** - * Stop recording on all processes. Child processes typically cache trace data and - * only rarely flush and send trace data back to the main process. This helps to - * minimize the runtime overhead of tracing since sending trace data over IPC can - * be an expensive operation. So, to end tracing, we must asynchronously ask all - * child processes to flush any pending trace data. Once all child processes have - * acknowledged the stopRecording request, callback will be called with a file that - * contains the traced data. Trace data will be written into resultFilePath if it - * is not empty or into a temporary file. The actual file path will be passed to - * callback if it's not null. Deprecated Soon - */ - stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void; - /** - * Stop recording on all processes. Child processes typically cache trace data and - * only rarely flush and send trace data back to the main process. This helps to - * minimize the runtime overhead of tracing since sending trace data over IPC can - * be an expensive operation. So, to end tracing, we must asynchronously ask all - * child processes to flush any pending trace data. Trace data will be written into - * resultFilePath if it is not empty or into a temporary file. - */ - stopRecording(resultFilePath: string): Promise; - } - - interface ContextBridge extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/context-bridge - - exposeInMainWorld(apiKey: string, api: Record): void; - } - - interface Cookie { - - // Docs: http://electronjs.org/docs/api/structures/cookie - - /** - * The domain of the cookie; this will be normalized with a preceding dot so that - * it's also valid for subdomains. - */ - domain?: string; - /** - * The expiration date of the cookie as the number of seconds since the UNIX epoch. - * Not provided for session cookies. - */ - expirationDate?: number; - /** - * Whether the cookie is a host-only cookie; this will only be true if no domain - * was passed. - */ - hostOnly?: boolean; - /** - * Whether the cookie is marked as HTTP only. - */ - httpOnly?: boolean; - /** - * The name of the cookie. - */ - name: string; - /** - * The path of the cookie. - */ - path?: string; - /** - * Whether the cookie is marked as secure. - */ - secure?: boolean; - /** - * Whether the cookie is a session cookie or a persistent cookie with an expiration - * date. - */ - session?: boolean; - /** - * The value of the cookie. - */ - value: string; - } - - class Cookies extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/cookies - - /** - * Emitted when a cookie is changed because it was added, edited, removed, or - * expired. - */ - on(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - once(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - addListener(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - removeListener(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - /** - * Writes any unwritten cookies data to disk. - */ - flushStore(): Promise; - /** - * Writes any unwritten cookies data to disk. Deprecated Soon - */ - flushStore(callback: Function): void; - /** - * Sends a request to get all cookies matching filter, and resolves a promise with - * the response. - */ - get(filter: Filter): Promise; - /** - * Sends a request to get all cookies matching filter, callback will be called with - * callback(error, cookies) on complete. Deprecated Soon - */ - get(filter: Filter, callback: (error: Error, cookies: Cookie[]) => void): void; - /** - * Removes the cookies matching url and name - */ - remove(url: string, name: string): Promise; - /** - * Removes the cookies matching url and name, callback will called with callback() - * on complete. Deprecated Soon - */ - remove(url: string, name: string, callback: Function): void; - /** - * Sets a cookie with details. - */ - set(details: Details): Promise; - /** - * Sets a cookie with details, callback will be called with callback(error) on - * complete. Deprecated Soon - */ - set(details: Details, callback: (error: Error) => void): void; - } - - interface CPUUsage { - - // Docs: http://electronjs.org/docs/api/structures/cpu-usage - - /** - * The number of average idle cpu wakeups per second since the last call to - * getCPUUsage. First call returns 0. Will always return 0 on Windows. - */ - idleWakeupsPerSecond: number; - /** - * Percentage of CPU used since the last call to getCPUUsage. First call returns 0. - */ - percentCPUUsage: number; - } - - interface CrashReport { - - // Docs: http://electronjs.org/docs/api/structures/crash-report - - date: Date; - id: string; - } - - interface CrashReporter { - - // Docs: http://electronjs.org/docs/api/crash-reporter - - /** - * Set an extra parameter to be sent with the crash report. The values specified - * here will be sent in addition to any values set via the extra option when start - * was called. This API is only available on macOS and windows, if you need to - * add/update extra parameters on Linux after your first call to start you can call - * start again with the updated extra options. - */ - addExtraParameter(key: string, value: string): void; - /** - * Returns the date and ID of the last crash report. Only crash reports that have - * been uploaded will be returned; even if a crash report is present on disk it - * will not be returned until it is uploaded. In the case that there are no - * uploaded reports, null is returned. - */ - getLastCrashReport(): CrashReport; - /** - * See all of the current parameters being passed to the crash reporter. - */ - getParameters(): void; - /** - * Returns all uploaded crash reports. Each report contains the date and uploaded - * ID. - */ - getUploadedReports(): CrashReport[]; - /** - * Note: This API can only be called from the main process. - */ - getUploadToServer(): boolean; - /** - * Remove a extra parameter from the current set of parameters so that it will not - * be sent with the crash report. - */ - removeExtraParameter(key: string): void; - /** - * This would normally be controlled by user preferences. This has no effect if - * called before start is called. Note: This API can only be called from the main - * process. - */ - setUploadToServer(uploadToServer: boolean): void; - /** - * You are required to call this method before using any other crashReporter APIs - * and in each process (main/renderer) from which you want to collect crash - * reports. You can pass different options to crashReporter.start when calling from - * different processes. Note Child processes created via the child_process module - * will not have access to the Electron modules. Therefore, to collect crash - * reports from them, use process.crashReporter.start instead. Pass the same - * options as above along with an additional one called crashesDirectory that - * should point to a directory to store the crash reports temporarily. You can test - * this out by calling process.crash() to crash the child process. Note: If you - * need send additional/updated extra parameters after your first call start you - * can call addExtraParameter on macOS or call start again with the new/updated - * extra parameters on Linux and Windows. Note: On macOS and windows, Electron uses - * a new crashpad client for crash collection and reporting. If you want to enable - * crash reporting, initializing crashpad from the main process using - * crashReporter.start is required regardless of which process you want to collect - * crashes from. Once initialized this way, the crashpad handler collects crashes - * from all processes. You still have to call crashReporter.start from the renderer - * or child process, otherwise crashes from them will get reported without - * companyName, productName or any of the extra information. - */ - start(options: CrashReporterStartOptions): void; - } - - interface CustomScheme { - - // Docs: http://electronjs.org/docs/api/structures/custom-scheme - - privileges?: Privileges; - /** - * Custom schemes to be registered with options. - */ - scheme: string; - } - - class Debugger extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/debugger - - /** - * Emitted when debugging session is terminated. This happens either when - * webContents is closed or devtools is invoked for the attached webContents. - */ - on(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - once(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - addListener(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - removeListener(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - /** - * Emitted whenever debugging target issues instrumentation event. - */ - on(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - once(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - addListener(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - removeListener(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - /** - * Attaches the debugger to the webContents. - */ - attach(protocolVersion?: string): void; - /** - * Detaches the debugger from the webContents. - */ - detach(): void; - isAttached(): boolean; - /** - * Send given command to the debugging target. Deprecated Soon - */ - sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; - /** - * Send given command to the debugging target. - */ - sendCommand(method: string, commandParams?: any): Promise; - } - - interface DesktopCapturer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/desktop-capturer - - /** - * Starts gathering information about all available desktop media sources, and - * calls callback(error, sources) when finished. sources is an array of - * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or - * an individual window that can be captured. Deprecated Soon - */ - getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void; - getSources(options: SourcesOptions): Promise; - } - - interface DesktopCapturerSource { - - // Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source - - /** - * An icon image of the application that owns the window or null if the source has - * a type screen. The size of the icon is not known in advance and depends on what - * the the application provides. - */ - appIcon: NativeImage; - /** - * A unique identifier that will correspond to the id of the matching returned by - * the . On some platforms, this is equivalent to the XX portion of the id field - * above and on others it will differ. It will be an empty string if not available. - */ - display_id: string; - /** - * The identifier of a window or screen that can be used as a chromeMediaSourceId - * constraint when calling [navigator.webkitGetUserMedia]. The format of the - * identifier will be window:XX or screen:XX, where XX is a random generated - * number. - */ - id: string; - /** - * A screen source will be named either Entire Screen or Screen , while the name of - * a window source will match the window title. - */ - name: string; - /** - * A thumbnail image. There is no guarantee that the size of the thumbnail is the - * same as the thumbnailSize specified in the options passed to - * desktopCapturer.getSources. The actual size depends on the scale of the screen - * or window. - */ - thumbnail: NativeImage; - } - - interface Dialog extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/dialog - - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: - */ - showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(options: CertificateTrustDialogOptions, callback: Function): void; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; - /** - * Displays a modal dialog that shows an error message. This API can be called - * safely before the ready event the app module emits, it is usually used to report - * errors in early stage of startup. If called before the app readyevent on Linux, - * the message will be emitted to stderr, and no GUI dialog will appear. - */ - showErrorBox(title: string, content: string): void; - /** - * Shows a message box, it will block the process until the message box is closed. - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. - */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise; - /** - * Shows a message box, it will block the process until the message box is closed. - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. - */ - showMessageBox(options: MessageBoxOptions): Promise; - /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. The browserWindow argument allows - * the dialog to attach itself to a parent window, making it modal. - */ - showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number; - /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. The browserWindow argument allows - * the dialog to attach itself to a parent window, making it modal. - */ - showMessageBoxSync(options: MessageBoxSyncOptions): number; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: Function): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialog(options: OpenDialogOptions, callback?: Function): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using - * the asynchronous version is recommended to avoid issues when expanding and - * collapsing the dialog. - */ - showSaveDialog(options: SaveDialogOptions): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using - * the asynchronous version is recommended to avoid issues when expanding and - * collapsing the dialog. - */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. - */ - showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. - */ - showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined); - } - - interface Display { - - // Docs: http://electronjs.org/docs/api/structures/display - - /** - * Can be available, unavailable, unknown. - */ - accelerometerSupport: ('available' | 'unavailable' | 'unknown'); - bounds: Rectangle; - /** - * The number of bits per pixel. - */ - colorDepth: number; - /** - * represent a color space (three-dimensional object which contains all realizable - * color combinations) for the purpose of color conversions - */ - colorSpace: string; - /** - * The number of bits per color component. - */ - depthPerComponent: number; - /** - * Unique identifier associated with the display. - */ - id: number; - /** - * true for an internal display and false for an external display - */ - internal: boolean; - /** - * Whether or not the display is a monochrome display. - */ - monochrome: boolean; - /** - * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. - */ - rotation: number; - /** - * Output device's pixel scale factor. - */ - scaleFactor: number; - size: Size; - /** - * Can be available, unavailable, unknown. - */ - touchSupport: ('available' | 'unavailable' | 'unknown'); - workArea: Rectangle; - workAreaSize: Size; - } - - class DownloadItem extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/download-item - - /** - * Emitted when the download is in a terminal state. This includes a completed - * download, a cancelled download (via downloadItem.cancel()), and interrupted - * download that can't be resumed. The state can be one of following: - */ - on(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - once(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - addListener(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - removeListener(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - /** - * Emitted when the download has been updated and is not done. The state can be one - * of following: - */ - on(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - once(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - addListener(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - removeListener(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - /** - * Cancels the download operation. - */ - cancel(): void; - canResume(): boolean; - getContentDisposition(): string; - getETag(): string; - /** - * Note: The file name is not always the same as the actual one saved in local - * disk. If user changes the file name in a prompted download saving dialog, the - * actual name of saved file will be different. - */ - getFilename(): string; - getLastModifiedTime(): string; - getMimeType(): string; - getReceivedBytes(): number; - getSaveDialogOptions(): SaveDialogOptions; - getSavePath(): string; - getStartTime(): number; - /** - * Note: The following methods are useful specifically to resume a cancelled item - * when session is restarted. - */ - getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted'); - /** - * If the size is unknown, it returns 0. - */ - getTotalBytes(): number; - getURL(): string; - getURLChain(): string[]; - hasUserGesture(): boolean; - isPaused(): boolean; - /** - * Pauses the download. - */ - pause(): void; - /** - * Resumes the download that has been paused. Note: To enable resumable downloads - * the server you are downloading from must support range requests and provide both - * Last-Modified and ETag header values. Otherwise resume() will dismiss previously - * received bytes and restart the download from the beginning. - */ - resume(): void; - /** - * This API allows the user to set custom options for the save dialog that opens - * for the download item by default. The API is only available in session's - * will-download callback function. - */ - setSaveDialogOptions(options: SaveDialogOptions): void; - /** - * The API is only available in session's will-download callback function. If user - * doesn't set the save path via the API, Electron will use the original routine to - * determine the save path(Usually prompts a save dialog). - */ - setSavePath(path: string): void; - } - - interface Event extends GlobalEvent { - - // Docs: http://electronjs.org/docs/api/structures/event - - preventDefault: (() => void); - } - - interface FileFilter { - - // Docs: http://electronjs.org/docs/api/structures/file-filter - - extensions: string[]; - name: string; - } - - interface GlobalShortcut extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/global-shortcut - - /** - * When the accelerator is already taken by other applications, this call will - * still return false. This behavior is intended by operating systems, since they - * don't want applications to fight for global shortcuts. - */ - isRegistered(accelerator: Accelerator): boolean; - /** - * Registers a global shortcut of accelerator. The callback is called when the - * registered shortcut is pressed by the user. When the accelerator is already - * taken by other applications, this call will silently fail. This behavior is - * intended by operating systems, since they don't want applications to fight for - * global shortcuts. The following accelerators will not be registered successfully - * on macOS 10.14 Mojave unless the app has been authorized as a trusted - * accessibility client: - */ - register(accelerator: Accelerator, callback: Function): boolean; - /** - * Registers a global shortcut of all accelerator items in accelerators. The - * callback is called when any of the registered shortcuts are pressed by the user. - * When a given accelerator is already taken by other applications, this call will - * silently fail. This behavior is intended by operating systems, since they don't - * want applications to fight for global shortcuts. The following accelerators will - * not be registered successfully on macOS 10.14 Mojave unless the app has been - * authorized as a trusted accessibility client: - */ - registerAll(accelerators: string[], callback: Function): void; - /** - * Unregisters the global shortcut of accelerator. - */ - unregister(accelerator: Accelerator): void; - /** - * Unregisters all of the global shortcuts. - */ - unregisterAll(): void; - } - - interface GPUFeatureStatus { - - // Docs: http://electronjs.org/docs/api/structures/gpu-feature-status - - /** - * Canvas. - */ - '2d_canvas': string; - /** - * Flash. - */ - flash_3d: string; - /** - * Flash Stage3D. - */ - flash_stage3d: string; - /** - * Flash Stage3D Baseline profile. - */ - flash_stage3d_baseline: string; - /** - * Compositing. - */ - gpu_compositing: string; - /** - * Multiple Raster Threads. - */ - multiple_raster_threads: string; - /** - * Native GpuMemoryBuffers. - */ - native_gpu_memory_buffers: string; - /** - * Rasterization. - */ - rasterization: string; - /** - * Video Decode. - */ - video_decode: string; - /** - * Video Encode. - */ - video_encode: string; - /** - * VPx Video Decode. - */ - vpx_decode: string; - /** - * WebGL. - */ - webgl: string; - /** - * WebGL2. - */ - webgl2: string; - } - - interface InAppPurchase extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/in-app-purchase - - /** - * Emitted when one or more transactions have been updated. - */ - on(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - once(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - addListener(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - removeListener(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - canMakePayments(): boolean; - /** - * Completes all pending transactions. - */ - finishAllTransactions(): void; - /** - * Completes the pending transactions corresponding to the date. - */ - finishTransactionByDate(date: string): void; - /** - * Retrieves the product descriptions. Deprecated Soon - */ - getProducts(productIDs: string[], callback: (products: Product[]) => void): void; - /** - * Retrieves the product descriptions. - */ - getProducts(productIDs: string[]): Promise; - getReceiptURL(): string; - /** - * You should listen for the transactions-updated event as soon as possible and - * certainly before you call purchaseProduct. Deprecated Soon - */ - purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void; - /** - * You should listen for the transactions-updated event as soon as possible and - * certainly before you call purchaseProduct. - */ - purchaseProduct(productID: string, quantity?: number): Promise; - } - - class IncomingMessage extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/incoming-message - - /** - * Emitted when a request has been canceled during an ongoing HTTP transaction. - */ - on(event: 'aborted', listener: Function): this; - once(event: 'aborted', listener: Function): this; - addListener(event: 'aborted', listener: Function): this; - removeListener(event: 'aborted', listener: Function): this; - /** - * The data event is the usual method of transferring response data into - * applicative code. - */ - on(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - once(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - addListener(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - removeListener(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - /** - * Indicates that response body has ended. - */ - on(event: 'end', listener: Function): this; - once(event: 'end', listener: Function): this; - addListener(event: 'end', listener: Function): this; - removeListener(event: 'end', listener: Function): this; - /** - * error Error - Typically holds an error string identifying failure root cause. - * Emitted when an error was encountered while streaming response data events. For - * instance, if the server closes the underlying while the response is still - * streaming, an error event will be emitted on the response object and a close - * event will subsequently follow on the request object. - */ - on(event: 'error', listener: Function): this; - once(event: 'error', listener: Function): this; - addListener(event: 'error', listener: Function): this; - removeListener(event: 'error', listener: Function): this; - headers: any; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - statusCode: number; - statusMessage: string; - } - - interface IOCounters { - - // Docs: http://electronjs.org/docs/api/structures/io-counters - - /** - * Then number of I/O other operations. - */ - otherOperationCount: number; - /** - * Then number of I/O other transfers. - */ - otherTransferCount: number; - /** - * The number of I/O read operations. - */ - readOperationCount: number; - /** - * The number of I/O read transfers. - */ - readTransferCount: number; - /** - * The number of I/O write operations. - */ - writeOperationCount: number; - /** - * The number of I/O write transfers. - */ - writeTransferCount: number; - } - - interface IpcMain extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/ipc-main - - /** - * Listens to channel, when a new message arrives listener would be called with - * listener(event, args...). - */ - on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this; - /** - * Adds a one time listener function for the event. This listener is invoked only - * the next time a message is sent to channel, after which it is removed. - */ - once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this; - /** - * Removes listeners of the specified channel. - */ - removeAllListeners(channel: string): this; - /** - * Removes the specified listener from the listener array for the specified - * channel. - */ - removeListener(channel: string, listener: Function): this; - } - - interface IpcMainEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/ipc-main-event - - /** - * The ID of the renderer frame that sent this message - */ - frameId: number; - /** - * A function that will send an IPC message to the renderer frame that sent the - * original message that you are currently handling. You should use this method to - * "reply" to the sent message in order to guaruntee the reply will go to the - * correct process and frame. - */ - reply: Function; - /** - * Set this to the value to be returned in a syncronous message - */ - returnValue: any; - /** - * Returns the webContents that sent the message - */ - sender: WebContents; - } - - interface IpcRenderer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/ipc-renderer - - /** - * Listens to channel, when a new message arrives listener would be called with - * listener(event, args...). - */ - on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this; - /** - * Adds a one time listener function for the event. This listener is invoked only - * the next time a message is sent to channel, after which it is removed. - */ - once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this; - /** - * Removes all listeners, or those of the specified channel. - */ - removeAllListeners(channel: string): this; - /** - * Removes the specified listener from the listener array for the specified - * channel. - */ - removeListener(channel: string, listener: Function): this; - /** - * Send a message to the main process asynchronously via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The main process handles it by - * listening for channel with ipcMain module. - */ - send(channel: string, ...args: any[]): void; - /** - * Send a message to the main process synchronously via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The main process handles it by - * listening for channel with ipcMain module, and replies by setting - * event.returnValue. Note: Sending a synchronous message will block the whole - * renderer process, unless you know what you are doing you should never use it. - */ - // sendSync(channel: string, ...args: any[]): any; ### VSCODE CHANGE (we do not want to use sendSync) - /** - * Sends a message to a window with webContentsId via channel. - */ - sendTo(webContentsId: number, channel: string, ...args: any[]): void; - /** - * Like ipcRenderer.send but the event will be sent to the element in the - * host page instead of the main process. - */ - sendToHost(channel: string, ...args: any[]): void; - } - - interface IpcRendererEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/ipc-renderer-event - - /** - * The IpcRenderer instance that emitted the event originally - */ - sender: IpcRenderer; - /** - * The webContents.id that sent the message, you can call - * event.sender.sendTo(event.senderId, ...) to reply to the message, see for more - * information. This only applies to messages sent from a different renderer. - * Messages sent directly from the main process set event.senderId to 0. - */ - senderId: number; - } - - interface JumpListCategory { - - // Docs: http://electronjs.org/docs/api/structures/jump-list-category - - /** - * Array of objects if type is tasks or custom, otherwise it should be omitted. - */ - items?: JumpListItem[]; - /** - * Must be set if type is custom, otherwise it should be omitted. - */ - name?: string; - /** - * One of the following: - */ - type?: ('tasks' | 'frequent' | 'recent' | 'custom'); - } - - interface JumpListItem { - - // Docs: http://electronjs.org/docs/api/structures/jump-list-item - - /** - * The command line arguments when program is executed. Should only be set if type - * is task. - */ - args?: string; - /** - * Description of the task (displayed in a tooltip). Should only be set if type is - * task. - */ - description?: string; - /** - * The index of the icon in the resource file. If a resource file contains multiple - * icons this value can be used to specify the zero-based index of the icon that - * should be displayed for this task. If a resource file contains only one icon, - * this property should be set to zero. - */ - iconIndex?: number; - /** - * The absolute path to an icon to be displayed in a Jump List, which can be an - * arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll). You can - * usually specify process.execPath to show the program icon. - */ - iconPath?: string; - /** - * Path of the file to open, should only be set if type is file. - */ - path?: string; - /** - * Path of the program to execute, usually you should specify process.execPath - * which opens the current program. Should only be set if type is task. - */ - program?: string; - /** - * The text to be displayed for the item in the Jump List. Should only be set if - * type is task. - */ - title?: string; - /** - * One of the following: - */ - type?: ('task' | 'separator' | 'file'); - /** - * The working directory. Default is empty. - */ - workingDirectory?: string; - } - - interface KeyboardEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/keyboard-event - - /** - * whether an Alt key was used in an accelerator to trigger the Event - */ - altKey?: boolean; - /** - * whether the Control key was used in an accelerator to trigger the Event - */ - ctrlKey?: boolean; - /** - * whether a meta key was used in an accelerator to trigger the Event - */ - metaKey?: boolean; - /** - * whether a Shift key was used in an accelerator to trigger the Event - */ - shiftKey?: boolean; - /** - * whether an accelerator was used to trigger the event as opposed to another user - * gesture like mouse click - */ - triggeredByAccelerator?: boolean; - } - - interface MemoryUsageDetails { - - // Docs: http://electronjs.org/docs/api/structures/memory-usage-details - - count: number; - liveSize: number; - size: number; - } - - class Menu { - - // Docs: http://electronjs.org/docs/api/menu - - /** - * Emitted when a popup is closed either manually or with menu.closePopup(). - */ - on(event: 'menu-will-close', listener: (event: Event) => void): this; - once(event: 'menu-will-close', listener: (event: Event) => void): this; - addListener(event: 'menu-will-close', listener: (event: Event) => void): this; - removeListener(event: 'menu-will-close', listener: (event: Event) => void): this; - /** - * Emitted when menu.popup() is called. - */ - on(event: 'menu-will-show', listener: (event: Event) => void): this; - once(event: 'menu-will-show', listener: (event: Event) => void): this; - addListener(event: 'menu-will-show', listener: (event: Event) => void): this; - removeListener(event: 'menu-will-show', listener: (event: Event) => void): this; - constructor(); - /** - * Generally, the template is an array of options for constructing a MenuItem. The - * usage can be referenced above. You can also attach other fields to the element - * of the template and they will become properties of the constructed menu items. - */ - static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu; - /** - * Note: The returned Menu instance doesn't support dynamic addition or removal of - * menu items. Instance properties can still be dynamically modified. - */ - static getApplicationMenu(): (Menu) | (null); - /** - * Sends the action to the first responder of application. This is used for - * emulating default macOS menu behaviors. Usually you would use the role property - * of a MenuItem. See the macOS Cocoa Event Handling Guide for more information on - * macOS' native actions. - */ - static sendActionToFirstResponder(action: string): void; - /** - * Sets menu as the application menu on macOS. On Windows and Linux, the menu will - * be set as each window's top menu. Also on Windows and Linux, you can use a & in - * the top-level item name to indicate which letter should get a generated - * accelerator. For example, using &File for the file menu would result in a - * generated Alt-F accelerator that opens the associated menu. The indicated - * character in the button label gets an underline. The & character is not - * displayed on the button label. Passing null will suppress the default menu. On - * Windows and Linux, this has the additional effect of removing the menu bar from - * the window. Note: The default menu will be created automatically if the app does - * not set one. It contains standard items such as File, Edit, View, Window and - * Help. - */ - static setApplicationMenu(menu: (Menu) | (null)): void; - /** - * Appends the menuItem to the menu. - */ - append(menuItem: MenuItem): void; - /** - * Closes the context menu in the browserWindow. - */ - closePopup(browserWindow?: BrowserWindow): void; - getMenuItemById(id: string): MenuItem; - /** - * Inserts the menuItem to the pos position of the menu. - */ - insert(pos: number, menuItem: MenuItem): void; - /** - * Pops up this menu as a context menu in the BrowserWindow. - */ - popup(options?: PopupOptions): void; - items: MenuItem[]; - } - - class MenuItem { - - // Docs: http://electronjs.org/docs/api/menu-item - - constructor(options: MenuItemConstructorOptions); - accelerator: string; - checked: boolean; - click: Function; - commandId: number; - enabled: boolean; - icon: NativeImage; - id: string; - label: string; - menu: Menu; - registerAccelerator: boolean; - role: string; - sublabel: string; - submenu: Menu; - type: string; - visible: boolean; - } - - interface MimeTypedBuffer { - - // Docs: http://electronjs.org/docs/api/structures/mime-typed-buffer - - /** - * The actual Buffer content. - */ - data: Buffer; - /** - * The mimeType of the Buffer that you are sending. - */ - mimeType: string; - } - - class NativeImage { - - // Docs: http://electronjs.org/docs/api/native-image - - /** - * Creates an empty NativeImage instance. - */ - static createEmpty(): NativeImage; - /** - * Creates a new NativeImage instance from buffer that contains the raw bitmap - * pixel data returned by toBitmap(). The specific format is platform-dependent. - */ - static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage; - /** - * Creates a new NativeImage instance from buffer. Tries to decode as PNG or JPEG - * first. - */ - static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage; - /** - * Creates a new NativeImage instance from dataURL. - */ - static createFromDataURL(dataURL: string): NativeImage; - /** - * Creates a new NativeImage instance from the NSImage that maps to the given image - * name. See NSImageName for a list of possible values. The hslShift is applied to - * the image with the following rules This means that [-1, 0, 1] will make the - * image completely white and [-1, 1, 0] will make the image completely black. In - * some cases, the NSImageName doesn't match its string representation; one example - * of this is NSFolderImageName, whose string representation would actually be - * NSFolder. Therefore, you'll need to determine the correct string representation - * for your image before passing it in. This can be done with the following: echo - * -e '#import \nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | - * clang -otest -x objective-c -framework Cocoa - && ./test where SYSTEM_IMAGE_NAME - * should be replaced with any value from this list. - */ - static createFromNamedImage(imageName: string, hslShift: number[]): NativeImage; - /** - * Creates a new NativeImage instance from a file located at path. This method - * returns an empty image if the path does not exist, cannot be read, or is not a - * valid image. - */ - static createFromPath(path: string): NativeImage; - /** - * Add an image representation for a specific scale factor. This can be used to - * explicitly add different scale factor representations to an image. This can be - * called on empty images. - */ - addRepresentation(options: AddRepresentationOptions): void; - crop(rect: Rectangle): NativeImage; - getAspectRatio(): number; - /** - * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy - * the bitmap data, so you have to use the returned Buffer immediately in current - * event loop tick, otherwise the data might be changed or destroyed. - */ - getBitmap(options?: BitmapOptions): Buffer; - /** - * Notice that the returned pointer is a weak pointer to the underlying native - * image instead of a copy, so you must ensure that the associated nativeImage - * instance is kept around. - */ - getNativeHandle(): Buffer; - getSize(): Size; - isEmpty(): boolean; - isTemplateImage(): boolean; - /** - * If only the height or the width are specified then the current aspect ratio will - * be preserved in the resized image. - */ - resize(options: ResizeOptions): NativeImage; - /** - * Marks the image as a template image. - */ - setTemplateImage(option: boolean): void; - toBitmap(options?: ToBitmapOptions): Buffer; - toDataURL(options?: ToDataURLOptions): string; - toJPEG(quality: number): Buffer; - toPNG(options?: ToPNGOptions): Buffer; - } - - interface Net extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/net - - /** - * Creates a ClientRequest instance using the provided options which are directly - * forwarded to the ClientRequest constructor. The net.request method would be used - * to issue both secure and insecure HTTP requests according to the specified - * protocol scheme in the options object. - */ - request(options: (any) | (string)): ClientRequest; - } - - interface NetLog extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/net-log - - /** - * Starts recording network events to path. - */ - startLogging(path: string): void; - /** - * Stops recording network events. If not called, net logging will automatically - * end when app quits. Deprecated Soon - */ - stopLogging(callback?: (path: string) => void): void; - /** - * Stops recording network events. If not called, net logging will automatically - * end when app quits. - */ - stopLogging(): Promise; - /** - * A Boolean property that indicates whether network logs are recorded. - */ - currentlyLogging?: boolean; - /** - * A String property that returns the path to the current log file. - */ - currentlyLoggingPath?: string; - } - - class Notification extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/notification - - on(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - once(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - addListener(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - removeListener(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - /** - * Emitted when the notification is clicked by the user. - */ - on(event: 'click', listener: (event: Event) => void): this; - once(event: 'click', listener: (event: Event) => void): this; - addListener(event: 'click', listener: (event: Event) => void): this; - removeListener(event: 'click', listener: (event: Event) => void): this; - /** - * Emitted when the notification is closed by manual intervention from the user. - * This event is not guaranteed to be emitted in all cases where the notification - * is closed. - */ - on(event: 'close', listener: (event: Event) => void): this; - once(event: 'close', listener: (event: Event) => void): this; - addListener(event: 'close', listener: (event: Event) => void): this; - removeListener(event: 'close', listener: (event: Event) => void): this; - /** - * Emitted when the user clicks the "Reply" button on a notification with hasReply: - * true. - */ - on(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - once(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - addListener(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - removeListener(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - /** - * Emitted when the notification is shown to the user, note this could be fired - * multiple times as a notification can be shown multiple times through the show() - * method. - */ - on(event: 'show', listener: (event: Event) => void): this; - once(event: 'show', listener: (event: Event) => void): this; - addListener(event: 'show', listener: (event: Event) => void): this; - removeListener(event: 'show', listener: (event: Event) => void): this; - constructor(options: NotificationConstructorOptions); - static isSupported(): boolean; - /** - * Dismisses the notification. - */ - close(): void; - /** - * Immediately shows the notification to the user, please note this means unlike - * the HTML5 Notification implementation, instantiating a new Notification does not - * immediately show it to the user, you need to call this method before the OS will - * display it. If the notification has been shown before, this method will dismiss - * the previously shown notification and create a new one with identical - * properties. - */ - show(): void; - } - - interface NotificationAction { - - // Docs: http://electronjs.org/docs/api/structures/notification-action - - /** - * The label for the given action. - */ - text?: string; - /** - * The type of action, can be button. - */ - type: ('button'); - } - - interface Point { - - // Docs: http://electronjs.org/docs/api/structures/point - - x: number; - y: number; - } - - interface PowerMonitor extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/power-monitor - - /** - * Emitted when the system is about to lock the screen. - */ - on(event: 'lock-screen', listener: Function): this; - once(event: 'lock-screen', listener: Function): this; - addListener(event: 'lock-screen', listener: Function): this; - removeListener(event: 'lock-screen', listener: Function): this; - /** - * Emitted when the system changes to AC power. - */ - on(event: 'on-ac', listener: Function): this; - once(event: 'on-ac', listener: Function): this; - addListener(event: 'on-ac', listener: Function): this; - removeListener(event: 'on-ac', listener: Function): this; - /** - * Emitted when system changes to battery power. - */ - on(event: 'on-battery', listener: Function): this; - once(event: 'on-battery', listener: Function): this; - addListener(event: 'on-battery', listener: Function): this; - removeListener(event: 'on-battery', listener: Function): this; - /** - * Emitted when system is resuming. - */ - on(event: 'resume', listener: Function): this; - once(event: 'resume', listener: Function): this; - addListener(event: 'resume', listener: Function): this; - removeListener(event: 'resume', listener: Function): this; - /** - * Emitted when the system is about to reboot or shut down. If the event handler - * invokes e.preventDefault(), Electron will attempt to delay system shutdown in - * order for the app to exit cleanly. If e.preventDefault() is called, the app - * should exit as soon as possible by calling something like app.quit(). - */ - on(event: 'shutdown', listener: Function): this; - once(event: 'shutdown', listener: Function): this; - addListener(event: 'shutdown', listener: Function): this; - removeListener(event: 'shutdown', listener: Function): this; - /** - * Emitted when the system is suspending. - */ - on(event: 'suspend', listener: Function): this; - once(event: 'suspend', listener: Function): this; - addListener(event: 'suspend', listener: Function): this; - removeListener(event: 'suspend', listener: Function): this; - /** - * Emitted as soon as the systems screen is unlocked. - */ - on(event: 'unlock-screen', listener: Function): this; - once(event: 'unlock-screen', listener: Function): this; - addListener(event: 'unlock-screen', listener: Function): this; - removeListener(event: 'unlock-screen', listener: Function): this; - /** - * Calculate the system idle state. idleThreshold is the amount of time (in - * seconds) before considered idle. locked is available on supported systems only. - */ - getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown'); - /** - * Calculate system idle time in seconds. - */ - getSystemIdleTime(): number; - /** - * Calculate the system idle state. idleThreshold is the amount of time (in - * seconds) before considered idle. callback will be called synchronously on some - * systems and with an idleState argument that describes the system's state. locked - * is available on supported systems only. - */ - querySystemIdleState(idleThreshold: number, callback: (idleState: 'active' | 'idle' | 'locked' | 'unknown') => void): void; - /** - * Calculate system idle time in seconds. - */ - querySystemIdleTime(callback: (idleTime: number) => void): void; - } - - interface PowerSaveBlocker extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/power-save-blocker - - isStarted(id: number): boolean; - /** - * Starts preventing the system from entering lower-power mode. Returns an integer - * identifying the power save blocker. Note: prevent-display-sleep has higher - * precedence over prevent-app-suspension. Only the highest precedence type takes - * effect. In other words, prevent-display-sleep always takes precedence over - * prevent-app-suspension. For example, an API calling A requests for - * prevent-app-suspension, and another calling B requests for - * prevent-display-sleep. prevent-display-sleep will be used until B stops its - * request. After that, prevent-app-suspension is used. - */ - start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number; - /** - * Stops the specified power save blocker. - */ - stop(id: number): void; - } - - interface PrinterInfo { - - // Docs: http://electronjs.org/docs/api/structures/printer-info - - description: string; - isDefault: boolean; - name: string; - status: number; - } - - interface ProcessMemoryInfo { - - // Docs: http://electronjs.org/docs/api/structures/process-memory-info - - /** - * The amount of memory not shared by other processes, such as JS heap or HTML - * content in Kilobytes. - */ - private: number; - /** - * and The amount of memory currently pinned to actual physical RAM in Kilobytes. - */ - residentSet: number; - /** - * The amount of memory shared between processes, typically memory consumed by the - * Electron code itself in Kilobytes. - */ - shared: number; - } - - interface ProcessMetric { - - // Docs: http://electronjs.org/docs/api/structures/process-metric - - /** - * CPU usage of the process. - */ - cpu: CPUUsage; - /** - * Process id of the process. - */ - pid: number; - /** - * Process type. One of the following values: - */ - type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'GPU' | 'Unknown'); - } - - interface Product { - - // Docs: http://electronjs.org/docs/api/structures/product - - /** - * The total size of the content, in bytes. - */ - contentLengths: number[]; - /** - * A string that identifies the version of the content. - */ - contentVersion: string; - /** - * The locale formatted price of the product. - */ - formattedPrice: string; - /** - * A Boolean value that indicates whether the App Store has downloadable content - * for this product. true if at least one file has been associated with the - * product. - */ - isDownloadable: boolean; - /** - * A description of the product. - */ - localizedDescription: string; - /** - * The name of the product. - */ - localizedTitle: string; - /** - * The cost of the product in the local currency. - */ - price: number; - /** - * The string that identifies the product to the Apple App Store. - */ - productIdentifier: string; - } - - interface Protocol extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/protocol - - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a Buffer as a response. - */ - interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a file as a response. - */ - interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a new HTTP request as a response. - */ - interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; - /** - * Same as protocol.registerStreamProtocol, except that it replaces an existing - * protocol handler. - */ - interceptStreamProtocol(scheme: string, handler: (request: InterceptStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a String as a response. - */ - interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * The callback will be called with a boolean that indicates whether there is - * already a handler for scheme. Deprecated Soon - */ - isProtocolHandled(scheme: string, callback: (handled: boolean) => void): void; - isProtocolHandled(scheme: string): Promise; - /** - * Registers a protocol of scheme that will send a Buffer as a response. The usage - * is the same with registerFileProtocol, except that the callback should be called - * with either a Buffer object or an object that has the data, mimeType, and - * charset properties. Example: - */ - registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: (Buffer) | (MimeTypedBuffer)) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send the file as a response. The - * handler will be called with handler(request, callback) when a request is going - * to be created with scheme. completion will be called with completion(null) when - * scheme is successfully registered or completion(error) when failed. To handle - * the request, the callback should be called with either the file's path or an - * object that has a path property, e.g. callback(filePath) or callback({ path: - * filePath }). The object may also have a headers property which gives a map of - * headers to values for the response headers, e.g. callback({ path: filePath, - * headers: {"Content-Security-Policy": "default-src 'none'"]}). When callback is - * called with nothing, a number, or an object that has an error property, the - * request will fail with the error number you specified. For the available error - * numbers you can use, please see the net error list. By default the scheme is - * treated like http:, which is parsed differently than protocols that follow the - * "generic URI syntax" like file:. - */ - registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send an HTTP request as a response. The - * usage is the same with registerFileProtocol, except that the callback should be - * called with a redirectRequest object that has the url, method, referrer, - * uploadData and session properties. By default the HTTP request will reuse the - * current session. If you want the request to have a different session you should - * set session to null. For POST requests the uploadData object must be provided. - */ - registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; - /** - * Note: This method can only be used before the ready event of the app module gets - * emitted and can be called only once. Registers the scheme as standard, secure, - * bypasses content security policy for resources, allows registering ServiceWorker - * and supports fetch API. Specify a privilege with the value of true to enable the - * capability. An example of registering a privileged scheme, with bypassing - * Content Security Policy: A standard scheme adheres to what RFC 3986 calls - * generic URI syntax. For example http and https are standard schemes, while file - * is not. Registering a scheme as standard, will allow relative and absolute - * resources to be resolved correctly when served. Otherwise the scheme will behave - * like the file protocol, but without the ability to resolve relative URLs. For - * example when you load following page with custom protocol without registering it - * as standard scheme, the image will not be loaded because non-standard schemes - * can not recognize relative URLs: Registering a scheme as standard will allow - * access to files through the FileSystem API. Otherwise the renderer will throw a - * security error for the scheme. By default web storage apis (localStorage, - * sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard - * schemes. So in general if you want to register a custom protocol to replace the - * http protocol, you have to register it as a standard scheme. - * protocol.registerSchemesAsPrivileged can be used to replicate the functionality - * of the previous protocol.registerStandardSchemes, webFrame.registerURLSchemeAs* - * and protocol.registerServiceWorkerSchemes functions that existed prior to - * Electron 5.0.0, for example: before (<= v4.x) after (>= v5.x) - */ - registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void; - /** - * Registers a protocol of scheme that will send a Readable as a response. The - * usage is similar to the other register{Any}Protocol, except that the callback - * should be called with either a Readable object or an object that has the data, - * statusCode, and headers properties. Example: It is possible to pass any object - * that implements the readable stream API (emits data/end/error events). For - * example, here's how a file could be returned: - */ - registerStreamProtocol(scheme: string, handler: (request: RegisterStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send a String as a response. The usage - * is the same with registerFileProtocol, except that the callback should be called - * with either a String or an object that has the data, mimeType, and charset - * properties. - */ - registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Remove the interceptor installed for scheme and restore its original handler. - */ - uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; - /** - * Unregisters the custom protocol of scheme. - */ - unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; - } - - interface Rectangle { - - // Docs: http://electronjs.org/docs/api/structures/rectangle - - /** - * The height of the rectangle (must be an integer). - */ - height: number; - /** - * The width of the rectangle (must be an integer). - */ - width: number; - /** - * The x coordinate of the origin of the rectangle (must be an integer). - */ - x: number; - /** - * The y coordinate of the origin of the rectangle (must be an integer). - */ - y: number; - } - - interface Referrer { - - // Docs: http://electronjs.org/docs/api/structures/referrer - - /** - * Can be default, unsafe-url, no-referrer-when-downgrade, no-referrer, origin, - * strict-origin-when-cross-origin, same-origin or strict-origin. See the for more - * details on the meaning of these values. - */ - policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin'); - /** - * HTTP Referrer URL. - */ - url: string; - } - - interface Remote extends MainInterface { - - // Docs: http://electronjs.org/docs/api/remote - - getCurrentWebContents(): WebContents; - /** - * Note: Do not use removeAllListeners on BrowserWindow. Use of this can remove all - * blur listeners, disable click events on touch bar buttons, and other unintended - * consequences. - */ - getCurrentWindow(): BrowserWindow; - getGlobal(name: string): any; - /** - * e.g. - */ - require(module: string): any; - /** - * The process object in the main process. This is the same as - * remote.getGlobal('process') but is cached. - */ - process?: any; - } - - interface RemoveClientCertificate { - - // Docs: http://electronjs.org/docs/api/structures/remove-client-certificate - - /** - * Origin of the server whose associated client certificate must be removed from - * the cache. - */ - origin: string; - /** - * clientCertificate. - */ - type: string; - } - - interface RemovePassword { - - // Docs: http://electronjs.org/docs/api/structures/remove-password - - /** - * When provided, the authentication info related to the origin will only be - * removed otherwise the entire cache will be cleared. - */ - origin?: string; - /** - * Credentials of the authentication. Must be provided if removing by origin. - */ - password?: string; - /** - * Realm of the authentication. Must be provided if removing by origin. - */ - realm?: string; - /** - * Scheme of the authentication. Can be basic, digest, ntlm, negotiate. Must be - * provided if removing by origin. - */ - scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate'); - /** - * password. - */ - type: string; - /** - * Credentials of the authentication. Must be provided if removing by origin. - */ - username?: string; - } - - interface Screen extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/screen - - /** - * Emitted when newDisplay has been added. - */ - on(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - once(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - addListener(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - removeListener(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - /** - * Emitted when one or more metrics change in a display. The changedMetrics is an - * array of strings that describe the changes. Possible changes are bounds, - * workArea, scaleFactor and rotation. - */ - on(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - once(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - addListener(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - removeListener(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - /** - * Emitted when oldDisplay has been removed. - */ - on(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - once(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - addListener(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - removeListener(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - /** - * Converts a screen DIP point to a screen physical point. The DPI scale is - * performed relative to the display containing the DIP point. - */ - dipToScreenPoint(point: Point): Point; - /** - * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed - * relative to the display nearest to window. If window is null, scaling will be - * performed to the display nearest to rect. - */ - dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle; - getAllDisplays(): Display[]; - /** - * The current absolute position of the mouse pointer. - */ - getCursorScreenPoint(): Point; - getDisplayMatching(rect: Rectangle): Display; - getDisplayNearestPoint(point: Point): Display; - getPrimaryDisplay(): Display; - /** - * Converts a screen physical point to a screen DIP point. The DPI scale is - * performed relative to the display containing the physical point. - */ - screenToDipPoint(point: Point): Point; - /** - * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed - * relative to the display nearest to window. If window is null, scaling will be - * performed to the display nearest to rect. - */ - screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle; - } - - interface ScrubberItem { - - // Docs: http://electronjs.org/docs/api/structures/scrubber-item - - /** - * The image to appear in this item. - */ - icon?: NativeImage; - /** - * The text to appear in this item. - */ - label?: string; - } - - interface SegmentedControlSegment { - - // Docs: http://electronjs.org/docs/api/structures/segmented-control-segment - - /** - * Whether this segment is selectable. Default: true. - */ - enabled?: boolean; - /** - * The image to appear in this segment. - */ - icon?: NativeImage; - /** - * The text to appear in this segment. - */ - label?: string; - } - - class Session extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/session - - /** - * If partition starts with persist:, the page will use a persistent session - * available to all pages in the app with the same partition. if there is no - * persist: prefix, the page will use an in-memory session. If the partition is - * empty then default session of the app will be returned. To create a Session with - * options, you have to ensure the Session with the partition has never been used - * before. There is no way to change the options of an existing Session object. - */ - static fromPartition(partition: string, options?: FromPartitionOptions): Session; - /** - * A Session object, the default session object of the app. - */ - static defaultSession?: Session; - /** - * Emitted when Electron is about to download item in webContents. Calling - * event.preventDefault() will cancel the download and item will not be available - * from next tick of the process. - */ - on(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - once(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - addListener(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - removeListener(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - /** - * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate - * authentication. - */ - allowNTLMCredentialsForDomains(domains: string): void; - clearAuthCache(): Promise; - clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate)): Promise; - /** - * Clears the session’s HTTP authentication cache. Deprecated Soon - */ - clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate), callback: Function): void; - /** - * Clears the session’s HTTP cache. - */ - clearCache(): Promise; - /** - * Clears the session’s HTTP cache. Deprecated Soon - */ - clearCache(callback: (error: number) => void): void; - /** - * Clears the host resolver cache. - */ - clearHostResolverCache(): Promise; - /** - * Clears the host resolver cache. Deprecated Soon - */ - clearHostResolverCache(callback?: Function): void; - /** - * Clears the storage data for the current session. Deprecated Soon - */ - clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void; - clearStorageData(options?: ClearStorageDataOptions): Promise; - /** - * Allows resuming cancelled or interrupted downloads from previous Session. The - * API will generate a DownloadItem that can be accessed with the will-download - * event. The DownloadItem will not have any WebContents associated with it and the - * initial state will be interrupted. The download will start only when the resume - * API is called on the DownloadItem. - */ - createInterruptedDownload(options: CreateInterruptedDownloadOptions): void; - /** - * Disables any network emulation already active for the session. Resets to the - * original network configuration. - */ - disableNetworkEmulation(): void; - /** - * Emulates network with the given configuration for the session. - */ - enableNetworkEmulation(options: EnableNetworkEmulationOptions): void; - /** - * Writes any unwritten DOMStorage data to disk. - */ - flushStorageData(): void; - /** - * Deprecated Soon - */ - getBlobData(identifier: string, callback: (result: Buffer) => void): void; - getBlobData(identifier: string): Promise; - getCacheSize(): Promise; - /** - * Callback is invoked with the session's current cache size. Deprecated Soon - */ - getCacheSize(callback: (size: number, error: number) => void): void; - getPreloads(): string[]; - getUserAgent(): string; - resolveProxy(url: string): Promise; - /** - * Resolves the proxy information for url. The callback will be called with - * callback(proxy) when the request is performed. Deprecated Soon - */ - resolveProxy(url: string, callback: (proxy: string) => void): void; - /** - * Sets the certificate verify proc for session, the proc will be called with - * proc(request, callback) whenever a server certificate verification is requested. - * Calling callback(0) accepts the certificate, calling callback(-2) rejects it. - * Calling setCertificateVerifyProc(null) will revert back to default certificate - * verify proc. - */ - setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void; - /** - * Sets download saving directory. By default, the download directory will be the - * Downloads under the respective app folder. - */ - setDownloadPath(path: string): void; - /** - * Sets the handler which can be used to respond to permission checks for the - * session. Returning true will allow the permission and false will reject it. To - * clear the handler, call setPermissionCheckHandler(null). - */ - setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerDetails) => boolean) | (null)): void; - /** - * Sets the handler which can be used to respond to permission requests for the - * session. Calling callback(true) will allow the permission and callback(false) - * will reject it. To clear the handler, call setPermissionRequestHandler(null). - */ - setPermissionRequestHandler(handler: ((webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerDetails) => void) | (null)): void; - /** - * Adds scripts that will be executed on ALL web contents that are associated with - * this session just before normal preload scripts run. - */ - setPreloads(preloads: string[]): void; - /** - * Sets the proxy settings. When pacScript and proxyRules are provided together, - * the proxyRules option is ignored and pacScript configuration is applied. The - * proxyRules has to follow the rules below: For example: The proxyBypassRules is a - * comma separated list of rules described below: - */ - setProxy(config: Config): Promise; - /** - * Sets the proxy settings. When pacScript and proxyRules are provided together, - * the proxyRules option is ignored and pacScript configuration is applied. The - * proxyRules has to follow the rules below: For example: The proxyBypassRules is a - * comma separated list of rules described below: Deprecated Soon - */ - setProxy(config: Config, callback: Function): void; - /** - * Overrides the userAgent and acceptLanguages for this session. The - * acceptLanguages must a comma separated ordered list of language codes, for - * example "en-US,fr,de,ko,zh-CN,ja". This doesn't affect existing WebContents, and - * each WebContents can use webContents.setUserAgent to override the session-wide - * user agent. - */ - setUserAgent(userAgent: string, acceptLanguages?: string): void; - cookies: Cookies; - netLog: NetLog; - protocol: Protocol; - webRequest: WebRequest; - } - - interface Shell { - - // Docs: http://electronjs.org/docs/api/shell - - /** - * Play the beep sound. - */ - beep(): void; - /** - * Move the given file to trash and returns a boolean status for the operation. - */ - moveItemToTrash(fullPath: string): boolean; - /** - * Open the given external protocol URL in the desktop's default manner. (For - * example, mailto: URLs in the user's default mail agent). - */ - openExternal(url: string, options?: OpenExternalOptions): Promise; - /** - * Open the given external protocol URL in the desktop's default manner. (For - * example, mailto: URLs in the user's default mail agent). Deprecated - */ - openExternalSync(url: string, options?: OpenExternalSyncOptions): boolean; - /** - * Open the given file in the desktop's default manner. - */ - openItem(fullPath: string): boolean; - /** - * Resolves the shortcut link at shortcutPath. An exception will be thrown when any - * error happens. - */ - readShortcutLink(shortcutPath: string): ShortcutDetails; - /** - * Show the given file in a file manager. If possible, select the file. - */ - showItemInFolder(fullPath: string): void; - /** - * Creates or updates a shortcut link at shortcutPath. - */ - writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean; - /** - * Creates or updates a shortcut link at shortcutPath. - */ - writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; - } - - interface ShortcutDetails { - - // Docs: http://electronjs.org/docs/api/structures/shortcut-details - - /** - * The Application User Model ID. Default is empty. - */ - appUserModelId?: string; - /** - * The arguments to be applied to target when launching from this shortcut. Default - * is empty. - */ - args?: string; - /** - * The working directory. Default is empty. - */ - cwd?: string; - /** - * The description of the shortcut. Default is empty. - */ - description?: string; - /** - * The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set - * together. Default is empty, which uses the target's icon. - */ - icon?: string; - /** - * The resource ID of icon when icon is a DLL or EXE. Default is 0. - */ - iconIndex?: number; - /** - * The target to launch from this shortcut. - */ - target: string; - } - - interface Size { - - // Docs: http://electronjs.org/docs/api/structures/size - - height: number; - width: number; - } - - interface StreamProtocolResponse { - - // Docs: http://electronjs.org/docs/api/structures/stream-protocol-response - - /** - * A Node.js readable stream representing the response body. - */ - data: NodeJS.ReadableStream; - /** - * An object containing the response headers. - */ - headers: Headers; - /** - * The HTTP response code. - */ - statusCode: number; - } - - interface SystemPreferences extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/system-preferences - - on(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - once(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - addListener(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - removeListener(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - on(event: 'color-changed', listener: (event: Event) => void): this; - once(event: 'color-changed', listener: (event: Event) => void): this; - addListener(event: 'color-changed', listener: (event: Event) => void): this; - removeListener(event: 'color-changed', listener: (event: Event) => void): this; - on(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - once(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - on(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - once(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - addListener(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - /** - * Important: In order to properly leverage this API, you must set the - * NSMicrophoneUsageDescription and NSCameraUsageDescription strings in your app's - * Info.plist file. The values for these keys will be used to populate the - * permission dialogs so that the user will be properly informed as to the purpose - * of the permission request. See Electron Application Distribution for more - * information about how to set these in the context of Electron. This user consent - * was not required until macOS 10.14 Mojave, so this method will always return - * true if your system is running 10.13 High Sierra or lower. - */ - askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise; - /** - * NOTE: This API will return false on macOS systems older than Sierra 10.12.2. - */ - canPromptTouchID(): boolean; - /** - * This API is only available on macOS 10.14 Mojave or newer. - */ - getAccentColor(): string; - /** - * Returns an object with system animation settings. - */ - getAnimationSettings(): AnimationSettings; - /** - * Gets the macOS appearance setting that you have declared you want for your - * application, maps to NSApplication.appearance. You can use the - * setAppLevelAppearance API to set this value. - */ - getAppLevelAppearance(): ('dark' | 'light' | 'unknown'); - getColor(color: '3d-dark-shadow' | '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'alternate-selected-control-text' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string; - /** - * Gets the macOS appearance setting that is currently applied to your application, - * maps to NSApplication.effectiveAppearance Please note that until Electron is - * built targeting the 10.14 SDK, your application's effectiveAppearance will - * default to 'light' and won't inherit the OS preference. In the interim in order - * for your application to inherit the OS preference you must set the - * NSRequiresAquaSystemAppearance key in your apps Info.plist to false. If you are - * using electron-packager or electron-forge just set the enableDarwinDarkMode - * packager option to true. See the Electron Packager API for more details. - */ - getEffectiveAppearance(): ('dark' | 'light' | 'unknown'); - /** - * This user consent was not required until macOS 10.14 Mojave, so this method will - * always return granted if your system is running 10.13 High Sierra or lower. - */ - getMediaAccessStatus(mediaType: string): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown'); - /** - * Returns one of several standard system colors that automatically adapt to - * vibrancy and changes in accessibility settings like 'Increase contrast' and - * 'Reduce transparency'. See Apple Documentation for more details. - */ - getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): void; - /** - * Some popular key and types are: - */ - getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; - /** - * An example of using it to determine if you should create a transparent window or - * not (transparent windows won't work correctly when DWM composition is disabled): - */ - isAeroGlassEnabled(): boolean; - isDarkMode(): boolean; - isHighContrastColorScheme(): boolean; - isInvertedColorScheme(): boolean; - isSwipeTrackingFromScrollEventsEnabled(): boolean; - isTrustedAccessibilityClient(prompt: boolean): boolean; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postLocalNotification(event: string, userInfo: any): void; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postNotification(event: string, userInfo: any, deliverImmediately?: boolean): void; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postWorkspaceNotification(event: string, userInfo: any): void; - /** - * This API itself will not protect your user data; rather, it is a mechanism to - * allow you to do so. Native apps will need to set Access Control Constants like - * kSecAccessControlUserPresence on the their keychain entry so that reading it - * would auto-prompt for Touch ID biometric consent. This could be done with - * node-keytar, such that one would store an encryption key with node-keytar and - * only fetch it if promptTouchID() resolves. NOTE: This API will return a rejected - * Promise on macOS systems older than Sierra 10.12.2. - */ - promptTouchID(reason: string): Promise; - /** - * Add the specified defaults to your application's NSUserDefaults. - */ - registerDefaults(defaults: any): void; - /** - * Removes the key in NSUserDefaults. This can be used to restore the default or - * global value of a key previously set with setUserDefault. - */ - removeUserDefault(key: string): void; - /** - * Sets the appearance setting for your application, this should override the - * system default and override the value of getEffectiveAppearance. - */ - setAppLevelAppearance(appearance: 'dark' | 'light'): void; - /** - * Set the value of key in NSUserDefaults. Note that type should match actual type - * of value. An exception is thrown if they don't. Some popular key and types are: - */ - setUserDefault(key: string, type: string, value: string): void; - /** - * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. - * This is necessary for events such as NSUserDefaultsDidChangeNotification. - */ - subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): number; - /** - * Subscribes to native notifications of macOS, callback will be called with - * callback(event, userInfo) when the corresponding event happens. The userInfo is - * an Object that contains the user information dictionary sent along with the - * notification. The id of the subscriber is returned, which can be used to - * unsubscribe the event. Under the hood this API subscribes to - * NSDistributedNotificationCenter, example values of event are: - */ - subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): number; - /** - * Same as subscribeNotification, but uses - * NSWorkspace.sharedWorkspace.notificationCenter. This is necessary for events - * such as NSWorkspaceDidActivateApplicationNotification. - */ - subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: any) => void): void; - /** - * Same as unsubscribeNotification, but removes the subscriber from - * NSNotificationCenter. - */ - unsubscribeLocalNotification(id: number): void; - /** - * Removes the subscriber with id. - */ - unsubscribeNotification(id: number): void; - /** - * Same as unsubscribeNotification, but removes the subscriber from - * NSWorkspace.sharedWorkspace.notificationCenter. - */ - unsubscribeWorkspaceNotification(id: number): void; - } - - interface Task { - - // Docs: http://electronjs.org/docs/api/structures/task - - /** - * The command line arguments when program is executed. - */ - arguments: string; - /** - * Description of this task. - */ - description: string; - /** - * The icon index in the icon file. If an icon file consists of two or more icons, - * set this value to identify the icon. If an icon file consists of one icon, this - * value is 0. - */ - iconIndex: number; - /** - * The absolute path to an icon to be displayed in a JumpList, which can be an - * arbitrary resource file that contains an icon. You can usually specify - * process.execPath to show the icon of the program. - */ - iconPath: string; - /** - * Path of the program to execute, usually you should specify process.execPath - * which opens the current program. - */ - program: string; - /** - * The string to be displayed in a JumpList. - */ - title: string; - /** - * The working directory. Default is empty. - */ - workingDirectory?: string; - } - - interface ThumbarButton { - - // Docs: http://electronjs.org/docs/api/structures/thumbar-button - - click: Function; - /** - * Control specific states and behaviors of the button. By default, it is - * ['enabled']. - */ - flags?: string[]; - /** - * The icon showing in thumbnail toolbar. - */ - icon: NativeImage; - /** - * The text of the button's tooltip. - */ - tooltip?: string; - } - - class TouchBarButton extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-button - - constructor(options: TouchBarButtonConstructorOptions); - backgroundColor: string; - icon: NativeImage; - label: string; - } - - class TouchBarColorPicker extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-color-picker - - constructor(options: TouchBarColorPickerConstructorOptions); - availableColors: string[]; - selectedColor: string; - } - - class TouchBarGroup extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-group - - constructor(options: TouchBarGroupConstructorOptions); - } - - class TouchBarLabel extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-label - - constructor(options: TouchBarLabelConstructorOptions); - label: string; - textColor: string; - } - - class TouchBarPopover extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-popover - - constructor(options: TouchBarPopoverConstructorOptions); - icon: NativeImage; - label: string; - } - - class TouchBarScrubber extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-scrubber - - constructor(options: TouchBarScrubberConstructorOptions); - continuous: boolean; - items: ScrubberItem[]; - mode: string; - overlayStyle: string; - selectedStyle: string; - showArrowButtons: boolean; - } - - class TouchBarSegmentedControl extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-segmented-control - - constructor(options: TouchBarSegmentedControlConstructorOptions); - segments: SegmentedControlSegment[]; - segmentStyle: string; - selectedIndex: number; - } - - class TouchBarSlider extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-slider - - constructor(options: TouchBarSliderConstructorOptions); - label: string; - maxValue: number; - minValue: number; - value: number; - } - - class TouchBarSpacer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-spacer - - constructor(options: TouchBarSpacerConstructorOptions); - } - - class TouchBar extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar - - constructor(options: TouchBarConstructorOptions); - escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null); - static TouchBarButton: typeof TouchBarButton; - static TouchBarColorPicker: typeof TouchBarColorPicker; - static TouchBarGroup: typeof TouchBarGroup; - static TouchBarLabel: typeof TouchBarLabel; - static TouchBarPopover: typeof TouchBarPopover; - static TouchBarScrubber: typeof TouchBarScrubber; - static TouchBarSegmentedControl: typeof TouchBarSegmentedControl; - static TouchBarSlider: typeof TouchBarSlider; - static TouchBarSpacer: typeof TouchBarSpacer; - } - - interface TraceCategoriesAndOptions { - - // Docs: http://electronjs.org/docs/api/structures/trace-categories-and-options - - /** - * – is a filter to control what category groups should be traced. A filter can - * have an optional prefix to exclude category groups that contain a matching - * category. Having both included and excluded category patterns in the same list - * is not supported. Examples: test_MyTest*, test_MyTest*,test_OtherStuff, - * -excluded_category1,-excluded_category2. - */ - categoryFilter: string; - /** - * Controls what kind of tracing is enabled, it is a comma-delimited sequence of - * the following strings: record-until-full, record-continuously, trace-to-console, - * enable-sampling, enable-systrace, e.g. 'record-until-full,enable-sampling'. The - * first 3 options are trace recording modes and hence mutually exclusive. If more - * than one trace recording modes appear in the traceOptions string, the last one - * takes precedence. If none of the trace recording modes are specified, recording - * mode is record-until-full. The trace option will first be reset to the default - * option (record_mode set to record-until-full, enable_sampling and - * enable_systrace set to false) before options parsed from traceOptions are - * applied on it. - */ - traceOptions: string; - } - - interface TraceConfig { - - // Docs: http://electronjs.org/docs/api/structures/trace-config - - excluded_categories?: string[]; - included_categories?: string[]; - memory_dump_config?: MemoryDumpConfig; - } - - interface Transaction { - - // Docs: http://electronjs.org/docs/api/structures/transaction - - /** - * The error code if an error occurred while processing the transaction. - */ - errorCode: number; - /** - * The error message if an error occurred while processing the transaction. - */ - errorMessage: string; - /** - * The identifier of the restored transaction by the App Store. - */ - originalTransactionIdentifier: string; - payment: Payment; - /** - * The date the transaction was added to the App Store’s payment queue. - */ - transactionDate: string; - /** - * A string that uniquely identifies a successful payment transaction. - */ - transactionIdentifier: string; - /** - * The transaction state, can be purchasing, purchased, failed, restored or - * deferred. - */ - transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred'); - } - - class Tray extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/tray - - /** - * Emitted when the tray balloon is clicked. - */ - on(event: 'balloon-click', listener: Function): this; - once(event: 'balloon-click', listener: Function): this; - addListener(event: 'balloon-click', listener: Function): this; - removeListener(event: 'balloon-click', listener: Function): this; - /** - * Emitted when the tray balloon is closed because of timeout or user manually - * closes it. - */ - on(event: 'balloon-closed', listener: Function): this; - once(event: 'balloon-closed', listener: Function): this; - addListener(event: 'balloon-closed', listener: Function): this; - removeListener(event: 'balloon-closed', listener: Function): this; - /** - * Emitted when the tray balloon shows. - */ - on(event: 'balloon-show', listener: Function): this; - once(event: 'balloon-show', listener: Function): this; - addListener(event: 'balloon-show', listener: Function): this; - removeListener(event: 'balloon-show', listener: Function): this; - /** - * Emitted when the tray icon is clicked. - */ - on(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the tray icon is double clicked. - */ - on(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - once(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - addListener(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - removeListener(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - /** - * Emitted when a drag operation ends on the tray or ends at another location. - */ - on(event: 'drag-end', listener: Function): this; - once(event: 'drag-end', listener: Function): this; - addListener(event: 'drag-end', listener: Function): this; - removeListener(event: 'drag-end', listener: Function): this; - /** - * Emitted when a drag operation enters the tray icon. - */ - on(event: 'drag-enter', listener: Function): this; - once(event: 'drag-enter', listener: Function): this; - addListener(event: 'drag-enter', listener: Function): this; - removeListener(event: 'drag-enter', listener: Function): this; - /** - * Emitted when a drag operation exits the tray icon. - */ - on(event: 'drag-leave', listener: Function): this; - once(event: 'drag-leave', listener: Function): this; - addListener(event: 'drag-leave', listener: Function): this; - removeListener(event: 'drag-leave', listener: Function): this; - /** - * Emitted when any dragged items are dropped on the tray icon. - */ - on(event: 'drop', listener: Function): this; - once(event: 'drop', listener: Function): this; - addListener(event: 'drop', listener: Function): this; - removeListener(event: 'drop', listener: Function): this; - /** - * Emitted when dragged files are dropped in the tray icon. - */ - on(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - once(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - addListener(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - removeListener(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - /** - * Emitted when dragged text is dropped in the tray icon. - */ - on(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - once(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - addListener(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - removeListener(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - /** - * Emitted when the mouse enters the tray icon. - */ - on(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the mouse exits the tray icon. - */ - on(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the mouse moves in the tray icon. - */ - on(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the tray icon is right clicked. - */ - on(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - once(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - addListener(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - removeListener(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - constructor(image: (NativeImage) | (string)); - /** - * Destroys the tray icon immediately. - */ - destroy(): void; - /** - * Displays a tray balloon. - */ - displayBalloon(options: DisplayBalloonOptions): void; - /** - * The bounds of this tray icon as Object. - */ - getBounds(): Rectangle; - getIgnoreDoubleClickEvents(): boolean; - getTitle(title: string): string; - isDestroyed(): boolean; - /** - * Pops up the context menu of the tray icon. When menu is passed, the menu will be - * shown instead of the tray icon's context menu. The position is only available on - * Windows, and it is (0, 0) by default. - */ - popUpContextMenu(menu?: Menu, position?: Point): void; - /** - * Sets the context menu for this icon. - */ - setContextMenu(menu: (Menu) | (null)): void; - /** - * Sets when the tray's icon background becomes highlighted (in blue). Deprecated - * Note: You can use highlightMode with a BrowserWindow by toggling between 'never' - * and 'always' modes when the window visibility changes. - */ - setHighlightMode(mode: 'selection' | 'always' | 'never'): void; - /** - * Sets the option to ignore double click events. Ignoring these events allows you - * to detect every individual click of the tray icon. This value is set to false by - * default. - */ - setIgnoreDoubleClickEvents(ignore: boolean): void; - /** - * Sets the image associated with this tray icon. - */ - setImage(image: (NativeImage) | (string)): void; - /** - * Sets the image associated with this tray icon when pressed on macOS. - */ - setPressedImage(image: (NativeImage) | (string)): void; - /** - * Sets the title displayed next to the tray icon in the status bar (Support ANSI - * colors). - */ - setTitle(title: string): void; - /** - * Sets the hover text for this tray icon. - */ - setToolTip(toolTip: string): void; - } - - interface UploadBlob { - - // Docs: http://electronjs.org/docs/api/structures/upload-blob - - /** - * UUID of blob data to upload. - */ - blobUUID: string; - /** - * blob. - */ - type: string; - } - - interface UploadData { - - // Docs: http://electronjs.org/docs/api/structures/upload-data - - /** - * UUID of blob data. Use method to retrieve the data. - */ - blobUUID: string; - /** - * Content being sent. - */ - bytes: Buffer; - /** - * Path of file being uploaded. - */ - file: string; - } - - interface UploadFile { - - // Docs: http://electronjs.org/docs/api/structures/upload-file - - /** - * Path of file to be uploaded. - */ - filePath: string; - /** - * Number of bytes to read from offset. Defaults to 0. - */ - length: number; - /** - * Last Modification time in number of seconds since the UNIX epoch. - */ - modificationTime: number; - /** - * Defaults to 0. - */ - offset: number; - /** - * file. - */ - type: string; - } - - interface UploadRawData { - - // Docs: http://electronjs.org/docs/api/structures/upload-raw-data - - /** - * Data to be uploaded. - */ - bytes: Buffer; - /** - * rawData. - */ - type: string; - } - - class WebContents extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-contents - - static fromId(id: number): WebContents; - static getAllWebContents(): WebContents[]; - static getFocusedWebContents(): WebContents; - /** - * Emitted before dispatching the keydown and keyup events in the page. Calling - * event.preventDefault will prevent the page keydown/keyup events and the menu - * shortcuts. To only prevent the menu shortcuts, use setIgnoreMenuShortcuts: - */ - on(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - once(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - addListener(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - removeListener(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - /** - * Emitted when failed to verify the certificate for url. The usage is the same - * with the certificate-error event of app. - */ - on(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - /** - * Emitted when the associated window logs a console message. Will not be emitted - * for windows with offscreen rendering enabled. - */ - on(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - once(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - addListener(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - removeListener(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - /** - * Emitted when there is a new context menu that needs to be handled. - */ - on(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - once(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - addListener(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - removeListener(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - /** - * Emitted when the renderer process crashes or is killed. - */ - on(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - once(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - addListener(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - removeListener(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - /** - * Emitted when the cursor's type changes. The type parameter can be default, - * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, - * s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, - * nwse-resize, col-resize, row-resize, m-panning, e-panning, n-panning, - * ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, - * vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, - * not-allowed, zoom-in, zoom-out, grab, grabbing or custom. If the type parameter - * is custom, the image parameter will hold the custom cursor image in a - * NativeImage, and scale, size and hotspot will hold additional information about - * the custom cursor. - */ - on(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - once(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - addListener(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - removeListener(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - /** - * Emitted when desktopCapturer.getSources() is called in the renderer process. - * Calling event.preventDefault() will make it return empty sources. - */ - on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - /** - * Emitted when webContents is destroyed. - */ - on(event: 'destroyed', listener: Function): this; - once(event: 'destroyed', listener: Function): this; - addListener(event: 'destroyed', listener: Function): this; - removeListener(event: 'destroyed', listener: Function): this; - /** - * Emitted when DevTools is closed. - */ - on(event: 'devtools-closed', listener: Function): this; - once(event: 'devtools-closed', listener: Function): this; - addListener(event: 'devtools-closed', listener: Function): this; - removeListener(event: 'devtools-closed', listener: Function): this; - /** - * Emitted when DevTools is focused / opened. - */ - on(event: 'devtools-focused', listener: Function): this; - once(event: 'devtools-focused', listener: Function): this; - addListener(event: 'devtools-focused', listener: Function): this; - removeListener(event: 'devtools-focused', listener: Function): this; - /** - * Emitted when DevTools is opened. - */ - on(event: 'devtools-opened', listener: Function): this; - once(event: 'devtools-opened', listener: Function): this; - addListener(event: 'devtools-opened', listener: Function): this; - removeListener(event: 'devtools-opened', listener: Function): this; - /** - * Emitted when the devtools window instructs the webContents to reload - */ - on(event: 'devtools-reload-page', listener: Function): this; - once(event: 'devtools-reload-page', listener: Function): this; - addListener(event: 'devtools-reload-page', listener: Function): this; - removeListener(event: 'devtools-reload-page', listener: Function): this; - /** - * Emitted when a has been attached to this web contents. - */ - on(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - once(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - addListener(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - removeListener(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - /** - * Emitted when a page's theme color changes. This is usually due to encountering a - * meta tag: - */ - on(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - once(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - addListener(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - removeListener(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - /** - * This event is like did-finish-load but emitted when the load failed or was - * cancelled, e.g. window.stop() is invoked. The full list of error codes and their - * meaning is available here. - */ - on(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when the navigation is done, i.e. the spinner of the tab has stopped - * spinning, and the onload event was dispatched. - */ - on(event: 'did-finish-load', listener: Function): this; - once(event: 'did-finish-load', listener: Function): this; - addListener(event: 'did-finish-load', listener: Function): this; - removeListener(event: 'did-finish-load', listener: Function): this; - /** - * Emitted when a frame has done navigation. - */ - on(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when any frame navigation is done. This event is not emitted for in-page - * navigations, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. - */ - on(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when a main frame navigation is done. This event is not emitted for - * in-page navigations, such as clicking anchor links or updating the - * window.location.hash. Use did-navigate-in-page event for this purpose. - */ - on(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - once(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - addListener(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - removeListener(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - /** - * Emitted when an in-page navigation happened in any frame. When in-page - * navigation happens, the page URL changes but does not cause navigation outside - * of the page. Examples of this occurring are when anchor links are clicked or - * when the DOM hashchange event is triggered. - */ - on(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted after a server side redirect occurs during navigation. For example a - * 302 redirect. This event can not be prevented, if you want to prevent redirects - * you should checkout out the will-redirect event above. - */ - on(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab started spinning. - */ - on(event: 'did-start-loading', listener: Function): this; - once(event: 'did-start-loading', listener: Function): this; - addListener(event: 'did-start-loading', listener: Function): this; - removeListener(event: 'did-start-loading', listener: Function): this; - /** - * Emitted when any frame (including main) starts navigating. isInplace will be - * true for in-page navigations. - */ - on(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab stopped spinning. - */ - on(event: 'did-stop-loading', listener: Function): this; - once(event: 'did-stop-loading', listener: Function): this; - addListener(event: 'did-stop-loading', listener: Function): this; - removeListener(event: 'did-stop-loading', listener: Function): this; - /** - * Emitted when the document in the given frame is loaded. - */ - on(event: 'dom-ready', listener: (event: Event) => void): this; - once(event: 'dom-ready', listener: (event: Event) => void): this; - addListener(event: 'dom-ready', listener: (event: Event) => void): this; - removeListener(event: 'dom-ready', listener: (event: Event) => void): this; - /** - * Emitted when the window enters a full-screen state triggered by HTML API. - */ - on(event: 'enter-html-full-screen', listener: Function): this; - once(event: 'enter-html-full-screen', listener: Function): this; - addListener(event: 'enter-html-full-screen', listener: Function): this; - removeListener(event: 'enter-html-full-screen', listener: Function): this; - /** - * Emitted when a result is available for [webContents.findInPage] request. - */ - on(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - once(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - addListener(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - removeListener(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - /** - * Emitted when the renderer process sends an asynchronous message via - * ipcRenderer.send(). - */ - on(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - once(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - addListener(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - removeListener(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - /** - * Emitted when the renderer process sends a synchronous message via - * ipcRenderer.sendSync(). - */ - on(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - once(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - addListener(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - removeListener(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - /** - * Emitted when the window leaves a full-screen state triggered by HTML API. - */ - on(event: 'leave-html-full-screen', listener: Function): this; - once(event: 'leave-html-full-screen', listener: Function): this; - addListener(event: 'leave-html-full-screen', listener: Function): this; - removeListener(event: 'leave-html-full-screen', listener: Function): this; - /** - * Emitted when webContents wants to do basic auth. The usage is the same with the - * login event of app. - */ - on(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when media is paused or done playing. - */ - on(event: 'media-paused', listener: Function): this; - once(event: 'media-paused', listener: Function): this; - addListener(event: 'media-paused', listener: Function): this; - removeListener(event: 'media-paused', listener: Function): this; - /** - * Emitted when media starts playing. - */ - on(event: 'media-started-playing', listener: Function): this; - once(event: 'media-started-playing', listener: Function): this; - addListener(event: 'media-started-playing', listener: Function): this; - removeListener(event: 'media-started-playing', listener: Function): this; - /** - * Emitted when the page requests to open a new window for a url. It could be - * requested by window.open or an external link like . By - * default a new BrowserWindow will be created for the url. Calling - * event.preventDefault() will prevent Electron from automatically creating a new - * BrowserWindow. If you call event.preventDefault() and manually create a new - * BrowserWindow then you must set event.newGuest to reference the new - * BrowserWindow instance, failing to do so may result in unexpected behavior. For - * example: - */ - on(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - once(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - addListener(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - removeListener(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - /** - * Emitted when page receives favicon urls. - */ - on(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - once(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - addListener(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - removeListener(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - /** - * Fired when page title is set during navigation. explicitSet is false when title - * is synthesized from file url. - */ - on(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - once(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - addListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - removeListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - /** - * Emitted when a new frame is generated. Only the dirty area is passed in the - * buffer. - */ - on(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - once(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - addListener(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - removeListener(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - /** - * Emitted when a plugin process has crashed. - */ - on(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - once(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - addListener(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - removeListener(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - /** - * Emitted when the preload script preloadPath throws an unhandled exception error. - */ - on(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - once(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - addListener(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - removeListener(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - /** - * Emitted when remote.getBuiltin() is called in the renderer process. Calling - * event.preventDefault() will prevent the module from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - once(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - addListener(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - removeListener(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - /** - * Emitted when remote.getCurrentWebContents() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - once(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - addListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - removeListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - /** - * Emitted when remote.getCurrentWindow() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-window', listener: (event: Event) => void): this; - once(event: 'remote-get-current-window', listener: (event: Event) => void): this; - addListener(event: 'remote-get-current-window', listener: (event: Event) => void): this; - removeListener(event: 'remote-get-current-window', listener: (event: Event) => void): this; - /** - * Emitted when remote.getGlobal() is called in the renderer process. Calling - * event.preventDefault() will prevent the global from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - once(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - addListener(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - removeListener(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - /** - * Emitted when .getWebContents() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - once(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - addListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - /** - * Emitted when remote.require() is called in the renderer process. Calling - * event.preventDefault() will prevent the module from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - once(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - addListener(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - removeListener(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - /** - * Emitted when the unresponsive web page becomes responsive again. - */ - on(event: 'responsive', listener: Function): this; - once(event: 'responsive', listener: Function): this; - addListener(event: 'responsive', listener: Function): this; - removeListener(event: 'responsive', listener: Function): this; - /** - * Emitted when bluetooth device needs to be selected on call to - * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth - * should be enabled. If event.preventDefault is not called, first available device - * will be selected. callback should be called with deviceId to be selected, - * passing empty string to callback will cancel the request. - */ - on(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - once(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - addListener(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - removeListener(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - /** - * Emitted when a client certificate is requested. The usage is the same with the - * select-client-certificate event of app. - */ - on(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - /** - * Emitted when the web page becomes unresponsive. - */ - on(event: 'unresponsive', listener: Function): this; - once(event: 'unresponsive', listener: Function): this; - addListener(event: 'unresponsive', listener: Function): this; - removeListener(event: 'unresponsive', listener: Function): this; - /** - * Emitted when mouse moves over a link or the keyboard moves the focus to a link. - */ - on(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - once(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - addListener(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when a 's web contents is being attached to this web contents. - * Calling event.preventDefault() will destroy the guest page. This event can be - * used to configure webPreferences for the webContents of a before it's - * loaded, and provides the ability to set settings that can't be set via - * attributes. Note: The specified preload script option will be appear as - * preloadURL (not preload) in the webPreferences object emitted with this event. - */ - on(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - once(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - addListener(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - removeListener(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - /** - * Emitted when a user or the page wants to start navigation. It can happen when - * the window.location object is changed or a user clicks a link in the page. This - * event will not emit when the navigation is started programmatically with APIs - * like webContents.loadURL and webContents.back. It is also not emitted for - * in-page navigations, such as clicking anchor links or updating the - * window.location.hash. Use did-navigate-in-page event for this purpose. Calling - * event.preventDefault() will prevent the navigation. - */ - on(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - once(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - addListener(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when a beforeunload event handler is attempting to cancel a page unload. - * Calling event.preventDefault() will ignore the beforeunload event handler and - * allow the page to be unloaded. - */ - on(event: 'will-prevent-unload', listener: (event: Event) => void): this; - once(event: 'will-prevent-unload', listener: (event: Event) => void): this; - addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; - removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; - /** - * Emitted as a server side redirect occurs during navigation. For example a 302 - * redirect. This event will be emitted after did-start-navigation and always - * before the did-redirect-navigation event for the same navigation. Calling - * event.preventDefault() will prevent the navigation (not just the redirect). - */ - on(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Adds the specified path to DevTools workspace. Must be used after DevTools - * creation: - */ - addWorkSpace(path: string): void; - /** - * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(image, dirtyRect) when there is a presentation event. - * The image is an instance of NativeImage that stores the captured frame. The - * dirtyRect is an object with x, y, width, height properties that describes which - * part of the page was repainted. If onlyDirty is set to true, image will only - * contain the repainted area. onlyDirty defaults to false. - */ - beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; - /** - * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(image, dirtyRect) when there is a presentation event. - * The image is an instance of NativeImage that stores the captured frame. The - * dirtyRect is an object with x, y, width, height properties that describes which - * part of the page was repainted. If onlyDirty is set to true, image will only - * contain the repainted area. onlyDirty defaults to false. - */ - beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; - canGoBack(): boolean; - canGoForward(): boolean; - canGoToOffset(offset: number): boolean; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Clears the navigation history. - */ - clearHistory(): void; - /** - * Closes the devtools. - */ - closeDevTools(): void; - /** - * Executes the editing command copy in web page. - */ - copy(): void; - /** - * Copy the image at the given position to the clipboard. - */ - copyImageAt(x: number, y: number): void; - /** - * Executes the editing command cut in web page. - */ - cut(): void; - /** - * Executes the editing command delete in web page. - */ - delete(): void; - /** - * Disable device emulation enabled by webContents.enableDeviceEmulation. - */ - disableDeviceEmulation(): void; - /** - * Initiates a download of the resource at url without navigating. The - * will-download event of session will be triggered. - */ - downloadURL(url: string): void; - /** - * Enable device emulation with the given parameters. - */ - enableDeviceEmulation(parameters: Parameters): void; - /** - * End subscribing for frame presentation events. - */ - endFrameSubscription(): void; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Starts a request to find all matches for the text in the web page. The result of - * the request can be obtained by subscribing to found-in-page event. - */ - findInPage(text: string, options?: FindInPageOptions): number; - /** - * Focuses the web page. - */ - focus(): void; - getFrameRate(): number; - getOSProcessId(): number; - /** - * Get the system printer list. - */ - getPrinters(): PrinterInfo[]; - getProcessId(): number; - getTitle(): string; - getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen'); - getURL(): string; - getUserAgent(): string; - getWebRTCIPHandlingPolicy(): string; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Makes the browser go back a web page. - */ - goBack(): void; - /** - * Makes the browser go forward a web page. - */ - goForward(): void; - /** - * Navigates browser to the specified absolute web page index. - */ - goToIndex(index: number): void; - /** - * Navigates to the specified offset from the "current entry". - */ - goToOffset(offset: number): void; - /** - * Injects CSS into the current web page. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Starts inspecting element at position (x, y). - */ - inspectElement(x: number, y: number): void; - /** - * Opens the developer tools for the service worker context. - */ - inspectServiceWorker(): void; - /** - * Opens the developer tools for the shared worker context. - */ - inspectSharedWorker(): void; - /** - * Schedules a full repaint of the window this web contents is in. If offscreen - * rendering is enabled invalidates the frame and generates a new one through the - * 'paint' event. - */ - invalidate(): void; - isAudioMuted(): boolean; - isCrashed(): boolean; - isCurrentlyAudible(): boolean; - isDestroyed(): boolean; - isDevToolsFocused(): boolean; - isDevToolsOpened(): boolean; - isFocused(): boolean; - isLoading(): boolean; - isLoadingMainFrame(): boolean; - isOffscreen(): boolean; - isPainting(): boolean; - isWaitingForResponse(): boolean; - /** - * Loads the given file in the window, filePath should be a path to an HTML file - * relative to the root of your application. For instance an app structure like - * this: Would require code like this - */ - loadFile(filePath: string, options?: LoadFileOptions): Promise; - /** - * Loads the url in the window. The url must contain the protocol prefix, e.g. the - * http:// or file://. If the load should bypass http cache then use the pragma - * header to achieve it. - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Opens the devtools. When contents is a tag, the mode would be detach - * by default, explicitly passing an empty mode can force using last used dock - * state. - */ - openDevTools(options?: OpenDevToolsOptions): void; - /** - * Executes the editing command paste in web page. - */ - paste(): void; - /** - * Executes the editing command pasteAndMatchStyle in web page. - */ - pasteAndMatchStyle(): void; - /** - * Prints window's web page. When silent is set to true, Electron will pick the - * system's default printer if deviceName is empty and the default settings for - * printing. Calling window.print() in web page is equivalent to calling - * webContents.print({ silent: false, printBackground: false, deviceName: '' }). - * Use page-break-before: always; CSS style to force to print to a new page. - */ - print(options?: PrintOptions, callback?: (success: boolean) => void): void; - /** - * Prints window's web page as PDF with Chromium's preview printing custom - * settings. The landscape will be ignored if @page CSS at-rule is used in the web - * page. By default, an empty options will be regarded as: Use page-break-before: - * always; CSS style to force to print to a new page. An example of - * webContents.printToPDF: - */ - printToPDF(options: PrintToPDFOptions): Promise; - /** - * Prints window's web page as PDF with Chromium's preview printing custom - * settings. The callback will be called with callback(error, data) on completion. - * The data is a Buffer that contains the generated PDF data. Deprecated Soon - */ - printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; - /** - * Executes the editing command redo in web page. - */ - redo(): void; - /** - * Reloads the current web page. - */ - reload(): void; - /** - * Reloads current page and ignores cache. - */ - reloadIgnoringCache(): void; - /** - * Removes the specified path from DevTools workspace. - */ - removeWorkSpace(path: string): void; - /** - * Executes the editing command replace in web page. - */ - replace(text: string): void; - /** - * Executes the editing command replaceMisspelling in web page. - */ - replaceMisspelling(text: string): void; - savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise; - /** - * Executes the editing command selectAll in web page. - */ - selectAll(): void; - /** - * Send an asynchronous message to renderer process via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The renderer process can - * handle the message by listening to channel with the ipcRenderer module. An - * example of sending messages from the main process to the renderer process: - */ - send(channel: string, ...args: any[]): void; - /** - * Sends an input event to the page. Note: The BrowserWindow containing the - * contents needs to be focused for sendInputEvent() to work. For keyboard events, - * the event object also have following properties: For mouse events, the event - * object also have following properties: For the mouseWheel event, the event - * object also have following properties: - */ - sendInputEvent(event: Event): void; - /** - * Send an asynchronous message to a specific frame in a renderer process via - * channel. Arguments will be serialized as JSON internally and as such no - * functions or prototype chains will be included. The renderer process can handle - * the message by listening to channel with the ipcRenderer module. If you want to - * get the frameId of a given renderer context you should use the - * webFrame.routingId value. E.g. You can also read frameId from all incoming IPC - * messages in the main process. - */ - sendToFrame(frameId: number, channel: string, ...args: any[]): void; - /** - * Mute the audio on the current web page. - */ - setAudioMuted(muted: boolean): void; - /** - * Controls whether or not this WebContents will throttle animations and timers - * when the page becomes backgrounded. This also affects the Page Visibility API. - */ - setBackgroundThrottling(allowed: boolean): void; - /** - * Uses the devToolsWebContents as the target WebContents to show devtools. The - * devToolsWebContents must not have done any navigation, and it should not be used - * for other purposes after the call. By default Electron manages the devtools by - * creating an internal WebContents with native view, which developers have very - * limited control of. With the setDevToolsWebContents method, developers can use - * any WebContents to show the devtools in it, including BrowserWindow, BrowserView - * and tag. Note that closing the devtools does not destroy the - * devToolsWebContents, it is caller's responsibility to destroy - * devToolsWebContents. An example of showing devtools in a tag: An - * example of showing devtools in a BrowserWindow: - */ - setDevToolsWebContents(devToolsWebContents: WebContents): void; - /** - * If offscreen rendering is enabled sets the frame rate to the specified number. - * Only values between 1 and 60 are accepted. - */ - setFrameRate(fps: number): void; - /** - * Ignore application menu shortcuts while this web contents is focused. - */ - setIgnoreMenuShortcuts(ignore: boolean): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Overrides the user agent for this web page. - */ - setUserAgent(userAgent: string): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Setting the WebRTC IP handling policy allows you to control which IPs are - * exposed via WebRTC. See BrowserLeaks for more details. - */ - setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. The formula for this is - * scale := 1.2 ^ level. - */ - setZoomLevel(level: number): void; - /** - * Shows pop-up dictionary that searches the selected word on the page. - */ - showDefinitionForSelection(): void; - /** - * Sets the item as dragging item for current drag-drop operation, file is the - * absolute path of the file to be dragged, and icon is the image showing under the - * cursor when dragging. - */ - startDrag(item: Item): void; - /** - * If offscreen rendering is enabled and not painting, start painting. - */ - startPainting(): void; - /** - * Stops any pending navigation. - */ - stop(): void; - /** - * Stops any findInPage request for the webContents with the provided action. - */ - stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; - /** - * If offscreen rendering is enabled and painting, stop painting. - */ - stopPainting(): void; - /** - * Takes a V8 heap snapshot and saves it to filePath. - */ - takeHeapSnapshot(filePath: string): Promise; - /** - * Toggles the developer tools. - */ - toggleDevTools(): void; - /** - * Executes the editing command undo in web page. - */ - undo(): void; - /** - * Executes the editing command unselect in web page. - */ - unselect(): void; - debugger: Debugger; - devToolsWebContents: WebContents; - hostWebContents: WebContents; - id: number; - session: Session; - } - - interface WebFrame extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-frame - - /** - * Attempts to free memory that is no longer being used (like images from a - * previous navigation). Note that blindly calling this method probably makes - * Electron slower since it will have to refill these emptied caches, you should - * only call it if an event in your app has occurred that makes you think your page - * is actually using less memory (i.e. you have navigated from a super heavy page - * to a mostly empty one, and intend to stay there). - */ - clearCache(): void; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Works like executeJavaScript but evaluates scripts in an isolated context. - * Deprecated Soon - */ - executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Works like executeJavaScript but evaluates scripts in an isolated context. - */ - executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise; - findFrameByName(name: string): WebFrame; - findFrameByRoutingId(routingId: number): WebFrame; - getFrameForSelector(selector: string): WebFrame; - /** - * Returns an object describing usage information of Blink's internal memory - * caches. This will generate: - */ - getResourceUsage(): ResourceUsage; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Inserts css as a style sheet in the document. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Set the content security policy of the isolated world. - */ - setIsolatedWorldContentSecurityPolicy(worldId: number, csp: string): void; - /** - * Set the name of the isolated world. Useful in devtools. - */ - setIsolatedWorldHumanReadableName(worldId: number, name: string): void; - /** - * Set the security origin, content security policy and name of the isolated world. - * Note: If the csp is specified, then the securityOrigin also has to be specified. - */ - setIsolatedWorldInfo(worldId: number, info: Info): void; - /** - * Set the security origin of the isolated world. - */ - setIsolatedWorldSecurityOrigin(worldId: number, securityOrigin: string): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Sets a provider for spell checking in input fields and text areas. The provider - * must be an object that has a spellCheck method that accepts an array of - * individual words for spellchecking. The spellCheck function runs asynchronously - * and calls the callback function with an array of misspelt words when complete. - * An example of using node-spellchecker as provider: - */ - setSpellCheckProvider(language: string, provider: Provider): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. - */ - setZoomLevel(level: number): void; - /** - * A WebFrame representing the first child frame of webFrame, the property would be - * null if webFrame has no children or if first child is not in the current - * renderer process. - */ - firstChild?: WebFrame; - /** - * A WebFrame representing next sibling frame, the property would be null if - * webFrame is the last frame in its parent or if the next sibling is not in the - * current renderer process. - */ - nextSibling?: WebFrame; - /** - * A WebFrame representing the frame which opened webFrame, the property would be - * null if there's no opener or opener is not in the current renderer process. - */ - opener?: WebFrame; - /** - * A WebFrame representing parent frame of webFrame, the property would be null if - * webFrame is top or parent is not in the current renderer process. - */ - parent?: WebFrame; - /** - * An Integer representing the unique frame id in the current renderer process. - * Distinct WebFrame instances that refer to the same underlying frame will have - * the same routingId. - */ - routingId?: number; - /** - * A WebFrame representing top frame in frame hierarchy to which webFrame belongs, - * the property would be null if top frame is not in the current renderer process. - */ - top?: WebFrame; - } - - class WebRequest extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-request - - /** - * The listener will be called with listener(details) when a server initiated - * redirect is about to occur. - */ - onBeforeRedirect(listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a server initiated - * redirect is about to occur. - */ - onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when a request is - * about to occur. The uploadData is an array of UploadData objects. The callback - * has to be called with an response object. Some examples of valid urls: - */ - onBeforeRequest(listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when a request is - * about to occur. The uploadData is an array of UploadData objects. The callback - * has to be called with an response object. Some examples of valid urls: - */ - onBeforeRequest(filter: OnBeforeRequestFilter, listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) before sending an - * HTTP request, once the request headers are available. This may occur after a TCP - * connection is made to the server, but before any http data is sent. The callback - * has to be called with an response object. - */ - onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) before sending an - * HTTP request, once the request headers are available. This may occur after a TCP - * connection is made to the server, but before any http data is sent. The callback - * has to be called with an response object. - */ - onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a request is completed. - */ - onCompleted(filter: OnCompletedFilter, listener: ((details: OnCompletedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a request is completed. - */ - onCompleted(listener: ((details: OnCompletedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when an error occurs. - */ - onErrorOccurred(listener: ((details: OnErrorOccurredDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when an error occurs. - */ - onErrorOccurred(filter: OnErrorOccurredFilter, listener: ((details: OnErrorOccurredDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when HTTP response - * headers of a request have been received. The callback has to be called with an - * response object. - */ - onHeadersReceived(filter: OnHeadersReceivedFilter, listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when HTTP response - * headers of a request have been received. The callback has to be called with an - * response object. - */ - onHeadersReceived(listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details) when first byte of the - * response body is received. For HTTP requests, this means that the status line - * and response headers are available. - */ - onResponseStarted(listener: ((details: OnResponseStartedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when first byte of the - * response body is received. For HTTP requests, this means that the status line - * and response headers are available. - */ - onResponseStarted(filter: OnResponseStartedFilter, listener: ((details: OnResponseStartedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) just before a request is - * going to be sent to the server, modifications of previous onBeforeSendHeaders - * response are visible by the time this listener is fired. - */ - onSendHeaders(filter: OnSendHeadersFilter, listener: ((details: OnSendHeadersDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) just before a request is - * going to be sent to the server, modifications of previous onBeforeSendHeaders - * response are visible by the time this listener is fired. - */ - onSendHeaders(listener: ((details: OnSendHeadersDetails) => void) | (null)): void; - } - - interface WebSource { - - // Docs: http://electronjs.org/docs/api/structures/web-source - - code: string; - /** - * Default is 1. - */ - startLine?: number; - url?: string; - } - - interface WebviewTag extends HTMLElement { - - // Docs: http://electronjs.org/docs/api/webview-tag - - /** - * Fired when a load has committed. This includes navigation within the current - * document as well as subframe document-level loads, but does not include - * asynchronous resource loads. - */ - addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this; - /** - * Fired when the navigation is done, i.e. the spinner of the tab will stop - * spinning, and the onload event is dispatched. - */ - addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this; - /** - * This event is like did-finish-load, but fired when the load failed or was - * cancelled, e.g. window.stop() is invoked. - */ - addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this; - /** - * Fired when a frame has done navigation. - */ - addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab starts spinning. - */ - addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab stops spinning. - */ - addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this; - /** - * Fired when document in the given frame is loaded. - */ - addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this; - /** - * Fired when page title is set during navigation. explicitSet is false when title - * is synthesized from file url. - */ - addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this; - /** - * Fired when page receives favicon urls. - */ - addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this; - /** - * Fired when page enters fullscreen triggered by HTML API. - */ - addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this; - /** - * Fired when page leaves fullscreen triggered by HTML API. - */ - addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this; - /** - * Fired when the guest window logs a console message. The following example code - * forwards all log messages to the embedder's console without regard for log level - * or other properties. - */ - addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this; - /** - * Fired when a result is available for webview.findInPage request. - */ - addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this; - /** - * Fired when the guest page attempts to open a new browser window. The following - * example code opens the new url in system's default browser. - */ - addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this; - /** - * Emitted when a user or the page wants to start navigation. It can happen when - * the window.location object is changed or a user clicks a link in the page. This - * event will not emit when the navigation is started programmatically with APIs - * like .loadURL and .back. It is also not emitted during in-page - * navigation, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. Calling event.preventDefault() - * does NOT have any effect. - */ - addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this; - /** - * Emitted when a navigation is done. This event is not emitted for in-page - * navigations, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. - */ - addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this; - /** - * Emitted when an in-page navigation happened. When in-page navigation happens, - * the page URL changes but does not cause navigation outside of the page. Examples - * of this occurring are when anchor links are clicked or when the DOM hashchange - * event is triggered. - */ - addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this; - /** - * Fired when the guest page attempts to close itself. The following example code - * navigates the webview to about:blank when the guest attempts to close itself. - */ - addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'close', listener: (event: Event) => void): this; - /** - * Fired when the guest page has sent an asynchronous message to embedder page. - * With sendToHost method and ipc-message event you can communicate between guest - * page and embedder page: - */ - addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this; - /** - * Fired when the renderer process is crashed. - */ - addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'crashed', listener: (event: Event) => void): this; - /** - * Fired when a plugin process is crashed. - */ - addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this; - /** - * Fired when the WebContents is destroyed. - */ - addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'destroyed', listener: (event: Event) => void): this; - /** - * Emitted when media starts playing. - */ - addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this; - /** - * Emitted when media is paused or done playing. - */ - addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'media-paused', listener: (event: Event) => void): this; - /** - * Emitted when a page's theme color changes. This is usually due to encountering a - * meta tag: - */ - addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this; - /** - * Emitted when mouse moves over a link or the keyboard moves the focus to a link. - */ - addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this; - /** - * Emitted when DevTools is opened. - */ - addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this; - /** - * Emitted when DevTools is closed. - */ - addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this; - /** - * Emitted when DevTools is focused / opened. - */ - addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - removeEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - canGoBack(): boolean; - canGoForward(): boolean; - canGoToOffset(offset: number): boolean; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Clears the navigation history. - */ - clearHistory(): void; - /** - * Closes the DevTools window of guest page. - */ - closeDevTools(): void; - /** - * Executes editing command copy in page. - */ - copy(): void; - /** - * Executes editing command cut in page. - */ - cut(): void; - /** - * Executes editing command delete in page. - */ - delete(): void; - /** - * Initiates a download of the resource at url without navigating. - */ - downloadURL(url: string): void; - /** - * Evaluates code in page. If userGesture is set, it will create the user gesture - * context in the page. HTML APIs like requestFullScreen, which require user - * action, can take advantage of this option for automation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Evaluates code in page. If userGesture is set, it will create the user gesture - * context in the page. HTML APIs like requestFullScreen, which require user - * action, can take advantage of this option for automation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Starts a request to find all matches for the text in the web page. The result of - * the request can be obtained by subscribing to found-in-page event. - */ - findInPage(text: string, options?: FindInPageOptions): number; - getTitle(): string; - getURL(): string; - getUserAgent(): string; - /** - * It depends on the remote module, it is therefore not available when this module - * is disabled. - */ - getWebContents(): WebContents; - getWebContentsId(): number; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Makes the guest page go back. - */ - goBack(): void; - /** - * Makes the guest page go forward. - */ - goForward(): void; - /** - * Navigates to the specified absolute index. - */ - goToIndex(index: number): void; - /** - * Navigates to the specified offset from the "current entry". - */ - goToOffset(offset: number): void; - /** - * Injects CSS into the guest page. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Starts inspecting element at position (x, y) of guest page. - */ - inspectElement(x: number, y: number): void; - /** - * Opens the DevTools for the service worker context present in the guest page. - */ - inspectServiceWorker(): void; - /** - * Opens the DevTools for the shared worker context present in the guest page. - */ - inspectSharedWorker(): void; - isAudioMuted(): boolean; - isCrashed(): boolean; - isCurrentlyAudible(): boolean; - isDevToolsFocused(): boolean; - isDevToolsOpened(): boolean; - isLoading(): boolean; - isLoadingMainFrame(): boolean; - isWaitingForResponse(): boolean; - /** - * Loads the url in the webview, the url must contain the protocol prefix, e.g. the - * http:// or file://. - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Opens a DevTools window for guest page. - */ - openDevTools(): void; - /** - * Executes editing command paste in page. - */ - paste(): void; - /** - * Executes editing command pasteAndMatchStyle in page. - */ - pasteAndMatchStyle(): void; - /** - * Prints webview's web page. Same as webContents.print([options]). - */ - print(options?: PrintOptions): void; - /** - * Prints webview's web page as PDF, Same as webContents.printToPDF(options, - * callback). Deprecated Soon - */ - printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; - /** - * Prints webview's web page as PDF, Same as webContents.printToPDF(options). - */ - printToPDF(options: PrintToPDFOptions): Promise; - /** - * Executes editing command redo in page. - */ - redo(): void; - /** - * Reloads the guest page. - */ - reload(): void; - /** - * Reloads the guest page and ignores cache. - */ - reloadIgnoringCache(): void; - /** - * Executes editing command replace in page. - */ - replace(text: string): void; - /** - * Executes editing command replaceMisspelling in page. - */ - replaceMisspelling(text: string): void; - /** - * Executes editing command selectAll in page. - */ - selectAll(): void; - /** - * Send an asynchronous message to renderer process via channel, you can also send - * arbitrary arguments. The renderer process can handle the message by listening to - * the channel event with the ipcRenderer module. See webContents.send for - * examples. - */ - send(channel: string, ...args: any[]): void; - /** - * Sends an input event to the page. See webContents.sendInputEvent for detailed - * description of event object. - */ - sendInputEvent(event: any): void; - /** - * Set guest page muted. - */ - setAudioMuted(muted: boolean): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Overrides the user agent for the guest page. - */ - setUserAgent(userAgent: string): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. The formula for this is - * scale := 1.2 ^ level. - */ - setZoomLevel(level: number): void; - /** - * Shows pop-up dictionary that searches the selected word on the page. - */ - showDefinitionForSelection(): void; - /** - * Stops any pending navigation. - */ - stop(): void; - /** - * Stops any findInPage request for the webview with the provided action. - */ - stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; - /** - * Executes editing command undo in page. - */ - undo(): void; - /** - * Executes editing command unselect in page. - */ - unselect(): void; - /** - * When this attribute is present the guest page will be allowed to open new - * windows. Popups are disabled by default. - */ - // allowpopups?: string; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * A list of strings which specifies the blink features to be disabled separated by - * ,. The full list of supported feature strings can be found in the - * RuntimeEnabledFeatures.json5 file. - */ - disableblinkfeatures?: string; - /** - * When this attribute is present the guest page will have web security disabled. - * Web security is enabled by default. - */ - // disablewebsecurity?: string; ### VSCODE CHANGE(https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * A list of strings which specifies the blink features to be enabled separated by - * ,. The full list of supported feature strings can be found in the - * RuntimeEnabledFeatures.json5 file. - */ - enableblinkfeatures?: string; - /** - * When this attribute is false the guest page in webview will not have access to - * the remote module. The remote module is available by default. - */ - enableremotemodule?: string; - /** - * Sets the referrer URL for the guest page. - */ - httpreferrer?: string; - /** - * When this attribute is present the guest page in webview will have node - * integration and can use node APIs like require and process to access low level - * system resources. Node integration is disabled by default in the guest page. - */ - nodeintegration?: string; - /** - * Experimental option for enabling NodeJS support in sub-frames such as iframes - * inside the webview. All your preloads will load for every iframe, you can use - * process.isMainFrame to determine if you are in the main frame or not. This - * option is disabled by default in the guest page. - */ - nodeintegrationinsubframes?: string; - /** - * Sets the session used by the page. If partition starts with persist:, the page - * will use a persistent session available to all pages in the app with the same - * partition. if there is no persist: prefix, the page will use an in-memory - * session. By assigning the same partition, multiple pages can share the same - * session. If the partition is unset then default session of the app will be used. - * This value can only be modified before the first navigation, since the session - * of an active renderer process cannot change. Subsequent attempts to modify the - * value will fail with a DOM exception. - */ - partition?: string; - /** - * When this attribute is present the guest page in webview will be able to use - * browser plugins. Plugins are disabled by default. - */ - plugins?: string; - /** - * Specifies a script that will be loaded before other scripts run in the guest - * page. The protocol of script's URL must be either file: or asar:, because it - * will be loaded by require in guest page under the hood. When the guest page - * doesn't have node integration this script will still have access to all Node - * APIs, but global objects injected by Node will be deleted after this script has - * finished executing. Note: This option will be appear as preloadURL (not preload) - * in the webPreferences specified to the will-attach-webview event. - */ - preload?: string; - /** - * Returns the visible URL. Writing to this attribute initiates top-level - * navigation. Assigning src its own value will reload the current page. The src - * attribute can also accept data URLs, such as data:text/plain,Hello, world!. - */ - src?: string; - /** - * Sets the user agent for the guest page before the page is navigated to. Once the - * page is loaded, use the setUserAgent method to change the user agent. - */ - useragent?: string; - /** - * A list of strings which specifies the web preferences to be set on the webview, - * separated by ,. The full list of supported preference strings can be found in - * BrowserWindow. The string follows the same format as the features string in - * window.open. A name by itself is given a true boolean value. A preference can be - * set to another value by including an =, followed by the value. Special values - * yes and 1 are interpreted as true, while no and 0 are interpreted as false. - */ - webpreferences?: string; - } - - interface AboutPanelOptionsOptions { - /** - * The app's name. - */ - applicationName?: string; - /** - * The app's version. - */ - applicationVersion?: string; - /** - * Copyright information. - */ - copyright?: string; - /** - * The app's build version number. - */ - version?: string; - /** - * Credit information. - */ - credits?: string; - /** - * The app's website. - */ - website?: string; - /** - * Path to the app's icon. Will be shown as 64x64 pixels while retaining aspect - * ratio. - */ - iconPath?: string; - } - - interface AddRepresentationOptions { - /** - * The scale factor to add the image representation for. - */ - scaleFactor: number; - /** - * Defaults to 0. Required if a bitmap buffer is specified as buffer. - */ - width?: number; - /** - * Defaults to 0. Required if a bitmap buffer is specified as buffer. - */ - height?: number; - /** - * The buffer containing the raw image data. - */ - buffer?: Buffer; - /** - * The data URL containing either a base 64 encoded PNG or JPEG image. - */ - dataURL?: string; - } - - interface AnimationSettings { - /** - * Returns true if rich animations should be rendered. Looks at session type (e.g. - * remote desktop) and accessibility settings to give guidance for heavy - * animations. - */ - shouldRenderRichAnimation: boolean; - /** - * Determines on a per-platform basis whether scroll animations (e.g. produced by - * home/end key) should be enabled. - */ - scrollAnimationsEnabledBySystem: boolean; - /** - * Determines whether the user desires reduced motion based on platform APIs. - */ - prefersReducedMotion: boolean; - } - - interface AppDetailsOptions { - /** - * Window's . It has to be set, otherwise the other options will have no effect. - */ - appId?: string; - /** - * Window's . - */ - appIconPath?: string; - /** - * Index of the icon in appIconPath. Ignored when appIconPath is not set. Default - * is 0. - */ - appIconIndex?: number; - /** - * Window's . - */ - relaunchCommand?: string; - /** - * Window's . - */ - relaunchDisplayName?: string; - } - - interface AuthInfo { - isProxy: boolean; - scheme: string; - host: string; - port: number; - realm: string; - } - - interface AutoResizeOptions { - /** - * If true, the view's width will grow and shrink together with the window. false - * by default. - */ - width: boolean; - /** - * If true, the view's height will grow and shrink together with the window. false - * by default. - */ - height: boolean; - /** - * If true, the view's x position and width will grow and shrink proportionly with - * the window. false by default. - */ - horizontal: boolean; - /** - * If true, the view's y position and height will grow and shrink proportinaly with - * the window. false by default. - */ - vertical: boolean; - } - - interface BitmapOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface BrowserViewConstructorOptions { - /** - * See . - */ - webPreferences?: WebPreferences; - } - - interface BrowserWindowConstructorOptions { - /** - * Window's width in pixels. Default is 800. - */ - width?: number; - /** - * Window's height in pixels. Default is 600. - */ - height?: number; - /** - * ( if y is used) Window's left offset from screen. Default is to center the - * window. - */ - x?: number; - /** - * ( if x is used) Window's top offset from screen. Default is to center the - * window. - */ - y?: number; - /** - * The width and height would be used as web page's size, which means the actual - * window's size will include window frame's size and be slightly larger. Default - * is false. - */ - useContentSize?: boolean; - /** - * Show window in the center of the screen. - */ - center?: boolean; - /** - * Window's minimum width. Default is 0. - */ - minWidth?: number; - /** - * Window's minimum height. Default is 0. - */ - minHeight?: number; - /** - * Window's maximum width. Default is no limit. - */ - maxWidth?: number; - /** - * Window's maximum height. Default is no limit. - */ - maxHeight?: number; - /** - * Whether window is resizable. Default is true. - */ - resizable?: boolean; - /** - * Whether window is movable. This is not implemented on Linux. Default is true. - */ - movable?: boolean; - /** - * Whether window is minimizable. This is not implemented on Linux. Default is - * true. - */ - minimizable?: boolean; - /** - * Whether window is maximizable. This is not implemented on Linux. Default is - * true. - */ - maximizable?: boolean; - /** - * Whether window is closable. This is not implemented on Linux. Default is true. - */ - closable?: boolean; - /** - * Whether the window can be focused. Default is true. On Windows setting - * focusable: false also implies setting skipTaskbar: true. On Linux setting - * focusable: false makes the window stop interacting with wm, so the window will - * always stay on top in all workspaces. - */ - focusable?: boolean; - /** - * Whether the window should always stay on top of other windows. Default is false. - */ - alwaysOnTop?: boolean; - /** - * Whether the window should show in fullscreen. When explicitly set to false the - * fullscreen button will be hidden or disabled on macOS. Default is false. - */ - fullscreen?: boolean; - /** - * Whether the window can be put into fullscreen mode. On macOS, also whether the - * maximize/zoom button should toggle full screen mode or maximize window. Default - * is true. - */ - fullscreenable?: boolean; - /** - * Use pre-Lion fullscreen on macOS. Default is false. - */ - simpleFullscreen?: boolean; - /** - * Whether to show the window in taskbar. Default is false. - */ - skipTaskbar?: boolean; - /** - * The kiosk mode. Default is false. - */ - kiosk?: boolean; - /** - * Default window title. Default is "Electron". If the HTML tag is defined - * in the HTML file loaded by loadURL(), this property will be - * ignored. - */ - title?: string; - /** - * The window icon. On Windows it is recommended to use ICO icons to get best - * visual effects, you can also leave it undefined so the executable's icon will be - * used. - */ - icon?: (NativeImage) | (string); - /** - * Whether window should be shown when created. Default is true. - */ - show?: boolean; - /** - * Specify false to create a . Default is true. - */ - frame?: boolean; - /** - * Specify parent window. Default is null. - */ - parent?: BrowserWindow; - /** - * Whether this is a modal window. This only works when the window is a child - * window. Default is false. - */ - modal?: boolean; - /** - * Whether the web view accepts a single mouse-down event that simultaneously - * activates the window. Default is false. - */ - acceptFirstMouse?: boolean; - /** - * Whether to hide cursor when typing. Default is false. - */ - disableAutoHideCursor?: boolean; - /** - * Auto hide the menu bar unless the Alt key is pressed. Default is false. - */ - autoHideMenuBar?: boolean; - /** - * Enable the window to be resized larger than screen. Default is false. - */ - enableLargerThanScreen?: boolean; - /** - * Window's background color as a hexadecimal value, like #66CD00 or #FFF or - * #80FFFFFF (alpha in #AARRGGBB format is supported if transparent is set to - * true). Default is #FFF (white). - */ - backgroundColor?: string; - /** - * Whether window should have a shadow. This is only implemented on macOS. Default - * is true. - */ - hasShadow?: boolean; - /** - * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 - * (fully opaque). This is only implemented on Windows and macOS. - */ - opacity?: number; - /** - * Forces using dark theme for the window, only works on some GTK+3 desktop - * environments. Default is false. - */ - darkTheme?: boolean; - /** - * Makes the window . Default is false. - */ - transparent?: boolean; - /** - * The type of window, default is normal window. See more about this below. - */ - type?: string; - /** - * The style of window title bar. Default is default. Possible values are: - */ - titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover'); - /** - * Shows the title in the title bar in full screen mode on macOS for all - * titleBarStyle options. Default is false. - */ - fullscreenWindowTitle?: boolean; - /** - * Use WS_THICKFRAME style for frameless windows on Windows, which adds standard - * window frame. Setting it to false will remove window shadow and window - * animations. Default is true. - */ - thickFrame?: boolean; - /** - * Add a type of vibrancy effect to the window, only on macOS. Can be - * appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, - * medium-light or ultra-dark. Please note that using frame: false in combination - * with a vibrancy value requires that you use a non-default titleBarStyle as well. - */ - vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'); - /** - * Controls the behavior on macOS when option-clicking the green stoplight button - * on the toolbar or by clicking the Window > Zoom menu item. If true, the window - * will grow to the preferred width of the web page when zoomed, false will cause - * it to zoom to the width of the screen. This will also affect the behavior when - * calling maximize() directly. Default is false. - */ - zoomToPageWidth?: boolean; - /** - * Tab group name, allows opening the window as a native tab on macOS 10.12+. - * Windows with the same tabbing identifier will be grouped together. This also - * adds a native new tab button to your window's tab bar and allows your app and - * window to receive the new-window-for-tab event. - */ - tabbingIdentifier?: string; - /** - * Settings of web page's features. - */ - webPreferences?: WebPreferences; - } - - interface CertificateTrustDialogOptions { - /** - * The certificate to trust/import. - */ - certificate: Certificate; - /** - * The message to display to the user. - */ - message: string; - } - - interface CertificateVerifyProcRequest { - hostname: string; - certificate: Certificate; - /** - * Verification result from chromium. - */ - verificationResult: string; - /** - * Error code. - */ - errorCode: number; - } - - interface ClearStorageDataOptions { - /** - * Should follow window.location.origin’s representation scheme://host:port. - */ - origin?: string; - /** - * The types of storages to clear, can contain: appcache, cookies, filesystem, - * indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. - */ - storages?: string[]; - /** - * The types of quotas to clear, can contain: temporary, persistent, syncable. - */ - quotas?: string[]; - } - - interface CommandLine { - /** - * Append a switch (with optional value) to Chromium's command line. Note: This - * will not affect process.argv. The intended usage of this function is to control - * Chromium's behavior. - */ - appendSwitch: (the_switch: string, value?: string) => void; - /** - * Append an argument to Chromium's command line. The argument will be quoted - * correctly. Switches will precede arguments regardless of appending order. If - * you're appending an argument like --switch=value, consider using - * appendSwitch('switch', 'value') instead. Note: This will not affect - * process.argv. The intended usage of this function is to control Chromium's - * behavior. - */ - appendArgument: (value: string) => void; - hasSwitch: (the_switch: string) => boolean; - /** - * Note: When the switch is not present or has no value, it returns empty string. - */ - getSwitchValue: (the_switch: string) => string; - } - - interface Config { - /** - * The URL associated with the PAC file. - */ - pacScript: string; - /** - * Rules indicating which proxies to use. - */ - proxyRules: string; - /** - * Rules indicating which URLs should bypass the proxy settings. - */ - proxyBypassRules: string; - } - - interface ConsoleMessageEvent extends Event { - level: number; - message: string; - line: number; - sourceId: string; - } - - interface ContextMenuParams { - /** - * x coordinate. - */ - x: number; - /** - * y coordinate. - */ - y: number; - /** - * URL of the link that encloses the node the context menu was invoked on. - */ - linkURL: string; - /** - * Text associated with the link. May be an empty string if the contents of the - * link are an image. - */ - linkText: string; - /** - * URL of the top level page that the context menu was invoked on. - */ - pageURL: string; - /** - * URL of the subframe that the context menu was invoked on. - */ - frameURL: string; - /** - * Source URL for the element that the context menu was invoked on. Elements with - * source URLs are images, audio and video. - */ - srcURL: string; - /** - * Type of the node the context menu was invoked on. Can be none, image, audio, - * video, canvas, file or plugin. - */ - mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'); - /** - * Whether the context menu was invoked on an image which has non-empty contents. - */ - hasImageContents: boolean; - /** - * Whether the context is editable. - */ - isEditable: boolean; - /** - * Text of the selection that the context menu was invoked on. - */ - selectionText: string; - /** - * Title or alt text of the selection that the context was invoked on. - */ - titleText: string; - /** - * The misspelled word under the cursor, if any. - */ - misspelledWord: string; - /** - * The character encoding of the frame on which the menu was invoked. - */ - frameCharset: string; - /** - * If the context menu was invoked on an input field, the type of that field. - * Possible values are none, plainText, password, other. - */ - inputFieldType: string; - /** - * Input source that invoked the context menu. Can be none, mouse, keyboard, touch - * or touchMenu. - */ - menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); - /** - * The flags for the media element the context menu was invoked on. - */ - mediaFlags: MediaFlags; - /** - * These flags indicate whether the renderer believes it is able to perform the - * corresponding action. - */ - editFlags: EditFlags; - } - - interface CrashReporterStartOptions { - companyName: string; - /** - * URL that crash reports will be sent to as POST. - */ - submitURL: string; - /** - * Defaults to app.getName(). - */ - productName?: string; - /** - * Whether crash reports should be sent to the server Default is true. - */ - uploadToServer?: boolean; - /** - * Default is false. - */ - ignoreSystemCrashHandler?: boolean; - /** - * An object you can define that will be sent along with the report. Only string - * properties are sent correctly. Nested objects are not supported and the property - * names and values must be less than 64 characters long. - */ - extra?: Extra; - /** - * Directory to store the crashreports temporarily (only used when the crash - * reporter is started via process.crashReporter.start). - */ - crashesDirectory?: string; - } - - interface CreateFromBitmapOptions { - width: number; - height: number; - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface CreateFromBufferOptions { - /** - * Required for bitmap buffers. - */ - width?: number; - /** - * Required for bitmap buffers. - */ - height?: number; - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface CreateInterruptedDownloadOptions { - /** - * Absolute path of the download. - */ - path: string; - /** - * Complete URL chain for the download. - */ - urlChain: string[]; - mimeType?: string; - /** - * Start range for the download. - */ - offset: number; - /** - * Total length of the download. - */ - length: number; - /** - * Last-Modified header value. - */ - lastModified: string; - /** - * ETag header value. - */ - eTag: string; - /** - * Time when download was started in number of seconds since UNIX epoch. - */ - startTime?: number; - } - - interface Data { - text?: string; - html?: string; - image?: NativeImage; - rtf?: string; - /** - * The title of the URL at text. - */ - bookmark?: string; - } - - interface Details { - /** - * The url to associate the cookie with. - */ - url: string; - /** - * The name of the cookie. Empty by default if omitted. - */ - name?: string; - /** - * The value of the cookie. Empty by default if omitted. - */ - value?: string; - /** - * The domain of the cookie. Empty by default if omitted. - */ - domain?: string; - /** - * The path of the cookie. Empty by default if omitted. - */ - path?: string; - /** - * Whether the cookie should be marked as Secure. Defaults to false. - */ - secure?: boolean; - /** - * Whether the cookie should be marked as HTTP only. Defaults to false. - */ - httpOnly?: boolean; - /** - * The expiration date of the cookie as the number of seconds since the UNIX epoch. - * If omitted then the cookie becomes a session cookie and will not be retained - * between sessions. - */ - expirationDate?: number; - } - - interface DevToolsExtensions { - } - - interface DidChangeThemeColorEvent extends Event { - themeColor: string; - } - - interface DidFailLoadEvent extends Event { - errorCode: number; - errorDescription: string; - validatedURL: string; - isMainFrame: boolean; - } - - interface DidFrameFinishLoadEvent extends Event { - isMainFrame: boolean; - } - - interface DidNavigateEvent extends Event { - url: string; - } - - interface DidNavigateInPageEvent extends Event { - isMainFrame: boolean; - url: string; - } - - interface DisplayBalloonOptions { - /** - * - - */ - icon?: (NativeImage) | (string); - title: string; - content: string; - } - - interface Dock { - /** - * When critical is passed, the dock icon will bounce until either the application - * becomes active or the request is canceled. When informational is passed, the - * dock icon will bounce for one second. However, the request remains active until - * either the application becomes active or the request is canceled. Nota Bene: - * This method can only be used while the app is not focused; when the app is - * focused it will return -1. - */ - bounce: (type?: 'critical' | 'informational') => number; - /** - * Cancel the bounce of id. - */ - cancelBounce: (id: number) => void; - /** - * Bounces the Downloads stack if the filePath is inside the Downloads folder. - */ - downloadFinished: (filePath: string) => void; - /** - * Sets the string to be displayed in the dock’s badging area. - */ - setBadge: (text: string) => void; - getBadge: () => string; - /** - * Hides the dock icon. - */ - hide: () => void; - show: () => Promise; - isVisible: () => boolean; - /** - * Sets the application's dock menu. - */ - setMenu: (menu: Menu) => void; - getMenu: () => (Menu) | (null); - /** - * Sets the image associated with this dock icon. - */ - setIcon: (image: (NativeImage) | (string)) => void; - } - - interface EnableNetworkEmulationOptions { - /** - * Whether to emulate network outage. Defaults to false. - */ - offline?: boolean; - /** - * RTT in ms. Defaults to 0 which will disable latency throttling. - */ - latency?: number; - /** - * Download rate in Bps. Defaults to 0 which will disable download throttling. - */ - downloadThroughput?: number; - /** - * Upload rate in Bps. Defaults to 0 which will disable upload throttling. - */ - uploadThroughput?: number; - } - - interface Extensions { - } - - interface FeedURLOptions { - url: string; - /** - * HTTP request headers. - */ - headers?: Headers; - /** - * Either json or default, see the README for more information. - */ - serverType?: string; - } - - interface FileIconOptions { - size: ('small' | 'normal' | 'large'); - } - - interface Filter { - /** - * Retrieves cookies which are associated with url. Empty implies retrieving - * cookies of all urls. - */ - url?: string; - /** - * Filters cookies by name. - */ - name?: string; - /** - * Retrieves cookies whose domains match or are subdomains of domains. - */ - domain?: string; - /** - * Retrieves cookies whose path matches path. - */ - path?: string; - /** - * Filters cookies by their Secure property. - */ - secure?: boolean; - /** - * Filters out session or persistent cookies. - */ - session?: boolean; - } - - interface FindInPageOptions { - /** - * Whether to search forward or backward, defaults to true. - */ - forward?: boolean; - /** - * Whether the operation is first request or a follow up, defaults to false. - */ - findNext?: boolean; - /** - * Whether search should be case-sensitive, defaults to false. - */ - matchCase?: boolean; - /** - * Whether to look only at the start of words. defaults to false. - */ - wordStart?: boolean; - /** - * When combined with wordStart, accepts a match in the middle of a word if the - * match begins with an uppercase letter followed by a lowercase or non-letter. - * Accepts several other intra-word matches, defaults to false. - */ - medialCapitalAsWordStart?: boolean; - } - - interface FoundInPageEvent extends Event { - result: FoundInPageResult; - } - - interface FromPartitionOptions { - /** - * Whether to enable cache. - */ - cache: boolean; - } - - interface Header { - /** - * Specify an extra header name. - */ - name: string; - } - - interface Headers { - } - - interface HeapStatistics { - totalHeapSize: number; - totalHeapSizeExecutable: number; - totalPhysicalSize: number; - totalAvailableSize: number; - usedHeapSize: number; - heapSizeLimit: number; - mallocedMemory: number; - peakMallocedMemory: number; - doesZapGarbage: boolean; - } - - interface IgnoreMouseEventsOptions { - /** - * If true, forwards mouse move messages to Chromium, enabling mouse related events - * such as mouseleave. Only used when ignore is true. If ignore is false, - * forwarding is always disabled regardless of this value. - */ - forward?: boolean; - } - - interface ImportCertificateOptions { - /** - * Path for the pkcs12 file. - */ - certificate: string; - /** - * Passphrase for the certificate. - */ - password: string; - } - - interface Info { - /** - * Security origin for the isolated world. - */ - securityOrigin?: string; - /** - * Content Security Policy for the isolated world. - */ - csp?: string; - /** - * Name for isolated world. Useful in devtools. - */ - name?: string; - } - - interface Input { - /** - * Either keyUp or keyDown. - */ - type: string; - /** - * Equivalent to . - */ - key: string; - /** - * Equivalent to . - */ - code: string; - /** - * Equivalent to . - */ - isAutoRepeat: boolean; - /** - * Equivalent to . - */ - shift: boolean; - /** - * Equivalent to . - */ - control: boolean; - /** - * Equivalent to . - */ - alt: boolean; - /** - * Equivalent to . - */ - meta: boolean; - } - - interface InterceptBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptHttpProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptStreamProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface IpcMessageEvent extends Event { - channel: string; - args: any[]; - } - - interface Item { - /** - * or files Array The path(s) to the file(s) being dragged. - */ - file: string; - /** - * The image must be non-empty on macOS. - */ - icon: NativeImage; - } - - interface JumpListSettings { - /** - * The minimum number of items that will be shown in the Jump List (for a more - * detailed description of this value see the ). - */ - minItems: number; - /** - * Array of JumpListItem objects that correspond to items that the user has - * explicitly removed from custom categories in the Jump List. These items must not - * be re-added to the Jump List in the call to app.setJumpList(), Windows will not - * display any custom category that contains any of the removed items. - */ - removedItems: JumpListItem[]; - } - - interface LoadCommitEvent extends Event { - url: string; - isMainFrame: boolean; - } - - interface LoadFileOptions { - /** - * Passed to url.format(). - */ - query?: Query; - /** - * Passed to url.format(). - */ - search?: string; - /** - * Passed to url.format(). - */ - hash?: string; - } - - interface LoadURLOptions { - /** - * An HTTP Referrer url. - */ - httpReferrer?: (string) | (Referrer); - /** - * A user agent originating the request. - */ - userAgent?: string; - /** - * Extra headers separated by "\n" - */ - extraHeaders?: string; - postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]); - /** - * Base url (with trailing path separator) for files to be loaded by the data url. - * This is needed only if the specified url is a data url and needs to load other - * files. - */ - baseURLForDataURL?: string; - } - - interface LoginItemSettings { - options?: Options; - /** - * true if the app is set to open at login. - */ - openAtLogin: boolean; - /** - * true if the app is set to open as hidden at login. This setting is not available - * on . - */ - openAsHidden: boolean; - /** - * true if the app was opened at login automatically. This setting is not available - * on . - */ - wasOpenedAtLogin: boolean; - /** - * true if the app was opened as a hidden login item. This indicates that the app - * should not open any windows at startup. This setting is not available on . - */ - wasOpenedAsHidden: boolean; - /** - * true if the app was opened as a login item that should restore the state from - * the previous session. This indicates that the app should restore the windows - * that were open the last time the app was closed. This setting is not available - * on . - */ - restoreState: boolean; - } - - interface LoginItemSettingsOptions { - /** - * The executable path to compare against. Defaults to process.execPath. - */ - path?: string; - /** - * The command-line arguments to compare against. Defaults to an empty array. - */ - args?: string[]; - } - - interface MemoryDumpConfig { - } - - interface MenuItemConstructorOptions { - /** - * Will be called with click(menuItem, browserWindow, event) when the menu item is - * clicked. - */ - click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: KeyboardEvent) => void; - /** - * Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, - * reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, - * togglefullscreen, window, minimize, close, help, about, services, hide, - * hideOthers, unhide, quit, startSpeaking, stopSpeaking, close, minimize, zoom, - * front, appMenu, fileMenu, editMenu, viewMenu, recentDocuments, toggleTabBar, - * selectNextTab, selectPreviousTab, mergeAllWindows, clearRecentDocuments, - * moveTabToNewWindow or windowMenu Define the action of the menu item, when - * specified the click property will be ignored. See . - */ - role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'close' | 'minimize' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu'); - /** - * Can be normal, separator, submenu, checkbox or radio. - */ - type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'); - label?: string; - sublabel?: string; - accelerator?: Accelerator; - icon?: (NativeImage) | (string); - /** - * If false, the menu item will be greyed out and unclickable. - */ - enabled?: boolean; - /** - * default is true, and when false will prevent the accelerator from triggering the - * item if the item is not visible`. - */ - acceleratorWorksWhenHidden?: boolean; - /** - * If false, the menu item will be entirely hidden. - */ - visible?: boolean; - /** - * Should only be specified for checkbox or radio type menu items. - */ - checked?: boolean; - /** - * If false, the accelerator won't be registered with the system, but it will still - * be displayed. Defaults to true. - */ - registerAccelerator?: boolean; - /** - * Should be specified for submenu type menu items. If submenu is specified, the - * type: 'submenu' can be omitted. If the value is not a then it will be - * automatically converted to one using Menu.buildFromTemplate. - */ - submenu?: (MenuItemConstructorOptions[]) | (Menu); - /** - * Unique within a single menu. If defined then it can be used as a reference to - * this item by the position attribute. - */ - id?: string; - /** - * Inserts this item before the item with the specified label. If the referenced - * item doesn't exist the item will be inserted at the end of the menu. Also - * implies that the menu item in question should be placed in the same “group” as - * the item. - */ - before?: string[]; - /** - * Inserts this item after the item with the specified label. If the referenced - * item doesn't exist the item will be inserted at the end of the menu. - */ - after?: string[]; - /** - * Provides a means for a single context menu to declare the placement of their - * containing group before the containing group of the item with the specified - * label. - */ - beforeGroupContaining?: string[]; - /** - * Provides a means for a single context menu to declare the placement of their - * containing group after the containing group of the item with the specified - * label. - */ - afterGroupContaining?: string[]; - } - - interface MessageBoxOptions { - /** - * Can be "none", "info", "error", "question" or "warning". On Windows, "question" - * displays the same icon as "info", unless you set an icon using the "icon" - * option. On macOS, both "warning" and "error" display the same warning icon. - */ - type?: string; - /** - * Array of texts for buttons. On Windows, an empty array will result in one button - * labeled "OK". - */ - buttons?: string[]; - /** - * Index of the button in the buttons array which will be selected by default when - * the message box opens. - */ - defaultId?: number; - /** - * Title of the message box, some platforms will not show it. - */ - title?: string; - /** - * Content of the message box. - */ - message: string; - /** - * Extra information of the message. - */ - detail?: string; - /** - * If provided, the message box will include a checkbox with the given label. The - * checkbox state can be inspected only when using callback. - */ - checkboxLabel?: string; - /** - * Initial checked state of the checkbox. false by default. - */ - checkboxChecked?: boolean; - icon?: NativeImage; - /** - * The index of the button to be used to cancel the dialog, via the Esc key. By - * default this is assigned to the first button with "cancel" or "no" as the label. - * If no such labeled buttons exist and this option is not set, 0 will be used as - * the return value or callback response. - */ - cancelId?: number; - /** - * On Windows Electron will try to figure out which one of the buttons are common - * buttons (like "Cancel" or "Yes"), and show the others as command links in the - * dialog. This can make the dialog appear in the style of modern Windows apps. If - * you don't like this behavior, you can set noLink to true. - */ - noLink?: boolean; - /** - * Normalize the keyboard access keys across platforms. Default is false. Enabling - * this assumes & is used in the button labels for the placement of the keyboard - * shortcut access key and labels will be converted so they work correctly on each - * platform, & characters are removed on macOS, converted to _ on Linux, and left - * untouched on Windows. For example, a button label of Vie&w will be converted to - * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and - * Linux. - */ - normalizeAccessKeys?: boolean; - } - - interface MessageBoxReturnValue { - /** - * The index of the clicked button. - */ - response: number; - /** - * The checked state of the checkbox if checkboxLabel was set. Otherwise false. - */ - checkboxChecked: boolean; - } - - interface MessageBoxSyncOptions { - /** - * Can be "none", "info", "error", "question" or "warning". On Windows, "question" - * displays the same icon as "info", unless you set an icon using the "icon" - * option. On macOS, both "warning" and "error" display the same warning icon. - */ - type?: string; - /** - * Array of texts for buttons. On Windows, an empty array will result in one button - * labeled "OK". - */ - buttons?: string[]; - /** - * Index of the button in the buttons array which will be selected by default when - * the message box opens. - */ - defaultId?: number; - /** - * Title of the message box, some platforms will not show it. - */ - title?: string; - /** - * Content of the message box. - */ - message: string; - /** - * Extra information of the message. - */ - detail?: string; - /** - * If provided, the message box will include a checkbox with the given label. The - * checkbox state can be inspected only when using callback. - */ - checkboxLabel?: string; - /** - * Initial checked state of the checkbox. false by default. - */ - checkboxChecked?: boolean; - icon?: (NativeImage) | (string); - /** - * The index of the button to be used to cancel the dialog, via the Esc key. By - * default this is assigned to the first button with "cancel" or "no" as the label. - * If no such labeled buttons exist and this option is not set, 0 will be used as - * the return value or callback response. - */ - cancelId?: number; - /** - * On Windows Electron will try to figure out which one of the buttons are common - * buttons (like "Cancel" or "Yes"), and show the others as command links in the - * dialog. This can make the dialog appear in the style of modern Windows apps. If - * you don't like this behavior, you can set noLink to true. - */ - noLink?: boolean; - /** - * Normalize the keyboard access keys across platforms. Default is false. Enabling - * this assumes & is used in the button labels for the placement of the keyboard - * shortcut access key and labels will be converted so they work correctly on each - * platform, & characters are removed on macOS, converted to _ on Linux, and left - * untouched on Windows. For example, a button label of Vie&w will be converted to - * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and - * Linux. - */ - normalizeAccessKeys?: boolean; - } - - interface NewWindowEvent extends Event { - url: string; - frameName: string; - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'); - /** - * The options which should be used for creating the new . - */ - options: Options; - } - - interface NotificationConstructorOptions { - /** - * A title for the notification, which will be shown at the top of the notification - * window when it is shown. - */ - title: string; - /** - * A subtitle for the notification, which will be displayed below the title. - */ - subtitle?: string; - /** - * The body text of the notification, which will be displayed below the title or - * subtitle. - */ - body: string; - /** - * Whether or not to emit an OS notification noise when showing the notification. - */ - silent?: boolean; - /** - * An icon to use in the notification. - */ - icon?: (string) | (NativeImage); - /** - * Whether or not to add an inline reply option to the notification. - */ - hasReply?: boolean; - /** - * The placeholder to write in the inline reply input field. - */ - replyPlaceholder?: string; - /** - * The name of the sound file to play when the notification is shown. - */ - sound?: string; - /** - * Actions to add to the notification. Please read the available actions and - * limitations in the NotificationAction documentation. - */ - actions?: NotificationAction[]; - /** - * A custom title for the close button of an alert. An empty string will cause the - * default localized text to be used. - */ - closeButtonText?: string; - } - - interface OnBeforeRedirectDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - redirectURL: string; - statusCode: number; - /** - * The server IP address that the request was actually sent to. - */ - ip?: string; - fromCache: boolean; - responseHeaders: ResponseHeaders; - } - - interface OnBeforeRedirectFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeRequestDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - uploadData: UploadData[]; - } - - interface OnBeforeRequestFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeSendHeadersDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - requestHeaders: RequestHeaders; - } - - interface OnBeforeSendHeadersFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeSendHeadersResponse { - cancel?: boolean; - /** - * When provided, request will be made with these headers. - */ - requestHeaders?: RequestHeaders; - } - - interface OnCompletedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - responseHeaders: ResponseHeaders; - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnCompletedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnErrorOccurredDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - fromCache: boolean; - /** - * The error description. - */ - error: string; - } - - interface OnErrorOccurredFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnHeadersReceivedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - statusLine: string; - statusCode: number; - responseHeaders: ResponseHeaders; - } - - interface OnHeadersReceivedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnHeadersReceivedResponse { - cancel?: boolean; - /** - * When provided, the server is assumed to have responded with these headers. - */ - responseHeaders?: ResponseHeaders; - /** - * Should be provided when overriding responseHeaders to change header status - * otherwise original response header's status will be used. - */ - statusLine?: string; - } - - interface OnResponseStartedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - responseHeaders: ResponseHeaders; - /** - * Indicates whether the response was fetched from disk cache. - */ - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnResponseStartedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnSendHeadersDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - requestHeaders: RequestHeaders; - } - - interface OnSendHeadersFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OpenDevToolsOptions { - /** - * Opens the devtools with specified dock state, can be right, bottom, undocked, - * detach. Defaults to last used dock state. In undocked mode it's possible to dock - * back. In detach mode it's not. - */ - mode: ('right' | 'bottom' | 'undocked' | 'detach'); - /** - * Whether to bring the opened devtools window to the foreground. The default is - * true. - */ - activate?: boolean; - } - - interface OpenDialogOptions { - title?: string; - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Contains which features the dialog should use. The following values are - * supported: - */ - properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>; - /** - * Message to display above input boxes. - */ - message?: string; - /** - * Create when packaged for the Mac App Store. - */ - securityScopedBookmarks?: boolean; - } - - interface OpenDialogReturnValue { - /** - * whether or not the dialog was canceled. - */ - canceled: boolean; - /** - * An array of file paths chosen by the user. If the dialog is cancelled this will - * be an empty array. - */ - filePaths?: string[]; - /** - * An array matching the filePaths array of base64 encoded strings which contains - * security scoped bookmark data. securityScopedBookmarks must be enabled for this - * to be populated. - */ - bookmarks?: string[]; - } - - interface OpenDialogSyncOptions { - title?: string; - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Contains which features the dialog should use. The following values are - * supported: - */ - properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>; - /** - * Message to display above input boxes. - */ - message?: string; - /** - * Create when packaged for the Mac App Store. - */ - securityScopedBookmarks?: boolean; - } - - interface OpenExternalOptions { - /** - * true to bring the opened application to the foreground. The default is true. - */ - activate?: boolean; - /** - * The working directory. - */ - workingDirectory?: string; - } - - interface OpenExternalSyncOptions { - /** - * true to bring the opened application to the foreground. The default is true. - */ - activate?: boolean; - /** - * The working directory. - */ - workingDirectory?: string; - } - - interface PageFaviconUpdatedEvent extends Event { - /** - * Array of URLs. - */ - favicons: string[]; - } - - interface PageTitleUpdatedEvent extends Event { - title: string; - explicitSet: boolean; - } - - interface Parameters { - /** - * Specify the screen type to emulate (default: desktop): - */ - screenPosition: ('desktop' | 'mobile'); - /** - * Set the emulated screen size (screenPosition == mobile). - */ - screenSize: Size; - /** - * Position the view on the screen (screenPosition == mobile) (default: { x: 0, y: - * 0 }). - */ - viewPosition: Point; - /** - * Set the device scale factor (if zero defaults to original device scale factor) - * (default: 0). - */ - deviceScaleFactor: number; - /** - * Set the emulated view size (empty means no override) - */ - viewSize: Size; - /** - * Scale of emulated view inside available space (not in fit to view mode) - * (default: 1). - */ - scale: number; - } - - interface Payment { - /** - * The identifier of the purchased product. - */ - productIdentifier: string; - /** - * The quantity purchased. - */ - quantity: number; - } - - interface PermissionCheckHandlerDetails { - /** - * The security orign of the media check. - */ - securityOrigin: string; - /** - * The type of media access being requested, can be video, audio or unknown - */ - mediaType: ('video' | 'audio' | 'unknown'); - /** - * The last URL the requesting frame loaded - */ - requestingUrl: string; - /** - * Whether the frame making the request is the main frame - */ - isMainFrame: boolean; - } - - interface PermissionRequestHandlerDetails { - /** - * The url of the openExternal request. - */ - externalURL?: string; - /** - * The types of media access being requested, elements can be video or audio - */ - mediaTypes?: Array<'video' | 'audio'>; - /** - * The last URL the requesting frame loaded - */ - requestingUrl: string; - /** - * Whether the frame making the request is the main frame - */ - isMainFrame: boolean; - } - - interface PluginCrashedEvent extends Event { - name: string; - version: string; - } - - interface PopupOptions { - /** - * Default is the focused window. - */ - window?: BrowserWindow; - /** - * Default is the current mouse cursor position. Must be declared if y is declared. - */ - x?: number; - /** - * Default is the current mouse cursor position. Must be declared if x is declared. - */ - y?: number; - /** - * The index of the menu item to be positioned under the mouse cursor at the - * specified coordinates. Default is -1. - */ - positioningItem?: number; - /** - * Called when menu is closed. - */ - callback?: () => void; - } - - interface PrintOptions { - /** - * Don't ask user for print settings. Default is false. - */ - silent?: boolean; - /** - * Also prints the background color and image of the web page. Default is false. - */ - printBackground?: boolean; - /** - * Set the printer device name to use. Default is ''. - */ - deviceName?: string; - } - - interface PrintToPDFOptions { - /** - * Specifies the type of margins to use. Uses 0 for default margin, 1 for no - * margin, and 2 for minimum margin. - */ - marginsType?: number; - /** - * Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, - * Tabloid or an Object containing height and width in microns. - */ - pageSize?: (string) | (Size); - /** - * Whether to print CSS backgrounds. - */ - printBackground?: boolean; - /** - * Whether to print selection only. - */ - printSelectionOnly?: boolean; - /** - * true for landscape, false for portrait. - */ - landscape?: boolean; - } - - interface Privileges { - /** - * Default false. - */ - standard?: boolean; - /** - * Default false. - */ - secure?: boolean; - /** - * Default false. - */ - bypassCSP?: boolean; - /** - * Default false. - */ - allowServiceWorkers?: boolean; - /** - * Default false. - */ - supportFetchAPI?: boolean; - /** - * Default false. - */ - corsEnabled?: boolean; - } - - interface ProgressBarOptions { - /** - * Mode for the progress bar. Can be none, normal, indeterminate, error or paused. - */ - mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused'); - } - - interface Provider { - /** - * . - */ - spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void; - } - - interface ReadBookmark { - title: string; - url: string; - } - - interface RedirectRequest { - url: string; - method: string; - session?: Session; - uploadData?: UploadData; - } - - interface RegisterBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterHttpProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterStreamProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RelaunchOptions { - args?: string[]; - execPath?: string; - } - - interface Request { - method: string; - url: string; - referrer: string; - } - - interface ResizeOptions { - /** - * Defaults to the image's width. - */ - width?: number; - /** - * Defaults to the image's height. - */ - height?: number; - /** - * The desired quality of the resize image. Possible values are good, better or - * best. The default is best. These values express a desired quality/speed - * tradeoff. They are translated into an algorithm-specific method that depends on - * the capabilities (CPU, GPU) of the underlying platform. It is possible for all - * three methods to be mapped to the same algorithm on a given platform. - */ - quality?: string; - } - - interface ResourceUsage { - images: MemoryUsageDetails; - scripts: MemoryUsageDetails; - cssStyleSheets: MemoryUsageDetails; - xslStyleSheets: MemoryUsageDetails; - fonts: MemoryUsageDetails; - other: MemoryUsageDetails; - } - - interface Response { - cancel?: boolean; - /** - * The original request is prevented from being sent or completed and is instead - * redirected to the given URL. - */ - redirectURL?: string; - } - - interface Result { - requestId: number; - /** - * Position of the active match. - */ - activeMatchOrdinal: number; - /** - * Number of Matches. - */ - matches: number; - /** - * Coordinates of first match region. - */ - selectionArea: SelectionArea; - finalUpdate: boolean; - } - - interface SaveDialogOptions { - title?: string; - /** - * Absolute directory path, absolute file path, or file name to use by default. - */ - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Message to display above text fields. - */ - message?: string; - /** - * Custom label for the text displayed in front of the filename text field. - */ - nameFieldLabel?: string; - /** - * Show the tags input box, defaults to true. - */ - showsTagField?: boolean; - /** - * Create a when packaged for the Mac App Store. If this option is enabled and the - * file doesn't already exist a blank file will be created at the chosen path. - */ - securityScopedBookmarks?: boolean; - } - - interface SaveDialogReturnValue { - /** - * whether or not the dialog was canceled. - */ - canceled: boolean; - /** - * If the dialog is canceled this will be undefined. - */ - filePath?: string; - /** - * Base64 encoded string which contains the security scoped bookmark data for the - * saved file. securityScopedBookmarks must be enabled for this to be present. - */ - bookmark?: string; - } - - interface SaveDialogSyncOptions { - title?: string; - /** - * Absolute directory path, absolute file path, or file name to use by default. - */ - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Message to display above text fields. - */ - message?: string; - /** - * Custom label for the text displayed in front of the filename text field. - */ - nameFieldLabel?: string; - /** - * Show the tags input box, defaults to true. - */ - showsTagField?: boolean; - /** - * Create a when packaged for the Mac App Store. If this option is enabled and the - * file doesn't already exist a blank file will be created at the chosen path. - */ - securityScopedBookmarks?: boolean; - } - - interface Settings { - /** - * true to open the app at login, false to remove the app as a login item. Defaults - * to false. - */ - openAtLogin?: boolean; - /** - * true to open the app as hidden. Defaults to false. The user can edit this - * setting from the System Preferences so - * app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is - * opened to know the current value. This setting is not available on . - */ - openAsHidden?: boolean; - /** - * The executable to launch at login. Defaults to process.execPath. - */ - path?: string; - /** - * The command-line arguments to pass to the executable. Defaults to an empty - * array. Take care to wrap paths in quotes. - */ - args?: string[]; - } - - interface SourcesOptions { - /** - * An array of Strings that lists the types of desktop sources to be captured, - * available types are screen and window. - */ - types: string[]; - /** - * The size that the media source thumbnail should be scaled to. Default is 150 x - * 150. Set width or height to 0 when you do not need the thumbnails. This will - * save the processing time required for capturing the content of each window and - * screen. - */ - thumbnailSize?: Size; - /** - * Set to true to enable fetching window icons. The default value is false. When - * false the appIcon property of the sources return null. Same if a source has the - * type screen. - */ - fetchWindowIcons?: boolean; - } - - interface SystemMemoryInfo { - /** - * The total amount of physical memory in Kilobytes available to the system. - */ - total: number; - /** - * The total amount of memory not being used by applications or disk cache. - */ - free: number; - /** - * The total amount of swap memory in Kilobytes available to the system. - */ - swapTotal: number; - /** - * The free amount of swap memory in Kilobytes available to the system. - */ - swapFree: number; - } - - interface ToBitmapOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface ToDataURLOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface ToPNGOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface TouchBarButtonConstructorOptions { - /** - * Button text. - */ - label?: string; - /** - * Button background color in hex format, i.e #ABCDEF. - */ - backgroundColor?: string; - /** - * Button icon. - */ - icon?: NativeImage; - /** - * Can be left, right or overlay. - */ - iconPosition?: ('left' | 'right' | 'overlay'); - /** - * Function to call when the button is clicked. - */ - click?: () => void; - } - - interface TouchBarColorPickerConstructorOptions { - /** - * Array of hex color strings to appear as possible colors to select. - */ - availableColors?: string[]; - /** - * The selected hex color in the picker, i.e #ABCDEF. - */ - selectedColor?: string; - /** - * Function to call when a color is selected. - */ - change?: (color: string) => void; - } - - interface TouchBarConstructorOptions { - items: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>; - escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null); - } - - interface TouchBarGroupConstructorOptions { - /** - * Items to display as a group. - */ - items: TouchBar; - } - - interface TouchBarLabelConstructorOptions { - /** - * Text to display. - */ - label?: string; - /** - * Hex color of text, i.e #ABCDEF. - */ - textColor?: string; - } - - interface TouchBarPopoverConstructorOptions { - /** - * Popover button text. - */ - label?: string; - /** - * Popover button icon. - */ - icon?: NativeImage; - /** - * Items to display in the popover. - */ - items?: TouchBar; - /** - * true to display a close button on the left of the popover, false to not show it. - * Default is true. - */ - showCloseButton?: boolean; - } - - interface TouchBarScrubberConstructorOptions { - /** - * An array of items to place in this scrubber. - */ - items: ScrubberItem[]; - /** - * Called when the user taps an item that was not the last tapped item. - */ - select: (selectedIndex: number) => void; - /** - * Called when the user taps any item. - */ - highlight: (highlightedIndex: number) => void; - /** - * Selected item style. Defaults to null. - */ - selectedStyle: string; - /** - * Selected overlay item style. Defaults to null. - */ - overlayStyle: string; - /** - * Defaults to false. - */ - showArrowButtons: boolean; - /** - * Defaults to free. - */ - mode: string; - /** - * Defaults to true. - */ - continuous: boolean; - } - - interface TouchBarSegmentedControlConstructorOptions { - /** - * Style of the segments: - */ - segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated'); - /** - * The selection mode of the control: - */ - mode?: ('single' | 'multiple' | 'buttons'); - /** - * An array of segments to place in this control. - */ - segments: SegmentedControlSegment[]; - /** - * The index of the currently selected segment, will update automatically with user - * interaction. When the mode is multiple it will be the last selected item. - */ - selectedIndex?: number; - /** - * Called when the user selects a new segment. - */ - change: (selectedIndex: number, isSelected: boolean) => void; - } - - interface TouchBarSliderConstructorOptions { - /** - * Label text. - */ - label?: string; - /** - * Selected value. - */ - value?: number; - /** - * Minimum value. - */ - minValue?: number; - /** - * Maximum value. - */ - maxValue?: number; - /** - * Function to call when the slider is changed. - */ - change?: (newValue: number) => void; - } - - interface TouchBarSpacerConstructorOptions { - /** - * Size of spacer, possible values are: - */ - size?: ('small' | 'large' | 'flexible'); - } - - interface UpdateTargetUrlEvent extends Event { - url: string; - } - - interface UploadProgress { - /** - * Whether the request is currently active. If this is false no other properties - * will be set - */ - active: boolean; - /** - * Whether the upload has started. If this is false both current and total will be - * set to 0. - */ - started: boolean; - /** - * The number of bytes that have been uploaded so far - */ - current: number; - /** - * The number of bytes that will be uploaded this request - */ - total: number; - } - - interface Versions { - /** - * A String representing Chrome's version string. - */ - chrome?: string; - /** - * A String representing Electron's version string. - */ - electron?: string; - } - - interface VisibleOnAllWorkspacesOptions { - /** - * Sets whether the window should be visible above fullscreen windows - */ - visibleOnFullScreen?: boolean; - } - - interface WillNavigateEvent extends Event { - url: string; - } - - interface EditFlags { - /** - * Whether the renderer believes it can undo. - */ - canUndo: boolean; - /** - * Whether the renderer believes it can redo. - */ - canRedo: boolean; - /** - * Whether the renderer believes it can cut. - */ - canCut: boolean; - /** - * Whether the renderer believes it can copy - */ - canCopy: boolean; - /** - * Whether the renderer believes it can paste. - */ - canPaste: boolean; - /** - * Whether the renderer believes it can delete. - */ - canDelete: boolean; - /** - * Whether the renderer believes it can select all. - */ - canSelectAll: boolean; - } - - interface Extra { - } - - interface FoundInPageResult { - requestId: number; - /** - * Position of the active match. - */ - activeMatchOrdinal: number; - /** - * Number of Matches. - */ - matches: number; - /** - * Coordinates of first match region. - */ - selectionArea: SelectionArea; - finalUpdate: boolean; - } - - interface MediaFlags { - /** - * Whether the media element has crashed. - */ - inError: boolean; - /** - * Whether the media element is paused. - */ - isPaused: boolean; - /** - * Whether the media element is muted. - */ - isMuted: boolean; - /** - * Whether the media element has audio. - */ - hasAudio: boolean; - /** - * Whether the media element is looping. - */ - isLooping: boolean; - /** - * Whether the media element's controls are visible. - */ - isControlsVisible: boolean; - /** - * Whether the media element's controls are toggleable. - */ - canToggleControls: boolean; - /** - * Whether the media element can be rotated. - */ - canRotate: boolean; - } - - interface Options { - } - - interface Query { - } - - interface RequestHeaders { - } - - interface ResponseHeaders { - } - - interface SelectionArea { - } - - interface WebPreferences { - /** - * Whether to enable DevTools. If it is set to false, can not use - * BrowserWindow.webContents.openDevTools() to open DevTools. Default is true. - */ - devTools?: boolean; - /** - * Whether node integration is enabled. Default is false. - */ - nodeIntegration?: boolean; - /** - * Whether node integration is enabled in web workers. Default is false. More about - * this can be found in . - */ - nodeIntegrationInWorker?: boolean; - /** - * Experimental option for enabling Node.js support in sub-frames such as iframes - * and child windows. All your preloads will load for every iframe, you can use - * process.isMainFrame to determine if you are in the main frame or not. - */ - nodeIntegrationInSubFrames?: boolean; - /** - * Specifies a script that will be loaded before other scripts run in the page. - * This script will always have access to node APIs no matter whether node - * integration is turned on or off. The value should be the absolute file path to - * the script. When node integration is turned off, the preload script can - * reintroduce Node global symbols back to the global scope. See example . - */ - preload?: string; - /** - * If set, this will sandbox the renderer associated with the window, making it - * compatible with the Chromium OS-level sandbox and disabling the Node.js engine. - * This is not the same as the nodeIntegration option and the APIs available to the - * preload script are more limited. Read more about the option . This option is - * currently experimental and may change or be removed in future Electron releases. - */ - sandbox?: boolean; - /** - * Whether to enable the module. Default is true. - */ - enableRemoteModule?: boolean; - /** - * Sets the session used by the page. Instead of passing the Session object - * directly, you can also choose to use the partition option instead, which accepts - * a partition string. When both session and partition are provided, session will - * be preferred. Default is the default session. - */ - session?: Session; - /** - * Sets the session used by the page according to the session's partition string. - * If partition starts with persist:, the page will use a persistent session - * available to all pages in the app with the same partition. If there is no - * persist: prefix, the page will use an in-memory session. By assigning the same - * partition, multiple pages can share the same session. Default is the default - * session. - */ - partition?: string; - /** - * When specified, web pages with the same affinity will run in the same renderer - * process. Note that due to reusing the renderer process, certain webPreferences - * options will also be shared between the web pages even when you specified - * different values for them, including but not limited to preload, sandbox and - * nodeIntegration. So it is suggested to use exact same webPreferences for web - * pages with the same affinity. - */ - affinity?: string; - /** - * The default zoom factor of the page, 3.0 represents 300%. Default is 1.0. - */ - zoomFactor?: number; - /** - * Enables JavaScript support. Default is true. - */ - javascript?: boolean; - /** - * When false, it will disable the same-origin policy (usually using testing - * websites by people), and set allowRunningInsecureContent to true if this options - * has not been set by user. Default is true. - */ - // webSecurity?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is - * false. - */ - // allowRunningInsecureContent?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Enables image support. Default is true. - */ - images?: boolean; - /** - * Make TextArea elements resizable. Default is true. - */ - textAreasAreResizable?: boolean; - /** - * Enables WebGL support. Default is true. - */ - webgl?: boolean; - /** - * Whether plugins should be enabled. Default is false. - */ - plugins?: boolean; - /** - * Enables Chromium's experimental features. Default is false. - */ - // experimentalFeatures?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Enables scroll bounce (rubber banding) effect on macOS. Default is false. - */ - scrollBounce?: boolean; - /** - * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to - * enable. The full list of supported feature strings can be found in the file. - */ - enableBlinkFeatures?: string; - /** - * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to - * disable. The full list of supported feature strings can be found in the file. - */ - disableBlinkFeatures?: string; - /** - * Sets the default font for the font-family. - */ - defaultFontFamily?: DefaultFontFamily; - /** - * Defaults to 16. - */ - defaultFontSize?: number; - /** - * Defaults to 13. - */ - defaultMonospaceFontSize?: number; - /** - * Defaults to 0. - */ - minimumFontSize?: number; - /** - * Defaults to ISO-8859-1. - */ - defaultEncoding?: string; - /** - * Whether to throttle animations and timers when the page becomes background. This - * also affects the . Defaults to true. - */ - backgroundThrottling?: boolean; - /** - * Whether to enable offscreen rendering for the browser window. Defaults to false. - * See the for more details. - */ - offscreen?: boolean; - /** - * Whether to run Electron APIs and the specified preload script in a separate - * JavaScript context. Defaults to false. The context that the preload script runs - * in will still have full access to the document and window globals but it will - * use its own set of JavaScript builtins (Array, Object, JSON, etc.) and will be - * isolated from any changes made to the global environment by the loaded page. The - * Electron API will only be available in the preload script and not the loaded - * page. This option should be used when loading potentially untrusted remote - * content to ensure the loaded content cannot tamper with the preload script and - * any Electron APIs being used. This option uses the same technique used by . You - * can access this context in the dev tools by selecting the 'Electron Isolated - * Context' entry in the combo box at the top of the Console tab. - */ - contextIsolation?: boolean; - /** - * Whether to use native window.open(). Defaults to false. Child windows will - * always have node integration disabled unless nodeIntegrationInSubFrames is true. - * This option is currently experimental. - */ - nativeWindowOpen?: boolean; - /** - * Whether to enable the . Defaults to false. The preload script configured for the - * will have node integration enabled when it is executed so you should ensure - * remote/untrusted content is not able to create a tag with a possibly malicious - * preload script. You can use the will-attach-webview event on to strip away the - * preload script and to validate or alter the 's initial settings. - */ - webviewTag?: boolean; - /** - * A list of strings that will be appended to process.argv in the renderer process - * of this app. Useful for passing small bits of data down to renderer process - * preload scripts. - */ - additionalArguments?: string[]; - /** - * Whether to enable browser style consecutive dialog protection. Default is false. - */ - safeDialogs?: boolean; - /** - * The message to display when consecutive dialog protection is triggered. If not - * defined the default message would be used, note that currently the default - * message is in English and not localized. - */ - safeDialogsMessage?: string; - /** - * Whether dragging and dropping a file or link onto the page causes a navigation. - * Default is false. - */ - navigateOnDragDrop?: boolean; - /** - * Autoplay policy to apply to content in the window, can be - * no-user-gesture-required, user-gesture-required, - * document-user-activation-required. Defaults to no-user-gesture-required. - */ - autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required'); - /** - * Whether to prevent the window from resizing when entering HTML Fullscreen. - * Default is false. - */ - disableHtmlFullscreenWindowResize?: boolean; - } - - interface DefaultFontFamily { - /** - * Defaults to Times New Roman. - */ - standard?: string; - /** - * Defaults to Times New Roman. - */ - serif?: string; - /** - * Defaults to Arial. - */ - sansSerif?: string; - /** - * Defaults to Courier New. - */ - monospace?: string; - /** - * Defaults to Script. - */ - cursive?: string; - /** - * Defaults to Impact. - */ - fantasy?: string; - } - -} - -declare module 'electron' { - export = Electron; -} - -interface NodeRequireFunction { - (moduleName: 'electron'): typeof Electron; -} - -interface File { - /** - * The real path to the file on the users filesystem - */ - path: string; -} - -declare module 'original-fs' { - import * as fs from 'fs'; - export = fs; -} - -interface Document { - createElement(tagName: 'webview'): Electron.WebviewTag; -} - -declare namespace NodeJS { - interface Process extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/process - - // ### BEGIN VSCODE MODIFICATION ### - // /** - // * Emitted when Electron has loaded its internal initialization script and is - // * beginning to load the web page or the main script. It can be used by the preload - // * script to add removed Node global symbols back to the global scope when node - // * integration is turned off: - // */ - // on(event: 'loaded', listener: Function): this; - // once(event: 'loaded', listener: Function): this; - // addListener(event: 'loaded', listener: Function): this; - // removeListener(event: 'loaded', listener: Function): this; - // ### END VSCODE MODIFICATION ### - /** - * Causes the main thread of the current process crash. - */ - crash(): void; - getCPUUsage(): Electron.CPUUsage; - /** - * Indicates the creation time of the application. The time is represented as - * number of milliseconds since epoch. It returns null if it is unable to get the - * process creation time. - */ - getCreationTime(): (number) | (null); - /** - * Returns an object with V8 heap statistics. Note that all statistics are reported - * in Kilobytes. - */ - getHeapStatistics(): Electron.HeapStatistics; - getIOCounters(): Electron.IOCounters; - /** - * Returns an object giving memory usage statistics about the current process. Note - * that all statistics are reported in Kilobytes. This api should be called after - * app ready. Chromium does not provide residentSet value for macOS. This is - * because macOS performs in-memory compression of pages that haven't been recently - * used. As a result the resident set size value is not what one would expect. - * private memory is more representative of the actual pre-compression memory usage - * of the process on macOS. - */ - getProcessMemoryInfo(): Promise; - /** - * Returns an object giving memory usage statistics about the entire system. Note - * that all statistics are reported in Kilobytes. - */ - getSystemMemoryInfo(): Electron.SystemMemoryInfo; - /** - * Examples: Note: It returns the actual operating system version instead of kernel - * version on macOS unlike os.release(). - */ - getSystemVersion(): string; - /** - * Causes the main thread of the current process hang. - */ - hang(): void; - /** - * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, - * whichever is lower for the current process. - */ - setFdLimit(maxDescriptors: number): void; - /** - * Takes a V8 heap snapshot and saves it to filePath. - */ - takeHeapSnapshot(filePath: string): boolean; - /** - * A Boolean. When app is started by being passed as parameter to the default app, - * this property is true in the main process, otherwise it is undefined. - */ - defaultApp?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings are printed to - * stderr when formerly callback-based APIs converted to Promises are invoked using - * callbacks. Setting this to true will enable deprecation warnings. - */ - enablePromiseAPIs?: boolean; - /** - * A Boolean, true when the current renderer context is the "main" renderer frame. - * If you want the ID of the current frame you should use webFrame.routingId. - */ - isMainFrame?: boolean; - /** - * A Boolean. For Mac App Store build, this property is true, for other builds it - * is undefined. - */ - mas?: boolean; - /** - * A Boolean that controls ASAR support inside your application. Setting this to - * true will disable the support for asar archives in Node's built-in modules. - */ - noAsar?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings are printed to - * stderr. Setting this to true will silence deprecation warnings. This property is - * used instead of the --no-deprecation command line flag. - */ - noDeprecation?: boolean; - /** - * A String representing the path to the resources directory. - */ - resourcesPath?: string; - /** - * A Boolean. When the renderer process is sandboxed, this property is true, - * otherwise it is undefined. - */ - sandboxed?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings will be thrown as - * exceptions. Setting this to true will throw errors for deprecations. This - * property is used instead of the --throw-deprecation command line flag. - */ - throwDeprecation?: boolean; - /** - * A Boolean that controls whether or not deprecations printed to stderr include - * their stack trace. Setting this to true will print stack traces for - * deprecations. This property is instead of the --trace-deprecation command line - * flag. - */ - traceDeprecation?: boolean; - /** - * A Boolean that controls whether or not process warnings printed to stderr - * include their stack trace. Setting this to true will print stack traces for - * process warnings (including deprecations). This property is instead of the - * --trace-warnings command line flag. - */ - traceProcessWarnings?: boolean; - /** - * A String representing the current process's type, can be "browser" (i.e. main - * process), "renderer", or "worker" (i.e. web worker). - */ - type?: string; - /** - * A Boolean. If the app is running as a Windows Store app (appx), this property is - * true, for otherwise it is undefined. - */ - windowsStore?: boolean; - } - interface ProcessVersions { - electron: string; - chrome: string; - } -} diff --git a/src/typings/lib.ie11_safe_es6.d.ts b/src/typings/lib.ie11_safe_es6.d.ts index 43bde6f7c640c..4d54d3c08ef43 100644 --- a/src/typings/lib.ie11_safe_es6.d.ts +++ b/src/typings/lib.ie11_safe_es6.d.ts @@ -12,7 +12,7 @@ interface Map { forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): Map; + set(key: K, value: V): Map; readonly size: number; // not supported on IE11: @@ -25,7 +25,7 @@ interface Map { interface MapConstructor { new (): Map; - prototype: Map; + readonly prototype: Map; // not supported on IE11: // new (iterable: Iterable<[K, V]>): Map; @@ -51,7 +51,7 @@ interface Set { interface SetConstructor { new (): Set; - prototype: Set; + readonly prototype: Set; // not supported on IE11: // new (iterable: Iterable): Set; diff --git a/src/typings/native-keymap.d.ts b/src/typings/native-keymap.d.ts deleted file mode 100644 index 716a74e38b8cc..0000000000000 --- a/src/typings/native-keymap.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'native-keymap' { - - export interface IWindowsKeyMapping { - vkey: string; - value: string; - withShift: string; - withAltGr: string; - withShiftAltGr: string; - } - export interface IWindowsKeyboardMapping { - [code: string]: IWindowsKeyMapping; - } - export interface ILinuxKeyMapping { - value: string; - withShift: string; - withAltGr: string; - withShiftAltGr: string; - } - export interface ILinuxKeyboardMapping { - [code: string]: ILinuxKeyMapping; - } - export interface IMacKeyMapping { - value: string; - withShift: string; - withAltGr: string; - withShiftAltGr: string; - valueIsDeadKey: boolean; - withShiftIsDeadKey: boolean; - withAltGrIsDeadKey: boolean; - withShiftAltGrIsDeadKey: boolean; - } - export interface IMacKeyboardMapping { - [code: string]: IMacKeyMapping; - } - - export type IKeyboardMapping = IWindowsKeyboardMapping | ILinuxKeyboardMapping | IMacKeyboardMapping; - - export function getKeyMap(): IKeyboardMapping; - - /* __GDPR__FRAGMENT__ - "IKeyboardLayoutInfo" : { - "name" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "id": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "text": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - export interface IWindowsKeyboardLayoutInfo { - name: string; - id: string; - text: string; - } - - /* __GDPR__FRAGMENT__ - "IKeyboardLayoutInfo" : { - "model" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "layout": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "variant": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "options": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "rules": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - export interface ILinuxKeyboardLayoutInfo { - model: string; - layout: string; - variant: string; - options: string; - rules: string; - } - - /* __GDPR__FRAGMENT__ - "IKeyboardLayoutInfo" : { - "id" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "lang": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - export interface IMacKeyboardLayoutInfo { - id: string; - lang: string; - } - - export type IKeyboardLayoutInfo = IWindowsKeyboardLayoutInfo | ILinuxKeyboardLayoutInfo | IMacKeyboardLayoutInfo; - - export function getCurrentKeyboardLayout(): IKeyboardLayoutInfo; - - export function onDidChangeKeyboardLayout(callback: () => void): void; - - export function isISOKeyboard(): boolean; -} \ No newline at end of file diff --git a/src/typings/native-watchdog.d.ts b/src/typings/native-watchdog.d.ts deleted file mode 100644 index 88119b314c128..0000000000000 --- a/src/typings/native-watchdog.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'native-watchdog' { - - /** - * Start monitoring for a certain pid to exist. - * If the process indicated by pid ceases to execute, - * the current process will exit in 6 seconds with exit code 87 - */ - export function start(pid: number): void; - - export function exit(exitCode: number): void; - -} diff --git a/src/typings/onigasm-umd.d.ts b/src/typings/onigasm-umd.d.ts deleted file mode 100644 index 151cecebfddb5..0000000000000 --- a/src/typings/onigasm-umd.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "onigasm-umd" { - - function loadWASM(data: string | ArrayBuffer): Promise; - - class OnigString { - constructor(content: string); - readonly content: string; - readonly dispose?: () => void; - } - - class OnigScanner { - constructor(patterns: string[]); - findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch; - } - - export interface IOnigCaptureIndex { - index: number - start: number - end: number - length: number - } - - export interface IOnigMatch { - index: number - captureIndices: IOnigCaptureIndex[] - scanner: OnigScanner - } -} \ No newline at end of file diff --git a/src/typings/require.d.ts b/src/typings/require.d.ts index 733da26c9adfb..dfffac43e5647 100644 --- a/src/typings/require.d.ts +++ b/src/typings/require.d.ts @@ -31,7 +31,7 @@ declare class LoaderEvent { readonly detail: string; } -declare var define: { +declare const define: { (moduleName: string, dependencies: string[], callback: (...args: any[]) => any): any; (moduleName: string, dependencies: string[], definition: any): any; (moduleName: string, callback: (...args: any[]) => any): any; diff --git a/src/typings/vscode-minimist.d.ts b/src/typings/vscode-minimist.d.ts deleted file mode 100644 index 17558a1a7383a..0000000000000 --- a/src/typings/vscode-minimist.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -// Type definitions for minimist 1.2.0 -// Project: https://github.com/substack/minimist -// Definitions by: Bart van der Schoor , Necroskillz , kamranayub -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * Return an argument object populated with the array arguments from args - * - * @param args An optional argument array (typically `process.argv.slice(2)`) - * @param opts An optional options object to customize the parsing - */ -declare function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs; - -/** - * Return an argument object populated with the array arguments from args. Strongly-typed - * to be the intersect of type T with minimist.ParsedArgs. - * - * @type T The type that will be intersected with minimist.ParsedArgs to represent the argument object - * @param args An optional argument array (typically `process.argv.slice(2)`) - * @param opts An optional options object to customize the parsing - */ -declare function minimist(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs; - -/** - * Return an argument object populated with the array arguments from args. Strongly-typed - * to be the the type T which should extend minimist.ParsedArgs - * - * @type T The type that extends minimist.ParsedArgs and represents the argument object - * @param args An optional argument array (typically `process.argv.slice(2)`) - * @param opts An optional options object to customize the parsing - */ -declare function minimist(args?: string[], opts?: minimist.Opts): T; - -declare namespace minimist { - export interface Opts { - /** - * A string or array of strings argument names to always treat as strings - */ - string?: string | string[]; - - /** - * A boolean, string or array of strings to always treat as booleans. If true will treat - * all double hyphenated arguments without equals signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) - */ - boolean?: boolean | string | string[]; - - /** - * An object mapping string names to strings or arrays of string argument names to use as aliases - */ - alias?: { [key: string]: string | string[] }; - - /** - * An object mapping string argument names to default values - */ - default?: { [key: string]: any }; - - /** - * When true, populate argv._ with everything after the first non-option - */ - stopEarly?: boolean; - - /** - * A function which is invoked with a command line parameter not defined in the opts - * configuration object. If the function returns false, the unknown option is not added to argv - */ - unknown?: (arg: string) => boolean; - - /** - * When true, populate argv._ with everything before the -- and argv['--'] with everything after the --. - * Note that with -- set, parsing for arguments still stops after the `--`. - */ - '--'?: boolean; - } - - export interface ParsedArgs { - [arg: string]: any; - - /** - * If opts['--'] is true, populated with everything after the -- - */ - '--'?: string[]; - - /** - * Contains all the arguments that didn't have an option associated with them - */ - _: string[]; - } -} - -declare module "vscode-minimist" { - export = minimist; -} diff --git a/src/typings/vscode-ripgrep.d.ts b/src/typings/vscode-ripgrep.d.ts deleted file mode 100644 index 4c5c89c3ca89c..0000000000000 --- a/src/typings/vscode-ripgrep.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'vscode-ripgrep' { - export const rgPath: string; -} diff --git a/src/typings/vscode-textmate.d.ts b/src/typings/vscode-textmate.d.ts deleted file mode 100644 index 835b33008ac50..0000000000000 --- a/src/typings/vscode-textmate.d.ts +++ /dev/null @@ -1,256 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode-textmate" { - /** - * A single theme setting. - */ - export interface IRawThemeSetting { - readonly name?: string; - readonly scope?: string | string[]; - readonly settings: { - readonly fontStyle?: string; - readonly foreground?: string; - readonly background?: string; - }; - } - /** - * A TextMate theme. - */ - export interface IRawTheme { - readonly name?: string; - readonly settings: IRawThemeSetting[]; - } - export interface Thenable extends PromiseLike { - } - /** - * A registry helper that can locate grammar file paths given scope names. - */ - export interface RegistryOptions { - theme?: IRawTheme; - loadGrammar(scopeName: string): Thenable; - getInjections?(scopeName: string): string[]; - getOnigLib?(): Thenable; - } - /** - * A map from scope name to a language id. Please do not use language id 0. - */ - export interface IEmbeddedLanguagesMap { - [scopeName: string]: number; - } - /** - * A map from selectors to token types. - */ - export interface ITokenTypeMap { - [selector: string]: StandardTokenType; - } - export const enum StandardTokenType { - Other = 0, - Comment = 1, - String = 2, - RegEx = 4, - } - export interface IGrammarConfiguration { - embeddedLanguages?: IEmbeddedLanguagesMap; - tokenTypes?: ITokenTypeMap; - } - /** - * The registry that will hold all grammars. - */ - export class Registry { - private readonly _locator; - private readonly _syncRegistry; - constructor(locator?: RegistryOptions); - /** - * Change the theme. Once called, no previous `ruleStack` should be used anymore. - */ - setTheme(theme: IRawTheme): void; - /** - * Returns a lookup array for color ids. - */ - getColorMap(): string[]; - /** - * Load the grammar for `scopeName` and all referenced included grammars asynchronously. - * Please do not use language id 0. - */ - loadGrammarWithEmbeddedLanguages(initialScopeName: string, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap): Thenable; - /** - * Load the grammar for `scopeName` and all referenced included grammars asynchronously. - * Please do not use language id 0. - */ - loadGrammarWithConfiguration(initialScopeName: string, initialLanguage: number, configuration: IGrammarConfiguration): Thenable; - /** - * Load the grammar for `scopeName` and all referenced included grammars asynchronously. - */ - loadGrammar(initialScopeName: string): Thenable; - private _loadGrammar; - /** - * Adds a rawGrammar. - */ - addGrammar(rawGrammar: IRawGrammar, injections?: string[], initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap): Thenable; - /** - * Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`. - */ - grammarForScopeName(scopeName: string, initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap, tokenTypes?: ITokenTypeMap): Thenable; - } - /** - * A grammar - */ - export interface IGrammar { - /** - * Tokenize `lineText` using previous line state `prevState`. - */ - tokenizeLine(lineText: string, prevState: StackElement | null): ITokenizeLineResult; - /** - * Tokenize `lineText` using previous line state `prevState`. - * The result contains the tokens in binary format, resolved with the following information: - * - language - * - token type (regex, string, comment, other) - * - font style - * - foreground color - * - background color - * e.g. for getting the languageId: `(metadata & MetadataConsts.LANGUAGEID_MASK) >>> MetadataConsts.LANGUAGEID_OFFSET` - */ - tokenizeLine2(lineText: string, prevState: StackElement | null): ITokenizeLineResult2; - } - export interface ITokenizeLineResult { - readonly tokens: IToken[]; - /** - * The `prevState` to be passed on to the next line tokenization. - */ - readonly ruleStack: StackElement; - } - /** - * Helpers to manage the "collapsed" metadata of an entire StackElement stack. - * The following assumptions have been made: - * - languageId < 256 => needs 8 bits - * - unique color count < 512 => needs 9 bits - * - * The binary format is: - * - ------------------------------------------- - * 3322 2222 2222 1111 1111 1100 0000 0000 - * 1098 7654 3210 9876 5432 1098 7654 3210 - * - ------------------------------------------- - * xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - * bbbb bbbb bfff ffff ffFF FTTT LLLL LLLL - * - ------------------------------------------- - * - L = LanguageId (8 bits) - * - T = StandardTokenType (3 bits) - * - F = FontStyle (3 bits) - * - f = foreground color (9 bits) - * - b = background color (9 bits) - */ - export const enum MetadataConsts { - LANGUAGEID_MASK = 255, - TOKEN_TYPE_MASK = 1792, - FONT_STYLE_MASK = 14336, - FOREGROUND_MASK = 8372224, - BACKGROUND_MASK = 4286578688, - LANGUAGEID_OFFSET = 0, - TOKEN_TYPE_OFFSET = 8, - FONT_STYLE_OFFSET = 11, - FOREGROUND_OFFSET = 14, - BACKGROUND_OFFSET = 23, - } - export interface ITokenizeLineResult2 { - /** - * The tokens in binary format. Each token occupies two array indices. For token i: - * - at offset 2*i => startIndex - * - at offset 2*i + 1 => metadata - * - */ - readonly tokens: Uint32Array; - /** - * The `prevState` to be passed on to the next line tokenization. - */ - readonly ruleStack: StackElement; - } - export interface IToken { - startIndex: number; - readonly endIndex: number; - readonly scopes: string[]; - } - /** - * **IMPORTANT** - Immutable! - */ - export interface StackElement { - _stackElementBrand: void; - readonly depth: number; - clone(): StackElement; - equals(other: StackElement): boolean; - } - export const INITIAL: StackElement; - export const parseRawGrammar: (content: string, filePath?: string) => IRawGrammar; - export interface ILocation { - readonly filename: string; - readonly line: number; - readonly char: number; - } - export interface ILocatable { - readonly $vscodeTextmateLocation?: ILocation; - } - export interface IRawGrammar extends ILocatable { - repository: IRawRepository; - readonly scopeName: string; - readonly patterns: IRawRule[]; - readonly injections?: { - [expression: string]: IRawRule; - }; - readonly injectionSelector?: string; - readonly fileTypes?: string[]; - readonly name?: string; - readonly firstLineMatch?: string; - } - export interface IRawRepositoryMap { - [name: string]: IRawRule; - $self: IRawRule; - $base: IRawRule; - } - export type IRawRepository = IRawRepositoryMap & ILocatable; - export interface IRawRule extends ILocatable { - id?: number; - readonly include?: string; - readonly name?: string; - readonly contentName?: string; - readonly match?: string; - readonly captures?: IRawCaptures; - readonly begin?: string; - readonly beginCaptures?: IRawCaptures; - readonly end?: string; - readonly endCaptures?: IRawCaptures; - readonly while?: string; - readonly whileCaptures?: IRawCaptures; - readonly patterns?: IRawRule[]; - readonly repository?: IRawRepository; - readonly applyEndPatternLast?: boolean; - } - export interface IRawCapturesMap { - [captureId: string]: IRawRule; - } - export type IRawCaptures = IRawCapturesMap & ILocatable; - export interface IOnigLib { - createOnigScanner(sources: string[]): OnigScanner; - createOnigString(sources: string): OnigString; - } - export interface IOnigCaptureIndex { - start: number; - end: number; - length: number; - } - export interface IOnigMatch { - index: number; - captureIndices: IOnigCaptureIndex[]; - scanner: OnigScanner; - } - export interface OnigScanner { - findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch; - } - export interface OnigString { - readonly content: string; - readonly dispose?: () => void; - } - - -} diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index c7570602cdf87..715019d30486d 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -120,6 +120,6 @@ export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0); export const isChrome = (userAgent.indexOf('Chrome') >= 0); export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0)); export const isWebkitWebView = (!isChrome && !isSafari && isWebKit); -export const isIPad = (userAgent.indexOf('iPad') >= 0); +export const isIPad = (userAgent.indexOf('iPad') >= 0 || (isSafari && navigator.maxTouchPoints > 0)); export const isEdgeWebView = isEdge && (userAgent.indexOf('WebView/') >= 0); export const isStandalone = (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches); diff --git a/src/vs/base/browser/canIUse.ts b/src/vs/base/browser/canIUse.ts index 061d1bfc74fb3..cf8211e919eb3 100644 --- a/src/vs/base/browser/canIUse.ts +++ b/src/vs/base/browser/canIUse.ts @@ -19,7 +19,7 @@ export const BrowserFeatures = { clipboard: { writeText: ( platform.isNative - || document.queryCommandSupported('copy') + || (document.queryCommandSupported && document.queryCommandSupported('copy')) || !!(navigator && navigator.clipboard && navigator.clipboard.writeText) ), readText: ( @@ -55,5 +55,6 @@ export const BrowserFeatures = { return KeyboardSupport.None; })(), - touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0 + touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0, + pointerEvents: window.PointerEvent && ('ontouchstart' in window || window.navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0) }; diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index db901ed9e5e09..69f1d93b2b72a 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -16,6 +16,7 @@ import * as platform from 'vs/base/common/platform'; import { coalesce } from 'vs/base/common/arrays'; import { URI } from 'vs/base/common/uri'; import { Schemas, RemoteAuthorities } from 'vs/base/common/network'; +import { BrowserFeatures } from 'vs/base/browser/canIUse'; export function clearNode(node: HTMLElement): void { while (node.firstChild) { @@ -231,9 +232,9 @@ class DomListener implements IDisposable { export function addDisposableListener(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable; export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture: AddEventListenerOptions): IDisposable; -export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean | AddEventListenerOptions): IDisposable { - return new DomListener(node, type, handler, useCapture); +export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable; +export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable { + return new DomListener(node, type, handler, useCaptureOrOptions); } export interface IAddStandardDisposableListenerSignature { @@ -266,10 +267,42 @@ export let addStandardDisposableListener: IAddStandardDisposableListenerSignatur return addDisposableListener(node, type, wrapHandler, useCapture); }; +export let addStandardDisposableGenericMouseDownListner = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable { + let wrapHandler = _wrapAsStandardMouseEvent(handler); + + return addDisposableGenericMouseDownListner(node, wrapHandler, useCapture); +}; + +export function addDisposableGenericMouseDownListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable { + return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture); +} + +export function addDisposableGenericMouseMoveListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable { + return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture); +} + +export function addDisposableGenericMouseUpListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable { + return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture); +} export function addDisposableNonBubblingMouseOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable { return addDisposableListener(node, 'mouseout', (e: MouseEvent) => { // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements - let toElement: Node | null = (e.relatedTarget || e.target); + let toElement: Node | null = (e.relatedTarget); + while (toElement && toElement !== node) { + toElement = toElement.parentNode; + } + if (toElement === node) { + return; + } + + handler(e); + }); +} + +export function addDisposableNonBubblingPointerOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable { + return addDisposableListener(node, 'pointerout', (e: MouseEvent) => { + // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements + let toElement: Node | null = (e.relatedTarget); while (toElement && toElement !== node) { toElement = toElement.parentNode; } @@ -428,7 +461,7 @@ export interface DOMEvent { } const MINIMUM_TIME_MS = 16; -const DEFAULT_EVENT_MERGER: IEventMerger = function (lastEvent: DOMEvent, currentEvent: DOMEvent) { +const DEFAULT_EVENT_MERGER: IEventMerger = function (lastEvent: DOMEvent | null, currentEvent: DOMEvent) { return currentEvent; }; @@ -477,6 +510,20 @@ export function getClientArea(element: HTMLElement): Dimension { return new Dimension(element.clientWidth, element.clientHeight); } + // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight + if (platform.isIOS && (window).visualViewport) { + const width = (window).visualViewport.width; + const height = (window).visualViewport.height - ( + browser.isStandalone + // in PWA mode, the visual viewport always includes the safe-area-inset-bottom (which is for the home indicator) + // even when you are using the onscreen monitor, the visual viewport will include the area between system statusbar and the onscreen keyboard + // plus the area between onscreen keyboard and the bottom bezel, which is 20px on iOS. + ? (20 + 4) // + 4px for body margin + : 0 + ); + return new Dimension(width, height); + } + // Try innerWidth / innerHeight if (window.innerWidth && window.innerHeight) { return new Dimension(window.innerWidth, window.innerHeight); @@ -581,11 +628,17 @@ export function getTopLeftOffset(element: HTMLElement): { left: number; top: num // Adapted from WinJS.Utilities.getPosition // and added borders to the mix - let offsetParent = element.offsetParent, top = element.offsetTop, left = element.offsetLeft; + let offsetParent = element.offsetParent; + let top = element.offsetTop; + let left = element.offsetLeft; - while ((element = element.parentNode) !== null && element !== document.body && element !== document.documentElement) { + while ( + (element = element.parentNode) !== null + && element !== document.body + && element !== document.documentElement + ) { top -= element.scrollTop; - let c = getComputedStyle(element); + const c = isShadowRoot(element) ? null : getComputedStyle(element); if (c) { left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft; } @@ -746,7 +799,7 @@ export function isAncestor(testChild: Node | null, testAncestor: Node | null): b } export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null { - while (node) { + while (node && node.nodeType === node.ELEMENT_NODE) { if (hasClass(node, clazz)) { return node; } @@ -773,6 +826,27 @@ export function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazz return !!findParentWithClass(node, clazz, stopAtClazzOrNode); } +export function isShadowRoot(node: Node): node is ShadowRoot { + return ( + node && !!(node).host && !!(node).mode + ); +} + +export function isInShadowDOM(domNode: Node): boolean { + return !!getShadowRoot(domNode); +} + +export function getShadowRoot(domNode: Node): ShadowRoot | null { + while (domNode.parentNode) { + if (domNode === document.body) { + // reached the body + return null; + } + domNode = domNode.parentNode; + } + return isShadowRoot(domNode) ? domNode : null; +} + export function createStyleSheet(container: HTMLElement = document.getElementsByTagName('head')[0]): HTMLStyleElement { let style = document.createElement('style'); style.type = 'text/css'; @@ -852,6 +926,9 @@ export const EventType = { MOUSE_OUT: 'mouseout', MOUSE_ENTER: 'mouseenter', MOUSE_LEAVE: 'mouseleave', + POINTER_UP: 'pointerup', + POINTER_DOWN: 'pointerdown', + POINTER_MOVE: 'pointermove', CONTEXT_MENU: 'contextmenu', WHEEL: 'wheel', // Keyboard @@ -922,6 +999,7 @@ export const EventHelper = { export interface IFocusTracker extends Disposable { onDidFocus: Event; onDidBlur: Event; + refreshState?(): void; } export function saveParentsScrollTop(node: Element): number[] { @@ -950,6 +1028,8 @@ class FocusTracker extends Disposable implements IFocusTracker { private readonly _onDidBlur = this._register(new Emitter()); public readonly onDidBlur: Event = this._onDidBlur.event; + private _refreshStateHandler: () => void; + constructor(element: HTMLElement | Window) { super(); let hasFocus = isAncestor(document.activeElement, element); @@ -976,9 +1056,24 @@ class FocusTracker extends Disposable implements IFocusTracker { } }; + this._refreshStateHandler = () => { + let currentNodeHasFocus = isAncestor(document.activeElement, element); + if (currentNodeHasFocus !== hasFocus) { + if (hasFocus) { + onBlur(); + } else { + onFocus(); + } + } + }; + this._register(domEvent(element, EventType.FOCUS, true)(onFocus)); this._register(domEvent(element, EventType.BLUR, true)(onBlur)); } + + refreshState() { + this._refreshStateHandler(); + } } export function trackFocus(element: HTMLElement | Window): IFocusTracker { @@ -1029,6 +1124,11 @@ function _$(namespace: Namespace, description: string, attrs? Object.keys(attrs).forEach(name => { const value = attrs![name]; + + if (typeof value === 'undefined') { + return; + } + if (/^on\w+$/.test(name)) { (result)[name] = value; } else if (name === 'selected') { @@ -1094,7 +1194,7 @@ export function hide(...elements: HTMLElement[]): void { } function findParentWithAttribute(node: Node | null, attribute: string): HTMLElement | null { - while (node) { + while (node && node.nodeType === node.ELEMENT_NODE) { if (node instanceof HTMLElement && node.hasAttribute(attribute)) { return node; } @@ -1213,7 +1313,22 @@ export function asCSSUrl(uri: URI): string { return `url('${asDomUri(uri).toString(true).replace(/'/g, '%27')}')`; } -export function triggerDownload(uri: URI, name: string): void { + +export function triggerDownload(dataOrUri: Uint8Array | URI, name: string): void { + + // If the data is provided as Buffer, we create a + // blog URL out of it to produce a valid link + let url: string; + if (URI.isUri(dataOrUri)) { + url = dataOrUri.toString(true); + } else { + const blob = new Blob([dataOrUri]); + url = URL.createObjectURL(blob); + + // Ensure to free the data from DOM eventually + setTimeout(() => URL.revokeObjectURL(url)); + } + // In order to download from the browser, the only way seems // to be creating a element with download attribute that // points to the file to download. @@ -1221,7 +1336,7 @@ export function triggerDownload(uri: URI, name: string): void { const anchor = document.createElement('a'); document.body.appendChild(anchor); anchor.download = name; - anchor.href = uri.toString(true); + anchor.href = url; anchor.click(); // Ensure to remove the element from DOM eventually diff --git a/src/vs/base/browser/fastDomNode.ts b/src/vs/base/browser/fastDomNode.ts index 180eacdbd0ff8..28ce15064f98a 100644 --- a/src/vs/base/browser/fastDomNode.ts +++ b/src/vs/base/browser/fastDomNode.ts @@ -25,8 +25,10 @@ export class FastDomNode { private _display: string; private _position: string; private _visibility: string; + private _backgroundColor: string; private _layerHint: boolean; private _contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'; + private _boxShadow: string; constructor(domNode: T) { this.domNode = domNode; @@ -47,8 +49,10 @@ export class FastDomNode { this._display = ''; this._position = ''; this._visibility = ''; + this._backgroundColor = ''; this._layerHint = false; this._contain = 'none'; + this._boxShadow = ''; } public setMaxWidth(maxWidth: number): void { @@ -200,12 +204,28 @@ export class FastDomNode { this.domNode.style.visibility = this._visibility; } + public setBackgroundColor(backgroundColor: string): void { + if (this._backgroundColor === backgroundColor) { + return; + } + this._backgroundColor = backgroundColor; + this.domNode.style.backgroundColor = this._backgroundColor; + } + public setLayerHinting(layerHint: boolean): void { if (this._layerHint === layerHint) { return; } this._layerHint = layerHint; - (this.domNode.style).willChange = this._layerHint ? 'transform' : 'auto'; + this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : ''; + } + + public setBoxShadow(boxShadow: string): void { + if (this._boxShadow === boxShadow) { + return; + } + this._boxShadow = boxShadow; + this.domNode.style.boxShadow = boxShadow; } public setContain(contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'): void { diff --git a/src/vs/base/browser/globalMouseMoveMonitor.ts b/src/vs/base/browser/globalMouseMoveMonitor.ts index 109f6f722604e..8fddd54b7b3e7 100644 --- a/src/vs/base/browser/globalMouseMoveMonitor.ts +++ b/src/vs/base/browser/globalMouseMoveMonitor.ts @@ -4,18 +4,22 @@ *--------------------------------------------------------------------------------------------*/ import * as dom from 'vs/base/browser/dom'; +import * as platform from 'vs/base/common/platform'; +import * as browser from 'vs/base/browser/browser'; import { IframeUtils } from 'vs/base/browser/iframe'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { BrowserFeatures } from 'vs/base/browser/canIUse'; export interface IStandardMouseMoveEventData { leftButton: boolean; + buttons: number; posx: number; posy: number; } export interface IEventMerger { - (lastEvent: R, currentEvent: MouseEvent): R; + (lastEvent: R | null, currentEvent: MouseEvent): R; } export interface IMouseMoveCallback { @@ -26,26 +30,27 @@ export interface IOnStopCallback { (): void; } -export function standardMouseMoveMerger(lastEvent: IStandardMouseMoveEventData, currentEvent: MouseEvent): IStandardMouseMoveEventData { +export function standardMouseMoveMerger(lastEvent: IStandardMouseMoveEventData | null, currentEvent: MouseEvent): IStandardMouseMoveEventData { let ev = new StandardMouseEvent(currentEvent); ev.preventDefault(); return { leftButton: ev.leftButton, + buttons: ev.buttons, posx: ev.posx, posy: ev.posy }; } -export class GlobalMouseMoveMonitor implements IDisposable { +export class GlobalMouseMoveMonitor implements IDisposable { - private readonly hooks = new DisposableStore(); - private mouseMoveEventMerger: IEventMerger | null = null; - private mouseMoveCallback: IMouseMoveCallback | null = null; - private onStopCallback: IOnStopCallback | null = null; + private readonly _hooks = new DisposableStore(); + private _mouseMoveEventMerger: IEventMerger | null = null; + private _mouseMoveCallback: IMouseMoveCallback | null = null; + private _onStopCallback: IOnStopCallback | null = null; public dispose(): void { this.stopMonitoring(false); - this.hooks.dispose(); + this._hooks.dispose(); } public stopMonitoring(invokeStopCallback: boolean): void { @@ -55,11 +60,11 @@ export class GlobalMouseMoveMonitor implements IDisposable { } // Unhook - this.hooks.clear(); - this.mouseMoveEventMerger = null; - this.mouseMoveCallback = null; - const onStopCallback = this.onStopCallback; - this.onStopCallback = null; + this._hooks.clear(); + this._mouseMoveEventMerger = null; + this._mouseMoveCallback = null; + const onStopCallback = this._onStopCallback; + this._onStopCallback = null; if (invokeStopCallback && onStopCallback) { onStopCallback(); @@ -67,10 +72,12 @@ export class GlobalMouseMoveMonitor implements IDisposable { } public isMonitoring(): boolean { - return !!this.mouseMoveEventMerger; + return !!this._mouseMoveEventMerger; } public startMonitoring( + initialElement: HTMLElement, + initialButtons: number, mouseMoveEventMerger: IEventMerger, mouseMoveCallback: IMouseMoveCallback, onStopCallback: IOnStopCallback @@ -79,38 +86,54 @@ export class GlobalMouseMoveMonitor implements IDisposable { // I am already hooked return; } - this.mouseMoveEventMerger = mouseMoveEventMerger; - this.mouseMoveCallback = mouseMoveCallback; - this.onStopCallback = onStopCallback; - - let windowChain = IframeUtils.getSameOriginWindowChain(); - for (const element of windowChain) { - this.hooks.add(dom.addDisposableThrottledListener(element.window.document, 'mousemove', - (data: R) => this.mouseMoveCallback!(data), - (lastEvent: R, currentEvent) => this.mouseMoveEventMerger!(lastEvent, currentEvent as MouseEvent) + this._mouseMoveEventMerger = mouseMoveEventMerger; + this._mouseMoveCallback = mouseMoveCallback; + this._onStopCallback = onStopCallback; + + const windowChain = IframeUtils.getSameOriginWindowChain(); + const mouseMove = platform.isIOS && BrowserFeatures.pointerEvents ? 'pointermove' : 'mousemove'; + const mouseUp = platform.isIOS && BrowserFeatures.pointerEvents ? 'pointerup' : 'mouseup'; + + const listenTo: (Document | ShadowRoot)[] = windowChain.map(element => element.window.document); + const shadowRoot = dom.getShadowRoot(initialElement); + if (shadowRoot) { + listenTo.unshift(shadowRoot); + } + + for (const element of listenTo) { + this._hooks.add(dom.addDisposableThrottledListener(element, mouseMove, + (data: R) => { + if (!browser.isIE && data.buttons !== initialButtons) { + // Buttons state has changed in the meantime + this.stopMonitoring(true); + return; + } + this._mouseMoveCallback!(data); + }, + (lastEvent: R | null, currentEvent) => this._mouseMoveEventMerger!(lastEvent, currentEvent as MouseEvent) )); - this.hooks.add(dom.addDisposableListener(element.window.document, 'mouseup', (e: MouseEvent) => this.stopMonitoring(true))); + this._hooks.add(dom.addDisposableListener(element, mouseUp, (e: MouseEvent) => this.stopMonitoring(true))); } if (IframeUtils.hasDifferentOriginAncestor()) { let lastSameOriginAncestor = windowChain[windowChain.length - 1]; // We might miss a mouse up if it happens outside the iframe // This one is for Chrome - this.hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseout', (browserEvent: MouseEvent) => { + this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseout', (browserEvent: MouseEvent) => { let e = new StandardMouseEvent(browserEvent); if (e.target.tagName.toLowerCase() === 'html') { this.stopMonitoring(true); } })); // This one is for FF - this.hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseover', (browserEvent: MouseEvent) => { + this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseover', (browserEvent: MouseEvent) => { let e = new StandardMouseEvent(browserEvent); if (e.target.tagName.toLowerCase() === 'html') { this.stopMonitoring(true); } })); // This one is for IE - this.hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document.body, 'mouseleave', (browserEvent: MouseEvent) => { + this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document.body, 'mouseleave', (browserEvent: MouseEvent) => { this.stopMonitoring(true); })); } diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index 57144d67ea618..64213751cdfb1 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -15,6 +15,7 @@ import { cloneAndChange } from 'vs/base/common/objects'; import { escape } from 'vs/base/common/strings'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; +import { renderCodicons, markdownEscapeEscapedCodicons } from 'vs/base/common/codicons'; export interface MarkdownRenderOptions extends FormattedTextRenderOptions { codeBlockRenderer?: (modeId: string, value: string) => Promise; @@ -24,7 +25,7 @@ export interface MarkdownRenderOptions extends FormattedTextRenderOptions { /** * Create html nodes for the given content element. */ -export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRenderOptions = {}): HTMLElement { +export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRenderOptions = {}, markedOptions: marked.MarkedOptions = {}): HTMLElement { const element = createElement(options); const _uriMassage = function (part: string): string { @@ -50,19 +51,19 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende const _href = function (href: string, isDomUri: boolean): string { const data = markdown.uris && markdown.uris[href]; if (!data) { - return href; + return href; // no uri exists } let uri = URI.revive(data); + if (URI.parse(href).toString() === uri.toString()) { + return href; // no tranformation performed + } if (isDomUri) { uri = DOM.asDomUri(uri); } if (uri.query) { uri = uri.with({ query: _uriMassage(uri.query) }); } - if (data) { - href = uri.toString(true); - } - return href; + return uri.toString(true); }; // signal to code-block render that the @@ -118,7 +119,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende } }; renderer.paragraph = (text): string => { - return `

${text}

`; + return `

${markdown.supportThemeIcons ? renderCodicons(text) : text}

`; }; if (options.codeBlockRenderer) { @@ -168,24 +169,29 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende })); } - const markedOptions: marked.MarkedOptions = { - sanitize: true, - renderer - }; + markedOptions.sanitize = true; + markedOptions.renderer = renderer; - const allowedSchemes = [Schemas.http, Schemas.https, Schemas.mailto, Schemas.data, Schemas.file, Schemas.vscodeRemote]; + const allowedSchemes = [Schemas.http, Schemas.https, Schemas.mailto, Schemas.data, Schemas.file, Schemas.vscodeRemote, Schemas.vscodeRemoteResource]; if (markdown.isTrusted) { allowedSchemes.push(Schemas.command); } - const renderedMarkdown = marked.parse(markdown.value, markedOptions); + const renderedMarkdown = marked.parse( + markdown.supportThemeIcons + ? markdownEscapeEscapedCodicons(markdown.value) + : markdown.value, + markedOptions + ); + element.innerHTML = insane(renderedMarkdown, { allowedSchemes, allowedAttributes: { 'a': ['href', 'name', 'target', 'data-href'], 'iframe': ['allowfullscreen', 'frameborder', 'src'], 'img': ['src', 'title', 'alt', 'width', 'height'], - 'div': ['class', 'data-code'] + 'div': ['class', 'data-code'], + 'span': ['class'] } }); diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts index f3f2089100bcf..25e73b113d6a4 100644 --- a/src/vs/base/browser/mouseEvent.ts +++ b/src/vs/base/browser/mouseEvent.ts @@ -12,6 +12,7 @@ export interface IMouseEvent { readonly leftButton: boolean; readonly middleButton: boolean; readonly rightButton: boolean; + readonly buttons: number; readonly target: HTMLElement; readonly detail: number; readonly posx: number; @@ -33,6 +34,7 @@ export class StandardMouseEvent implements IMouseEvent { public readonly leftButton: boolean; public readonly middleButton: boolean; public readonly rightButton: boolean; + public readonly buttons: number; public readonly target: HTMLElement; public detail: number; public readonly posx: number; @@ -49,6 +51,7 @@ export class StandardMouseEvent implements IMouseEvent { this.leftButton = e.button === 0; this.middleButton = e.button === 1; this.rightButton = e.button === 2; + this.buttons = e.buttons; this.target = e.target; diff --git a/src/vs/base/browser/touch.ts b/src/vs/base/browser/touch.ts index bef90a94d4d07..9956bc9112b10 100644 --- a/src/vs/base/browser/touch.ts +++ b/src/vs/base/browser/touch.ts @@ -33,6 +33,7 @@ export interface GestureEvent extends MouseEvent { translationY: number; pageX: number; pageY: number; + tapCount: number; } interface Touch { @@ -71,16 +72,24 @@ export class Gesture extends Disposable { private dispatched = false; private targets: HTMLElement[]; + private ignoreTargets: HTMLElement[]; private handle: IDisposable | null; private activeTouches: { [id: number]: TouchData; }; + private _lastSetTapCountTime: number; + + private static readonly CLEAR_TAP_COUNT_TIME = 400; // ms + + private constructor() { super(); this.activeTouches = {}; this.handle = null; this.targets = []; + this.ignoreTargets = []; + this._lastSetTapCountTime = 0; this._register(DomUtils.addDisposableListener(document, 'touchstart', (e: TouchEvent) => this.onTouchStart(e))); this._register(DomUtils.addDisposableListener(document, 'touchend', (e: TouchEvent) => this.onTouchEnd(e))); this._register(DomUtils.addDisposableListener(document, 'touchmove', (e: TouchEvent) => this.onTouchMove(e))); @@ -103,6 +112,23 @@ export class Gesture extends Disposable { }; } + public static ignoreTarget(element: HTMLElement): IDisposable { + if (!Gesture.isTouchDevice()) { + return Disposable.None; + } + if (!Gesture.INSTANCE) { + Gesture.INSTANCE = new Gesture(); + } + + Gesture.INSTANCE.ignoreTargets.push(element); + + return { + dispose: () => { + Gesture.INSTANCE.ignoreTargets = Gesture.INSTANCE.ignoreTargets.filter(t => t !== element); + } + }; + } + @memoize private static isTouchDevice(): boolean { return 'ontouchstart' in window as any || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0; @@ -224,10 +250,33 @@ export class Gesture extends Disposable { let event = (document.createEvent('CustomEvent')); event.initEvent(type, false, true); event.initialTarget = initialTarget; + event.tapCount = 0; return event; } private dispatchEvent(event: GestureEvent): void { + if (event.type === EventType.Tap) { + const currentTime = (new Date()).getTime(); + let setTapCount = 0; + if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) { + setTapCount = 1; + } else { + setTapCount = 2; + } + + this._lastSetTapCountTime = currentTime; + event.tapCount = setTapCount; + } else if (event.type === EventType.Change || event.type === EventType.Contextmenu) { + // tap is canceled by scrolling or context menu + this._lastSetTapCountTime = 0; + } + + for (let i = 0; i < this.ignoreTargets.length; i++) { + if (event.initialTarget instanceof Node && this.ignoreTargets[i].contains(event.initialTarget)) { + return; + } + } + this.targets.forEach(target => { if (event.initialTarget instanceof Node && target.contains(event.initialTarget)) { target.dispatchEvent(event); diff --git a/src/vs/base/browser/ui/button/button.ts b/src/vs/base/browser/ui/button/button.ts index de4d35ef320eb..9f75328eca8a8 100644 --- a/src/vs/base/browser/ui/button/button.ts +++ b/src/vs/base/browser/ui/button/button.ts @@ -14,7 +14,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { Gesture, EventType } from 'vs/base/browser/touch'; export interface IButtonOptions extends IButtonStyles { - title?: boolean; + title?: boolean | string; } export interface IButtonStyles { @@ -129,7 +129,7 @@ export class Button extends Disposable { private applyStyles(): void { if (this._element) { const background = this.buttonBackground ? this.buttonBackground.toString() : ''; - const foreground = this.buttonForeground ? this.buttonForeground.toString() : null; + const foreground = this.buttonForeground ? this.buttonForeground.toString() : ''; const border = this.buttonBorder ? this.buttonBorder.toString() : ''; this._element.style.color = foreground; @@ -150,7 +150,9 @@ export class Button extends Disposable { DOM.addClass(this._element, 'monaco-text-button'); } this._element.textContent = value; - if (this.options.title) { + if (typeof this.options.title === 'string') { + this._element.title = this.options.title; + } else if (this.options.title) { this._element.title = value; } } diff --git a/src/vs/base/browser/ui/centered/centeredViewLayout.ts b/src/vs/base/browser/ui/centered/centeredViewLayout.ts index 43f665fbd006e..52cc64b8a369d 100644 --- a/src/vs/base/browser/ui/centered/centeredViewLayout.ts +++ b/src/vs/base/browser/ui/centered/centeredViewLayout.ts @@ -9,6 +9,7 @@ import { Event } from 'vs/base/common/event'; import { IView, IViewSize } from 'vs/base/browser/ui/grid/grid'; import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Color } from 'vs/base/common/color'; +import { IBoundarySashes } from 'vs/base/browser/ui/grid/gridview'; export interface CenteredViewState { leftMarginRatio: number; @@ -42,7 +43,7 @@ function toSplitViewView(view: IView, getHeight: () => number): ISplitViewView { get maximumSize() { return view.maximumWidth; }, get minimumSize() { return view.minimumWidth; }, onDidChange: Event.map(view.onDidChange, e => e && e.width), - layout: size => view.layout(size, getHeight(), Orientation.HORIZONTAL) + layout: (size, offset) => view.layout(size, getHeight(), 0, offset) }; } @@ -72,6 +73,19 @@ export class CenteredViewLayout implements IDisposable { get maximumHeight(): number { return this.view.maximumHeight; } get onDidChange(): Event { return this.view.onDidChange; } + private _boundarySashes: IBoundarySashes = {}; + get boundarySashes(): IBoundarySashes { return this._boundarySashes; } + set boundarySashes(boundarySashes: IBoundarySashes) { + this._boundarySashes = boundarySashes; + + if (!this.splitView) { + return; + } + + this.splitView.orthogonalStartSash = boundarySashes.top; + this.splitView.orthogonalEndSash = boundarySashes.bottom; + } + layout(width: number, height: number): void { this.width = width; this.height = height; @@ -81,7 +95,7 @@ export class CenteredViewLayout implements IDisposable { this.resizeMargins(); } } else { - this.view.layout(width, height, Orientation.HORIZONTAL); + this.view.layout(width, height, 0, 0); } this.didLayout = true; } @@ -119,6 +133,8 @@ export class CenteredViewLayout implements IDisposable { orientation: Orientation.HORIZONTAL, styles: this.style }); + this.splitView.orthogonalStartSash = this.boundarySashes.top; + this.splitView.orthogonalEndSash = this.boundarySashes.bottom; this.splitViewDisposables.add(this.splitView.onDidSashChange(() => { if (this.splitView) { diff --git a/src/vs/base/browser/ui/checkbox/check-dark.svg b/src/vs/base/browser/ui/checkbox/check-dark.svg deleted file mode 100644 index 865cc83c347af..0000000000000 --- a/src/vs/base/browser/ui/checkbox/check-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/checkbox/check-light.svg b/src/vs/base/browser/ui/checkbox/check-light.svg deleted file mode 100644 index e1a546660ed15..0000000000000 --- a/src/vs/base/browser/ui/checkbox/check-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/checkbox/checkbox.css b/src/vs/base/browser/ui/checkbox/checkbox.css index fa9aa082d3991..972e94f7175c6 100644 --- a/src/vs/base/browser/ui/checkbox/checkbox.css +++ b/src/vs/base/browser/ui/checkbox/checkbox.css @@ -44,10 +44,7 @@ background-size: 16px !important; } -.monaco-custom-checkbox.monaco-simple-checkbox.checked { - background: url('check-light.svg') center center no-repeat; -} - -.monaco-custom-checkbox.monaco-simple-checkbox.checked { - background: url('check-dark.svg') center center no-repeat; +/* hide check when unchecked */ +.monaco-custom-checkbox.monaco-simple-checkbox.unchecked:not(.checked)::before { + visibility: hidden;; } diff --git a/src/vs/base/browser/ui/checkbox/checkbox.ts b/src/vs/base/browser/ui/checkbox/checkbox.ts index afc9cc616a0a8..372119cfa1919 100644 --- a/src/vs/base/browser/ui/checkbox/checkbox.ts +++ b/src/vs/base/browser/ui/checkbox/checkbox.ts @@ -113,6 +113,8 @@ export class Checkbox extends Widget { ev.preventDefault(); }); + this.ignoreGesture(this.domNode); + this.onkeydown(this.domNode, (keyboardEvent) => { if (keyboardEvent.keyCode === KeyCode.Space || keyboardEvent.keyCode === KeyCode.Enter) { this.checked = !this._checked; @@ -190,7 +192,7 @@ export class SimpleCheckbox extends Widget { constructor(private title: string, private isChecked: boolean) { super(); - this.checkbox = new Checkbox({ title: this.title, isChecked: this.isChecked, actionClassName: 'monaco-simple-checkbox' }); + this.checkbox = new Checkbox({ title: this.title, isChecked: this.isChecked, actionClassName: 'monaco-simple-checkbox codicon-check' }); this.domNode = this.checkbox.domNode; @@ -218,7 +220,7 @@ export class SimpleCheckbox extends Widget { } protected applyStyles(): void { - this.domNode.style.color = this.styles.checkboxForeground ? this.styles.checkboxForeground.toString() : null; + this.domNode.style.color = this.styles.checkboxForeground ? this.styles.checkboxForeground.toString() : ''; this.domNode.style.backgroundColor = this.styles.checkboxBackground ? this.styles.checkboxBackground.toString() : ''; this.domNode.style.borderColor = this.styles.checkboxBorder ? this.styles.checkboxBorder.toString() : ''; } diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css index 753d70792994e..41efce5c63d20 100644 --- a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css +++ b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css @@ -5,7 +5,7 @@ @font-face { font-family: "codicon"; - src: url("./codicon.ttf?3443fb4013ab5a04c23a30f912dd6627") format("truetype"); + src: url("./codicon.ttf?279add2ec8b3d516ca20a123230cbf9f") format("truetype"); } .codicon[class*='codicon-'] { @@ -69,6 +69,10 @@ .codicon-eye-watch:before { content: "\ea70" } .codicon-circle-filled:before { content: "\ea71" } .codicon-primitive-dot:before { content: "\ea71" } +.codicon-close-dirty:before { content: "\ea71" } +.codicon-debug-breakpoint:before { content: "\ea71" } +.codicon-debug-breakpoint-disabled:before { content: "\ea71" } +.codicon-debug-hint:before { content: "\ea71" } .codicon-primitive-square:before { content: "\ea72" } .codicon-edit:before { content: "\ea73" } .codicon-pencil:before { content: "\ea73" } @@ -115,6 +119,7 @@ .codicon-github:before { content: "\ea84" } .codicon-terminal:before { content: "\ea85" } .codicon-console:before { content: "\ea85" } +.codicon-repl:before { content: "\ea85" } .codicon-zap:before { content: "\ea86" } .codicon-symbol-event:before { content: "\ea86" } .codicon-error:before { content: "\ea87" } @@ -139,7 +144,6 @@ .codicon-symbol-parameter:before { content: "\ea92" } .codicon-symbol-type-parameter:before { content: "\ea92" } .codicon-symbol-key:before { content: "\ea93" } -.codicon-symbol-string:before { content: "\ea93" } .codicon-symbol-text:before { content: "\ea93" } .codicon-symbol-reference:before { content: "\ea94" } .codicon-go-to-file:before { content: "\ea94" } @@ -162,12 +166,15 @@ .codicon-bold:before { content: "\eaa3" } .codicon-book:before { content: "\eaa4" } .codicon-bookmark:before { content: "\eaa5" } -.codicon-breakpoint-conditional-unverified:before { content: "\eaa6" } -.codicon-breakpoint-conditional:before { content: "\eaa7" } -.codicon-breakpoint-data-unverified:before { content: "\eaa8" } -.codicon-breakpoint-data:before { content: "\eaa9" } -.codicon-breakpoint-log-unverified:before { content: "\eaaa" } -.codicon-breakpoint-log:before { content: "\eaab" } +.codicon-debug-breakpoint-conditional-unverified:before { content: "\eaa6" } +.codicon-debug-breakpoint-conditional:before { content: "\eaa7" } +.codicon-debug-breakpoint-conditional-disabled:before { content: "\eaa7" } +.codicon-debug-breakpoint-data-unverified:before { content: "\eaa8" } +.codicon-debug-breakpoint-data:before { content: "\eaa9" } +.codicon-debug-breakpoint-data-disabled:before { content: "\eaa9" } +.codicon-debug-breakpoint-log-unverified:before { content: "\eaaa" } +.codicon-debug-breakpoint-log:before { content: "\eaab" } +.codicon-debug-breakpoint-log-disabled:before { content: "\eaab" } .codicon-briefcase:before { content: "\eaac" } .codicon-broadcast:before { content: "\eaad" } .codicon-browser:before { content: "\eaae" } @@ -185,6 +192,7 @@ .codicon-chrome-minimize:before { content: "\eaba" } .codicon-chrome-restore:before { content: "\eabb" } .codicon-circle-outline:before { content: "\eabc" } +.codicon-debug-breakpoint-unverified:before { content: "\eabc" } .codicon-circle-slash:before { content: "\eabd" } .codicon-circuit-board:before { content: "\eabe" } .codicon-clear-all:before { content: "\eabf" } @@ -198,8 +206,6 @@ .codicon-comment-discussion:before { content: "\eac7" } .codicon-compare-changes:before { content: "\eac8" } .codicon-credit-card:before { content: "\eac9" } -.codicon-current-and-breakpoint:before { content: "\eaca" } -.codicon-current:before { content: "\eacb" } .codicon-dash:before { content: "\eacc" } .codicon-dashboard:before { content: "\eacd" } .codicon-database:before { content: "\eace" } @@ -297,6 +303,7 @@ .codicon-paintcan:before { content: "\eb2a" } .codicon-pin:before { content: "\eb2b" } .codicon-play:before { content: "\eb2c" } +.codicon-run:before { content: "\eb2c" } .codicon-plug:before { content: "\eb2d" } .codicon-preserve-case:before { content: "\eb2e" } .codicon-preview:before { content: "\eb2f" } @@ -385,4 +392,28 @@ .codicon-list-filter:before { content: "\eb83" } .codicon-list-flat:before { content: "\eb84" } .codicon-list-selection:before { content: "\eb85" } +.codicon-selection:before { content: "\eb85" } .codicon-list-tree:before { content: "\eb86" } +.codicon-debug-breakpoint-function-unverified:before { content: "\eb87" } +.codicon-debug-breakpoint-function:before { content: "\eb88" } +.codicon-debug-breakpoint-function-disabled:before { content: "\eb88" } +.codicon-debug-stackframe-active:before { content: "\eb89" } +.codicon-debug-stackframe-dot:before { content: "\eb8a" } +.codicon-debug-stackframe:before { content: "\eb8b" } +.codicon-debug-stackframe-focused:before { content: "\eb8b" } +.codicon-debug-breakpoint-unsupported:before { content: "\eb8c" } +.codicon-symbol-string:before { content: "\eb8d" } +.codicon-debug-reverse-continue:before { content: "\eb8e" } +.codicon-debug-step-back:before { content: "\eb8f" } +.codicon-debug-restart-frame:before { content: "\eb90" } +.codicon-debug-alternate:before { content: "\eb91" } +.codicon-call-incoming:before { content: "\eb92" } +.codicon-call-outgoing:before { content: "\eb93" } +.codicon-menu:before { content: "\eb94" } +.codicon-expand-all:before { content: "\eb95" } +.codicon-feedback:before { content: "\eb96" } +.codicon-group-by-ref-type:before { content: "\eb97" } +.codicon-ungroup-by-ref-type:before { content: "\eb98" } +.codicon-bell-dot:before { content: "\f101" } +.codicon-debug-alt-2:before { content: "\f102" } +.codicon-debug-alt:before { content: "\f103" } diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf index ba3474205da69..df86f7d4d9a21 100644 Binary files a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf and b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf differ diff --git a/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts b/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts index e496fd3a164f1..ccec1f655bb77 100644 --- a/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts +++ b/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts @@ -6,16 +6,7 @@ import 'vs/css!./codicon/codicon'; import 'vs/css!./codicon/codicon-animations'; import { escape } from 'vs/base/common/strings'; - -function expand(text: string): string { - return text.replace(/\$\((([a-z0-9\-]+?)(~([a-z0-9\-]*?))?)\)/gi, (_match, _g1, name, _g3, animation) => { - return ``; - }); -} - -export function renderCodicons(label: string): string { - return expand(escape(label)); -} +import { renderCodicons } from 'vs/base/common/codicons'; export class CodiconLabel { @@ -24,7 +15,7 @@ export class CodiconLabel { ) { } set text(text: string) { - this._container.innerHTML = renderCodicons(text || ''); + this._container.innerHTML = renderCodicons(escape(text ?? '')); } set title(title: string) { diff --git a/src/vs/base/browser/ui/contextview/contextview.css b/src/vs/base/browser/ui/contextview/contextview.css index af3ead17a6b2a..b1b67bbe3c3dc 100644 --- a/src/vs/base/browser/ui/contextview/contextview.css +++ b/src/vs/base/browser/ui/contextview/contextview.css @@ -5,5 +5,5 @@ .context-view { position: absolute; - z-index: 2000; -} \ No newline at end of file + z-index: 2500; +} diff --git a/src/vs/base/browser/ui/contextview/contextview.ts b/src/vs/base/browser/ui/contextview/contextview.ts index 098e8b03182f2..eacf37f358af1 100644 --- a/src/vs/base/browser/ui/contextview/contextview.ts +++ b/src/vs/base/browser/ui/contextview/contextview.ts @@ -5,8 +5,10 @@ import 'vs/css!./contextview'; import * as DOM from 'vs/base/browser/dom'; +import * as platform from 'vs/base/common/platform'; import { IDisposable, toDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Range } from 'vs/base/common/range'; +import { BrowserFeatures } from 'vs/base/browser/canIUse'; export interface IAnchor { x: number; @@ -178,7 +180,7 @@ export class ContextView extends Disposable { return; } - if (this.delegate!.canRelayout === false) { + if (this.delegate!.canRelayout === false && !(platform.isIOS && BrowserFeatures.pointerEvents)) { this.hide(); return; } diff --git a/src/vs/base/browser/ui/dialog/close-dark.svg b/src/vs/base/browser/ui/dialog/close-dark.svg deleted file mode 100644 index 7305a8f099ab2..0000000000000 --- a/src/vs/base/browser/ui/dialog/close-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/close-light.svg b/src/vs/base/browser/ui/dialog/close-light.svg deleted file mode 100644 index ecddcd665b580..0000000000000 --- a/src/vs/base/browser/ui/dialog/close-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/dialog.css b/src/vs/base/browser/ui/dialog/dialog.css index 4cb5c5ce13bc8..1249a329acf65 100644 --- a/src/vs/base/browser/ui/dialog/dialog.css +++ b/src/vs/base/browser/ui/dialog/dialog.css @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ /** Dialog: Modal Block */ -.monaco-workbench .dialog-modal-block { +.monaco-dialog-modal-block { position: fixed; height: 100%; width: 100%; @@ -15,12 +15,12 @@ align-items: center; } -.monaco-workbench .dialog-modal-block.dimmed { +.monaco-dialog-modal-block.dimmed { background: rgba(0, 0, 0, 0.3); } /** Dialog: Container */ -.monaco-workbench .dialog-box { +.monaco-dialog-box { display: flex; flex-direction: column-reverse; width: min-content; @@ -28,14 +28,15 @@ max-width: 90%; min-height: 75px; padding: 10px; + transform: translate3d(0px, 0px, 0px); } /** Dialog: Title Actions Row */ -.monaco-workbench .dialog-box .dialog-toolbar-row { +.monaco-dialog-box .dialog-toolbar-row { padding-bottom: 4px; } -.monaco-workbench .dialog-box .action-label { +.monaco-dialog-box .action-label { height: 16px; min-width: 16px; background-size: 16px; @@ -46,77 +47,23 @@ } -.monaco-workbench .dialog-box .dialog-close-action { - background: url('close-light.svg') center center no-repeat; -} - -.vs-dark .monaco-workbench .dialog-box .dialog-close-action, -.hc-black .monaco-workbench .dialog-box .dialog-close-action { - background: url('close-dark.svg') center center no-repeat; -} - /** Dialog: Message Row */ -.monaco-workbench .dialog-box .dialog-message-row { +.monaco-dialog-box .dialog-message-row { display: flex; flex-grow: 1; align-items: center; padding: 0 10px; } -.monaco-workbench .dialog-box .dialog-message-row .dialog-icon { +.monaco-dialog-box .dialog-message-row > .codicon { flex: 0 0 48px; height: 48px; align-self: baseline; - background-position: center; - background-repeat: no-repeat; - background-size: 48px; -} - -.vs .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-pending { - background-image: url('pending.svg'); -} - -.vs .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-info { - background-image: url('info-light.svg'); -} - -.vs .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-warning { - background-image: url('warning-light.svg'); -} - -.vs .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-error { - background-image: url('error-light.svg'); -} - -.vs-dark .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-pending { - background-image: url('pending-dark.svg'); -} - -.vs-dark .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-info, -.hc-black .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-info { - background-image: url('info-dark.svg'); -} - -.vs-dark .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-warning, -.hc-black .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-warning { - background-image: url('warning-dark.svg'); -} - -.vs-dark .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-error, -.hc-black .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-error { - background-image: url('error-dark.svg'); -} - -.hc-black .monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-pending { - background-image: url('pending-hc.svg'); -} - -.monaco-workbench .dialog-box .dialog-message-row .dialog-icon.icon-pending { - background-size: 30px; + font-size: 48px; } /** Dialog: Message Container */ -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container { +.monaco-dialog-box .dialog-message-row .dialog-message-container { display: flex; flex-direction: column; overflow: hidden; @@ -130,33 +77,36 @@ } /** Dialog: Message */ -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container .dialog-message { +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message { line-height: 22px; font-size: 18px; flex: 1; /* let the message always grow */ white-space: normal; word-wrap: break-word; /* never overflow long words, but break to next line */ + min-height: 48px; /* matches icon height */ + margin-bottom: 8px; + display: flex; + align-items: center; } /** Dialog: Details */ -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container .dialog-message-detail { +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-detail { line-height: 22px; flex: 1; /* let the message always grow */ opacity: .9; - margin-top: 8px; } -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container .dialog-message a:focus { +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message a:focus { outline-width: 1px; outline-style: solid; } -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row { +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row { padding: 15px 0px 0px; display: flex; } -.monaco-workbench .dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row .dialog-checkbox-message { +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row .dialog-checkbox-message { cursor: pointer; user-select: none; -webkit-user-select: none; @@ -164,7 +114,7 @@ } /** Dialog: Buttons Row */ -.monaco-workbench .dialog-box > .dialog-buttons-row { +.monaco-dialog-box > .dialog-buttons-row { display: flex; align-items: center; justify-content: flex-end; @@ -172,19 +122,19 @@ overflow: hidden; /* buttons row should never overflow */ } -.monaco-workbench .dialog-box > .dialog-buttons-row { +.monaco-dialog-box > .dialog-buttons-row { display: flex; white-space: nowrap; padding: 20px 10px 10px; } /** Dialog: Buttons */ -.monaco-workbench .dialog-box > .dialog-buttons-row > .dialog-buttons { +.monaco-dialog-box > .dialog-buttons-row > .dialog-buttons { display: flex; overflow: hidden; } -.monaco-workbench .dialog-box > .dialog-buttons-row > .dialog-buttons > .monaco-button { +.monaco-dialog-box > .dialog-buttons-row > .dialog-buttons > .monaco-button { width: fit-content; width: -moz-fit-content; padding: 5px 10px; diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts index cc3e823d5c44f..46190302d98e0 100644 --- a/src/vs/base/browser/ui/dialog/dialog.ts +++ b/src/vs/base/browser/ui/dialog/dialog.ts @@ -6,7 +6,7 @@ import 'vs/css!./dialog'; import * as nls from 'vs/nls'; import { Disposable } from 'vs/base/common/lifecycle'; -import { $, hide, show, EventHelper, clearNode, removeClasses, addClass, removeNode, isAncestor, addDisposableListener, EventType } from 'vs/base/browser/dom'; +import { $, hide, show, EventHelper, clearNode, removeClasses, addClass, addClasses, removeNode, isAncestor, addDisposableListener, EventType } from 'vs/base/browser/dom'; import { domEvent } from 'vs/base/browser/event'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; @@ -46,6 +46,7 @@ interface ButtonMapEntry { export class Dialog extends Disposable { private element: HTMLElement | undefined; + private shadowElement: HTMLElement | undefined; private modal: HTMLElement | undefined; private buttonsContainer: HTMLElement | undefined; private messageDetailElement: HTMLElement | undefined; @@ -60,8 +61,9 @@ export class Dialog extends Disposable { constructor(private container: HTMLElement, private message: string, buttons: string[], private options: IDialogOptions) { super(); - this.modal = this.container.appendChild($(`.dialog-modal-block${options.type === 'pending' ? '.dimmed' : ''}`)); - this.element = this.modal.appendChild($('.dialog-box')); + this.modal = this.container.appendChild($(`.monaco-dialog-modal-block${options.type === 'pending' ? '.dimmed' : ''}`)); + this.shadowElement = this.modal.appendChild($('.dialog-shadow')); + this.element = this.shadowElement.appendChild($('.monaco-dialog-box')); hide(this.element); // If no button is provided, default to OK @@ -75,7 +77,8 @@ export class Dialog extends Disposable { if (this.options.detail) { const messageElement = messageContainer.appendChild($('.dialog-message')); - messageElement.innerText = this.message; + const messageTextElement = messageElement.appendChild($('.dialog-message-text')); + messageTextElement.innerText = this.message; } this.messageDetailElement = messageContainer.appendChild($('.dialog-message-detail')); @@ -199,29 +202,30 @@ export class Dialog extends Disposable { } })); - removeClasses(this.iconElement, 'icon-error', 'icon-warning', 'icon-info'); + addClass(this.iconElement, 'codicon'); + removeClasses(this.iconElement, 'codicon-alert', 'codicon-warning', 'codicon-info'); switch (this.options.type) { case 'error': - addClass(this.iconElement, 'icon-error'); + addClass(this.iconElement, 'codicon-error'); break; case 'warning': - addClass(this.iconElement, 'icon-warning'); + addClass(this.iconElement, 'codicon-warning'); break; case 'pending': - addClass(this.iconElement, 'icon-pending'); + addClasses(this.iconElement, 'codicon-loading', 'codicon-animation-spin'); break; case 'none': case 'info': case 'question': default: - addClass(this.iconElement, 'icon-info'); + addClass(this.iconElement, 'codicon-info'); break; } const actionBar = new ActionBar(this.toolbarContainer, {}); - const action = new Action('dialog.close', nls.localize('dialogClose', "Close Dialog"), 'dialog-close-action', true, () => { + const action = new Action('dialog.close', nls.localize('dialogClose', "Close Dialog"), 'codicon codicon-close', true, () => { resolve({ button: this.options.cancelId || 0, checkboxChecked: this.checkbox ? this.checkbox.checked : undefined }); return Promise.resolve(); }); @@ -247,10 +251,13 @@ export class Dialog extends Disposable { const shadowColor = style.dialogShadow ? `0 0px 8px ${style.dialogShadow}` : ''; const border = style.dialogBorder ? `1px solid ${style.dialogBorder}` : ''; + if (this.shadowElement) { + this.shadowElement.style.boxShadow = shadowColor; + } + if (this.element) { this.element.style.color = fgColor; this.element.style.backgroundColor = bgColor; - this.element.style.boxShadow = shadowColor; this.element.style.border = border; if (this.buttonGroup) { diff --git a/src/vs/base/browser/ui/dialog/error-dark.svg b/src/vs/base/browser/ui/dialog/error-dark.svg deleted file mode 100644 index efdc5f2ae2d2d..0000000000000 --- a/src/vs/base/browser/ui/dialog/error-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/error-light.svg b/src/vs/base/browser/ui/dialog/error-light.svg deleted file mode 100644 index d646c72c740e5..0000000000000 --- a/src/vs/base/browser/ui/dialog/error-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/info-dark.svg b/src/vs/base/browser/ui/dialog/info-dark.svg deleted file mode 100644 index bb851afdfe587..0000000000000 --- a/src/vs/base/browser/ui/dialog/info-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/info-light.svg b/src/vs/base/browser/ui/dialog/info-light.svg deleted file mode 100644 index 6faf670cccc40..0000000000000 --- a/src/vs/base/browser/ui/dialog/info-light.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/vs/base/browser/ui/dialog/pending-dark.svg b/src/vs/base/browser/ui/dialog/pending-dark.svg deleted file mode 100644 index 5f38838116201..0000000000000 --- a/src/vs/base/browser/ui/dialog/pending-dark.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/vs/base/browser/ui/dialog/pending-hc.svg b/src/vs/base/browser/ui/dialog/pending-hc.svg deleted file mode 100644 index c6d0ec7e29f17..0000000000000 --- a/src/vs/base/browser/ui/dialog/pending-hc.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/vs/base/browser/ui/dialog/pending.svg b/src/vs/base/browser/ui/dialog/pending.svg deleted file mode 100644 index 47ce444bb2402..0000000000000 --- a/src/vs/base/browser/ui/dialog/pending.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/vs/base/browser/ui/dialog/warning-dark.svg b/src/vs/base/browser/ui/dialog/warning-dark.svg deleted file mode 100644 index a267963e58554..0000000000000 --- a/src/vs/base/browser/ui/dialog/warning-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/dialog/warning-light.svg b/src/vs/base/browser/ui/dialog/warning-light.svg deleted file mode 100644 index f2e2aa741e558..0000000000000 --- a/src/vs/base/browser/ui/dialog/warning-light.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/vs/base/browser/ui/grid/grid.ts b/src/vs/base/browser/ui/grid/grid.ts index c2448a2fbff46..a8105574ac30d 100644 --- a/src/vs/base/browser/ui/grid/grid.ts +++ b/src/vs/base/browser/ui/grid/grid.ts @@ -7,7 +7,7 @@ import 'vs/css!./gridview'; import { Orientation } from 'vs/base/browser/ui/sash/sash'; import { Disposable } from 'vs/base/common/lifecycle'; import { tail2 as tail, equals } from 'vs/base/common/arrays'; -import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions } from './gridview'; +import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions, IBoundarySashes } from './gridview'; import { Event } from 'vs/base/common/event'; export { Orientation, Sizing as GridViewSizing, IViewSize, orthogonal, LayoutPriority } from './gridview'; @@ -212,6 +212,9 @@ export class Grid extends Disposable { get maximumHeight(): number { return this.gridview.maximumHeight; } get onDidChange(): Event<{ width: number; height: number; } | undefined> { return this.gridview.onDidChange; } + get boundarySashes(): IBoundarySashes { return this.gridview.boundarySashes; } + set boundarySashes(boundarySashes: IBoundarySashes) { this.gridview.boundarySashes = boundarySashes; } + get element(): HTMLElement { return this.gridview.element; } private didLayout = false; @@ -604,8 +607,8 @@ export class SerializableGrid extends Grid { export type GridNodeDescriptor = { size?: number, groups?: GridNodeDescriptor[] }; export type GridDescriptor = { orientation: Orientation, groups?: GridNodeDescriptor[] }; -export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor): void { - if (nodeDescriptor.groups && nodeDescriptor.groups.length === 0) { +export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor, rootNode: boolean): void { + if (!rootNode && nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) { nodeDescriptor.groups = undefined; } @@ -617,7 +620,7 @@ export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor): let totalDefinedSizeCount = 0; for (const child of nodeDescriptor.groups) { - sanitizeGridNodeDescriptor(child); + sanitizeGridNodeDescriptor(child, false); if (child.size) { totalDefinedSize += child.size; @@ -665,7 +668,7 @@ function getDimensions(node: ISerializedNode, orientation: Orientation): { width } export function createSerializedGrid(gridDescriptor: GridDescriptor): ISerializedGrid { - sanitizeGridNodeDescriptor(gridDescriptor); + sanitizeGridNodeDescriptor(gridDescriptor, true); const root = createSerializedNode(gridDescriptor); const { width, height } = getDimensions(root, gridDescriptor.orientation); diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index 1c4944ce53910..a61fd2c5bab87 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -21,6 +21,20 @@ export interface IViewSize { readonly height: number; } +interface IRelativeBoundarySashes { + readonly start?: Sash; + readonly end?: Sash; + readonly orthogonalStart?: Sash; + readonly orthogonalEnd?: Sash; +} + +export interface IBoundarySashes { + readonly top?: Sash; + readonly right?: Sash; + readonly bottom?: Sash; + readonly left?: Sash; +} + export interface IView { readonly element: HTMLElement; readonly minimumWidth: number; @@ -30,8 +44,9 @@ export interface IView { readonly onDidChange: Event; readonly priority?: LayoutPriority; readonly snap?: boolean; - layout(width: number, height: number, orientation: Orientation): void; + layout(width: number, height: number, top: number, left: number): void; setVisible?(visible: boolean): void; + setBoundarySashes?(sashes: IBoundarySashes): void; } export interface ISerializableView extends IView { @@ -69,10 +84,10 @@ export function orthogonal(orientation: Orientation): Orientation { } export interface Box { - top: number; - left: number; - width: number; - height: number; + readonly top: number; + readonly left: number; + readonly width: number; + readonly height: number; } export interface GridLeafNode { @@ -117,11 +132,35 @@ export interface IGridViewOptions { readonly layoutController?: ILayoutController; } -class BranchNode implements ISplitView, IDisposable { +interface ILayoutContext { + readonly orthogonalSize: number; + readonly absoluteOffset: number; + readonly absoluteOrthogonalOffset: number; + readonly absoluteSize: number; + readonly absoluteOrthogonalSize: number; +} + +function toAbsoluteBoundarySashes(sashes: IRelativeBoundarySashes, orientation: Orientation): IBoundarySashes { + if (orientation === Orientation.HORIZONTAL) { + return { left: sashes.start, right: sashes.end, top: sashes.orthogonalStart, bottom: sashes.orthogonalEnd }; + } else { + return { top: sashes.start, bottom: sashes.end, left: sashes.orthogonalStart, right: sashes.orthogonalEnd }; + } +} + +function fromAbsoluteBoundarySashes(sashes: IBoundarySashes, orientation: Orientation): IRelativeBoundarySashes { + if (orientation === Orientation.HORIZONTAL) { + return { start: sashes.left, end: sashes.right, orthogonalStart: sashes.top, orthogonalEnd: sashes.bottom }; + } else { + return { start: sashes.top, end: sashes.bottom, orthogonalStart: sashes.left, orthogonalEnd: sashes.right }; + } +} + +class BranchNode implements ISplitView, IDisposable { readonly element: HTMLElement; readonly children: Node[] = []; - private splitview: SplitView; + private splitview: SplitView; private _size: number; get size(): number { return this._size; } @@ -129,6 +168,9 @@ class BranchNode implements ISplitView, IDisposable { private _orthogonalSize: number; get orthogonalSize(): number { return this._orthogonalSize; } + private absoluteOffset: number = 0; + private absoluteOrthogonalOffset: number = 0; + private _styles: IGridViewStyles; get styles(): IGridViewStyles { return this._styles; } @@ -140,6 +182,14 @@ class BranchNode implements ISplitView, IDisposable { return this.orientation === Orientation.HORIZONTAL ? this.orthogonalSize : this.size; } + get top(): number { + return this.orientation === Orientation.HORIZONTAL ? this.absoluteOffset : this.absoluteOrthogonalOffset; + } + + get left(): number { + return this.orientation === Orientation.HORIZONTAL ? this.absoluteOrthogonalOffset : this.absoluteOffset; + } + get minimumSize(): number { return this.children.length === 0 ? 0 : Math.max(...this.children.map(c => c.minimumOrthogonalSize)); } @@ -198,10 +248,27 @@ class BranchNode implements ISplitView, IDisposable { private splitviewSashResetDisposable: IDisposable = Disposable.None; private childrenSashResetDisposable: IDisposable = Disposable.None; - get orthogonalStartSash(): Sash | undefined { return this.splitview.orthogonalStartSash; } - set orthogonalStartSash(sash: Sash | undefined) { this.splitview.orthogonalStartSash = sash; } - get orthogonalEndSash(): Sash | undefined { return this.splitview.orthogonalEndSash; } - set orthogonalEndSash(sash: Sash | undefined) { this.splitview.orthogonalEndSash = sash; } + private _boundarySashes: IRelativeBoundarySashes = {}; + get boundarySashes(): IRelativeBoundarySashes { return this._boundarySashes; } + set boundarySashes(boundarySashes: IRelativeBoundarySashes) { + this._boundarySashes = boundarySashes; + + this.splitview.orthogonalStartSash = boundarySashes.orthogonalStart; + this.splitview.orthogonalEndSash = boundarySashes.orthogonalEnd; + + for (let index = 0; index < this.children.length; index++) { + const child = this.children[index]; + const first = index === 0; + const last = index === this.children.length - 1; + + child.boundarySashes = { + start: boundarySashes.orthogonalStart, + end: boundarySashes.orthogonalEnd, + orthogonalStart: first ? boundarySashes.start : child.boundarySashes.orthogonalStart, + orthogonalEnd: last ? boundarySashes.end : child.boundarySashes.orthogonalEnd, + }; + } + } constructor( readonly orientation: Orientation, @@ -221,7 +288,7 @@ class BranchNode implements ISplitView, IDisposable { if (!childDescriptors) { // Normal behavior, we have no children yet, just set up the splitview this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout }); - this.splitview.layout(size, orthogonalSize); + this.splitview.layout(size, { orthogonalSize, absoluteOffset: 0, absoluteOrthogonalOffset: 0, absoluteSize: size, absoluteOrthogonalSize: orthogonalSize }); } else { // Reconstruction behavior, we want to reconstruct a splitview const descriptor = { @@ -241,9 +308,15 @@ class BranchNode implements ISplitView, IDisposable { this.splitview = new SplitView(this.element, { ...options, descriptor }); this.children.forEach((node, index) => { - // Set up orthogonal sashes for children - node.orthogonalStartSash = this.splitview.sashes[index - 1]; - node.orthogonalEndSash = this.splitview.sashes[index]; + const first = index === 0; + const last = index === this.children.length; + + node.boundarySashes = { + start: this.boundarySashes.orthogonalStart, + end: this.boundarySashes.orthogonalEnd, + orthogonalStart: first ? this.boundarySashes.start : this.splitview.sashes[index - 1], + orthogonalEnd: last ? this.boundarySashes.end : this.splitview.sashes[index], + }; }); } @@ -268,20 +341,32 @@ class BranchNode implements ISplitView, IDisposable { } } - layout(size: number, orthogonalSize: number | undefined): void { + layout(size: number, offset: number, ctx: ILayoutContext | undefined): void { if (!this.layoutController.isLayoutEnabled) { return; } - if (typeof orthogonalSize !== 'number') { + if (typeof ctx === 'undefined') { throw new Error('Invalid state'); } // branch nodes should flip the normal/orthogonal directions - this._size = orthogonalSize; + this._size = ctx.orthogonalSize; this._orthogonalSize = size; + this.absoluteOffset = ctx.absoluteOffset + offset; + this.absoluteOrthogonalOffset = ctx.absoluteOrthogonalOffset; + + this.splitview.layout(ctx.orthogonalSize, { + orthogonalSize: size, + absoluteOffset: this.absoluteOrthogonalOffset, + absoluteOrthogonalOffset: this.absoluteOffset, + absoluteSize: ctx.absoluteOrthogonalSize, + absoluteOrthogonalSize: ctx.absoluteSize + }); - this.splitview.layout(orthogonalSize, size); + // Disable snapping on views which sit on the edges of the grid + this.splitview.startSnappingEnabled = this.absoluteOrthogonalOffset > 0; + this.splitview.endSnappingEnabled = this.absoluteOrthogonalOffset + ctx.orthogonalSize < ctx.absoluteOrthogonalSize; } setVisible(visible: boolean): void { @@ -304,15 +389,26 @@ class BranchNode implements ISplitView, IDisposable { const first = index === 0; const last = index === this.children.length; this.children.splice(index, 0, node); - node.orthogonalStartSash = this.splitview.sashes[index - 1]; - node.orthogonalEndSash = this.splitview.sashes[index]; + + node.boundarySashes = { + start: this.boundarySashes.orthogonalStart, + end: this.boundarySashes.orthogonalEnd, + orthogonalStart: first ? this.boundarySashes.start : this.splitview.sashes[index - 1], + orthogonalEnd: last ? this.boundarySashes.end : this.splitview.sashes[index], + }; if (!first) { - this.children[index - 1].orthogonalEndSash = this.splitview.sashes[index - 1]; + this.children[index - 1].boundarySashes = { + ...this.children[index - 1].boundarySashes, + orthogonalEnd: this.splitview.sashes[index - 1] + }; } if (!last) { - this.children[index + 1].orthogonalStartSash = this.splitview.sashes[index]; + this.children[index + 1].boundarySashes = { + ...this.children[index + 1].boundarySashes, + orthogonalStart: this.splitview.sashes[index] + }; } } @@ -332,11 +428,17 @@ class BranchNode implements ISplitView, IDisposable { const [child] = this.children.splice(index, 1); if (!first) { - this.children[index - 1].orthogonalEndSash = this.splitview.sashes[index - 1]; + this.children[index - 1].boundarySashes = { + ...this.children[index - 1].boundarySashes, + orthogonalEnd: this.splitview.sashes[index - 1] + }; } if (!last) { // [0,1,2,3] (2) => [0,1,3] - this.children[index].orthogonalStartSash = this.splitview.sashes[Math.max(index - 1, 0)]; + this.children[index].boundarySashes = { + ...this.children[index].boundarySashes, + orthogonalStart: this.splitview.sashes[Math.max(index - 1, 0)] + }; } return child; @@ -361,6 +463,8 @@ class BranchNode implements ISplitView, IDisposable { const child = this._removeChild(from); this._addChild(child, to); + + this.onDidChildrenChange(); } swapChildren(from: number, to: number): void { @@ -375,8 +479,15 @@ class BranchNode implements ISplitView, IDisposable { to = clamp(to, 0, this.children.length); this.splitview.swapViews(from, to); - [this.children[from].orthogonalStartSash, this.children[from].orthogonalEndSash, this.children[to].orthogonalStartSash, this.children[to].orthogonalEndSash] = [this.children[to].orthogonalStartSash, this.children[to].orthogonalEndSash, this.children[from].orthogonalStartSash, this.children[from].orthogonalEndSash]; + + // swap boundary sashes + [this.children[from].boundarySashes, this.children[to].boundarySashes] + = [this.children[from].boundarySashes, this.children[to].boundarySashes]; + + // swap children [this.children[from], this.children[to]] = [this.children[to], this.children[from]]; + + this.onDidChildrenChange(); } resizeChild(index: number, size: number): void { @@ -511,7 +622,7 @@ class BranchNode implements ISplitView, IDisposable { } } -class LeafNode implements ISplitView, IDisposable { +class LeafNode implements ISplitView, IDisposable { private _size: number = 0; get size(): number { return this._size; } @@ -519,6 +630,9 @@ class LeafNode implements ISplitView, IDisposable { private _orthogonalSize: number; get orthogonalSize(): number { return this._orthogonalSize; } + private absoluteOffset: number = 0; + private absoluteOrthogonalOffset: number = 0; + readonly onDidSashReset: Event = Event.None; private _onDidLinkedWidthNodeChange = new Relay(); @@ -565,6 +679,14 @@ class LeafNode implements ISplitView, IDisposable { return this.orientation === Orientation.HORIZONTAL ? this.size : this.orthogonalSize; } + get top(): number { + return this.orientation === Orientation.HORIZONTAL ? this.absoluteOffset : this.absoluteOrthogonalOffset; + } + + get left(): number { + return this.orientation === Orientation.HORIZONTAL ? this.absoluteOrthogonalOffset : this.absoluteOffset; + } + get element(): HTMLElement { return this.view.element; } @@ -609,26 +731,30 @@ class LeafNode implements ISplitView, IDisposable { return this.orientation === Orientation.HORIZONTAL ? this.maximumWidth : this.maximumHeight; } - set orthogonalStartSash(sash: Sash) { - // noop - } + private _boundarySashes: IRelativeBoundarySashes = {}; + get boundarySashes(): IRelativeBoundarySashes { return this._boundarySashes; } + set boundarySashes(boundarySashes: IRelativeBoundarySashes) { + this._boundarySashes = boundarySashes; - set orthogonalEndSash(sash: Sash) { - // noop + if (this.view.setBoundarySashes) { + this.view.setBoundarySashes(toAbsoluteBoundarySashes(boundarySashes, this.orientation)); + } } - layout(size: number, orthogonalSize: number | undefined): void { + layout(size: number, offset: number, ctx: ILayoutContext | undefined): void { if (!this.layoutController.isLayoutEnabled) { return; } - if (typeof orthogonalSize !== 'number') { + if (typeof ctx === 'undefined') { throw new Error('Invalid state'); } this._size = size; - this._orthogonalSize = orthogonalSize; - this.view.layout(this.width, this.height, orthogonal(this.orientation)); + this._orthogonalSize = ctx.orthogonalSize; + this.absoluteOffset = ctx.absoluteOffset + offset; + this.absoluteOrthogonalOffset = ctx.absoluteOrthogonalOffset; + this.view.layout(this.width, this.height, this.top, this.left); } setVisible(visible: boolean): void { @@ -715,7 +841,8 @@ export class GridView implements IDisposable { const { size, orthogonalSize } = this._root; this.root = flipNode(this._root, orthogonalSize, size); - this.root.layout(size, orthogonalSize); + this.root.layout(size, 0, { orthogonalSize, absoluteOffset: 0, absoluteOrthogonalOffset: 0, absoluteSize: size, absoluteOrthogonalSize: orthogonalSize }); + this.boundarySashes = this.boundarySashes; } get width(): number { return this.root.width; } @@ -729,6 +856,13 @@ export class GridView implements IDisposable { private _onDidChange = new Relay(); readonly onDidChange = this._onDidChange.event; + private _boundarySashes: IBoundarySashes = {}; + get boundarySashes(): IBoundarySashes { return this._boundarySashes; } + set boundarySashes(boundarySashes: IBoundarySashes) { + this._boundarySashes = boundarySashes; + this.root.boundarySashes = fromAbsoluteBoundarySashes(boundarySashes, this.orientation); + } + /** * The first layout controller makes sure layout only propagates * to the views after the very first call to gridview.layout() @@ -771,7 +905,7 @@ export class GridView implements IDisposable { this.firstLayoutController.isLayoutEnabled = true; const [size, orthogonalSize] = this.root.orientation === Orientation.HORIZONTAL ? [height, width] : [width, height]; - this.root.layout(size, orthogonalSize); + this.root.layout(size, 0, { orthogonalSize, absoluteOffset: 0, absoluteOrthogonalOffset: 0, absoluteSize: size, absoluteOrthogonalSize: orthogonalSize }); } addView(view: IView, size: number | Sizing, location: number[]): void { @@ -850,6 +984,7 @@ export class GridView implements IDisposable { // we must promote sibling to be the new root parent.removeChild(0); this.root = sibling; + this.boundarySashes = this.boundarySashes; return node.view; } @@ -1032,7 +1167,7 @@ export class GridView implements IDisposable { getView(location?: number[]): GridNode; getView(location?: number[]): GridNode { const node = location ? this.getNode(location)[1] : this._root; - return this._getViews(node, this.orientation, { top: 0, left: 0, width: this.width, height: this.height }); + return this._getViews(node, this.orientation); } static deserialize(json: ISerializedGridView, deserializer: IViewDeserializer, options: IGridViewOptions = {}): GridView { @@ -1042,6 +1177,8 @@ export class GridView implements IDisposable { throw new Error('Invalid JSON: \'width\' property must be a number.'); } else if (typeof json.height !== 'number') { throw new Error('Invalid JSON: \'height\' property must be a number.'); + } else if (json.root?.type !== 'branch') { + throw new Error('Invalid JSON: \'root\' property must have \'type\' value of branch.'); } const orientation = json.orientation; @@ -1076,24 +1213,20 @@ export class GridView implements IDisposable { return result; } - private _getViews(node: Node, orientation: Orientation, box: Box, cachedVisibleSize?: number): GridNode { + private _getViews(node: Node, orientation: Orientation, cachedVisibleSize?: number): GridNode { + const box = { top: node.top, left: node.left, width: node.width, height: node.height }; + if (node instanceof LeafNode) { return { view: node.view, box, cachedVisibleSize }; } const children: GridNode[] = []; - let i = 0; - let offset = 0; - - for (const child of node.children) { - const childOrientation = orthogonal(orientation); - const childBox: Box = orientation === Orientation.HORIZONTAL - ? { top: box.top, left: box.left + offset, width: child.width, height: box.height } - : { top: box.top + offset, left: box.left, width: box.width, height: child.height }; - const cachedVisibleSize = node.getChildCachedVisibleSize(i++); - - children.push(this._getViews(child, childOrientation, childBox, cachedVisibleSize)); - offset += orientation === Orientation.HORIZONTAL ? child.width : child.height; + + for (let i = 0; i < node.children.length; i++) { + const child = node.children[i]; + const cachedVisibleSize = node.getChildCachedVisibleSize(i); + + children.push(this._getViews(child, orthogonal(orientation), cachedVisibleSize)); } return { children, box }; diff --git a/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts b/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts index 701d3a6a7858c..e408f21afd2e4 100644 --- a/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts +++ b/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts @@ -4,12 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as objects from 'vs/base/common/objects'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import { renderCodicons } from 'vs/base/common/codicons'; import { escape } from 'vs/base/common/strings'; export interface IHighlight { start: number; end: number; + extraClasses?: string; } export class HighlightedLabel { @@ -65,13 +66,17 @@ export class HighlightedLabel { if (pos < highlight.start) { htmlContent += ''; const substring = this.text.substring(pos, highlight.start); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; pos = highlight.end; } - htmlContent += ''; + if (highlight.extraClasses) { + htmlContent += ``; + } else { + htmlContent += ``; + } const substring = this.text.substring(highlight.start, highlight.end); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; pos = highlight.end; } @@ -79,12 +84,16 @@ export class HighlightedLabel { if (pos < this.text.length) { htmlContent += ''; const substring = this.text.substring(pos); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; } this.domNode.innerHTML = htmlContent; - this.domNode.title = this.title; + if (this.title) { + this.domNode.title = this.title; + } else { + this.domNode.removeAttribute('title'); + } this.didEverRender = true; } diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index 69315ea919a24..af06f86e2faf6 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -8,6 +8,8 @@ import * as dom from 'vs/base/browser/dom'; import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel'; import { IMatch } from 'vs/base/common/filters'; import { Disposable } from 'vs/base/common/lifecycle'; +import { Range } from 'vs/base/common/range'; +import { equals } from 'vs/base/common/objects'; export interface IIconLabelCreationOptions { supportHighlights?: boolean; @@ -24,6 +26,8 @@ export interface IIconLabelValueOptions { matches?: IMatch[]; labelEscapeNewLines?: boolean; descriptionMatches?: IMatch[]; + readonly separator?: string; + readonly domId?: string; } class FastLabelNode { @@ -86,9 +90,12 @@ class FastLabelNode { } export class IconLabel extends Disposable { + private domNode: FastLabelNode; - private labelDescriptionContainer: FastLabelNode; - private labelNode: FastLabelNode | HighlightedLabel; + + private nameNode: Label | LabelWithHighlights; + + private descriptionContainer: FastLabelNode; private descriptionNode: FastLabelNode | HighlightedLabel | undefined; private descriptionNodeFactory: () => FastLabelNode | HighlightedLabel; @@ -97,18 +104,21 @@ export class IconLabel extends Disposable { this.domNode = this._register(new FastLabelNode(dom.append(container, dom.$('.monaco-icon-label')))); - this.labelDescriptionContainer = this._register(new FastLabelNode(dom.append(this.domNode.element, dom.$('.monaco-icon-label-description-container')))); + const labelContainer = dom.append(this.domNode.element, dom.$('.monaco-icon-label-container')); + + const nameContainer = dom.append(labelContainer, dom.$('span.monaco-icon-name-container')); + this.descriptionContainer = this._register(new FastLabelNode(dom.append(labelContainer, dom.$('span.monaco-icon-description-container')))); if (options?.supportHighlights) { - this.labelNode = new HighlightedLabel(dom.append(this.labelDescriptionContainer.element, dom.$('a.label-name')), !!options.supportCodicons); + this.nameNode = new LabelWithHighlights(nameContainer, !!options.supportCodicons); } else { - this.labelNode = this._register(new FastLabelNode(dom.append(this.labelDescriptionContainer.element, dom.$('a.label-name')))); + this.nameNode = new Label(nameContainer); } if (options?.supportDescriptionHighlights) { - this.descriptionNodeFactory = () => new HighlightedLabel(dom.append(this.labelDescriptionContainer.element, dom.$('span.label-description')), !!options.supportCodicons); + this.descriptionNodeFactory = () => new HighlightedLabel(dom.append(this.descriptionContainer.element, dom.$('span.label-description')), !!options.supportCodicons); } else { - this.descriptionNodeFactory = () => this._register(new FastLabelNode(dom.append(this.labelDescriptionContainer.element, dom.$('span.label-description')))); + this.descriptionNodeFactory = () => this._register(new FastLabelNode(dom.append(this.descriptionContainer.element, dom.$('span.label-description')))); } } @@ -116,7 +126,7 @@ export class IconLabel extends Disposable { return this.domNode.element; } - setLabel(label?: string, description?: string, options?: IIconLabelValueOptions): void { + setLabel(label: string | string[], description?: string, options?: IIconLabelValueOptions): void { const classes = ['monaco-icon-label']; if (options) { if (options.extraClasses) { @@ -131,11 +141,7 @@ export class IconLabel extends Disposable { this.domNode.className = classes.join(' '); this.domNode.title = options?.title || ''; - if (this.labelNode instanceof HighlightedLabel) { - this.labelNode.set(label || '', options?.matches, options?.title, options?.labelEscapeNewLines); - } else { - this.labelNode.textContent = label || ''; - } + this.nameNode.setLabel(label, options); if (description || this.descriptionNode) { if (!this.descriptionNode) { @@ -157,3 +163,116 @@ export class IconLabel extends Disposable { } } } + +class Label { + + private label: string | string[] | undefined = undefined; + private singleLabel: HTMLElement | undefined = undefined; + private options: IIconLabelValueOptions | undefined; + + constructor(private container: HTMLElement) { } + + setLabel(label: string | string[], options?: IIconLabelValueOptions): void { + if (this.label === label && equals(this.options, options)) { + return; + } + + this.label = label; + this.options = options; + + if (typeof label === 'string') { + if (!this.singleLabel) { + this.container.innerHTML = ''; + dom.removeClass(this.container, 'multiple'); + this.singleLabel = dom.append(this.container, dom.$('a.label-name', { id: options?.domId })); + } + + this.singleLabel.textContent = label; + } else { + this.container.innerHTML = ''; + dom.addClass(this.container, 'multiple'); + this.singleLabel = undefined; + + for (let i = 0; i < label.length; i++) { + const l = label[i]; + const id = options?.domId && `${options?.domId}_${i}`; + + dom.append(this.container, dom.$('a.label-name', { id, 'data-icon-label-count': label.length, 'data-icon-label-index': i }, l)); + + if (i < label.length - 1) { + dom.append(this.container, dom.$('span.label-separator', undefined, options?.separator || '/')); + } + } + } + } +} + +function splitMatches(labels: string[], separator: string, matches: IMatch[] | undefined): IMatch[][] | undefined { + if (!matches) { + return undefined; + } + + let labelStart = 0; + + return labels.map(label => { + const labelRange = { start: labelStart, end: labelStart + label.length }; + + const result = matches + .map(match => Range.intersect(labelRange, match)) + .filter(range => !Range.isEmpty(range)) + .map(({ start, end }) => ({ start: start - labelStart, end: end - labelStart })); + + labelStart = labelRange.end + separator.length; + return result; + }); +} + +class LabelWithHighlights { + + private label: string | string[] | undefined = undefined; + private singleLabel: HighlightedLabel | undefined = undefined; + private options: IIconLabelValueOptions | undefined; + + constructor(private container: HTMLElement, private supportCodicons: boolean) { } + + setLabel(label: string | string[], options?: IIconLabelValueOptions): void { + if (this.label === label && equals(this.options, options)) { + return; + } + + this.label = label; + this.options = options; + + if (typeof label === 'string') { + if (!this.singleLabel) { + this.container.innerHTML = ''; + dom.removeClass(this.container, 'multiple'); + this.singleLabel = new HighlightedLabel(dom.append(this.container, dom.$('a.label-name', { id: options?.domId })), this.supportCodicons); + } + + this.singleLabel.set(label, options?.matches, options?.title, options?.labelEscapeNewLines); + } else { + + this.container.innerHTML = ''; + dom.addClass(this.container, 'multiple'); + this.singleLabel = undefined; + + const separator = options?.separator || '/'; + const matches = splitMatches(label, separator, options?.matches); + + for (let i = 0; i < label.length; i++) { + const l = label[i]; + const m = matches ? matches[i] : undefined; + const id = options?.domId && `${options?.domId}_${i}`; + + const name = dom.$('a.label-name', { id, 'data-icon-label-count': label.length, 'data-icon-label-index': i }); + const highlightedLabel = new HighlightedLabel(dom.append(this.container, name), this.supportCodicons); + highlightedLabel.set(l, m, options?.title, options?.labelEscapeNewLines); + + if (i < label.length - 1) { + dom.append(name, dom.$('span.label-separator', undefined, separator)); + } + } + } + } +} diff --git a/src/vs/base/browser/ui/iconLabel/iconlabel.css b/src/vs/base/browser/ui/iconLabel/iconlabel.css index ad21f0ae1e4d9..8ee16195b5c53 100644 --- a/src/vs/base/browser/ui/iconLabel/iconlabel.css +++ b/src/vs/base/browser/ui/iconLabel/iconlabel.css @@ -31,25 +31,32 @@ flex-shrink: 0; /* fix for https://github.com/Microsoft/vscode/issues/13787 */ } -.monaco-icon-label > .monaco-icon-label-description-container { - overflow: hidden; /* this causes the label/description to shrink first if decorations are enabled */ +.monaco-icon-label > .monaco-icon-label-container { + min-width: 0; + overflow: hidden; text-overflow: ellipsis; + flex: 1; } -.monaco-icon-label > .monaco-icon-label-description-container > .label-name { +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-name-container > .label-name { color: inherit; white-space: pre; /* enable to show labels that include multiple whitespaces */ } -.monaco-icon-label > .monaco-icon-label-description-container > .label-description { +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-name-container > .label-name > .label-separator { + margin: 0 2px; + opacity: 0.5; +} + +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-description-container > .label-description { opacity: .7; margin-left: 0.5em; font-size: 0.9em; white-space: pre; /* enable to show labels that include multiple whitespaces */ } -.monaco-icon-label.italic > .monaco-icon-label-description-container > .label-name, -.monaco-icon-label.italic > .monaco-icon-label-description-container > .label-description { +.monaco-icon-label.italic > .monaco-icon-label-container > .monaco-icon-name-container > .label-name, +.monaco-icon-label.italic > .monaco-icon-description-container > .label-description { font-style: italic; } @@ -58,7 +65,6 @@ font-size: 90%; font-weight: 600; padding: 0 16px 0 5px; - margin-left: auto; text-align: center; } diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 59dd50015d898..cd57d7f772f56 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -171,7 +171,7 @@ export class InputBox extends Widget { this.maxHeight = typeof this.options.flexibleMaxHeight === 'number' ? this.options.flexibleMaxHeight : Number.POSITIVE_INFINITY; this.mirror = dom.append(wrapper, $('div.mirror')); - this.mirror.innerHTML = ' '; + this.mirror.innerHTML = ' '; this.scrollableElement = new ScrollableElement(this.element, { vertical: ScrollbarVisibility.Auto }); @@ -220,6 +220,8 @@ export class InputBox extends Widget { }); } + this.ignoreGesture(this.input); + setTimeout(() => this.updateMirror(), 0); // Support actions @@ -303,6 +305,7 @@ export class InputBox extends Widget { } public disable(): void { + this.blur(); this.input.disabled = true; this._hideMessage(); } @@ -474,7 +477,7 @@ export class InputBox extends Widget { const styles = this.stylesForType(this.message.type); spanElement.style.backgroundColor = styles.background ? styles.background.toString() : ''; - spanElement.style.color = styles.foreground ? styles.foreground.toString() : null; + spanElement.style.color = styles.foreground ? styles.foreground.toString() : ''; spanElement.style.border = styles.border ? `1px solid ${styles.border}` : ''; dom.append(div, spanElement); @@ -527,7 +530,7 @@ export class InputBox extends Widget { if (mirrorTextContent) { this.mirror.textContent = value + suffix; } else { - this.mirror.innerHTML = ' '; + this.mirror.innerHTML = ' '; } this.layout(); diff --git a/src/vs/base/browser/ui/list/list.css b/src/vs/base/browser/ui/list/list.css index 1bf13b4ce11b7..c4b75d53cdec1 100644 --- a/src/vs/base/browser/ui/list/list.css +++ b/src/vs/base/browser/ui/list/list.css @@ -113,55 +113,28 @@ } .monaco-list-type-filter > .controls > * { + border: none; box-sizing: border-box; - width: 16px; - height: 16px; - margin: 0 0 0 2px; - flex-shrink: 0; -} - -.monaco-list-type-filter > .controls > .filter { -webkit-appearance: none; -moz-appearance: none; + background: none; width: 16px; height: 16px; - background: url("media/no-filter-light.svg"); - background-position: 50% 50%; - cursor: pointer; -} - -.monaco-list-type-filter > .controls > .filter:checked { - background-image: url("media/filter-light.svg"); -} - -.vs-dark .monaco-list-type-filter > .controls > .filter { - background-image: url("media/no-filter-dark.svg"); -} - -.vs-dark .monaco-list-type-filter > .controls > .filter:checked { - background-image: url("media/filter-dark.svg"); -} - -.hc-black .monaco-list-type-filter > .controls > .filter { - background-image: url("media/no-filter-hc.svg"); -} - -.hc-black .monaco-list-type-filter > .controls > .filter:checked { - background-image: url("media/filter-hc.svg"); -} - -.monaco-list-type-filter > .controls > .clear { - border: none; - background: url("media/close-light.svg"); + flex-shrink: 0; + margin: 0; + padding: 0; + display: flex; + align-items: center; + justify-content: center; cursor: pointer; } -.vs-dark .monaco-list-type-filter > .controls > .clear { - background-image: url("media/close-dark.svg"); +.monaco-list-type-filter > .controls > .filter:checked::before { + content: "\eb83" !important; /* codicon-list-filter */ } -.hc-black .monaco-list-type-filter > .controls > .clear { - background-image: url("media/close-hc.svg"); +.monaco-list-type-filter > .controls > .filter { + margin-left: 4px; } .monaco-list-type-filter-message { diff --git a/src/vs/base/browser/ui/list/list.ts b/src/vs/base/browser/ui/list/list.ts index 076d78d77254c..f07e22e1bee47 100644 --- a/src/vs/base/browser/ui/list/list.ts +++ b/src/vs/base/browser/ui/list/list.ts @@ -103,10 +103,11 @@ export const ListDragOverReactions = { export interface IListDragAndDrop { getDragURI(element: T): string | null; - getDragLabel?(elements: T[]): string | undefined; + getDragLabel?(elements: T[], originalEvent: DragEvent): string | undefined; onDragStart?(data: IDragAndDropData, originalEvent: DragEvent): void; onDragOver(data: IDragAndDropData, targetElement: T | undefined, targetIndex: number | undefined, originalEvent: DragEvent): boolean | IListDragOverReaction; drop(data: IDragAndDropData, targetElement: T | undefined, targetIndex: number | undefined, originalEvent: DragEvent): void; + onDragEnd?(originalEvent: DragEvent): void; } export class ListError extends Error { @@ -128,6 +129,8 @@ export abstract class CachedListVirtualDelegate implements ILi abstract getTemplateId(element: T): string; setDynamicHeight(element: T, height: number): void { - this.cache.set(element, height); + if (height > 0) { + this.cache.set(element, height); + } } } diff --git a/src/vs/base/browser/ui/list/listView.ts b/src/vs/base/browser/ui/list/listView.ts index 620974cd757ed..7b52050158237 100644 --- a/src/vs/base/browser/ui/list/listView.ts +++ b/src/vs/base/browser/ui/list/listView.ts @@ -52,6 +52,7 @@ export interface IListViewOptions { readonly useShadows?: boolean; readonly verticalScrollMode?: ScrollbarVisibility; readonly setRowLineHeight?: boolean; + readonly setRowHeight?: boolean; readonly supportDynamicHeights?: boolean; readonly mouseSupport?: boolean; readonly horizontalScrolling?: boolean; @@ -63,6 +64,7 @@ const DefaultOptions = { useShadows: true, verticalScrollMode: ScrollbarVisibility.Auto, setRowLineHeight: true, + setRowHeight: true, supportDynamicHeights: false, dnd: { getDragElements(e: T) { return [e]; }, @@ -74,9 +76,10 @@ const DefaultOptions = { horizontalScrolling: false }; -export class ElementsDragAndDropData implements IDragAndDropData { +export class ElementsDragAndDropData implements IDragAndDropData { readonly elements: T[]; + context: TContext | undefined; constructor(elements: T[]) { this.elements = elements; @@ -84,7 +87,7 @@ export class ElementsDragAndDropData implements IDragAndDropData { update(): void { } - getData(): any { + getData(): T[] { return this.elements; } } @@ -99,7 +102,7 @@ export class ExternalElementsDragAndDropData implements IDragAndDropData { update(): void { } - getData(): any { + getData(): T[] { return this.elements; } } @@ -173,6 +176,7 @@ export class ListView implements ISpliceable, IDisposable { private dragOverAnimationStopDisposable: IDisposable = Disposable.None; private dragOverMouseY: number = 0; private setRowLineHeight: boolean; + private setRowHeight: boolean; private supportDynamicHeights: boolean; private horizontalScrolling: boolean; private additionalScrollHeight: number; @@ -193,6 +197,7 @@ export class ListView implements ISpliceable, IDisposable { get contentHeight(): number { return this.rangeMap.size; } get onDidScroll(): Event { return this.scrollableElement.onScroll; } + get onWillScroll(): Event { return this.scrollableElement.onWillScroll; } constructor( container: HTMLElement, @@ -234,7 +239,7 @@ export class ListView implements ISpliceable, IDisposable { this.rowsContainer = document.createElement('div'); this.rowsContainer.className = 'monaco-list-rows'; - this.rowsContainer.style.willChange = 'transform'; + this.rowsContainer.style.transform = 'translate3d(0px, 0px, 0px)'; this.disposables.add(Gesture.addTarget(this.rowsContainer)); this.scrollableElement = this.disposables.add(new ScrollableElement(this.rowsContainer, { @@ -261,6 +266,7 @@ export class ListView implements ISpliceable, IDisposable { domEvent(window, 'dragend')(this.onDragEnd, this, this.disposables); this.setRowLineHeight = getOrDefault(options, o => o.setRowLineHeight, DefaultOptions.setRowLineHeight); + this.setRowHeight = getOrDefault(options, o => o.setRowHeight, DefaultOptions.setRowHeight); this.supportDynamicHeights = getOrDefault(options, o => o.supportDynamicHeights, DefaultOptions.supportDynamicHeights); this.dnd = getOrDefault, IListViewDragAndDrop>(options, o => o.dnd, DefaultOptions.dnd); @@ -613,7 +619,10 @@ export class ListView implements ISpliceable, IDisposable { private updateItemInDOM(item: IItem, index: number): void { item.row!.domNode!.style.top = `${this.elementTop(index)}px`; - item.row!.domNode!.style.height = `${item.size}px`; + + if (this.setRowHeight) { + item.row!.domNode!.style.height = `${item.size}px`; + } if (this.setRowLineHeight) { item.row!.domNode!.style.lineHeight = `${item.size}px`; @@ -766,7 +775,7 @@ export class ListView implements ISpliceable, IDisposable { let label: string | undefined; if (this.dnd.getDragLabel) { - label = this.dnd.getDragLabel(elements); + label = this.dnd.getDragLabel(elements, event); } if (typeof label === 'undefined') { @@ -843,13 +852,9 @@ export class ListView implements ISpliceable, IDisposable { } // sanitize feedback list - feedback = distinct(feedback).filter(i => i >= -1 && i < this.length).sort(); + feedback = distinct(feedback).filter(i => i >= -1 && i < this.length).sort((a, b) => a - b); feedback = feedback[0] === -1 ? [-1] : feedback; - if (feedback.length === 0) { - throw new Error('Invalid empty feedback list'); - } - if (equalsDragFeedback(this.currentDragFeedback, feedback)) { return true; } @@ -859,7 +864,11 @@ export class ListView implements ISpliceable, IDisposable { if (feedback[0] === -1) { // entire list feedback DOM.addClass(this.domNode, 'drop-target'); - this.currentDragFeedbackDisposable = toDisposable(() => DOM.removeClass(this.domNode, 'drop-target')); + DOM.addClass(this.rowsContainer, 'drop-target'); + this.currentDragFeedbackDisposable = toDisposable(() => { + DOM.removeClass(this.domNode, 'drop-target'); + DOM.removeClass(this.rowsContainer, 'drop-target'); + }); } else { for (const index of feedback) { const item = this.items[index]!; @@ -910,12 +919,16 @@ export class ListView implements ISpliceable, IDisposable { this.dnd.drop(dragData, event.element, event.index, event.browserEvent); } - private onDragEnd(): void { + private onDragEnd(event: DragEvent): void { this.canDrop = false; this.teardownDragAndDropScrollTopAnimation(); this.clearDragOverFeedback(); this.currentDragData = undefined; StaticDND.CurrentDragAndDropData = undefined; + + if (this.dnd.onDragEnd) { + this.dnd.onDragEnd(event); + } } private clearDragOverFeedback(): void { diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index 65ff0de7f6e4e..aa3febf7c8539 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -702,16 +702,27 @@ export interface IAccessibilityProvider { * https://www.w3.org/TR/wai-aria/#aria-level */ getAriaLevel?(element: T): number | undefined; + + onDidChangeActiveDescendant?: Event; + getActiveDescendantId?(element: T): string | undefined; } export class DefaultStyleController implements IStyleController { - constructor(private styleElement: HTMLStyleElement, private selectorSuffix?: string) { } + constructor(private styleElement: HTMLStyleElement, private selectorSuffix: string) { } style(styles: IListStyles): void { - const suffix = this.selectorSuffix ? `.${this.selectorSuffix}` : ''; + const suffix = this.selectorSuffix && `.${this.selectorSuffix}`; const content: string[] = []; + if (styles.listBackground) { + if (styles.listBackground.isOpaque()) { + content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`); + } else if (!platform.isMacintosh) { // subpixel AA doesn't exist in macOS + console.warn(`List with id '${this.selectorSuffix}' was styled with a non-opaque background color. This will break sub-pixel antialiasing.`); + } + } + if (styles.listFocusBackground) { content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`); content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`); // overwrite :hover style in this case! @@ -788,6 +799,7 @@ export class DefaultStyleController implements IStyleController { if (styles.listDropBackground) { content.push(` .monaco-list${suffix}.drop-target, + .monaco-list${suffix} .monaco-list-rows.drop-target, .monaco-list${suffix} .monaco-list-row.drop-target { background-color: ${styles.listDropBackground} !important; color: inherit !important; } `); } @@ -815,7 +827,7 @@ export class DefaultStyleController implements IStyleController { } } -export interface IListOptions extends IListStyles { +export interface IListOptions { readonly identityProvider?: IIdentityProvider; readonly dnd?: IListDragAndDrop; readonly enableKeyboardNavigation?: boolean; @@ -828,13 +840,14 @@ export interface IListOptions extends IListStyles { readonly multipleSelectionSupport?: boolean; readonly multipleSelectionController?: IMultipleSelectionController; readonly openController?: IOpenController; - readonly styleController?: IStyleController; + readonly styleController?: (suffix: string) => IStyleController; readonly accessibilityProvider?: IAccessibilityProvider; // list view options readonly useShadows?: boolean; readonly verticalScrollMode?: ScrollbarVisibility; readonly setRowLineHeight?: boolean; + readonly setRowHeight?: boolean; readonly supportDynamicHeights?: boolean; readonly mouseSupport?: boolean; readonly horizontalScrolling?: boolean; @@ -842,6 +855,7 @@ export interface IListOptions extends IListStyles { } export interface IListStyles { + listBackground?: Color; listFocusBackground?: Color; listFocusForeground?: Color; listActiveSelectionBackground?: Color; @@ -1062,9 +1076,9 @@ class ListViewDragAndDrop implements IListViewDragAndDrop { return this.dnd.getDragURI(element); } - getDragLabel?(elements: T[]): string | undefined { + getDragLabel?(elements: T[], originalEvent: DragEvent): string | undefined { if (this.dnd.getDragLabel) { - return this.dnd.getDragLabel(elements); + return this.dnd.getDragLabel(elements, originalEvent); } return undefined; @@ -1080,6 +1094,12 @@ class ListViewDragAndDrop implements IListViewDragAndDrop { return this.dnd.onDragOver(data, targetElement, targetIndex, originalEvent); } + onDragEnd(originalEvent: DragEvent): void { + if (this.dnd.onDragEnd) { + this.dnd.onDragEnd(originalEvent); + } + } + drop(data: IDragAndDropData, targetElement: T, targetIndex: number, originalEvent: DragEvent): void { this.dnd.drop(data, targetElement, targetIndex, originalEvent); } @@ -1097,9 +1117,9 @@ export class List implements ISpliceable, IDisposable { private eventBufferer = new EventBufferer(); private view: ListView; private spliceable: ISpliceable; - private styleElement: HTMLStyleElement; private styleController: IStyleController; private typeLabelController?: TypeLabelController; + private accessibilityProvider?: IAccessibilityProvider; protected readonly disposables = new DisposableStore(); @@ -1185,8 +1205,14 @@ export class List implements ISpliceable, IDisposable { const baseRenderers: IListRenderer[] = [this.focus.renderer, this.selection.renderer]; - if (_options.accessibilityProvider) { - baseRenderers.push(new AccessibiltyRenderer(_options.accessibilityProvider)); + this.accessibilityProvider = _options.accessibilityProvider; + + if (this.accessibilityProvider) { + baseRenderers.push(new AccessibiltyRenderer(this.accessibilityProvider)); + + if (this.accessibilityProvider.onDidChangeActiveDescendant) { + this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant, this, this.disposables); + } } renderers = renderers.map(r => new PipelineRenderer(r.templateId, [...baseRenderers, r])); @@ -1204,9 +1230,12 @@ export class List implements ISpliceable, IDisposable { this.view.domNode.setAttribute('role', _options.ariaRole); } - this.styleElement = DOM.createStyleSheet(this.view.domNode); - - this.styleController = _options.styleController || new DefaultStyleController(this.styleElement, this.view.domId); + if (_options.styleController) { + this.styleController = _options.styleController(this.view.domId); + } else { + const styleElement = DOM.createStyleSheet(this.view.domNode); + this.styleController = new DefaultStyleController(styleElement, this.view.domId); + } this.spliceable = new CombinedSpliceable([ new TraitSpliceable(this.focus, this.view, _options.identityProvider), @@ -1243,8 +1272,6 @@ export class List implements ISpliceable, IDisposable { if (_options.ariaLabel) { this.view.domNode.setAttribute('aria-label', localize('aria list', "{0}. Use the navigation keys to navigate.", _options.ariaLabel)); } - - this.style(_options); } protected createMouseController(options: IListOptions): MouseController { @@ -1607,14 +1634,24 @@ export class List implements ISpliceable, IDisposable { private _onFocusChange(): void { const focus = this.focus.get(); + DOM.toggleClass(this.view.domNode, 'element-focused', focus.length > 0); + this.onDidChangeActiveDescendant(); + } + + private onDidChangeActiveDescendant(): void { + const focus = this.focus.get(); if (focus.length > 0) { - this.view.domNode.setAttribute('aria-activedescendant', this.view.getElementDomId(focus[0])); + let id: string | undefined; + + if (this.accessibilityProvider?.getActiveDescendantId) { + id = this.accessibilityProvider.getActiveDescendantId(this.view.element(focus[0])); + } + + this.view.domNode.setAttribute('aria-activedescendant', id || this.view.getElementDomId(focus[0])); } else { this.view.domNode.removeAttribute('aria-activedescendant'); } - - DOM.toggleClass(this.view.domNode, 'element-focused', focus.length > 0); } private _onSelectionChange(): void { diff --git a/src/vs/base/browser/ui/list/media/close-dark.svg b/src/vs/base/browser/ui/list/media/close-dark.svg deleted file mode 100644 index 7305a8f099ab2..0000000000000 --- a/src/vs/base/browser/ui/list/media/close-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/close-hc.svg b/src/vs/base/browser/ui/list/media/close-hc.svg deleted file mode 100644 index 7305a8f099ab2..0000000000000 --- a/src/vs/base/browser/ui/list/media/close-hc.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/close-light.svg b/src/vs/base/browser/ui/list/media/close-light.svg deleted file mode 100644 index ecddcd665b580..0000000000000 --- a/src/vs/base/browser/ui/list/media/close-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/filter-dark.svg b/src/vs/base/browser/ui/list/media/filter-dark.svg deleted file mode 100644 index 46c35f4374df7..0000000000000 --- a/src/vs/base/browser/ui/list/media/filter-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/filter-hc.svg b/src/vs/base/browser/ui/list/media/filter-hc.svg deleted file mode 100644 index d7b6bdd392343..0000000000000 --- a/src/vs/base/browser/ui/list/media/filter-hc.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/filter-light.svg b/src/vs/base/browser/ui/list/media/filter-light.svg deleted file mode 100644 index 2550d80cb700f..0000000000000 --- a/src/vs/base/browser/ui/list/media/filter-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/no-filter-dark.svg b/src/vs/base/browser/ui/list/media/no-filter-dark.svg deleted file mode 100644 index 6fc07d81a555c..0000000000000 --- a/src/vs/base/browser/ui/list/media/no-filter-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/no-filter-hc.svg b/src/vs/base/browser/ui/list/media/no-filter-hc.svg deleted file mode 100644 index 6fc07d81a555c..0000000000000 --- a/src/vs/base/browser/ui/list/media/no-filter-hc.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/list/media/no-filter-light.svg b/src/vs/base/browser/ui/list/media/no-filter-light.svg deleted file mode 100644 index 3608b15d29ebb..0000000000000 --- a/src/vs/base/browser/ui/list/media/no-filter-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/menu/check.svg b/src/vs/base/browser/ui/menu/check.svg deleted file mode 100644 index cea818ef5968a..0000000000000 --- a/src/vs/base/browser/ui/menu/check.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/menu/ellipsis.svg b/src/vs/base/browser/ui/menu/ellipsis.svg deleted file mode 100644 index 2c52e359f610d..0000000000000 --- a/src/vs/base/browser/ui/menu/ellipsis.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/vs/base/browser/ui/menu/menu.css b/src/vs/base/browser/ui/menu/menu.css index 9c3dde44785d6..1812044cd50e8 100644 --- a/src/vs/base/browser/ui/menu/menu.css +++ b/src/vs/base/browser/ui/menu/menu.css @@ -51,8 +51,17 @@ .monaco-menu .monaco-action-bar.vertical .submenu-indicator { height: 100%; - mask: url('submenu.svg') no-repeat 90% 50%/13px 13px; - -webkit-mask: url('submenu.svg') no-repeat 90% 50%/13px 13px; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon { + font-size: 16px !important; + display: flex; + align-items: center; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before { + margin-left: auto; + margin-right: -20px; } .monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding, @@ -94,14 +103,15 @@ .monaco-menu .monaco-action-bar.vertical .menu-item-check { position: absolute; visibility: hidden; - mask: url('check.svg') no-repeat 50% 56%/15px 15px; - -webkit-mask: url('check.svg') no-repeat 50% 56%/15px 15px; width: 1em; height: 100%; } .monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check { visibility: visible; + display: flex; + align-items: center; + justify-content: center; } /* Context Menu */ @@ -186,9 +196,6 @@ } .menubar .toolbar-toggle-more { - background-position: center; - background-repeat: no-repeat; - background-size: 14px; width: 20px; height: 100%; } @@ -197,21 +204,18 @@ position: absolute; left: 0px; top: 0px; - background-position: center; - background-repeat: no-repeat; - background-size: 16px; cursor: pointer; width: 100%; + display: flex; + align-items: center; + justify-content: center; } .menubar .toolbar-toggle-more { - display: inline-block; padding: 0; - mask: url('ellipsis.svg') no-repeat 50% 55%/14px 14px; - -webkit-mask: url('ellipsis.svg') no-repeat 50% 55%/14px 14px; + vertical-align: sub; } -.menubar.compact .toolbar-toggle-more { - mask: url('menu.svg') no-repeat 50% 55%/16px 16px; - -webkit-mask: url('menu.svg') no-repeat 50% 55%/16px 16px; +.menubar.compact .toolbar-toggle-more::before { + content: "\eb94" !important; } diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index affb18ccbe13e..0adbfe23b904d 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -6,10 +6,10 @@ import 'vs/css!./menu'; import * as nls from 'vs/nls'; import * as strings from 'vs/base/common/strings'; -import { IActionRunner, IAction, Action } from 'vs/base/common/actions'; +import { IActionRunner, IAction, Action, IActionViewItem } from 'vs/base/common/actions'; import { ActionBar, IActionViewItemProvider, ActionsOrientation, Separator, ActionViewItem, IActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes'; -import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses } from 'vs/base/browser/dom'; +import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses, clearNode } from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { RunOnceScheduler } from 'vs/base/common/async'; import { DisposableStore } from 'vs/base/common/lifecycle'; @@ -205,8 +205,8 @@ export class Menu extends ActionBar { container.appendChild(this.scrollableElement.getDomNode()); this.scrollableElement.scanDomNode(); - this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item: BaseMenuActionViewItem, index: number, array: any[]) => { - item.updatePositionInSet(index + 1, array.length); + this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item: IActionViewItem, index: number, array: any[]) => { + (item as BaseMenuActionViewItem).updatePositionInSet(index + 1, array.length); }); } @@ -422,7 +422,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem { } } - this.check = append(this.item, $('span.menu-item-check')); + this.check = append(this.item, $('span.menu-item-check.codicon.codicon-check')); this.check.setAttribute('role', 'none'); this.label = append(this.item, $('span.action-label')); @@ -464,7 +464,13 @@ class BaseMenuActionViewItem extends BaseActionViewItem { } updateLabel(): void { + if (!this.label) { + return; + } + if (this.options.label) { + clearNode(this.label); + let label = this.getAction().label; if (label) { const cleanLabel = cleanMnemonic(label); @@ -472,9 +478,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem { label = cleanLabel; } - if (this.label) { - this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&')); - } + this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&')); const matches = MENU_MNEMONIC_REGEX.exec(label); @@ -490,22 +494,25 @@ class BaseMenuActionViewItem extends BaseActionViewItem { escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label); } + const replaceDoubleEscapes = (str: string) => str.replace(/&&/g, '&'); + if (escMatch) { - label = `${label.substr(0, escMatch.index)}${label.substr(escMatch.index + escMatch[0].length)}`; + this.label.append( + strings.ltrim(replaceDoubleEscapes(label.substr(0, escMatch.index)), ' '), + $('u', { 'aria-hidden': 'true' }, + escMatch[3]), + strings.rtrim(replaceDoubleEscapes(label.substr(escMatch.index + escMatch[0].length)), ' ')); + } else { + this.label.innerText = replaceDoubleEscapes(label).trim(); } - label = label.replace(/&&/g, '&'); if (this.item) { this.item.setAttribute('aria-keyshortcuts', (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase()); } } else { - label = label.replace(/&&/g, '&'); + this.label.innerText = label.replace(/&&/g, '&').trim(); } } - - if (this.label) { - this.label.innerHTML = label.trim(); - } } } @@ -593,16 +600,16 @@ 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 bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : undefined; const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : ''; if (this.item) { - this.item.style.color = fgColor ? `${fgColor}` : null; - this.item.style.backgroundColor = bgColor ? `${bgColor}` : ''; + this.item.style.color = fgColor ? fgColor.toString() : ''; + this.item.style.backgroundColor = bgColor ? bgColor.toString() : ''; } if (this.check) { - this.check.style.backgroundColor = fgColor ? `${fgColor}` : ''; + this.check.style.color = fgColor ? fgColor.toString() : ''; } if (this.container) { @@ -661,8 +668,8 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { if (this.item) { addClass(this.item, 'monaco-submenu-item'); this.item.setAttribute('aria-haspopup', 'true'); - - this.submenuIndicator = append(this.item, $('span.submenu-indicator')); + this.updateAriaExpanded('false'); + this.submenuIndicator = append(this.item, $('span.submenu-indicator.codicon.codicon-chevron-right')); this.submenuIndicator.setAttribute('aria-hidden', 'true'); } @@ -726,7 +733,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { if (this.parentData.submenu && (force || (this.parentData.submenu !== this.mysubmenu))) { this.parentData.submenu.dispose(); this.parentData.submenu = undefined; - + this.updateAriaExpanded('false'); if (this.submenuContainer) { this.submenuDisposables.clear(); this.submenuContainer = undefined; @@ -740,6 +747,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { } if (!this.parentData.submenu) { + this.updateAriaExpanded('true'); this.submenuContainer = append(this.element, $('div.monaco-submenu')); addClasses(this.submenuContainer, 'menubar-menu-items-holder', 'context-view'); @@ -778,13 +786,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { this.parentData.parent.focus(); - if (this.parentData.submenu) { - this.parentData.submenu.dispose(); - this.parentData.submenu = undefined; - } - - this.submenuDisposables.clear(); - this.submenuContainer = undefined; + this.cleanupExistingSubmenu(true); } })); @@ -799,13 +801,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { this.submenuDisposables.add(this.parentData.submenu.onDidCancel(() => { this.parentData.parent.focus(); - if (this.parentData.submenu) { - this.parentData.submenu.dispose(); - this.parentData.submenu = undefined; - } - - this.submenuDisposables.clear(); - this.submenuContainer = undefined; + this.cleanupExistingSubmenu(true); })); this.parentData.submenu.focus(selectFirstItem); @@ -816,6 +812,12 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { } } + private updateAriaExpanded(value: string): void { + if (this.item) { + this.item?.setAttribute('aria-expanded', value); + } + } + protected applyStyle(): void { super.applyStyle(); @@ -827,7 +829,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; if (this.submenuIndicator) { - this.submenuIndicator.style.backgroundColor = fgColor ? `${fgColor}` : ''; + this.submenuIndicator.style.color = fgColor ? `${fgColor}` : ''; } if (this.parentData.submenu) { diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts index 925ebc3a53b94..fa92216ab124b 100644 --- a/src/vs/base/browser/ui/menu/menubar.ts +++ b/src/vs/base/browser/ui/menu/menubar.ts @@ -88,7 +88,7 @@ export class MenuBar extends Disposable { private numMenusShown: number = 0; private menuStyle: IMenuStyles | undefined; - private overflowLayoutScheduled: IDisposable | null = null; + private overflowLayoutScheduled: IDisposable | undefined = undefined; constructor(private container: HTMLElement, private options: IMenuBarOptions = {}) { super(); @@ -308,9 +308,10 @@ export class MenuBar extends Disposable { } createOverflowMenu(): void { - const label = this.options.compactMode !== undefined ? nls.localize('mAppMenu', 'Application Menu') : nls.localize('mMore', "..."); - const buttonElement = $('div.menubar-menu-button', { 'role': 'menuitem', 'tabindex': -1, 'aria-label': label, 'title': label, 'aria-haspopup': true }); - const titleElement = $('div.menubar-menu-title.toolbar-toggle-more', { 'role': 'none', 'aria-hidden': true }); + const label = this.options.compactMode !== undefined ? nls.localize('mAppMenu', 'Application Menu') : nls.localize('mMore', 'More'); + const title = this.options.compactMode !== undefined ? label : undefined; + const buttonElement = $('div.menubar-menu-button', { 'role': 'menuitem', 'tabindex': -1, 'aria-label': label, 'title': title, 'aria-haspopup': true }); + const titleElement = $('div.menubar-menu-title.toolbar-toggle-more.codicon.codicon-more', { 'role': 'none', 'aria-hidden': true }); buttonElement.appendChild(titleElement); this.container.appendChild(buttonElement); @@ -418,9 +419,8 @@ export class MenuBar extends Disposable { DOM.removeNode(this.overflowMenu.titleElement); DOM.removeNode(this.overflowMenu.buttonElement); - if (this.overflowLayoutScheduled) { - this.overflowLayoutScheduled = dispose(this.overflowLayoutScheduled); - } + dispose(this.overflowLayoutScheduled); + this.overflowLayoutScheduled = undefined; } blur(): void { @@ -560,7 +560,7 @@ export class MenuBar extends Disposable { if (!this.overflowLayoutScheduled) { this.overflowLayoutScheduled = DOM.scheduleAtNextAnimationFrame(() => { this.updateOverflowAction(); - this.overflowLayoutScheduled = null; + this.overflowLayoutScheduled = undefined; }); } @@ -910,7 +910,7 @@ export class MenuBar extends Disposable { return; } - const menuHolder = $('div.menubar-menu-items-holder'); + const menuHolder = $('div.menubar-menu-items-holder', { 'title': '' }); DOM.addClass(customMenu.buttonElement, 'open'); diff --git a/src/vs/base/browser/ui/menu/submenu.svg b/src/vs/base/browser/ui/menu/submenu.svg deleted file mode 100644 index 98a0aa5924add..0000000000000 --- a/src/vs/base/browser/ui/menu/submenu.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/progressbar/progressbar.css b/src/vs/base/browser/ui/progressbar/progressbar.css index 5d1e8b3f76258..64368d699b0f1 100644 --- a/src/vs/base/browser/ui/progressbar/progressbar.css +++ b/src/vs/base/browser/ui/progressbar/progressbar.css @@ -35,7 +35,7 @@ animation-duration: 4s; animation-iteration-count: infinite; animation-timing-function: linear; - will-change: transform; + transform: translate3d(0px, 0px, 0px); } /** diff --git a/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts b/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts index b1d48bc7cf824..6658a8ceedd90 100644 --- a/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +++ b/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts @@ -20,6 +20,7 @@ import { INewScrollPosition, Scrollable, ScrollbarVisibility } from 'vs/base/com const MOUSE_DRAG_RESET_DISTANCE = 140; export interface ISimplifiedMouseEvent { + buttons: number; posx: number; posy: number; } @@ -60,6 +61,7 @@ export abstract class AbstractScrollbar extends Widget { this._scrollable = opts.scrollable; this._scrollbarState = opts.scrollbarState; this._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName)); + this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()); this._mouseMoveMonitor = this._register(new GlobalMouseMoveMonitor()); this._shouldRender = true; this.domNode = createFastDomNode(document.createElement('div')); @@ -215,13 +217,15 @@ export abstract class AbstractScrollbar extends Widget { } } - private _sliderMouseDown(e: ISimplifiedMouseEvent, onDragFinished: () => void): void { + private _sliderMouseDown(e: IMouseEvent, onDragFinished: () => void): void { const initialMousePosition = this._sliderMousePosition(e); const initialMouseOrthogonalPosition = this._sliderOrthogonalMousePosition(e); const initialScrollbarState = this._scrollbarState.clone(); this.slider.toggleClassName('active', true); this._mouseMoveMonitor.startMonitoring( + e.target, + e.buttons, standardMouseMoveMerger, (mouseMoveData: IStandardMouseMoveEventData) => { const mouseOrthogonalPosition = this._sliderOrthogonalMousePosition(mouseMoveData); diff --git a/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts b/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts index 1c36edb215ab5..f68d4434b4d64 100644 --- a/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +++ b/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts @@ -13,13 +13,18 @@ import { INewScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from export class HorizontalScrollbar extends AbstractScrollbar { constructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) { + const scrollDimensions = scrollable.getScrollDimensions(); + const scrollPosition = scrollable.getCurrentScrollPosition(); super({ lazyRender: options.lazyRender, host: host, scrollbarState: new ScrollbarState( (options.horizontalHasArrows ? options.arrowSize : 0), (options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize), - (options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize) + (options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize), + scrollDimensions.width, + scrollDimensions.scrollWidth, + scrollPosition.scrollLeft ), visibility: options.horizontal, extraScrollbarClassName: 'horizontal', diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts index f7216dfdb1073..4c34a8bafcd6a 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts @@ -64,7 +64,7 @@ export class MouseWheelClassifier { return false; } - // 0.5 * last + 0.25 * before last + 0.125 * before before last + ... + // 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ... let remainingInfluence = 1; let score = 0; let iteration = 1; @@ -167,6 +167,9 @@ export abstract class AbstractScrollableElement extends Widget { private readonly _onScroll = this._register(new Emitter()); public readonly onScroll: Event = this._onScroll.event; + private readonly _onWillScroll = this._register(new Emitter()); + public readonly onWillScroll: Event = this._onWillScroll.event; + protected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) { super(); element.style.overflow = 'hidden'; @@ -174,6 +177,7 @@ export abstract class AbstractScrollableElement extends Widget { this._scrollable = scrollable; this._register(this._scrollable.onScroll((e) => { + this._onWillScroll.fire(e); this._onDidScroll(e); this._onScroll.fire(e); })); @@ -287,6 +291,7 @@ export abstract class AbstractScrollableElement extends Widget { this._options.handleMouseWheel = massagedOptions.handleMouseWheel; this._options.mouseWheelScrollSensitivity = massagedOptions.mouseWheelScrollSensitivity; this._options.fastScrollSensitivity = massagedOptions.fastScrollSensitivity; + this._options.scrollPredominantAxis = massagedOptions.scrollPredominantAxis; this._setListeningToMouseWheel(this._options.handleMouseWheel); if (!this._options.lazyRender) { @@ -317,7 +322,7 @@ export abstract class AbstractScrollableElement extends Widget { this._onMouseWheel(new StandardWheelEvent(browserEvent)); }; - this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel)); + this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false })); } } @@ -334,6 +339,14 @@ export abstract class AbstractScrollableElement extends Widget { let deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity; let deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity; + if (this._options.scrollPredominantAxis) { + if (Math.abs(deltaY) >= Math.abs(deltaX)) { + deltaX = 0; + } else { + deltaY = 0; + } + } + if (this._options.flipAxes) { [deltaY, deltaX] = [deltaX, deltaY]; } @@ -553,6 +566,7 @@ function resolveOptions(opts: ScrollableElementCreationOptions): ScrollableEleme scrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false), mouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1), fastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5), + scrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true), mouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true), arrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11), diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts b/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts index 7073bee8cb592..3979dfe5e1e84 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts @@ -55,6 +55,13 @@ export interface ScrollableElementCreationOptions { * Defaults to 5. */ fastScrollSensitivity?: number; + /** + * Whether the scrollable will only scroll along the predominant axis when scrolling both + * vertically and horizontally at the same time. + * Prevents horizontal drift when scrolling vertically on a trackpad. + * Defaults to true. + */ + scrollPredominantAxis?: boolean; /** * Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right). * Defaults to 11. @@ -113,6 +120,7 @@ export interface ScrollableElementChangeOptions { handleMouseWheel?: boolean; mouseWheelScrollSensitivity?: number; fastScrollSensitivity: number; + scrollPredominantAxis: boolean; } export interface ScrollableElementResolvedOptions { @@ -125,6 +133,7 @@ export interface ScrollableElementResolvedOptions { alwaysConsumeMouseWheel: boolean; mouseWheelScrollSensitivity: number; fastScrollSensitivity: number; + scrollPredominantAxis: boolean; mouseWheelSmoothScroll: boolean; arrowSize: number; listenOnDomNode: HTMLElement | null; diff --git a/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts b/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts index b174952d7ae3f..fcde58933bf54 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts @@ -93,6 +93,8 @@ export class ScrollbarArrow extends Widget { this._mousedownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200); this._mouseMoveMonitor.startMonitoring( + e.target, + e.buttons, standardMouseMoveMerger, (mouseMoveData: IStandardMouseMoveEventData) => { /* Intentional empty */ diff --git a/src/vs/base/browser/ui/scrollbar/scrollbarState.ts b/src/vs/base/browser/ui/scrollbar/scrollbarState.ts index edde3f8d1eed6..a3554658ecb6f 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollbarState.ts @@ -62,14 +62,14 @@ export class ScrollbarState { private _computedSliderRatio: number; private _computedSliderPosition: number; - constructor(arrowSize: number, scrollbarSize: number, oppositeScrollbarSize: number) { + constructor(arrowSize: number, scrollbarSize: number, oppositeScrollbarSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) { this._scrollbarSize = Math.round(scrollbarSize); this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize); this._arrowSize = Math.round(arrowSize); - this._visibleSize = 0; - this._scrollSize = 0; - this._scrollPosition = 0; + this._visibleSize = visibleSize; + this._scrollSize = scrollSize; + this._scrollPosition = scrollPosition; this._computedAvailableSize = 0; this._computedIsNeeded = false; @@ -81,11 +81,7 @@ export class ScrollbarState { } public clone(): ScrollbarState { - let r = new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize); - r.setVisibleSize(this._visibleSize); - r.setScrollSize(this._scrollSize); - r.setScrollPosition(this._scrollPosition); - return r; + return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition); } public setVisibleSize(visibleSize: number): boolean { diff --git a/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts b/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts index 8c1bb82823fe7..c974029acc2d1 100644 --- a/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +++ b/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts @@ -13,6 +13,8 @@ import { INewScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from export class VerticalScrollbar extends AbstractScrollbar { constructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) { + const scrollDimensions = scrollable.getScrollDimensions(); + const scrollPosition = scrollable.getCurrentScrollPosition(); super({ lazyRender: options.lazyRender, host: host, @@ -20,7 +22,10 @@ export class VerticalScrollbar extends AbstractScrollbar { (options.verticalHasArrows ? options.arrowSize : 0), (options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize), // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom - 0 + 0, + scrollDimensions.height, + scrollDimensions.scrollHeight, + scrollPosition.scrollTop ), visibility: options.vertical, extraScrollbarClassName: 'vertical', diff --git a/src/vs/base/browser/ui/selectBox/selectBox.ts b/src/vs/base/browser/ui/selectBox/selectBox.ts index c92601b96ba0f..cff14f50206bc 100644 --- a/src/vs/base/browser/ui/selectBox/selectBox.ts +++ b/src/vs/base/browser/ui/selectBox/selectBox.ts @@ -9,6 +9,7 @@ import { Event } from 'vs/base/common/event'; import { Widget } from 'vs/base/browser/ui/widget'; import { Color } from 'vs/base/common/color'; import { deepClone } from 'vs/base/common/objects'; +import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; import { SelectBoxNative } from 'vs/base/browser/ui/selectBox/selectBoxNative'; @@ -47,6 +48,7 @@ export interface ISelectOptionItem { decoratorRight?: string; description?: string; descriptionIsMarkdown?: boolean; + descriptionMarkdownActionHandler?: IContentActionHandler; isDisabled?: boolean; } diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index 7e6ee0f7f6ae6..07258ce3befb4 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -19,6 +19,7 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { ISelectBoxDelegate, ISelectOptionItem, ISelectBoxOptions, ISelectBoxStyles, ISelectData } from 'vs/base/browser/ui/selectBox/selectBox'; import { isMacintosh } from 'vs/base/common/platform'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; +import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer'; const $ = dom.$; @@ -748,11 +749,16 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi .filter(() => this.selectList.length > 0) .on(e => this.onMouseUp(e), this)); - - this._register(this.selectList.onDidBlur(_ => this.onListBlur())); this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index]))); this._register(this.selectList.onFocusChange(e => this.onListFocus(e))); + this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => { + if (!this._isVisible || dom.isAncestor(e.relatedTarget as HTMLElement, this.selectDropDownContainer)) { + return; + } + this.onListBlur(); + })); + this.selectList.getHTMLElement().setAttribute('aria-label', this.selectBoxOptions.ariaLabel || ''); this.selectList.getHTMLElement().setAttribute('aria-expanded', 'true'); @@ -823,7 +829,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi } - private renderDescriptionMarkdown(text: string): HTMLElement { + private renderDescriptionMarkdown(text: string, actionHandler?: IContentActionHandler): HTMLElement { const cleanRenderedMarkdown = (element: Node) => { for (let i = 0; i < element.childNodes.length; i++) { const child = element.childNodes.item(i); @@ -837,7 +843,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi } }; - const renderedMarkdown = renderMarkdown({ value: text }); + const renderedMarkdown = renderMarkdown({ value: text }, { actionHandler }); renderedMarkdown.classList.add('select-box-description-markdown'); cleanRenderedMarkdown(renderedMarkdown); @@ -859,7 +865,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi if (description) { if (descriptionIsMarkdown) { - this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description)); + const actionHandler = this.options[selectedIndex].descriptionMarkdownActionHandler; + this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description, actionHandler)); } else { this.selectionDetailsPane.innerText = description; } @@ -872,7 +879,6 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi this._skipLayout = true; this.contextViewProvider.layout(); this._skipLayout = false; - } // List keyboard controller diff --git a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts index 8c50b057fb53b..fc18c6d3b1880 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts @@ -10,6 +10,7 @@ import * as dom from 'vs/base/browser/dom'; import * as arrays from 'vs/base/common/arrays'; import { ISelectBoxDelegate, ISelectOptionItem, ISelectBoxOptions, ISelectBoxStyles, ISelectData } from 'vs/base/browser/ui/selectBox/selectBox'; import { isMacintosh } from 'vs/base/common/platform'; +import { Gesture, EventType } from 'vs/base/browser/touch'; export class SelectBoxNative extends Disposable implements ISelectBoxDelegate { @@ -43,6 +44,12 @@ export class SelectBoxNative extends Disposable implements ISelectBoxDelegate { } private registerListeners() { + this._register(Gesture.addTarget(this.selectElement)); + [EventType.Tap].forEach(eventType => { + this._register(dom.addDisposableListener(this.selectElement, eventType, (e) => { + this.selectElement.focus(); + })); + }); this._register(dom.addStandardDisposableListener(this.selectElement, 'change', (e) => { this.selectElement.title = e.target.value; diff --git a/src/vs/base/browser/ui/splitview/panelview.css b/src/vs/base/browser/ui/splitview/paneview.css similarity index 50% rename from src/vs/base/browser/ui/splitview/panelview.css rename to src/vs/base/browser/ui/splitview/paneview.css index ff3554c4227fd..c1397d6c62c5d 100644 --- a/src/vs/base/browser/ui/splitview/panelview.css +++ b/src/vs/base/browser/ui/splitview/paneview.css @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -.monaco-panel-view { +.monaco-pane-view { width: 100%; height: 100%; } -.monaco-panel-view .panel { +.monaco-pane-view .pane { overflow: hidden; width: 100%; height: 100%; @@ -16,7 +16,7 @@ flex-direction: column; } -.monaco-panel-view .panel > .panel-header { +.monaco-pane-view .pane > .pane-header { font-size: 11px; font-weight: bold; text-transform: uppercase; @@ -26,7 +26,7 @@ align-items: center; } -.monaco-panel-view .panel > .panel-header > .twisties { +.monaco-pane-view .pane > .pane-header > .twisties { width: 20px; display: flex; align-items: center; @@ -36,26 +36,26 @@ flex-shrink: 0; } -.monaco-panel-view .panel > .panel-header.expanded > .twisties::before { +.monaco-pane-view .pane > .pane-header.expanded > .twisties::before { transform: rotate(90deg); } -/* TODO: actions should be part of the panel, but they aren't yet */ -.monaco-panel-view .panel > .panel-header > .actions { +/* TODO: actions should be part of the pane, but they aren't yet */ +.monaco-pane-view .pane > .pane-header > .actions { display: none; flex: 1; } -/* TODO: actions should be part of the panel, but they aren't yet */ -.monaco-panel-view .panel:hover > .panel-header.expanded > .actions, -.monaco-panel-view .panel > .panel-header.actions-always-visible.expanded > .actions, -.monaco-panel-view .panel > .panel-header.focused.expanded > .actions { +/* TODO: actions should be part of the pane, but they aren't yet */ +.monaco-pane-view .pane:hover > .pane-header.expanded > .actions, +.monaco-pane-view .pane > .pane-header.actions-always-visible.expanded > .actions, +.monaco-pane-view .pane > .pane-header.focused.expanded > .actions { display: initial; } -/* TODO: actions should be part of the panel, but they aren't yet */ -.monaco-panel-view .panel > .panel-header > .actions .action-label.icon, -.monaco-panel-view .panel > .panel-header > .actions .action-label.codicon { +/* TODO: actions should be part of the pane, but they aren't yet */ +.monaco-pane-view .pane > .pane-header > .actions .action-label.icon, +.monaco-pane-view .pane > .pane-header > .actions .action-label.codicon { width: 28px; height: 22px; background-size: 16px; @@ -69,33 +69,33 @@ } /* Bold font style does not go well with CJK fonts */ -.monaco-panel-view:lang(zh-Hans) .panel > .panel-header, -.monaco-panel-view:lang(zh-Hant) .panel > .panel-header, -.monaco-panel-view:lang(ja) .panel > .panel-header, -.monaco-panel-view:lang(ko) .panel > .panel-header { +.monaco-pane-view:lang(zh-Hans) .pane > .pane-header, +.monaco-pane-view:lang(zh-Hant) .pane > .pane-header, +.monaco-pane-view:lang(ja) .pane > .pane-header, +.monaco-pane-view:lang(ko) .pane > .pane-header { font-weight: normal; } -.monaco-panel-view .panel > .panel-header.hidden { +.monaco-pane-view .pane > .pane-header.hidden { display: none; } -.monaco-panel-view .panel > .panel-body { +.monaco-pane-view .pane > .pane-body { overflow: hidden; flex: 1; } /* Animation */ -.monaco-panel-view.animated .split-view-view { +.monaco-pane-view.animated .split-view-view { transition-duration: 0.15s; transition-timing-function: ease-out; } -.monaco-panel-view.animated.vertical .split-view-view { +.monaco-pane-view.animated.vertical .split-view-view { transition-property: height; } -.monaco-panel-view.animated.horizontal .split-view-view { +.monaco-pane-view.animated.horizontal .split-view-view { transition-property: width; } diff --git a/src/vs/base/browser/ui/splitview/panelview.ts b/src/vs/base/browser/ui/splitview/paneview.ts similarity index 71% rename from src/vs/base/browser/ui/splitview/panelview.ts rename to src/vs/base/browser/ui/splitview/paneview.ts index 85d24c6bc7c72..037ffdce27b9c 100644 --- a/src/vs/base/browser/ui/splitview/panelview.ts +++ b/src/vs/base/browser/ui/splitview/paneview.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import 'vs/css!./panelview'; +import 'vs/css!./paneview'; import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Event, Emitter } from 'vs/base/common/event'; import { domEvent } from 'vs/base/browser/event'; @@ -16,14 +16,14 @@ import { SplitView, IView } from './splitview'; import { isFirefox } from 'vs/base/browser/browser'; import { DataTransfers } from 'vs/base/browser/dnd'; -export interface IPanelOptions { +export interface IPaneOptions { ariaHeaderLabel?: string; minimumBodySize?: number; maximumBodySize?: number; expanded?: boolean; } -export interface IPanelStyles { +export interface IPaneStyles { dropBackground?: Color; headerForeground?: Color; headerBackground?: Color; @@ -31,7 +31,7 @@ export interface IPanelStyles { } /** - * A Panel is a structured SplitView view. + * A Pane is a structured SplitView view. * * WARNING: You must call `render()` after you contruct it. * It can't be done automatically at the end of the ctor @@ -39,7 +39,7 @@ export interface IPanelStyles { * Subclasses wouldn't be able to set own properties * before the `render()` call, thus forbiding their use. */ -export abstract class Panel extends Disposable implements IView { +export abstract class Pane extends Disposable implements IView { private static readonly HEADER_SIZE = 22; @@ -54,7 +54,7 @@ export abstract class Panel extends Disposable implements IView { private _minimumBodySize: number; private _maximumBodySize: number; private ariaHeaderLabel: string; - private styles: IPanelStyles = {}; + private styles: IPaneStyles = {}; private animationTimer: number | undefined = undefined; private readonly _onDidChange = this._register(new Emitter()); @@ -95,7 +95,7 @@ export abstract class Panel extends Disposable implements IView { } private get headerSize(): number { - return this.headerVisible ? Panel.HEADER_SIZE : 0; + return this.headerVisible ? Pane.HEADER_SIZE : 0; } get minimumSize(): number { @@ -116,14 +116,14 @@ export abstract class Panel extends Disposable implements IView { width: number = 0; - constructor(options: IPanelOptions = {}) { + constructor(options: IPaneOptions = {}) { super(); this._expanded = typeof options.expanded === 'undefined' ? true : !!options.expanded; this.ariaHeaderLabel = options.ariaHeaderLabel || ''; this._minimumBodySize = typeof options.minimumBodySize === 'number' ? options.minimumBodySize : 120; this._maximumBodySize = typeof options.maximumBodySize === 'number' ? options.maximumBodySize : Number.POSITIVE_INFINITY; - this.element = $('.panel'); + this.element = $('.pane'); } isExpanded(): boolean { @@ -169,7 +169,7 @@ export abstract class Panel extends Disposable implements IView { } render(): void { - this.header = $('.panel-header'); + this.header = $('.pane-header'); append(this.element, this.header); this.header.setAttribute('tabindex', '0'); this.header.setAttribute('role', 'toolbar'); @@ -198,12 +198,12 @@ export abstract class Panel extends Disposable implements IView { this._register(domEvent(this.header, 'click') (() => this.setExpanded(!this.isExpanded()), null)); - this.body = append(this.element, $('.panel-body')); + this.body = append(this.element, $('.pane-body')); this.renderBody(this.body); } layout(height: number): void { - const headerSize = this.headerVisible ? Panel.HEADER_SIZE : 0; + const headerSize = this.headerVisible ? Pane.HEADER_SIZE : 0; if (this.isExpanded()) { this.layoutBody(height - headerSize, this.width); @@ -211,7 +211,7 @@ export abstract class Panel extends Disposable implements IView { } } - style(styles: IPanelStyles): void { + style(styles: IPaneStyles): void { this.styles = styles; if (!this.header) { @@ -230,7 +230,7 @@ export abstract class Panel extends Disposable implements IView { toggleClass(this.header, 'expanded', expanded); this.header.setAttribute('aria-expanded', String(expanded)); - this.header.style.color = this.styles.headerForeground ? this.styles.headerForeground.toString() : null; + this.header.style.color = this.styles.headerForeground ? this.styles.headerForeground.toString() : ''; 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; @@ -242,31 +242,31 @@ export abstract class Panel extends Disposable implements IView { } interface IDndContext { - draggable: PanelDraggable | null; + draggable: PaneDraggable | null; } -class PanelDraggable extends Disposable { +class PaneDraggable extends Disposable { private static readonly DefaultDragOverBackgroundColor = new Color(new RGBA(128, 128, 128, 0.5)); private dragOverCounter = 0; // see https://github.com/Microsoft/vscode/issues/14470 - private _onDidDrop = this._register(new Emitter<{ from: Panel, to: Panel }>()); + private _onDidDrop = this._register(new Emitter<{ from: Pane, to: Pane }>()); readonly onDidDrop = this._onDidDrop.event; - constructor(private panel: Panel, private dnd: IPanelDndController, private context: IDndContext) { + constructor(private pane: Pane, private dnd: IPaneDndController, private context: IDndContext) { super(); - panel.draggableElement.draggable = true; - this._register(domEvent(panel.draggableElement, 'dragstart')(this.onDragStart, this)); - this._register(domEvent(panel.dropTargetElement, 'dragenter')(this.onDragEnter, this)); - this._register(domEvent(panel.dropTargetElement, 'dragleave')(this.onDragLeave, this)); - this._register(domEvent(panel.dropTargetElement, 'dragend')(this.onDragEnd, this)); - this._register(domEvent(panel.dropTargetElement, 'drop')(this.onDrop, this)); + pane.draggableElement.draggable = true; + this._register(domEvent(pane.draggableElement, 'dragstart')(this.onDragStart, this)); + this._register(domEvent(pane.dropTargetElement, 'dragenter')(this.onDragEnter, this)); + this._register(domEvent(pane.dropTargetElement, 'dragleave')(this.onDragLeave, this)); + this._register(domEvent(pane.dropTargetElement, 'dragend')(this.onDragEnd, this)); + this._register(domEvent(pane.dropTargetElement, 'drop')(this.onDrop, this)); } private onDragStart(e: DragEvent): void { - if (!this.dnd.canDrag(this.panel) || !e.dataTransfer) { + if (!this.dnd.canDrag(this.pane) || !e.dataTransfer) { e.preventDefault(); e.stopPropagation(); return; @@ -276,10 +276,10 @@ class PanelDraggable extends Disposable { if (isFirefox) { // Firefox: requires to set a text data transfer to get going - e.dataTransfer?.setData(DataTransfers.TEXT, this.panel.draggableElement.textContent || ''); + e.dataTransfer?.setData(DataTransfers.TEXT, this.pane.draggableElement.textContent || ''); } - const dragImage = append(document.body, $('.monaco-drag-image', {}, this.panel.draggableElement.textContent || '')); + const dragImage = append(document.body, $('.monaco-drag-image', {}, this.pane.draggableElement.textContent || '')); e.dataTransfer.setDragImage(dragImage, -10, -10); setTimeout(() => document.body.removeChild(dragImage), 0); @@ -291,7 +291,7 @@ class PanelDraggable extends Disposable { return; } - if (!this.dnd.canDrop(this.context.draggable.panel, this.panel)) { + if (!this.dnd.canDrop(this.context.draggable.pane, this.pane)) { return; } @@ -304,7 +304,7 @@ class PanelDraggable extends Disposable { return; } - if (!this.dnd.canDrop(this.context.draggable.panel, this.panel)) { + if (!this.dnd.canDrop(this.context.draggable.pane, this.pane)) { return; } @@ -335,8 +335,8 @@ class PanelDraggable extends Disposable { this.dragOverCounter = 0; this.render(); - if (this.dnd.canDrop(this.context.draggable.panel, this.panel) && this.context.draggable !== this) { - this._onDidDrop.fire({ from: this.context.draggable.panel, to: this.panel }); + if (this.dnd.canDrop(this.context.draggable.pane, this.pane) && this.context.draggable !== this) { + this._onDidDrop.fire({ from: this.context.draggable.pane, to: this.pane }); } this.context.draggable = null; @@ -346,106 +346,106 @@ class PanelDraggable extends Disposable { let backgroundColor: string | null = null; if (this.dragOverCounter > 0) { - backgroundColor = (this.panel.dropBackground || PanelDraggable.DefaultDragOverBackgroundColor).toString(); + backgroundColor = (this.pane.dropBackground || PaneDraggable.DefaultDragOverBackgroundColor).toString(); } - this.panel.dropTargetElement.style.backgroundColor = backgroundColor || ''; + this.pane.dropTargetElement.style.backgroundColor = backgroundColor || ''; } } -export interface IPanelDndController { - canDrag(panel: Panel): boolean; - canDrop(panel: Panel, overPanel: Panel): boolean; +export interface IPaneDndController { + canDrag(pane: Pane): boolean; + canDrop(pane: Pane, overPane: Pane): boolean; } -export class DefaultPanelDndController implements IPanelDndController { +export class DefaultPaneDndController implements IPaneDndController { - canDrag(panel: Panel): boolean { + canDrag(pane: Pane): boolean { return true; } - canDrop(panel: Panel, overPanel: Panel): boolean { + canDrop(pane: Pane, overPane: Pane): boolean { return true; } } -export interface IPanelViewOptions { - dnd?: IPanelDndController; +export interface IPaneViewOptions { + dnd?: IPaneDndController; } -interface IPanelItem { - panel: Panel; +interface IPaneItem { + pane: Pane; disposable: IDisposable; } -export class PanelView extends Disposable { +export class PaneView extends Disposable { - private dnd: IPanelDndController | undefined; + private dnd: IPaneDndController | undefined; private dndContext: IDndContext = { draggable: null }; private el: HTMLElement; - private panelItems: IPanelItem[] = []; + private paneItems: IPaneItem[] = []; private width: number = 0; private splitview: SplitView; private animationTimer: number | undefined = undefined; - private _onDidDrop = this._register(new Emitter<{ from: Panel, to: Panel }>()); - readonly onDidDrop: Event<{ from: Panel, to: Panel }> = this._onDidDrop.event; + private _onDidDrop = this._register(new Emitter<{ from: Pane, to: Pane }>()); + readonly onDidDrop: Event<{ from: Pane, to: Pane }> = this._onDidDrop.event; readonly onDidSashChange: Event; - constructor(container: HTMLElement, options: IPanelViewOptions = {}) { + constructor(container: HTMLElement, options: IPaneViewOptions = {}) { super(); this.dnd = options.dnd; - this.el = append(container, $('.monaco-panel-view')); + this.el = append(container, $('.monaco-pane-view')); this.splitview = this._register(new SplitView(this.el)); this.onDidSashChange = this.splitview.onDidSashChange; } - addPanel(panel: Panel, size: number, index = this.splitview.length): void { + addPane(pane: Pane, size: number, index = this.splitview.length): void { const disposables = new DisposableStore(); - panel.onDidChangeExpansionState(this.setupAnimation, this, disposables); + pane.onDidChangeExpansionState(this.setupAnimation, this, disposables); - const panelItem = { panel, disposable: disposables }; - this.panelItems.splice(index, 0, panelItem); - panel.width = this.width; - this.splitview.addView(panel, size, index); + const paneItem = { pane: pane, disposable: disposables }; + this.paneItems.splice(index, 0, paneItem); + pane.width = this.width; + this.splitview.addView(pane, size, index); if (this.dnd) { - const draggable = new PanelDraggable(panel, this.dnd, this.dndContext); + const draggable = new PaneDraggable(pane, this.dnd, this.dndContext); disposables.add(draggable); disposables.add(draggable.onDidDrop(this._onDidDrop.fire, this._onDidDrop)); } } - removePanel(panel: Panel): void { - const index = firstIndex(this.panelItems, item => item.panel === panel); + removePane(pane: Pane): void { + const index = firstIndex(this.paneItems, item => item.pane === pane); if (index === -1) { return; } this.splitview.removeView(index); - const panelItem = this.panelItems.splice(index, 1)[0]; - panelItem.disposable.dispose(); + const paneItem = this.paneItems.splice(index, 1)[0]; + paneItem.disposable.dispose(); } - movePanel(from: Panel, to: Panel): void { - const fromIndex = firstIndex(this.panelItems, item => item.panel === from); - const toIndex = firstIndex(this.panelItems, item => item.panel === to); + movePane(from: Pane, to: Pane): void { + const fromIndex = firstIndex(this.paneItems, item => item.pane === from); + const toIndex = firstIndex(this.paneItems, item => item.pane === to); if (fromIndex === -1 || toIndex === -1) { return; } - const [panelItem] = this.panelItems.splice(fromIndex, 1); - this.panelItems.splice(toIndex, 0, panelItem); + const [paneItem] = this.paneItems.splice(fromIndex, 1); + this.paneItems.splice(toIndex, 0, paneItem); this.splitview.moveView(fromIndex, toIndex); } - resizePanel(panel: Panel, size: number): void { - const index = firstIndex(this.panelItems, item => item.panel === panel); + resizePane(pane: Pane, size: number): void { + const index = firstIndex(this.paneItems, item => item.pane === pane); if (index === -1) { return; @@ -454,8 +454,8 @@ export class PanelView extends Disposable { this.splitview.resizeView(index, size); } - getPanelSize(panel: Panel): number { - const index = firstIndex(this.panelItems, item => item.panel === panel); + getPaneSize(pane: Pane): number { + const index = firstIndex(this.paneItems, item => item.pane === pane); if (index === -1) { return -1; @@ -467,8 +467,8 @@ export class PanelView extends Disposable { layout(height: number, width: number): void { this.width = width; - for (const panelItem of this.panelItems) { - panelItem.panel.width = width; + for (const paneItem of this.paneItems) { + paneItem.pane.width = width; } this.splitview.layout(height); @@ -490,6 +490,6 @@ export class PanelView extends Disposable { dispose(): void { super.dispose(); - this.panelItems.forEach(i => i.disposable.dispose()); + this.paneItems.forEach(i => i.disposable.dispose()); } } diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 8b9333782667b..6bca3b4ec7bf1 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -23,14 +23,14 @@ const defaultStyles: ISplitViewStyles = { separatorBorder: Color.transparent }; -export interface ISplitViewOptions { +export interface ISplitViewOptions { readonly orientation?: Orientation; // default Orientation.VERTICAL readonly styles?: ISplitViewStyles; readonly orthogonalStartSash?: Sash; readonly orthogonalEndSash?: Sash; readonly inverseAltBehavior?: boolean; readonly proportionalLayout?: boolean; // default true, - readonly descriptor?: ISplitViewDescriptor; + readonly descriptor?: ISplitViewDescriptor; } /** @@ -42,14 +42,14 @@ export const enum LayoutPriority { High } -export interface IView { +export interface IView { readonly element: HTMLElement; readonly minimumSize: number; readonly maximumSize: number; readonly onDidChange: Event; readonly priority?: LayoutPriority; readonly snap?: boolean; - layout(size: number, orthogonalSize: number | undefined): void; + layout(size: number, offset: number, context: TLayoutContext | undefined): void; setVisible?(visible: boolean): void; } @@ -62,7 +62,7 @@ interface ISashEvent { type ViewItemSize = number | { cachedVisibleSize: number }; -abstract class ViewItem { +abstract class ViewItem { private _size: number; set size(size: number) { @@ -109,9 +109,13 @@ abstract class ViewItem { get priority(): LayoutPriority | undefined { return this.view.priority; } get snap(): boolean { return !!this.view.snap; } + set enabled(enabled: boolean) { + this.container.style.pointerEvents = enabled ? null : 'none'; + } + constructor( protected container: HTMLElement, - private view: IView, + private view: IView, size: ViewItemSize, private disposable: IDisposable ) { @@ -125,31 +129,31 @@ abstract class ViewItem { } } - layout(position: number, orthogonalSize: number | undefined): void { - this.layoutContainer(position); - this.view.layout(this.size, orthogonalSize); + layout(offset: number, layoutContext: TLayoutContext | undefined): void { + this.layoutContainer(offset); + this.view.layout(this.size, offset, layoutContext); } - abstract layoutContainer(position: number): void; + abstract layoutContainer(offset: number): void; - dispose(): IView { + dispose(): IView { this.disposable.dispose(); return this.view; } } -class VerticalViewItem extends ViewItem { +class VerticalViewItem extends ViewItem { - layoutContainer(position: number): void { - this.container.style.top = `${position}px`; + layoutContainer(offset: number): void { + this.container.style.top = `${offset}px`; this.container.style.height = `${this.size}px`; } } -class HorizontalViewItem extends ViewItem { +class HorizontalViewItem extends ViewItem { - layoutContainer(position: number): void { - this.container.style.left = `${position}px`; + layoutContainer(offset: number): void { + this.container.style.left = `${offset}px`; this.container.style.width = `${this.size}px`; } } @@ -194,26 +198,26 @@ export namespace Sizing { export function Invisible(cachedVisibleSize: number): InvisibleSizing { return { type: 'invisible', cachedVisibleSize }; } } -export interface ISplitViewDescriptor { +export interface ISplitViewDescriptor { size: number; views: { visible?: boolean; size: number; - view: IView; + view: IView; }[]; } -export class SplitView extends Disposable { +export class SplitView extends Disposable { readonly orientation: Orientation; readonly el: HTMLElement; private sashContainer: HTMLElement; private viewContainer: HTMLElement; private size = 0; - private orthogonalSize: number | undefined; + private layoutContext: TLayoutContext | undefined; private contentSize = 0; private proportions: undefined | number[] = undefined; - private viewItems: ViewItem[] = []; + private viewItems: ViewItem[] = []; private sashItems: ISashItem[] = []; private sashDragState: ISashDragState | undefined; private state: State = State.Idle; @@ -262,7 +266,29 @@ export class SplitView extends Disposable { return this.sashItems.map(s => s.sash); } - constructor(container: HTMLElement, options: ISplitViewOptions = {}) { + private _startSnappingEnabled = true; + get startSnappingEnabled(): boolean { return this._startSnappingEnabled; } + set startSnappingEnabled(startSnappingEnabled: boolean) { + if (this._startSnappingEnabled === startSnappingEnabled) { + return; + } + + this._startSnappingEnabled = startSnappingEnabled; + this.updateSashEnablement(); + } + + private _endSnappingEnabled = true; + get endSnappingEnabled(): boolean { return this._endSnappingEnabled; } + set endSnappingEnabled(endSnappingEnabled: boolean) { + if (this._endSnappingEnabled === endSnappingEnabled) { + return; + } + + this._endSnappingEnabled = endSnappingEnabled; + this.updateSashEnablement(); + } + + constructor(container: HTMLElement, options: ISplitViewOptions = {}) { super(); this.orientation = types.isUndefined(options.orientation) ? Orientation.VERTICAL : options.orientation; @@ -305,11 +331,11 @@ export class SplitView extends Disposable { } } - addView(view: IView, size: number | Sizing, index = this.viewItems.length): void { + addView(view: IView, size: number | Sizing, index = this.viewItems.length): void { this.doAddView(view, size, index, false); } - removeView(index: number, sizing?: Sizing): IView { + removeView(index: number, sizing?: Sizing): IView { if (this.state !== State.Idle) { throw new Error('Cant modify splitview'); } @@ -401,10 +427,10 @@ export class SplitView extends Disposable { return viewItem.cachedVisibleSize; } - layout(size: number, orthogonalSize?: number): void { + layout(size: number, layoutContext?: TLayoutContext): void { const previousSize = Math.max(this.size, this.contentSize); this.size = size; - this.orthogonalSize = orthogonalSize; + this.layoutContext = layoutContext; if (!this.proportions) { const indexes = range(this.viewItems.length); @@ -430,6 +456,10 @@ export class SplitView extends Disposable { } private onSashStart({ sash, start, alt }: ISashEvent): void { + for (const item of this.viewItems) { + item.enabled = false; + } + const index = firstIndex(this.sashItems, item => item.sash === sash); // This way, we can press Alt while we resize a sash, macOS style! @@ -535,9 +565,13 @@ export class SplitView extends Disposable { this._onDidSashChange.fire(index); this.sashDragState!.disposable.dispose(); this.saveProportions(); + + for (const item of this.viewItems) { + item.enabled = true; + } } - private onViewChange(item: ViewItem, size: number | undefined): void { + private onViewChange(item: ViewItem, size: number | undefined): void { const index = this.viewItems.indexOf(item); if (index < 0 || index >= this.viewItems.length) { @@ -584,7 +618,7 @@ export class SplitView extends Disposable { } distributeViewSizes(): void { - const flexibleViewItems: ViewItem[] = []; + const flexibleViewItems: ViewItem[] = []; let flexibleSize = 0; for (const item of this.viewItems) { @@ -615,7 +649,7 @@ export class SplitView extends Disposable { return this.viewItems[index].size; } - private doAddView(view: IView, size: number | Sizing, index = this.viewItems.length, skipLayout?: boolean): void { + private doAddView(view: IView, size: number | Sizing, index = this.viewItems.length, skipLayout?: boolean): void { if (this.state !== State.Idle) { throw new Error('Cant modify splitview'); } @@ -849,17 +883,19 @@ export class SplitView extends Disposable { this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); // Layout views - let position = 0; + let offset = 0; for (const viewItem of this.viewItems) { - viewItem.layout(position, this.orthogonalSize); - position += viewItem.size; + viewItem.layout(offset, this.layoutContext); + offset += viewItem.size; } // Layout sashes this.sashItems.forEach(item => item.sash.layout()); + this.updateSashEnablement(); + } - // Update sashes enablement + private updateSashEnablement(): void { let previous = false; const collapsesDown = this.viewItems.map(i => previous = (i.size - i.minimumSize > 0) || previous); @@ -873,7 +909,12 @@ export class SplitView extends Disposable { previous = false; const expandsUp = reverseViews.map(i => previous = (i.maximumSize - i.size > 0) || previous).reverse(); - this.sashItems.forEach(({ sash }, index) => { + let position = 0; + for (let index = 0; index < this.sashItems.length; index++) { + const { sash } = this.sashItems[index]; + const viewItem = this.viewItems[index]; + position += viewItem.size; + const min = !(collapsesDown[index] && expandsUp[index + 1]); const max = !(expandsDown[index] && collapsesUp[index + 1]); @@ -886,9 +927,9 @@ export class SplitView extends Disposable { const snappedBefore = typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible; const snappedAfter = typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible; - if (snappedBefore && collapsesUp[index]) { + if (snappedBefore && collapsesUp[index] && (position > 0 || this.startSnappingEnabled)) { sash.state = SashState.Minimum; - } else if (snappedAfter && collapsesDown[index]) { + } else if (snappedAfter && collapsesDown[index] && (position < this.contentSize || this.endSnappingEnabled)) { sash.state = SashState.Maximum; } else { sash.state = SashState.Disabled; @@ -900,8 +941,7 @@ export class SplitView extends Disposable { } else { sash.state = SashState.Enabled; } - // } - }); + } } private getSashPosition(sash: Sash): number { diff --git a/src/vs/base/browser/ui/toolbar/toolbar.ts b/src/vs/base/browser/ui/toolbar/toolbar.ts index 3e13d9ce66d0d..846e156dfa305 100644 --- a/src/vs/base/browser/ui/toolbar/toolbar.ts +++ b/src/vs/base/browser/ui/toolbar/toolbar.ts @@ -52,7 +52,7 @@ export class ToolBar extends Disposable { orientation: options.orientation, ariaLabel: options.ariaLabel, actionRunner: options.actionRunner, - actionViewItemProvider: (action: Action) => { + actionViewItemProvider: (action: IAction) => { // Return special action item for the toggle menu action if (action.id === ToggleMenuAction.ID) { diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index f47c7cf804f52..9e584efcc560d 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -27,10 +27,24 @@ import { clamp } from 'vs/base/common/numbers'; import { ScrollEvent } from 'vs/base/common/scrollable'; import { SetMap } from 'vs/base/common/collections'; +class TreeElementsDragAndDropData extends ElementsDragAndDropData { + + set context(context: TContext | undefined) { + this.data.context = context; + } + + get context(): TContext | undefined { + return this.data.context; + } + + constructor(private data: ElementsDragAndDropData, TContext>) { + super(data.elements.map(node => node.element)); + } +} + function asTreeDragAndDropData(data: IDragAndDropData): IDragAndDropData { if (data instanceof ElementsDragAndDropData) { - const nodes = (data as ElementsDragAndDropData>).elements; - return new ElementsDragAndDropData(nodes.map(node => node.element)); + return new TreeElementsDragAndDropData(data); } return data; @@ -47,9 +61,9 @@ class TreeNodeListDragAndDrop implements IListDragAndDrop< return this.dnd.getDragURI(node.element); } - getDragLabel(nodes: ITreeNode[]): string | undefined { + getDragLabel(nodes: ITreeNode[], originalEvent: DragEvent): string | undefined { if (this.dnd.getDragLabel) { - return this.dnd.getDragLabel(nodes.map(node => node.element)); + return this.dnd.getDragLabel(nodes.map(node => node.element), originalEvent); } return undefined; @@ -87,7 +101,7 @@ class TreeNodeListDragAndDrop implements IListDragAndDrop< }, 500); } - if (typeof result === 'boolean' || !result.accept || typeof result.bubble === 'undefined') { + if (typeof result === 'boolean' || !result.accept || typeof result.bubble === 'undefined' || result.feedback) { if (!raw) { const accept = typeof result === 'boolean' ? result : result.accept; const effect = typeof result === 'boolean' ? undefined : result.effect; @@ -121,6 +135,12 @@ class TreeNodeListDragAndDrop implements IListDragAndDrop< this.dnd.drop(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, originalEvent); } + + onDragEnd(originalEvent: DragEvent): void { + if (this.dnd.onDragEnd) { + this.dnd.onDragEnd(originalEvent); + } + } } function asListOptions(modelProvider: () => ITreeModel, options?: IAbstractTreeOptions): IListOptions> | undefined { @@ -141,12 +161,16 @@ function asListOptions(modelProvider: () => ITreeModel { + return options.accessibilityProvider!.getActiveDescendantId!(node.element); + }) }, keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && { ...options.keyboardNavigationLabelProvider, @@ -166,7 +190,13 @@ function asListOptions(modelProvider: () => ITreeModel { + return options.ariaProvider!.isChecked!(node.element); + } : undefined, + getRole: options.ariaProvider && options.ariaProvider.getRole ? (node) => { + return options.ariaProvider!.getRole!(node.element); + } : undefined } }; } @@ -316,7 +346,7 @@ class TreeRenderer implements IListRenderer } const indent = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent; - templateData.twistie.style.marginLeft = `${indent}px`; + templateData.twistie.style.paddingLeft = `${indent}px`; templateData.indent.style.width = `${indent + this.indent - 16}px`; this.renderTwistie(node, templateData); @@ -614,14 +644,14 @@ class TypeFilterController implements IDisposable { const controls = append(this.domNode, $('.controls')); this._filterOnType = !!tree.options.filterOnType; - this.filterOnTypeDomNode = append(controls, $('input.filter')); + this.filterOnTypeDomNode = append(controls, $('input.filter.codicon.codicon-list-selection')); this.filterOnTypeDomNode.type = 'checkbox'; this.filterOnTypeDomNode.checked = this._filterOnType; this.filterOnTypeDomNode.tabIndex = -1; this.updateFilterOnTypeTitle(); domEvent(this.filterOnTypeDomNode, 'input')(this.onDidChangeFilterOnType, this, this.disposables); - this.clearDomNode = append(controls, $('button.clear')); + this.clearDomNode = append(controls, $('button.clear.codicon.codicon-close')); this.clearDomNode.tabIndex = -1; this.clearDomNode.title = localize('clear', "Clear"); @@ -1274,7 +1304,7 @@ export abstract class AbstractTree implements IDisposable onDidModelSplice(() => null, null, this.disposables); // Active nodes can change when the model changes or when focus or selection change. - // We debouce it with 0 delay since these events may fire in the same stack and we only + // We debounce it with 0 delay since these events may fire in the same stack and we only // want to run this once. It also doesn't matter if it runs on the next tick since it's only // a nice to have UI feature. onDidChangeActiveNodes.input = Event.chain(Event.any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange)) @@ -1397,8 +1427,13 @@ export abstract class AbstractTree implements IDisposable return this.view.renderHeight; } - get firstVisibleElement(): T { + get firstVisibleElement(): T | undefined { const index = this.view.firstVisibleIndex; + + if (index < 0 || index >= this.view.length) { + return undefined; + } + const node = this.view.element(index); return node.element; } @@ -1550,7 +1585,7 @@ export abstract class AbstractTree implements IDisposable } open(elements: TRef[], browserEvent?: UIEvent): void { - const indexes = elements.map(e => this.model.getListIndex(e)); + const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i >= 0); this.view.open(indexes, browserEvent); } diff --git a/src/vs/base/browser/ui/tree/asyncDataTree.ts b/src/vs/base/browser/ui/tree/asyncDataTree.ts index 19c5c94724fa9..6ddb3fe5cb80b 100644 --- a/src/vs/base/browser/ui/tree/asyncDataTree.ts +++ b/src/vs/base/browser/ui/tree/asyncDataTree.ts @@ -6,7 +6,7 @@ import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate } from 'vs/base/browser/ui/tree/abstractTree'; import { ObjectTree, IObjectTreeOptions, 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 { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop, TreeError, WeakMapper, ITreeFilter, TreeVisibility, TreeFilterResult } from 'vs/base/browser/ui/tree/tree'; 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'; @@ -20,6 +20,7 @@ import { values } from 'vs/base/common/map'; import { ScrollEvent } from 'vs/base/common/scrollable'; import { ICompressedTreeNode, ICompressedTreeElement } from 'vs/base/browser/ui/tree/compressedObjectTreeModel'; import { IThemable } from 'vs/base/common/styler'; +import { isFilterResult, getVisibleState } from 'vs/base/browser/ui/tree/indexTreeModel'; interface IAsyncDataTreeNode { element: TInput | T; @@ -127,14 +128,14 @@ class AsyncDataTreeRenderer implements IT } } -function asTreeEvent(e: ITreeEvent>): ITreeEvent { +function asTreeEvent(e: ITreeEvent | null>): ITreeEvent { return { browserEvent: e.browserEvent, - elements: e.elements.map(e => e.element as T) + elements: e.elements.map(e => e!.element as T) }; } -function asTreeMouseEvent(e: ITreeMouseEvent>): ITreeMouseEvent { +function asTreeMouseEvent(e: ITreeMouseEvent | null>): ITreeMouseEvent { return { browserEvent: e.browserEvent, element: e.element && e.element.element as T, @@ -142,7 +143,7 @@ function asTreeMouseEvent(e: ITreeMouseEvent(e: ITreeContextMenuEvent>): ITreeContextMenuEvent { +function asTreeContextMenuEvent(e: ITreeContextMenuEvent | null>): ITreeContextMenuEvent { return { browserEvent: e.browserEvent, element: e.element && e.element.element as T, @@ -150,10 +151,24 @@ function asTreeContextMenuEvent(e: ITreeContextMenuEvent extends ElementsDragAndDropData { + + set context(context: TContext | undefined) { + this.data.context = context; + } + + get context(): TContext | undefined { + return this.data.context; + } + + constructor(private data: ElementsDragAndDropData, TContext>) { + super(data.elements.map(node => node.element as T)); + } +} + function asAsyncDataTreeDragAndDropData(data: IDragAndDropData): IDragAndDropData { if (data instanceof ElementsDragAndDropData) { - const nodes = (data as ElementsDragAndDropData>).elements; - return new ElementsDragAndDropData(nodes.map(node => node.element)); + return new AsyncDataTreeElementsDragAndDropData(data); } return data; @@ -167,9 +182,9 @@ class AsyncDataTreeNodeListDragAndDrop implements IListDragAndDrop[]): string | undefined { + getDragLabel(nodes: IAsyncDataTreeNode[], originalEvent: DragEvent): string | undefined { if (this.dnd.getDragLabel) { - return this.dnd.getDragLabel(nodes.map(node => node.element as T)); + return this.dnd.getDragLabel(nodes.map(node => node.element as T), originalEvent); } return undefined; @@ -188,6 +203,12 @@ class AsyncDataTreeNodeListDragAndDrop implements IListDragAndDrop | undefined, targetIndex: number | undefined, originalEvent: DragEvent): void { this.dnd.drop(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element as T, targetIndex, originalEvent); } + + onDragEnd(originalEvent: DragEvent): void { + if (this.dnd.onDragEnd) { + this.dnd.onDragEnd(originalEvent); + } + } } function asObjectTreeOptions(options?: IAsyncDataTreeOptions): IObjectTreeOptions, TFilterData> | undefined { @@ -209,9 +230,16 @@ function asObjectTreeOptions(options?: IAsyncDataTreeOpt } }, accessibilityProvider: options.accessibilityProvider && { + ...options.accessibilityProvider, getAriaLabel(e) { return options.accessibilityProvider!.getAriaLabel(e.element as T); - } + }, + getAriaLevel: options.accessibilityProvider!.getAriaLevel && (node => { + return options.accessibilityProvider!.getAriaLevel!(node.element as T); + }), + getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => { + return options.accessibilityProvider!.getActiveDescendantId!(node.element as T); + }) }, filter: options.filter && { filter(e, parentVisibility) { @@ -230,7 +258,20 @@ function asObjectTreeOptions(options?: IAsyncDataTreeOpt e => (options.expandOnlyOnTwistieClick as ((e: T) => boolean))(e.element as T) ) ), - ariaProvider: undefined, + ariaProvider: options.ariaProvider && { + getPosInSet(el, index) { + return options.ariaProvider!.getPosInSet(el.element as T, index); + }, + getSetSize(el, index, listLength) { + return options.ariaProvider!.getSetSize(el.element as T, index, listLength); + }, + getRole: options.ariaProvider!.getRole ? (el) => { + return options.ariaProvider!.getRole!(el.element as T); + } : undefined, + isChecked: options.ariaProvider!.isChecked ? (e) => { + return options.ariaProvider?.isChecked!(e.element as T); + } : undefined + }, additionalScrollHeight: options.additionalScrollHeight }; } @@ -402,10 +443,6 @@ export class AsyncDataTree implements IDisposable return this.tree.renderHeight; } - get firstVisibleElement(): T { - return this.tree.firstVisibleElement!.element as T; - } - get lastVisibleElement(): T { return this.tree.lastVisibleElement!.element as T; } @@ -436,7 +473,7 @@ export class AsyncDataTree implements IDisposable const viewStateContext = viewState && { viewState, focus: [], selection: [] } as IAsyncDataTreeViewStateContext; - await this._updateChildren(input, true, viewStateContext); + await this._updateChildren(input, true, false, viewStateContext); if (viewStateContext) { this.tree.setFocus(viewStateContext.focus); @@ -448,11 +485,11 @@ export class AsyncDataTree implements IDisposable } } - async updateChildren(element: TInput | T = this.root.element, recursive = true): Promise { - await this._updateChildren(element, recursive); + async updateChildren(element: TInput | T = this.root.element, recursive = true, rerender = false): Promise { + await this._updateChildren(element, recursive, rerender); } - private async _updateChildren(element: TInput | T = this.root.element, recursive = true, viewStateContext?: IAsyncDataTreeViewStateContext): Promise { + private async _updateChildren(element: TInput | T = this.root.element, recursive = true, rerender = false, viewStateContext?: IAsyncDataTreeViewStateContext): Promise { if (typeof this.root.element === 'undefined') { throw new TreeError(this.user, 'Tree input not set'); } @@ -462,7 +499,17 @@ export class AsyncDataTree implements IDisposable await Event.toPromise(this._onDidRender.event); } - await this.refreshAndRenderNode(this.getDataNode(element), recursive, viewStateContext); + const node = this.getDataNode(element); + await this.refreshAndRenderNode(node, recursive, viewStateContext); + + if (rerender) { + try { + this.tree.rerender(node); + } catch { + // missing nodes are fine, this could've resulted from + // parallel refresh calls, removing `node` altogether + } + } } resort(element: TInput | T = this.root.element, recursive = true): void { @@ -515,6 +562,10 @@ export class AsyncDataTree implements IDisposable const node = this.getDataNode(element); + if (this.tree.hasElement(node) && !this.tree.isCollapsible(node)) { + return false; + } + if (node.refreshPromise) { await this.root.refreshPromise; await Event.toPromise(this._onDidRender.event); @@ -734,12 +785,7 @@ export class AsyncDataTree implements IDisposable result = createCancelablePromise(async () => { const children = await this.dataSource.getChildren(node.element!); - - if (this.sorter) { - children.sort(this.sorter.compare.bind(this.sorter)); - } - - return children; + return this.processChildren(children); }); this.refreshPromises.set(node, result); @@ -747,7 +793,11 @@ export class AsyncDataTree implements IDisposable return result.finally(() => this.refreshPromises.delete(node)); } - private _onDidChangeCollapseState({ node, deep }: ICollapseStateChangeEvent, any>): void { + private _onDidChangeCollapseState({ node, deep }: ICollapseStateChangeEvent | null, any>): void { + if (node.element === null) { + return; + } + if (!node.collapsed && node.element.stale) { if (deep) { this.collapse(node.element.element as T); @@ -898,6 +948,14 @@ export class AsyncDataTree implements IDisposable }; } + protected processChildren(children: T[]): T[] { + if (this.sorter) { + children.sort(this.sorter.compare.bind(this.sorter)); + } + + return children; + } + // view state getViewState(): IAsyncDataTreeViewState { @@ -993,6 +1051,12 @@ class CompressibleAsyncDataTreeRenderer i } } + disposeCompressedElements(node: ITreeNode>, TFilterData>, index: number, templateData: IDataTreeListTemplateData, height: number | undefined): void { + if (this.renderer.disposeCompressedElements) { + this.renderer.disposeCompressedElements(this.compressibleNodeMapperProvider().map(node) as ITreeNode, TFilterData>, index, templateData.templateData, height); + } + } + disposeTemplate(templateData: IDataTreeListTemplateData): void { this.renderer.disposeTemplate(templateData.templateData); } @@ -1034,6 +1098,7 @@ export class CompressibleAsyncDataTree extends As protected readonly tree!: CompressibleObjectTree, TFilterData>; protected readonly compressibleNodeMapper: CompressibleAsyncDataTreeNodeMapper = new WeakMapper(node => new CompressibleAsyncDataTreeNodeWrapper(node)); + private filter?: ITreeFilter; constructor( user: string, @@ -1045,6 +1110,7 @@ export class CompressibleAsyncDataTree extends As options: ICompressibleAsyncDataTreeOptions = {} ) { super(user, container, virtualDelegate, renderers, dataSource, options); + this.filter = options.filter; } protected createTree( @@ -1144,14 +1210,16 @@ export class CompressibleAsyncDataTree extends As if (compressedNode) { for (let i = 0; i < compressedNode.elements.length; i++) { const id = getId(compressedNode.elements[i].element as T); + const element = compressedNode.elements[compressedNode.elements.length - 1].element as T; - if (oldSelection.has(id)) { - selection.push(compressedNode.elements[compressedNode.elements.length - 1].element as T); + // github.com/microsoft/vscode/issues/85938 + if (oldSelection.has(id) && selection.indexOf(element) === -1) { + selection.push(element); didChangeSelection = true; } - if (oldFocus.has(id)) { - focus.push(compressedNode.elements[compressedNode.elements.length - 1].element as T); + if (oldFocus.has(id) && focus.indexOf(element) === -1) { + focus.push(element); didChangeFocus = true; } } @@ -1170,4 +1238,34 @@ export class CompressibleAsyncDataTree extends As this.setFocus(focus); } } + + // For compressed async data trees, `TreeVisibility.Recurse` doesn't currently work + // and we have to filter everything beforehand + // Related to #85193 and #85835 + protected processChildren(children: T[]): T[] { + if (this.filter) { + children = children.filter(e => { + const result = this.filter!.filter(e, TreeVisibility.Visible); + const visibility = getVisibility(result); + + if (visibility === TreeVisibility.Recurse) { + throw new Error('Recursive tree visibility not supported in async data compressed trees'); + } + + return visibility === TreeVisibility.Visible; + }); + } + + return super.processChildren(children); + } +} + +function getVisibility(filterResult: TreeFilterResult): TreeVisibility { + if (typeof filterResult === 'boolean') { + return filterResult ? TreeVisibility.Visible : TreeVisibility.Hidden; + } else if (isFilterResult(filterResult)) { + return getVisibleState(filterResult.visibility); + } else { + return getVisibleState(filterResult); + } } diff --git a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts index 4b55b9b6f775e..8c0cffe69834f 100644 --- a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts +++ b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts @@ -11,7 +11,7 @@ import { IObjectTreeModelOptions, ObjectTreeModel, IObjectTreeModel } from 'vs/b // Exported only for test reasons, do not use directly export interface ICompressedTreeElement extends ITreeElement { - readonly children?: Iterator> | ICompressedTreeElement[]; + readonly children?: ISequence>; readonly incompressible?: boolean; } @@ -138,7 +138,6 @@ export class CompressedObjectTreeModel, TFilterData e element: T | null, children: ISequence> | undefined ): void { - if (element === null) { const compressedChildren = Iterator.map(Iterator.from(children), this.enabled ? compress : noCompress); this._setChildren(null, compressedChildren); @@ -206,6 +205,10 @@ export class CompressedObjectTreeModel, TFilterData e this.model.setChildren(node, children, _onDidCreateNode, _onDidDeleteNode); } + has(element: T | null): boolean { + return this.nodes.has(element); + } + getListIndex(location: T | null): number { const node = this.getCompressedNode(location); return this.model.getListIndex(node); @@ -422,6 +425,10 @@ export class CompressibleObjectTreeModel, TFilterData this.model.setCompressionEnabled(enabled); } + has(location: T | null): boolean { + return this.model.has(location); + } + getListIndex(location: T | null): number { return this.model.getListIndex(location); } diff --git a/src/vs/base/browser/ui/tree/dataTree.ts b/src/vs/base/browser/ui/tree/dataTree.ts index 2dbfc990a6138..f14d44e8e4aa9 100644 --- a/src/vs/base/browser/ui/tree/dataTree.ts +++ b/src/vs/base/browser/ui/tree/dataTree.ts @@ -37,7 +37,7 @@ export class DataTree extends AbstractTree, options: IDataTreeOptions = {} ) { - super(user, container, delegate, renderers, options); + super(user, container, delegate, renderers, options as IDataTreeOptions); this.identityProvider = options.identityProvider; } @@ -182,7 +182,7 @@ export class DataTree extends AbstractTree this.identityProvider!.getId(element).toString(); + const getId = (element: T | null) => this.identityProvider!.getId(element!).toString(); const focus = this.getFocus().map(getId); const selection = this.getSelection().map(getId); diff --git a/src/vs/base/browser/ui/tree/indexTreeModel.ts b/src/vs/base/browser/ui/tree/indexTreeModel.ts index c7f287e873ba0..b0c1ed8628f28 100644 --- a/src/vs/base/browser/ui/tree/indexTreeModel.ts +++ b/src/vs/base/browser/ui/tree/indexTreeModel.ts @@ -199,6 +199,10 @@ export class IndexTreeModel, TFilterData = voi } } + has(location: number[]): boolean { + return this.hasTreeNode(location); + } + getListIndex(location: number[]): number { const { listIndex, visible, revealed } = this.getTreeNodeWithListIndex(location); return visible && revealed ? listIndex : -1; @@ -291,6 +295,8 @@ export class IndexTreeModel, TFilterData = voi if (isCollapsibleStateUpdate(update)) { result = node.collapsible !== update.collapsible; node.collapsible = update.collapsible; + } else if (!node.collapsible) { + result = false; } else { result = node.collapsed !== update.collapsed; node.collapsed = update.collapsed; @@ -516,6 +522,21 @@ export class IndexTreeModel, TFilterData = voi } } + // cheap + private hasTreeNode(location: number[], node: IIndexTreeNode = this.root): boolean { + if (!location || location.length === 0) { + return true; + } + + const [index, ...rest] = location; + + if (index < 0 || index > node.children.length) { + return false; + } + + return this.hasTreeNode(rest, node.children[index]); + } + // cheap private getTreeNode(location: number[], node: IIndexTreeNode = this.root): IIndexTreeNode { if (!location || location.length === 0) { diff --git a/src/vs/base/browser/ui/tree/media/panelviewlet.css b/src/vs/base/browser/ui/tree/media/paneviewlet.css similarity index 89% rename from src/vs/base/browser/ui/tree/media/panelviewlet.css rename to src/vs/base/browser/ui/tree/media/paneviewlet.css index 7aba33ef44025..eb1e0be70b292 100644 --- a/src/vs/base/browser/ui/tree/media/panelviewlet.css +++ b/src/vs/base/browser/ui/tree/media/paneviewlet.css @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -.monaco-panel-view .panel > .panel-header h3.title { +.monaco-pane-view .pane > .pane-header h3.title { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; diff --git a/src/vs/base/browser/ui/tree/media/tree.css b/src/vs/base/browser/ui/tree/media/tree.css index dc83adc86f408..66cd61d0b87b1 100644 --- a/src/vs/base/browser/ui/tree/media/tree.css +++ b/src/vs/base/browser/ui/tree/media/tree.css @@ -41,7 +41,7 @@ .monaco-tl-twistie { font-size: 10px; text-align: right; - margin-right: 6px; + padding-right: 6px; flex-shrink: 0; width: 16px; display: flex !important; diff --git a/src/vs/base/browser/ui/tree/objectTree.ts b/src/vs/base/browser/ui/tree/objectTree.ts index 757683c18aff3..a259ad59db074 100644 --- a/src/vs/base/browser/ui/tree/objectTree.ts +++ b/src/vs/base/browser/ui/tree/objectTree.ts @@ -30,7 +30,7 @@ export class ObjectTree, TFilterData = void> extends renderers: ITreeRenderer[], options: IObjectTreeOptions = {} ) { - super(user, container, delegate, renderers, options); + super(user, container, delegate, renderers, options as IObjectTreeOptions); } setChildren(element: T | null, children?: ISequence>): void { @@ -50,6 +50,10 @@ export class ObjectTree, TFilterData = void> extends this.model.resort(element, recursive); } + hasElement(element: T): boolean { + return this.model.has(element); + } + protected createModel(user: string, view: ISpliceable>, options: IObjectTreeOptions): ITreeModel { return new ObjectTreeModel(user, view, options); } @@ -177,7 +181,7 @@ export class CompressibleObjectTree, TFilterData = vo ) { const compressedTreeNodeProvider = () => this; const compressibleRenderers = renderers.map(r => new CompressibleRenderer(compressedTreeNodeProvider, r)); - super(user, container, delegate, compressibleRenderers, asObjectTreeOptions(compressedTreeNodeProvider, options)); + super(user, container, delegate, compressibleRenderers, asObjectTreeOptions(compressedTreeNodeProvider, options)); } setChildren(element: T | null, children?: ISequence>): void { diff --git a/src/vs/base/browser/ui/tree/objectTreeModel.ts b/src/vs/base/browser/ui/tree/objectTreeModel.ts index 9d6b9749510e0..1031060c15f30 100644 --- a/src/vs/base/browser/ui/tree/objectTreeModel.ts +++ b/src/vs/base/browser/ui/tree/objectTreeModel.ts @@ -79,35 +79,47 @@ export class ObjectTreeModel, TFilterData extends Non const insertedElements = new Set(); const insertedElementIds = new Set(); - const _onDidCreateNode = (node: ITreeNode) => { - insertedElements.add(node.element); - this.nodes.set(node.element, node); + const _onDidCreateNode = (node: ITreeNode) => { + if (node.element === null) { + return; + } + + const tnode = node as ITreeNode; + + insertedElements.add(tnode.element); + this.nodes.set(tnode.element, tnode); if (this.identityProvider) { - const id = this.identityProvider.getId(node.element).toString(); + const id = this.identityProvider.getId(tnode.element).toString(); insertedElementIds.add(id); - this.nodesByIdentity.set(id, node); + this.nodesByIdentity.set(id, tnode); } if (onDidCreateNode) { - onDidCreateNode(node); + onDidCreateNode(tnode); } }; - const _onDidDeleteNode = (node: ITreeNode) => { - if (!insertedElements.has(node.element)) { - this.nodes.delete(node.element); + const _onDidDeleteNode = (node: ITreeNode) => { + if (node.element === null) { + return; + } + + const tnode = node as ITreeNode; + + if (!insertedElements.has(tnode.element)) { + this.nodes.delete(tnode.element); } if (this.identityProvider) { - const id = this.identityProvider.getId(node.element).toString(); + const id = this.identityProvider.getId(tnode.element).toString(); if (!insertedElementIds.has(id)) { this.nodesByIdentity.delete(id); } } if (onDidDeleteNode) { - onDidDeleteNode(node); + onDidDeleteNode(tnode); } }; @@ -195,6 +207,10 @@ export class ObjectTreeModel, TFilterData extends Non return this.model.getLastElementAncestor(location); } + has(element: T | null): boolean { + return this.nodes.has(element); + } + getListIndex(element: T | null): number { const location = this.getElementLocation(element); return this.model.getListIndex(location); diff --git a/src/vs/base/browser/ui/tree/tree.ts b/src/vs/base/browser/ui/tree/tree.ts index 374296fa573e3..7e2b282cf82cd 100644 --- a/src/vs/base/browser/ui/tree/tree.ts +++ b/src/vs/base/browser/ui/tree/tree.ts @@ -108,6 +108,8 @@ export interface ITreeModel { readonly onDidChangeCollapseState: Event>; readonly onDidChangeRenderNodeCount: Event>; + has(location: TRef): boolean; + getListIndex(location: TRef): number; getListRenderCount(location: TRef): number; getNode(location?: TRef): ITreeNode; diff --git a/src/vs/base/browser/ui/widget.ts b/src/vs/base/browser/ui/widget.ts index 569ef4925fc45..7e44d9a5a4b96 100644 --- a/src/vs/base/browser/ui/widget.ts +++ b/src/vs/base/browser/ui/widget.ts @@ -7,6 +7,7 @@ import * as dom from 'vs/base/browser/dom'; import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { Disposable } from 'vs/base/common/lifecycle'; +import { Gesture } from 'vs/base/browser/touch'; export abstract class Widget extends Disposable { @@ -49,4 +50,8 @@ export abstract class Widget extends Disposable { protected onchange(domNode: HTMLElement, listener: (e: Event) => void): void { this._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener)); } + + protected ignoreGesture(domNode: HTMLElement): void { + Gesture.ignoreTarget(domNode); + } } diff --git a/src/vs/base/common/amd.ts b/src/vs/base/common/amd.ts index 8aa520d20c176..b44b19ddd0d31 100644 --- a/src/vs/base/common/amd.ts +++ b/src/vs/base/common/amd.ts @@ -6,7 +6,11 @@ import { URI } from 'vs/base/common/uri'; export function getPathFromAmdModule(requirefn: typeof require, relativePath: string): string { - return URI.parse(requirefn.toUrl(relativePath)).fsPath; + return getUriFromAmdModule(requirefn, relativePath).fsPath; +} + +export function getUriFromAmdModule(requirefn: typeof require, relativePath: string): URI { + return URI.parse(requirefn.toUrl(relativePath)); } /** diff --git a/src/vs/base/common/arrays.ts b/src/vs/base/common/arrays.ts index 8ddd98a5a82ca..9a9b53a100ca8 100644 --- a/src/vs/base/common/arrays.ts +++ b/src/vs/base/common/arrays.ts @@ -584,3 +584,7 @@ export function mapArrayOrNot(items: T | T[], fn: (_: T) => U): U | U[] { export function asArray(x: T | T[]): T[] { return Array.isArray(x) ? x : [x]; } + +export function getRandomElement(arr: T[]): T | undefined { + return arr[Math.floor(Math.random() * arr.length)]; +} diff --git a/src/vs/base/common/async.ts b/src/vs/base/common/async.ts index 39055d0201e25..e5ff745c87639 100644 --- a/src/vs/base/common/async.ts +++ b/src/vs/base/common/async.ts @@ -34,7 +34,7 @@ export function createCancelablePromise(callback: (token: CancellationToken) }); }); - return new class implements CancelablePromise { + return >new class { cancel() { source.cancel(); } @@ -56,6 +56,20 @@ export function raceCancellation(promise: Promise, token: CancellationToke return Promise.race([promise, new Promise(resolve => token.onCancellationRequested(() => resolve(defaultValue)))]); } +export function raceTimeout(promise: Promise, timeout: number, onTimeout?: () => void): Promise { + let promiseResolve: (() => void) | undefined = undefined; + + const timer = setTimeout(() => { + promiseResolve?.(); + onTimeout?.(); + }, timeout); + + return Promise.race([ + promise.finally(() => clearTimeout(timer)), + new Promise(resolve => promiseResolve = resolve) + ]); +} + export function asPromise(callback: () => T | Thenable): Promise { return new Promise((resolve, reject) => { const item = callback(); @@ -184,13 +198,14 @@ export class Delayer implements IDisposable { private timeout: any; private completionPromise: Promise | null; private doResolve: ((value?: any | Promise) => void) | null; - private doReject?: (err: any) => void; + private doReject: ((err: any) => void) | null; private task: ITask> | null; constructor(public defaultDelay: number) { this.timeout = null; this.completionPromise = null; this.doResolve = null; + this.doReject = null; this.task = null; } @@ -205,16 +220,20 @@ export class Delayer implements IDisposable { }).then(() => { this.completionPromise = null; this.doResolve = null; - const task = this.task!; - this.task = null; - - return task(); + if (this.task) { + const task = this.task; + this.task = null; + return task(); + } + return undefined; }); } this.timeout = setTimeout(() => { this.timeout = null; - this.doResolve!(null); + if (this.doResolve) { + this.doResolve(null); + } }, delay); return this.completionPromise; @@ -228,7 +247,9 @@ export class Delayer implements IDisposable { this.cancelTimeout(); if (this.completionPromise) { - this.doReject!(errors.canceled()); + if (this.doReject) { + this.doReject(errors.canceled()); + } this.completionPromise = null; } } @@ -474,8 +495,9 @@ export class Queue extends Limiter { * A helper to organize queues per resource. The ResourceQueue makes sure to manage queues per resource * by disposing them once the queue is empty. */ -export class ResourceQueue { - private queues: Map> = new Map(); +export class ResourceQueue implements IDisposable { + + private readonly queues = new Map>(); queueFor(resource: URI): Queue { const key = resource.toString(); @@ -491,6 +513,11 @@ export class ResourceQueue { return this.queues.get(key)!; } + + dispose(): void { + this.queues.forEach(queue => queue.dispose()); + this.queues.clear(); + } } export class TimeoutTimer implements IDisposable { @@ -661,7 +688,7 @@ export class RunOnceWorker extends RunOnceScheduler { export interface IdleDeadline { readonly didTimeout: boolean; - timeRemaining(): DOMHighResTimeStamp; + timeRemaining(): number; } /** * Execute the callback the next time the browser is idle @@ -766,3 +793,107 @@ export async function retry(task: ITask>, delay: number, retries: throw lastError; } + +//#region Task Sequentializer + +interface IPendingTask { + taskId: number; + cancel: () => void; + promise: Promise; +} + +interface ISequentialTask { + promise: Promise; + promiseResolve: () => void; + promiseReject: (error: Error) => void; + run: () => Promise; +} + +export interface ITaskSequentializerWithPendingTask { + readonly pending: Promise; +} + +export class TaskSequentializer { + private _pending?: IPendingTask; + private _next?: ISequentialTask; + + hasPending(taskId?: number): this is ITaskSequentializerWithPendingTask { + if (!this._pending) { + return false; + } + + if (typeof taskId === 'number') { + return this._pending.taskId === taskId; + } + + return !!this._pending; + } + + get pending(): Promise | undefined { + return this._pending ? this._pending.promise : undefined; + } + + cancelPending(): void { + this._pending?.cancel(); + } + + setPending(taskId: number, promise: Promise, onCancel?: () => void, ): Promise { + this._pending = { taskId: taskId, cancel: () => onCancel?.(), promise }; + + promise.then(() => this.donePending(taskId), () => this.donePending(taskId)); + + return promise; + } + + private donePending(taskId: number): void { + if (this._pending && taskId === this._pending.taskId) { + + // only set pending to done if the promise finished that is associated with that taskId + this._pending = undefined; + + // schedule the next task now that we are free if we have any + this.triggerNext(); + } + } + + private triggerNext(): void { + if (this._next) { + const next = this._next; + this._next = undefined; + + // Run next task and complete on the associated promise + next.run().then(next.promiseResolve, next.promiseReject); + } + } + + setNext(run: () => Promise): Promise { + + // this is our first next task, so we create associated promise with it + // so that we can return a promise that completes when the task has + // completed. + if (!this._next) { + let promiseResolve: () => void; + let promiseReject: (error: Error) => void; + const promise = new Promise((resolve, reject) => { + promiseResolve = resolve; + promiseReject = reject; + }); + + this._next = { + run, + promise, + promiseResolve: promiseResolve!, + promiseReject: promiseReject! + }; + } + + // we have a previous next task, just overwrite it + else { + this._next.run = run; + } + + return this._next.promise; + } +} + +//#endregion diff --git a/src/vs/base/common/buffer.ts b/src/vs/base/common/buffer.ts index 25371f5ec795e..1126f89c7d8ca 100644 --- a/src/vs/base/common/buffer.ts +++ b/src/vs/base/common/buffer.ts @@ -6,7 +6,7 @@ import * as strings from 'vs/base/common/strings'; import * as streams from 'vs/base/common/stream'; -declare var Buffer: any; +declare const Buffer: any; const hasBuffer = (typeof Buffer !== 'undefined'); const hasTextEncoder = (typeof TextEncoder !== 'undefined'); diff --git a/src/vs/base/common/cancellation.ts b/src/vs/base/common/cancellation.ts index f741f6b7af11d..75b615de669bf 100644 --- a/src/vs/base/common/cancellation.ts +++ b/src/vs/base/common/cancellation.ts @@ -7,18 +7,27 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; export interface CancellationToken { + + /** + * A flag signalling is cancellation has been requested. + */ readonly isCancellationRequested: boolean; + /** - * An event emitted when cancellation is requested + * An event which fires when cancellation is requested. This event + * only ever fires `once` as cancellation can only happen once. Listeners + * that are registered after cancellation will be called (next event loop run), + * but also only once. + * * @event */ - readonly onCancellationRequested: Event; + readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable; } -const shortcutEvent = Object.freeze(function (callback, context?): IDisposable { +const shortcutEvent: Event = Object.freeze(function (callback, context?): IDisposable { const handle = setTimeout(callback.bind(context), 0); return { dispose() { clearTimeout(handle); } }; -} as Event); +}); export namespace CancellationToken { diff --git a/src/vs/base/common/codicons.ts b/src/vs/base/common/codicons.ts new file mode 100644 index 0000000000000..00b2f8b1c1715 --- /dev/null +++ b/src/vs/base/common/codicons.ts @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const escapeCodiconsRegex = /(\\)?\$\([a-z0-9\-]+?(?:~[a-z0-9\-]*?)?\)/gi; +export function escapeCodicons(text: string): string { + return text.replace(escapeCodiconsRegex, (match, escaped) => escaped ? match : `\\${match}`); +} + +const markdownEscapedCodiconsRegex = /\\\$\([a-z0-9\-]+?(?:~[a-z0-9\-]*?)?\)/gi; +export function markdownEscapeEscapedCodicons(text: string): string { + // Need to add an extra \ for escaping in markdown + return text.replace(markdownEscapedCodiconsRegex, match => `\\${match}`); +} + +const markdownUnescapeCodiconsRegex = /(\\)?\$\\\(([a-z0-9\-]+?(?:~[a-z0-9\-]*?)?)\\\)/gi; +export function markdownUnescapeCodicons(text: string): string { + return text.replace(markdownUnescapeCodiconsRegex, (match, escaped, codicon) => escaped ? match : `$(${codicon})`); +} + +const renderCodiconsRegex = /(\\)?\$\((([a-z0-9\-]+?)(?:~([a-z0-9\-]*?))?)\)/gi; +export function renderCodicons(text: string): string { + return text.replace(renderCodiconsRegex, (_, escaped, codicon, name, animation) => { + return escaped + ? `$(${codicon})` + : ``; + }); +} diff --git a/src/vs/base/common/color.ts b/src/vs/base/common/color.ts index 8068e76aadd38..58397cfbcaee5 100644 --- a/src/vs/base/common/color.ts +++ b/src/vs/base/common/color.ts @@ -399,6 +399,23 @@ export class Color { return new Color(new RGBA(r, g, b, a)); } + makeOpaque(opaqueBackground: Color): Color { + if (this.isOpaque() || opaqueBackground.rgba.a !== 1) { + // only allow to blend onto a non-opaque color onto a opaque color + return this; + } + + const { r, g, b, a } = this.rgba; + + // https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity + return new Color(new RGBA( + opaqueBackground.rgba.r - a * (opaqueBackground.rgba.r - r), + opaqueBackground.rgba.g - a * (opaqueBackground.rgba.g - g), + opaqueBackground.rgba.b - a * (opaqueBackground.rgba.b - b), + 1 + )); + } + flatten(...backgrounds: Color[]): Color { const background = backgrounds.reduceRight((accumulator, color) => { return Color._flatten(color, accumulator); diff --git a/src/vs/base/common/date.ts b/src/vs/base/common/date.ts index a6da9d5ae3363..ec970c131035e 100644 --- a/src/vs/base/common/date.ts +++ b/src/vs/base/common/date.ts @@ -5,6 +5,53 @@ import { pad } from './strings'; +const minute = 60; +const hour = minute * 60; +const day = hour * 24; +const week = day * 7; +const month = day * 30; +const year = day * 365; + +// TODO[ECA]: Localize strings +export function fromNow(date: number | Date, appendAgoLabel?: boolean): string { + if (typeof date !== 'number') { + date = date.getTime(); + } + + const seconds = Math.round((new Date().getTime() - date) / 1000); + if (seconds < 30) { + return 'now'; + } + + let value: number; + let unit: string; + if (seconds < minute) { + value = seconds; + unit = 'sec'; + } else if (seconds < hour) { + value = Math.floor(seconds / minute); + unit = 'min'; + } else if (seconds < day) { + value = Math.floor(seconds / hour); + unit = 'hr'; + } else if (seconds < week) { + value = Math.floor(seconds / day); + unit = 'day'; + } else if (seconds < month) { + value = Math.floor(seconds / week); + unit = 'wk'; + } else if (seconds < year) { + value = Math.floor(seconds / month); + unit = 'mo'; + } else { + value = Math.floor(seconds / year); + unit = 'yr'; + } + + return `${value} ${unit}${value === 1 ? '' : 's'}${appendAgoLabel ? ' ago' : ''}`; + +} + export function toLocalISOString(date: Date): string { return date.getFullYear() + '-' + pad(date.getMonth() + 1, 2) + diff --git a/src/vs/base/common/decorators.ts b/src/vs/base/common/decorators.ts index 17dfadbf784ea..f9e39b6b941d7 100644 --- a/src/vs/base/common/decorators.ts +++ b/src/vs/base/common/decorators.ts @@ -84,11 +84,11 @@ export function memoize(target: any, key: string, descriptor: any) { return createMemoizer()(target, key, descriptor); } -export interface IDebouceReducer { +export interface IDebounceReducer { (previousValue: T, ...args: any[]): T; } -export function debounce(delay: number, reducer?: IDebouceReducer, initialValueProvider?: () => T): Function { +export function debounce(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function { return createDecorator((fn, key) => { const timerKey = `$debounce$${key}`; const resultKey = `$debounce$result$${key}`; @@ -112,3 +112,44 @@ export function debounce(delay: number, reducer?: IDebouceReducer, initial }; }); } + +export function throttle(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function { + return createDecorator((fn, key) => { + const timerKey = `$throttle$timer$${key}`; + const resultKey = `$throttle$result$${key}`; + const lastRunKey = `$throttle$lastRun$${key}`; + const pendingKey = `$throttle$pending$${key}`; + + return function (this: any, ...args: any[]) { + if (!this[resultKey]) { + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + } + if (this[lastRunKey] === null || this[lastRunKey] === undefined) { + this[lastRunKey] = -Number.MAX_VALUE; + } + + if (reducer) { + this[resultKey] = reducer(this[resultKey], ...args); + } + + if (this[pendingKey]) { + return; + } + + const nextTime = this[lastRunKey] + delay; + if (nextTime <= Date.now()) { + this[lastRunKey] = Date.now(); + fn.apply(this, [this[resultKey]]); + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + } else { + this[pendingKey] = true; + this[timerKey] = setTimeout(() => { + this[pendingKey] = false; + this[lastRunKey] = Date.now(); + fn.apply(this, [this[resultKey]]); + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + }, nextTime - Date.now()); + } + }; + }); +} diff --git a/src/vs/base/common/errorMessage.ts b/src/vs/base/common/errorMessage.ts index e3fc44bacd3e2..f686dd28bd773 100644 --- a/src/vs/base/common/errorMessage.ts +++ b/src/vs/base/common/errorMessage.ts @@ -8,15 +8,11 @@ import * as types from 'vs/base/common/types'; import * as arrays from 'vs/base/common/arrays'; function exceptionToErrorMessage(exception: any, verbose: boolean): string { - if (exception.message) { - if (verbose && (exception.stack || exception.stacktrace)) { - return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace)); - } - - return detectSystemErrorMessage(exception); + if (verbose && (exception.stack || exception.stacktrace)) { + return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace)); } - return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); + return detectSystemErrorMessage(exception); } function stackToString(stack: string[] | string | undefined): string | undefined { @@ -34,7 +30,7 @@ function detectSystemErrorMessage(exception: any): string { return nls.localize('nodeExceptionMessage', "A system error occurred ({0})", exception.message); } - return exception.message; + return exception.message || nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); } /** diff --git a/src/vs/base/common/errors.ts b/src/vs/base/common/errors.ts index 0beea24d6f3e9..b2440204634f4 100644 --- a/src/vs/base/common/errors.ts +++ b/src/vs/base/common/errors.ts @@ -31,7 +31,7 @@ export class ErrorHandler { }; } - public addListener(listener: ErrorListenerCallback): ErrorListenerUnbind { + addListener(listener: ErrorListenerCallback): ErrorListenerUnbind { this.listeners.push(listener); return () => { @@ -49,21 +49,21 @@ export class ErrorHandler { this.listeners.splice(this.listeners.indexOf(listener), 1); } - public setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void { + setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void { this.unexpectedErrorHandler = newUnexpectedErrorHandler; } - public getUnexpectedErrorHandler(): (e: any) => void { + getUnexpectedErrorHandler(): (e: any) => void { return this.unexpectedErrorHandler; } - public onUnexpectedError(e: any): void { + onUnexpectedError(e: any): void { this.unexpectedErrorHandler(e); this.emit(e); } // For external errors, we don't want the listeners to be called - public onUnexpectedExternalError(e: any): void { + onUnexpectedExternalError(e: any): void { this.unexpectedErrorHandler(e); } } diff --git a/src/vs/base/common/event.ts b/src/vs/base/common/event.ts index b85073b6786e1..9da5ca139b02a 100644 --- a/src/vs/base/common/event.ts +++ b/src/vs/base/common/event.ts @@ -7,6 +7,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { once as onceFn } from 'vs/base/common/functional'; import { Disposable, IDisposable, toDisposable, combinedDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { LinkedList } from 'vs/base/common/linkedList'; +import { CancellationToken } from 'vs/base/common/cancellation'; /** * To an event a function with one or zero parameters @@ -84,6 +85,8 @@ export namespace Event { * Given a collection of events, returns a single event which emits * whenever any of the provided events emit. */ + export function any(...events: Event[]): Event; + export function any(...events: Event[]): Event; export function any(...events: Event[]): Event { return (listener, thisArgs = null, disposables?) => combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e), null, disposables))); } @@ -147,6 +150,7 @@ export namespace Event { if (leading && !handle) { emitter.fire(output); + output = undefined; } clearTimeout(handle); @@ -269,6 +273,7 @@ export namespace Event { map(fn: (i: T) => O): IChainableEvent; forEach(fn: (i: T) => void): IChainableEvent; filter(fn: (e: T) => boolean): IChainableEvent; + filter(fn: (e: T | R) => e is R): IChainableEvent; reduce(merge: (last: R | undefined, event: T) => R, initial?: R): IChainableEvent; latch(): IChainableEvent; debounce(merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent; @@ -289,6 +294,8 @@ export namespace Event { return new ChainableEvent(forEach(this.event, fn)); } + filter(fn: (e: T) => boolean): IChainableEvent; + filter(fn: (e: T | R) => e is R): IChainableEvent; filter(fn: (e: T) => boolean): IChainableEvent { return new ChainableEvent(filter(this.event, fn)); } @@ -653,27 +660,39 @@ export interface IWaitUntil { export class AsyncEmitter extends Emitter { - private _asyncDeliveryQueue?: [Listener, T, Promise[]][]; + private _asyncDeliveryQueue?: LinkedList<[Listener, Omit]>; - async fireAsync(eventFn: (thenables: Promise[], listener: Function) => T): Promise { + async fireAsync(data: Omit, token: CancellationToken, promiseJoin?: (p: Promise, listener: Function) => Promise): Promise { if (!this._listeners) { return; } - // put all [listener,event]-pairs into delivery queue - // then emit all event. an inner/nested event might be - // the driver of this if (!this._asyncDeliveryQueue) { - this._asyncDeliveryQueue = []; + this._asyncDeliveryQueue = new LinkedList(); } for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) { - const thenables: Promise[] = []; - this._asyncDeliveryQueue.push([e.value, eventFn(thenables, typeof e.value === 'function' ? e.value : e.value[0]), thenables]); + this._asyncDeliveryQueue.push([e.value, data]); } - while (this._asyncDeliveryQueue.length > 0) { - const [listener, event, thenables] = this._asyncDeliveryQueue.shift()!; + while (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) { + + const [listener, data] = this._asyncDeliveryQueue.shift()!; + const thenables: Promise[] = []; + + const event = { + ...data, + waitUntil: (p: Promise): void => { + if (Object.isFrozen(thenables)) { + throw new Error('waitUntil can NOT be called asynchronous'); + } + if (promiseJoin) { + p = promiseJoin(p, typeof listener === 'function' ? listener : listener[0]); + } + thenables.push(p); + } + }; + try { if (typeof listener === 'function') { listener.call(undefined, event); diff --git a/src/vs/base/common/extpath.ts b/src/vs/base/common/extpath.ts index 907dc51ff9333..3ca76db9a29d0 100644 --- a/src/vs/base/common/extpath.ts +++ b/src/vs/base/common/extpath.ts @@ -283,3 +283,20 @@ export function isRootOrDriveLetter(path: string): boolean { return pathNormalized === posix.sep; } + +export function indexOfPath(path: string, candidate: string, ignoreCase: boolean): number { + if (candidate.length > path.length) { + return -1; + } + + if (path === candidate) { + return 0; + } + + if (ignoreCase) { + path = path.toLowerCase(); + candidate = candidate.toLowerCase(); + } + + return path.indexOf(candidate); +} diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index 5e3150d33080a..3740a128f1ae8 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -543,7 +543,7 @@ export function fuzzyScore(pattern: string, patternLow: string, patternStart: nu const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length; const wordLen = word.length > _maxLen ? _maxLen : word.length; - if (patternStart >= patternLen || wordStart >= wordLen || patternLen > wordLen) { + if (patternStart >= patternLen || wordStart >= wordLen || (patternLen - patternStart) > (wordLen - wordStart)) { return undefined; } @@ -560,9 +560,9 @@ export function fuzzyScore(pattern: string, patternLow: string, patternStart: nu let wordPos = wordStart; // There will be a match, fill in tables - for (row = 1, patternPos = patternStart; patternPos < patternLen; row++ , patternPos++) { + for (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) { - for (column = 1, wordPos = wordStart; wordPos < wordLen; column++ , wordPos++) { + for (column = 1, wordPos = wordStart; wordPos < wordLen; column++, wordPos++) { const score = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos); diff --git a/src/vs/base/common/glob.ts b/src/vs/base/common/glob.ts index 78fc5e97ce1ec..6da220436f688 100644 --- a/src/vs/base/common/glob.ts +++ b/src/vs/base/common/glob.ts @@ -251,14 +251,14 @@ export interface IGlobOptions { } interface ParsedStringPattern { - (path: string, basename: string): string | null | Promise /* the matching pattern */; + (path: string, basename?: string): string | null | Promise /* the matching pattern */; basenames?: string[]; patterns?: string[]; allBasenames?: string[]; allPaths?: string[]; } interface ParsedExpressionPattern { - (path: string, basename: string, name?: string, hasSibling?: (name: string) => boolean | Promise): string | null | Promise /* the matching pattern */; + (path: string, basename?: string, name?: string, hasSibling?: (name: string) => boolean | Promise): string | null | Promise /* the matching pattern */; requiresSiblings?: boolean; allBasenames?: string[]; allPaths?: string[]; @@ -374,7 +374,7 @@ function trivia3(pattern: string, options: IGlobOptions): ParsedStringPattern { if (n === 1) { return parsedPatterns[0]; } - const parsedPattern: ParsedStringPattern = function (path: string, basename: string) { + const parsedPattern: ParsedStringPattern = function (path: string, basename?: string) { for (let i = 0, n = parsedPatterns.length; i < n; i++) { if ((parsedPatterns[i])(path, basename)) { return pattern; @@ -409,7 +409,7 @@ function trivia4and5(path: string, pattern: string, matchPathEnds: boolean): Par function toRegExp(pattern: string): ParsedStringPattern { try { const regExp = new RegExp(`^${parseRegExp(pattern)}$`); - return function (path: string, basename: string) { + return function (path: string) { regExp.lastIndex = 0; // reset RegExp to its initial state to reuse it! return typeof path === 'string' && regExp.test(path) ? pattern : null; }; @@ -457,7 +457,7 @@ export function parse(arg1: string | IExpression | IRelativePattern, options: IG if (parsedPattern === NULL) { return FALSE; } - const resultPattern: ParsedPattern & { allBasenames?: string[]; allPaths?: string[]; } = function (path: string, basename: string) { + const resultPattern: ParsedPattern & { allBasenames?: string[]; allPaths?: string[]; } = function (path: string, basename?: string) { return !!parsedPattern(path, basename); }; if (parsedPattern.allBasenames) { @@ -540,7 +540,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse return parsedPatterns[0]; } - const resultExpression: ParsedStringPattern = function (path: string, basename: string) { + const resultExpression: ParsedStringPattern = function (path: string, basename?: string) { for (let i = 0, n = parsedPatterns.length; i < n; i++) { // Pattern matches path const result = (parsedPatterns[i])(path, basename); @@ -565,7 +565,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse return resultExpression; } - const resultExpression: ParsedStringPattern = function (path: string, basename: string, hasSibling?: (name: string) => boolean | Promise) { + const resultExpression: ParsedStringPattern = function (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise) { let name: string | undefined = undefined; for (let i = 0, n = parsedPatterns.length; i < n; i++) { @@ -620,12 +620,12 @@ function parseExpressionPattern(pattern: string, value: boolean | SiblingClause, if (value) { const when = (value).when; if (typeof when === 'string') { - const result: ParsedExpressionPattern = (path: string, basename: string, name: string, hasSibling: (name: string) => boolean | Promise) => { + const result: ParsedExpressionPattern = (path: string, basename?: string, name?: string, hasSibling?: (name: string) => boolean | Promise) => { if (!hasSibling || !parsedPattern(path, basename)) { return null; } - const clausePattern = when.replace('$(basename)', name); + const clausePattern = when.replace('$(basename)', name!); const matched = hasSibling(clausePattern); return isThenable(matched) ? matched.then(m => m ? pattern : null) : diff --git a/src/vs/base/common/htmlContent.ts b/src/vs/base/common/htmlContent.ts index c9bfed7ea8fbe..be074865f2b02 100644 --- a/src/vs/base/common/htmlContent.ts +++ b/src/vs/base/common/htmlContent.ts @@ -5,29 +5,41 @@ import { equals } from 'vs/base/common/arrays'; import { UriComponents } from 'vs/base/common/uri'; +import { escapeCodicons } from 'vs/base/common/codicons'; export interface IMarkdownString { readonly value: string; readonly isTrusted?: boolean; + readonly supportThemeIcons?: boolean; uris?: { [href: string]: UriComponents }; } export class MarkdownString implements IMarkdownString { + private readonly _isTrusted: boolean; + private readonly _supportThemeIcons: boolean; + + constructor( + private _value: string = '', + isTrustedOrOptions: boolean | { isTrusted?: boolean, supportThemeIcons?: boolean } = false, + ) { + if (typeof isTrustedOrOptions === 'boolean') { + this._isTrusted = isTrustedOrOptions; + this._supportThemeIcons = false; + } + else { + this._isTrusted = isTrustedOrOptions.isTrusted ?? false; + this._supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false; + } - private _value: string; - private _isTrusted: boolean; - - constructor(value: string = '', isTrusted = false) { - this._value = value; - this._isTrusted = isTrusted; } get value() { return this._value; } get isTrusted() { return this._isTrusted; } + get supportThemeIcons() { return this._supportThemeIcons; } appendText(value: string): MarkdownString { // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash - this._value += value + this._value += (this._supportThemeIcons ? escapeCodicons(value) : value) .replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&') .replace('\n', '\n\n'); @@ -36,6 +48,7 @@ export class MarkdownString implements IMarkdownString { appendMarkdown(value: string): MarkdownString { this._value += value; + return this; } @@ -64,7 +77,8 @@ export function isMarkdownString(thing: any): thing is IMarkdownString { return true; } else if (thing && typeof thing === 'object') { return typeof (thing).value === 'string' - && (typeof (thing).isTrusted === 'boolean' || (thing).isTrusted === undefined); + && (typeof (thing).isTrusted === 'boolean' || (thing).isTrusted === undefined) + && (typeof (thing).supportThemeIcons === 'boolean' || (thing).supportThemeIcons === undefined); } return false; } @@ -89,7 +103,7 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean { } else if (!a || !b) { return false; } else { - return a.value === b.value && a.isTrusted === b.isTrusted; + return a.value === b.value && a.isTrusted === b.isTrusted && a.supportThemeIcons === b.supportThemeIcons; } } diff --git a/src/vs/base/common/iterator.ts b/src/vs/base/common/iterator.ts index f44cbd236b8fb..9287a6eaebf4a 100644 --- a/src/vs/base/common/iterator.ts +++ b/src/vs/base/common/iterator.ts @@ -172,13 +172,28 @@ export module Iterator { } }; } + + export function chain(iterator: Iterator): ChainableIterator { + return new ChainableIterator(iterator); + } +} + +export class ChainableIterator implements Iterator { + + constructor(private it: Iterator) { } + + next(): IteratorResult { return this.it.next(); } + map(fn: (t: T) => R): ChainableIterator { return new ChainableIterator(Iterator.map(this.it, fn)); } + filter(fn: (t: T) => boolean): ChainableIterator { return new ChainableIterator(Iterator.filter(this.it, fn)); } } export type ISequence = Iterator | T[]; -export function getSequenceIterator(arg: Iterator | T[]): Iterator { +export function getSequenceIterator(arg: ISequence | undefined): Iterator { if (Array.isArray(arg)) { return Iterator.fromArray(arg); + } else if (!arg) { + return Iterator.empty(); } else { return arg; } @@ -271,7 +286,7 @@ export interface INavigator extends INextIterator { export class MappedNavigator extends MappedIterator implements INavigator { - constructor(protected navigator: INavigator, fn: (item: T) => R) { + constructor(protected navigator: INavigator, fn: (item: T | null) => R) { super(navigator, fn); } diff --git a/src/vs/base/common/jsonEdit.ts b/src/vs/base/common/jsonEdit.ts index 0aac5a59b2220..a16f4457a1c3b 100644 --- a/src/vs/base/common/jsonEdit.ts +++ b/src/vs/base/common/jsonEdit.ts @@ -84,47 +84,43 @@ export function setProperty(text: string, originalPath: JSONPath, value: any, fo return withFormatting(text, edit, formattingOptions); } } else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) { - const insertIndex = lastSegment; - if (insertIndex === -1) { + if (value !== undefined) { // Insert const newProperty = `${JSON.stringify(value)}`; let edit: Edit; - if (parent.children.length === 0) { - edit = { offset: parent.offset + 1, length: 0, content: newProperty }; + if (parent.children.length === 0 || lastSegment === 0) { + edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' }; } else { - const previous = parent.children[parent.children.length - 1]; + const index = lastSegment === -1 || lastSegment > parent.children.length ? parent.children.length : lastSegment; + const previous = parent.children[index - 1]; edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty }; } return withFormatting(text, edit, formattingOptions); } else { - if (value === undefined && parent.children.length >= 0) { - //Removal - const removalIndex = lastSegment; - const toRemove = parent.children[removalIndex]; - let edit: Edit; - if (parent.children.length === 1) { - // only item - edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' }; - } else if (parent.children.length - 1 === removalIndex) { - // last item - const previous = parent.children[removalIndex - 1]; - const offset = previous.offset + previous.length; - const parentEndOffset = parent.offset + parent.length; - edit = { offset, length: parentEndOffset - 2 - offset, content: '' }; - } else { - edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' }; - } - return withFormatting(text, edit, formattingOptions); + //Removal + const removalIndex = lastSegment; + const toRemove = parent.children[removalIndex]; + let edit: Edit; + if (parent.children.length === 1) { + // only item + edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' }; + } else if (parent.children.length - 1 === removalIndex) { + // last item + const previous = parent.children[removalIndex - 1]; + const offset = previous.offset + previous.length; + const parentEndOffset = parent.offset + parent.length; + edit = { offset, length: parentEndOffset - 2 - offset, content: '' }; } else { - throw new Error('Array modification not supported yet'); + edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' }; } + return withFormatting(text, edit, formattingOptions); } } else { throw new Error(`Can not add ${typeof lastSegment !== 'number' ? 'index' : 'property'} to parent of type ${parent.type}`); } } -function withFormatting(text: string, edit: Edit, formattingOptions: FormattingOptions): Edit[] { +export function withFormatting(text: string, edit: Edit, formattingOptions: FormattingOptions): Edit[] { // apply the edit let newText = applyEdit(text, edit); @@ -179,7 +175,3 @@ export function applyEdits(text: string, edits: Edit[]): string { } return text; } - -export function isWS(text: string, offset: number) { - return '\r\n \t'.indexOf(text.charAt(offset)) !== -1; -} diff --git a/src/vs/base/common/jsonFormatter.ts b/src/vs/base/common/jsonFormatter.ts index a25c493c05d9a..05852ef5fc5c4 100644 --- a/src/vs/base/common/jsonFormatter.ts +++ b/src/vs/base/common/jsonFormatter.ts @@ -228,7 +228,7 @@ function computeIndentLevel(content: string, options: FormattingOptions): number return Math.floor(nChars / tabSize); } -function getEOL(options: FormattingOptions, text: string): string { +export function getEOL(options: FormattingOptions, text: string): string { for (let i = 0; i < text.length; i++) { const ch = text.charAt(i); if (ch === '\r') { @@ -245,4 +245,4 @@ function getEOL(options: FormattingOptions, text: string): string { export function isEOL(text: string, offset: number) { return '\r\n'.indexOf(text.charAt(offset)) !== -1; -} \ No newline at end of file +} diff --git a/src/vs/base/common/lifecycle.ts b/src/vs/base/common/lifecycle.ts index 8d1cbd5b99680..a99fc45bd5045 100644 --- a/src/vs/base/common/lifecycle.ts +++ b/src/vs/base/common/lifecycle.ts @@ -91,6 +91,9 @@ export function toDisposable(fn: () => void): IDisposable { } export class DisposableStore implements IDisposable { + + static DISABLE_DISPOSED_WARNING = false; + private _toDispose = new Set(); private _isDisposed = false; @@ -127,7 +130,9 @@ export class DisposableStore implements IDisposable { markTracked(t); if (this._isDisposed) { - console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack); + if (!DisposableStore.DISABLE_DISPOSED_WARNING) { + console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack); + } } else { this._toDispose.add(t); } @@ -163,7 +168,7 @@ export abstract class Disposable implements IDisposable { /** * Manages the lifecycle of a disposable value that may be changed. * - * This ensures that when the the disposable value is changed, the previously held disposable is disposed of. You can + * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up. */ export class MutableDisposable implements IDisposable { @@ -206,43 +211,6 @@ export class MutableDisposable implements IDisposable { } } -/** - * Wrapper class that stores a disposable that is not currently "owned" by anyone. - * - * Example use cases: - * - * - Express that a function/method will take ownership of a disposable parameter. - * - Express that a function returns a disposable that the caller must explicitly take ownership of. - */ -export class UnownedDisposable extends Disposable { - private _hasBeenAcquired = false; - private _value?: T; - - public constructor(value: T) { - super(); - this._value = value; - } - - public acquire(): T { - if (this._hasBeenAcquired) { - throw new Error('This disposable has already been acquired'); - } - this._hasBeenAcquired = true; - const value = this._value!; - this._value = undefined; - return value; - } - - public dispose() { - super.dispose(); - if (!this._hasBeenAcquired) { - this._hasBeenAcquired = true; - this._value!.dispose(); - this._value = undefined; - } - } -} - export interface IReference extends IDisposable { readonly object: T; } diff --git a/src/vs/base/common/linkedText.ts b/src/vs/base/common/linkedText.ts new file mode 100644 index 0000000000000..ee268d9fdcd2f --- /dev/null +++ b/src/vs/base/common/linkedText.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { memoize } from 'vs/base/common/decorators'; + +export interface ILink { + readonly label: string; + readonly href: string; + readonly title?: string; +} + +export type LinkedTextNode = string | ILink; + +export class LinkedText { + + constructor(readonly nodes: LinkedTextNode[]) { } + + @memoize + toString(): string { + return this.nodes.map(node => typeof node === 'string' ? node : node.label).join(''); + } +} + +const LINK_REGEX = /\[([^\]]+)\]\(((?:https?:\/\/|command:)[^\)\s]+)(?: "([^"]+)")?\)/gi; + +export function parseLinkedText(text: string): LinkedText { + const result: LinkedTextNode[] = []; + + let index = 0; + let match: RegExpExecArray | null; + + while (match = LINK_REGEX.exec(text)) { + if (match.index - index > 0) { + result.push(text.substring(index, match.index)); + } + + const [, label, href, title] = match; + + if (title) { + result.push({ label, href, title }); + } else { + result.push({ label, href }); + } + + index = match.index + match[0].length; + } + + if (index < text.length) { + result.push(text.substring(index)); + } + + return new LinkedText(result); +} diff --git a/src/vs/base/common/map.ts b/src/vs/base/common/map.ts index dadb16862bb15..4f6b55c3fe547 100644 --- a/src/vs/base/common/map.ts +++ b/src/vs/base/common/map.ts @@ -454,8 +454,8 @@ export class ResourceMap { return this.map.delete(this.toKey(resource)); } - forEach(clb: (value: T) => void): void { - this.map.forEach(clb); + forEach(clb: (value: T, key: URI) => void): void { + this.map.forEach((value, index) => clb(value, URI.parse(index))); } values(): T[] { @@ -526,6 +526,14 @@ export class LinkedMap { return this._size; } + get first(): V | undefined { + return this._head?.value; + } + + get last(): V | undefined { + return this._tail?.value; + } + has(key: K): boolean { return this._map.has(key); } diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts index 231180d513fb2..a68e020f9f103 100644 --- a/src/vs/base/common/network.ts +++ b/src/vs/base/common/network.ts @@ -12,47 +12,47 @@ export namespace Schemas { * A schema that is used for models that exist in memory * only and that have no correspondence on a server or such. */ - export const inMemory: string = 'inmemory'; + export const inMemory = 'inmemory'; /** * A schema that is used for setting files */ - export const vscode: string = 'vscode'; + export const vscode = 'vscode'; /** * A schema that is used for internal private files */ - export const internal: string = 'private'; + export const internal = 'private'; /** * A walk-through document. */ - export const walkThrough: string = 'walkThrough'; + export const walkThrough = 'walkThrough'; /** * An embedded code snippet. */ - export const walkThroughSnippet: string = 'walkThroughSnippet'; + export const walkThroughSnippet = 'walkThroughSnippet'; - export const http: string = 'http'; + export const http = 'http'; - export const https: string = 'https'; + export const https = 'https'; - export const file: string = 'file'; + export const file = 'file'; - export const mailto: string = 'mailto'; + export const mailto = 'mailto'; - export const untitled: string = 'untitled'; + export const untitled = 'untitled'; - export const data: string = 'data'; + export const data = 'data'; - export const command: string = 'command'; + export const command = 'command'; - export const vscodeRemote: string = 'vscode-remote'; + export const vscodeRemote = 'vscode-remote'; - export const vscodeRemoteResource: string = 'vscode-remote-resource'; + export const vscodeRemoteResource = 'vscode-remote-resource'; - export const userData: string = 'vscode-userdata'; + export const userData = 'vscode-userdata'; } class RemoteAuthoritiesImpl { diff --git a/src/vs/base/common/path.ts b/src/vs/base/common/path.ts index 28b7d5e61cc49..5f1739053bbdd 100644 --- a/src/vs/base/common/path.ts +++ b/src/vs/base/common/path.ts @@ -69,11 +69,11 @@ function validateString(value: string, name: string) { } } -function isPathSeparator(code: number) { +function isPathSeparator(code: number | undefined) { return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; } -function isPosixPathSeparator(code: number) { +function isPosixPathSeparator(code: number | undefined) { return code === CHAR_FORWARD_SLASH; } diff --git a/src/vs/base/common/performance.js b/src/vs/base/common/performance.js index 2bc7710862012..16960cea06901 100644 --- a/src/vs/base/common/performance.js +++ b/src/vs/base/common/performance.js @@ -100,7 +100,7 @@ if (typeof global === 'object') { if (typeof define === 'function') { // amd define([], function () { return _factory(sharedObj); }); -} else if (typeof module === "object" && typeof module.exports === "object") { +} else if (typeof module === 'object' && typeof module.exports === 'object') { // commonjs module.exports = _factory(sharedObj); } else { diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts index b3c7001a51dea..5a631e0b39554 100644 --- a/src/vs/base/common/platform.ts +++ b/src/vs/base/common/platform.ts @@ -10,6 +10,7 @@ let _isMacintosh = false; let _isLinux = false; let _isNative = false; let _isWeb = false; +let _isIOS = false; let _locale: string | undefined = undefined; let _language: string = LANGUAGE_DEFAULT; let _translationsConfigFile: string | undefined = undefined; @@ -41,6 +42,7 @@ declare const global: any; interface INavigator { userAgent: string; language: string; + maxTouchPoints?: number; } declare const navigator: INavigator; declare const self: any; @@ -52,6 +54,7 @@ if (typeof navigator === 'object' && !isElectronRenderer) { _userAgent = navigator.userAgent; _isWindows = _userAgent.indexOf('Windows') >= 0; _isMacintosh = _userAgent.indexOf('Macintosh') >= 0; + _isIOS = _userAgent.indexOf('Macintosh') >= 0 && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0; _isLinux = _userAgent.indexOf('Linux') >= 0; _isWeb = true; _locale = navigator.language; @@ -106,6 +109,7 @@ export const isMacintosh = _isMacintosh; export const isLinux = _isLinux; export const isNative = _isNative; export const isWeb = _isWeb; +export const isIOS = _isIOS; export const platform = _platform; export const userAgent = _userAgent; diff --git a/src/vs/base/common/resources.ts b/src/vs/base/common/resources.ts index bea40bbdc628c..05610a4750b05 100644 --- a/src/vs/base/common/resources.ts +++ b/src/vs/base/common/resources.ts @@ -182,7 +182,7 @@ export function hasTrailingPathSeparator(resource: URI, sep: string = paths.sep) return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep; } else { const p = resource.path; - return p.length > 1 && p.charCodeAt(p.length - 1) === CharCode.Slash; // ignore the slash at offset 0 + return (p.length > 1 && p.charCodeAt(p.length - 1) === CharCode.Slash) && !(/^[a-zA-Z]:(\/$|\\$)/.test(resource.fsPath)); // ignore the slash at offset 0 } } @@ -191,6 +191,7 @@ export function hasTrailingPathSeparator(resource: URI, sep: string = paths.sep) * Important: Doesn't remove the first slash, it would make the URI invalid */ export function removeTrailingPathSeparator(resource: URI, sep: string = paths.sep): URI { + // Make sure that the path isn't a drive letter. A trailing separator there is not removable. if (hasTrailingPathSeparator(resource, sep)) { return resource.with({ path: resource.path.substr(0, resource.path.length - 1) }); } @@ -226,7 +227,7 @@ export function relativePath(from: URI, to: URI, ignoreCase = hasToIgnoreCase(fr return undefined; } if (from.scheme === Schemas.file) { - const relativePath = paths.relative(from.path, to.path); + const relativePath = paths.relative(originalFSPath(from), originalFSPath(to)); return isWindows ? extpath.toSlashes(relativePath) : relativePath; } let fromPath = from.path || '/', toPath = to.path || '/'; diff --git a/src/vs/base/common/strings.ts b/src/vs/base/common/strings.ts index 02fe7deb96066..8d67e493772b7 100644 --- a/src/vs/base/common/strings.ts +++ b/src/vs/base/common/strings.ts @@ -517,60 +517,80 @@ function getPrevCodePoint(str: string, offset: number): number { } export function nextCharLength(str: string, offset: number): number { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); const initialOffset = offset; const len = str.length; - let codePoint = getNextCodePoint(str, len, offset); - offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + const initialCodePoint = getNextCodePoint(str, len, offset); + offset += (initialCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint); while (offset < len) { - codePoint = getNextCodePoint(str, len, offset); - if (!isUnicodeMark(codePoint)) { + const nextCodePoint = getNextCodePoint(str, len, offset); + const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint); + if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) { break; } - offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + offset += (nextCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = nextGraphemeBreakType; } return (offset - initialOffset); } export function prevCharLength(str: string, offset: number): number { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); const initialOffset = offset; - let codePoint = getPrevCodePoint(str, offset); - offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + const initialCodePoint = getPrevCodePoint(str, offset); + offset -= (initialCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); - while (offset > 0 && isUnicodeMark(codePoint)) { - codePoint = getPrevCodePoint(str, offset); - offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint); + while (offset > 0) { + const prevCodePoint = getPrevCodePoint(str, offset); + const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint); + if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) { + break; + } + offset -= (prevCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = prevGraphemeBreakType; } return (initialOffset - offset); } function _getCharContainingOffset(str: string, offset: number): [number, number] { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); const len = str.length; const initialOffset = offset; const initialCodePoint = getNextCodePoint(str, len, offset); + const initialGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint); offset += (initialCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); // extend to the right + let graphemeBreakType = initialGraphemeBreakType; while (offset < len) { const nextCodePoint = getNextCodePoint(str, len, offset); - if (!isUnicodeMark(nextCodePoint)) { + const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint); + if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) { break; } offset += (nextCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = nextGraphemeBreakType; } const endOffset = offset; // extend to the left offset = initialOffset; - let codePoint = initialCodePoint; - - while (offset > 0 && isUnicodeMark(codePoint)) { - codePoint = getPrevCodePoint(str, offset); - offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = initialGraphemeBreakType; + while (offset > 0) { + const prevCodePoint = getPrevCodePoint(str, offset); + const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint); + if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) { + break; + } + offset -= (prevCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = prevGraphemeBreakType; } return [offset, endOffset]; @@ -583,95 +603,6 @@ export function getCharContainingOffset(str: string, offset: number): [number, n return _getCharContainingOffset(str, offset); } -export function isUnicodeMark(codePoint: number): boolean { - return MarkClassifier.getInstance().isUnicodeMark(codePoint); -} - -class MarkClassifier { - - private static _INSTANCE: MarkClassifier | null = null; - - public static getInstance(): MarkClassifier { - if (!MarkClassifier._INSTANCE) { - MarkClassifier._INSTANCE = new MarkClassifier(); - } - return MarkClassifier._INSTANCE; - } - - private arr: Uint8Array; - - constructor() { - // generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-mark-test.js - const ranges = [ - 0x0300, 0x036F, 0x0483, 0x0489, 0x0591, 0x05BD, 0x05BF, 0x05BF, 0x05C1, 0x05C2, 0x05C4, 0x05C5, - 0x05C7, 0x05C7, 0x0610, 0x061A, 0x064B, 0x065F, 0x0670, 0x0670, 0x06D6, 0x06DC, 0x06DF, 0x06E4, - 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0711, 0x0711, 0x0730, 0x074A, 0x07A6, 0x07B0, 0x07EB, 0x07F3, - 0x07FD, 0x07FD, 0x0816, 0x0819, 0x081B, 0x0823, 0x0825, 0x0827, 0x0829, 0x082D, 0x0859, 0x085B, - 0x08D3, 0x08E1, 0x08E3, 0x0903, 0x093A, 0x093C, 0x093E, 0x094F, 0x0951, 0x0957, 0x0962, 0x0963, - 0x0981, 0x0983, 0x09BC, 0x09BC, 0x09BE, 0x09CD, 0x09D7, 0x09D7, 0x09E2, 0x09E3, 0x09FE, 0x0A03, - 0x0A3C, 0x0A51, 0x0A70, 0x0A71, 0x0A75, 0x0A75, 0x0A81, 0x0A83, 0x0ABC, 0x0ABC, 0x0ABE, 0x0ACD, - 0x0AE2, 0x0AE3, 0x0AFA, 0x0B03, 0x0B3C, 0x0B3C, 0x0B3E, 0x0B57, 0x0B62, 0x0B63, 0x0B82, 0x0B82, - 0x0BBE, 0x0BCD, 0x0BD7, 0x0BD7, 0x0C00, 0x0C04, 0x0C3E, 0x0C56, 0x0C62, 0x0C63, 0x0C81, 0x0C83, - 0x0CBC, 0x0CBC, 0x0CBE, 0x0CD6, 0x0CE2, 0x0CE3, 0x0D00, 0x0D03, 0x0D3B, 0x0D3C, 0x0D3E, 0x0D4D, - 0x0D57, 0x0D57, 0x0D62, 0x0D63, 0x0D81, 0x0D83, 0x0DCA, 0x0DDF, 0x0DF2, 0x0DF3, 0x0E31, 0x0E31, - 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB1, 0x0EB1, 0x0EB4, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, - 0x0F35, 0x0F35, 0x0F37, 0x0F37, 0x0F39, 0x0F39, 0x0F3E, 0x0F3F, 0x0F71, 0x0F84, 0x0F86, 0x0F87, - 0x0F8D, 0x0FBC, 0x0FC6, 0x0FC6, 0x102B, 0x103E, 0x1056, 0x1059, 0x105E, 0x1060, 0x1062, 0x1064, - 0x1067, 0x106D, 0x1071, 0x1074, 0x1082, 0x108D, 0x108F, 0x108F, 0x109A, 0x109D, 0x135D, 0x135F, - 0x1712, 0x1714, 0x1732, 0x1734, 0x1752, 0x1753, 0x1772, 0x1773, 0x17B4, 0x17D3, 0x17DD, 0x17DD, - 0x180B, 0x180D, 0x1885, 0x1886, 0x18A9, 0x18A9, 0x1920, 0x193B, 0x1A17, 0x1A1B, 0x1A55, 0x1A7F, - 0x1AB0, 0x1B04, 0x1B34, 0x1B44, 0x1B6B, 0x1B73, 0x1B80, 0x1B82, 0x1BA1, 0x1BAD, 0x1BE6, 0x1BF3, - 0x1C24, 0x1C37, 0x1CD0, 0x1CD2, 0x1CD4, 0x1CE8, 0x1CED, 0x1CED, 0x1CF4, 0x1CF4, 0x1CF7, 0x1CF9, - 0x1DC0, 0x1DFF, 0x20D0, 0x20F0, 0x2CEF, 0x2CF1, 0x2D7F, 0x2D7F, 0x2DE0, 0x2DFF, 0x302A, 0x302F, - 0x3099, 0x309A, 0xA66F, 0xA672, 0xA674, 0xA67D, 0xA69E, 0xA69F, 0xA6F0, 0xA6F1, 0xA802, 0xA802, - 0xA806, 0xA806, 0xA80B, 0xA80B, 0xA823, 0xA827, 0xA82C, 0xA82C, 0xA880, 0xA881, 0xA8B4, 0xA8C5, - 0xA8E0, 0xA8F1, 0xA8FF, 0xA8FF, 0xA926, 0xA92D, 0xA947, 0xA953, 0xA980, 0xA983, 0xA9B3, 0xA9C0, - 0xA9E5, 0xA9E5, 0xAA29, 0xAA36, 0xAA43, 0xAA43, 0xAA4C, 0xAA4D, 0xAA7B, 0xAA7D, 0xAAB0, 0xAAB0, - 0xAAB2, 0xAAB4, 0xAAB7, 0xAAB8, 0xAABE, 0xAABF, 0xAAC1, 0xAAC1, 0xAAEB, 0xAAEF, 0xAAF5, 0xAAF6, - 0xABE3, 0xABEA, 0xABEC, 0xABED, 0xFB1E, 0xFB1E, 0xFE00, 0xFE0F, 0xFE20, 0xFE2F, 0x101FD, 0x101FD, - 0x102E0, 0x102E0, 0x10376, 0x1037A, 0x10A01, 0x10A0F, 0x10A38, 0x10A3F, 0x10AE5, 0x10AE6, 0x10D24, 0x10D27, - 0x10EAB, 0x10EAC, 0x10F46, 0x10F50, 0x11000, 0x11002, 0x11038, 0x11046, 0x1107F, 0x11082, 0x110B0, 0x110BA, - 0x11100, 0x11102, 0x11127, 0x11134, 0x11145, 0x11146, 0x11173, 0x11173, 0x11180, 0x11182, 0x111B3, 0x111C0, - 0x111C9, 0x111CC, 0x111CE, 0x111CF, 0x1122C, 0x11237, 0x1123E, 0x1123E, 0x112DF, 0x112EA, 0x11300, 0x11303, - 0x1133B, 0x1133C, 0x1133E, 0x1134D, 0x11357, 0x11357, 0x11362, 0x11374, 0x11435, 0x11446, 0x1145E, 0x1145E, - 0x114B0, 0x114C3, 0x115AF, 0x115C0, 0x115DC, 0x115DD, 0x11630, 0x11640, 0x116AB, 0x116B7, 0x1171D, 0x1172B, - 0x1182C, 0x1183A, 0x11930, 0x1193E, 0x11940, 0x11940, 0x11942, 0x11943, 0x119D1, 0x119E0, 0x119E4, 0x119E4, - 0x11A01, 0x11A0A, 0x11A33, 0x11A39, 0x11A3B, 0x11A3E, 0x11A47, 0x11A47, 0x11A51, 0x11A5B, 0x11A8A, 0x11A99, - 0x11C2F, 0x11C3F, 0x11C92, 0x11CB6, 0x11D31, 0x11D45, 0x11D47, 0x11D47, 0x11D8A, 0x11D97, 0x11EF3, 0x11EF6, - 0x16AF0, 0x16AF4, 0x16B30, 0x16B36, 0x16F4F, 0x16F4F, 0x16F51, 0x16F92, 0x16FE4, 0x16FF1, 0x1BC9D, 0x1BC9E, - 0x1D165, 0x1D169, 0x1D16D, 0x1D172, 0x1D17B, 0x1D182, 0x1D185, 0x1D18B, 0x1D1AA, 0x1D1AD, 0x1D242, 0x1D244, - 0x1DA00, 0x1DA36, 0x1DA3B, 0x1DA6C, 0x1DA75, 0x1DA75, 0x1DA84, 0x1DA84, 0x1DA9B, 0x1E02A, 0x1E130, 0x1E136, - 0x1E2EC, 0x1E2EF, 0x1E8D0, 0x1E8D6, 0x1E944, 0x1E94A, 0xE0100, 0xE01EF - ]; - - const maxCodePoint = ranges[ranges.length - 1]; - const arrLen = Math.ceil(maxCodePoint / 8); - const arr = new Uint8Array(arrLen); - - for (let i = 0, len = ranges.length / 2; i < len; i++) { - const from = ranges[2 * i]; - const to = ranges[2 * i + 1]; - - for (let j = from; j <= to; j++) { - const div8 = j >>> 3; - const mod8 = j & 7; - arr[div8] = arr[div8] | (1 << mod8); - } - } - - this.arr = arr; - } - - public isUnicodeMark(codePoint: number): boolean { - const div8 = codePoint >>> 3; - const mod8 = codePoint & 7; - if (div8 >= this.arr.length) { - return false; - } - return (this.arr[div8] & (1 << mod8)) ? true : false; - } -} - /** * A manual encoding of `str` to UTF8. * Use only in environments which do not offer native conversion methods! @@ -1038,3 +969,167 @@ export function singleLetterHash(n: number): string { return String.fromCharCode(CharCode.A + n - LETTERS_CNT); } + +//#region Unicode Grapheme Break + +export function getGraphemeBreakType(codePoint: number): GraphemeBreakType { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); + return graphemeBreakTree.getGraphemeBreakType(codePoint); +} + +export function breakBetweenGraphemeBreakType(breakTypeA: GraphemeBreakType, breakTypeB: GraphemeBreakType): boolean { + // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules + + // !!! Let's make the common case a bit faster + if (breakTypeA === GraphemeBreakType.Other) { + // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table + return (breakTypeB !== GraphemeBreakType.Extend && breakTypeB !== GraphemeBreakType.SpacingMark); + } + + // Do not break between a CR and LF. Otherwise, break before and after controls. + // GB3 CR × LF + // GB4 (Control | CR | LF) ÷ + // GB5 ÷ (Control | CR | LF) + if (breakTypeA === GraphemeBreakType.CR) { + if (breakTypeB === GraphemeBreakType.LF) { + return false; // GB3 + } + } + if (breakTypeA === GraphemeBreakType.Control || breakTypeA === GraphemeBreakType.CR || breakTypeA === GraphemeBreakType.LF) { + return true; // GB4 + } + if (breakTypeB === GraphemeBreakType.Control || breakTypeB === GraphemeBreakType.CR || breakTypeB === GraphemeBreakType.LF) { + return true; // GB5 + } + + // Do not break Hangul syllable sequences. + // GB6 L × (L | V | LV | LVT) + // GB7 (LV | V) × (V | T) + // GB8 (LVT | T) × T + if (breakTypeA === GraphemeBreakType.L) { + if (breakTypeB === GraphemeBreakType.L || breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.LV || breakTypeB === GraphemeBreakType.LVT) { + return false; // GB6 + } + } + if (breakTypeA === GraphemeBreakType.LV || breakTypeA === GraphemeBreakType.V) { + if (breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.T) { + return false; // GB7 + } + } + if (breakTypeA === GraphemeBreakType.LVT || breakTypeA === GraphemeBreakType.T) { + if (breakTypeB === GraphemeBreakType.T) { + return false; // GB8 + } + } + + // Do not break before extending characters or ZWJ. + // GB9 × (Extend | ZWJ) + if (breakTypeB === GraphemeBreakType.Extend || breakTypeB === GraphemeBreakType.ZWJ) { + return false; // GB9 + } + + // The GB9a and GB9b rules only apply to extended grapheme clusters: + // Do not break before SpacingMarks, or after Prepend characters. + // GB9a × SpacingMark + // GB9b Prepend × + if (breakTypeB === GraphemeBreakType.SpacingMark) { + return false; // GB9a + } + if (breakTypeA === GraphemeBreakType.Prepend) { + return false; // GB9b + } + + // Do not break within emoji modifier sequences or emoji zwj sequences. + // GB11 \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} + if (breakTypeA === GraphemeBreakType.ZWJ && breakTypeB === GraphemeBreakType.Extended_Pictographic) { + // Note: we are not implementing the rule entirely here to avoid introducing states + return false; // GB11 + } + + // GB12 sot (RI RI)* RI × RI + // GB13 [^RI] (RI RI)* RI × RI + if (breakTypeA === GraphemeBreakType.Regional_Indicator && breakTypeB === GraphemeBreakType.Regional_Indicator) { + // Note: we are not implementing the rule entirely here to avoid introducing states + return false; // GB12 & GB13 + } + + // GB999 Any ÷ Any + return true; +} + +export const enum GraphemeBreakType { + Other = 0, + Prepend = 1, + CR = 2, + LF = 3, + Control = 4, + Extend = 5, + Regional_Indicator = 6, + SpacingMark = 7, + L = 8, + V = 9, + T = 10, + LV = 11, + LVT = 12, + ZWJ = 13, + Extended_Pictographic = 14 +} + +class GraphemeBreakTree { + + private static _INSTANCE: GraphemeBreakTree | null = null; + public static getInstance(): GraphemeBreakTree { + if (!GraphemeBreakTree._INSTANCE) { + GraphemeBreakTree._INSTANCE = new GraphemeBreakTree(); + } + return GraphemeBreakTree._INSTANCE; + } + + private readonly _data: number[]; + + constructor() { + this._data = getGraphemeBreakRawData(); + } + + public getGraphemeBreakType(codePoint: number): GraphemeBreakType { + // !!! Let's make 7bit ASCII a bit faster: 0..31 + if (codePoint < 32) { + if (codePoint === CharCode.LineFeed) { + return GraphemeBreakType.LF; + } + if (codePoint === CharCode.CarriageReturn) { + return GraphemeBreakType.CR; + } + return GraphemeBreakType.Control; + } + // !!! Let's make 7bit ASCII a bit faster: 32..126 + if (codePoint < 127) { + return GraphemeBreakType.Other; + } + + const data = this._data; + const nodeCount = data.length / 3; + let nodeIndex = 1; + while (nodeIndex <= nodeCount) { + if (codePoint < data[3 * nodeIndex]) { + // go left + nodeIndex = 2 * nodeIndex; + } else if (codePoint > data[3 * nodeIndex + 1]) { + // go right + nodeIndex = 2 * nodeIndex + 1; + } else { + // hit + return data[3 * nodeIndex + 2]; + } + } + + return GraphemeBreakType.Other; + } +} + +function getGraphemeBreakRawData(): number[] { + // generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-grapheme-break.js + return JSON.parse('[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]'); +} + +//#endregion diff --git a/src/vs/base/common/types.ts b/src/vs/base/common/types.ts index 460e1a910ae14..980c686c9adb0 100644 --- a/src/vs/base/common/types.ts +++ b/src/vs/base/common/types.ts @@ -3,6 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { URI, UriComponents } from 'vs/base/common/uri'; + const _typeof = { number: 'number', string: 'string', @@ -262,3 +264,21 @@ export type AddFirstParameterToFunctions = { [K in keyof T]: T[K] extends URI + ? UriComponents + : UriDto }; + +/** + * Mapped-type that replaces all occurrences of URI with UriComponents and + * drops all functions. + * todo@joh use toJSON-results + */ +export type Dto = { [K in keyof T]: T[K] extends URI + ? UriComponents + : T[K] extends Function + ? never + : UriDto }; diff --git a/src/vs/base/common/uint.ts b/src/vs/base/common/uint.ts index b44e0fdaec7bd..347af57eec20d 100644 --- a/src/vs/base/common/uint.ts +++ b/src/vs/base/common/uint.ts @@ -57,12 +57,3 @@ export function toUint32(v: number): number { } return v | 0; } - -export function toUint32Array(arr: number[]): Uint32Array { - const len = arr.length; - const r = new Uint32Array(len); - for (let i = 0; i < len; i++) { - r[i] = toUint32(arr[i]); - } - return r; -} diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index f6a8959a04c9c..78c9fda1d71ba 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -267,10 +267,10 @@ export class URI implements UriComponents { } return new _URI( match[2] || _empty, - decodeURIComponent(match[4] || _empty), - decodeURIComponent(match[5] || _empty), - decodeURIComponent(match[7] || _empty), - decodeURIComponent(match[9] || _empty), + percentDecode(match[4] || _empty), + percentDecode(match[5] || _empty), + percentDecode(match[7] || _empty), + percentDecode(match[9] || _empty), _strict ); } @@ -389,7 +389,7 @@ interface UriState extends UriComponents { const _pathSepMarker = isWindows ? 1 : undefined; -// tslint:disable-next-line:class-name +// eslint-disable-next-line @typescript-eslint/class-name-casing class _URI extends URI { _formatted: string | null = null; @@ -648,3 +648,26 @@ function _asFormatted(uri: URI, skipEncoding: boolean): string { } return res; } + +// --- decode + +function decodeURIComponentGraceful(str: string): string { + try { + return decodeURIComponent(str); + } catch { + if (str.length > 3) { + return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3)); + } else { + return str; + } + } +} + +const _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g; + +function percentDecode(str: string): string { + if (!str.match(_rEncodedAsHex)) { + return str; + } + return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match)); +} diff --git a/src/vs/base/common/worker/simpleWorker.ts b/src/vs/base/common/worker/simpleWorker.ts index 6c9815d3aaa67..479c2ceb32cfc 100644 --- a/src/vs/base/common/worker/simpleWorker.ts +++ b/src/vs/base/common/worker/simpleWorker.ts @@ -12,7 +12,7 @@ const INITIALIZE = '$initialize'; export interface IWorker extends IDisposable { getId(): number; - postMessage(message: any, transfer: Transferable[]): void; + postMessage(message: any, transfer: ArrayBuffer[]): void; } export interface IWorkerCallback { @@ -302,7 +302,7 @@ export class SimpleWorkerServer { private _requestHandler: IRequestHandler | null; private _protocol: SimpleWorkerProtocol; - constructor(postMessage: (msg: any, transfer?: Transferable[]) => void, requestHandlerFactory: IRequestHandlerFactory | null) { + constructor(postMessage: (msg: any, transfer?: ArrayBuffer[]) => void, requestHandlerFactory: IRequestHandlerFactory | null) { this._requestHandlerFactory = requestHandlerFactory; this._requestHandler = null; this._protocol = new SimpleWorkerProtocol({ diff --git a/src/vs/base/node/config.ts b/src/vs/base/node/config.ts deleted file mode 100644 index 6fac5849f9615..0000000000000 --- a/src/vs/base/node/config.ts +++ /dev/null @@ -1,189 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as fs from 'fs'; -import { dirname } from 'vs/base/common/path'; -import * as objects from 'vs/base/common/objects'; -import { Disposable } from 'vs/base/common/lifecycle'; -import { Event, Emitter } from 'vs/base/common/event'; -import * as json from 'vs/base/common/json'; -import { statLink } from 'vs/base/node/pfs'; -import { realpath } from 'vs/base/node/extpath'; -import { watchFolder, watchFile } from 'vs/base/node/watcher'; - -export interface IConfigurationChangeEvent { - config: T; -} - -export interface IConfigWatcher { - path: string; - hasParseErrors: boolean; - - reload(callback: (config: T) => void): void; - getConfig(): T; -} - -export interface IConfigOptions { - onError: (error: Error | string) => void; - defaultConfig: T; - changeBufferDelay?: number; - parse?: (content: string, errors: any[]) => T; - initCallback?: (config: T) => void; -} - -/** - * A simple helper to watch a configured file for changes and process its contents as JSON object. - * Supports: - * - comments in JSON files and errors - * - symlinks for the config file itself - * - delayed processing of changes to accomodate for lots of changes - * - configurable defaults - */ -export class ConfigWatcher extends Disposable implements IConfigWatcher { - private cache: T | undefined; - private parseErrors: json.ParseError[] | undefined; - private disposed: boolean | undefined; - private loaded: boolean | undefined; - private timeoutHandle: NodeJS.Timer | null | undefined; - private readonly _onDidUpdateConfiguration: Emitter>; - - constructor(private _path: string, private options: IConfigOptions = { defaultConfig: Object.create(null), onError: error => console.error(error) }) { - super(); - this._onDidUpdateConfiguration = this._register(new Emitter>()); - - this.registerWatcher(); - this.initAsync(); - } - - get path(): string { - return this._path; - } - - get hasParseErrors(): boolean { - return !!this.parseErrors && this.parseErrors.length > 0; - } - - get onDidUpdateConfiguration(): Event> { - return this._onDidUpdateConfiguration.event; - } - - private initAsync(): void { - this.loadAsync(config => { - if (!this.loaded) { - this.updateCache(config); // prevent race condition if config was loaded sync already - } - if (this.options.initCallback) { - this.options.initCallback(this.getConfig()); - } - }); - } - - private updateCache(value: T): void { - this.cache = value; - this.loaded = true; - } - - private loadSync(): T { - try { - return this.parse(fs.readFileSync(this._path).toString()); - } catch (error) { - return this.options.defaultConfig; - } - } - - private loadAsync(callback: (config: T) => void): void { - fs.readFile(this._path, (error, raw) => { - if (error) { - return callback(this.options.defaultConfig); - } - - return callback(this.parse(raw.toString())); - }); - } - - private parse(raw: string): T { - let res: T; - try { - this.parseErrors = []; - res = this.options.parse ? this.options.parse(raw, this.parseErrors) : json.parse(raw, this.parseErrors); - - return res || this.options.defaultConfig; - } catch (error) { - return this.options.defaultConfig; // Ignore parsing errors - } - } - - private registerWatcher(): void { - - // Watch the parent of the path so that we detect ADD and DELETES - const parentFolder = dirname(this._path); - this.watch(parentFolder, true); - - // Check if the path is a symlink and watch its target if so - this.handleSymbolicLink().then(undefined, () => { /* ignore error */ }); - } - - private async handleSymbolicLink(): Promise { - const { stat, isSymbolicLink } = await statLink(this._path); - if (isSymbolicLink && !stat.isDirectory()) { - const realPath = await realpath(this._path); - - this.watch(realPath, false); - } - } - - private watch(path: string, isFolder: boolean): void { - if (this.disposed) { - return; // avoid watchers that will never get disposed by checking for being disposed - } - - if (isFolder) { - this._register(watchFolder(path, (type, path) => path === this._path ? this.onConfigFileChange() : undefined, error => this.options.onError(error))); - } else { - this._register(watchFile(path, () => this.onConfigFileChange(), error => this.options.onError(error))); - } - } - - private onConfigFileChange(): void { - if (this.timeoutHandle) { - global.clearTimeout(this.timeoutHandle); - this.timeoutHandle = null; - } - - // we can get multiple change events for one change, so we buffer through a timeout - this.timeoutHandle = global.setTimeout(() => this.reload(), this.options.changeBufferDelay || 0); - } - - reload(callback?: (config: T) => void): void { - this.loadAsync(currentConfig => { - if (!objects.equals(currentConfig, this.cache)) { - this.updateCache(currentConfig); - - this._onDidUpdateConfiguration.fire({ config: currentConfig }); - } - - if (callback) { - return callback(currentConfig); - } - }); - } - - getConfig(): T { - this.ensureLoaded(); - - return this.cache!; - } - - private ensureLoaded(): void { - if (!this.loaded) { - this.updateCache(this.loadSync()); - } - } - - dispose(): void { - this.disposed = true; - super.dispose(); - } -} diff --git a/src/vs/base/node/decoder.ts b/src/vs/base/node/decoder.ts index 0e313a5715a67..767cf6d89c114 100644 --- a/src/vs/base/node/decoder.ts +++ b/src/vs/base/node/decoder.ts @@ -15,7 +15,7 @@ import { CharCode } from 'vs/base/common/charCode'; * - forEach() over the result to get the lines */ export class LineDecoder { - private stringDecoder: sd.NodeStringDecoder; + private stringDecoder: sd.StringDecoder; private remaining: string | null; constructor(encoding: string = 'utf8') { diff --git a/src/vs/base/node/encoding.ts b/src/vs/base/node/encoding.ts index c4cd563ef8f3a..4a9462c646aac 100644 --- a/src/vs/base/node/encoding.ts +++ b/src/vs/base/node/encoding.ts @@ -4,8 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import * as iconv from 'iconv-lite'; -import { isLinux, isMacintosh } from 'vs/base/common/platform'; -import { exec } from 'child_process'; import { Readable, Writable } from 'stream'; import { VSBuffer } from 'vs/base/common/buffer'; @@ -24,9 +22,10 @@ export const UTF16be_BOM = [0xFE, 0xFF]; export const UTF16le_BOM = [0xFF, 0xFE]; export const UTF8_BOM = [0xEF, 0xBB, 0xBF]; -const ZERO_BYTE_DETECTION_BUFFER_MAX_LEN = 512; // number of bytes to look at to decide about a file being binary or not -const NO_GUESS_BUFFER_MAX_LEN = 512; // when not auto guessing the encoding, small number of bytes are enough -const AUTO_GUESS_BUFFER_MAX_LEN = 512 * 8; // with auto guessing we want a lot more content to be read for guessing +const ZERO_BYTE_DETECTION_BUFFER_MAX_LEN = 512; // number of bytes to look at to decide about a file being binary or not +const NO_ENCODING_GUESS_MIN_BYTES = 512; // when not auto guessing the encoding, small number of bytes are enough +const AUTO_ENCODING_GUESS_MIN_BYTES = 512 * 8; // with auto guessing we want a lot more content to be read for guessing +const AUTO_ENCODING_GUESS_MAX_BYTES = 512 * 128; // set an upper limit for the number of bytes we pass on to jschardet export interface IDecodeStreamOptions { guessEncoding: boolean; @@ -42,7 +41,7 @@ export interface IDecodeStreamResult { export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions): Promise { if (!options.minBytesRequiredForDetection) { - options.minBytesRequiredForDetection = options.guessEncoding ? AUTO_GUESS_BUFFER_MAX_LEN : NO_GUESS_BUFFER_MAX_LEN; + options.minBytesRequiredForDetection = options.guessEncoding ? AUTO_ENCODING_GUESS_MIN_BYTES : NO_ENCODING_GUESS_MIN_BYTES; } return new Promise((resolve, reject) => { @@ -53,7 +52,7 @@ export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions private bufferedChunks: Buffer[] = []; private bytesBuffered = 0; - _write(chunk: Buffer, encoding: string, callback: (error: Error | null) => void): void { + _write(chunk: Buffer, encoding: string, callback: (error: Error | null | undefined) => void): void { if (!Buffer.isBuffer(chunk)) { return callback(new Error('toDecodeStream(): data must be a buffer')); } @@ -85,7 +84,7 @@ export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions } } - _startDecodeStream(callback: (error: Error | null) => void): void { + _startDecodeStream(callback: (error: Error | null | undefined) => void): void { // detect encoding from buffer this.decodeStreamPromise = Promise.resolve(detectEncodingFromBuffer({ @@ -167,7 +166,7 @@ function toNodeEncoding(enc: string | null): string { return enc; } -export function detectEncodingByBOMFromBuffer(buffer: Buffer | VSBuffer | null, bytesRead: number): string | null { +export function detectEncodingByBOMFromBuffer(buffer: Buffer | VSBuffer | null, bytesRead: number): typeof UTF8_with_bom | typeof UTF16le | typeof UTF16be | null { if (!buffer || bytesRead < UTF16be_BOM.length) { return null; } @@ -193,32 +192,33 @@ export function detectEncodingByBOMFromBuffer(buffer: Buffer | VSBuffer | null, // UTF-8 if (b0 === UTF8_BOM[0] && b1 === UTF8_BOM[1] && b2 === UTF8_BOM[2]) { - return UTF8; + return UTF8_with_bom; } return null; } +// we explicitly ignore a specific set of encodings from auto guessing +// - ASCII: we never want this encoding (most UTF-8 files would happily detect as +// ASCII files and then you could not type non-ASCII characters anymore) +// - UTF-16: we have our own detection logic for UTF-16 +// - UTF-32: we do not support this encoding in VSCode +const IGNORE_ENCODINGS = ['ascii', 'utf-16', 'utf-32']; + /** * Guesses the encoding from buffer. */ async function guessEncodingByBuffer(buffer: Buffer): Promise { const jschardet = await import('jschardet'); - const guessed = jschardet.detect(buffer); + const guessed = jschardet.detect(buffer.slice(0, AUTO_ENCODING_GUESS_MAX_BYTES)); // ensure to limit buffer for guessing due to https://github.com/aadsm/jschardet/issues/53 if (!guessed || !guessed.encoding) { return null; } - // Ignore 'ascii' as guessed encoding because that - // is almost never what we want, rather fallback - // to the configured encoding then. Otherwise, - // opening a ascii-only file with auto guessing - // enabled will put the file into 'ascii' mode - // and thus typing any special characters is - // not possible anymore. - if (guessed.encoding.toLowerCase() === 'ascii') { - return null; + const enc = guessed.encoding.toLowerCase(); + if (0 <= IGNORE_ENCODINGS.indexOf(enc)) { + return null; // see comment above why we ignore some encodings } return toIconvLiteEncoding(guessed.encoding); @@ -352,87 +352,3 @@ export function detectEncodingFromBuffer({ buffer, bytesRead }: IReadResult, aut return { seemsBinary, encoding }; } - -// https://ss64.com/nt/chcp.html -const windowsTerminalEncodings = { - '437': 'cp437', // United States - '850': 'cp850', // Multilingual(Latin I) - '852': 'cp852', // Slavic(Latin II) - '855': 'cp855', // Cyrillic(Russian) - '857': 'cp857', // Turkish - '860': 'cp860', // Portuguese - '861': 'cp861', // Icelandic - '863': 'cp863', // Canadian - French - '865': 'cp865', // Nordic - '866': 'cp866', // Russian - '869': 'cp869', // Modern Greek - '936': 'cp936', // Simplified Chinese - '1252': 'cp1252' // West European Latin -}; - -export async function resolveTerminalEncoding(verbose?: boolean): Promise { - let rawEncodingPromise: Promise; - - // Support a global environment variable to win over other mechanics - const cliEncodingEnv = process.env['VSCODE_CLI_ENCODING']; - if (cliEncodingEnv) { - if (verbose) { - console.log(`Found VSCODE_CLI_ENCODING variable: ${cliEncodingEnv}`); - } - - rawEncodingPromise = Promise.resolve(cliEncodingEnv); - } - - // Linux/Mac: use "locale charmap" command - else if (isLinux || isMacintosh) { - rawEncodingPromise = new Promise(resolve => { - if (verbose) { - console.log('Running "locale charmap" to detect terminal encoding...'); - } - - exec('locale charmap', (err, stdout, stderr) => resolve(stdout)); - }); - } - - // Windows: educated guess - else { - rawEncodingPromise = new Promise(resolve => { - if (verbose) { - console.log('Running "chcp" to detect terminal encoding...'); - } - - exec('chcp', (err, stdout, stderr) => { - if (stdout) { - const windowsTerminalEncodingKeys = Object.keys(windowsTerminalEncodings) as Array; - for (const key of windowsTerminalEncodingKeys) { - if (stdout.indexOf(key) >= 0) { - return resolve(windowsTerminalEncodings[key]); - } - } - } - - return resolve(undefined); - }); - }); - } - - const rawEncoding = await rawEncodingPromise; - if (verbose) { - console.log(`Detected raw terminal encoding: ${rawEncoding}`); - } - - if (!rawEncoding || rawEncoding.toLowerCase() === 'utf-8' || rawEncoding.toLowerCase() === UTF8) { - return UTF8; - } - - const iconvEncoding = toIconvLiteEncoding(rawEncoding); - if (iconv.encodingExists(iconvEncoding)) { - return iconvEncoding; - } - - if (verbose) { - console.log('Unsupported terminal encoding, falling back to UTF-8.'); - } - - return UTF8; -} diff --git a/src/vs/base/node/pfs.ts b/src/vs/base/node/pfs.ts index 1b294073eed2a..6cf71160c506a 100644 --- a/src/vs/base/node/pfs.ts +++ b/src/vs/base/node/pfs.ts @@ -14,7 +14,18 @@ import { promisify } from 'util'; import { isRootOrDriveLetter } from 'vs/base/common/extpath'; import { generateUuid } from 'vs/base/common/uuid'; import { normalizeNFC } from 'vs/base/common/normalization'; -import { encode, encodeStream } from 'vs/base/node/encoding'; +import { encode } from 'vs/base/node/encoding'; + +// See https://github.com/Microsoft/vscode/issues/30180 +const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB +const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB + +// See https://github.com/v8/v8/blob/5918a23a3d571b9625e5cce246bdd5b46ff7cd8b/src/heap/heap.cc#L149 +const WIN32_MAX_HEAP_SIZE = 700 * 1024 * 1024; // 700 MB +const GENERAL_MAX_HEAP_SIZE = 700 * 2 * 1024 * 1024; // 1400 MB + +export const MAX_FILE_SIZE = process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE : GENERAL_MAX_FILE_SIZE; +export const MAX_HEAP_SIZE = process.arch === 'ia32' ? WIN32_MAX_HEAP_SIZE : GENERAL_MAX_HEAP_SIZE; export enum RimRafMode { @@ -178,30 +189,52 @@ export function stat(path: string): Promise { } export interface IStatAndLink { + + // The stats of the file. If the file is a symbolic + // link, the stats will be of that target file and + // not the link itself. + // If the file is a symbolic link pointing to a non + // existing file, the stat will be of the link and + // the `dangling` flag will indicate this. stat: fs.Stats; - isSymbolicLink: boolean; + + // Will be provided if the resource is a symbolic link + // on disk. Use the `dangling` flag to find out if it + // points to a resource that does not exist on disk. + symbolicLink?: { dangling: boolean }; } export async function statLink(path: string): Promise { // First stat the link - let linkStat: fs.Stats | undefined; - let linkStatError: NodeJS.ErrnoException | undefined; + let lstats: fs.Stats | undefined; try { - linkStat = await lstat(path); + lstats = await lstat(path); + + // Return early if the stat is not a symbolic link at all + if (!lstats.isSymbolicLink()) { + return { stat: lstats }; + } } catch (error) { - linkStatError = error; + /* ignore - use stat() instead */ } - // Then stat the target and return that - const isLink = !!(linkStat && linkStat.isSymbolicLink()); - if (linkStatError || isLink) { - const fileStat = await stat(path); + // If the stat is a symbolic link or failed to stat, use fs.stat() + // which for symbolic links will stat the target they point to + try { + const stats = await stat(path); - return { stat: fileStat, isSymbolicLink: isLink }; - } + return { stat: stats, symbolicLink: lstats?.isSymbolicLink() ? { dangling: false } : undefined }; + } catch (error) { + + // If the link points to a non-existing file we still want + // to return it as result while setting dangling: true flag + if (error.code === 'ENOENT' && lstats) { + return { stat: lstats, symbolicLink: { dangling: true } }; + } - return { stat: linkStat!, isSymbolicLink: false }; + throw error; + } } export function lstat(path: string): Promise { @@ -213,9 +246,7 @@ export function rename(oldPath: string, newPath: string): Promise { } export function renameIgnoreError(oldPath: string, newPath: string): Promise { - return new Promise(resolve => { - fs.rename(oldPath, newPath, () => resolve()); - }); + return new Promise(resolve => fs.rename(oldPath, newPath, () => resolve())); } export function unlink(path: string): Promise { @@ -236,6 +267,10 @@ export function readFile(path: string, encoding?: string): Promise { + return promisify(fs.mkdir)(path, { mode, recursive: true }); +} + // According to node.js docs (https://nodejs.org/docs/v6.5.0/api/fs.html#fs_fs_writefile_file_data_options_callback) // it is not safe to call writeFile() on the same path multiple times without waiting for the callback to return. // Therefor we use a Queue on the path that is given to us to sequentialize calls to the same path properly. @@ -244,12 +279,15 @@ const writeFilePathQueues: Map> = new Map(); export function writeFile(path: string, data: string, options?: IWriteFileOptions): Promise; export function writeFile(path: string, data: Buffer, options?: IWriteFileOptions): Promise; export function writeFile(path: string, data: Uint8Array, options?: IWriteFileOptions): Promise; -export function writeFile(path: string, data: NodeJS.ReadableStream, options?: IWriteFileOptions): Promise; -export function writeFile(path: string, data: string | Buffer | NodeJS.ReadableStream | Uint8Array, options?: IWriteFileOptions): Promise; -export function writeFile(path: string, data: string | Buffer | NodeJS.ReadableStream | Uint8Array, options?: IWriteFileOptions): Promise { +export function writeFile(path: string, data: string | Buffer | Uint8Array, options?: IWriteFileOptions): Promise; +export function writeFile(path: string, data: string | Buffer | Uint8Array, options?: IWriteFileOptions): Promise { const queueKey = toQueueKey(path); - return ensureWriteFileQueue(queueKey).queue(() => writeFileAndFlush(path, data, options)); + return ensureWriteFileQueue(queueKey).queue(() => { + const ensuredOptions = ensureWriteOptions(options); + + return new Promise((resolve, reject) => doWriteFileAndFlush(path, data, ensuredOptions, error => error ? reject(error) : resolve())); + }); } function toQueueKey(path: string): string { @@ -294,103 +332,6 @@ interface IEnsuredWriteFileOptions extends IWriteFileOptions { } let canFlush = true; -function writeFileAndFlush(path: string, data: string | Buffer | NodeJS.ReadableStream | Uint8Array, options: IWriteFileOptions | undefined): Promise { - const ensuredOptions = ensureWriteOptions(options); - - return new Promise((resolve, reject) => { - if (typeof data === 'string' || Buffer.isBuffer(data) || data instanceof Uint8Array) { - doWriteFileAndFlush(path, data, ensuredOptions, error => error ? reject(error) : resolve()); - } else { - doWriteFileStreamAndFlush(path, data, ensuredOptions, error => error ? reject(error) : resolve()); - } - }); -} - -function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream, options: IEnsuredWriteFileOptions, callback: (error?: Error) => void): void { - - // finish only once - let finished = false; - const finish = (error?: Error) => { - if (!finished) { - finished = true; - - // in error cases we need to manually close streams - // if the write stream was successfully opened - if (error) { - if (isOpen) { - writer.once('close', () => callback(error)); - writer.destroy(); - } else { - callback(error); - } - } - - // otherwise just return without error - else { - callback(); - } - } - }; - - // create writer to target. we set autoClose: false because we want to use the streams - // file descriptor to call fs.fdatasync to ensure the data is flushed to disk - const writer = fs.createWriteStream(path, { mode: options.mode, flags: options.flag, autoClose: false }); - - // Event: 'open' - // Purpose: save the fd for later use and start piping - // Notes: will not be called when there is an error opening the file descriptor! - let fd: number; - let isOpen: boolean; - writer.once('open', descriptor => { - fd = descriptor; - isOpen = true; - - // if an encoding is provided, we need to pipe the stream through - // an encoder stream and forward the encoding related options - if (options.encoding) { - reader = reader.pipe(encodeStream(options.encoding.charset, { addBOM: options.encoding.addBOM })); - } - - // start data piping only when we got a successful open. this ensures that we do - // not consume the stream when an error happens and helps to fix this issue: - // https://github.com/Microsoft/vscode/issues/42542 - reader.pipe(writer); - }); - - // Event: 'error' - // Purpose: to return the error to the outside and to close the write stream (does not happen automatically) - reader.once('error', error => finish(error)); - writer.once('error', error => finish(error)); - - // Event: 'finish' - // Purpose: use fs.fdatasync to flush the contents to disk - // Notes: event is called when the writer has finished writing to the underlying resource. we must call writer.close() - // because we have created the WriteStream with autoClose: false - writer.once('finish', () => { - - // flush to disk - if (canFlush && isOpen) { - fs.fdatasync(fd, (syncError: Error) => { - - // In some exotic setups it is well possible that node fails to sync - // In that case we disable flushing and warn to the console - if (syncError) { - console.warn('[node.js fs] fdatasync is now disabled for this session because it failed: ', syncError); - canFlush = false; - } - - writer.destroy(); - }); - } else { - writer.destroy(); - } - }); - - // Event: 'close' - // Purpose: signal we are done to the outside - // Notes: event is called when the writer's filedescriptor is closed - writer.once('close', () => finish()); -} // Calls fs.writeFile() followed by a fs.sync() call to flush the changes to disk // We do this in cases where we want to make sure the data is really on disk and @@ -419,7 +360,7 @@ function doWriteFileAndFlush(path: string, data: string | Buffer | Uint8Array, o } // Flush contents (not metadata) of the file to disk - fs.fdatasync(fd, (syncError: Error) => { + fs.fdatasync(fd, (syncError: Error | null) => { // In some exotic setups it is well possible that node fails to sync // In that case we disable flushing and warn to the console @@ -631,18 +572,3 @@ async function doCopyFile(source: string, target: string, mode: number): Promise reader.pipe(writer); }); } - -export async function mkdirp(path: string, mode?: number): Promise { - return promisify(fs.mkdir)(path, { mode, recursive: true }); -} - -// See https://github.com/Microsoft/vscode/issues/30180 -const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB -const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB - -// See https://github.com/v8/v8/blob/5918a23a3d571b9625e5cce246bdd5b46ff7cd8b/src/heap/heap.cc#L149 -const WIN32_MAX_HEAP_SIZE = 700 * 1024 * 1024; // 700 MB -const GENERAL_MAX_HEAP_SIZE = 700 * 2 * 1024 * 1024; // 1400 MB - -export const MAX_FILE_SIZE = process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE : GENERAL_MAX_FILE_SIZE; -export const MAX_HEAP_SIZE = process.arch === 'ia32' ? WIN32_MAX_HEAP_SIZE : GENERAL_MAX_HEAP_SIZE; diff --git a/src/vs/base/node/ports.ts b/src/vs/base/node/ports.ts index d0334628e4777..ba8297dc46ff9 100644 --- a/src/vs/base/node/ports.ts +++ b/src/vs/base/node/ports.ts @@ -72,6 +72,49 @@ function doFindFreePort(startPort: number, giveUpAfter: number, clb: (port: numb client.connect(startPort, '127.0.0.1'); } +/** + * Uses listen instead of connect. Is faster, but if there is another listener on 0.0.0.0 then this will take 127.0.0.1 from that listener. + */ +export function findFreePortFaster(startPort: number, giveUpAfter: number, timeout: number): Promise { + let resolved: boolean = false; + let timeoutHandle: NodeJS.Timeout | undefined = undefined; + let countTried: number = 1; + const server = net.createServer({ pauseOnConnect: true }); + function doResolve(port: number, resolve: (port: number) => void) { + if (!resolved) { + resolved = true; + server.removeAllListeners(); + server.close(); + if (timeoutHandle) { + clearTimeout(timeoutHandle); + } + resolve(port); + } + } + return new Promise(resolve => { + timeoutHandle = setTimeout(() => { + doResolve(0, resolve); + }, timeout); + + server.on('listening', () => { + doResolve(startPort, resolve); + }); + server.on('error', err => { + if (err && ((err).code === 'EADDRINUSE' || (err).code === 'EACCES') && (countTried < giveUpAfter)) { + startPort++; + countTried++; + server.listen(startPort, '127.0.0.1'); + } else { + doResolve(0, resolve); + } + }); + server.on('close', () => { + doResolve(0, resolve); + }); + server.listen(startPort, '127.0.0.1'); + }); +} + function dispose(socket: net.Socket): void { try { socket.removeAllListeners('connect'); diff --git a/src/vs/base/node/processes.ts b/src/vs/base/node/processes.ts index b6f7742e2b3cb..1fb6c3c235460 100644 --- a/src/vs/base/node/processes.ts +++ b/src/vs/base/node/processes.ts @@ -409,7 +409,7 @@ export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender return; } - const result = childProcess.send(msg, (error: Error) => { + const result = childProcess.send(msg, (error: Error | null) => { if (error) { console.error(error); // unlikely to happen, best we can do is log this error } diff --git a/src/vs/base/node/terminalEncoding.ts b/src/vs/base/node/terminalEncoding.ts new file mode 100644 index 0000000000000..3077f3a963312 --- /dev/null +++ b/src/vs/base/node/terminalEncoding.ts @@ -0,0 +1,98 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/** + * This code is also used by standalone cli's. Avoid adding dependencies to keep the size of the cli small. + */ +import { exec } from 'child_process'; +import * as os from 'os'; + +const windowsTerminalEncodings = { + '437': 'cp437', // United States + '850': 'cp850', // Multilingual(Latin I) + '852': 'cp852', // Slavic(Latin II) + '855': 'cp855', // Cyrillic(Russian) + '857': 'cp857', // Turkish + '860': 'cp860', // Portuguese + '861': 'cp861', // Icelandic + '863': 'cp863', // Canadian - French + '865': 'cp865', // Nordic + '866': 'cp866', // Russian + '869': 'cp869', // Modern Greek + '936': 'cp936', // Simplified Chinese + '1252': 'cp1252' // West European Latin +}; + +function toIconvLiteEncoding(encodingName: string): string { + const normalizedEncodingName = encodingName.replace(/[^a-zA-Z0-9]/g, '').toLowerCase(); + const mapped = JSCHARDET_TO_ICONV_ENCODINGS[normalizedEncodingName]; + + return mapped || normalizedEncodingName; +} + +const JSCHARDET_TO_ICONV_ENCODINGS: { [name: string]: string } = { + 'ibm866': 'cp866', + 'big5': 'cp950' +}; + +const UTF8 = 'utf8'; + + +export async function resolveTerminalEncoding(verbose?: boolean): Promise { + let rawEncodingPromise: Promise; + + // Support a global environment variable to win over other mechanics + const cliEncodingEnv = process.env['VSCODE_CLI_ENCODING']; + if (cliEncodingEnv) { + if (verbose) { + console.log(`Found VSCODE_CLI_ENCODING variable: ${cliEncodingEnv}`); + } + + rawEncodingPromise = Promise.resolve(cliEncodingEnv); + } + + // Windows: educated guess + else if (os.platform() === 'win32') { + rawEncodingPromise = new Promise(resolve => { + if (verbose) { + console.log('Running "chcp" to detect terminal encoding...'); + } + + exec('chcp', (err, stdout, stderr) => { + if (stdout) { + const windowsTerminalEncodingKeys = Object.keys(windowsTerminalEncodings) as Array; + for (const key of windowsTerminalEncodingKeys) { + if (stdout.indexOf(key) >= 0) { + return resolve(windowsTerminalEncodings[key]); + } + } + } + + return resolve(undefined); + }); + }); + } + // Linux/Mac: use "locale charmap" command + else { + rawEncodingPromise = new Promise(resolve => { + if (verbose) { + console.log('Running "locale charmap" to detect terminal encoding...'); + } + + exec('locale charmap', (err, stdout, stderr) => resolve(stdout)); + }); + } + + const rawEncoding = await rawEncodingPromise; + if (verbose) { + console.log(`Detected raw terminal encoding: ${rawEncoding}`); + } + + if (!rawEncoding || rawEncoding.toLowerCase() === 'utf-8' || rawEncoding.toLowerCase() === UTF8) { + return UTF8; + } + + return toIconvLiteEncoding(rawEncoding); +} diff --git a/src/vs/base/node/watcher.ts b/src/vs/base/node/watcher.ts index b51f73c6eaac0..b71a84a63f15a 100644 --- a/src/vs/base/node/watcher.ts +++ b/src/vs/base/node/watcher.ts @@ -10,7 +10,7 @@ import { normalizeNFC } from 'vs/base/common/normalization'; import { toDisposable, IDisposable, dispose } from 'vs/base/common/lifecycle'; import { exists, readdir } from 'vs/base/node/pfs'; -export function watchFile(path: string, onChange: (type: 'changed' | 'deleted', path: string) => void, onError: (error: string) => void): IDisposable { +export function watchFile(path: string, onChange: (type: 'added' | 'changed' | 'deleted', path: string) => void, onError: (error: string) => void): IDisposable { return doWatchNonRecursive({ path, isDirectory: false }, onChange, onError); } @@ -189,4 +189,4 @@ function doWatchNonRecursive(file: { path: string, isDirectory: boolean }, onCha watcherDisposables = dispose(watcherDisposables); }); -} \ No newline at end of file +} diff --git a/src/vs/base/node/zip.ts b/src/vs/base/node/zip.ts index 93ebb6ad60756..8047aa275f75c 100644 --- a/src/vs/base/node/zip.ts +++ b/src/vs/base/node/zip.ts @@ -12,7 +12,6 @@ import { mkdirp, rimraf } from 'vs/base/node/pfs'; import { open as _openZip, Entry, ZipFile } from 'yauzl'; import * as yazl from 'yazl'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { Event } from 'vs/base/common/event'; export interface IExtractOptions { overwrite?: boolean; @@ -80,7 +79,7 @@ function extractEntry(stream: Readable, fileName: string, mode: number, targetPa let istream: WriteStream; - Event.once(token.onCancellationRequested)(() => { + token.onCancellationRequested(() => { if (istream) { istream.destroy(); } @@ -107,7 +106,7 @@ function extractZip(zipfile: ZipFile, targetPath: string, options: IOptions, tok let last = createCancelablePromise(() => Promise.resolve()); let extractedEntriesCount = 0; - Event.once(token.onCancellationRequested)(() => { + token.onCancellationRequested(() => { last.cancel(); zipfile.close(); }); diff --git a/src/vs/base/parts/composite/browser/compositeDnd.ts b/src/vs/base/parts/composite/browser/compositeDnd.ts new file mode 100644 index 0000000000000..ca8b52d491a5f --- /dev/null +++ b/src/vs/base/parts/composite/browser/compositeDnd.ts @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IDragAndDropData } from 'vs/base/browser/dnd'; + +export class CompositeDragAndDropData implements IDragAndDropData { + constructor(private type: 'view' | 'composite', private id: string) { } + update(dataTransfer: DataTransfer): void { + // no-op + } + getData(): { + type: 'view' | 'composite'; + id: string; + } { + return { type: this.type, id: this.id }; + } +} + +export interface ICompositeDragAndDrop { + drop(data: IDragAndDropData, target: string | undefined, originalEvent: DragEvent): void; + onDragOver(data: IDragAndDropData, target: string | undefined, originalEvent: DragEvent): boolean; +} diff --git a/src/vs/base/parts/ipc/common/ipc.ts b/src/vs/base/parts/ipc/common/ipc.ts index 48f7557720638..8dea0ab03daec 100644 --- a/src/vs/base/parts/ipc/common/ipc.ts +++ b/src/vs/base/parts/ipc/common/ipc.ts @@ -3,12 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Event, Emitter, Relay } from 'vs/base/common/event'; -import { IDisposable, toDisposable, combinedDisposable } from 'vs/base/common/lifecycle'; +import { Event, Emitter, Relay, EventMultiplexer } from 'vs/base/common/event'; +import { IDisposable, toDisposable, combinedDisposable, DisposableStore } from 'vs/base/common/lifecycle'; 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 { VSBuffer } from 'vs/base/common/buffer'; +import { getRandomElement } from 'vs/base/common/arrays'; +import { isFunction } from 'vs/base/common/types'; /** * An `IChannel` is an abstraction over a collection of commands. @@ -95,7 +97,8 @@ export interface Client { export interface IConnectionHub { readonly connections: Connection[]; - readonly onDidChangeConnections: Event>; + readonly onDidAddConnection: Event>; + readonly onDidRemoveConnection: Event>; } /** @@ -116,7 +119,7 @@ export interface IClientRouter { * order to pick the right one. */ export interface IRoutingChannelClient { - getChannel(channelName: string, router: IClientRouter): T; + getChannel(channelName: string, router?: IClientRouter): T; } interface IReader { @@ -187,7 +190,7 @@ const BufferPresets = { Object: createOneByteBuffer(DataType.Object), }; -declare var Buffer: any; +declare const Buffer: any; const hasBuffer = (typeof Buffer !== 'undefined'); function serialize(writer: IWriter, data: any): void { @@ -553,7 +556,7 @@ export class ChannelClient implements IChannelClient, IDisposable { } }); - const handler: IHandler = (res: IRawEventFireResponse) => emitter.fire(res.data); + const handler: IHandler = (res: IRawResponse) => emitter.fire((res as IRawEventFireResponse).data); this.handlers.set(id, handler); return emitter.event; @@ -659,8 +662,11 @@ export class IPCServer implements IChannelServer, I private channels = new Map>(); private _connections = new Set>(); - private readonly _onDidChangeConnections = new Emitter>(); - readonly onDidChangeConnections: Event> = this._onDidChangeConnections.event; + private readonly _onDidAddConnection = new Emitter>(); + readonly onDidAddConnection: Event> = this._onDidAddConnection.event; + + private readonly _onDidRemoveConnection = new Emitter>(); + readonly onDidRemoveConnection: Event> = this._onDidRemoveConnection.event; get connections(): Connection[] { const result: Connection[] = []; @@ -683,30 +689,59 @@ export class IPCServer implements IChannelServer, I const connection: Connection = { channelServer, channelClient, ctx }; this._connections.add(connection); - this._onDidChangeConnections.fire(connection); + this._onDidAddConnection.fire(connection); onDidClientDisconnect(() => { channelServer.dispose(); channelClient.dispose(); this._connections.delete(connection); + this._onDidRemoveConnection.fire(connection); }); }); }); } - getChannel(channelName: string, router: IClientRouter): T { + /** + * Get a channel from a remote client. When passed a router, + * one can specify which client it wants to call and listen to/from. + * Otherwise, when calling without a router, a random client will + * be selected and when listening without a router, every client + * will be listened to. + */ + getChannel(channelName: string, router: IClientRouter): T; + getChannel(channelName: string, clientFilter: (client: Client) => boolean): T; + getChannel(channelName: string, routerOrClientFilter: IClientRouter | ((client: Client) => boolean)): T { const that = this; return { - call(command: string, arg?: any, cancellationToken?: CancellationToken) { - const channelPromise = router.routeCall(that, command, arg) + call(command: string, arg?: any, cancellationToken?: CancellationToken): Promise { + let connectionPromise: Promise>; + + if (isFunction(routerOrClientFilter)) { + // when no router is provided, we go random client picking + let connection = getRandomElement(that.connections.filter(routerOrClientFilter)); + + connectionPromise = connection + // if we found a client, let's call on it + ? Promise.resolve(connection) + // else, let's wait for a client to come along + : Event.toPromise(Event.filter(that.onDidAddConnection, routerOrClientFilter)); + } else { + connectionPromise = routerOrClientFilter.routeCall(that, command, arg); + } + + const channelPromise = connectionPromise .then(connection => (connection as Connection).channelClient.getChannel(channelName)); return getDelayedChannel(channelPromise) .call(command, arg, cancellationToken); }, - listen(event: string, arg: any) { - const channelPromise = router.routeEvent(that, event, arg) + listen(event: string, arg: any): Event { + if (isFunction(routerOrClientFilter)) { + return that.getMulticastEvent(channelName, routerOrClientFilter, event, arg); + } + + const channelPromise = routerOrClientFilter.routeEvent(that, event, arg) .then(connection => (connection as Connection).channelClient.getChannel(channelName)); return getDelayedChannel(channelPromise) @@ -715,6 +750,58 @@ export class IPCServer implements IChannelServer, I } as T; } + private getMulticastEvent(channelName: string, clientFilter: (client: Client) => boolean, eventName: string, arg: any): Event { + const that = this; + let disposables = new DisposableStore(); + + // Create an emitter which hooks up to all clients + // as soon as first listener is added. It also + // disconnects from all clients as soon as the last listener + // is removed. + const emitter = new Emitter({ + onFirstListenerAdd: () => { + disposables = new DisposableStore(); + + // The event multiplexer is useful since the active + // client list is dynamic. We need to hook up and disconnection + // to/from clients as they come and go. + const eventMultiplexer = new EventMultiplexer(); + const map = new Map, IDisposable>(); + + const onDidAddConnection = (connection: Connection) => { + const channel = connection.channelClient.getChannel(channelName); + const event = channel.listen(eventName, arg); + const disposable = eventMultiplexer.add(event); + + map.set(connection, disposable); + }; + + const onDidRemoveConnection = (connection: Connection) => { + const disposable = map.get(connection); + + if (!disposable) { + return; + } + + disposable.dispose(); + map.delete(connection); + }; + + that.connections.filter(clientFilter).forEach(onDidAddConnection); + Event.filter(that.onDidAddConnection, clientFilter)(onDidAddConnection, undefined, disposables); + that.onDidRemoveConnection(onDidRemoveConnection, undefined, disposables); + eventMultiplexer.event(emitter.fire, emitter, disposables); + + disposables.add(eventMultiplexer); + }, + onLastListenerRemove: () => { + disposables.dispose(); + } + }); + + return emitter.event; + } + registerChannel(channelName: string, channel: IServerChannel): void { this.channels.set(channelName, channel); @@ -726,7 +813,8 @@ export class IPCServer implements IChannelServer, I dispose(): void { this.channels.clear(); this._connections.clear(); - this._onDidChangeConnections.dispose(); + this._onDidAddConnection.dispose(); + this._onDidRemoveConnection.dispose(); } } @@ -827,7 +915,7 @@ export class StaticRouter implements IClientRouter } } - await Event.toPromise(hub.onDidChangeConnections); + await Event.toPromise(hub.onDidAddConnection); return await this.route(hub); } } diff --git a/src/vs/base/parts/ipc/node/ipc.cp.ts b/src/vs/base/parts/ipc/node/ipc.cp.ts index d930cdd4003a8..a5632fdd069ed 100644 --- a/src/vs/base/parts/ipc/node/ipc.cp.ts +++ b/src/vs/base/parts/ipc/node/ipc.cp.ts @@ -227,7 +227,7 @@ export class Client implements IChannelClient, IDisposable { this.child.on('error', err => console.warn('IPC "' + this.options.serverName + '" errored with ' + err)); this.child.on('exit', (code: any, signal: any) => { - process.removeListener('exit', onExit); + process.removeListener('exit' as 'loaded', onExit); // https://github.com/electron/electron/issues/21475 this.activeRequests.forEach(r => dispose(r)); this.activeRequests.clear(); diff --git a/src/vs/base/parts/ipc/node/ipc.net.ts b/src/vs/base/parts/ipc/node/ipc.net.ts index 11e4f516f2244..ec80ba3f1c3a6 100644 --- a/src/vs/base/parts/ipc/node/ipc.net.ts +++ b/src/vs/base/parts/ipc/node/ipc.net.ts @@ -56,7 +56,7 @@ export class NodeSocket implements ISocket { // anyways and nodejs is already doing that for us: // > https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback // > However, the false return value is only advisory and the writable stream will unconditionally - // > accept and buffer chunk even if it has not not been allowed to drain. + // > accept and buffer chunk even if it has not been allowed to drain. this.socket.write(buffer.buffer); } diff --git a/src/vs/base/parts/ipc/test/node/ipc.test.ts b/src/vs/base/parts/ipc/test/node/ipc.test.ts index 589acae53d4e4..3539f5dea8c50 100644 --- a/src/vs/base/parts/ipc/test/node/ipc.test.ts +++ b/src/vs/base/parts/ipc/test/node/ipc.test.ts @@ -415,4 +415,80 @@ suite('Base IPC', function () { return assert.equal(r, 'Super Context'); }); }); + + suite('one to many', function () { + test('all clients get pinged', async function () { + const service = new TestService(); + const channel = new TestChannel(service); + const server = new TestIPCServer(); + server.registerChannel('channel', channel); + + let client1GotPinged = false; + const client1 = server.createConnection('client1'); + const ipcService1 = new TestChannelClient(client1.getChannel('channel')); + ipcService1.onPong(() => client1GotPinged = true); + + let client2GotPinged = false; + const client2 = server.createConnection('client2'); + const ipcService2 = new TestChannelClient(client2.getChannel('channel')); + ipcService2.onPong(() => client2GotPinged = true); + + await timeout(1); + service.ping('hello'); + + await timeout(1); + assert(client1GotPinged, 'client 1 got pinged'); + assert(client2GotPinged, 'client 2 got pinged'); + + client1.dispose(); + client2.dispose(); + server.dispose(); + }); + + test('server gets pings from all clients (broadcast channel)', async function () { + const server = new TestIPCServer(); + + const client1 = server.createConnection('client1'); + const clientService1 = new TestService(); + const clientChannel1 = new TestChannel(clientService1); + client1.registerChannel('channel', clientChannel1); + + const pings: string[] = []; + const channel = server.getChannel('channel', () => true); + const service = new TestChannelClient(channel); + service.onPong(msg => pings.push(msg)); + + await timeout(1); + clientService1.ping('hello 1'); + + await timeout(1); + assert.deepEqual(pings, ['hello 1']); + + const client2 = server.createConnection('client2'); + const clientService2 = new TestService(); + const clientChannel2 = new TestChannel(clientService2); + client2.registerChannel('channel', clientChannel2); + + await timeout(1); + clientService2.ping('hello 2'); + + await timeout(1); + assert.deepEqual(pings, ['hello 1', 'hello 2']); + + client1.dispose(); + clientService1.ping('hello 1'); + + await timeout(1); + assert.deepEqual(pings, ['hello 1', 'hello 2']); + + await timeout(1); + clientService2.ping('hello again 2'); + + await timeout(1); + assert.deepEqual(pings, ['hello 1', 'hello 2', 'hello again 2']); + + client2.dispose(); + server.dispose(); + }); + }); }); diff --git a/src/vs/workbench/browser/parts/quickinput/media/arrow-left-dark.svg b/src/vs/base/parts/quickinput/browser/media/arrow-left-dark.svg similarity index 100% rename from src/vs/workbench/browser/parts/quickinput/media/arrow-left-dark.svg rename to src/vs/base/parts/quickinput/browser/media/arrow-left-dark.svg diff --git a/src/vs/workbench/browser/parts/quickinput/media/arrow-left-light.svg b/src/vs/base/parts/quickinput/browser/media/arrow-left-light.svg similarity index 100% rename from src/vs/workbench/browser/parts/quickinput/media/arrow-left-light.svg rename to src/vs/base/parts/quickinput/browser/media/arrow-left-light.svg diff --git a/src/vs/workbench/browser/parts/quickinput/media/quickInput.css b/src/vs/base/parts/quickinput/browser/media/quickInput.css similarity index 99% rename from src/vs/workbench/browser/parts/quickinput/media/quickInput.css rename to src/vs/base/parts/quickinput/browser/media/quickInput.css index 7d43a8518b883..1a5f4d35f6c41 100644 --- a/src/vs/workbench/browser/parts/quickinput/media/quickInput.css +++ b/src/vs/base/parts/quickinput/browser/media/quickInput.css @@ -45,6 +45,10 @@ background-repeat: no-repeat; } +.quick-input-description { + margin: 6px; +} + .quick-input-header { display: flex; padding: 6px 6px 0px 6px; diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts new file mode 100644 index 0000000000000..afb94d703957e --- /dev/null +++ b/src/vs/base/parts/quickinput/browser/quickInput.ts @@ -0,0 +1,1552 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import 'vs/css!./media/quickInput'; +import { IQuickPickItem, IPickOptions, IInputOptions, IQuickNavigateConfiguration, IQuickPick, IQuickInput, IQuickInputButton, IInputBox, IQuickPickItemButtonEvent, QuickPickInput, IQuickPickSeparator, IKeyMods } from 'vs/base/parts/quickinput/common/quickInput'; +import * as dom from 'vs/base/browser/dom'; +import { CancellationToken } from 'vs/base/common/cancellation'; +import { QuickInputList } from './quickInputList'; +import { QuickInputBox } from './quickInputBox'; +import { KeyCode } from 'vs/base/common/keyCodes'; +import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { localize } from 'vs/nls'; +import { CountBadge, ICountBadgetyles } from 'vs/base/browser/ui/countBadge/countBadge'; +import { ProgressBar, IProgressBarStyles } from 'vs/base/browser/ui/progressbar/progressbar'; +import { Emitter, Event } from 'vs/base/common/event'; +import { Button, IButtonStyles } from 'vs/base/browser/ui/button/button'; +import { dispose, Disposable, DisposableStore } from 'vs/base/common/lifecycle'; +import Severity from 'vs/base/common/severity'; +import { ActionBar, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; +import { Action } from 'vs/base/common/actions'; +import { URI } from 'vs/base/common/uri'; +import { equals } from 'vs/base/common/arrays'; +import { TimeoutTimer } from 'vs/base/common/async'; +import { getIconClass } from 'vs/base/parts/quickinput/browser/quickInputUtils'; +import { registerAndGetAmdImageURL } from 'vs/base/common/amd'; +import { IListVirtualDelegate, IListRenderer } from 'vs/base/browser/ui/list/list'; +import { List, IListOptions, IListStyles } from 'vs/base/browser/ui/list/listWidget'; +import { IInputBoxStyles } from 'vs/base/browser/ui/inputbox/inputBox'; +import { Color } from 'vs/base/common/color'; + +export interface IQuickInputOptions { + idPrefix: string; + container: HTMLElement; + ignoreFocusOut(): boolean; + isScreenReaderOptimized(): boolean; + backKeybindingLabel(): string | undefined; + setContextKey(id?: string): void; + returnFocus(): void; + createList( + user: string, + container: HTMLElement, + delegate: IListVirtualDelegate, + renderers: IListRenderer[], + options: IListOptions, + ): List; + styles: IQuickInputStyles; +} + +export interface IQuickInputStyles { + widget: IQuickInputWidgetStyles; + inputBox: IInputBoxStyles; + countBadge: ICountBadgetyles; + button: IButtonStyles; + progressBar: IProgressBarStyles; + list: IListStyles & { listInactiveFocusForeground?: Color; pickerGroupBorder?: Color; pickerGroupForeground?: Color; }; +} + +export interface IQuickInputWidgetStyles { + quickInputBackground?: Color; + quickInputForeground?: Color; + contrastBorder?: Color; + widgetShadow?: Color; + titleColor: string | undefined; +} + +const $ = dom.$; + +type Writeable = { -readonly [P in keyof T]: T[P] }; + +const backButton = { + iconPath: { + dark: URI.parse(registerAndGetAmdImageURL('vs/base/parts/quickinput/browser/media/arrow-left-dark.svg')), + light: URI.parse(registerAndGetAmdImageURL('vs/base/parts/quickinput/browser/media/arrow-left-light.svg')) + }, + tooltip: localize('quickInput.back', "Back"), + handle: -1 // TODO +}; + +interface QuickInputUI { + container: HTMLElement; + styleSheet: HTMLStyleElement; + leftActionBar: ActionBar; + titleBar: HTMLElement; + title: HTMLElement; + description: HTMLElement; + rightActionBar: ActionBar; + checkAll: HTMLInputElement; + filterContainer: HTMLElement; + inputBox: QuickInputBox; + visibleCountContainer: HTMLElement; + visibleCount: CountBadge; + countContainer: HTMLElement; + count: CountBadge; + okContainer: HTMLElement; + ok: Button; + message: HTMLElement; + customButtonContainer: HTMLElement; + customButton: Button; + progressBar: ProgressBar; + list: QuickInputList; + onDidAccept: Event; + onDidCustom: Event; + onDidTriggerButton: Event; + ignoreFocusOut: boolean; + keyMods: Writeable; + isScreenReaderOptimized(): boolean; + show(controller: QuickInput): void; + setVisibilities(visibilities: Visibilities): void; + setComboboxAccessibility(enabled: boolean): void; + setEnabled(enabled: boolean): void; + setContextKey(contextKey?: string): void; + hide(): void; +} + +type Visibilities = { + title?: boolean; + description?: boolean; + checkAll?: boolean; + inputBox?: boolean; + visibleCount?: boolean; + count?: boolean; + message?: boolean; + list?: boolean; + ok?: boolean; + customButton?: boolean; +}; + +class QuickInput extends Disposable implements IQuickInput { + + private _title: string | undefined; + private _description: string | undefined; + private _steps: number | undefined; + private _totalSteps: number | undefined; + protected visible = false; + private _enabled = true; + private _contextKey: string | undefined; + private _busy = false; + private _ignoreFocusOut = false; + private _buttons: IQuickInputButton[] = []; + private buttonsUpdated = false; + private readonly onDidTriggerButtonEmitter = this._register(new Emitter()); + private readonly onDidHideEmitter = this._register(new Emitter()); + + protected readonly visibleDisposables = this._register(new DisposableStore()); + + private busyDelay: TimeoutTimer | undefined; + + constructor( + protected ui: QuickInputUI + ) { + super(); + } + + get title() { + return this._title; + } + + set title(title: string | undefined) { + this._title = title; + this.update(); + } + + get description() { + return this._description; + } + + set description(description: string | undefined) { + this._description = description; + this.update(); + } + + get step() { + return this._steps; + } + + set step(step: number | undefined) { + this._steps = step; + this.update(); + } + + get totalSteps() { + return this._totalSteps; + } + + set totalSteps(totalSteps: number | undefined) { + this._totalSteps = totalSteps; + this.update(); + } + + get enabled() { + return this._enabled; + } + + set enabled(enabled: boolean) { + this._enabled = enabled; + this.update(); + } + + get contextKey() { + return this._contextKey; + } + + set contextKey(contextKey: string | undefined) { + this._contextKey = contextKey; + this.update(); + } + + get busy() { + return this._busy; + } + + set busy(busy: boolean) { + this._busy = busy; + this.update(); + } + + get ignoreFocusOut() { + return this._ignoreFocusOut; + } + + set ignoreFocusOut(ignoreFocusOut: boolean) { + this._ignoreFocusOut = ignoreFocusOut; + this.update(); + } + + get buttons() { + return this._buttons; + } + + set buttons(buttons: IQuickInputButton[]) { + this._buttons = buttons; + this.buttonsUpdated = true; + this.update(); + } + + onDidTriggerButton = this.onDidTriggerButtonEmitter.event; + + show(): void { + if (this.visible) { + return; + } + this.visibleDisposables.add( + this.ui.onDidTriggerButton(button => { + if (this.buttons.indexOf(button) !== -1) { + this.onDidTriggerButtonEmitter.fire(button); + } + }), + ); + this.ui.show(this); + this.visible = true; + this.update(); + } + + hide(): void { + if (!this.visible) { + return; + } + this.ui.hide(); + } + + didHide(): void { + this.visible = false; + this.visibleDisposables.clear(); + this.onDidHideEmitter.fire(); + } + + onDidHide = this.onDidHideEmitter.event; + + protected update() { + if (!this.visible) { + return; + } + const title = this.getTitle(); + if (this.ui.title.textContent !== title) { + this.ui.title.textContent = title; + } + const description = this.getDescription(); + if (this.ui.description.textContent !== description) { + this.ui.description.textContent = description; + } + if (this.busy && !this.busyDelay) { + this.busyDelay = new TimeoutTimer(); + this.busyDelay.setIfNotSet(() => { + if (this.visible) { + this.ui.progressBar.infinite(); + } + }, 800); + } + if (!this.busy && this.busyDelay) { + this.ui.progressBar.stop(); + this.busyDelay.cancel(); + this.busyDelay = undefined; + } + if (this.buttonsUpdated) { + this.buttonsUpdated = false; + this.ui.leftActionBar.clear(); + const leftButtons = this.buttons.filter(button => button === backButton); + this.ui.leftActionBar.push(leftButtons.map((button, index) => { + const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => { + this.onDidTriggerButtonEmitter.fire(button); + return Promise.resolve(null); + }); + action.tooltip = button.tooltip || ''; + return action; + }), { icon: true, label: false }); + this.ui.rightActionBar.clear(); + const rightButtons = this.buttons.filter(button => button !== backButton); + this.ui.rightActionBar.push(rightButtons.map((button, index) => { + const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => { + this.onDidTriggerButtonEmitter.fire(button); + return Promise.resolve(null); + }); + action.tooltip = button.tooltip || ''; + return action; + }), { icon: true, label: false }); + } + this.ui.ignoreFocusOut = this.ignoreFocusOut; + this.ui.setEnabled(this.enabled); + this.ui.setContextKey(this.contextKey); + } + + private getTitle() { + if (this.title && this.step) { + return `${this.title} (${this.getSteps()})`; + } + if (this.title) { + return this.title; + } + if (this.step) { + return this.getSteps(); + } + return ''; + } + + private getDescription() { + return this.description || ''; + } + + private getSteps() { + if (this.step && this.totalSteps) { + return localize('quickInput.steps', "{0}/{1}", this.step, this.totalSteps); + } + if (this.step) { + return String(this.step); + } + return ''; + } + + protected showMessageDecoration(severity: Severity) { + this.ui.inputBox.showDecoration(severity); + if (severity === Severity.Error) { + const styles = this.ui.inputBox.stylesForType(severity); + this.ui.message.style.backgroundColor = styles.background ? `${styles.background}` : ''; + this.ui.message.style.border = styles.border ? `1px solid ${styles.border}` : ''; + this.ui.message.style.paddingBottom = '4px'; + } else { + this.ui.message.style.backgroundColor = ''; + this.ui.message.style.border = ''; + this.ui.message.style.paddingBottom = ''; + } + } + + public dispose(): void { + this.hide(); + super.dispose(); + } +} + +class QuickPick extends QuickInput implements IQuickPick { + + private static readonly INPUT_BOX_ARIA_LABEL = localize('quickInputBox.ariaLabel', "Type to narrow down results."); + + private _value = ''; + private _placeholder: string | undefined; + private readonly onDidChangeValueEmitter = this._register(new Emitter()); + private readonly onDidAcceptEmitter = this._register(new Emitter()); + private readonly onDidCustomEmitter = this._register(new Emitter()); + private _items: Array = []; + private itemsUpdated = false; + private _canSelectMany = false; + private _matchOnDescription = false; + private _matchOnDetail = false; + private _matchOnLabel = true; + private _sortByLabel = true; + private _autoFocusOnList = true; + private _activeItems: T[] = []; + private activeItemsUpdated = false; + private activeItemsToConfirm: T[] | null = []; + private readonly onDidChangeActiveEmitter = this._register(new Emitter()); + private _selectedItems: T[] = []; + private selectedItemsUpdated = false; + private selectedItemsToConfirm: T[] | null = []; + private readonly onDidChangeSelectionEmitter = this._register(new Emitter()); + private readonly onDidTriggerItemButtonEmitter = this._register(new Emitter>()); + private _valueSelection: Readonly<[number, number]> | undefined; + private valueSelectionUpdated = true; + private _validationMessage: string | undefined; + private _ok = false; + private _customButton = false; + private _customButtonLabel: string | undefined; + private _customButtonHover: string | undefined; + + quickNavigate: IQuickNavigateConfiguration | undefined; + + + get value() { + return this._value; + } + + set value(value: string) { + this._value = value || ''; + this.update(); + } + + get placeholder() { + return this._placeholder; + } + + set placeholder(placeholder: string | undefined) { + this._placeholder = placeholder; + this.update(); + } + + onDidChangeValue = this.onDidChangeValueEmitter.event; + + onDidAccept = this.onDidAcceptEmitter.event; + + onDidCustom = this.onDidCustomEmitter.event; + + get items() { + return this._items; + } + + set items(items: Array) { + this._items = items; + this.itemsUpdated = true; + this.update(); + } + + get canSelectMany() { + return this._canSelectMany; + } + + set canSelectMany(canSelectMany: boolean) { + this._canSelectMany = canSelectMany; + this.update(); + } + + get matchOnDescription() { + return this._matchOnDescription; + } + + set matchOnDescription(matchOnDescription: boolean) { + this._matchOnDescription = matchOnDescription; + this.update(); + } + + get matchOnDetail() { + return this._matchOnDetail; + } + + set matchOnDetail(matchOnDetail: boolean) { + this._matchOnDetail = matchOnDetail; + this.update(); + } + + get matchOnLabel() { + return this._matchOnLabel; + } + + set matchOnLabel(matchOnLabel: boolean) { + this._matchOnLabel = matchOnLabel; + this.update(); + } + + get sortByLabel() { + return this._sortByLabel; + } + + set sortByLabel(sortByLabel: boolean) { + this._sortByLabel = sortByLabel; + this.update(); + } + + + get autoFocusOnList() { + return this._autoFocusOnList; + } + + set autoFocusOnList(autoFocusOnList: boolean) { + this._autoFocusOnList = autoFocusOnList; + this.update(); + } + + get activeItems() { + return this._activeItems; + } + + set activeItems(activeItems: T[]) { + this._activeItems = activeItems; + this.activeItemsUpdated = true; + this.update(); + } + + onDidChangeActive = this.onDidChangeActiveEmitter.event; + + get selectedItems() { + return this._selectedItems; + } + + set selectedItems(selectedItems: T[]) { + this._selectedItems = selectedItems; + this.selectedItemsUpdated = true; + this.update(); + } + + get keyMods() { + return this.ui.keyMods; + } + + set valueSelection(valueSelection: Readonly<[number, number]>) { + this._valueSelection = valueSelection; + this.valueSelectionUpdated = true; + this.update(); + } + + get validationMessage() { + return this._validationMessage; + } + + set validationMessage(validationMessage: string | undefined) { + this._validationMessage = validationMessage; + this.update(); + } + + get customButton() { + return this._customButton; + } + + set customButton(showCustomButton: boolean) { + this._customButton = showCustomButton; + this.update(); + } + + get customLabel() { + return this._customButtonLabel; + } + + set customLabel(label: string | undefined) { + this._customButtonLabel = label; + this.update(); + } + + get customHover() { + return this._customButtonHover; + } + + set customHover(hover: string | undefined) { + this._customButtonHover = hover; + this.update(); + } + + get ok() { + return this._ok; + } + + set ok(showOkButton: boolean) { + this._ok = showOkButton; + this.update(); + } + + public inputHasFocus(): boolean { + return this.visible ? this.ui.inputBox.hasFocus() : false; + } + + onDidChangeSelection = this.onDidChangeSelectionEmitter.event; + + onDidTriggerItemButton = this.onDidTriggerItemButtonEmitter.event; + + private trySelectFirst() { + if (this.autoFocusOnList) { + if (!this.ui.isScreenReaderOptimized() && !this.canSelectMany) { + this.ui.list.focus('First'); + } + } + } + + show() { + if (!this.visible) { + this.visibleDisposables.add( + this.ui.inputBox.onDidChange(value => { + if (value === this.value) { + return; + } + this._value = value; + this.ui.list.filter(this.ui.inputBox.value); + this.trySelectFirst(); + this.onDidChangeValueEmitter.fire(value); + })); + this.visibleDisposables.add(this.ui.inputBox.onMouseDown(event => { + if (!this.autoFocusOnList) { + this.ui.list.clearFocus(); + } + })); + this.visibleDisposables.add(this.ui.inputBox.onKeyDown(event => { + switch (event.keyCode) { + case KeyCode.DownArrow: + this.ui.list.focus('Next'); + if (this.canSelectMany) { + this.ui.list.domFocus(); + } + event.preventDefault(); + break; + case KeyCode.UpArrow: + if (this.ui.list.getFocusedElements().length) { + this.ui.list.focus('Previous'); + } else { + this.ui.list.focus('Last'); + } + if (this.canSelectMany) { + this.ui.list.domFocus(); + } + event.preventDefault(); + break; + case KeyCode.PageDown: + if (this.ui.list.getFocusedElements().length) { + this.ui.list.focus('NextPage'); + } else { + this.ui.list.focus('First'); + } + if (this.canSelectMany) { + this.ui.list.domFocus(); + } + event.preventDefault(); + break; + case KeyCode.PageUp: + if (this.ui.list.getFocusedElements().length) { + this.ui.list.focus('PreviousPage'); + } else { + this.ui.list.focus('Last'); + } + if (this.canSelectMany) { + this.ui.list.domFocus(); + } + event.preventDefault(); + break; + } + })); + this.visibleDisposables.add(this.ui.onDidAccept(() => { + if (!this.canSelectMany && this.activeItems[0]) { + this._selectedItems = [this.activeItems[0]]; + this.onDidChangeSelectionEmitter.fire(this.selectedItems); + } + this.onDidAcceptEmitter.fire(undefined); + })); + this.visibleDisposables.add(this.ui.onDidCustom(() => { + this.onDidCustomEmitter.fire(undefined); + })); + this.visibleDisposables.add(this.ui.list.onDidChangeFocus(focusedItems => { + if (this.activeItemsUpdated) { + return; // Expect another event. + } + if (this.activeItemsToConfirm !== this._activeItems && equals(focusedItems, this._activeItems, (a, b) => a === b)) { + return; + } + this._activeItems = focusedItems as T[]; + this.onDidChangeActiveEmitter.fire(focusedItems as T[]); + })); + this.visibleDisposables.add(this.ui.list.onDidChangeSelection(selectedItems => { + if (this.canSelectMany) { + if (selectedItems.length) { + this.ui.list.setSelectedElements([]); + } + return; + } + if (this.selectedItemsToConfirm !== this._selectedItems && equals(selectedItems, this._selectedItems, (a, b) => a === b)) { + return; + } + this._selectedItems = selectedItems as T[]; + this.onDidChangeSelectionEmitter.fire(selectedItems as T[]); + if (selectedItems.length) { + this.onDidAcceptEmitter.fire(undefined); + } + })); + this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(checkedItems => { + if (!this.canSelectMany) { + return; + } + if (this.selectedItemsToConfirm !== this._selectedItems && equals(checkedItems, this._selectedItems, (a, b) => a === b)) { + return; + } + this._selectedItems = checkedItems as T[]; + this.onDidChangeSelectionEmitter.fire(checkedItems as T[]); + })); + this.visibleDisposables.add(this.ui.list.onButtonTriggered(event => this.onDidTriggerItemButtonEmitter.fire(event as IQuickPickItemButtonEvent))); + this.visibleDisposables.add(this.registerQuickNavigation()); + this.valueSelectionUpdated = true; + } + super.show(); // TODO: Why have show() bubble up while update() trickles down? (Could move setComboboxAccessibility() here.) + } + + private registerQuickNavigation() { + return dom.addDisposableListener(this.ui.container, dom.EventType.KEY_UP, e => { + if (this.canSelectMany || !this.quickNavigate) { + return; + } + + const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e); + const keyCode = keyboardEvent.keyCode; + + // Select element when keys are pressed that signal it + const quickNavKeys = this.quickNavigate.keybindings; + const wasTriggerKeyPressed = quickNavKeys.some(k => { + const [firstPart, chordPart] = k.getParts(); + if (chordPart) { + return false; + } + + if (firstPart.shiftKey && keyCode === KeyCode.Shift) { + if (keyboardEvent.ctrlKey || keyboardEvent.altKey || keyboardEvent.metaKey) { + return false; // this is an optimistic check for the shift key being used to navigate back in quick open + } + + return true; + } + + if (firstPart.altKey && keyCode === KeyCode.Alt) { + return true; + } + + if (firstPart.ctrlKey && keyCode === KeyCode.Ctrl) { + return true; + } + + if (firstPart.metaKey && keyCode === KeyCode.Meta) { + return true; + } + + return false; + }); + + if (wasTriggerKeyPressed && this.activeItems[0]) { + this._selectedItems = [this.activeItems[0]]; + this.onDidChangeSelectionEmitter.fire(this.selectedItems); + this.onDidAcceptEmitter.fire(undefined); + } + }); + } + + protected update() { + if (!this.visible) { + return; + } + this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, description: !!this.description, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: this.ok, list: true, message: !!this.validationMessage, customButton: this.customButton } : { title: !!this.title || !!this.step, description: !!this.description, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage, customButton: this.customButton, ok: this.ok }); + super.update(); + if (this.ui.inputBox.value !== this.value) { + this.ui.inputBox.value = this.value; + } + if (this.valueSelectionUpdated) { + this.valueSelectionUpdated = false; + this.ui.inputBox.select(this._valueSelection && { start: this._valueSelection[0], end: this._valueSelection[1] }); + } + if (this.ui.inputBox.placeholder !== (this.placeholder || '')) { + this.ui.inputBox.placeholder = (this.placeholder || ''); + } + if (this.itemsUpdated) { + this.itemsUpdated = false; + this.ui.list.setElements(this.items); + this.ui.list.filter(this.ui.inputBox.value); + this.ui.checkAll.checked = this.ui.list.getAllVisibleChecked(); + this.ui.visibleCount.setCount(this.ui.list.getVisibleCount()); + this.ui.count.setCount(this.ui.list.getCheckedCount()); + this.trySelectFirst(); + } + if (this.ui.container.classList.contains('show-checkboxes') !== !!this.canSelectMany) { + if (this.canSelectMany) { + this.ui.list.clearFocus(); + } else { + this.trySelectFirst(); + } + } + if (this.activeItemsUpdated) { + this.activeItemsUpdated = false; + this.activeItemsToConfirm = this._activeItems; + this.ui.list.setFocusedElements(this.activeItems); + if (this.activeItemsToConfirm === this._activeItems) { + this.activeItemsToConfirm = null; + } + } + if (this.selectedItemsUpdated) { + this.selectedItemsUpdated = false; + this.selectedItemsToConfirm = this._selectedItems; + if (this.canSelectMany) { + this.ui.list.setCheckedElements(this.selectedItems); + } else { + this.ui.list.setSelectedElements(this.selectedItems); + } + if (this.selectedItemsToConfirm === this._selectedItems) { + this.selectedItemsToConfirm = null; + } + } + if (this.validationMessage) { + this.ui.message.textContent = this.validationMessage; + this.showMessageDecoration(Severity.Error); + } else { + this.ui.message.textContent = null; + this.showMessageDecoration(Severity.Ignore); + } + this.ui.customButton.label = this.customLabel || ''; + this.ui.customButton.element.title = this.customHover || ''; + this.ui.list.matchOnDescription = this.matchOnDescription; + this.ui.list.matchOnDetail = this.matchOnDetail; + this.ui.list.matchOnLabel = this.matchOnLabel; + this.ui.list.sortByLabel = this.sortByLabel; + this.ui.setComboboxAccessibility(true); + this.ui.inputBox.setAttribute('aria-label', QuickPick.INPUT_BOX_ARIA_LABEL); + } +} + +class InputBox extends QuickInput implements IInputBox { + + private static readonly noPromptMessage = localize('inputModeEntry', "Press 'Enter' to confirm your input or 'Escape' to cancel"); + + private _value = ''; + private _valueSelection: Readonly<[number, number]> | undefined; + private valueSelectionUpdated = true; + private _placeholder: string | undefined; + private _password = false; + private _prompt: string | undefined; + private noValidationMessage = InputBox.noPromptMessage; + private _validationMessage: string | undefined; + private readonly onDidValueChangeEmitter = this._register(new Emitter()); + private readonly onDidAcceptEmitter = this._register(new Emitter()); + + get value() { + return this._value; + } + + set value(value: string) { + this._value = value || ''; + this.update(); + } + + set valueSelection(valueSelection: Readonly<[number, number]>) { + this._valueSelection = valueSelection; + this.valueSelectionUpdated = true; + this.update(); + } + + get placeholder() { + return this._placeholder; + } + + set placeholder(placeholder: string | undefined) { + this._placeholder = placeholder; + this.update(); + } + + get password() { + return this._password; + } + + set password(password: boolean) { + this._password = password; + this.update(); + } + + get prompt() { + return this._prompt; + } + + set prompt(prompt: string | undefined) { + this._prompt = prompt; + this.noValidationMessage = prompt + ? localize('inputModeEntryDescription', "{0} (Press 'Enter' to confirm or 'Escape' to cancel)", prompt) + : InputBox.noPromptMessage; + this.update(); + } + + get validationMessage() { + return this._validationMessage; + } + + set validationMessage(validationMessage: string | undefined) { + this._validationMessage = validationMessage; + this.update(); + } + + readonly onDidChangeValue = this.onDidValueChangeEmitter.event; + + readonly onDidAccept = this.onDidAcceptEmitter.event; + + show() { + if (!this.visible) { + this.visibleDisposables.add( + this.ui.inputBox.onDidChange(value => { + if (value === this.value) { + return; + } + this._value = value; + this.onDidValueChangeEmitter.fire(value); + })); + this.visibleDisposables.add(this.ui.onDidAccept(() => this.onDidAcceptEmitter.fire(undefined))); + this.valueSelectionUpdated = true; + } + super.show(); + } + + protected update() { + if (!this.visible) { + return; + } + this.ui.setVisibilities({ title: !!this.title || !!this.step, description: !!this.description || !!this.step, inputBox: true, message: true }); + super.update(); + if (this.ui.inputBox.value !== this.value) { + this.ui.inputBox.value = this.value; + } + if (this.valueSelectionUpdated) { + this.valueSelectionUpdated = false; + this.ui.inputBox.select(this._valueSelection && { start: this._valueSelection[0], end: this._valueSelection[1] }); + } + if (this.ui.inputBox.placeholder !== (this.placeholder || '')) { + this.ui.inputBox.placeholder = (this.placeholder || ''); + } + if (this.ui.inputBox.password !== this.password) { + this.ui.inputBox.password = this.password; + } + if (!this.validationMessage && this.ui.message.textContent !== this.noValidationMessage) { + this.ui.message.textContent = this.noValidationMessage; + this.showMessageDecoration(Severity.Ignore); + } + if (this.validationMessage && this.ui.message.textContent !== this.validationMessage) { + this.ui.message.textContent = this.validationMessage; + this.showMessageDecoration(Severity.Error); + } + } +} + +export class QuickInputController extends Disposable { + private static readonly MAX_WIDTH = 600; // Max total width of quick open widget + + private idPrefix: string; + private ui: QuickInputUI | undefined; + private dimension?: dom.Dimension; + private titleBarOffset?: number; + private comboboxAccessibility = false; + private enabled = true; + private readonly onDidAcceptEmitter = this._register(new Emitter()); + private readonly onDidCustomEmitter = this._register(new Emitter()); + private readonly onDidTriggerButtonEmitter = this._register(new Emitter()); + private keyMods: Writeable = { ctrlCmd: false, alt: false }; + + private controller: QuickInput | null = null; + + private parentElement: HTMLElement; + private styles: IQuickInputStyles; + private onShowEmitter = new Emitter(); + private onHideEmitter = new Emitter(); + public onShow = this.onShowEmitter.event; + public onHide = this.onHideEmitter.event; + + constructor(private options: IQuickInputOptions) { + super(); + this.idPrefix = options.idPrefix; + this.parentElement = options.container; + this.styles = options.styles; + this.registerKeyModsListeners(); + } + + private registerKeyModsListeners() { + this._register(dom.addDisposableListener(this.parentElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { + const event = new StandardKeyboardEvent(e); + switch (event.keyCode) { + case KeyCode.Ctrl: + case KeyCode.Meta: + this.keyMods.ctrlCmd = true; + break; + case KeyCode.Alt: + this.keyMods.alt = true; + break; + } + })); + this._register(dom.addDisposableListener(this.parentElement, dom.EventType.KEY_UP, (e: KeyboardEvent) => { + const event = new StandardKeyboardEvent(e); + switch (event.keyCode) { + case KeyCode.Ctrl: + case KeyCode.Meta: + this.keyMods.ctrlCmd = false; + break; + case KeyCode.Alt: + this.keyMods.alt = false; + break; + } + })); + } + + private getUI() { + if (this.ui) { + return this.ui; + } + + const container = dom.append(this.parentElement, $('.quick-input-widget.show-file-icons')); + container.tabIndex = -1; + container.style.display = 'none'; + + const styleSheet = dom.createStyleSheet(container); + + const titleBar = dom.append(container, $('.quick-input-titlebar')); + + const leftActionBar = this._register(new ActionBar(titleBar)); + leftActionBar.domNode.classList.add('quick-input-left-action-bar'); + + const title = dom.append(titleBar, $('.quick-input-title')); + + const rightActionBar = this._register(new ActionBar(titleBar)); + rightActionBar.domNode.classList.add('quick-input-right-action-bar'); + + const description = dom.append(container, $('.quick-input-description')); + + const headerContainer = dom.append(container, $('.quick-input-header')); + + const checkAll = dom.append(headerContainer, $('input.quick-input-check-all')); + checkAll.type = 'checkbox'; + this._register(dom.addStandardDisposableListener(checkAll, dom.EventType.CHANGE, e => { + const checked = checkAll.checked; + list.setAllVisibleChecked(checked); + })); + this._register(dom.addDisposableListener(checkAll, dom.EventType.CLICK, e => { + if (e.x || e.y) { // Avoid 'click' triggered by 'space'... + inputBox.setFocus(); + } + })); + + const extraContainer = dom.append(headerContainer, $('.quick-input-and-message')); + const filterContainer = dom.append(extraContainer, $('.quick-input-filter')); + + const inputBox = this._register(new QuickInputBox(filterContainer)); + inputBox.setAttribute('aria-describedby', `${this.idPrefix}message`); + + const visibleCountContainer = dom.append(filterContainer, $('.quick-input-visible-count')); + visibleCountContainer.setAttribute('aria-live', 'polite'); + visibleCountContainer.setAttribute('aria-atomic', 'true'); + const visibleCount = new CountBadge(visibleCountContainer, { countFormat: localize({ key: 'quickInput.visibleCount', comment: ['This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers.'] }, "{0} Results") }); + + const countContainer = dom.append(filterContainer, $('.quick-input-count')); + countContainer.setAttribute('aria-live', 'polite'); + const count = new CountBadge(countContainer, { countFormat: localize({ key: 'quickInput.countSelected', comment: ['This tells the user how many items are selected in a list of items to select from. The items can be anything.'] }, "{0} Selected") }); + + const okContainer = dom.append(headerContainer, $('.quick-input-action')); + const ok = new Button(okContainer); + ok.label = localize('ok', "OK"); + this._register(ok.onDidClick(e => { + this.onDidAcceptEmitter.fire(); + })); + + const customButtonContainer = dom.append(headerContainer, $('.quick-input-action')); + const customButton = new Button(customButtonContainer); + customButton.label = localize('custom', "Custom"); + this._register(customButton.onDidClick(e => { + this.onDidCustomEmitter.fire(); + })); + + const message = dom.append(extraContainer, $(`#${this.idPrefix}message.quick-input-message`)); + + const progressBar = new ProgressBar(container); + dom.addClass(progressBar.getContainer(), 'quick-input-progress'); + + const list = this._register(new QuickInputList(container, this.idPrefix + 'list', this.options)); + this._register(list.onChangedAllVisibleChecked(checked => { + checkAll.checked = checked; + })); + this._register(list.onChangedVisibleCount(c => { + visibleCount.setCount(c); + })); + this._register(list.onChangedCheckedCount(c => { + count.setCount(c); + })); + this._register(list.onLeave(() => { + // Defer to avoid the input field reacting to the triggering key. + setTimeout(() => { + inputBox.setFocus(); + if (this.controller instanceof QuickPick && this.controller.canSelectMany) { + list.clearFocus(); + } + }, 0); + })); + this._register(list.onDidChangeFocus(() => { + if (this.comboboxAccessibility) { + this.getUI().inputBox.setAttribute('aria-activedescendant', this.getUI().list.getActiveDescendant() || ''); + } + })); + + const focusTracker = dom.trackFocus(container); + this._register(focusTracker); + this._register(focusTracker.onDidBlur(() => { + if (!this.getUI().ignoreFocusOut && !this.options.ignoreFocusOut()) { + this.hide(true); + } + })); + this._register(dom.addDisposableListener(container, dom.EventType.FOCUS, (e: FocusEvent) => { + inputBox.setFocus(); + })); + this._register(dom.addDisposableListener(container, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { + const event = new StandardKeyboardEvent(e); + switch (event.keyCode) { + case KeyCode.Enter: + dom.EventHelper.stop(e, true); + this.onDidAcceptEmitter.fire(); + break; + case KeyCode.Escape: + dom.EventHelper.stop(e, true); + this.hide(); + break; + case KeyCode.Tab: + if (!event.altKey && !event.ctrlKey && !event.metaKey) { + const selectors = ['.action-label.codicon']; + if (container.classList.contains('show-checkboxes')) { + selectors.push('input'); + } else { + selectors.push('input[type=text]'); + } + if (this.getUI().list.isDisplayed()) { + selectors.push('.monaco-list'); + } + const stops = container.querySelectorAll(selectors.join(', ')); + if (event.shiftKey && event.target === stops[0]) { + dom.EventHelper.stop(e, true); + stops[stops.length - 1].focus(); + } else if (!event.shiftKey && event.target === stops[stops.length - 1]) { + dom.EventHelper.stop(e, true); + stops[0].focus(); + } + } + break; + } + })); + + this.ui = { + container, + styleSheet, + leftActionBar, + titleBar, + title, + description, + rightActionBar, + checkAll, + filterContainer, + inputBox, + visibleCountContainer, + visibleCount, + countContainer, + count, + okContainer, + ok, + message, + customButtonContainer, + customButton, + progressBar, + list, + onDidAccept: this.onDidAcceptEmitter.event, + onDidCustom: this.onDidCustomEmitter.event, + onDidTriggerButton: this.onDidTriggerButtonEmitter.event, + ignoreFocusOut: false, + keyMods: this.keyMods, + isScreenReaderOptimized: () => this.options.isScreenReaderOptimized(), + show: controller => this.show(controller), + hide: () => this.hide(), + setVisibilities: visibilities => this.setVisibilities(visibilities), + setComboboxAccessibility: enabled => this.setComboboxAccessibility(enabled), + setEnabled: enabled => this.setEnabled(enabled), + setContextKey: contextKey => this.options.setContextKey(contextKey), + }; + this.updateStyles(); + return this.ui; + } + + pick>(picks: Promise[]> | QuickPickInput[], options: O = {}, token: CancellationToken = CancellationToken.None): Promise { + return new Promise((doResolve, reject) => { + let resolve = (result: any) => { + resolve = doResolve; + if (options.onKeyMods) { + options.onKeyMods(input.keyMods); + } + doResolve(result); + }; + if (token.isCancellationRequested) { + resolve(undefined); + return; + } + const input = this.createQuickPick(); + let activeItem: T | undefined; + const disposables = [ + input, + input.onDidAccept(() => { + if (input.canSelectMany) { + resolve(input.selectedItems.slice()); + input.hide(); + } else { + const result = input.activeItems[0]; + if (result) { + resolve(result); + input.hide(); + } + } + }), + input.onDidChangeActive(items => { + const focused = items[0]; + if (focused && options.onDidFocus) { + options.onDidFocus(focused); + } + }), + input.onDidChangeSelection(items => { + if (!input.canSelectMany) { + const result = items[0]; + if (result) { + resolve(result); + input.hide(); + } + } + }), + input.onDidTriggerItemButton(event => options.onDidTriggerItemButton && options.onDidTriggerItemButton({ + ...event, + removeItem: () => { + const index = input.items.indexOf(event.item); + if (index !== -1) { + const items = input.items.slice(); + items.splice(index, 1); + input.items = items; + } + } + })), + input.onDidChangeValue(value => { + if (activeItem && !value && (input.activeItems.length !== 1 || input.activeItems[0] !== activeItem)) { + input.activeItems = [activeItem]; + } + }), + token.onCancellationRequested(() => { + input.hide(); + }), + input.onDidHide(() => { + dispose(disposables); + resolve(undefined); + }), + ]; + input.canSelectMany = !!options.canPickMany; + input.placeholder = options.placeHolder; + input.ignoreFocusOut = !!options.ignoreFocusLost; + input.matchOnDescription = !!options.matchOnDescription; + input.matchOnDetail = !!options.matchOnDetail; + input.matchOnLabel = (options.matchOnLabel === undefined) || options.matchOnLabel; // default to true + input.autoFocusOnList = (options.autoFocusOnList === undefined) || options.autoFocusOnList; // default to true + input.quickNavigate = options.quickNavigate; + input.contextKey = options.contextKey; + input.busy = true; + Promise.all[], T | undefined>([picks, options.activeItem]) + .then(([items, _activeItem]) => { + activeItem = _activeItem; + input.busy = false; + input.items = items; + if (input.canSelectMany) { + input.selectedItems = items.filter(item => item.type !== 'separator' && item.picked) as T[]; + } + if (activeItem) { + input.activeItems = [activeItem]; + } + }); + input.show(); + Promise.resolve(picks).then(undefined, err => { + reject(err); + input.hide(); + }); + }); + } + + input(options: IInputOptions = {}, token: CancellationToken = CancellationToken.None): Promise { + return new Promise((resolve, reject) => { + if (token.isCancellationRequested) { + resolve(undefined); + return; + } + const input = this.createInputBox(); + const validateInput = options.validateInput || (() => >Promise.resolve(undefined)); + const onDidValueChange = Event.debounce(input.onDidChangeValue, (last, cur) => cur, 100); + let validationValue = options.value || ''; + let validation = Promise.resolve(validateInput(validationValue)); + const disposables = [ + input, + onDidValueChange(value => { + if (value !== validationValue) { + validation = Promise.resolve(validateInput(value)); + validationValue = value; + } + validation.then(result => { + if (value === validationValue) { + input.validationMessage = result || undefined; + } + }); + }), + input.onDidAccept(() => { + const value = input.value; + if (value !== validationValue) { + validation = Promise.resolve(validateInput(value)); + validationValue = value; + } + validation.then(result => { + if (!result) { + resolve(value); + input.hide(); + } else if (value === validationValue) { + input.validationMessage = result; + } + }); + }), + token.onCancellationRequested(() => { + input.hide(); + }), + input.onDidHide(() => { + dispose(disposables); + resolve(undefined); + }), + ]; + input.value = options.value || ''; + input.valueSelection = options.valueSelection; + input.prompt = options.prompt; + input.placeholder = options.placeHolder; + input.password = !!options.password; + input.ignoreFocusOut = !!options.ignoreFocusLost; + input.show(); + }); + } + + backButton = backButton; + + createQuickPick(): IQuickPick { + const ui = this.getUI(); + return new QuickPick(ui); + } + + createInputBox(): IInputBox { + const ui = this.getUI(); + return new InputBox(ui); + } + + private show(controller: QuickInput) { + const ui = this.getUI(); + this.onShowEmitter.fire(); + const oldController = this.controller; + this.controller = controller; + if (oldController) { + oldController.didHide(); + } + + this.setEnabled(true); + ui.leftActionBar.clear(); + ui.title.textContent = ''; + ui.description.textContent = ''; + ui.rightActionBar.clear(); + ui.checkAll.checked = false; + // ui.inputBox.value = ''; Avoid triggering an event. + ui.inputBox.placeholder = ''; + ui.inputBox.password = false; + ui.inputBox.showDecoration(Severity.Ignore); + ui.visibleCount.setCount(0); + ui.count.setCount(0); + ui.message.textContent = ''; + ui.progressBar.stop(); + ui.list.setElements([]); + ui.list.matchOnDescription = false; + ui.list.matchOnDetail = false; + ui.list.matchOnLabel = true; + ui.list.sortByLabel = true; + ui.ignoreFocusOut = false; + this.setComboboxAccessibility(false); + ui.inputBox.removeAttribute('aria-label'); + + const backKeybindingLabel = this.options.backKeybindingLabel(); + backButton.tooltip = backKeybindingLabel ? localize('quickInput.backWithKeybinding', "Back ({0})", backKeybindingLabel) : localize('quickInput.back', "Back"); + + ui.container.style.display = ''; + this.updateLayout(); + ui.inputBox.setFocus(); + } + + private setVisibilities(visibilities: Visibilities) { + const ui = this.getUI(); + ui.title.style.display = visibilities.title ? '' : 'none'; + ui.description.style.display = visibilities.description ? '' : 'none'; + ui.checkAll.style.display = visibilities.checkAll ? '' : 'none'; + ui.filterContainer.style.display = visibilities.inputBox ? '' : 'none'; + ui.visibleCountContainer.style.display = visibilities.visibleCount ? '' : 'none'; + ui.countContainer.style.display = visibilities.count ? '' : 'none'; + ui.okContainer.style.display = visibilities.ok ? '' : 'none'; + ui.customButtonContainer.style.display = visibilities.customButton ? '' : 'none'; + ui.message.style.display = visibilities.message ? '' : 'none'; + ui.list.display(!!visibilities.list); + ui.container.classList[visibilities.checkAll ? 'add' : 'remove']('show-checkboxes'); + this.updateLayout(); // TODO + } + + private setComboboxAccessibility(enabled: boolean) { + if (enabled !== this.comboboxAccessibility) { + const ui = this.getUI(); + this.comboboxAccessibility = enabled; + if (this.comboboxAccessibility) { + ui.inputBox.setAttribute('role', 'combobox'); + ui.inputBox.setAttribute('aria-haspopup', 'true'); + ui.inputBox.setAttribute('aria-autocomplete', 'list'); + ui.inputBox.setAttribute('aria-activedescendant', ui.list.getActiveDescendant() || ''); + } else { + ui.inputBox.removeAttribute('role'); + ui.inputBox.removeAttribute('aria-haspopup'); + ui.inputBox.removeAttribute('aria-autocomplete'); + ui.inputBox.removeAttribute('aria-activedescendant'); + } + } + } + + private setEnabled(enabled: boolean) { + if (enabled !== this.enabled) { + this.enabled = enabled; + for (const item of this.getUI().leftActionBar.viewItems) { + (item as ActionViewItem).getAction().enabled = enabled; + } + for (const item of this.getUI().rightActionBar.viewItems) { + (item as ActionViewItem).getAction().enabled = enabled; + } + this.getUI().checkAll.disabled = !enabled; + // this.getUI().inputBox.enabled = enabled; Avoid loosing focus. + this.getUI().ok.enabled = enabled; + this.getUI().list.enabled = enabled; + } + } + + public hide(focusLost?: boolean) { + const controller = this.controller; + if (controller) { + this.controller = null; + this.onHideEmitter.fire(); + this.getUI().container.style.display = 'none'; + if (!focusLost) { + this.options.returnFocus(); + } + controller.didHide(); + } + } + + focus() { + if (this.isDisplayed()) { + this.getUI().inputBox.setFocus(); + } + } + + toggle() { + if (this.isDisplayed() && this.controller instanceof QuickPick && this.controller.canSelectMany) { + this.getUI().list.toggleCheckbox(); + } + } + + navigate(next: boolean, quickNavigate?: IQuickNavigateConfiguration) { + if (this.isDisplayed() && this.getUI().list.isDisplayed()) { + this.getUI().list.focus(next ? 'Next' : 'Previous'); + if (quickNavigate && this.controller instanceof QuickPick) { + this.controller.quickNavigate = quickNavigate; + } + } + } + + accept() { + this.onDidAcceptEmitter.fire(); + return Promise.resolve(undefined); + } + + back() { + this.onDidTriggerButtonEmitter.fire(this.backButton); + return Promise.resolve(undefined); + } + + cancel() { + this.hide(); + return Promise.resolve(undefined); + } + + layout(dimension: dom.Dimension, titleBarOffset: number): void { + this.dimension = dimension; + this.titleBarOffset = titleBarOffset; + this.updateLayout(); + } + + private updateLayout() { + if (this.ui) { + this.ui.container.style.top = `${this.titleBarOffset}px`; + + const style = this.ui.container.style; + const width = Math.min(this.dimension!.width * 0.62 /* golden cut */, QuickInputController.MAX_WIDTH); + style.width = width + 'px'; + style.marginLeft = '-' + (width / 2) + 'px'; + + this.ui.inputBox.layout(); + this.ui.list.layout(this.dimension && this.dimension.height * 0.4); + } + } + + public applyStyles(styles: IQuickInputStyles) { + this.styles = styles; + this.updateStyles(); + } + + private updateStyles() { + if (this.ui) { + const { + titleColor, + quickInputBackground, + quickInputForeground, + contrastBorder, + widgetShadow, + } = this.styles.widget; + this.ui.titleBar.style.backgroundColor = titleColor || ''; + this.ui.container.style.backgroundColor = quickInputBackground ? quickInputBackground.toString() : ''; + this.ui.container.style.color = quickInputForeground ? quickInputForeground.toString() : ''; + this.ui.container.style.border = contrastBorder ? `1px solid ${contrastBorder}` : ''; + this.ui.container.style.boxShadow = widgetShadow ? `0 5px 8px ${widgetShadow}` : ''; + this.ui.inputBox.style(this.styles.inputBox); + this.ui.count.style(this.styles.countBadge); + this.ui.ok.style(this.styles.button); + this.ui.customButton.style(this.styles.button); + this.ui.progressBar.style(this.styles.progressBar); + this.ui.list.style(this.styles.list); + + const content: string[] = []; + if (this.styles.list.listInactiveFocusForeground) { + content.push(`.monaco-list .monaco-list-row.focused { color: ${this.styles.list.listInactiveFocusForeground}; }`); + content.push(`.monaco-list .monaco-list-row.focused:hover { color: ${this.styles.list.listInactiveFocusForeground}; }`); // overwrite :hover style in this case! + } + if (this.styles.list.pickerGroupBorder) { + content.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.list.pickerGroupBorder}; }`); + } + if (this.styles.list.pickerGroupForeground) { + content.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.list.pickerGroupForeground}; }`); + } + const newStyles = content.join('\n'); + if (newStyles !== this.ui.styleSheet.innerHTML) { + this.ui.styleSheet.innerHTML = newStyles; + } + } + } + + private isDisplayed() { + return this.ui && this.ui.container.style.display !== 'none'; + } +} diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts b/src/vs/base/parts/quickinput/browser/quickInputBox.ts similarity index 68% rename from src/vs/workbench/browser/parts/quickinput/quickInputBox.ts rename to src/vs/base/parts/quickinput/browser/quickInputBox.ts index f78fc4363b7b4..31c4f7cb160d6 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts +++ b/src/vs/base/parts/quickinput/browser/quickInputBox.ts @@ -5,9 +5,7 @@ import 'vs/css!./media/quickInput'; import * as dom from 'vs/base/browser/dom'; -import { InputBox, IRange, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; -import { inputBackground, inputForeground, inputBorder, inputValidationInfoBackground, inputValidationInfoForeground, inputValidationInfoBorder, inputValidationWarningBackground, inputValidationWarningForeground, inputValidationWarningBorder, inputValidationErrorBackground, inputValidationErrorForeground, inputValidationErrorBorder } from 'vs/platform/theme/common/colorRegistry'; -import { ITheme } from 'vs/platform/theme/common/themeService'; +import { InputBox, IRange, MessageType, IInputBoxStyles } from 'vs/base/browser/ui/inputbox/inputBox'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import Severity from 'vs/base/common/severity'; @@ -32,17 +30,17 @@ export class QuickInputBox extends Disposable { return dom.addDisposableListener(this.inputBox.inputElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { handler(new StandardKeyboardEvent(e)); }); - } + }; onMouseDown = (handler: (event: StandardMouseEvent) => void): IDisposable => { return dom.addDisposableListener(this.inputBox.inputElement, dom.EventType.MOUSE_DOWN, (e: MouseEvent) => { handler(new StandardMouseEvent(e)); }); - } + }; onDidChange = (handler: (event: string) => void): IDisposable => { return this.inputBox.onDidChange(handler); - } + }; get value() { return this.inputBox.value; @@ -112,20 +110,7 @@ export class QuickInputBox extends Disposable { this.inputBox.layout(); } - style(theme: ITheme) { - this.inputBox.style({ - inputForeground: theme.getColor(inputForeground), - inputBackground: theme.getColor(inputBackground), - inputBorder: theme.getColor(inputBorder), - inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground), - inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground), - inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder), - inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground), - inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground), - inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder), - inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground), - inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground), - inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder), - }); + style(styles: IInputBoxStyles) { + this.inputBox.style(styles); } } diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts b/src/vs/base/parts/quickinput/browser/quickInputList.ts similarity index 87% rename from src/vs/workbench/browser/parts/quickinput/quickInputList.ts rename to src/vs/base/parts/quickinput/browser/quickInputList.ts index 1e62ba48a8aa1..e824a69d12774 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts +++ b/src/vs/base/parts/quickinput/browser/quickInputList.ts @@ -7,9 +7,7 @@ import 'vs/css!./media/quickInput'; import { IListVirtualDelegate, IListRenderer } from 'vs/base/browser/ui/list/list'; import * as dom from 'vs/base/browser/dom'; import { dispose, IDisposable } from 'vs/base/common/lifecycle'; -import { WorkbenchList } from 'vs/platform/list/browser/listService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; +import { IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator } from 'vs/base/parts/quickinput/common/quickInput'; import { IMatch } from 'vs/base/common/filters'; import { matchesFuzzyCodiconAware, parseCodicons } from 'vs/base/common/codicon'; import { compareAnything } from 'vs/base/common/comparers'; @@ -22,13 +20,12 @@ import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlighte import { memoize } from 'vs/base/common/decorators'; import { range } from 'vs/base/common/arrays'; import * as platform from 'vs/base/common/platform'; -import { listFocusBackground, pickerGroupBorder, pickerGroupForeground, activeContrastBorder, listFocusForeground } from 'vs/platform/theme/common/colorRegistry'; -import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { Action } from 'vs/base/common/actions'; -import { getIconClass } from 'vs/workbench/browser/parts/quickinput/quickInputUtils'; -import { IListOptions } from 'vs/base/browser/ui/list/listWidget'; +import { getIconClass } from 'vs/base/parts/quickinput/browser/quickInputUtils'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { IQuickInputOptions } from 'vs/base/parts/quickinput/browser/quickInput'; +import { IListOptions, List, IListStyles } from 'vs/base/browser/ui/list/listWidget'; const $ = dom.$; @@ -215,13 +212,14 @@ export class QuickInputList { readonly id: string; private container: HTMLElement; - private list: WorkbenchList; + private list: List; private inputElements: Array = []; private elements: ListElement[] = []; private elementsToIndexes = new Map(); matchOnDescription = false; matchOnDetail = false; matchOnLabel = true; + sortByLabel = true; private readonly _onChangedAllVisibleChecked = new Emitter(); onChangedAllVisibleChecked: Event = this._onChangedAllVisibleChecked.event; private readonly _onChangedCheckedCount = new Emitter(); @@ -241,17 +239,17 @@ export class QuickInputList { constructor( private parent: HTMLElement, id: string, - @IInstantiationService private readonly instantiationService: IInstantiationService + options: IQuickInputOptions, ) { this.id = id; this.container = dom.append(this.parent, $('.quick-input-list')); const delegate = new ListElementDelegate(); - this.list = this.instantiationService.createInstance(WorkbenchList, 'QuickInput', this.container, delegate, [new ListElementRenderer()], { + this.list = options.createList('QuickInput', this.container, delegate, [new ListElementRenderer()], { identityProvider: { getId: element => element.saneLabel }, openController: { shouldOpen: () => false }, // Workaround #58124 setRowLineHeight: false, multipleSelectionSupport: false, - horizontalScrolling: false + horizontalScrolling: false, } as IListOptions); this.list.getHTMLElement().id = id; this.disposables.push(this.list); @@ -455,8 +453,7 @@ export class QuickInputList { if ((what === 'Previous' || what === 'PreviousPage') && this.list.getFocus()[0] === 0) { what = 'Last'; } - - (this.list as any)['focus' + what](); + this.list['focus' + what as 'focusFirst' | 'focusLast' | 'focusNext' | 'focusPrevious' | 'focusNextPage' | 'focusPreviousPage'](); this.list.reveal(this.list.getFocus()[0]); } @@ -468,18 +465,19 @@ export class QuickInputList { this.list.domFocus(); } - layout(): void { + layout(maxHeight?: number): void { + this.list.getHTMLElement().style.maxHeight = maxHeight ? `calc(${Math.floor(maxHeight / 44) * 44}px)` : ''; this.list.layout(); } filter(query: string) { - if (!(this.matchOnLabel || this.matchOnDescription || this.matchOnDetail)) { + if (!(this.sortByLabel || this.matchOnLabel || this.matchOnDescription || this.matchOnDetail)) { return; } query = query.trim(); // Reset filtering - if (!query) { + if (!query || !(this.matchOnLabel || this.matchOnDescription || this.matchOnDetail)) { this.elements.forEach(element => { element.labelHighlights = undefined; element.descriptionHighlights = undefined; @@ -515,7 +513,7 @@ export class QuickInputList { const shownElements = this.elements.filter(element => !element.hidden); // Sort by value - if (query) { + if (this.sortByLabel && query) { const normalizedSearchValue = query.toLowerCase(); shownElements.sort((a, b) => { return compareEntries(a, b, normalizedSearchValue); @@ -572,6 +570,10 @@ export class QuickInputList { private fireButtonTriggered(event: IQuickPickItemButtonEvent) { this._onButtonTriggered.fire(event); } + + style(styles: IListStyles) { + this.list.style(styles); + } } function compareEntries(elementA: ListElement, elementB: ListElement, lookFor: string): number { @@ -588,30 +590,3 @@ function compareEntries(elementA: ListElement, elementB: ListElement, lookFor: s return compareAnything(elementA.saneLabel, elementB.saneLabel, lookFor); } - -registerThemingParticipant((theme, collector) => { - // Override inactive focus foreground with active focus foreground for single-pick case. - const listInactiveFocusForeground = theme.getColor(listFocusForeground); - if (listInactiveFocusForeground) { - collector.addRule(`.quick-input-list .monaco-list .monaco-list-row.focused { color: ${listInactiveFocusForeground}; }`); - } - // Override inactive focus background with active focus background for single-pick case. - const listInactiveFocusBackground = theme.getColor(listFocusBackground); - if (listInactiveFocusBackground) { - collector.addRule(`.quick-input-list .monaco-list .monaco-list-row.focused { background-color: ${listInactiveFocusBackground}; }`); - collector.addRule(`.quick-input-list .monaco-list .monaco-list-row.focused:hover { background-color: ${listInactiveFocusBackground}; }`); - } - // dotted instead of solid (as in listWidget.ts) to match QuickOpen - const activeContrast = theme.getColor(activeContrastBorder); - if (activeContrast) { - collector.addRule(`.quick-input-list .monaco-list .monaco-list-row.focused { outline: 1px dotted ${activeContrast}; outline-offset: -1px; }`); - } - const pickerGroupBorderColor = theme.getColor(pickerGroupBorder); - if (pickerGroupBorderColor) { - collector.addRule(`.quick-input-list .quick-input-list-entry { border-top-color: ${pickerGroupBorderColor}; }`); - } - const pickerGroupForegroundColor = theme.getColor(pickerGroupForeground); - if (pickerGroupForegroundColor) { - collector.addRule(`.quick-input-list .quick-input-list-separator { color: ${pickerGroupForegroundColor}; }`); - } -}); diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputUtils.ts b/src/vs/base/parts/quickinput/browser/quickInputUtils.ts similarity index 100% rename from src/vs/workbench/browser/parts/quickinput/quickInputUtils.ts rename to src/vs/base/parts/quickinput/browser/quickInputUtils.ts diff --git a/src/vs/base/parts/quickinput/common/quickInput.ts b/src/vs/base/parts/quickinput/common/quickInput.ts new file mode 100644 index 0000000000000..8cbf10553e758 --- /dev/null +++ b/src/vs/base/parts/quickinput/common/quickInput.ts @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { ResolvedKeybinding } from 'vs/base/common/keyCodes'; +import { URI } from 'vs/base/common/uri'; +import { Event } from 'vs/base/common/event'; + +export interface IQuickPickItem { + type?: 'item'; + id?: string; + label: string; + description?: string; + detail?: string; + iconClasses?: string[]; + buttons?: IQuickInputButton[]; + picked?: boolean; + alwaysShow?: boolean; +} + +export interface IQuickPickSeparator { + type: 'separator'; + label?: string; +} + +export interface IKeyMods { + readonly ctrlCmd: boolean; + readonly alt: boolean; +} + +export interface IQuickNavigateConfiguration { + keybindings: ResolvedKeybinding[]; +} + +export interface IPickOptions { + + /** + * an optional string to show as placeholder in the input box to guide the user what she picks on + */ + placeHolder?: string; + + /** + * an optional flag to include the description when filtering the picks + */ + matchOnDescription?: boolean; + + /** + * an optional flag to include the detail when filtering the picks + */ + matchOnDetail?: boolean; + + /** + * an optional flag to filter the picks based on label. Defaults to true. + */ + matchOnLabel?: boolean; + + /** + * an option flag to control whether focus is always automatically brought to a list item. Defaults to true. + */ + autoFocusOnList?: boolean; + + /** + * an optional flag to not close the picker on focus lost + */ + ignoreFocusLost?: boolean; + + /** + * an optional flag to make this picker multi-select + */ + canPickMany?: boolean; + + /** + * enables quick navigate in the picker to open an element without typing + */ + quickNavigate?: IQuickNavigateConfiguration; + + /** + * a context key to set when this picker is active + */ + contextKey?: string; + + /** + * an optional property for the item to focus initially. + */ + activeItem?: Promise | T; + + onKeyMods?: (keyMods: IKeyMods) => void; + onDidFocus?: (entry: T) => void; + onDidTriggerItemButton?: (context: IQuickPickItemButtonContext) => void; +} + +export interface IInputOptions { + + /** + * the value to prefill in the input box + */ + value?: string; + + /** + * the selection of value, default to the whole word + */ + valueSelection?: [number, number]; + + /** + * the text to display underneath the input box + */ + prompt?: string; + + /** + * an optional string to show as placeholder in the input box to guide the user what to type + */ + placeHolder?: string; + + /** + * set to true to show a password prompt that will not show the typed value + */ + password?: boolean; + + ignoreFocusLost?: boolean; + + /** + * an optional function that is used to validate user input. + */ + validateInput?: (input: string) => Promise; +} + +export interface IQuickInput { + + title: string | undefined; + + description: string | undefined; + + step: number | undefined; + + totalSteps: number | undefined; + + enabled: boolean; + + contextKey: string | undefined; + + busy: boolean; + + ignoreFocusOut: boolean; + + show(): void; + + hide(): void; + + onDidHide: Event; + + dispose(): void; +} + +export interface IQuickPick extends IQuickInput { + + value: string; + + placeholder: string | undefined; + + readonly onDidChangeValue: Event; + + readonly onDidAccept: Event; + + ok: boolean; + + readonly onDidCustom: Event; + + customButton: boolean; + + customLabel: string | undefined; + + customHover: string | undefined; + + buttons: ReadonlyArray; + + readonly onDidTriggerButton: Event; + + readonly onDidTriggerItemButton: Event>; + + items: ReadonlyArray; + + canSelectMany: boolean; + + matchOnDescription: boolean; + + matchOnDetail: boolean; + + matchOnLabel: boolean; + + sortByLabel: boolean; + + autoFocusOnList: boolean; + + quickNavigate: IQuickNavigateConfiguration | undefined; + + activeItems: ReadonlyArray; + + readonly onDidChangeActive: Event; + + selectedItems: ReadonlyArray; + + readonly onDidChangeSelection: Event; + + readonly keyMods: IKeyMods; + + valueSelection: Readonly<[number, number]> | undefined; + + validationMessage: string | undefined; + + inputHasFocus(): boolean; +} + +export interface IInputBox extends IQuickInput { + + value: string; + + valueSelection: Readonly<[number, number]> | undefined; + + placeholder: string | undefined; + + password: boolean; + + readonly onDidChangeValue: Event; + + readonly onDidAccept: Event; + + buttons: ReadonlyArray; + + readonly onDidTriggerButton: Event; + + prompt: string | undefined; + + validationMessage: string | undefined; +} + +export interface IQuickInputButton { + /** iconPath or iconClass required */ + iconPath?: { dark: URI; light?: URI; }; + /** iconPath or iconClass required */ + iconClass?: string; + tooltip?: string; +} + +export interface IQuickPickItemButtonEvent { + button: IQuickInputButton; + item: T; +} + +export interface IQuickPickItemButtonContext extends IQuickPickItemButtonEvent { + removeItem(): void; +} + +export type QuickPickInput = T | IQuickPickSeparator; diff --git a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts index 8bb7da3ff4f2f..b846129db466e 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts @@ -462,7 +462,7 @@ class Renderer implements IRenderer { options.title = entry.getTooltip(); options.descriptionTitle = entry.getDescriptionTooltip() || entry.getDescription(); // tooltip over description because it could overflow options.descriptionMatches = descriptionHighlights || []; - data.label.setLabel(types.withNullAsUndefined(entry.getLabel()), entry.getDescription(), options); + data.label.setLabel(entry.getLabel() || '', entry.getDescription(), options); // Meta data.detail.set(entry.getDetail(), detailHighlights); diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts index 8a5414833f5cd..463cbc5a2baaf 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts @@ -135,7 +135,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem private styles: IQuickOpenStyles; // @ts-ignore (legacy widget - to be replaced with quick input) private renderer: Renderer; - private keyDownSeenSinceShown = false; constructor(container: HTMLElement, callbacks: IQuickOpenCallbacks, options: IQuickOpenOptions) { super(); @@ -172,7 +171,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem this._register(DOM.addDisposableListener(this.element, DOM.EventType.FOCUS, e => this.gainingFocus(), true)); this._register(DOM.addDisposableListener(this.element, DOM.EventType.BLUR, e => this.loosingFocus(e), true)); this._register(DOM.addDisposableListener(this.element, DOM.EventType.KEY_DOWN, e => { - this.keyDownSeenSinceShown = true; const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e); if (keyboardEvent.keyCode === KeyCode.Escape) { DOM.EventHelper.stop(e, true); @@ -223,7 +221,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem this._register(DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.INPUT, (e: Event) => this.onType())); this._register(DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => { - this.keyDownSeenSinceShown = true; const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e); const shouldOpenInBackground = this.shouldOpenInBackground(keyboardEvent); @@ -304,7 +301,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem })); this._register(DOM.addDisposableListener(this.treeContainer, DOM.EventType.KEY_DOWN, e => { - this.keyDownSeenSinceShown = true; const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e); // Only handle when in quick navigation mode @@ -318,6 +314,16 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem this.navigateInTree(keyboardEvent.keyCode); } + + // Support to open item with Enter still even in quick nav mode + else if (keyboardEvent.keyCode === KeyCode.Enter) { + DOM.EventHelper.stop(e, true); + + const focus = this.tree.getFocus(); + if (focus) { + this.elementSelected(focus, e); + } + } })); this._register(DOM.addDisposableListener(this.treeContainer, DOM.EventType.KEY_UP, e => { @@ -325,13 +331,13 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem const keyCode = keyboardEvent.keyCode; // Only handle when in quick navigation mode - if (!this.quickNavigateConfiguration || !this.keyDownSeenSinceShown) { + if (!this.quickNavigateConfiguration) { return; } // Select element when keys are pressed that signal it const quickNavKeys = this.quickNavigateConfiguration.keybindings; - const wasTriggerKeyPressed = keyCode === KeyCode.Enter || quickNavKeys.some(k => { + const wasTriggerKeyPressed = quickNavKeys.some(k => { const [firstPart, chordPart] = k.getParts(); if (chordPart) { return false; @@ -400,7 +406,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem protected applyStyles(): void { if (this.element) { - const foreground = this.styles.foreground ? this.styles.foreground.toString() : null; + const foreground = this.styles.foreground ? this.styles.foreground.toString() : ''; 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() : ''; @@ -600,7 +606,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem this.visible = true; this.isLoosingFocus = false; this.quickNavigateConfiguration = options ? options.quickNavigateConfiguration : undefined; - this.keyDownSeenSinceShown = false; // Adjust UI for quick navigate mode if (this.quickNavigateConfiguration) { @@ -749,6 +754,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider, IThem else if (autoFocus.autoFocusLastEntry) { if (entries.length > 1) { this.tree.focusLast(); + this.tree.reveal(this.tree.getFocus()); } } } diff --git a/src/vs/base/parts/quickopen/browser/quickopen.css b/src/vs/base/parts/quickopen/browser/quickopen.css index b6a9b9247d0d4..4ecafadcfd392 100644 --- a/src/vs/base/parts/quickopen/browser/quickopen.css +++ b/src/vs/base/parts/quickopen/browser/quickopen.css @@ -77,7 +77,7 @@ } .monaco-quick-open-widget .quick-open-tree .monaco-icon-label, -.monaco-quick-open-widget .quick-open-tree .monaco-icon-label .monaco-icon-label-description-container { +.monaco-quick-open-widget .quick-open-tree .monaco-icon-label .monaco-icon-label-container > .monaco-icon-name-container { flex: 1; /* make sure the icon label grows within the row */ } @@ -85,6 +85,10 @@ opacity: 1; } +.monaco-quick-open-widget .quick-open-tree .quick-open-entry .monaco-highlighted-label .codicon { + vertical-align: sub; /* vertically align codicon */ +} + .monaco-quick-open-widget .quick-open-tree .quick-open-entry-meta { opacity: 0.7; line-height: normal; diff --git a/src/vs/base/parts/quickopen/common/quickOpen.ts b/src/vs/base/parts/quickopen/common/quickOpen.ts index d6039c688028b..582ddf56ee675 100644 --- a/src/vs/base/parts/quickopen/common/quickOpen.ts +++ b/src/vs/base/parts/quickopen/common/quickOpen.ts @@ -68,9 +68,7 @@ export interface IDataSource { export interface IRenderer { getHeight(entry: T): number; getTemplateId(entry: T): string; - // rationale: will be replaced by quickinput later - // tslint:disable-next-line: no-dom-globals - renderTemplate(templateId: string, container: HTMLElement, styles: any): any; + renderTemplate(templateId: string, container: any /* HTMLElement */, styles: any): any; renderElement(entry: T, templateId: string, templateData: any, styles: any): void; disposeTemplate(templateId: string, templateData: any): void; } diff --git a/src/vs/base/parts/quickopen/test/browser/quickopen.test.ts b/src/vs/base/parts/quickopen/test/browser/quickopen.test.ts index f53d0b4e1edc5..f857c0b64a7ae 100644 --- a/src/vs/base/parts/quickopen/test/browser/quickopen.test.ts +++ b/src/vs/base/parts/quickopen/test/browser/quickopen.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { QuickOpenModel, QuickOpenEntry, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel'; import { DataSource } from 'vs/base/parts/quickopen/browser/quickOpenViewer'; @@ -28,7 +29,7 @@ suite('QuickOpen', () => { assert.equal(entry2, model.getEntries(true)[0]); }); - test('QuickOpenDataSource', () => { + test('QuickOpenDataSource', async () => { const model = new QuickOpenModel(); const entry1 = new QuickOpenEntry(); @@ -42,8 +43,7 @@ suite('QuickOpen', () => { assert.equal(true, ds.hasChildren(null!, model)); assert.equal(false, ds.hasChildren(null!, entry1)); - ds.getChildren(null!, model).then((children: any[]) => { - assert.equal(3, children.length); - }); + const children = await ds.getChildren(null!, model); + assert.equal(3, children.length); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts b/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts index 548cc9489f0b1..a7bbe6fb2a0bb 100644 --- a/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts +++ b/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts @@ -833,4 +833,4 @@ suite('Quick Open Scorer', () => { assert.equal(scorer.prepareQuery('ModelTester.ts').containsPathSeparator, false); assert.equal(scorer.prepareQuery('Model' + sep + 'Tester.ts').containsPathSeparator, true); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/parts/storage/test/node/storage.test.ts b/src/vs/base/parts/storage/test/node/storage.test.ts index 92992e494b01c..9c966c0868b67 100644 --- a/src/vs/base/parts/storage/test/node/storage.test.ts +++ b/src/vs/base/parts/storage/test/node/storage.test.ts @@ -137,14 +137,14 @@ suite('Storage Library', () => { changes.clear(); // Delete is accepted - change.set('foo', undefined); + change.set('foo', undefined!); database.fireDidChangeItemsExternal({ items: change }); ok(changes.has('foo')); equal(storage.get('foo', null!), null); changes.clear(); // Nothing happens if changing to same value - change.set('foo', undefined); + change.set('foo', undefined!); database.fireDidChangeItemsExternal({ items: change }); equal(changes.size, 0); @@ -294,7 +294,7 @@ suite('SQLite Storage Library', () => { return set; } - async function testDBBasics(path: string, logError?: (error: Error) => void) { + async function testDBBasics(path: string, logError?: (error: Error | string) => void) { let options!: ISQLiteStorageDatabaseOptions; if (logError) { options = { @@ -550,7 +550,7 @@ suite('SQLite Storage Library', () => { let storage = new SQLiteStorageDatabase(join(storageDir, 'storage.db')); const items1 = new Map(); - items1.set('colorthemedata', '{"id":"vs vscode-theme-defaults-themes-light_plus-json","label":"Light+ (default light)","settingsId":"Default Light+","selector":"vs.vscode-theme-defaults-themes-light_plus-json","themeTokenColors":[{"settings":{"foreground":"#000000ff","background":"#ffffffff"}},{"scope":["meta.embedded","source.groovy.embedded"],"settings":{"foreground":"#000000ff"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"meta.diff.header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#008000"}},{"scope":"constant.language","settings":{"foreground":"#0000ff"}},{"scope":["constant.numeric"],"settings":{"foreground":"#09885a"}},{"scope":"constant.regexp","settings":{"foreground":"#811f3f"}},{"name":"css tags in selectors, xml tags","scope":"entity.name.tag","settings":{"foreground":"#800000"}},{"scope":"entity.name.selector","settings":{"foreground":"#800000"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#ff0000"}},{"scope":["entity.other.attribute-name.class.css","entity.other.attribute-name.class.mixin.css","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.pseudo-class.css","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.attribute.scss","entity.other.attribute-name.scss"],"settings":{"foreground":"#800000"}},{"scope":"invalid","settings":{"foreground":"#cd3131"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#000080"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#800000"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.inserted","settings":{"foreground":"#09885a"}},{"scope":"markup.deleted","settings":{"foreground":"#a31515"}},{"scope":"markup.changed","settings":{"foreground":"#0451a5"}},{"scope":["punctuation.definition.quote.begin.markdown","punctuation.definition.list.begin.markdown"],"settings":{"foreground":"#0451a5"}},{"scope":"markup.inline.raw","settings":{"foreground":"#800000"}},{"name":"brackets of XML/HTML tags","scope":"punctuation.definition.tag","settings":{"foreground":"#800000"}},{"scope":"meta.preprocessor","settings":{"foreground":"#0000ff"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#a31515"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#09885a"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#0451a5"}},{"scope":"storage","settings":{"foreground":"#0000ff"}},{"scope":"storage.type","settings":{"foreground":"#0000ff"}},{"scope":"storage.modifier","settings":{"foreground":"#0000ff"}},{"scope":"string","settings":{"foreground":"#a31515"}},{"scope":["string.comment.buffered.block.pug","string.quoted.pug","string.interpolated.pug","string.unquoted.plain.in.yaml","string.unquoted.plain.out.yaml","string.unquoted.block.yaml","string.quoted.single.yaml","string.quoted.double.xml","string.quoted.single.xml","string.unquoted.cdata.xml","string.quoted.double.html","string.quoted.single.html","string.unquoted.html","string.quoted.single.handlebars","string.quoted.double.handlebars"],"settings":{"foreground":"#0000ff"}},{"scope":"string.regexp","settings":{"foreground":"#811f3f"}},{"name":"String interpolation","scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#0000ff"}},{"name":"Reset JavaScript string interpolation expression","scope":["meta.template.expression"],"settings":{"foreground":"#000000"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"scope":["support.type.vendored.property-name","support.type.property-name","variable.css","variable.scss","variable.other.less","source.coffee.embedded"],"settings":{"foreground":"#ff0000"}},{"scope":["support.type.property-name.json"],"settings":{"foreground":"#0451a5"}},{"scope":"keyword","settings":{"foreground":"#0000ff"}},{"scope":"keyword.control","settings":{"foreground":"#0000ff"}},{"scope":"keyword.operator","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.instanceof","keyword.operator.logical.python"],"settings":{"foreground":"#0000ff"}},{"scope":"keyword.other.unit","settings":{"foreground":"#09885a"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#800000"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#0451a5"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#09885a"}},{"name":"coloring of the Java import and package identifiers","scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#000000"}},{"name":"this.self","scope":"variable.language","settings":{"foreground":"#0000ff"}},{"name":"Function declarations","scope":["entity.name.function","support.function","support.constant.handlebars"],"settings":{"foreground":"#795E26"}},{"name":"Types declaration and references","scope":["meta.return-type","support.class","support.type","entity.name.type","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#267f99"}},{"name":"Types declaration and references, TS grammar specific","scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class"],"settings":{"foreground":"#267f99"}},{"name":"Control flow keywords","scope":"keyword.control","settings":{"foreground":"#AF00DB"}},{"name":"Variable and parameter name","scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable"],"settings":{"foreground":"#001080"}},{"name":"Object keys, TS grammar specific","scope":["meta.object-literal.key"],"settings":{"foreground":"#001080"}},{"name":"CSS property value","scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"name":"Regular expression groups","scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#811f3f"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#ff0000"}},{"scope":"constant.character","settings":{"foreground":"#0000ff"}},{"scope":"constant.character.escape","settings":{"foreground":"#ff0000"}},{"scope":"token.info-token","settings":{"foreground":"#316bcd"}},{"scope":"token.warn-token","settings":{"foreground":"#cd9731"}},{"scope":"token.error-token","settings":{"foreground":"#cd3131"}},{"scope":"token.debug-token","settings":{"foreground":"#800080"}}],"extensionData":{"extensionId":"vscode.theme-defaults","extensionPublisher":"vscode","extensionName":"theme-defaults","extensionIsBuiltin":true},"colorMap":{"editor.background":"#ffffff","editor.foreground":"#000000","editor.inactiveSelectionBackground":"#e5ebf1","editorIndentGuide.background":"#d3d3d3","editorIndentGuide.activeBackground":"#939393","editor.selectionHighlightBackground":"#add6ff4d","editorSuggestWidget.background":"#f3f3f3","activityBarBadge.background":"#007acc","sideBarTitle.foreground":"#6f6f6f","list.hoverBackground":"#e8e8e8","input.placeholderForeground":"#767676","settings.textInputBorder":"#cecece","settings.numberInputBorder":"#cecece"}}'); + items1.set('colorthemedata', '{"id":"vs vscode-theme-defaults-themes-light_plus-json","label":"Light+ (default light)","settingsId":"Default Light+","selector":"vs.vscode-theme-defaults-themes-light_plus-json","themeTokenColors":[{"settings":{"foreground":"#000000ff","background":"#ffffffff"}},{"scope":["meta.embedded","source.groovy.embedded"],"settings":{"foreground":"#000000ff"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"meta.diff.header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#008000"}},{"scope":"constant.language","settings":{"foreground":"#0000ff"}},{"scope":["constant.numeric"],"settings":{"foreground":"#098658"}},{"scope":"constant.regexp","settings":{"foreground":"#811f3f"}},{"name":"css tags in selectors, xml tags","scope":"entity.name.tag","settings":{"foreground":"#800000"}},{"scope":"entity.name.selector","settings":{"foreground":"#800000"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#ff0000"}},{"scope":["entity.other.attribute-name.class.css","entity.other.attribute-name.class.mixin.css","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.pseudo-class.css","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.attribute.scss","entity.other.attribute-name.scss"],"settings":{"foreground":"#800000"}},{"scope":"invalid","settings":{"foreground":"#cd3131"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#000080"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#800000"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.inserted","settings":{"foreground":"#098658"}},{"scope":"markup.deleted","settings":{"foreground":"#a31515"}},{"scope":"markup.changed","settings":{"foreground":"#0451a5"}},{"scope":["punctuation.definition.quote.begin.markdown","punctuation.definition.list.begin.markdown"],"settings":{"foreground":"#0451a5"}},{"scope":"markup.inline.raw","settings":{"foreground":"#800000"}},{"name":"brackets of XML/HTML tags","scope":"punctuation.definition.tag","settings":{"foreground":"#800000"}},{"scope":"meta.preprocessor","settings":{"foreground":"#0000ff"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#a31515"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#098658"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#0451a5"}},{"scope":"storage","settings":{"foreground":"#0000ff"}},{"scope":"storage.type","settings":{"foreground":"#0000ff"}},{"scope":"storage.modifier","settings":{"foreground":"#0000ff"}},{"scope":"string","settings":{"foreground":"#a31515"}},{"scope":["string.comment.buffered.block.pug","string.quoted.pug","string.interpolated.pug","string.unquoted.plain.in.yaml","string.unquoted.plain.out.yaml","string.unquoted.block.yaml","string.quoted.single.yaml","string.quoted.double.xml","string.quoted.single.xml","string.unquoted.cdata.xml","string.quoted.double.html","string.quoted.single.html","string.unquoted.html","string.quoted.single.handlebars","string.quoted.double.handlebars"],"settings":{"foreground":"#0000ff"}},{"scope":"string.regexp","settings":{"foreground":"#811f3f"}},{"name":"String interpolation","scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#0000ff"}},{"name":"Reset JavaScript string interpolation expression","scope":["meta.template.expression"],"settings":{"foreground":"#000000"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"scope":["support.type.vendored.property-name","support.type.property-name","variable.css","variable.scss","variable.other.less","source.coffee.embedded"],"settings":{"foreground":"#ff0000"}},{"scope":["support.type.property-name.json"],"settings":{"foreground":"#0451a5"}},{"scope":"keyword","settings":{"foreground":"#0000ff"}},{"scope":"keyword.control","settings":{"foreground":"#0000ff"}},{"scope":"keyword.operator","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.instanceof","keyword.operator.logical.python"],"settings":{"foreground":"#0000ff"}},{"scope":"keyword.other.unit","settings":{"foreground":"#098658"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#800000"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#0451a5"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#098658"}},{"name":"coloring of the Java import and package identifiers","scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#000000"}},{"name":"this.self","scope":"variable.language","settings":{"foreground":"#0000ff"}},{"name":"Function declarations","scope":["entity.name.function","support.function","support.constant.handlebars"],"settings":{"foreground":"#795E26"}},{"name":"Types declaration and references","scope":["meta.return-type","support.class","support.type","entity.name.type","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#267f99"}},{"name":"Types declaration and references, TS grammar specific","scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class"],"settings":{"foreground":"#267f99"}},{"name":"Control flow keywords","scope":"keyword.control","settings":{"foreground":"#AF00DB"}},{"name":"Variable and parameter name","scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable"],"settings":{"foreground":"#001080"}},{"name":"Object keys, TS grammar specific","scope":["meta.object-literal.key"],"settings":{"foreground":"#001080"}},{"name":"CSS property value","scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"name":"Regular expression groups","scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#811f3f"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#ff0000"}},{"scope":"constant.character","settings":{"foreground":"#0000ff"}},{"scope":"constant.character.escape","settings":{"foreground":"#ff0000"}},{"scope":"token.info-token","settings":{"foreground":"#316bcd"}},{"scope":"token.warn-token","settings":{"foreground":"#cd9731"}},{"scope":"token.error-token","settings":{"foreground":"#cd3131"}},{"scope":"token.debug-token","settings":{"foreground":"#800080"}}],"extensionData":{"extensionId":"vscode.theme-defaults","extensionPublisher":"vscode","extensionName":"theme-defaults","extensionIsBuiltin":true},"colorMap":{"editor.background":"#ffffff","editor.foreground":"#000000","editor.inactiveSelectionBackground":"#e5ebf1","editorIndentGuide.background":"#d3d3d3","editorIndentGuide.activeBackground":"#939393","editor.selectionHighlightBackground":"#add6ff4d","editorSuggestWidget.background":"#f3f3f3","activityBarBadge.background":"#007acc","sideBarTitle.foreground":"#6f6f6f","list.hoverBackground":"#e8e8e8","input.placeholderForeground":"#767676","settings.textInputBorder":"#cecece","settings.numberInputBorder":"#cecece"}}'); items1.set('commandpalette.mru.cache', '{"usesLRU":true,"entries":[{"key":"revealFileInOS","value":3},{"key":"extension.openInGitHub","value":4},{"key":"workbench.extensions.action.openExtensionsFolder","value":11},{"key":"workbench.action.showRuntimeExtensions","value":14},{"key":"workbench.action.toggleTabsVisibility","value":15},{"key":"extension.liveServerPreview.open","value":16},{"key":"workbench.action.openIssueReporter","value":18},{"key":"workbench.action.openProcessExplorer","value":19},{"key":"workbench.action.toggleSharedProcess","value":20},{"key":"workbench.action.configureLocale","value":21},{"key":"workbench.action.appPerf","value":22},{"key":"workbench.action.reportPerformanceIssueUsingReporter","value":23},{"key":"workbench.action.openGlobalKeybindings","value":25},{"key":"workbench.action.output.toggleOutput","value":27},{"key":"extension.sayHello","value":29}]}'); items1.set('cpp.1.lastsessiondate', 'Fri Oct 05 2018'); items1.set('debug.actionswidgetposition', '0.6880952380952381'); @@ -641,7 +641,7 @@ suite('SQLite Storage Library', () => { let storage = new SQLiteStorageDatabase(join(storageDir, 'storage.db')); const items = new Map(); - items.set('colorthemedata', '{"id":"vs vscode-theme-defaults-themes-light_plus-json","label":"Light+ (default light)","settingsId":"Default Light+","selector":"vs.vscode-theme-defaults-themes-light_plus-json","themeTokenColors":[{"settings":{"foreground":"#000000ff","background":"#ffffffff"}},{"scope":["meta.embedded","source.groovy.embedded"],"settings":{"foreground":"#000000ff"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"meta.diff.header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#008000"}},{"scope":"constant.language","settings":{"foreground":"#0000ff"}},{"scope":["constant.numeric"],"settings":{"foreground":"#09885a"}},{"scope":"constant.regexp","settings":{"foreground":"#811f3f"}},{"name":"css tags in selectors, xml tags","scope":"entity.name.tag","settings":{"foreground":"#800000"}},{"scope":"entity.name.selector","settings":{"foreground":"#800000"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#ff0000"}},{"scope":["entity.other.attribute-name.class.css","entity.other.attribute-name.class.mixin.css","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.pseudo-class.css","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.attribute.scss","entity.other.attribute-name.scss"],"settings":{"foreground":"#800000"}},{"scope":"invalid","settings":{"foreground":"#cd3131"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#000080"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#800000"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.inserted","settings":{"foreground":"#09885a"}},{"scope":"markup.deleted","settings":{"foreground":"#a31515"}},{"scope":"markup.changed","settings":{"foreground":"#0451a5"}},{"scope":["punctuation.definition.quote.begin.markdown","punctuation.definition.list.begin.markdown"],"settings":{"foreground":"#0451a5"}},{"scope":"markup.inline.raw","settings":{"foreground":"#800000"}},{"name":"brackets of XML/HTML tags","scope":"punctuation.definition.tag","settings":{"foreground":"#800000"}},{"scope":"meta.preprocessor","settings":{"foreground":"#0000ff"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#a31515"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#09885a"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#0451a5"}},{"scope":"storage","settings":{"foreground":"#0000ff"}},{"scope":"storage.type","settings":{"foreground":"#0000ff"}},{"scope":"storage.modifier","settings":{"foreground":"#0000ff"}},{"scope":"string","settings":{"foreground":"#a31515"}},{"scope":["string.comment.buffered.block.pug","string.quoted.pug","string.interpolated.pug","string.unquoted.plain.in.yaml","string.unquoted.plain.out.yaml","string.unquoted.block.yaml","string.quoted.single.yaml","string.quoted.double.xml","string.quoted.single.xml","string.unquoted.cdata.xml","string.quoted.double.html","string.quoted.single.html","string.unquoted.html","string.quoted.single.handlebars","string.quoted.double.handlebars"],"settings":{"foreground":"#0000ff"}},{"scope":"string.regexp","settings":{"foreground":"#811f3f"}},{"name":"String interpolation","scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#0000ff"}},{"name":"Reset JavaScript string interpolation expression","scope":["meta.template.expression"],"settings":{"foreground":"#000000"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"scope":["support.type.vendored.property-name","support.type.property-name","variable.css","variable.scss","variable.other.less","source.coffee.embedded"],"settings":{"foreground":"#ff0000"}},{"scope":["support.type.property-name.json"],"settings":{"foreground":"#0451a5"}},{"scope":"keyword","settings":{"foreground":"#0000ff"}},{"scope":"keyword.control","settings":{"foreground":"#0000ff"}},{"scope":"keyword.operator","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.instanceof","keyword.operator.logical.python"],"settings":{"foreground":"#0000ff"}},{"scope":"keyword.other.unit","settings":{"foreground":"#09885a"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#800000"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#0451a5"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#09885a"}},{"name":"coloring of the Java import and package identifiers","scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#000000"}},{"name":"this.self","scope":"variable.language","settings":{"foreground":"#0000ff"}},{"name":"Function declarations","scope":["entity.name.function","support.function","support.constant.handlebars"],"settings":{"foreground":"#795E26"}},{"name":"Types declaration and references","scope":["meta.return-type","support.class","support.type","entity.name.type","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#267f99"}},{"name":"Types declaration and references, TS grammar specific","scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class"],"settings":{"foreground":"#267f99"}},{"name":"Control flow keywords","scope":"keyword.control","settings":{"foreground":"#AF00DB"}},{"name":"Variable and parameter name","scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable"],"settings":{"foreground":"#001080"}},{"name":"Object keys, TS grammar specific","scope":["meta.object-literal.key"],"settings":{"foreground":"#001080"}},{"name":"CSS property value","scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"name":"Regular expression groups","scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#811f3f"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#ff0000"}},{"scope":"constant.character","settings":{"foreground":"#0000ff"}},{"scope":"constant.character.escape","settings":{"foreground":"#ff0000"}},{"scope":"token.info-token","settings":{"foreground":"#316bcd"}},{"scope":"token.warn-token","settings":{"foreground":"#cd9731"}},{"scope":"token.error-token","settings":{"foreground":"#cd3131"}},{"scope":"token.debug-token","settings":{"foreground":"#800080"}}],"extensionData":{"extensionId":"vscode.theme-defaults","extensionPublisher":"vscode","extensionName":"theme-defaults","extensionIsBuiltin":true},"colorMap":{"editor.background":"#ffffff","editor.foreground":"#000000","editor.inactiveSelectionBackground":"#e5ebf1","editorIndentGuide.background":"#d3d3d3","editorIndentGuide.activeBackground":"#939393","editor.selectionHighlightBackground":"#add6ff4d","editorSuggestWidget.background":"#f3f3f3","activityBarBadge.background":"#007acc","sideBarTitle.foreground":"#6f6f6f","list.hoverBackground":"#e8e8e8","input.placeholderForeground":"#767676","settings.textInputBorder":"#cecece","settings.numberInputBorder":"#cecece"}}'); + items.set('colorthemedata', '{"id":"vs vscode-theme-defaults-themes-light_plus-json","label":"Light+ (default light)","settingsId":"Default Light+","selector":"vs.vscode-theme-defaults-themes-light_plus-json","themeTokenColors":[{"settings":{"foreground":"#000000ff","background":"#ffffffff"}},{"scope":["meta.embedded","source.groovy.embedded"],"settings":{"foreground":"#000000ff"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"meta.diff.header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#008000"}},{"scope":"constant.language","settings":{"foreground":"#0000ff"}},{"scope":["constant.numeric"],"settings":{"foreground":"#098658"}},{"scope":"constant.regexp","settings":{"foreground":"#811f3f"}},{"name":"css tags in selectors, xml tags","scope":"entity.name.tag","settings":{"foreground":"#800000"}},{"scope":"entity.name.selector","settings":{"foreground":"#800000"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#ff0000"}},{"scope":["entity.other.attribute-name.class.css","entity.other.attribute-name.class.mixin.css","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.pseudo-class.css","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.attribute.scss","entity.other.attribute-name.scss"],"settings":{"foreground":"#800000"}},{"scope":"invalid","settings":{"foreground":"#cd3131"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#000080"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#800000"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.inserted","settings":{"foreground":"#098658"}},{"scope":"markup.deleted","settings":{"foreground":"#a31515"}},{"scope":"markup.changed","settings":{"foreground":"#0451a5"}},{"scope":["punctuation.definition.quote.begin.markdown","punctuation.definition.list.begin.markdown"],"settings":{"foreground":"#0451a5"}},{"scope":"markup.inline.raw","settings":{"foreground":"#800000"}},{"name":"brackets of XML/HTML tags","scope":"punctuation.definition.tag","settings":{"foreground":"#800000"}},{"scope":"meta.preprocessor","settings":{"foreground":"#0000ff"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#a31515"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#098658"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#0451a5"}},{"scope":"storage","settings":{"foreground":"#0000ff"}},{"scope":"storage.type","settings":{"foreground":"#0000ff"}},{"scope":"storage.modifier","settings":{"foreground":"#0000ff"}},{"scope":"string","settings":{"foreground":"#a31515"}},{"scope":["string.comment.buffered.block.pug","string.quoted.pug","string.interpolated.pug","string.unquoted.plain.in.yaml","string.unquoted.plain.out.yaml","string.unquoted.block.yaml","string.quoted.single.yaml","string.quoted.double.xml","string.quoted.single.xml","string.unquoted.cdata.xml","string.quoted.double.html","string.quoted.single.html","string.unquoted.html","string.quoted.single.handlebars","string.quoted.double.handlebars"],"settings":{"foreground":"#0000ff"}},{"scope":"string.regexp","settings":{"foreground":"#811f3f"}},{"name":"String interpolation","scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#0000ff"}},{"name":"Reset JavaScript string interpolation expression","scope":["meta.template.expression"],"settings":{"foreground":"#000000"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"scope":["support.type.vendored.property-name","support.type.property-name","variable.css","variable.scss","variable.other.less","source.coffee.embedded"],"settings":{"foreground":"#ff0000"}},{"scope":["support.type.property-name.json"],"settings":{"foreground":"#0451a5"}},{"scope":"keyword","settings":{"foreground":"#0000ff"}},{"scope":"keyword.control","settings":{"foreground":"#0000ff"}},{"scope":"keyword.operator","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.instanceof","keyword.operator.logical.python"],"settings":{"foreground":"#0000ff"}},{"scope":"keyword.other.unit","settings":{"foreground":"#098658"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#800000"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#0451a5"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#098658"}},{"name":"coloring of the Java import and package identifiers","scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#000000"}},{"name":"this.self","scope":"variable.language","settings":{"foreground":"#0000ff"}},{"name":"Function declarations","scope":["entity.name.function","support.function","support.constant.handlebars"],"settings":{"foreground":"#795E26"}},{"name":"Types declaration and references","scope":["meta.return-type","support.class","support.type","entity.name.type","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#267f99"}},{"name":"Types declaration and references, TS grammar specific","scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class"],"settings":{"foreground":"#267f99"}},{"name":"Control flow keywords","scope":"keyword.control","settings":{"foreground":"#AF00DB"}},{"name":"Variable and parameter name","scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable"],"settings":{"foreground":"#001080"}},{"name":"Object keys, TS grammar specific","scope":["meta.object-literal.key"],"settings":{"foreground":"#001080"}},{"name":"CSS property value","scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#0451a5"}},{"name":"Regular expression groups","scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#811f3f"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#000000"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#ff0000"}},{"scope":"constant.character","settings":{"foreground":"#0000ff"}},{"scope":"constant.character.escape","settings":{"foreground":"#ff0000"}},{"scope":"token.info-token","settings":{"foreground":"#316bcd"}},{"scope":"token.warn-token","settings":{"foreground":"#cd9731"}},{"scope":"token.error-token","settings":{"foreground":"#cd3131"}},{"scope":"token.debug-token","settings":{"foreground":"#800080"}}],"extensionData":{"extensionId":"vscode.theme-defaults","extensionPublisher":"vscode","extensionName":"theme-defaults","extensionIsBuiltin":true},"colorMap":{"editor.background":"#ffffff","editor.foreground":"#000000","editor.inactiveSelectionBackground":"#e5ebf1","editorIndentGuide.background":"#d3d3d3","editorIndentGuide.activeBackground":"#939393","editor.selectionHighlightBackground":"#add6ff4d","editorSuggestWidget.background":"#f3f3f3","activityBarBadge.background":"#007acc","sideBarTitle.foreground":"#6f6f6f","list.hoverBackground":"#e8e8e8","input.placeholderForeground":"#767676","settings.textInputBorder":"#cecece","settings.numberInputBorder":"#cecece"}}'); items.set('commandpalette.mru.cache', '{"usesLRU":true,"entries":[{"key":"revealFileInOS","value":3},{"key":"extension.openInGitHub","value":4},{"key":"workbench.extensions.action.openExtensionsFolder","value":11},{"key":"workbench.action.showRuntimeExtensions","value":14},{"key":"workbench.action.toggleTabsVisibility","value":15},{"key":"extension.liveServerPreview.open","value":16},{"key":"workbench.action.openIssueReporter","value":18},{"key":"workbench.action.openProcessExplorer","value":19},{"key":"workbench.action.toggleSharedProcess","value":20},{"key":"workbench.action.configureLocale","value":21},{"key":"workbench.action.appPerf","value":22},{"key":"workbench.action.reportPerformanceIssueUsingReporter","value":23},{"key":"workbench.action.openGlobalKeybindings","value":25},{"key":"workbench.action.output.toggleOutput","value":27},{"key":"extension.sayHello","value":29}]}'); let uuid = generateUuid(); diff --git a/src/vs/base/parts/tree/browser/treeModel.ts b/src/vs/base/parts/tree/browser/treeModel.ts index 30df6dc07d788..6d2999bf7e7b0 100644 --- a/src/vs/base/parts/tree/browser/treeModel.ts +++ b/src/vs/base/parts/tree/browser/treeModel.ts @@ -141,8 +141,8 @@ export class ItemRegistry { readonly onDidCollapseItem: Event = this._onDidCollapseItem.event; private _onDidAddTraitItem = new EventMultiplexer(); readonly onDidAddTraitItem: Event = this._onDidAddTraitItem.event; - private _onDidRemoveTraitItem = new EventMultiplexer(); - readonly onDidRemoveTraitItem: Event = this._onDidRemoveTraitItem.event; + private _onDidRemoveTraitItem = new EventMultiplexer(); + readonly onDidRemoveTraitItem: Event = this._onDidRemoveTraitItem.event; private _onDidRefreshItem = new EventMultiplexer(); readonly onDidRefreshItem: Event = this._onDidRefreshItem.event; private _onRefreshItemChildren = new EventMultiplexer(); @@ -273,8 +273,8 @@ export class Item { readonly onDidCollapse: Event = this._onDidCollapse.event; private readonly _onDidAddTrait = new Emitter(); readonly onDidAddTrait: Event = this._onDidAddTrait.event; - private readonly _onDidRemoveTrait = new Emitter(); - readonly onDidRemoveTrait: Event = this._onDidRemoveTrait.event; + private readonly _onDidRemoveTrait = new Emitter(); + readonly onDidRemoveTrait: Event = this._onDidRemoveTrait.event; private readonly _onDidRefresh = new Emitter(); readonly onDidRefresh: Event = this._onDidRefresh.event; private readonly _onRefreshChildren = new Emitter(); @@ -895,8 +895,8 @@ export class TreeModel { readonly onDidCollapseItem: Event = this._onDidCollapseItem.event; private _onDidAddTraitItem = new Relay(); readonly onDidAddTraitItem: Event = this._onDidAddTraitItem.event; - private _onDidRemoveTraitItem = new Relay(); - readonly onDidRemoveTraitItem: Event = this._onDidRemoveTraitItem.event; + private _onDidRemoveTraitItem = new Relay(); + readonly onDidRemoveTraitItem: Event = this._onDidRemoveTraitItem.event; private _onDidRefreshItem = new Relay(); readonly onDidRefreshItem: Event = this._onDidRefreshItem.event; private _onRefreshItemChildren = new Relay(); diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 64e5cfdb24551..51d69f930361e 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -557,7 +557,7 @@ export class TreeView extends HeightMap { this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSGestureTap', (e) => this.onMsGestureTap(e))); // these events come too fast, we throttle them - this.viewListeners.push(DOM.addDisposableThrottledListener(this.wrapper, 'MSGestureChange', (e) => this.onThrottledMsGestureChange(e), (lastEvent: IThrottledGestureEvent, event: MSGestureEvent): IThrottledGestureEvent => { + this.viewListeners.push(DOM.addDisposableThrottledListener(this.wrapper, 'MSGestureChange', e => this.onThrottledMsGestureChange(e), (lastEvent, event) => { event.stopPropagation(); event.preventDefault(); diff --git a/src/vs/base/test/browser/markdownRenderer.test.ts b/src/vs/base/test/browser/markdownRenderer.test.ts index 525eb86e741b8..499565a641cb2 100644 --- a/src/vs/base/test/browser/markdownRenderer.test.ts +++ b/src/vs/base/test/browser/markdownRenderer.test.ts @@ -6,42 +6,96 @@ import * as assert from 'assert'; import * as marked from 'vs/base/common/marked/marked'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; +import { MarkdownString } from 'vs/base/common/htmlContent'; suite('MarkdownRenderer', () => { - test('image rendering conforms to default', () => { - const markdown = { value: `![image](someimageurl 'caption')` }; - const result: HTMLElement = renderMarkdown(markdown); - const renderer = new marked.Renderer(); - const imageFromMarked = marked(markdown.value, { - sanitize: true, - renderer - }).trim(); - assert.strictEqual(result.innerHTML, imageFromMarked); - }); + suite('Images', () => { - test('image rendering conforms to default without title', () => { - const markdown = { value: `![image](someimageurl)` }; - const result: HTMLElement = renderMarkdown(markdown); - const renderer = new marked.Renderer(); - const imageFromMarked = marked(markdown.value, { - sanitize: true, - renderer - }).trim(); - assert.strictEqual(result.innerHTML, imageFromMarked); - }); + test('image rendering conforms to default', () => { + const markdown = { value: `![image](someimageurl 'caption')` }; + const result: HTMLElement = renderMarkdown(markdown); + const renderer = new marked.Renderer(); + const imageFromMarked = marked(markdown.value, { + sanitize: true, + renderer + }).trim(); + assert.strictEqual(result.innerHTML, imageFromMarked); + }); + + test('image rendering conforms to default without title', () => { + const markdown = { value: `![image](someimageurl)` }; + const result: HTMLElement = renderMarkdown(markdown); + const renderer = new marked.Renderer(); + const imageFromMarked = marked(markdown.value, { + sanitize: true, + renderer + }).trim(); + assert.strictEqual(result.innerHTML, imageFromMarked); + }); + + test('image width from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|width=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); + + test('image height from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); + + test('image width and height from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=200,width=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); - test('image width from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|width=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); }); - test('image height from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); + suite('ThemeIcons Support On', () => { + + test('render appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText('$(zap) $(not a theme icon) $(add)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(not a theme icon) $(add)

`); + }); + + test('render appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('$(zap) $(not a theme icon) $(add)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(not a theme icon)

`); + }); + + test('render appendMarkdown with escaped icon', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(not a theme icon)

`); + }); + }); - test('image width and height from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=200,width=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); + suite('ThemeIcons Support Off', () => { + + test('render appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendText('$(zap) $(not a theme icon) $(add)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(not a theme icon) $(add)

`); + }); + + test('render appendMarkdown with escaped icon', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(not a theme icon) $(add)

`); + }); + }); + }); diff --git a/src/vs/base/test/browser/progressBar.test.ts b/src/vs/base/test/browser/progressBar.test.ts index 03e0a061419db..f43082a0bc677 100644 --- a/src/vs/base/test/browser/progressBar.test.ts +++ b/src/vs/base/test/browser/progressBar.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar'; @@ -28,4 +29,4 @@ suite('ProgressBar', () => { bar.dispose(); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/browser/ui/grid/grid.test.ts b/src/vs/base/test/browser/ui/grid/grid.test.ts index a228eafffd86c..7956239d44d99 100644 --- a/src/vs/base/test/browser/ui/grid/grid.test.ts +++ b/src/vs/base/test/browser/ui/grid/grid.test.ts @@ -7,6 +7,7 @@ import * as assert from 'assert'; import { Direction, getRelativeLocation, Orientation, SerializableGrid, ISerializableView, IViewDeserializer, GridNode, Sizing, isGridBranchNode, sanitizeGridNodeDescriptor, GridNodeDescriptor, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid'; import { TestView, nodesToArrays } from './util'; import { deepClone } from 'vs/base/common/objects'; +import { Event } from 'vs/base/common/event'; // Simple example: // @@ -786,7 +787,7 @@ suite('SerializableGrid', function () { test('sanitizeGridNodeDescriptor', () => { const nodeDescriptor = { groups: [{ size: 0.2 }, { size: 0.2 }, { size: 0.6, groups: [{}, {}] }] }; const nodeDescriptorCopy = deepClone(nodeDescriptor); - sanitizeGridNodeDescriptor(nodeDescriptorCopy); + sanitizeGridNodeDescriptor(nodeDescriptorCopy, true); assert.deepEqual(nodeDescriptorCopy, { groups: [{ size: 0.2 }, { size: 0.2 }, { size: 0.6, groups: [{ size: 0.5 }, { size: 0.5 }] }] }); }); @@ -814,6 +815,33 @@ suite('SerializableGrid', function () { }); }); + test('createSerializedGrid - issue #85601, should not allow single children groups', () => { + const serializedGrid = createSerializedGrid({ orientation: Orientation.HORIZONTAL, groups: [{ groups: [{}, {}], size: 0.5 }, { groups: [{}], size: 0.5 }] }); + const views: ISerializableView[] = []; + const deserializer = new class implements IViewDeserializer { + fromJSON(): ISerializableView { + const view: ISerializableView = { + element: document.createElement('div'), + layout: () => null, + minimumWidth: 0, + maximumWidth: Number.POSITIVE_INFINITY, + minimumHeight: 0, + maximumHeight: Number.POSITIVE_INFINITY, + onDidChange: Event.None, + toJSON: () => ({}) + }; + views.push(view); + return view; + } + }; + + const grid = SerializableGrid.deserialize(serializedGrid, deserializer); + assert.equal(views.length, 3); + + // should not throw + grid.removeView(views[2]); + }); + test('serialize should store visibility and previous size', function () { const view1 = new TestSerializableView('view1', 50, Number.MAX_VALUE, 50, Number.MAX_VALUE); const grid = new SerializableGrid(view1); diff --git a/src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts b/src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts index 9dad8183e9164..5ab03d9cd4ccb 100644 --- a/src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts +++ b/src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts @@ -8,10 +8,7 @@ import { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState'; suite('ScrollbarState', () => { test('inflates slider size', () => { - let actual = new ScrollbarState(0, 14, 0); - actual.setVisibleSize(339); - actual.setScrollSize(42423); - actual.setScrollPosition(32787); + let actual = new ScrollbarState(0, 14, 0, 339, 42423, 32787); assert.equal(actual.getArrowSize(), 0); assert.equal(actual.getScrollPosition(), 32787); @@ -34,10 +31,7 @@ suite('ScrollbarState', () => { }); test('inflates slider size with arrows', () => { - let actual = new ScrollbarState(12, 14, 0); - actual.setVisibleSize(339); - actual.setScrollSize(42423); - actual.setScrollPosition(32787); + let actual = new ScrollbarState(12, 14, 0, 339, 42423, 32787); assert.equal(actual.getArrowSize(), 12); assert.equal(actual.getScrollPosition(), 32787); diff --git a/src/vs/base/test/browser/ui/splitview/splitview.test.ts b/src/vs/base/test/browser/ui/splitview/splitview.test.ts index 264a2bac86b96..2620db0b7d86e 100644 --- a/src/vs/base/test/browser/ui/splitview/splitview.test.ts +++ b/src/vs/base/test/browser/ui/splitview/splitview.test.ts @@ -8,7 +8,7 @@ import { Emitter } from 'vs/base/common/event'; import { SplitView, IView, Sizing, LayoutPriority } from 'vs/base/browser/ui/splitview/splitview'; import { Sash, SashState } from 'vs/base/browser/ui/sash/sash'; -class TestView implements IView { +class TestView implements IView { private readonly _onDidChange = new Emitter(); readonly onDidChange = this._onDidChange.event; @@ -43,7 +43,7 @@ class TestView implements IView { assert(_minimumSize <= _maximumSize, 'splitview view minimum size must be <= maximum size'); } - layout(size: number, orthogonalSize: number | undefined): void { + layout(size: number, _offset: number, orthogonalSize: number | undefined): void { this._size = size; this._orthogonalSize = orthogonalSize; this._onDidLayout.fire({ size, orthogonalSize }); @@ -527,11 +527,11 @@ suite('Splitview', () => { view1.dispose(); }); - test('orthogonal size propagates to views', () => { + test('context propagates to views', () => { const view1 = new TestView(20, Number.POSITIVE_INFINITY); const view2 = new TestView(20, Number.POSITIVE_INFINITY); const view3 = new TestView(20, Number.POSITIVE_INFINITY, LayoutPriority.Low); - const splitview = new SplitView(container, { proportionalLayout: false }); + const splitview = new SplitView(container, { proportionalLayout: false }); splitview.layout(200); splitview.addView(view1, Sizing.Distribute); diff --git a/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts b/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts index 1177889e12af8..95411fbbc71cb 100644 --- a/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts +++ b/src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts @@ -12,19 +12,28 @@ import { timeout } from 'vs/base/common/async'; interface Element { id: string; + suffix?: string; children?: Element[]; } -function find(elements: Element[] | undefined, id: string): Element { - while (elements) { - for (const element of elements) { - if (element.id === id) { - return element; - } +function find(element: Element, id: string): Element | undefined { + if (element.id === id) { + return element; + } + + if (!element.children) { + return undefined; + } + + for (const child of element.children) { + const result = find(child, id); + + if (result) { + return result; } } - throw new Error('element not found'); + return undefined; } class Renderer implements ITreeRenderer { @@ -33,7 +42,7 @@ class Renderer implements ITreeRenderer { return container; } renderElement(element: ITreeNode, index: number, templateData: HTMLElement): void { - templateData.textContent = element.element.id; + templateData.textContent = element.element.id + (element.element.suffix || ''); } disposeTemplate(templateData: HTMLElement): void { // noop @@ -65,7 +74,13 @@ class Model { constructor(readonly root: Element) { } get(id: string): Element { - return find(this.root.children, id); + const result = find(this.root, id); + + if (!result) { + throw new Error('element not found'); + } + + return result; } } @@ -389,4 +404,36 @@ suite('AsyncDataTree', function () { assert(!hasClass(twistie, 'collapsible')); assert(!hasClass(twistie, 'collapsed')); }); + + test('issues #84569, #82629 - rerender', async () => { + const container = document.createElement('div'); + const model = new Model({ + id: 'root', + children: [{ + id: 'a', + children: [{ + id: 'b', + suffix: '1' + }] + }] + }); + + const tree = new AsyncDataTree('test', container, new VirtualDelegate(), [new Renderer()], new DataSource(), { identityProvider: new IdentityProvider() }); + tree.layout(200); + + await tree.setInput(model.root); + await tree.expand(model.get('a')); + assert.deepEqual(Array.from(container.querySelectorAll('.monaco-list-row')).map(e => e.textContent), ['a', 'b1']); + + const a = model.get('a'); + const b = model.get('b'); + a.children?.splice(0, 1, { id: 'b', suffix: '2' }); + + await Promise.all([ + tree.updateChildren(a, true, true), + tree.updateChildren(b, true, true) + ]); + + assert.deepEqual(Array.from(container.querySelectorAll('.monaco-list-row')).map(e => e.textContent), ['a', 'b2']); + }); }); diff --git a/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts b/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts index d1914e5584f5e..43b8849801c9c 100644 --- a/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts +++ b/src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts @@ -356,13 +356,15 @@ suite('IndexTreeModel', function () { assert.deepEqual(list[1].collapsible, false); assert.deepEqual(list[1].collapsed, false); - model.setCollapsed([0], true); - assert.deepEqual(list.length, 1); + assert.deepEqual(model.setCollapsed([0], true), false); assert.deepEqual(list[0].element, 0); assert.deepEqual(list[0].collapsible, false); - assert.deepEqual(list[0].collapsed, true); + assert.deepEqual(list[0].collapsed, false); + assert.deepEqual(list[1].element, 10); + assert.deepEqual(list[1].collapsible, false); + assert.deepEqual(list[1].collapsed, false); - model.setCollapsed([0], false); + assert.deepEqual(model.setCollapsed([0], false), false); assert.deepEqual(list[0].element, 0); assert.deepEqual(list[0].collapsible, false); assert.deepEqual(list[0].collapsed, false); @@ -379,13 +381,13 @@ suite('IndexTreeModel', function () { assert.deepEqual(list[1].collapsible, false); assert.deepEqual(list[1].collapsed, false); - model.setCollapsed([0], true); + assert.deepEqual(model.setCollapsed([0], true), true); assert.deepEqual(list.length, 1); assert.deepEqual(list[0].element, 0); assert.deepEqual(list[0].collapsible, true); assert.deepEqual(list[0].collapsed, true); - model.setCollapsed([0], false); + assert.deepEqual(model.setCollapsed([0], false), true); assert.deepEqual(list[0].element, 0); assert.deepEqual(list[0].collapsible, true); assert.deepEqual(list[0].collapsed, false); diff --git a/src/vs/base/test/common/assert.test.ts b/src/vs/base/test/common/assert.test.ts index c7d3343ba2934..a925cd0437aec 100644 --- a/src/vs/base/test/common/assert.test.ts +++ b/src/vs/base/test/common/assert.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { ok } from 'vs/base/common/assert'; diff --git a/src/vs/base/test/common/async.test.ts b/src/vs/base/test/common/async.test.ts index 586c0fa8a7f13..25e7d83cc7bd4 100644 --- a/src/vs/base/test/common/async.test.ts +++ b/src/vs/base/test/common/async.test.ts @@ -7,6 +7,7 @@ import * as assert from 'assert'; import * as async from 'vs/base/common/async'; import { isPromiseCanceledError } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; +import { CancellationTokenSource } from 'vs/base/common/cancellation'; suite('Async', () => { @@ -557,4 +558,134 @@ suite('Async', () => { assert.equal(error, error); } }); + + test('TaskSequentializer - pending basics', async function () { + const sequentializer = new async.TaskSequentializer(); + + assert.ok(!sequentializer.hasPending()); + assert.ok(!sequentializer.hasPending(2323)); + assert.ok(!sequentializer.pending); + + // pending removes itself after done + await sequentializer.setPending(1, Promise.resolve()); + assert.ok(!sequentializer.hasPending()); + assert.ok(!sequentializer.hasPending(1)); + assert.ok(!sequentializer.pending); + + // pending removes itself after done (use async.timeout) + sequentializer.setPending(2, async.timeout(1)); + assert.ok(sequentializer.hasPending()); + assert.ok(sequentializer.hasPending(2)); + assert.ok(!sequentializer.hasPending(1)); + assert.ok(sequentializer.pending); + + await async.timeout(2); + assert.ok(!sequentializer.hasPending()); + assert.ok(!sequentializer.hasPending(2)); + assert.ok(!sequentializer.pending); + }); + + test('TaskSequentializer - pending and next (finishes instantly)', async function () { + const sequentializer = new async.TaskSequentializer(); + + let pendingDone = false; + sequentializer.setPending(1, async.timeout(1).then(() => { pendingDone = true; return; })); + + // next finishes instantly + let nextDone = false; + const res = sequentializer.setNext(() => Promise.resolve(null).then(() => { nextDone = true; return; })); + + await res; + assert.ok(pendingDone); + assert.ok(nextDone); + }); + + test('TaskSequentializer - pending and next (finishes after timeout)', async function () { + const sequentializer = new async.TaskSequentializer(); + + let pendingDone = false; + sequentializer.setPending(1, async.timeout(1).then(() => { pendingDone = true; return; })); + + // next finishes after async.timeout + let nextDone = false; + const res = sequentializer.setNext(() => async.timeout(1).then(() => { nextDone = true; return; })); + + await res; + assert.ok(pendingDone); + assert.ok(nextDone); + }); + + test('TaskSequentializer - pending and multiple next (last one wins)', async function () { + const sequentializer = new async.TaskSequentializer(); + + let pendingDone = false; + sequentializer.setPending(1, async.timeout(1).then(() => { pendingDone = true; return; })); + + // next finishes after async.timeout + let firstDone = false; + let firstRes = sequentializer.setNext(() => async.timeout(2).then(() => { firstDone = true; return; })); + + let secondDone = false; + let secondRes = sequentializer.setNext(() => async.timeout(3).then(() => { secondDone = true; return; })); + + let thirdDone = false; + let thirdRes = sequentializer.setNext(() => async.timeout(4).then(() => { thirdDone = true; return; })); + + await Promise.all([firstRes, secondRes, thirdRes]); + assert.ok(pendingDone); + assert.ok(!firstDone); + assert.ok(!secondDone); + assert.ok(thirdDone); + }); + + test('TaskSequentializer - cancel pending', async function () { + const sequentializer = new async.TaskSequentializer(); + + let pendingCancelled = false; + sequentializer.setPending(1, async.timeout(1), () => pendingCancelled = true); + sequentializer.cancelPending(); + + assert.ok(pendingCancelled); + }); + + test('raceCancellation', async () => { + const cts = new CancellationTokenSource(); + + const now = Date.now(); + + const p = async.raceCancellation(async.timeout(100), cts.token); + cts.cancel(); + + await p; + + assert.ok(Date.now() - now < 100); + }); + + test('raceTimeout', async () => { + const cts = new CancellationTokenSource(); + + // timeout wins + let now = Date.now(); + let timedout = false; + + const p1 = async.raceTimeout(async.timeout(100), 1, () => timedout = true); + cts.cancel(); + + await p1; + + assert.ok(Date.now() - now < 100); + assert.equal(timedout, true); + + // promise wins + now = Date.now(); + timedout = false; + + const p2 = async.raceTimeout(async.timeout(1), 100, () => timedout = true); + cts.cancel(); + + await p2; + + assert.ok(Date.now() - now < 100); + assert.equal(timedout, false); + }); }); diff --git a/src/vs/base/test/common/collections.test.ts b/src/vs/base/test/common/collections.test.ts index 353b5d0147d8a..e5449f4633398 100644 --- a/src/vs/base/test/common/collections.test.ts +++ b/src/vs/base/test/common/collections.test.ts @@ -6,7 +6,6 @@ import * as assert from 'assert'; import * as collections from 'vs/base/common/collections'; - suite('Collections', () => { test('forEach', () => { diff --git a/src/vs/base/test/common/decorators.test.ts b/src/vs/base/test/common/decorators.test.ts index e7882ddb4790c..9a01f60a3f478 100644 --- a/src/vs/base/test/common/decorators.test.ts +++ b/src/vs/base/test/common/decorators.test.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as sinon from 'sinon'; import * as assert from 'assert'; -import { memoize, createMemoizer } from 'vs/base/common/decorators'; +import { memoize, createMemoizer, throttle } from 'vs/base/common/decorators'; suite('Decorators', () => { test('memoize should memoize methods', () => { @@ -100,7 +101,9 @@ suite('Decorators', () => { test('memoized property should not be enumerable', () => { class Foo { @memoize - get answer() { return 42; } + get answer() { + return 42; + } } const foo = new Foo(); @@ -112,7 +115,9 @@ suite('Decorators', () => { test('memoized property should not be writable', () => { class Foo { @memoize - get answer() { return 42; } + get answer() { + return 42; + } } const foo = new Foo(); @@ -131,7 +136,9 @@ suite('Decorators', () => { let counter = 0; class Foo { @memoizer - get answer() { return ++counter; } + get answer() { + return ++counter; + } } const foo = new Foo(); @@ -145,4 +152,49 @@ suite('Decorators', () => { assert.equal(foo.answer, 3); assert.equal(foo.answer, 3); }); + + test('throttle', () => { + const spy = sinon.spy(); + const clock = sinon.useFakeTimers(); + try { + class ThrottleTest { + private _handle: Function; + + constructor(fn: Function) { + this._handle = fn; + } + + @throttle( + 100, + (a: number, b: number) => a + b, + () => 0 + ) + report(p: number): void { + this._handle(p); + } + } + + const t = new ThrottleTest(spy); + + t.report(1); + t.report(2); + t.report(3); + assert.deepEqual(spy.args, [[1]]); + + clock.tick(200); + assert.deepEqual(spy.args, [[1], [5]]); + spy.reset(); + + t.report(4); + t.report(5); + clock.tick(50); + t.report(6); + + assert.deepEqual(spy.args, [[4]]); + clock.tick(60); + assert.deepEqual(spy.args, [[4], [11]]); + } finally { + clock.restore(); + } + }); }); diff --git a/src/vs/base/test/common/errors.test.ts b/src/vs/base/test/common/errors.test.ts index d2dc4bfcb573f..a5e7916236166 100644 --- a/src/vs/base/test/common/errors.test.ts +++ b/src/vs/base/test/common/errors.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { toErrorMessage } from 'vs/base/common/errorMessage'; @@ -16,9 +17,17 @@ suite('Errors', () => { error.detail.exception = {}; error.detail.exception.message = 'Foo Bar'; assert.strictEqual(toErrorMessage(error), 'Foo Bar'); + assert.strictEqual(toErrorMessage(error, true), 'Foo Bar'); assert(toErrorMessage()); assert(toErrorMessage(null)); assert(toErrorMessage({})); + + try { + throw new Error(); + } catch (error) { + assert.strictEqual(toErrorMessage(error), 'An unknown error occurred. Please consult the log for more details.'); + assert.ok(toErrorMessage(error, true).length > 'An unknown error occurred. Please consult the log for more details.'.length); + } }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/common/event.test.ts b/src/vs/base/test/common/event.test.ts index 25d47dc6e00a8..bb589ca763303 100644 --- a/src/vs/base/test/common/event.test.ts +++ b/src/vs/base/test/common/event.test.ts @@ -3,10 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { Event, Emitter, EventBufferer, EventMultiplexer, AsyncEmitter, IWaitUntil, PauseableEmitter } from 'vs/base/common/event'; +import { Event, Emitter, EventBufferer, EventMultiplexer, IWaitUntil, PauseableEmitter, AsyncEmitter } from 'vs/base/common/event'; import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import * as Errors from 'vs/base/common/errors'; import { timeout } from 'vs/base/common/async'; +import { CancellationToken } from 'vs/base/common/cancellation'; namespace Samples { @@ -135,6 +136,7 @@ suite('Event', function () { let a = new Emitter(); let hit = false; a.event(function () { + // eslint-disable-next-line no-throw-literal throw 9; }); a.event(function () { @@ -174,7 +176,7 @@ suite('Event', function () { test('Debounce Event', function (done: () => void) { let doc = new Samples.Document3(); - let onDocDidChange = Event.debounce(doc.onDidChange, (prev: string[], cur) => { + let onDocDidChange = Event.debounce(doc.onDidChange, (prev: string[] | undefined, cur) => { if (!prev) { prev = [cur]; } else if (prev.indexOf(cur) < 0) { @@ -235,6 +237,20 @@ suite('Event', function () { assert.equal(calls, 2); }); + test('Debounce Event - leading reset', async function () { + const emitter = new Emitter(); + let debounced = Event.debounce(emitter.event, (l, e) => l ? l + 1 : 1, 0, /*leading=*/true); + + let calls: number[] = []; + debounced((e) => calls.push(e)); + + emitter.fire(1); + emitter.fire(1); + + await timeout(1); + assert.deepEqual(calls, [1, 1]); + }); + test('Emitter - In Order Delivery', function () { const a = new Emitter(); const listener2Events: string[] = []; @@ -272,11 +288,7 @@ suite('AsyncEmitter', function () { assert.equal(typeof e.waitUntil, 'function'); }); - emitter.fireAsync(thenables => ({ - foo: true, - bar: 1, - waitUntil(t: Promise) { thenables.push(t); } - })); + emitter.fireAsync({ foo: true, bar: 1, }, CancellationToken.None); emitter.dispose(); }); @@ -303,12 +315,7 @@ suite('AsyncEmitter', function () { })); }); - await emitter.fireAsync(thenables => ({ - foo: true, - waitUntil(t) { - thenables.push(t); - } - })); + await emitter.fireAsync({ foo: true }, CancellationToken.None); assert.equal(globalState, 2); }); @@ -324,12 +331,7 @@ suite('AsyncEmitter', function () { emitter.event(e => { e.waitUntil(timeout(10).then(async _ => { if (e.foo === 1) { - await emitter.fireAsync(thenables => ({ - foo: 2, - waitUntil(t) { - thenables.push(t); - } - })); + await emitter.fireAsync({ foo: 2 }, CancellationToken.None); assert.deepEqual(events, [1, 2]); done = true; } @@ -342,12 +344,7 @@ suite('AsyncEmitter', function () { e.waitUntil(timeout(7)); }); - await emitter.fireAsync(thenables => ({ - foo: 1, - waitUntil(t) { - thenables.push(t); - } - })); + await emitter.fireAsync({ foo: 1 }, CancellationToken.None); assert.ok(done); }); @@ -372,12 +369,7 @@ suite('AsyncEmitter', function () { e.waitUntil(timeout(10)); }); - await emitter.fireAsync(thenables => ({ - foo: true, - waitUntil(t) { - thenables.push(t); - } - })).then(() => { + await emitter.fireAsync({ foo: true }, CancellationToken.None).then(() => { assert.equal(globalState, 2); }).catch(e => { console.log(e); diff --git a/src/vs/base/test/common/extpath.test.ts b/src/vs/base/test/common/extpath.test.ts index da6da32873fdc..eb3d8da7a466e 100644 --- a/src/vs/base/test/common/extpath.test.ts +++ b/src/vs/base/test/common/extpath.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import * as extpath from 'vs/base/common/extpath'; import * as platform from 'vs/base/common/platform'; @@ -28,7 +29,6 @@ suite('Paths', () => { assert.equal(extpath.getRoot('http://www/'), 'http://www/'); assert.equal(extpath.getRoot('file:///foo'), 'file:///'); assert.equal(extpath.getRoot('file://foo'), ''); - }); test('isUNC', () => { diff --git a/src/vs/base/test/common/filters.test.ts b/src/vs/base/test/common/filters.test.ts index 6f96e22f47e97..0cf70ae8555c5 100644 --- a/src/vs/base/test/common/filters.test.ts +++ b/src/vs/base/test/common/filters.test.ts @@ -498,4 +498,14 @@ suite('Filters', () => { fuzzyScore ); }); + + test('"Go to Symbol" with the exact method name doesn\'t work as expected #84787', function () { + const match = fuzzyScore(':get', ':get', 1, 'get', 'get', 0, true); + assert.ok(Boolean(match)); + }); + + test('Suggestion is not highlighted #85826', function () { + assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScore); + assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScoreGracefulAggressive); + }); }); diff --git a/src/vs/base/test/common/hash.test.ts b/src/vs/base/test/common/hash.test.ts index d197cdf4f1f99..58b5904b63d32 100644 --- a/src/vs/base/test/common/hash.test.ts +++ b/src/vs/base/test/common/hash.test.ts @@ -43,4 +43,14 @@ suite('Hash', () => { assert.notEqual(hash({ 'foo': 'bar' }), hash({ 'foo': 'bar2' })); assert.notEqual(hash({}), hash([])); }); -}); \ No newline at end of file + + test('array - unexpected collision', function () { + this.skip(); + const a = hash([undefined, undefined, undefined, undefined, undefined]); + const b = hash([undefined, undefined, 'HHHHHH', [{ line: 0, character: 0 }, { line: 0, character: 0 }], undefined]); + // console.log(a); + // console.log(b); + assert.notEqual(a, b); + }); + +}); diff --git a/src/vs/base/test/common/jsonEdit.test.ts b/src/vs/base/test/common/jsonEdit.test.ts index 194f246a402f9..09936392c2436 100644 --- a/src/vs/base/test/common/jsonEdit.test.ts +++ b/src/vs/base/test/common/jsonEdit.test.ts @@ -118,13 +118,43 @@ suite('JSON - edits', () => { assertEdit(content, edits, '{\n "x": "y"\n}'); }); - test('insert item to empty array', () => { + test('insert item at 0', () => { + let content = '[\n 2,\n 3\n]'; + let edits = setProperty(content, [0], 1, formatterOptions); + assertEdit(content, edits, '[\n 1,\n 2,\n 3\n]'); + }); + + test('insert item at 0 in empty array', () => { + let content = '[\n]'; + let edits = setProperty(content, [0], 1, formatterOptions); + assertEdit(content, edits, '[\n 1\n]'); + }); + + test('insert item at an index', () => { + let content = '[\n 1,\n 3\n]'; + let edits = setProperty(content, [1], 2, formatterOptions); + assertEdit(content, edits, '[\n 1,\n 2,\n 3\n]'); + }); + + test('insert item at an index im empty array', () => { + let content = '[\n]'; + let edits = setProperty(content, [1], 1, formatterOptions); + assertEdit(content, edits, '[\n 1\n]'); + }); + + test('insert item at end index', () => { + let content = '[\n 1,\n 2\n]'; + let edits = setProperty(content, [2], 3, formatterOptions); + assertEdit(content, edits, '[\n 1,\n 2,\n 3\n]'); + }); + + test('insert item at end to empty array', () => { let content = '[\n]'; let edits = setProperty(content, [-1], 'bar', formatterOptions); assertEdit(content, edits, '[\n "bar"\n]'); }); - test('insert item', () => { + test('insert item at end', () => { let content = '[\n 1,\n 2\n]'; let edits = setProperty(content, [-1], 'bar', formatterOptions); assertEdit(content, edits, '[\n 1,\n 2,\n "bar"\n]'); @@ -160,4 +190,4 @@ suite('JSON - edits', () => { assertEdit(content, edits, '// This is a comment\n[\n 1,\n "foo"\n]'); }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/common/lazy.test.ts b/src/vs/base/test/common/lazy.test.ts index c6a1655513fbe..04d4a2569858b 100644 --- a/src/vs/base/test/common/lazy.test.ts +++ b/src/vs/base/test/common/lazy.test.ts @@ -47,7 +47,7 @@ suite('Lazy', () => { assert.deepEqual(innerLazy.getValue(), [1, 11]); }); - test('map should should handle error values', () => { + test('map should handle error values', () => { let outer = 0; let inner = 10; const outerLazy = new Lazy(() => { throw new Error(`${++outer}`); }); diff --git a/src/vs/base/test/common/linkedText.test.ts b/src/vs/base/test/common/linkedText.test.ts new file mode 100644 index 0000000000000..8e1cb887485da --- /dev/null +++ b/src/vs/base/test/common/linkedText.test.ts @@ -0,0 +1,58 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { parseLinkedText } from 'vs/base/common/linkedText'; + +suite('LinkedText', () => { + test('parses correctly', () => { + assert.deepEqual(parseLinkedText('').nodes, []); + assert.deepEqual(parseLinkedText('hello').nodes, ['hello']); + assert.deepEqual(parseLinkedText('hello there').nodes, ['hello there']); + assert.deepEqual(parseLinkedText('Some message with [link text](http://link.href).').nodes, [ + 'Some message with ', + { label: 'link text', href: 'http://link.href' }, + '.' + ]); + assert.deepEqual(parseLinkedText('Some message with [link text](http://link.href "and a title").').nodes, [ + 'Some message with ', + { label: 'link text', href: 'http://link.href', title: 'and a title' }, + '.' + ]); + assert.deepEqual(parseLinkedText('Some message with [link text](random stuff).').nodes, [ + 'Some message with [link text](random stuff).' + ]); + assert.deepEqual(parseLinkedText('Some message with [https link](https://link.href).').nodes, [ + 'Some message with ', + { label: 'https link', href: 'https://link.href' }, + '.' + ]); + assert.deepEqual(parseLinkedText('Some message with [https link](https:).').nodes, [ + 'Some message with [https link](https:).' + ]); + assert.deepEqual(parseLinkedText('Some message with [a command](command:foobar).').nodes, [ + 'Some message with ', + { label: 'a command', href: 'command:foobar' }, + '.' + ]); + assert.deepEqual(parseLinkedText('Some message with [a command](command:).').nodes, [ + 'Some message with [a command](command:).' + ]); + assert.deepEqual(parseLinkedText('link [one](command:foo "nice") and link [two](http://foo)...').nodes, [ + 'link ', + { label: 'one', href: 'command:foo', title: 'nice' }, + ' and link ', + { label: 'two', href: 'http://foo' }, + '...' + ]); + assert.deepEqual(parseLinkedText('link\n[one](command:foo "nice")\nand link [two](http://foo)...').nodes, [ + 'link\n', + { label: 'one', href: 'command:foo', title: 'nice' }, + '\nand link ', + { label: 'two', href: 'http://foo' }, + '...' + ]); + }); +}); diff --git a/src/vs/base/test/common/map.test.ts b/src/vs/base/test/common/map.test.ts index 245cccdf776b1..8afd0496f2416 100644 --- a/src/vs/base/test/common/map.test.ts +++ b/src/vs/base/test/common/map.test.ts @@ -16,6 +16,8 @@ suite('Map', () => { map.set('bk', 'bv'); assert.deepStrictEqual(map.keys(), ['ak', 'bk']); assert.deepStrictEqual(map.values(), ['av', 'bv']); + assert.equal(map.first, 'av'); + assert.equal(map.last, 'bv'); }); test('LinkedMap - Touch Old one', () => { diff --git a/src/vs/base/test/common/markdownString.test.ts b/src/vs/base/test/common/markdownString.test.ts index 69d33de8f1709..f33f741f624ad 100644 --- a/src/vs/base/test/common/markdownString.test.ts +++ b/src/vs/base/test/common/markdownString.test.ts @@ -6,14 +6,67 @@ import * as assert from 'assert'; import { MarkdownString } from 'vs/base/common/htmlContent'; -suite('markdownString', () => { +suite('MarkdownString', () => { - test('escape', () => { + test('appendText', () => { const mds = new MarkdownString(); - mds.appendText('# foo\n*bar*'); assert.equal(mds.value, '\\# foo\n\n\\*bar\\*'); }); + + suite('ThemeIcons', () => { + + suite('Support On', () => { + + test('appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText('$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '\\\\$\\(zap\\) $\\(not a theme icon\\) \\\\$\\(add\\)'); + }); + + test('appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '$(zap) $(not a theme icon) $(add)'); + }); + + test('appendMarkdown with escaped icon', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '\\$(zap) $(not a theme icon) $(add)'); + }); + + }); + + suite('Support Off', () => { + + test('appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendText('$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '$\\(zap\\) $\\(not a theme icon\\) $\\(add\\)'); + }); + + test('appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendMarkdown('$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '$(zap) $(not a theme icon) $(add)'); + }); + + test('appendMarkdown with escaped icon', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('\\$(zap) $(not a theme icon) $(add)'); + + assert.equal(mds.value, '\\$(zap) $(not a theme icon) $(add)'); + }); + + }); + + }); }); diff --git a/src/vs/base/test/common/mime.test.ts b/src/vs/base/test/common/mime.test.ts index 7c99c964c75b0..3d163580a6df4 100644 --- a/src/vs/base/test/common/mime.test.ts +++ b/src/vs/base/test/common/mime.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { guessMimeTypes, registerTextMime, suggestFilename } from 'vs/base/common/mime'; import { URI } from 'vs/base/common/uri'; diff --git a/src/vs/base/test/common/resources.test.ts b/src/vs/base/test/common/resources.test.ts index 5fdf1ba108899..b45ea4fc2f80e 100644 --- a/src/vs/base/test/common/resources.test.ts +++ b/src/vs/base/test/common/resources.test.ts @@ -108,6 +108,7 @@ suite('Resources', () => { assert.equal(joinPath(URI.file('/foo/bar'), '/./file.js').toString(), 'file:///foo/bar/file.js'); assert.equal(joinPath(URI.file('/foo/bar'), '../file.js').toString(), 'file:///foo/file.js'); } + assert.equal(joinPath(URI.parse('foo://a/foo/bar')).toString(), 'foo://a/foo/bar'); assert.equal(joinPath(URI.parse('foo://a/foo/bar'), '/file.js').toString(), 'foo://a/foo/bar/file.js'); assert.equal(joinPath(URI.parse('foo://a/foo/bar'), 'file.js').toString(), 'foo://a/foo/bar/file.js'); assert.equal(joinPath(URI.parse('foo://a/foo/bar/'), '/file.js').toString(), 'foo://a/foo/bar/file.js'); diff --git a/src/vs/base/test/common/strings.test.ts b/src/vs/base/test/common/strings.test.ts index ca5c6d3483e01..600df87cfca8f 100644 --- a/src/vs/base/test/common/strings.test.ts +++ b/src/vs/base/test/common/strings.test.ts @@ -492,4 +492,8 @@ suite('Strings', () => { assertEncodeDecodeUTF8('🧝', [240, 159, 167, 157]); }); + + test('getGraphemeBreakType', () => { + assert.equal(strings.getGraphemeBreakType(0xBC1), strings.GraphemeBreakType.SpacingMark); + }); }); diff --git a/src/vs/base/test/common/types.test.ts b/src/vs/base/test/common/types.test.ts index 90e174dd0009f..0bec27fcd846e 100644 --- a/src/vs/base/test/common/types.test.ts +++ b/src/vs/base/test/common/types.test.ts @@ -2,10 +2,12 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import * as types from 'vs/base/common/types'; suite('Types', () => { + test('isFunction', () => { assert(!types.isFunction(undefined)); assert(!types.isFunction(null)); diff --git a/src/vs/base/test/common/uri.test.ts b/src/vs/base/test/common/uri.test.ts index 3255575ae5717..495a1ddf636be 100644 --- a/src/vs/base/test/common/uri.test.ts +++ b/src/vs/base/test/common/uri.test.ts @@ -404,7 +404,7 @@ suite('URI', () => { path = 'foo/bar'; assert.equal(URI.file(path).path, '/foo/bar'); path = './foo/bar'; - assert.equal(URI.file(path).path, '/./foo/bar'); // todo@joh missing normalization + assert.equal(URI.file(path).path, '/./foo/bar'); // missing normalization const fileUri1 = URI.parse(`file:foo/bar`); assert.equal(fileUri1.path, '/foo/bar'); @@ -439,6 +439,10 @@ suite('URI', () => { assert.equal(uri.path, uri2.path); }); + test('Unable to open \'%A0.txt\': URI malformed #76506', function () { + assert.equal(URI.parse('file://some/%.txt'), 'file://some/%25.txt'); + assert.equal(URI.parse('file://some/%A0.txt'), 'file://some/%25A0.txt'); + }); test('Links in markdown are broken if url contains encoded parameters #79474', function () { this.skip(); diff --git a/src/vs/base/test/common/utils.ts b/src/vs/base/test/common/utils.ts index 26b225a1fa900..d77f9f786e242 100644 --- a/src/vs/base/test/common/utils.ts +++ b/src/vs/base/test/common/utils.ts @@ -26,35 +26,32 @@ export class DeferredPromise { public complete(value: T) { return new Promise(resolve => { - process.nextTick(() => { - this.completeCallback(value); - resolve(); - }); + this.completeCallback(value); + resolve(); }); } public error(err: any) { return new Promise(resolve => { - process.nextTick(() => { - this.errorCallback(err); - resolve(); - }); + this.errorCallback(err); + resolve(); }); } public cancel() { - process.nextTick(() => { + new Promise(resolve => { this.errorCallback(canceled()); + resolve(); }); } } export function toResource(this: any, path: string) { if (isWindows) { - return URI.file(join('C:\\', Buffer.from(this.test.fullTitle()).toString('base64'), path)); + return URI.file(join('C:\\', btoa(this.test.fullTitle()), path)); } - return URI.file(join('/', Buffer.from(this.test.fullTitle()).toString('base64'), path)); + return URI.file(join('/', btoa(this.test.fullTitle()), path)); } export function suiteRepeat(n: number, description: string, callback: (this: any) => void): void { diff --git a/src/vs/base/test/node/config.test.ts b/src/vs/base/test/node/config.test.ts deleted file mode 100644 index 3fa8f78de6828..0000000000000 --- a/src/vs/base/test/node/config.test.ts +++ /dev/null @@ -1,163 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as assert from 'assert'; -import * as os from 'os'; - -import * as path from 'vs/base/common/path'; -import * as fs from 'fs'; -import * as uuid from 'vs/base/common/uuid'; -import { ConfigWatcher } from 'vs/base/node/config'; -import { testFile } from 'vs/base/test/node/utils'; - -suite('Config', () => { - - test('defaults', () => { - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const newDir = path.join(parentDir, 'config', id); - const testFile = path.join(newDir, 'config.json'); - - let watcher = new ConfigWatcher<{}>(testFile); - - let config = watcher.getConfig(); - assert.ok(config); - assert.equal(Object.keys(config), 0); - - watcher.dispose(); - - let watcher2 = new ConfigWatcher(testFile, { defaultConfig: ['foo'], onError: console.error }); - - let config2 = watcher2.getConfig(); - assert.ok(Array.isArray(config2)); - assert.equal(config2.length, 1); - - watcher.dispose(); - }); - - test('getConfig / getValue', function () { - return testFile('config', 'config.json').then(res => { - fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "bar" }'); - - let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile); - - let config = watcher.getConfig(); - assert.ok(config); - assert.equal(config.foo, 'bar'); - assert.ok(!watcher.hasParseErrors); - - watcher.dispose(); - - return res.cleanUp(); - }); - }); - - test('getConfig / getValue - broken JSON', function () { - return testFile('config', 'config.json').then(res => { - fs.writeFileSync(res.testFile, '// my comment\n "foo": "bar ... '); - - let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile); - - let config = watcher.getConfig(); - assert.ok(config); - assert.ok(!config.foo); - - assert.ok(watcher.hasParseErrors); - - watcher.dispose(); - - return res.cleanUp(); - }); - }); - - // test('watching', function (done) { - // this.timeout(10000); // watching is timing intense - - // testFile('config', 'config.json').then(res => { - // fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "bar" }'); - - // let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile); - // watcher.getConfig(); // ensure we are in sync - - // fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "changed" }'); - - // watcher.onDidUpdateConfiguration(event => { - // assert.ok(event); - // assert.equal(event.config.foo, 'changed'); - // assert.equal(watcher.getValue('foo'), 'changed'); - - // watcher.dispose(); - - // res.cleanUp().then(done, done); - // }); - // }, done); - // }); - - // test('watching also works when file created later', function (done) { - // this.timeout(10000); // watching is timing intense - - // testFile('config', 'config.json').then(res => { - // let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile); - // watcher.getConfig(); // ensure we are in sync - - // fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "changed" }'); - - // watcher.onDidUpdateConfiguration(event => { - // assert.ok(event); - // assert.equal(event.config.foo, 'changed'); - // assert.equal(watcher.getValue('foo'), 'changed'); - - // watcher.dispose(); - - // res.cleanUp().then(done, done); - // }); - // }, done); - // }); - - // test('watching detects the config file getting deleted', function (done) { - // this.timeout(10000); // watching is timing intense - - // testFile('config', 'config.json').then(res => { - // fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "bar" }'); - - // let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile); - // watcher.getConfig(); // ensure we are in sync - - // watcher.onDidUpdateConfiguration(event => { - // assert.ok(event); - - // watcher.dispose(); - - // res.cleanUp().then(done, done); - // }); - - // fs.unlinkSync(res.testFile); - // }, done); - // }); - - test('reload', function (done) { - testFile('config', 'config.json').then(res => { - fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "bar" }'); - - let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile, { changeBufferDelay: 100, onError: console.error, defaultConfig: { foo: 'bar' } }); - watcher.getConfig(); // ensure we are in sync - - fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "changed" }'); - - // still old values because change is not bubbling yet - assert.equal(watcher.getConfig().foo, 'bar'); - - // force a load from disk - watcher.reload(config => { - assert.equal(config.foo, 'changed'); - assert.equal(watcher.getConfig().foo, 'changed'); - - watcher.dispose(); - - res.cleanUp().then(done, done); - }); - }, done); - }); -}); \ No newline at end of file diff --git a/src/vs/base/test/node/encoding/encoding.test.ts b/src/vs/base/test/node/encoding/encoding.test.ts index eef17fbddb61a..1931c76aa4015 100644 --- a/src/vs/base/test/node/encoding/encoding.test.ts +++ b/src/vs/base/test/node/encoding/encoding.test.ts @@ -6,10 +6,11 @@ import * as assert from 'assert'; import * as fs from 'fs'; import * as encoding from 'vs/base/node/encoding'; +import * as terminalEncoding from 'vs/base/node/terminalEncoding'; import { Readable } from 'stream'; import { getPathFromAmdModule } from 'vs/base/common/amd'; -export async function detectEncodingByBOM(file: string): Promise { +export async function detectEncodingByBOM(file: string): Promise { try { const { buffer, bytesRead } = await readExactlyByFile(file, 3); @@ -86,7 +87,7 @@ suite('Encoding', () => { const file = getPathFromAmdModule(require, './fixtures/some_utf8.css'); const detectedEncoding = await detectEncodingByBOM(file); - assert.equal(detectedEncoding, 'utf8'); + assert.equal(detectedEncoding, 'utf8bom'); }); test('detectBOM UTF-16 LE', async () => { @@ -118,14 +119,14 @@ suite('Encoding', () => { }); test('resolve terminal encoding (detect)', async function () { - const enc = await encoding.resolveTerminalEncoding(); - assert.ok(encoding.encodingExists(enc)); + const enc = await terminalEncoding.resolveTerminalEncoding(); + assert.ok(enc.length > 0); }); test('resolve terminal encoding (environment)', async function () { process.env['VSCODE_CLI_ENCODING'] = 'utf16le'; - const enc = await encoding.resolveTerminalEncoding(); + const enc = await terminalEncoding.resolveTerminalEncoding(); assert.ok(encoding.encodingExists(enc)); assert.equal(enc, 'utf16le'); }); diff --git a/src/vs/base/test/node/glob.test.ts b/src/vs/base/test/node/glob.test.ts index f2610a7ee5f43..f7e8dfd13562c 100644 --- a/src/vs/base/test/node/glob.test.ts +++ b/src/vs/base/test/node/glob.test.ts @@ -14,12 +14,12 @@ suite('Glob', () => { // let patterns = [ // '{**/*.cs,**/*.json,**/*.csproj,**/*.sln}', // '{**/*.cs,**/*.csproj,**/*.sln}', - // '{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/*.mjs}', + // '{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/*.mjs,**/*.cjs}', // '**/*.go', // '{**/*.ps,**/*.ps1}', // '{**/*.c,**/*.cpp,**/*.h}', // '{**/*.fsx,**/*.fsi,**/*.fs,**/*.ml,**/*.mli}', - // '{**/*.js,**/*.jsx,**/*.es6,**/*.mjs}', + // '{**/*.js,**/*.jsx,**/*.es6,**/*.mjs,**/*.cjs}', // '{**/*.ts,**/*.tsx}', // '{**/*.php}', // '{**/*.php}', @@ -1015,4 +1015,4 @@ suite('Glob', () => { assertNoGlobMatch(p, '/DNXConsoleApp/foo/Program.cs'); } }); -}); \ No newline at end of file +}); diff --git a/src/vs/base/test/node/keytar.test.ts b/src/vs/base/test/node/keytar.test.ts index 53f1c31a1a64d..b2f7bab5042f4 100644 --- a/src/vs/base/test/node/keytar.test.ts +++ b/src/vs/base/test/node/keytar.test.ts @@ -28,7 +28,7 @@ suite('Keytar', () => { try { await keytar.deletePassword(name, 'foo'); } finally { - // tslint:disable-next-line: no-unsafe-finally + // eslint-disable-next-line no-unsafe-finally throw err; } } diff --git a/src/vs/base/test/common/path.test.ts b/src/vs/base/test/node/path.test.ts similarity index 99% rename from src/vs/base/test/common/path.test.ts rename to src/vs/base/test/node/path.test.ts index f5230c4a35c73..688c184a99e16 100644 --- a/src/vs/base/test/common/path.test.ts +++ b/src/vs/base/test/node/path.test.ts @@ -176,8 +176,8 @@ suite('Paths (Node Implementation)', () => { }); test('dirname', () => { - assert.strictEqual(path.dirname(path.normalize(__filename)).substr(-11), - isWindows ? 'test\\common' : 'test/common'); + assert.strictEqual(path.dirname(path.normalize(__filename)).substr(-9), + isWindows ? 'test\\node' : 'test/node'); assert.strictEqual(path.posix.dirname('/a/b/'), '/a'); assert.strictEqual(path.posix.dirname('/a/b'), '/a'); diff --git a/src/vs/base/test/node/pfs/pfs.test.ts b/src/vs/base/test/node/pfs/pfs.test.ts index 80595e9ec5fe0..c82436e3b8253 100644 --- a/src/vs/base/test/node/pfs/pfs.test.ts +++ b/src/vs/base/test/node/pfs/pfs.test.ts @@ -7,47 +7,13 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'vs/base/common/path'; import * as fs from 'fs'; -import { Readable } from 'stream'; import * as uuid from 'vs/base/common/uuid'; import * as pfs from 'vs/base/node/pfs'; import { timeout } from 'vs/base/common/async'; import { getPathFromAmdModule } from 'vs/base/common/amd'; -import { isWindows, isLinux } from 'vs/base/common/platform'; +import { isWindows } from 'vs/base/common/platform'; import { canNormalize } from 'vs/base/common/normalization'; import { VSBuffer } from 'vs/base/common/buffer'; -import { join } from 'path'; - -const chunkSize = 64 * 1024; -const readError = 'Error while reading'; -function toReadable(value: string, throwError?: boolean): Readable { - const totalChunks = Math.ceil(value.length / chunkSize); - const stringChunks: string[] = []; - - for (let i = 0, j = 0; i < totalChunks; ++i, j += chunkSize) { - stringChunks[i] = value.substr(j, chunkSize); - } - - let counter = 0; - return new Readable({ - read: function () { - if (throwError) { - this.emit('error', new Error(readError)); - } - - let res!: string; - let canPush = true; - while (canPush && (res = stringChunks[counter++])) { - canPush = this.push(res); - } - - // EOS - if (!res) { - this.push(null); - } - }, - encoding: 'utf8' - }); -} suite('PFS', function () { @@ -335,7 +301,7 @@ suite('PFS', function () { test('stat link', async () => { if (isWindows) { - return Promise.resolve(); // Symlinks are not the same on win, and we can not create them programitically without admin privileges + return; // Symlinks are not the same on win, and we can not create them programitically without admin privileges } const id1 = uuid.generateUuid(); @@ -350,12 +316,36 @@ suite('PFS', function () { fs.symlinkSync(directory, symbolicLink); let statAndIsLink = await pfs.statLink(directory); - assert.ok(!statAndIsLink!.isSymbolicLink); + assert.ok(!statAndIsLink?.symbolicLink); statAndIsLink = await pfs.statLink(symbolicLink); - assert.ok(statAndIsLink!.isSymbolicLink); + assert.ok(statAndIsLink?.symbolicLink); + assert.ok(!statAndIsLink?.symbolicLink?.dangling); + + pfs.rimrafSync(directory); + }); + + test('stat link (non existing target)', async () => { + if (isWindows) { + return; // Symlinks are not the same on win, and we can not create them programitically without admin privileges + } + + const id1 = uuid.generateUuid(); + const parentDir = path.join(os.tmpdir(), 'vsctests', id1); + const directory = path.join(parentDir, 'pfs', id1); + + const id2 = uuid.generateUuid(); + const symbolicLink = path.join(parentDir, 'pfs', id2); + + await pfs.mkdirp(directory, 493); + + fs.symlinkSync(directory, symbolicLink); pfs.rimrafSync(directory); + + const statAndIsLink = await pfs.statLink(symbolicLink); + assert.ok(statAndIsLink?.symbolicLink); + assert.ok(statAndIsLink?.symbolicLink?.dangling); }); test('readdir', async () => { @@ -379,12 +369,12 @@ suite('PFS', function () { if (canNormalize && typeof process.versions['electron'] !== 'undefined' /* needs electron */) { const id = uuid.generateUuid(); const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const testDir = join(parentDir, 'pfs', id); + const testDir = path.join(parentDir, 'pfs', id); const newDir = path.join(testDir, 'öäü'); await pfs.mkdirp(newDir, 493); - await pfs.writeFile(join(testDir, 'somefile.txt'), 'contents'); + await pfs.writeFile(path.join(testDir, 'somefile.txt'), 'contents'); assert.ok(fs.existsSync(newDir)); @@ -421,17 +411,10 @@ suite('PFS', function () { return testWriteFileAndFlush(VSBuffer.fromString(smallData).buffer, smallData, VSBuffer.fromString(bigData).buffer, bigData); }); - test('writeFile (stream)', async () => { - const smallData = 'Hello World'; - const bigData = (new Array(100 * 1024)).join('Large String\n'); - - return testWriteFileAndFlush(toReadable(smallData), smallData, toReadable(bigData), bigData); - }); - async function testWriteFileAndFlush( - smallData: string | Buffer | NodeJS.ReadableStream | Uint8Array, + smallData: string | Buffer | Uint8Array, smallDataValue: string, - bigData: string | Buffer | NodeJS.ReadableStream | Uint8Array, + bigData: string | Buffer | Uint8Array, bigDataValue: string ): Promise { const id = uuid.generateUuid(); @@ -451,22 +434,6 @@ suite('PFS', function () { await pfs.rimraf(parentDir); } - test('writeFile (file stream)', async () => { - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const sourceFile = getPathFromAmdModule(require, './fixtures/index.html'); - const newDir = path.join(parentDir, 'pfs', id); - const testFile = path.join(newDir, 'flushed.txt'); - - await pfs.mkdirp(newDir, 493); - assert.ok(fs.existsSync(newDir)); - - await pfs.writeFile(testFile, fs.createReadStream(sourceFile)); - assert.equal(fs.readFileSync(testFile).toString(), fs.readFileSync(sourceFile).toString()); - - await pfs.rimraf(parentDir); - }); - test('writeFile (string, error handling)', async () => { const id = uuid.generateUuid(); const parentDir = path.join(os.tmpdir(), 'vsctests', id); @@ -491,118 +458,6 @@ suite('PFS', function () { await pfs.rimraf(parentDir); }); - test('writeFile (stream, error handling EISDIR)', async () => { - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const newDir = path.join(parentDir, 'pfs', id); - const testFile = path.join(newDir, 'flushed.txt'); - - await pfs.mkdirp(newDir, 493); - - assert.ok(fs.existsSync(newDir)); - - fs.mkdirSync(testFile); // this will trigger an error because testFile is now a directory! - - const readable = toReadable('Hello World'); - - let expectedError: Error | undefined; - try { - await pfs.writeFile(testFile, readable); - } catch (error) { - expectedError = error; - } - - if (!expectedError || (expectedError).code !== 'EISDIR') { - throw new Error('Expected EISDIR error for writing to folder but got: ' + (expectedError ? (expectedError).code : 'no error')); - } - - // verify that the stream is still consumable (for https://github.com/Microsoft/vscode/issues/42542) - assert.equal(readable.read(), 'Hello World'); - - await pfs.rimraf(parentDir); - }); - - test('writeFile (stream, error handling READERROR)', async () => { - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const newDir = path.join(parentDir, 'pfs', id); - const testFile = path.join(newDir, 'flushed.txt'); - - await pfs.mkdirp(newDir, 493); - assert.ok(fs.existsSync(newDir)); - - let expectedError: Error | undefined; - try { - await pfs.writeFile(testFile, toReadable('Hello World', true /* throw error */)); - } catch (error) { - expectedError = error; - } - - if (!expectedError || expectedError.message !== readError) { - throw new Error('Expected error for writing to folder'); - } - - await pfs.rimraf(parentDir); - }); - - test('writeFile (stream, error handling EACCES)', async () => { - if (isLinux) { - return Promise.resolve(); // somehow this test fails on Linux in our TFS builds - } - - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const newDir = path.join(parentDir, 'pfs', id); - const testFile = path.join(newDir, 'flushed.txt'); - - await pfs.mkdirp(newDir, 493); - - assert.ok(fs.existsSync(newDir)); - - fs.writeFileSync(testFile, ''); - fs.chmodSync(testFile, 33060); // make readonly - - let expectedError: Error | undefined; - try { - await pfs.writeFile(testFile, toReadable('Hello World')); - } catch (error) { - expectedError = error; - } - - if (!expectedError || !((expectedError).code !== 'EACCES' || (expectedError).code !== 'EPERM')) { - throw new Error('Expected EACCES/EPERM error for writing to folder but got: ' + (expectedError ? (expectedError).code : 'no error')); - } - - await pfs.rimraf(parentDir); - }); - - test('writeFile (file stream, error handling)', async () => { - const id = uuid.generateUuid(); - const parentDir = path.join(os.tmpdir(), 'vsctests', id); - const sourceFile = getPathFromAmdModule(require, './fixtures/index.html'); - const newDir = path.join(parentDir, 'pfs', id); - const testFile = path.join(newDir, 'flushed.txt'); - - await pfs.mkdirp(newDir, 493); - - assert.ok(fs.existsSync(newDir)); - - fs.mkdirSync(testFile); // this will trigger an error because testFile is now a directory! - - let expectedError: Error | undefined; - try { - await pfs.writeFile(testFile, fs.createReadStream(sourceFile)); - } catch (error) { - expectedError = error; - } - - if (!expectedError) { - throw new Error('Expected error for writing to folder'); - } - - await pfs.rimraf(parentDir); - }); - test('writeFileSync', async () => { const id = uuid.generateUuid(); const parentDir = path.join(os.tmpdir(), 'vsctests', id); diff --git a/src/vs/code/browser/workbench/workbench-dev.html b/src/vs/code/browser/workbench/workbench-dev.html index 7ae960dbc913a..7355cabbb7cff 100644 --- a/src/vs/code/browser/workbench/workbench-dev.html +++ b/src/vs/code/browser/workbench/workbench-dev.html @@ -31,7 +31,9 @@ 'onigasm-umd': `${window.location.origin}/static/remote/web/node_modules/onigasm-umd/release/main`, 'xterm': `${window.location.origin}/static/remote/web/node_modules/xterm/lib/xterm.js`, 'xterm-addon-search': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-search/lib/xterm-addon-search.js`, + 'xterm-addon-unicode11': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, 'xterm-addon-web-links': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`, + 'xterm-addon-webgl': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, 'semver-umd': `${window.location.origin}/static/remote/web/node_modules/semver-umd/lib/semver-umd.js`, } }; diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html index dbcb8e490fefa..db616831643bd 100644 --- a/src/vs/code/browser/workbench/workbench.html +++ b/src/vs/code/browser/workbench/workbench.html @@ -35,7 +35,9 @@ 'onigasm-umd': `${window.location.origin}/static/node_modules/onigasm-umd/release/main`, 'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`, 'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`, + 'xterm-addon-unicode11': `${window.location.origin}/static/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, 'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`, + 'xterm-addon-webgl': `${window.location.origin}/static/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, 'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`, } }; diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index a599f5a7ebf07..45f6f17ce064b 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IWorkbenchConstructionOptions, create, URI, Event, Emitter, UriComponents, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace } from 'vs/workbench/workbench.web.api'; +import { IWorkbenchConstructionOptions, create, URI, Event, Emitter, UriComponents, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace, IApplicationLink } from 'vs/workbench/workbench.web.api'; import { generateUuid } from 'vs/base/common/uuid'; import { CancellationToken } from 'vs/base/common/cancellation'; import { streamToBuffer } from 'vs/base/common/buffer'; @@ -12,6 +12,10 @@ import { request } from 'vs/base/parts/request/browser/request'; import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/windows/common/windows'; import { isEqual } from 'vs/base/common/resources'; import { isStandalone } from 'vs/base/browser/browser'; +import product from 'vs/platform/product/common/product'; +import { Schemas } from 'vs/base/common/network'; +import { posix } from 'vs/base/common/path'; +import { localize } from 'vs/nls'; interface ICredential { service: string; @@ -338,11 +342,30 @@ class WorkspaceProvider implements IWorkspaceProvider { } } + // Application links ("Open in Desktop") + let applicationLinks: IApplicationLink[] | undefined = undefined; + if (workspace) { + const workspaceUri = isWorkspaceToOpen(workspace) ? workspace.workspaceUri : isFolderToOpen(workspace) ? workspace.folderUri : undefined; + if (workspaceUri) { + applicationLinks = [{ + uri: URI.from({ + scheme: product.quality === 'stable' ? 'vscode' : 'vscode-insiders', + authority: Schemas.vscodeRemote, + path: posix.join(posix.sep, workspaceUri.authority, workspaceUri.path), + query: workspaceUri.query, + fragment: workspaceUri.fragment, + }), + label: localize('openInDesktop', "Open in Desktop") + }]; + } + } + // Finally create workbench create(document.body, { ...config, workspaceProvider: new WorkspaceProvider(workspace, payload), urlCallbackProvider: new PollingURLCallbackProvider(), - credentialsProvider: new LocalStorageCredentialsProvider() + credentialsProvider: new LocalStorageCredentialsProvider(), + applicationLinks: applicationLinks }); })(); diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts index 32eaef78ac46d..169dbf0c32673 100644 --- a/src/vs/code/electron-browser/issue/issueReporterMain.ts +++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts @@ -3,43 +3,43 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import 'vs/css!./media/issueReporter'; -import { shell, ipcRenderer, webFrame, clipboard } from 'electron'; -import { localize } from 'vs/nls'; +import { clipboard, ipcRenderer, shell, webFrame } from 'electron'; +import * as os from 'os'; +import * as browser from 'vs/base/browser/browser'; import { $ } from 'vs/base/browser/dom'; +import { Button } from 'vs/base/browser/ui/button/button'; +import { CodiconLabel } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; import * as collections from 'vs/base/common/collections'; -import * as browser from 'vs/base/browser/browser'; -import { escape } from 'vs/base/common/strings'; -import product from 'vs/platform/product/common/product'; -import * as os from 'os'; import { debounce } from 'vs/base/common/decorators'; -import * as platform from 'vs/base/common/platform'; import { Disposable } from 'vs/base/common/lifecycle'; +import * as platform from 'vs/base/common/platform'; +import { escape } from 'vs/base/common/strings'; import { getDelayedChannel } from 'vs/base/parts/ipc/common/ipc'; import { createChannelSender } from 'vs/base/parts/ipc/node/ipc'; import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net'; -import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; -import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils'; +import { normalizeGitHubUrl } from 'vs/code/common/issue/issueReporterUtil'; +import { IssueReporterData as IssueReporterModelData, IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel'; +import BaseHtml from 'vs/code/electron-browser/issue/issueReporterPage'; +import 'vs/css!./media/issueReporter'; +import { localize } from 'vs/nls'; +import { isRemoteDiagnosticError, SystemInfo } from 'vs/platform/diagnostics/common/diagnostics'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; -import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; -import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; -import { MainProcessService, IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; -import { IssueReporterModel, IssueReporterData as IssueReporterModelData } from 'vs/code/electron-browser/issue/issueReporterModel'; -import { IssueReporterData, IssueReporterStyles, IssueType, ISettingsSearchIssueReporterData, IssueReporterFeatures, IssueReporterExtensionData } from 'vs/platform/issue/node/issue'; -import BaseHtml from 'vs/code/electron-browser/issue/issueReporterPage'; -import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc'; -import { ILogService, getLogLevel } from 'vs/platform/log/common/log'; -import { CodiconLabel } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; -import { normalizeGitHubUrl } from 'vs/code/common/issue/issueReporterUtil'; -import { Button } from 'vs/base/browser/ui/button/button'; -import { SystemInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; -import { SpdLogService } from 'vs/platform/log/node/spdlogService'; +import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; +import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; +import { IMainProcessService, MainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; +import { ISettingsSearchIssueReporterData, IssueReporterData, IssueReporterExtensionData, IssueReporterFeatures, IssueReporterStyles, IssueType } from 'vs/platform/issue/node/issue'; +import { getLogLevel, ILogService } from 'vs/platform/log/common/log'; +import { FollowerLogService, LoggerChannelClient } from 'vs/platform/log/common/logIpc'; +import { SpdLogService } from 'vs/platform/log/node/spdlogService'; +import product from 'vs/platform/product/common/product'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; +import { combinedAppender, LogAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; +import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; +import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; +import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; const MAX_URL_LENGTH = 2045; @@ -97,6 +97,23 @@ export class IssueReporter extends Disposable { this.previewButton = new Button(issueReporterElement); } + const issueTitle = configuration.data.issueTitle; + if (issueTitle) { + const issueTitleElement = this.getElementById('issue-title'); + if (issueTitleElement) { + issueTitleElement.value = issueTitle; + } + } + + const issueBody = configuration.data.issueBody; + if (issueBody) { + const description = this.getElementById('description'); + if (description) { + description.value = issueBody; + this.issueReporterModel.update({ issueDescription: issueBody }); + } + } + ipcRenderer.on('vscode:issuePerformanceInfoResponse', (_: unknown, info: Partial) => { this.logService.trace('issueReporter: Received performance data'); this.issueReporterModel.update(info); @@ -185,8 +202,16 @@ export class IssueReporter extends Disposable { } if (styles.inputErrorBorder) { - content.push(`.invalid-input, .invalid-input:focus { border: 1px solid ${styles.inputErrorBorder} !important; }`); - content.push(`.validation-error, .required-input { color: ${styles.inputErrorBorder}; }`); + content.push(`.invalid-input, .invalid-input:focus, .validation-error { border: 1px solid ${styles.inputErrorBorder} !important; }`); + content.push(`.required-input { color: ${styles.inputErrorBorder}; }`); + } + + if (styles.inputErrorBackground) { + content.push(`.validation-error { background: ${styles.inputErrorBackground}; }`); + } + + if (styles.inputErrorForeground) { + content.push(`.validation-error { color: ${styles.inputErrorForeground}; }`); } if (styles.inputActiveBorder) { @@ -226,7 +251,7 @@ export class IssueReporter extends Disposable { } if (styles.buttonHoverBackground) { - content.push(`.monaco-text-button:hover, .monaco-text-button:focus { background-color: ${styles.buttonHoverBackground} !important; }`); + content.push(`.monaco-text-button:not(.disabled):hover, .monaco-text-button:focus { background-color: ${styles.buttonHoverBackground} !important; }`); } styleTag.innerHTML = content.join('\n'); @@ -345,8 +370,8 @@ export class IssueReporter extends Disposable { const showInfoElements = document.getElementsByClassName('showInfo'); for (let i = 0; i < showInfoElements.length; i++) { - const showInfo = showInfoElements.item(i); - showInfo!.addEventListener('click', (e: MouseEvent) => { + const showInfo = showInfoElements.item(i)!; + (showInfo as HTMLAnchorElement).addEventListener('click', (e: MouseEvent) => { e.preventDefault(); const label = (e.target); if (label) { @@ -432,9 +457,14 @@ export class IssueReporter extends Disposable { sendWorkbenchCommand('workbench.action.reloadWindowWithExtensionsDisabled'); }); - this.addEventListener('disableExtensions', 'keydown', (e: KeyboardEvent) => { + this.addEventListener('extensionBugsLink', 'click', (e: Event) => { + const url = (e.target).innerText; + shell.openExternal(url); + }); + + this.addEventListener('disableExtensions', 'keydown', (e: Event) => { e.stopPropagation(); - if (e.keyCode === 13 || e.keyCode === 32) { + if ((e as KeyboardEvent).keyCode === 13 || (e as KeyboardEvent).keyCode === 32) { sendWorkbenchCommand('workbench.extensions.action.disableAll'); sendWorkbenchCommand('workbench.action.reloadWindow'); } @@ -1028,15 +1058,63 @@ export class IssueReporter extends Disposable { const matches = extensions.filter(extension => extension.id === selectedExtensionId); if (matches.length) { this.issueReporterModel.update({ selectedExtension: matches[0] }); + this.validateSelectedExtension(); const title = (this.getElementById('issue-title')).value; this.searchExtensionIssues(title); } else { this.issueReporterModel.update({ selectedExtension: undefined }); this.clearSearchResults(); + this.validateSelectedExtension(); } }); } + + this.addEventListener('problem-source', 'change', (_) => { + this.validateSelectedExtension(); + }); + } + + private validateSelectedExtension(): void { + const extensionValidationMessage = this.getElementById('extension-selection-validation-error')!; + const extensionValidationNoUrlsMessage = this.getElementById('extension-selection-validation-error-no-url')!; + hide(extensionValidationMessage); + hide(extensionValidationNoUrlsMessage); + + if (!this.issueReporterModel.getData().selectedExtension) { + this.previewButton.enabled = true; + return; + } + + const hasValidGitHubUrl = this.getExtensionGitHubUrl(); + if (hasValidGitHubUrl) { + this.previewButton.enabled = true; + } else { + this.setExtensionValidationMessage(); + this.previewButton.enabled = false; + } + } + + private setExtensionValidationMessage(): void { + const extensionValidationMessage = this.getElementById('extension-selection-validation-error')!; + const extensionValidationNoUrlsMessage = this.getElementById('extension-selection-validation-error-no-url')!; + const bugsUrl = this.getExtensionBugsUrl(); + if (bugsUrl) { + show(extensionValidationMessage); + const link = this.getElementById('extensionBugsLink')!; + link.textContent = bugsUrl; + return; + } + + const extensionUrl = this.getExtensionRepositoryUrl(); + if (extensionUrl) { + show(extensionValidationMessage); + const link = this.getElementById('extensionBugsLink'); + link!.textContent = extensionUrl; + return; + } + + show(extensionValidationNoUrlsMessage); } private updateProcessInfo(state: IssueReporterModelData) { @@ -1114,8 +1192,8 @@ export class IssueReporter extends Disposable { } } - private getElementById(elementId: string): HTMLElement | undefined { - const element = document.getElementById(elementId); + private getElementById(elementId: string): T | undefined { + const element = document.getElementById(elementId) as T | undefined; if (element) { return element; } else { diff --git a/src/vs/code/electron-browser/issue/issueReporterPage.ts b/src/vs/code/electron-browser/issue/issueReporterPage.ts index 63f42d9b960a8..5500cc46ac4e5 100644 --- a/src/vs/code/electron-browser/issue/issueReporterPage.ts +++ b/src/vs/code/electron-browser/issue/issueReporterPage.ts @@ -32,6 +32,11 @@ export default (): string => ` + + @@ -124,4 +129,4 @@ export default (): string => ` -`; \ No newline at end of file +`; diff --git a/src/vs/code/electron-browser/issue/media/issueReporter.css b/src/vs/code/electron-browser/issue/media/issueReporter.css index 78e41309e488a..eb4f53747a86b 100644 --- a/src/vs/code/electron-browser/issue/media/issueReporter.css +++ b/src/vs/code/electron-browser/issue/media/issueReporter.css @@ -251,16 +251,9 @@ a { text-decoration: none; } -.invalid-input { - border: 1px solid #be1100; -} - -.required-input, .validation-error { - color: #be1100; -} - .section .input-group .validation-error { - margin-left: 15%; + margin-left: calc(15% + 5px); + padding: 10px; } .section .inline-form-control, .section .inline-label { diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 1492e7710c10d..2e35f7c47a199 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -13,11 +13,11 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; import { ExtensionManagementChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; -import { IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { IExtensionManagementService, IExtensionGalleryService, IGlobalExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { ConfigurationService } from 'vs/platform/configuration/node/configurationService'; +import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; import { IRequestService } from 'vs/platform/request/common/request'; import { RequestService } from 'vs/platform/request/browser/requestService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -26,7 +26,6 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper import { TelemetryAppenderChannel } from 'vs/platform/telemetry/node/telemetryIpc'; import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService'; import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender'; -import { ActiveWindowManager } from 'vs/code/node/activeWindowTracker'; import { ipcRenderer } from 'electron'; import { ILogService, LogLevel, ILoggerService } from 'vs/platform/log/common/log'; import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc'; @@ -50,19 +49,24 @@ import { IFileService } from 'vs/platform/files/common/files'; import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider'; import { Schemas } from 'vs/base/common/network'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IUserDataSyncService, IUserDataSyncStoreService, ISettingsMergeService, registerConfiguration, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; -import { UserDataSyncService, UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService'; +import { IUserDataSyncService, IUserDataSyncStoreService, registerConfiguration, IUserDataSyncLogService, IUserDataSyncUtilService, ISettingsSyncService, IUserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSync'; +import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyncService'; import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService'; -import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; -import { SettingsMergeChannelClient } from 'vs/platform/userDataSync/common/settingsSyncIpc'; +import { UserDataSyncChannel, UserDataSyncUtilServiceClient, SettingsSyncChannel, UserDataAutoSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; import { IElectronService } from 'vs/platform/electron/node/electron'; import { LoggerService } from 'vs/platform/log/node/loggerService'; import { UserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSyncLog'; -import { IAuthTokenService } from 'vs/platform/auth/common/auth'; -import { AuthTokenService } from 'vs/platform/auth/electron-browser/authTokenService'; -import { AuthTokenChannel } from 'vs/platform/auth/common/authTokenIpc'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; +import { UserDataAutoSyncService } from 'vs/platform/userDataSync/electron-browser/userDataAutoSyncService'; +import { SettingsSynchroniser } from 'vs/platform/userDataSync/common/settingsSync'; +import { NativeStorageService } from 'vs/platform/storage/node/storageService'; +import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/storageIpc'; +import { IStorageService } from 'vs/platform/storage/common/storage'; +import { GlobalExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService'; +import { UserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSyncEnablementService'; +import { IAuthenticationTokenService, AuthenticationTokenService } from 'vs/platform/authentication/common/authentication'; +import { AuthenticationTokenServiceChannel } from 'vs/platform/authentication/common/authenticationIpc'; export interface ISharedProcessConfiguration { readonly machineId: string; @@ -102,7 +106,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat const onExit = () => disposables.dispose(); process.once('exit', onExit); - ipcRenderer.once('handshake:goodbye', onExit); + ipcRenderer.once('electron-main->shared-process: exit', onExit); disposables.add(server); @@ -114,10 +118,28 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat disposables.add(logService); logService.info('main', JSON.stringify(configuration)); - const configurationService = new ConfigurationService(environmentService.settingsResource); + const mainProcessService = new MainProcessService(server, mainRouter); + services.set(IMainProcessService, mainProcessService); + + // Files + const fileService = new FileService(logService); + services.set(IFileService, fileService); + disposables.add(fileService); + const diskFileSystemProvider = new DiskFileSystemProvider(logService); + disposables.add(diskFileSystemProvider); + fileService.registerProvider(Schemas.file, diskFileSystemProvider); + + // Configuration + const configurationService = new ConfigurationService(environmentService.settingsResource, fileService); disposables.add(configurationService); await configurationService.initialize(); + // Storage + const storageService = new NativeStorageService(new GlobalStorageDatabaseChannelClient(mainProcessService.getChannel('storage')), logService, environmentService); + await storageService.initialize(); + services.set(IStorageService, storageService); + disposables.add(toDisposable(() => storageService.flush())); + services.set(IEnvironmentService, environmentService); services.set(IProductService, { _serviceBrand: undefined, ...product }); services.set(ILogService, logService); @@ -125,24 +147,9 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat services.set(IRequestService, new SyncDescriptor(RequestService)); services.set(ILoggerService, new SyncDescriptor(LoggerService)); - const mainProcessService = new MainProcessService(server, mainRouter); - services.set(IMainProcessService, mainProcessService); - const electronService = createChannelSender(mainProcessService.getChannel('electron'), { context: configuration.windowId }); services.set(IElectronService, electronService); - const activeWindowManager = new ActiveWindowManager(electronService); - const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id)); - - // Files - const fileService = new FileService(logService); - services.set(IFileService, fileService); - disposables.add(fileService); - - const diskFileSystemProvider = new DiskFileSystemProvider(logService); - disposables.add(diskFileSystemProvider); - fileService.registerProvider(Schemas.file, diskFileSystemProvider); - services.set(IDownloadService, new SyncDescriptor(DownloadService)); const instantiationService = new InstantiationService(services); @@ -151,7 +158,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat instantiationService.invokeFunction(accessor => { const services = new ServiceCollection(); const environmentService = accessor.get(IEnvironmentService); - const { appRoot, extensionsPath, extensionDevelopmentLocationURI: extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService; + const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService; const telemetryLogService = new FollowerLogService(loggerClient, new SpdLogService('telemetry', environmentService.logsPath, initData.logLevel)); telemetryLogService.info('The below are logs for every telemetry event sent from VS Code once the log level is set to trace.'); telemetryLogService.info('==========================================================='); @@ -182,11 +189,13 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat services.set(IDiagnosticsService, new SyncDescriptor(DiagnosticsService)); services.set(ICredentialsService, new SyncDescriptor(KeytarCredentialsService)); - services.set(IAuthTokenService, new SyncDescriptor(AuthTokenService)); + services.set(IAuthenticationTokenService, new SyncDescriptor(AuthenticationTokenService)); services.set(IUserDataSyncLogService, new SyncDescriptor(UserDataSyncLogService)); - const settingsMergeChannel = server.getChannel('settingsMerge', activeWindowRouter); - services.set(ISettingsMergeService, new SettingsMergeChannelClient(settingsMergeChannel)); + services.set(IUserDataSyncUtilService, new UserDataSyncUtilServiceClient(server.getChannel('userDataSyncUtil', client => client.ctx !== 'main'))); + services.set(IGlobalExtensionEnablementService, new SyncDescriptor(GlobalExtensionEnablementService)); services.set(IUserDataSyncStoreService, new SyncDescriptor(UserDataSyncStoreService)); + services.set(IUserDataSyncEnablementService, new SyncDescriptor(UserDataSyncEnablementService)); + services.set(ISettingsSyncService, new SyncDescriptor(SettingsSynchroniser)); services.set(IUserDataSyncService, new SyncDescriptor(UserDataSyncService)); registerConfiguration(); @@ -206,14 +215,22 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat const diagnosticsChannel = new DiagnosticsChannel(diagnosticsService); server.registerChannel('diagnostics', diagnosticsChannel); - const authTokenService = accessor.get(IAuthTokenService); - const authTokenChannel = new AuthTokenChannel(authTokenService); + const authTokenService = accessor.get(IAuthenticationTokenService); + const authTokenChannel = new AuthenticationTokenServiceChannel(authTokenService); server.registerChannel('authToken', authTokenChannel); + const settingsSyncService = accessor.get(ISettingsSyncService); + const settingsSyncChannel = new SettingsSyncChannel(settingsSyncService); + server.registerChannel('settingsSync', settingsSyncChannel); + const userDataSyncService = accessor.get(IUserDataSyncService); const userDataSyncChannel = new UserDataSyncChannel(userDataSyncService); server.registerChannel('userDataSync', userDataSyncChannel); + const userDataAutoSync = instantiationService2.createInstance(UserDataAutoSyncService); + const userDataAutoSyncChannel = new UserDataAutoSyncChannel(userDataAutoSync); + server.registerChannel('userDataAutoSync', userDataAutoSyncChannel); + // clean up deprecated extensions (extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions(); // update localizations cache @@ -224,7 +241,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat instantiationService2.createInstance(LanguagePackCachedDataCleaner), instantiationService2.createInstance(StorageDataCleaner), instantiationService2.createInstance(LogsDataCleaner), - instantiationService2.createInstance(UserDataAutoSync) + userDataAutoSync )); disposables.add(extensionManagementService as ExtensionManagementService); }); @@ -266,13 +283,20 @@ function setupIPC(hook: string): Promise { } async function handshake(configuration: ISharedProcessConfiguration): Promise { + + // receive payload from electron-main to start things const data = await new Promise(c => { - ipcRenderer.once('handshake:hey there', (_: any, r: ISharedProcessInitData) => c(r)); - ipcRenderer.send('handshake:hello'); + ipcRenderer.once('electron-main->shared-process: payload', (_: any, r: ISharedProcessInitData) => c(r)); + + // tell electron-main we are ready to receive payload + ipcRenderer.send('shared-process->electron-main: ready-for-payload'); }); + // await IPC connection and signal this back to electron-main const server = await setupIPC(data.sharedIPCHandle); + ipcRenderer.send('shared-process->electron-main: ipc-ready'); + // await initialization and signal this back to electron-main await main(server, data, configuration); - ipcRenderer.send('handshake:im ready'); + ipcRenderer.send('shared-process->electron-main: init-done'); } diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index e8afc9c7217c9..f6966b2772c88 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -55,7 +55,7 @@ import { MenubarMainService } from 'vs/platform/menubar/electron-main/menubarMai import { RunOnceScheduler } from 'vs/base/common/async'; import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu'; import { homedir } from 'os'; -import { join, sep } from 'vs/base/common/path'; +import { join, sep, posix } from 'vs/base/common/path'; import { localize } from 'vs/nls'; import { Schemas } from 'vs/base/common/network'; import { SnapUpdateService } from 'vs/platform/update/electron-main/updateService.snap'; @@ -70,9 +70,6 @@ import { WorkspacesMainService, IWorkspacesMainService } from 'vs/platform/works import { statSync } from 'fs'; import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsIpc'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; -import { FileService } from 'vs/platform/files/common/fileService'; -import { IFileService } from 'vs/platform/files/common/files'; -import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc'; import { IElectronMainService, ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService'; import { ISharedProcessMainService, SharedProcessMainService } from 'vs/platform/ipc/electron-main/sharedProcessMainService'; @@ -171,7 +168,7 @@ export class CodeApplication extends Disposable { app.on('web-contents-created', (_event: Event, contents) => { contents.on('will-attach-webview', (event: Event, webPreferences, params) => { - const isValidWebviewSource = (source: string): boolean => { + const isValidWebviewSource = (source: string | undefined): boolean => { if (!source) { return false; } @@ -191,11 +188,12 @@ export class CodeApplication extends Disposable { webPreferences.nodeIntegration = false; // Verify URLs being loaded - if (isValidWebviewSource(params.src) && isValidWebviewSource(webPreferences.preloadURL)) { + // https://github.com/electron/electron/issues/21553 + if (isValidWebviewSource(params.src) && isValidWebviewSource((webPreferences as { preloadURL: string }).preloadURL)) { return; } - delete webPreferences.preloadUrl; + delete (webPreferences as { preloadURL: string }).preloadURL; // https://github.com/electron/electron/issues/21553 // Otherwise prevent loading this.logService.error('webContents#web-contents-created: Prevented webview attach'); @@ -363,7 +361,14 @@ export class CodeApplication extends Disposable { // Spawn shared process after the first window has opened and 3s have passed const sharedProcess = this.instantiationService.createInstance(SharedProcess, machineId, this.userEnv); - const sharedProcessClient = sharedProcess.whenReady().then(() => connect(this.environmentService.sharedIPCHandle, 'main')); + const sharedProcessClient = sharedProcess.whenIpcReady().then(() => { + this.logService.trace('Shared process: IPC ready'); + return connect(this.environmentService.sharedIPCHandle, 'main'); + }); + const sharedProcessReady = sharedProcess.whenReady().then(() => { + this.logService.trace('Shared process: init ready'); + return sharedProcessClient; + }); this.lifecycleMainService.when(LifecycleMainPhase.AfterWindowOpen).then(() => { this._register(new RunOnceScheduler(async () => { const userEnv = await getShellEnvironment(this.logService, this.environmentService); @@ -373,7 +378,7 @@ export class CodeApplication extends Disposable { }); // Services - const appInstantiationService = await this.createServices(machineId, trueMachineId, sharedProcess, sharedProcessClient); + const appInstantiationService = await this.createServices(machineId, trueMachineId, sharedProcess, sharedProcessReady); // Create driver if (this.environmentService.driverHandle) { @@ -390,7 +395,7 @@ export class CodeApplication extends Disposable { const windows = appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor, electronIpcServer, sharedProcessClient)); // Post Open Windows Tasks - this.afterWindowOpen(); + appInstantiationService.invokeFunction(this.afterWindowOpen.bind(this)); // Tracing: Stop tracing after windows are ready if enabled if (this.environmentService.args.trace) { @@ -423,15 +428,9 @@ export class CodeApplication extends Disposable { return { machineId, trueMachineId }; } - private async createServices(machineId: string, trueMachineId: string | undefined, sharedProcess: SharedProcess, sharedProcessClient: Promise>): Promise { + private async createServices(machineId: string, trueMachineId: string | undefined, sharedProcess: SharedProcess, sharedProcessReady: Promise>): Promise { const services = new ServiceCollection(); - const fileService = this._register(new FileService(this.logService)); - services.set(IFileService, fileService); - - const diskFileSystemProvider = this._register(new DiskFileSystemProvider(this.logService)); - fileService.registerProvider(Schemas.file, diskFileSystemProvider); - switch (process.platform) { case 'win32': services.set(IUpdateService, new SyncDescriptor(Win32UpdateService)); @@ -455,7 +454,7 @@ export class CodeApplication extends Disposable { services.set(ISharedProcessMainService, new SyncDescriptor(SharedProcessMainService, [sharedProcess])); services.set(ILaunchMainService, new SyncDescriptor(LaunchMainService)); - const diagnosticsChannel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('diagnostics'))); + const diagnosticsChannel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics'))); services.set(IDiagnosticsService, new SyncDescriptor(DiagnosticsService, [diagnosticsChannel])); services.set(IIssueService, new SyncDescriptor(IssueMainService, [machineId, this.userEnv])); @@ -476,7 +475,7 @@ export class CodeApplication extends Disposable { // Telemetry if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) { - const channel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('telemetryAppender'))); + const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender'))); const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService)); const commonProperties = resolveCommonProperties(product.commit, product.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath); const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot]; @@ -497,27 +496,27 @@ export class CodeApplication extends Disposable { this.logService.info(`Tracing: waiting for windows to get ready...`); let recordingStopped = false; - const stopRecording = (timeout: boolean) => { + const stopRecording = async (timeout: boolean) => { if (recordingStopped) { return; } recordingStopped = true; // only once - contentTracing.stopRecording(join(homedir(), `${product.applicationName}-${Math.random().toString(16).slice(-4)}.trace.txt`), path => { - if (!timeout) { - if (this.dialogMainService) { - this.dialogMainService.showMessageBox({ - type: 'info', - message: localize('trace.message', "Successfully created trace."), - detail: localize('trace.detail', "Please create an issue and manually attach the following file:\n{0}", path), - buttons: [localize('trace.ok', "Ok")] - }, withNullAsUndefined(BrowserWindow.getFocusedWindow())); - } - } else { - this.logService.info(`Tracing: data recorded (after 30s timeout) to ${path}`); + const path = await contentTracing.stopRecording(join(homedir(), `${product.applicationName}-${Math.random().toString(16).slice(-4)}.trace.txt`)); + + if (!timeout) { + if (this.dialogMainService) { + this.dialogMainService.showMessageBox({ + type: 'info', + message: localize('trace.message', "Successfully created trace."), + detail: localize('trace.detail', "Please create an issue and manually attach the following file:\n{0}", path), + buttons: [localize('trace.ok', "Ok")] + }, withNullAsUndefined(BrowserWindow.getFocusedWindow())); } - }); + } else { + this.logService.info(`Tracing: data recorded (after 30s timeout) to ${path}`); + } }; // Wait up to 30s before creating the trace anyways @@ -570,6 +569,7 @@ export class CodeApplication extends Disposable { const storageMainService = accessor.get(IStorageMainService); const storageChannel = this._register(new GlobalStorageDatabaseChannel(this.logService, storageMainService)); electronIpcServer.registerChannel('storage', storageChannel); + sharedProcessClient.then(client => client.registerChannel('storage', storageChannel)); const loggerChannel = new LoggerChannel(accessor.get(ILogService)); electronIpcServer.registerChannel('logger', loggerChannel); @@ -591,16 +591,42 @@ export class CodeApplication extends Disposable { urlService.registerHandler({ async handleURL(uri: URI, options?: IOpenURLOptions): Promise { - // Catch file URLs - if (uri.authority === Schemas.file && !!uri.path) { + // Catch file/remote URLs + if ((uri.authority === Schemas.file || uri.authority === Schemas.vscodeRemote) && !!uri.path) { const cli = assign(Object.create(null), environmentService.args); + const urisToOpen: IWindowOpenable[] = []; - // hey Ben, we need to convert this `code://file` URI into a `file://` URI - const urisToOpen = [{ fileUri: URI.file(uri.fsPath) }]; + // File path + if (uri.authority === Schemas.file) { + // we configure as fileUri, but later validation will + // make sure to open as folder or workspace if possible + urisToOpen.push({ fileUri: URI.file(uri.fsPath) }); + } + + // Remote path + else { + // Example conversion: + // From: vscode://vscode-remote/wsl+ubuntu/mnt/c/GitDevelopment/monaco + // To: vscode-remote://wsl+ubuntu/mnt/c/GitDevelopment/monaco + const secondSlash = uri.path.indexOf(posix.sep, 1 /* skip over the leading slash */); + if (secondSlash !== -1) { + const authority = uri.path.substring(1, secondSlash); + const path = uri.path.substring(secondSlash); + const remoteUri = URI.from({ scheme: Schemas.vscodeRemote, authority, path, query: uri.query, fragment: uri.fragment }); + + if (hasWorkspaceFileExtension(path)) { + urisToOpen.push({ workspaceUri: remoteUri }); + } else { + urisToOpen.push({ folderUri: remoteUri }); + } + } + } - windowsMainService.open({ context: OpenContext.API, cli, urisToOpen, gotoLineMode: true }); + if (urisToOpen.length > 0) { + windowsMainService.open({ context: OpenContext.API, cli, urisToOpen, gotoLineMode: true }); - return true; + return true; + } } return false; @@ -639,7 +665,7 @@ export class CodeApplication extends Disposable { // Watch Electron URLs and forward them to the UrlService const args = this.environmentService.args; const urls = args['open-url'] ? args._urls : []; - const urlListener = new ElectronURLListener(urls || [], urlService, windowsMainService); + const urlListener = new ElectronURLListener(urls || [], urlService, windowsMainService, this.environmentService); this._register(urlListener); // Open our first window @@ -651,8 +677,8 @@ export class CodeApplication extends Disposable { const noRecentEntry = args['skip-add-to-recently-opened'] === true; const waitMarkerFileURI = args.wait && args.waitMarkerFilePath ? URI.file(args.waitMarkerFilePath) : undefined; - // new window if "-n" was used without paths - if (args['new-window'] && !hasCliArgs && !hasFolderURIs && !hasFileURIs) { + // new window if "-n" or "--remote" was used without paths + if ((args['new-window'] || args.remote) && !hasCliArgs && !hasFolderURIs && !hasFileURIs) { return windowsMainService.open({ context, cli: args, @@ -707,13 +733,18 @@ export class CodeApplication extends Disposable { return { fileUri: URI.file(path) }; } - private afterWindowOpen(): void { - + private afterWindowOpen(accessor: ServicesAccessor): void { // Signal phase: after window open this.lifecycleMainService.phase = LifecycleMainPhase.AfterWindowOpen; // Remote Authorities this.handleRemoteAuthorities(); + + // Initialize update service + const updateService = accessor.get(IUpdateService); + if (updateService instanceof Win32UpdateService || updateService instanceof LinuxUpdateService || updateService instanceof DarwinUpdateService) { + updateService.initialize(); + } } private handleRemoteAuthorities(): void { diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index bb05eddc6ce4f..7871c40dc5940 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -26,7 +26,7 @@ import { IStateService } from 'vs/platform/state/node/state'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { EnvironmentService, xdgRuntimeDir } from 'vs/platform/environment/node/environmentService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { ConfigurationService } from 'vs/platform/configuration/node/configurationService'; +import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; import { IRequestService } from 'vs/platform/request/common/request'; import { RequestMainService } from 'vs/platform/request/electron-main/requestMainService'; import * as fs from 'fs'; @@ -42,6 +42,10 @@ import { once } from 'vs/base/common/functional'; import { ISignService } from 'vs/platform/sign/common/sign'; import { SignService } from 'vs/platform/sign/node/signService'; import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsIpc'; +import { FileService } from 'vs/platform/files/common/fileService'; +import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; +import { Schemas } from 'vs/base/common/network'; +import { IFileService } from 'vs/platform/files/common/files'; class ExpectedError extends Error { readonly isExpected = true; @@ -118,12 +122,16 @@ class CodeMain { const environmentService = accessor.get(IEnvironmentService); const logService = accessor.get(ILogService); const lifecycleMainService = accessor.get(ILifecycleMainService); + const fileService = accessor.get(IFileService); const configurationService = accessor.get(IConfigurationService); const mainIpcServer = await this.doStartup(logService, environmentService, lifecycleMainService, instantiationService, true); bufferLogService.logger = new SpdLogService('main', environmentService.logsPath, bufferLogService.getLevel()); - once(lifecycleMainService.onWillShutdown)(() => (configurationService as ConfigurationService).dispose()); + once(lifecycleMainService.onWillShutdown)(() => { + fileService.dispose(); + (configurationService as ConfigurationService).dispose(); + }); return instantiationService.createInstance(CodeApplication, mainIpcServer, instanceEnvironment).startup(); }); @@ -143,7 +151,12 @@ class CodeMain { process.once('exit', () => logService.dispose()); services.set(ILogService, logService); - services.set(IConfigurationService, new ConfigurationService(environmentService.settingsResource)); + const fileService = new FileService(logService); + services.set(IFileService, fileService); + const diskFileSystemProvider = new DiskFileSystemProvider(logService); + fileService.registerProvider(Schemas.file, diskFileSystemProvider); + + services.set(IConfigurationService, new ConfigurationService(environmentService.settingsResource, fileService)); services.set(ILifecycleMainService, new SyncDescriptor(LifecycleMainService)); services.set(IStateService, new SyncDescriptor(StateService)); services.set(IRequestService, new SyncDescriptor(RequestMainService)); diff --git a/src/vs/code/electron-main/sharedProcess.ts b/src/vs/code/electron-main/sharedProcess.ts index fc716c82be1c5..2ad547190cd90 100644 --- a/src/vs/code/electron-main/sharedProcess.ts +++ b/src/vs/code/electron-main/sharedProcess.ts @@ -21,6 +21,8 @@ export class SharedProcess implements ISharedProcess { private window: BrowserWindow | null = null; + private readonly _whenReady: Promise; + constructor( private readonly machineId: string, private userEnv: NodeJS.ProcessEnv, @@ -28,10 +30,13 @@ export class SharedProcess implements ISharedProcess { @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @ILogService private readonly logService: ILogService, @IThemeMainService private readonly themeMainService: IThemeMainService - ) { } + ) { + // overall ready promise when shared process signals initialization is done + this._whenReady = new Promise(c => ipcMain.once('shared-process->electron-main: init-done', () => c(undefined))); + } @memoize - private get _whenReady(): Promise { + private get _whenIpcReady(): Promise { this.window = new BrowserWindow({ show: false, backgroundColor: this.themeMainService.getBackgroundColor(), @@ -98,16 +103,19 @@ export class SharedProcess implements ISharedProcess { }); return new Promise(c => { - const onHello = Event.once(Event.fromNodeEventEmitter(ipcMain, 'handshake:hello', ({ sender }: { sender: WebContents }) => sender)); - disposables.add(onHello(sender => { - sender.send('handshake:hey there', { + // send payload once shared process is ready to receive it + disposables.add(Event.once(Event.fromNodeEventEmitter(ipcMain, 'shared-process->electron-main: ready-for-payload', ({ sender }: { sender: WebContents }) => sender))(sender => { + sender.send('electron-main->shared-process: payload', { sharedIPCHandle: this.environmentService.sharedIPCHandle, args: this.environmentService.args, logLevel: this.logService.getLevel() }); - disposables.add(toDisposable(() => sender.send('handshake:goodbye'))); - ipcMain.once('handshake:im ready', () => c(undefined)); + // signal exit to shared process when we get disposed + disposables.add(toDisposable(() => sender.send('electron-main->shared-process: exit'))); + + // complete IPC-ready promise when shared process signals this to us + ipcMain.once('shared-process->electron-main: ipc-ready', () => c(undefined)); })); }); } @@ -122,6 +130,11 @@ export class SharedProcess implements ISharedProcess { await this._whenReady; } + async whenIpcReady(): Promise { + await this.barrier.wait(); + await this._whenIpcReady; + } + toggle(): void { if (!this.window || this.window.isVisible()) { this.hide(); diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index b55f4095e3b82..1f1c08a58f132 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -8,7 +8,7 @@ import * as objects from 'vs/base/common/objects'; import * as nls from 'vs/nls'; import { Event as CommonEvent, Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; -import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment } from 'electron'; +import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment, nativeTheme } from 'electron'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -31,6 +31,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs'; import { mnemonicButtonLabel } from 'vs/base/common/labels'; +import { ThemeIcon } from 'vs/platform/theme/common/themeService'; const RUN_TEXTMATE_IN_WORKER = false; @@ -113,6 +114,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Load window state const [state, hasMultipleDisplays] = this.restoreWindowState(config.state); this.windowState = state; + this.logService.trace('window#ctor: using window state', state); // in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below) const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen); @@ -128,19 +130,19 @@ export class CodeWindow extends Disposable implements ICodeWindow { show: !isFullscreenOrMaximized, title: product.nameLong, webPreferences: { - // By default if Code is in the background, intervals and timeouts get throttled, so we - // want to enforce that Code stays in the foreground. This triggers a disable_hidden_ - // flag that Electron provides via patch: - // https://github.com/electron/libchromiumcontent/blob/master/patches/common/chromium/disable_hidden.patch - backgroundThrottling: false, nodeIntegration: true, nodeIntegrationInWorker: RUN_TEXTMATE_IN_WORKER, webviewTag: true } }; + // Apply icon to window + // Linux: always + // Windows: only when running out of sources, otherwise an icon is set by us on the executable if (isLinux) { - options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s) + options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); + } else if (isWindows && !this.environmentService.isBuilt) { + options.icon = path.join(this.environmentService.appRoot, 'resources/win32/code_150x150.png'); } const windowConfig = this.configurationService.getValue('window'); @@ -345,9 +347,9 @@ export class CodeWindow extends Disposable implements ICodeWindow { }); this._win.webContents.session.webRequest.onHeadersReceived(null!, (details, callback) => { - const responseHeaders = details.responseHeaders as { [key: string]: string[] }; + const responseHeaders = details.responseHeaders as Record; - const contentType: string[] = (responseHeaders['content-type'] || responseHeaders['Content-Type']); + const contentType = (responseHeaders['content-type'] || responseHeaders['Content-Type']); if (contentType && Array.isArray(contentType) && contentType.some(x => x.toLowerCase().indexOf('image/svg') >= 0)) { return callback({ cancel: true }); } @@ -438,15 +440,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Inject headers when requests are incoming const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*']; - this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, (details, cb) => { - this.marketplaceHeadersPromise.then(headers => { - const requestHeaders = objects.assign(details.requestHeaders, headers) as { [key: string]: string | undefined }; - if (!this.configurationService.getValue('extensions.disableExperimentalAzureSearch')) { - requestHeaders['Cookie'] = `${requestHeaders['Cookie'] ? requestHeaders['Cookie'] + ';' : ''}EnableExternalSearchForVSCode=true`; - } - cb({ cancel: false, requestHeaders }); - }); - }); + this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, (details, cb) => + this.marketplaceHeadersPromise.then(headers => cb({ cancel: false, requestHeaders: objects.assign(details.requestHeaders, headers) as Record }))); } private onWindowError(error: WindowError): void { @@ -653,7 +648,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { if (windowConfig?.autoDetectHighContrast === false) { autoDetectHighContrast = false; } - windowConfiguration.highContrast = isWindows && autoDetectHighContrast && systemPreferences.isInvertedColorScheme(); + windowConfiguration.highContrast = isWindows && autoDetectHighContrast && nativeTheme.shouldUseInvertedColorScheme; windowConfiguration.accessibilitySupport = app.accessibilitySupportEnabled; // Title style related @@ -778,45 +773,79 @@ export class CodeWindow extends Disposable implements ICodeWindow { } private validateWindowState(state: IWindowState, displays: Display[]): IWindowState | undefined { + this.logService.trace(`window#validateWindowState: validating window state on ${displays.length} display(s)`, state); + if (typeof state.x !== 'number' || typeof state.y !== 'number' || typeof state.width !== 'number' || typeof state.height !== 'number' ) { + this.logService.trace('window#validateWindowState: unexpected type of state values'); return undefined; } if (state.width <= 0 || state.height <= 0) { + this.logService.trace('window#validateWindowState: unexpected negative values'); return undefined; } // Single Monitor: be strict about x/y positioning + // macOS & Linux: these OS seem to be pretty good in ensuring that a window is never outside of it's bounds. + // Windows: it is possible to have a window with a size that makes it fall out of the window. our strategy + // is to try as much as possible to keep the window in the monitor bounds. we are not as strict as + // macOS and Linux and allow the window to exceed the monitor bounds as long as the window is still + // some pixels (128) visible on the screen for the user to drag it back. if (displays.length === 1) { const displayWorkingArea = this.getWorkingArea(displays[0]); if (displayWorkingArea) { - if (state.x < displayWorkingArea.x) { - state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the left - } + this.logService.trace('window#validateWindowState: 1 monitor working area', displayWorkingArea); - if (state.y < displayWorkingArea.y) { - state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the top - } + function ensureStateInDisplayWorkingArea(): void { + if (!state || typeof state.x !== 'number' || typeof state.y !== 'number' || !displayWorkingArea) { + return; + } - if (state.x > (displayWorkingArea.x + displayWorkingArea.width)) { - state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the right - } + if (state.x < displayWorkingArea.x) { + // prevent window from falling out of the screen to the left + state.x = displayWorkingArea.x; + } - if (state.y > (displayWorkingArea.y + displayWorkingArea.height)) { - state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the bottom + if (state.y < displayWorkingArea.y) { + // prevent window from falling out of the screen to the top + state.y = displayWorkingArea.y; + } } + // ensure state is not outside display working area (top, left) + ensureStateInDisplayWorkingArea(); + if (state.width > displayWorkingArea.width) { - state.width = displayWorkingArea.width; // prevent window from exceeding display bounds width + // prevent window from exceeding display bounds width + state.width = displayWorkingArea.width; } if (state.height > displayWorkingArea.height) { - state.height = displayWorkingArea.height; // prevent window from exceeding display bounds height + // prevent window from exceeding display bounds height + state.height = displayWorkingArea.height; } + + if (state.x > (displayWorkingArea.x + displayWorkingArea.width - 128)) { + // prevent window from falling out of the screen to the right with + // 128px margin by positioning the window to the far right edge of + // the screen + state.x = displayWorkingArea.x + displayWorkingArea.width - state.width; + } + + if (state.y > (displayWorkingArea.y + displayWorkingArea.height - 128)) { + // prevent window from falling out of the screen to the bottom with + // 128px margin by positioning the window to the far bottom edge of + // the screen + state.y = displayWorkingArea.y + displayWorkingArea.height - state.height; + } + + // again ensure state is not outside display working area + // (it may have changed from the previous validation step) + ensureStateInDisplayWorkingArea(); } return state; @@ -826,6 +855,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { if (state.display && state.mode === WindowMode.Fullscreen) { const display = displays.filter(d => d.id === state.display)[0]; if (display && typeof display.bounds?.x === 'number' && typeof display.bounds?.y === 'number') { + this.logService.trace('window#validateWindowState: restoring fullscreen to previous display'); + const defaults = defaultWindowState(WindowMode.Fullscreen); // make sure we have good values when the user restores the window defaults.x = display.bounds.x; // carefull to use displays x/y position so that the window ends up on the correct monitor defaults.y = display.bounds.y; @@ -834,18 +865,19 @@ export class CodeWindow extends Disposable implements ICodeWindow { } } - // Multi Monitor (non-fullscreen): be less strict because metrics can be crazy - const bounds = { x: state.x, y: state.y, width: state.width, height: state.height }; - const display = screen.getDisplayMatching(bounds); + // Multi Monitor (non-fullscreen): ensure window is within display bounds + const display = screen.getDisplayMatching({ x: state.x, y: state.y, width: state.width, height: state.height }); const displayWorkingArea = this.getWorkingArea(display); if ( display && // we have a display matching the desired bounds displayWorkingArea && // we have valid working area bounds - bounds.x < displayWorkingArea.x + displayWorkingArea.width && // prevent window from falling out of the screen to the right - bounds.y < displayWorkingArea.y + displayWorkingArea.height && // prevent window from falling out of the screen to the bottom - bounds.x + bounds.width > displayWorkingArea.x && // prevent window from falling out of the screen to the left - bounds.y + bounds.height > displayWorkingArea.y // prevent window from falling out of the scree nto the top + state.x + state.width > displayWorkingArea.x && // prevent window from falling out of the screen to the left + state.y + state.height > displayWorkingArea.y && // prevent window from falling out of the screen to the top + state.x < displayWorkingArea.x + displayWorkingArea.width && // prevent window from falling out of the screen to the right + state.y < displayWorkingArea.y + displayWorkingArea.height // prevent window from falling out of the screen to the bottom ) { + this.logService.trace('window#validateWindowState: multi-monitor working area', displayWorkingArea); + return state; } @@ -975,22 +1007,22 @@ export class CodeWindow extends Disposable implements ICodeWindow { switch (visibility) { case ('default'): this._win.setMenuBarVisibility(!isFullscreen); - this._win.setAutoHideMenuBar(isFullscreen); + this._win.autoHideMenuBar = isFullscreen; break; case ('visible'): this._win.setMenuBarVisibility(true); - this._win.setAutoHideMenuBar(false); + this._win.autoHideMenuBar = false; break; case ('toggle'): this._win.setMenuBarVisibility(false); - this._win.setAutoHideMenuBar(true); + this._win.autoHideMenuBar = true; break; case ('hidden'): this._win.setMenuBarVisibility(false); - this._win.setAutoHideMenuBar(false); + this._win.autoHideMenuBar = false; break; } } @@ -1096,8 +1128,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { private createTouchBarGroupSegments(items: ISerializableCommandAction[] = []): ITouchBarSegment[] { const segments: ITouchBarSegment[] = items.map(item => { let icon: NativeImage | undefined; - if (item.iconLocation && item.iconLocation.dark.scheme === 'file') { - icon = nativeImage.createFromPath(URI.revive(item.iconLocation.dark).fsPath); + if (item.icon && !ThemeIcon.isThemeIcon(item.icon) && item.icon?.dark?.scheme === 'file') { + icon = nativeImage.createFromPath(URI.revive(item.icon.dark).fsPath); if (icon.isEmpty()) { icon = undefined; } diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index 5a6c573b36db0..609395b535aa3 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -14,10 +14,10 @@ import product from 'vs/platform/product/common/product'; import * as paths from 'vs/base/common/path'; import { whenDeleted, writeFileSync } from 'vs/base/node/pfs'; import { findFreePort, randomPort } from 'vs/base/node/ports'; -import { resolveTerminalEncoding } from 'vs/base/node/encoding'; import { isWindows, isLinux } from 'vs/base/common/platform'; import { ProfilingSession, Target } from 'v8-inspect-profiler'; import { isString } from 'vs/base/common/types'; +import { hasStdinWithoutTty, stdinDataListener, getStdinFilePath, readFromStdin } from 'vs/platform/environment/node/stdin'; function shouldSpawnCliProcess(argv: ParsedArgs): boolean { return !!argv['install-source'] @@ -142,91 +142,55 @@ export async function main(argv: string[]): Promise { }); } - let stdinWithoutTty: boolean = false; - try { - stdinWithoutTty = !process.stdin.isTTY; // Via https://twitter.com/MylesBorins/status/782009479382626304 - } catch (error) { - // Windows workaround for https://github.com/nodejs/node/issues/11656 - } - - const readFromStdin = args._.some(a => a === '-'); - if (readFromStdin) { + const hasReadStdinArg = args._.some(a => a === '-'); + if (hasReadStdinArg) { // remove the "-" argument when we read from stdin args._ = args._.filter(a => a !== '-'); argv = argv.filter(a => a !== '-'); } - let stdinFilePath: string; - if (stdinWithoutTty) { + let stdinFilePath: string | undefined; + if (hasStdinWithoutTty()) { // Read from stdin: we require a single "-" argument to be passed in order to start reading from // stdin. We do this because there is no reliable way to find out if data is piped to stdin. Just // checking for stdin being connected to a TTY is not enough (https://github.com/Microsoft/vscode/issues/40351) - if (args._.length === 0 && readFromStdin) { - - // prepare temp file to read stdin to - stdinFilePath = paths.join(os.tmpdir(), `code-stdin-${Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 3)}.txt`); - // open tmp file for writing - let stdinFileError: Error | undefined; - let stdinFileStream: fs.WriteStream; - try { - stdinFileStream = fs.createWriteStream(stdinFilePath); - } catch (error) { - stdinFileError = error; - } + if (args._.length === 0) { + if (hasReadStdinArg) { + stdinFilePath = getStdinFilePath(); - if (!stdinFileError) { + // returns a file path where stdin input is written into (write in progress). + try { + readFromStdin(stdinFilePath, !!verbose); // throws error if file can not be written - // Pipe into tmp file using terminals encoding - resolveTerminalEncoding(verbose).then(async encoding => { - const iconv = await import('iconv-lite'); - const converterStream = iconv.decodeStream(encoding); - process.stdin.pipe(converterStream).pipe(stdinFileStream); - }); + // Make sure to open tmp file + addArg(argv, stdinFilePath); - // Make sure to open tmp file - addArg(argv, stdinFilePath); - - // Enable --wait to get all data and ignore adding this to history - addArg(argv, '--wait'); - addArg(argv, '--skip-add-to-recently-opened'); - args.wait = true; - } + // Enable --wait to get all data and ignore adding this to history + addArg(argv, '--wait'); + addArg(argv, '--skip-add-to-recently-opened'); + args.wait = true; - if (verbose) { - if (stdinFileError) { - console.error(`Failed to create file to read via stdin: ${stdinFileError.toString()}`); - } else { console.log(`Reading from stdin via: ${stdinFilePath}`); + } catch (e) { + console.log(`Failed to create file to read via stdin: ${e.toString()}`); + stdinFilePath = undefined; } - } - } - - // If the user pipes data via stdin but forgot to add the "-" argument, help by printing a message - // if we detect that data flows into via stdin after a certain timeout. - else if (args._.length === 0) { - processCallbacks.push(child => new Promise(c => { - const dataListener = () => { - if (isWindows) { - console.log(`Run with '${product.applicationName} -' to read output from another program (e.g. 'echo Hello World | ${product.applicationName} -').`); - } else { - console.log(`Run with '${product.applicationName} -' to read from stdin (e.g. 'ps aux | grep code | ${product.applicationName} -').`); + } else { + + // If the user pipes data via stdin but forgot to add the "-" argument, help by printing a message + // if we detect that data flows into via stdin after a certain timeout. + processCallbacks.push(_ => stdinDataListener(1000).then(dataReceived => { + if (dataReceived) { + if (isWindows) { + console.log(`Run with '${product.applicationName} -' to read output from another program (e.g. 'echo Hello World | ${product.applicationName} -').`); + } else { + console.log(`Run with '${product.applicationName} -' to read from stdin (e.g. 'ps aux | grep code | ${product.applicationName} -').`); + } } - - c(undefined); - }; - - // wait for 1s maximum... - setTimeout(() => { - process.stdin.removeListener('data', dataListener); - - c(undefined); - }, 1000); - - // ...but finish early if we detect data - process.stdin.once('data', dataListener); - })); + })); + } } } diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 2ba0de50620d2..9c82546995f1d 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -24,7 +24,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper import { IRequestService } from 'vs/platform/request/common/request'; import { RequestService } from 'vs/platform/request/node/requestService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { ConfigurationService } from 'vs/platform/configuration/node/configurationService'; +import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender'; import { mkdirp, writeFile } from 'vs/base/node/pfs'; import { getBaseLabel } from 'vs/base/common/labels'; @@ -306,16 +306,6 @@ export async function main(argv: ParsedArgs): Promise { await Promise.all([environmentService.appSettingsHome.fsPath, environmentService.extensionsPath] .map((path): undefined | Promise => path ? mkdirp(path) : undefined)); - const configurationService = new ConfigurationService(environmentService.settingsResource); - disposables.add(configurationService); - await configurationService.initialize(); - - services.set(IEnvironmentService, environmentService); - services.set(ILogService, logService); - services.set(IConfigurationService, configurationService); - services.set(IStateService, new SyncDescriptor(StateService)); - services.set(IProductService, { _serviceBrand: undefined, ...product }); - // Files const fileService = new FileService(logService); disposables.add(fileService); @@ -325,13 +315,23 @@ export async function main(argv: ParsedArgs): Promise { disposables.add(diskFileSystemProvider); fileService.registerProvider(Schemas.file, diskFileSystemProvider); + const configurationService = new ConfigurationService(environmentService.settingsResource, fileService); + disposables.add(configurationService); + await configurationService.initialize(); + + services.set(IEnvironmentService, environmentService); + services.set(ILogService, logService); + services.set(IConfigurationService, configurationService); + services.set(IStateService, new SyncDescriptor(StateService)); + services.set(IProductService, { _serviceBrand: undefined, ...product }); + const instantiationService: IInstantiationService = new InstantiationService(services); return instantiationService.invokeFunction(async accessor => { const envService = accessor.get(IEnvironmentService); const stateService = accessor.get(IStateService); - const { appRoot, extensionsPath, extensionDevelopmentLocationURI: extensionDevelopmentLocationURI, isBuilt, installSourcePath } = envService; + const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = envService; const services = new ServiceCollection(); diff --git a/src/vs/code/test/electron-main/windowsStateStorage.test.ts b/src/vs/code/test/electron-main/windowsStateStorage.test.ts index 6094456c6f59c..419caee0d71af 100644 --- a/src/vs/code/test/electron-main/windowsStateStorage.test.ts +++ b/src/vs/code/test/electron-main/windowsStateStorage.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import * as os from 'os'; import * as path from 'vs/base/common/path'; diff --git a/src/vs/editor/browser/config/charWidthReader.ts b/src/vs/editor/browser/config/charWidthReader.ts index 21a546634121b..479a35c7bea48 100644 --- a/src/vs/editor/browser/config/charWidthReader.ts +++ b/src/vs/editor/browser/config/charWidthReader.ts @@ -124,7 +124,7 @@ class DomCharWidthReader { private static _render(testElement: HTMLElement, request: CharWidthRequest): void { if (request.chr === ' ') { - let htmlString = ' '; + let htmlString = ' '; // Repeat character 256 (2^8) times for (let i = 0; i < 8; i++) { htmlString += htmlString; diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts index 471c97e1162a9..9dc1f11dc390e 100644 --- a/src/vs/editor/browser/config/configuration.ts +++ b/src/vs/editor/browser/config/configuration.ts @@ -14,7 +14,7 @@ import { CommonEditorConfiguration, IEnvConfiguration } from 'vs/editor/common/c import { EditorOption, IEditorConstructionOptions, EditorFontLigatures } from 'vs/editor/common/config/editorOptions'; import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo'; import { IDimension } from 'vs/editor/common/editorCommon'; -import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; class CSSBasedConfigurationCache { @@ -87,6 +87,8 @@ export interface ISerializedFontInfo { readonly typicalFullwidthCharacterWidth: number; readonly canUseHalfwidthRightwardsArrow: boolean; readonly spaceWidth: number; + middotWidth: number; + wsmiddotWidth: number; readonly maxDigitWidth: number; } @@ -159,6 +161,8 @@ class CSSBasedConfiguration extends Disposable { const savedFontInfo = savedFontInfos[i]; // compatibility with older versions of VS Code which did not store this... savedFontInfo.fontFeatureSettings = savedFontInfo.fontFeatureSettings || EditorFontLigatures.OFF; + savedFontInfo.middotWidth = savedFontInfo.middotWidth || savedFontInfo.spaceWidth; + savedFontInfo.wsmiddotWidth = savedFontInfo.wsmiddotWidth || savedFontInfo.spaceWidth; const fontInfo = new FontInfo(savedFontInfo, false); this._writeToCache(fontInfo, fontInfo); } @@ -183,6 +187,8 @@ class CSSBasedConfiguration extends Disposable { typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5), canUseHalfwidthRightwardsArrow: readConfig.canUseHalfwidthRightwardsArrow, spaceWidth: Math.max(readConfig.spaceWidth, 5), + middotWidth: Math.max(readConfig.middotWidth, 5), + wsmiddotWidth: Math.max(readConfig.wsmiddotWidth, 5), maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5), }, false); } @@ -223,7 +229,11 @@ class CSSBasedConfiguration extends Disposable { const rightwardsArrow = this.createRequest('→', CharWidthRequestType.Regular, all, monospace); const halfwidthRightwardsArrow = this.createRequest('→', CharWidthRequestType.Regular, all, null); - this.createRequest('·', CharWidthRequestType.Regular, all, monospace); + // U+00B7 - MIDDLE DOT + const middot = this.createRequest('·', CharWidthRequestType.Regular, all, monospace); + + // U+2E31 - WORD SEPARATOR MIDDLE DOT + const wsmiddotWidth = this.createRequest(String.fromCharCode(0x2E31), CharWidthRequestType.Regular, all, null); // monospace test: some characters this.createRequest('|', CharWidthRequestType.Regular, all, monospace); @@ -289,6 +299,8 @@ class CSSBasedConfiguration extends Disposable { typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width, canUseHalfwidthRightwardsArrow: canUseHalfwidthRightwardsArrow, spaceWidth: space.width, + middotWidth: middot.width, + wsmiddotWidth: wsmiddotWidth.width, maxDigitWidth: maxDigitWidth }, canTrustBrowserZoomLevel); } @@ -333,7 +345,7 @@ export class Configuration extends CommonEditorConfiguration { } this._register(browser.onDidChangeZoomLevel(_ => this._recomputeOptions())); - this._register(this.accessibilityService.onDidChangeAccessibilitySupport(() => this._recomputeOptions())); + this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions())); this._recomputeOptions(); } @@ -374,7 +386,11 @@ export class Configuration extends CommonEditorConfiguration { emptySelectionClipboard: browser.isWebKit || browser.isFirefox, pixelRatio: browser.getPixelRatio(), zoomLevel: browser.getZoomLevel(), - accessibilitySupport: this.accessibilityService.getAccessibilitySupport() + accessibilitySupport: ( + this.accessibilityService.isScreenReaderOptimized() + ? AccessibilitySupport.Enabled + : this.accessibilityService.getAccessibilitySupport() + ) }; } diff --git a/src/vs/editor/browser/config/elementSizeObserver.ts b/src/vs/editor/browser/config/elementSizeObserver.ts index 16eea46d1f303..b78ede941f478 100644 --- a/src/vs/editor/browser/config/elementSizeObserver.ts +++ b/src/vs/editor/browser/config/elementSizeObserver.ts @@ -3,24 +3,27 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Disposable } from 'vs/base/common/lifecycle'; +import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import { IDimension } from 'vs/editor/common/editorCommon'; +import * as dom from 'vs/base/browser/dom'; export class ElementSizeObserver extends Disposable { private readonly referenceDomElement: HTMLElement | null; - private measureReferenceDomElementToken: any; private readonly changeCallback: () => void; private width: number; private height: number; + private mutationObserver: MutationObserver | null; + private windowSizeListener: IDisposable | null; constructor(referenceDomElement: HTMLElement | null, dimension: IDimension | undefined, changeCallback: () => void) { super(); this.referenceDomElement = referenceDomElement; this.changeCallback = changeCallback; - this.measureReferenceDomElementToken = -1; this.width = -1; this.height = -1; + this.mutationObserver = null; + this.windowSizeListener = null; this.measureReferenceDomElement(false, dimension); } @@ -38,15 +41,25 @@ export class ElementSizeObserver extends Disposable { } public startObserving(): void { - if (this.measureReferenceDomElementToken === -1) { - this.measureReferenceDomElementToken = setInterval(() => this.measureReferenceDomElement(true), 100); + if (!this.mutationObserver && this.referenceDomElement) { + this.mutationObserver = new MutationObserver(() => this._onDidMutate()); + this.mutationObserver.observe(this.referenceDomElement, { + attributes: true, + }); + } + if (!this.windowSizeListener) { + this.windowSizeListener = dom.addDisposableListener(window, 'resize', () => this._onDidResizeWindow()); } } public stopObserving(): void { - if (this.measureReferenceDomElementToken !== -1) { - clearInterval(this.measureReferenceDomElementToken); - this.measureReferenceDomElementToken = -1; + if (this.mutationObserver) { + this.mutationObserver.disconnect(); + this.mutationObserver = null; + } + if (this.windowSizeListener) { + this.windowSizeListener.dispose(); + this.windowSizeListener = null; } } @@ -54,6 +67,14 @@ export class ElementSizeObserver extends Disposable { this.measureReferenceDomElement(true, dimension); } + private _onDidMutate(): void { + this.measureReferenceDomElement(true); + } + + private _onDidResizeWindow(): void { + this.measureReferenceDomElement(true); + } + private measureReferenceDomElement(callChangeCallback: boolean, dimension?: IDimension): void { let observedWidth = 0; let observedHeight = 0; diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index 94ed9e159cbce..ca00039a59243 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -24,7 +24,8 @@ import { MenuId } from 'vs/platform/actions/common/actions'; import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { EditorOption } from 'vs/editor/common/config/editorOptions'; const CORE_WEIGHT = KeybindingWeight.EditorCore; @@ -1529,6 +1530,122 @@ export namespace CoreNavigationCommands { }); } +const columnSelectionCondition = ContextKeyExpr.and( + EditorContextKeys.textInputFocus, + EditorContextKeys.columnSelection +); +function registerColumnSelection(id: string, keybinding: number): void { + KeybindingsRegistry.registerKeybindingRule({ + id: id, + primary: keybinding, + when: columnSelectionCondition, + weight: CORE_WEIGHT + 1 + }); +} + +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectLeft.id, KeyMod.Shift | KeyCode.LeftArrow); +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectRight.id, KeyMod.Shift | KeyCode.RightArrow); +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectUp.id, KeyMod.Shift | KeyCode.UpArrow); +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectPageUp.id, KeyMod.Shift | KeyCode.PageUp); +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectDown.id, KeyMod.Shift | KeyCode.DownArrow); +registerColumnSelection(CoreNavigationCommands.CursorColumnSelectPageDown.id, KeyMod.Shift | KeyCode.PageDown); + +/** + * A command that will: + * 1. invoke a command on the focused editor. + * 2. otherwise, invoke a browser built-in command on the `activeElement`. + * 3. otherwise, invoke a command on the workbench active editor. + */ +abstract class EditorOrNativeTextInputCommand extends Command { + + public runCommand(accessor: ServicesAccessor, args: any): void { + + const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor(); + // Only if editor text focus (i.e. not if editor has widget focus). + if (focusedEditor && focusedEditor.hasTextFocus()) { + return this.runEditorCommand(accessor, focusedEditor, args); + } + + // Ignore this action when user is focused on an element that allows for entering text + const activeElement = document.activeElement; + if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) { + return this.runDOMCommand(); + } + + // Redirecting to active editor + const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor(); + if (activeEditor) { + activeEditor.focus(); + return this.runEditorCommand(accessor, activeEditor, args); + } + } + + public abstract runDOMCommand(): void; + public abstract runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void; +} + +class SelectAllCommand extends EditorOrNativeTextInputCommand { + constructor() { + super({ + id: 'editor.action.selectAll', + precondition: EditorContextKeys.textInputFocus, + kbOpts: { + weight: CORE_WEIGHT, + kbExpr: null, + primary: KeyMod.CtrlCmd | KeyCode.KEY_A + }, + menuOpts: [{ + menuId: MenuId.MenubarSelectionMenu, + group: '1_basic', + title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"), + order: 1 + }, { + menuId: MenuId.CommandPalette, + group: '', + title: nls.localize('selectAll', "Select All"), + order: 1 + }] + }); + } + public runDOMCommand(): void { + document.execCommand('selectAll'); + } + public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void { + args = args || {}; + args.source = 'keyboard'; + CoreNavigationCommands.SelectAll.runEditorCommand(accessor, editor, args); + } +} + +class UndoCommand extends EditorOrNativeTextInputCommand { + public runDOMCommand(): void { + document.execCommand('undo'); + } + public runEditorCommand(accessor: ServicesAccessor | null, editor: ICodeEditor, args: any): void { + if (!editor.hasModel() || editor.getOption(EditorOption.readOnly) === true) { + return; + } + editor.getModel().undo(); + } +} + +class RedoCommand extends EditorOrNativeTextInputCommand { + public runDOMCommand(): void { + document.execCommand('redo'); + } + public runEditorCommand(accessor: ServicesAccessor | null, editor: ICodeEditor, args: any): void { + if (!editor.hasModel() || editor.getOption(EditorOption.readOnly) === true) { + return; + } + editor.getModel().redo(); + } +} + +function registerCommand(command: T): T { + command.register(); + return command; +} + export namespace CoreEditingCommands { export abstract class CoreEditingCommand extends EditorCommand { @@ -1614,7 +1731,7 @@ export namespace CoreEditingCommands { constructor() { super({ id: 'deleteLeft', - precondition: EditorContextKeys.writable, + precondition: undefined, kbOpts: { weight: CORE_WEIGHT, kbExpr: EditorContextKeys.textInputFocus, @@ -1639,7 +1756,7 @@ export namespace CoreEditingCommands { constructor() { super({ id: 'deleteRight', - precondition: EditorContextKeys.writable, + precondition: undefined, kbOpts: { weight: CORE_WEIGHT, kbExpr: EditorContextKeys.textInputFocus, @@ -1659,62 +1776,53 @@ export namespace CoreEditingCommands { } }); -} - -function registerCommand(command: Command) { - command.register(); -} - -/** - * A command that will: - * 1. invoke a command on the focused editor. - * 2. otherwise, invoke a browser built-in command on the `activeElement`. - * 3. otherwise, invoke a command on the workbench active editor. - */ -class EditorOrNativeTextInputCommand extends Command { - - private readonly _editorHandler: string | EditorCommand; - private readonly _inputHandler: string; - - constructor(opts: ICommandOptions & { editorHandler: string | EditorCommand; inputHandler: string; }) { - super(opts); - this._editorHandler = opts.editorHandler; - this._inputHandler = opts.inputHandler; - } - - public runCommand(accessor: ServicesAccessor, args: any): void { - - const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor(); - // Only if editor text focus (i.e. not if editor has widget focus). - if (focusedEditor && focusedEditor.hasTextFocus()) { - return this._runEditorHandler(accessor, focusedEditor, args); - } + export const Undo: UndoCommand = registerCommand(new UndoCommand({ + id: 'undo', + precondition: EditorContextKeys.writable, + kbOpts: { + weight: CORE_WEIGHT, + kbExpr: EditorContextKeys.textInputFocus, + primary: KeyMod.CtrlCmd | KeyCode.KEY_Z + }, + menuOpts: [{ + menuId: MenuId.MenubarEditMenu, + group: '1_do', + title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), + order: 1 + }, { + menuId: MenuId.CommandPalette, + group: '', + title: nls.localize('undo', "Undo"), + order: 1 + }] + })); - // Ignore this action when user is focused on an element that allows for entering text - const activeElement = document.activeElement; - if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) { - document.execCommand(this._inputHandler); - return; - } + export const DefaultUndo: UndoCommand = registerCommand(new UndoCommand({ id: 'default:undo', precondition: EditorContextKeys.writable })); - // Redirecting to active editor - const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor(); - if (activeEditor) { - activeEditor.focus(); - return this._runEditorHandler(accessor, activeEditor, args); - } - } + export const Redo: RedoCommand = registerCommand(new RedoCommand({ + id: 'redo', + precondition: EditorContextKeys.writable, + kbOpts: { + weight: CORE_WEIGHT, + kbExpr: EditorContextKeys.textInputFocus, + primary: KeyMod.CtrlCmd | KeyCode.KEY_Y, + secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z], + mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z } + }, + menuOpts: [{ + menuId: MenuId.MenubarEditMenu, + group: '1_do', + title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"), + order: 2 + }, { + menuId: MenuId.CommandPalette, + group: '', + title: nls.localize('redo', "Redo"), + order: 1 + }] + })); - private _runEditorHandler(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void { - const HANDLER = this._editorHandler; - if (typeof HANDLER === 'string') { - editor.trigger('keyboard', HANDLER, args); - } else { - args = args || {}; - args.source = 'keyboard'; - HANDLER.runEditorCommand(accessor, editor, args); - } - } + export const DefaultRedo: RedoCommand = registerCommand(new RedoCommand({ id: 'default:redo', precondition: EditorContextKeys.writable })); } /** @@ -1743,63 +1851,7 @@ class EditorHandlerCommand extends Command { } } -registerCommand(new EditorOrNativeTextInputCommand({ - editorHandler: CoreNavigationCommands.SelectAll, - inputHandler: 'selectAll', - id: 'editor.action.selectAll', - precondition: EditorContextKeys.textInputFocus, - kbOpts: { - weight: CORE_WEIGHT, - kbExpr: null, - primary: KeyMod.CtrlCmd | KeyCode.KEY_A - }, - menubarOpts: { - menuId: MenuId.MenubarSelectionMenu, - group: '1_basic', - title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"), - order: 1 - } -})); - -registerCommand(new EditorOrNativeTextInputCommand({ - editorHandler: Handler.Undo, - inputHandler: 'undo', - id: Handler.Undo, - precondition: EditorContextKeys.writable, - kbOpts: { - weight: CORE_WEIGHT, - kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_Z - }, - menubarOpts: { - menuId: MenuId.MenubarEditMenu, - group: '1_do', - title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), - order: 1 - } -})); -registerCommand(new EditorHandlerCommand('default:' + Handler.Undo, Handler.Undo)); - -registerCommand(new EditorOrNativeTextInputCommand({ - editorHandler: Handler.Redo, - inputHandler: 'redo', - id: Handler.Redo, - precondition: EditorContextKeys.writable, - kbOpts: { - weight: CORE_WEIGHT, - kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_Y, - secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z], - mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z } - }, - menubarOpts: { - menuId: MenuId.MenubarEditMenu, - group: '1_do', - title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"), - order: 2 - } -})); -registerCommand(new EditorHandlerCommand('default:' + Handler.Redo, Handler.Redo)); +registerCommand(new SelectAllCommand()); function registerOverwritableCommand(handlerId: string, description?: ICommandHandlerDescription): void { registerCommand(new EditorHandlerCommand('default:' + handlerId, handlerId)); diff --git a/src/vs/editor/browser/controller/mouseHandler.ts b/src/vs/editor/browser/controller/mouseHandler.ts index d1a1984102862..5bab90e5eb1b5 100644 --- a/src/vs/editor/browser/controller/mouseHandler.ts +++ b/src/vs/editor/browser/controller/mouseHandler.ts @@ -9,11 +9,10 @@ import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent import { RunOnceScheduler, TimeoutTimer } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; -import { HitTestContext, IViewZoneData, MouseTarget, MouseTargetFactory } from 'vs/editor/browser/controller/mouseTarget'; -import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { HitTestContext, IViewZoneData, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from 'vs/editor/browser/controller/mouseTarget'; +import { IMouseTarget, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorMouseMoveMonitor, createEditorPagePosition } from 'vs/editor/browser/editorDom'; import { ViewController } from 'vs/editor/browser/view/viewController'; -import { IViewCursorRenderData } from 'vs/editor/browser/viewParts/viewCursors/viewCursor'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; import { Position } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; @@ -26,8 +25,8 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions'; /** * Merges mouse events when mouse move events are throttled */ -function createMouseMoveEventMerger(mouseTargetFactory: MouseTargetFactory | null) { - return function (lastEvent: EditorMouseEvent, currentEvent: EditorMouseEvent): EditorMouseEvent { +export function createMouseMoveEventMerger(mouseTargetFactory: MouseTargetFactory | null) { + return function (lastEvent: EditorMouseEvent | null, currentEvent: EditorMouseEvent): EditorMouseEvent { let targetIsWidget = false; if (mouseTargetFactory) { targetIsWidget = mouseTargetFactory.mouseTargetIsWidget(currentEvent); @@ -46,9 +45,9 @@ export interface IPointerHandlerHelper { focusTextArea(): void; /** - * Get the last rendered information of the cursors. + * Get the last rendered information for cursors & textarea. */ - getLastViewCursorsRenderData(): IViewCursorRenderData[]; + getLastRenderData(): PointerHandlerLastRenderData; shouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean; shouldSuppressMouseDownOnWidget(widgetId: string): boolean; @@ -71,8 +70,7 @@ export class MouseHandler extends ViewEventHandler { protected viewHelper: IPointerHandlerHelper; protected mouseTargetFactory: MouseTargetFactory; private readonly _asyncFocus: RunOnceScheduler; - - private readonly _mouseDownOperation: MouseDownOperation; + protected readonly _mouseDownOperation: MouseDownOperation; private lastMouseLeaveTime: number; constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) { @@ -124,7 +122,7 @@ export class MouseHandler extends ViewEventHandler { e.stopPropagation(); } }; - this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, true)); + this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { capture: true, passive: false })); this._context.addEventHandler(this); } @@ -150,7 +148,7 @@ export class MouseHandler extends ViewEventHandler { } // --- end event handlers - public getTargetAtClientPoint(clientX: number, clientY: number): editorBrowser.IMouseTarget | null { + public getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null { const clientPos = new ClientCoordinates(clientX, clientY); const pos = clientPos.toPageCoordinates(); const editorPos = createEditorPagePosition(this.viewHelper.viewDomNode); @@ -159,13 +157,11 @@ export class MouseHandler extends ViewEventHandler { return null; } - const lastViewCursorsRenderData = this.viewHelper.getLastViewCursorsRenderData(); - return this.mouseTargetFactory.createMouseTarget(lastViewCursorsRenderData, editorPos, pos, null); + return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, null); } - protected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): editorBrowser.IMouseTarget { - const lastViewCursorsRenderData = this.viewHelper.getLastViewCursorsRenderData(); - return this.mouseTargetFactory.createMouseTarget(lastViewCursorsRenderData, e.editorPos, e.pos, testEventTarget ? e.target : null); + protected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): IMouseTarget { + return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, testEventTarget ? e.target : null); } private _getMouseColumn(e: EditorMouseEvent): number { @@ -179,7 +175,7 @@ export class MouseHandler extends ViewEventHandler { }); } - private _onMouseMove(e: EditorMouseEvent): void { + public _onMouseMove(e: EditorMouseEvent): void { if (this._mouseDownOperation.isActive()) { // In selection/drag operation return; @@ -196,7 +192,7 @@ export class MouseHandler extends ViewEventHandler { }); } - private _onMouseLeave(e: EditorMouseEvent): void { + public _onMouseLeave(e: EditorMouseEvent): void { this.lastMouseLeaveTime = (new Date()).getTime(); this.viewController.emitMouseLeave({ event: e, @@ -214,12 +210,12 @@ export class MouseHandler extends ViewEventHandler { public _onMouseDown(e: EditorMouseEvent): void { const t = this._createMouseTarget(e, true); - const targetIsContent = (t.type === editorBrowser.MouseTargetType.CONTENT_TEXT || t.type === editorBrowser.MouseTargetType.CONTENT_EMPTY); - const targetIsGutter = (t.type === editorBrowser.MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_DECORATIONS); - const targetIsLineNumbers = (t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS); + const targetIsContent = (t.type === MouseTargetType.CONTENT_TEXT || t.type === MouseTargetType.CONTENT_EMPTY); + const targetIsGutter = (t.type === MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === MouseTargetType.GUTTER_LINE_NUMBERS || t.type === MouseTargetType.GUTTER_LINE_DECORATIONS); + const targetIsLineNumbers = (t.type === MouseTargetType.GUTTER_LINE_NUMBERS); const selectOnLineNumbers = this._context.configuration.options.get(EditorOption.selectOnLineNumbers); - const targetIsViewZone = (t.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || t.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE); - const targetIsWidget = (t.type === editorBrowser.MouseTargetType.CONTENT_WIDGET); + const targetIsViewZone = (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE); + const targetIsWidget = (t.type === MouseTargetType.CONTENT_WIDGET); let shouldHandle = e.leftButton || e.middleButton; if (platform.isMacintosh && e.leftButton && e.ctrlKey) { @@ -273,7 +269,7 @@ class MouseDownOperation extends Disposable { private readonly _context: ViewContext; private readonly _viewController: ViewController; private readonly _viewHelper: IPointerHandlerHelper; - private readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => editorBrowser.IMouseTarget; + private readonly _createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget; private readonly _getMouseColumn: (e: EditorMouseEvent) => number; private readonly _mouseMoveMonitor: GlobalEditorMouseMoveMonitor; @@ -288,7 +284,7 @@ class MouseDownOperation extends Disposable { context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper, - createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => editorBrowser.IMouseTarget, + createMouseTarget: (e: EditorMouseEvent, testEventTarget: boolean) => IMouseTarget, getMouseColumn: (e: EditorMouseEvent) => number ) { super(); @@ -335,10 +331,10 @@ class MouseDownOperation extends Disposable { } } - public start(targetType: editorBrowser.MouseTargetType, e: EditorMouseEvent): void { + public start(targetType: MouseTargetType, e: EditorMouseEvent): void { this._lastMouseEvent = e; - this._mouseState.setStartedOnLineNumbers(targetType === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS); + this._mouseState.setStartedOnLineNumbers(targetType === MouseTargetType.GUTTER_LINE_NUMBERS); this._mouseState.setStartButtons(e); this._mouseState.setModifiers(e); const position = this._findMousePosition(e, true); @@ -356,17 +352,20 @@ class MouseDownOperation extends Disposable { if (!options.get(EditorOption.readOnly) && options.get(EditorOption.dragAndDrop) + && !options.get(EditorOption.columnSelection) && !this._mouseState.altKey // we don't support multiple mouse && e.detail < 2 // only single click on a selection can work && !this._isActive // the mouse is not down yet && !this._currentSelection.isEmpty() // we don't drag single cursor - && (position.type === editorBrowser.MouseTargetType.CONTENT_TEXT) // single click on text + && (position.type === MouseTargetType.CONTENT_TEXT) // single click on text && position.position && this._currentSelection.containsPosition(position.position) // single click on a selection ) { this._mouseState.isDragAndDrop = true; this._isActive = true; this._mouseMoveMonitor.startMonitoring( + e.target, + e.buttons, createMouseMoveEventMerger(null), (e) => this._onMouseDownThenMove(e), () => { @@ -390,6 +389,8 @@ class MouseDownOperation extends Disposable { if (!this._isActive) { this._isActive = true; this._mouseMoveMonitor.startMonitoring( + e.target, + e.buttons, createMouseMoveEventMerger(null), (e) => this._onMouseDownThenMove(e), () => this._stop() @@ -440,12 +441,12 @@ class MouseDownOperation extends Disposable { if (viewZoneData) { const newPosition = this._helpPositionJumpOverViewZone(viewZoneData); if (newPosition) { - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, newPosition); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, newPosition); } } const aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset); - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(aboveLineNumber, 1)); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(aboveLineNumber, 1)); } if (e.posy > editorContent.y + editorContent.height) { @@ -454,22 +455,22 @@ class MouseDownOperation extends Disposable { if (viewZoneData) { const newPosition = this._helpPositionJumpOverViewZone(viewZoneData); if (newPosition) { - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, newPosition); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, newPosition); } } const belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset); - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber))); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber))); } const possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + (e.posy - editorContent.y)); if (e.posx < editorContent.x) { - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(possibleLineNumber, 1)); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(possibleLineNumber, 1)); } if (e.posx > editorContent.x + editorContent.width) { - return new MouseTarget(null, editorBrowser.MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(possibleLineNumber, model.getLineMaxColumn(possibleLineNumber))); + return new MouseTarget(null, MouseTargetType.OUTSIDE_EDITOR, mouseColumn, new Position(possibleLineNumber, model.getLineMaxColumn(possibleLineNumber))); } return null; @@ -487,7 +488,7 @@ class MouseDownOperation extends Disposable { return null; } - if (t.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || t.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) { + if (t.type === MouseTargetType.CONTENT_VIEW_ZONE || t.type === MouseTargetType.GUTTER_VIEW_ZONE) { const newPosition = this._helpPositionJumpOverViewZone(t.detail); if (newPosition) { return new MouseTarget(t.element, t.type, t.mouseColumn, newPosition, null, t.detail); diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index 1f7377742484a..f83ff9bfd94ba 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -17,6 +17,7 @@ import { HorizontalPosition } from 'vs/editor/common/view/renderingContext'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; import { CursorColumns } from 'vs/editor/common/controller/cursorCommon'; +import * as dom from 'vs/base/browser/dom'; export interface IViewZoneData { viewZoneId: string; @@ -79,7 +80,7 @@ interface IETextRange { setEndPoint(how: string, SourceRange: IETextRange): void; } -declare var IETextRange: { +declare const IETextRange: { prototype: IETextRange; new(): IETextRange; }; @@ -89,6 +90,13 @@ interface IHitTestResult { hitTarget: Element | null; } +export class PointerHandlerLastRenderData { + constructor( + public readonly lastViewCursorsRenderData: IViewCursorRenderData[], + public readonly lastTextareaPosition: Position | null + ) { } +} + export class MouseTarget implements IMouseTarget { public readonly element: Element | null; @@ -232,19 +240,19 @@ export class HitTestContext { public readonly viewDomNode: HTMLElement; public readonly lineHeight: number; public readonly typicalHalfwidthCharacterWidth: number; - public readonly lastViewCursorsRenderData: IViewCursorRenderData[]; + public readonly lastRenderData: PointerHandlerLastRenderData; private readonly _context: ViewContext; private readonly _viewHelper: IPointerHandlerHelper; - constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastViewCursorsRenderData: IViewCursorRenderData[]) { + constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastRenderData: PointerHandlerLastRenderData) { this.model = context.model; const options = context.configuration.options; this.layoutInfo = options.get(EditorOption.layoutInfo); this.viewDomNode = viewHelper.viewDomNode; this.lineHeight = options.get(EditorOption.lineHeight); this.typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; - this.lastViewCursorsRenderData = lastViewCursorsRenderData; + this.lastRenderData = lastRenderData; this._context = context; this._viewHelper = viewHelper; } @@ -462,8 +470,8 @@ export class MouseTargetFactory { return false; } - public createMouseTarget(lastViewCursorsRenderData: IViewCursorRenderData[], editorPos: EditorPagePosition, pos: PageCoordinates, target: HTMLElement | null): IMouseTarget { - const ctx = new HitTestContext(this._context, this._viewHelper, lastViewCursorsRenderData); + public createMouseTarget(lastRenderData: PointerHandlerLastRenderData, editorPos: EditorPagePosition, pos: PageCoordinates, target: HTMLElement | null): IMouseTarget { + const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData); const request = new HitTestRequest(ctx, editorPos, pos, target); try { const r = MouseTargetFactory._createMouseTarget(ctx, request, false); @@ -544,7 +552,7 @@ export class MouseTargetFactory { if (request.target) { // Check if we've hit a painted cursor - const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData; + const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData; for (const d of lastViewCursorsRenderData) { @@ -560,7 +568,7 @@ export class MouseTargetFactory { // first or last rendered view line dom node, therefore help it out // and first check if we are on top of a cursor - const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData; + const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData; const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset; const mouseVerticalOffset = request.mouseVerticalOffset; @@ -602,7 +610,10 @@ export class MouseTargetFactory { private static _hitTestTextArea(ctx: HitTestContext, request: ResolvedHitTestRequest): MouseTarget | null { // Is it the textarea? if (ElementPath.isTextArea(request.targetPath)) { - return request.fulfill(MouseTargetType.TEXTAREA); + if (ctx.lastRenderData.lastTextareaPosition) { + return request.fulfill(MouseTargetType.CONTENT_TEXT, ctx.lastRenderData.lastTextareaPosition); + } + return request.fulfill(MouseTargetType.TEXTAREA, ctx.lastRenderData.lastTextareaPosition); } return null; } @@ -663,6 +674,13 @@ export class MouseTargetFactory { const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth); return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, 1), undefined, detail); } + + const lineWidth = ctx.getLineWidth(lineNumber); + if (request.mouseContentHorizontalOffset >= lineWidth) { + const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth); + const pos = new Position(lineNumber, ctx.model.getLineMaxColumn(lineNumber)); + return request.fulfill(MouseTargetType.CONTENT_EMPTY, pos, undefined, detail); + } } // We have already executed hit test... @@ -818,8 +836,17 @@ export class MouseTargetFactory { } private static _actualDoHitTestWithCaretRangeFromPoint(ctx: HitTestContext, coords: ClientCoordinates): IHitTestResult { - - const range: Range = document.caretRangeFromPoint(coords.clientX, coords.clientY); + const shadowRoot = dom.getShadowRoot(ctx.viewDomNode); + let range: Range; + if (shadowRoot) { + if (typeof shadowRoot.caretRangeFromPoint === 'undefined') { + range = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY); + } else { + range = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY); + } + } else { + range = document.caretRangeFromPoint(coords.clientX, coords.clientY); + } if (!range || !range.startContainer) { return { @@ -992,3 +1019,94 @@ export class MouseTargetFactory { }; } } + +export function shadowCaretRangeFromPoint(shadowRoot: ShadowRoot, x: number, y: number): Range { + const range = document.createRange(); + + // Get the element under the point + let el: Element | null = shadowRoot.elementFromPoint(x, y); + + if (el !== null) { + // Get the last child of the element until its firstChild is a text node + // This assumes that the pointer is on the right of the line, out of the tokens + // and that we want to get the offset of the last token of the line + while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE) { + el = el.lastChild; + } + + // Grab its rect + const rect = el.getBoundingClientRect(); + + // And its font + const font = window.getComputedStyle(el, null).getPropertyValue('font'); + + // And also its txt content + const text = (el as any).innerText; + + // Position the pixel cursor at the left of the element + let pixelCursor = rect.left; + let offset = 0; + let step: number; + + // If the point is on the right of the box put the cursor after the last character + if (x > rect.left + rect.width) { + offset = text.length; + } else { + const charWidthReader = CharWidthReader.getInstance(); + // Goes through all the characters of the innerText, and checks if the x of the point + // belongs to the character. + for (let i = 0; i < text.length + 1; i++) { + // The step is half the width of the character + step = charWidthReader.getCharWidth(text.charAt(i), font) / 2; + // Move to the center of the character + pixelCursor += step; + // If the x of the point is smaller that the position of the cursor, the point is over that character + if (x < pixelCursor) { + offset = i; + break; + } + // Move between the current character and the next + pixelCursor += step; + } + } + + // Creates a range with the text node of the element and set the offset found + range.setStart(el.firstChild!, offset); + range.setEnd(el.firstChild!, offset); + } + + return range; +} + +class CharWidthReader { + private static _INSTANCE: CharWidthReader | null = null; + + public static getInstance(): CharWidthReader { + if (!CharWidthReader._INSTANCE) { + CharWidthReader._INSTANCE = new CharWidthReader(); + } + return CharWidthReader._INSTANCE; + } + + private readonly _cache: { [cacheKey: string]: number; }; + private readonly _canvas: HTMLCanvasElement; + + private constructor() { + this._cache = {}; + this._canvas = document.createElement('canvas'); + } + + public getCharWidth(char: string, font: string): number { + const cacheKey = char + font; + if (this._cache[cacheKey]) { + return this._cache[cacheKey]; + } + + const context = this._canvas.getContext('2d')!; + context.font = font; + const metrics = context.measureText(char); + const width = metrics.width; + this._cache[cacheKey] = width; + return width; + } +} diff --git a/src/vs/editor/browser/controller/pointerHandler.ts b/src/vs/editor/browser/controller/pointerHandler.ts index 51988d09968cd..46894f1be1523 100644 --- a/src/vs/editor/browser/controller/pointerHandler.ts +++ b/src/vs/editor/browser/controller/pointerHandler.ts @@ -4,20 +4,22 @@ *--------------------------------------------------------------------------------------------*/ import * as dom from 'vs/base/browser/dom'; +import * as platform from 'vs/base/common/platform'; import { EventType, Gesture, GestureEvent } from 'vs/base/browser/touch'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; -import { IPointerHandlerHelper, MouseHandler } from 'vs/editor/browser/controller/mouseHandler'; +import { IPointerHandlerHelper, MouseHandler, createMouseMoveEventMerger } from 'vs/editor/browser/controller/mouseHandler'; import { IMouseTarget } from 'vs/editor/browser/editorBrowser'; -import { EditorMouseEvent } from 'vs/editor/browser/editorDom'; +import { EditorMouseEvent, EditorPointerEventFactory } from 'vs/editor/browser/editorDom'; import { ViewController } from 'vs/editor/browser/view/viewController'; import { ViewContext } from 'vs/editor/common/view/viewContext'; +import { BrowserFeatures } from 'vs/base/browser/canIUse'; interface IThrottledGestureEvent { translationX: number; translationY: number; } -function gestureChangeEventMerger(lastEvent: IThrottledGestureEvent, currentEvent: MSGestureEvent): IThrottledGestureEvent { +function gestureChangeEventMerger(lastEvent: IThrottledGestureEvent | null, currentEvent: MSGestureEvent): IThrottledGestureEvent { const r = { translationY: currentEvent.translationY, translationX: currentEvent.translationX @@ -52,7 +54,7 @@ class MsPointerHandler extends MouseHandler implements IDisposable { const penGesture = new MSGesture(); touchGesture.target = this.viewHelper.linesContentDomNode; penGesture.target = this.viewHelper.linesContentDomNode; - this.viewHelper.linesContentDomNode.addEventListener('MSPointerDown', (e: MSPointerEvent) => { + this.viewHelper.linesContentDomNode.addEventListener('MSPointerDown', (e: MSPointerEvent) => { // Circumvent IE11 breaking change in e.pointerType & TypeScript's stale definitions const pointerType = e.pointerType; if (pointerType === ((e).MSPOINTER_TYPE_MOUSE || 'mouse')) { @@ -66,7 +68,7 @@ class MsPointerHandler extends MouseHandler implements IDisposable { penGesture.addPointer(e.pointerId); } }); - this._register(dom.addDisposableThrottledListener(this.viewHelper.linesContentDomNode, 'MSGestureChange', (e) => this._onGestureChange(e), gestureChangeEventMerger)); + this._register(dom.addDisposableThrottledListener(this.viewHelper.linesContentDomNode, 'MSGestureChange', (e) => this._onGestureChange(e), gestureChangeEventMerger)); this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'MSGestureTap', (e) => this._onCaptureGestureTap(e), true)); } }, 100); @@ -131,7 +133,7 @@ class StandardPointerHandler extends MouseHandler implements IDisposable { const penGesture = new MSGesture(); touchGesture.target = this.viewHelper.linesContentDomNode; penGesture.target = this.viewHelper.linesContentDomNode; - this.viewHelper.linesContentDomNode.addEventListener('pointerdown', (e: MSPointerEvent) => { + this.viewHelper.linesContentDomNode.addEventListener('pointerdown', (e: PointerEvent) => { const pointerType = e.pointerType; if (pointerType === 'mouse') { this._lastPointerType = 'mouse'; @@ -144,7 +146,7 @@ class StandardPointerHandler extends MouseHandler implements IDisposable { penGesture.addPointer(e.pointerId); } }); - this._register(dom.addDisposableThrottledListener(this.viewHelper.linesContentDomNode, 'MSGestureChange', (e) => this._onGestureChange(e), gestureChangeEventMerger)); + this._register(dom.addDisposableThrottledListener(this.viewHelper.linesContentDomNode, 'MSGestureChange', (e) => this._onGestureChange(e), gestureChangeEventMerger)); this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'MSGestureTap', (e) => this._onCaptureGestureTap(e), true)); } }, 100); @@ -185,6 +187,87 @@ class StandardPointerHandler extends MouseHandler implements IDisposable { } } +/** + * Currently only tested on iOS 13/ iPadOS. + */ +export class PointerEventHandler extends MouseHandler { + private _lastPointerType: string; + constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) { + super(context, viewController, viewHelper); + + this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode)); + this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e))); + this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e))); + this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e: MouseEvent) => this._onContextMenu(new EditorMouseEvent(e, this.viewHelper.viewDomNode), false))); + + this._lastPointerType = 'mouse'; + + this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'pointerdown', (e: any) => { + const pointerType = e.pointerType; + if (pointerType === 'mouse') { + this._lastPointerType = 'mouse'; + return; + } else if (pointerType === 'touch') { + this._lastPointerType = 'touch'; + } else { + this._lastPointerType = 'pen'; + } + })); + + // PonterEvents + const pointerEvents = new EditorPointerEventFactory(this.viewHelper.viewDomNode); + + this._register(pointerEvents.onPointerMoveThrottled(this.viewHelper.viewDomNode, + (e) => this._onMouseMove(e), + createMouseMoveEventMerger(this.mouseTargetFactory), MouseHandler.MOUSE_MOVE_MINIMUM_TIME)); + this._register(pointerEvents.onPointerUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e))); + this._register(pointerEvents.onPointerLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e))); + this._register(pointerEvents.onPointerDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e))); + } + + private onTap(event: GestureEvent): void { + if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) { + return; + } + + event.preventDefault(); + this.viewHelper.focusTextArea(); + const target = this._createMouseTarget(new EditorMouseEvent(event, this.viewHelper.viewDomNode), false); + + if (target.position) { + // this.viewController.moveTo(target.position); + this.viewController.dispatchMouse({ + position: target.position, + mouseColumn: target.position.column, + startedOnLineNumbers: false, + mouseDownCount: event.tapCount, + inSelectionMode: false, + altKey: false, + ctrlKey: false, + metaKey: false, + shiftKey: false, + + leftButton: false, + middleButton: false, + }); + } + } + + private onChange(e: GestureEvent): void { + if (this._lastPointerType === 'touch') { + this._context.viewLayout.deltaScrollNow(-e.translationX, -e.translationY); + } + } + + public _onMouseDown(e: EditorMouseEvent): void { + if (e.target && this.viewHelper.linesContentDomNode.contains(e.target) && this._lastPointerType === 'touch') { + return; + } + + super._onMouseDown(e); + } +} + class TouchHandler extends MouseHandler { constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) { @@ -221,6 +304,8 @@ export class PointerHandler extends Disposable { super(); if (window.navigator.msPointerEnabled) { this.handler = this._register(new MsPointerHandler(context, viewController, viewHelper)); + } else if ((platform.isIOS && BrowserFeatures.pointerEvents)) { + this.handler = this._register(new PointerEventHandler(context, viewController, viewHelper)); } else if ((window).TouchEvent) { this.handler = this._register(new TouchHandler(context, viewController, viewHelper)); } else if (window.navigator.pointerEnabled || (window).PointerEvent) { diff --git a/src/vs/editor/browser/controller/textAreaHandler.ts b/src/vs/editor/browser/controller/textAreaHandler.ts index 70cd98a030a34..7a22ab779d3d9 100644 --- a/src/vs/editor/browser/controller/textAreaHandler.ts +++ b/src/vs/editor/browser/controller/textAreaHandler.ts @@ -17,7 +17,7 @@ import { ViewController } from 'vs/editor/browser/view/viewController'; import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart'; import { LineNumbersOverlay } from 'vs/editor/browser/viewParts/lineNumbers/lineNumbers'; import { Margin } from 'vs/editor/browser/viewParts/margin/margin'; -import { RenderLineNumbersType, EditorOption, IComputedEditorOptions } from 'vs/editor/common/config/editorOptions'; +import { RenderLineNumbersType, EditorOption, IComputedEditorOptions, EditorOptions } from 'vs/editor/common/config/editorOptions'; import { BareFontInfo } from 'vs/editor/common/config/fontInfo'; import { WordCharacterClass, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier'; import { Position } from 'vs/editor/common/core/position'; @@ -29,6 +29,7 @@ import { RenderingContext, RestrictedRenderingContext, HorizontalPosition } from import { ViewContext } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; +import { IEditorAriaOptions } from 'vs/editor/browser/editorBrowser'; export interface ITextAreaHandlerHelper { visibleRangeForPositionRelativeToEditor(lineNumber: number, column: number): HorizontalPosition | null; @@ -61,7 +62,8 @@ export class TextAreaHandler extends ViewPart { private _scrollLeft: number; private _scrollTop: number; - private _accessibilitySupport: AccessibilitySupport; + private _accessibilitySupport!: AccessibilitySupport; + private _accessibilityPageSize!: number; private _contentLeft: number; private _contentWidth: number; private _contentHeight: number; @@ -75,6 +77,13 @@ export class TextAreaHandler extends ViewPart { */ private _visibleTextArea: VisibleTextAreaData | null; private _selections: Selection[]; + private _modelSelections: Selection[]; + + /** + * The position at which the textarea was rendered. + * This is useful for hit-testing and determining the mouse position. + */ + private _lastRenderPosition: Position | null; public readonly textArea: FastDomNode; public readonly textAreaCover: FastDomNode; @@ -91,10 +100,10 @@ export class TextAreaHandler extends ViewPart { const options = this._context.configuration.options; const layoutInfo = options.get(EditorOption.layoutInfo); - this._accessibilitySupport = options.get(EditorOption.accessibilitySupport); + this._setAccessibilityOptions(options); this._contentLeft = layoutInfo.contentLeft; this._contentWidth = layoutInfo.contentWidth; - this._contentHeight = layoutInfo.contentHeight; + this._contentHeight = layoutInfo.height; this._fontInfo = options.get(EditorOption.fontInfo); this._lineHeight = options.get(EditorOption.lineHeight); this._emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard); @@ -102,6 +111,8 @@ export class TextAreaHandler extends ViewPart { this._visibleTextArea = null; this._selections = [new Selection(1, 1, 1, 1)]; + this._modelSelections = [new Selection(1, 1, 1, 1)]; + this._lastRenderPosition = null; // Text Area (The focus will always be in the textarea when the cursor is blinking) this.textArea = createFastDomNode(document.createElement('textarea')); @@ -139,24 +150,30 @@ export class TextAreaHandler extends ViewPart { const textAreaInputHost: ITextAreaInputHost = { getDataToCopy: (generateHTML: boolean): ClipboardDataToCopy => { - const rawTextToCopy = this._context.model.getPlainTextToCopy(this._selections, this._emptySelectionClipboard, platform.isWindows); + const rawTextToCopy = this._context.model.getPlainTextToCopy(this._modelSelections, this._emptySelectionClipboard, platform.isWindows); const newLineCharacter = this._context.model.getEOL(); - const isFromEmptySelection = (this._emptySelectionClipboard && this._selections.length === 1 && this._selections[0].isEmpty()); + const isFromEmptySelection = (this._emptySelectionClipboard && this._modelSelections.length === 1 && this._modelSelections[0].isEmpty()); const multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null); const text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy); let html: string | null | undefined = undefined; + let mode: string | null = null; if (generateHTML) { if (CopyOptions.forceCopyWithSyntaxHighlighting || (this._copyWithSyntaxHighlighting && text.length < 65536)) { - html = this._context.model.getHTMLToCopy(this._selections, this._emptySelectionClipboard); + const richText = this._context.model.getRichTextToCopy(this._modelSelections, this._emptySelectionClipboard); + if (richText) { + html = richText.html; + mode = richText.mode; + } } } return { isFromEmptySelection, multicursorText, text, - html + html, + mode }; }, @@ -189,7 +206,7 @@ export class TextAreaHandler extends ViewPart { return TextAreaState.EMPTY; } - return PagedScreenReaderStrategy.fromEditorSelection(currentState, simpleModel, this._selections[0], this._accessibilitySupport === AccessibilitySupport.Unknown); + return PagedScreenReaderStrategy.fromEditorSelection(currentState, simpleModel, this._selections[0], this._accessibilityPageSize, this._accessibilitySupport === AccessibilitySupport.Unknown); }, deduceModelPosition: (viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position => { @@ -210,11 +227,13 @@ export class TextAreaHandler extends ViewPart { this._register(this._textAreaInput.onPaste((e: IPasteData) => { let pasteOnNewLine = false; let multicursorText: string[] | null = null; + let mode: string | null = null; if (e.metadata) { pasteOnNewLine = (this._emptySelectionClipboard && !!e.metadata.isFromEmptySelection); multicursorText = (typeof e.metadata.multicursorText !== 'undefined' ? e.metadata.multicursorText : null); + mode = e.metadata.mode; } - this._viewController.paste('keyboard', e.text, pasteOnNewLine, multicursorText); + this._viewController.paste('keyboard', e.text, pasteOnNewLine, multicursorText, mode); })); this._register(this._textAreaInput.onCut(() => { @@ -334,16 +353,28 @@ export class TextAreaHandler extends ViewPart { return options.get(EditorOption.ariaLabel); } + private _setAccessibilityOptions(options: IComputedEditorOptions): void { + this._accessibilitySupport = options.get(EditorOption.accessibilitySupport); + const accessibilityPageSize = options.get(EditorOption.accessibilityPageSize); + if (this._accessibilitySupport === AccessibilitySupport.Enabled && accessibilityPageSize === EditorOptions.accessibilityPageSize.defaultValue) { + // If a screen reader is attached and the default value is not set we shuold automatically increase the page size to 160 for a better experience + // If we put more than 160 lines the nvda can not handle this https://github.com/microsoft/vscode/issues/89717 + this._accessibilityPageSize = 160; + } else { + this._accessibilityPageSize = accessibilityPageSize; + } + } + // --- begin event handlers public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { const options = this._context.configuration.options; const layoutInfo = options.get(EditorOption.layoutInfo); - this._accessibilitySupport = options.get(EditorOption.accessibilitySupport); + this._setAccessibilityOptions(options); this._contentLeft = layoutInfo.contentLeft; this._contentWidth = layoutInfo.contentWidth; - this._contentHeight = layoutInfo.contentHeight; + this._contentHeight = layoutInfo.height; this._fontInfo = options.get(EditorOption.fontInfo); this._lineHeight = options.get(EditorOption.lineHeight); this._emptySelectionClipboard = options.get(EditorOption.emptySelectionClipboard); @@ -366,6 +397,7 @@ export class TextAreaHandler extends ViewPart { } public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean { this._selections = e.selections.slice(0); + this._modelSelections = e.modelSelections.slice(0); this._textAreaInput.writeScreenReaderContent('selection changed'); return true; } @@ -410,13 +442,30 @@ export class TextAreaHandler extends ViewPart { this._textAreaInput.refreshFocusState(); } + public getLastRenderData(): Position | null { + return this._lastRenderPosition; + } + + public setAriaOptions(options: IEditorAriaOptions): void { + if (options.activeDescendant) { + this.textArea.setAttribute('aria-haspopup', 'true'); + this.textArea.setAttribute('aria-autocomplete', 'list'); + this.textArea.setAttribute('aria-activedescendant', options.activeDescendant); + } else { + this.textArea.setAttribute('aria-haspopup', 'false'); + this.textArea.setAttribute('aria-autocomplete', 'both'); + this.textArea.removeAttribute('aria-activedescendant'); + } + } + // --- end view API + private _primaryCursorPosition: Position = new Position(1, 1); private _primaryCursorVisibleRange: HorizontalPosition | null = null; public prepareRender(ctx: RenderingContext): void { - const primaryCursorPosition = new Position(this._selections[0].positionLineNumber, this._selections[0].positionColumn); - this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(primaryCursorPosition); + this._primaryCursorPosition = new Position(this._selections[0].positionLineNumber, this._selections[0].positionColumn); + this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(this._primaryCursorPosition); } public render(ctx: RestrictedRenderingContext): void { @@ -428,6 +477,7 @@ export class TextAreaHandler extends ViewPart { if (this._visibleTextArea) { // The text area is visible for composition reasons this._renderInsideEditor( + null, this._visibleTextArea.top - this._scrollTop, this._contentLeft + this._visibleTextArea.left - this._scrollLeft, this._visibleTextArea.width, @@ -462,6 +512,7 @@ export class TextAreaHandler extends ViewPart { // For the popup emoji input, we will make the text area as high as the line height // We will also make the fontSize and lineHeight the correct dimensions to help with the placement of these pickers this._renderInsideEditor( + this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, this._lineHeight ); @@ -469,12 +520,14 @@ export class TextAreaHandler extends ViewPart { } this._renderInsideEditor( + this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, canUseZeroSizeTextarea ? 0 : 1 ); } - private _renderInsideEditor(top: number, left: number, width: number, height: number): void { + private _renderInsideEditor(renderedPosition: Position | null, top: number, left: number, width: number, height: number): void { + this._lastRenderPosition = renderedPosition; const ta = this.textArea; const tac = this.textAreaCover; @@ -492,6 +545,7 @@ export class TextAreaHandler extends ViewPart { } private _renderAtTopLeft(): void { + this._lastRenderPosition = null; const ta = this.textArea; const tac = this.textAreaCover; diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index daecfbc4f6860..8d0f1962ab239 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -41,12 +41,14 @@ export interface ClipboardDataToCopy { multicursorText: string[] | null | undefined; text: string; html: string | null | undefined; + mode: string | null; } export interface ClipboardStoredMetadata { version: 1; isFromEmptySelection: boolean | undefined; multicursorText: string[] | null | undefined; + mode: string | null; } export interface ITextAreaInputHost { @@ -55,19 +57,6 @@ export interface ITextAreaInputHost { deduceModelPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position; } -const enum TextAreaInputEventType { - none, - compositionstart, - compositionupdate, - compositionend, - input, - cut, - copy, - paste, - focus, - blur -} - interface CompositionEvent extends UIEvent { readonly data: string; readonly locale: string; @@ -153,7 +142,6 @@ export class TextAreaInput extends Disposable { private readonly _host: ITextAreaInputHost; private readonly _textArea: TextAreaWrapper; - private _lastTextAreaEvent: TextAreaInputEventType; private readonly _asyncTriggerCut: RunOnceScheduler; private _textAreaState: TextAreaState; @@ -167,7 +155,6 @@ export class TextAreaInput extends Disposable { super(); this._host = host; this._textArea = this._register(new TextAreaWrapper(textArea)); - this._lastTextAreaEvent = TextAreaInputEventType.none; this._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0)); this._textAreaState = TextAreaState.EMPTY; @@ -198,8 +185,6 @@ export class TextAreaInput extends Disposable { })); this._register(dom.addDisposableListener(textArea.domNode, 'compositionstart', (e: CompositionEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.compositionstart; - if (this._isDoingComposition) { return; } @@ -216,10 +201,10 @@ export class TextAreaInput extends Disposable { /** * Deduce the typed input from a text area's value and the last observed state. */ - const deduceInputFromTextAreaValue = (couldBeEmojiInput: boolean, couldBeTypingAtOffset0: boolean): [TextAreaState, ITypeData] => { + const deduceInputFromTextAreaValue = (couldBeEmojiInput: boolean): [TextAreaState, ITypeData] => { const oldState = this._textAreaState; const newState = TextAreaState.readFromTextArea(this._textArea); - return [newState, TextAreaState.deduceInput(oldState, newState, couldBeEmojiInput, couldBeTypingAtOffset0)]; + return [newState, TextAreaState.deduceInput(oldState, newState, couldBeEmojiInput)]; }; /** @@ -256,10 +241,8 @@ export class TextAreaInput extends Disposable { }; this._register(dom.addDisposableListener(textArea.domNode, 'compositionupdate', (e: CompositionEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.compositionupdate; - if (compositionDataInValid(e.locale)) { - const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false, /*couldBeTypingAtOffset0*/false); + const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false); this._textAreaState = newState; this._onType.fire(typeInput); this._onCompositionUpdate.fire(e); @@ -273,11 +256,14 @@ export class TextAreaInput extends Disposable { })); this._register(dom.addDisposableListener(textArea.domNode, 'compositionend', (e: CompositionEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.compositionend; - + // https://github.com/microsoft/monaco-editor/issues/1663 + // On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data + if (!this._isDoingComposition) { + return; + } if (compositionDataInValid(e.locale)) { // https://github.com/Microsoft/monaco-editor/issues/339 - const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false, /*couldBeTypingAtOffset0*/false); + const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false); this._textAreaState = newState; this._onType.fire(typeInput); } else { @@ -301,10 +287,6 @@ export class TextAreaInput extends Disposable { })); this._register(dom.addDisposableListener(textArea.domNode, 'input', () => { - // We want to find out if this is the first `input` after a `focus`. - const previousEventWasFocus = (this._lastTextAreaEvent === TextAreaInputEventType.focus); - this._lastTextAreaEvent = TextAreaInputEventType.input; - // Pretend here we touched the text area, as the `input` event will most likely // result in a `selectionchange` event which we want to ignore this._textArea.setIgnoreSelectionChangeTime('received input event'); @@ -313,7 +295,7 @@ export class TextAreaInput extends Disposable { return; } - const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/platform.isMacintosh, /*couldBeTypingAtOffset0*/previousEventWasFocus && platform.isMacintosh); + const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/platform.isMacintosh); if (typeInput.replaceCharCnt === 0 && typeInput.text.length === 1 && strings.isHighSurrogate(typeInput.text.charCodeAt(0))) { // Ignore invalid input but keep it around for next time return; @@ -325,7 +307,7 @@ export class TextAreaInput extends Disposable { this._onType.fire(typeInput); } } else { - if (typeInput.text !== '') { + if (typeInput.text !== '' || typeInput.replaceCharCnt !== 0) { this._firePaste(typeInput.text, null); } this._nextCommand = ReadFromTextArea.Type; @@ -335,8 +317,6 @@ export class TextAreaInput extends Disposable { // --- Clipboard operations this._register(dom.addDisposableListener(textArea.domNode, 'cut', (e: ClipboardEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.cut; - // Pretend here we touched the text area, as the `cut` event will most likely // result in a `selectionchange` event which we want to ignore this._textArea.setIgnoreSelectionChangeTime('received cut event'); @@ -346,14 +326,10 @@ export class TextAreaInput extends Disposable { })); this._register(dom.addDisposableListener(textArea.domNode, 'copy', (e: ClipboardEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.copy; - this._ensureClipboardGetsEditorSelection(e); })); this._register(dom.addDisposableListener(textArea.domNode, 'paste', (e: ClipboardEvent) => { - this._lastTextAreaEvent = TextAreaInputEventType.paste; - // Pretend here we touched the text area, as the `paste` event will most likely // result in a `selectionchange` event which we want to ignore this._textArea.setIgnoreSelectionChangeTime('received paste event'); @@ -373,11 +349,9 @@ export class TextAreaInput extends Disposable { })); this._register(dom.addDisposableListener(textArea.domNode, 'focus', () => { - this._lastTextAreaEvent = TextAreaInputEventType.focus; this._setHasFocus(true); })); this._register(dom.addDisposableListener(textArea.domNode, 'blur', () => { - this._lastTextAreaEvent = TextAreaInputEventType.blur; this._setHasFocus(false); })); } @@ -477,6 +451,9 @@ export class TextAreaInput extends Disposable { // Setting this._hasFocus and writing the screen reader content // will result in a focus() and setSelectionRange() in the textarea this._setHasFocus(true); + + // If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus + this.refreshFocusState(); } public isFocused(): boolean { @@ -484,8 +461,11 @@ export class TextAreaInput extends Disposable { } public refreshFocusState(): void { - if (document.body.contains(this.textArea.domNode) && document.activeElement === this.textArea.domNode) { - this._setHasFocus(true); + const shadowRoot = dom.getShadowRoot(this.textArea.domNode); + if (shadowRoot) { + this._setHasFocus(shadowRoot.activeElement === this.textArea.domNode); + } else if (dom.isInDOM(this.textArea.domNode)) { + this._setHasFocus(document.activeElement === this.textArea.domNode); } else { this._setHasFocus(false); } @@ -546,7 +526,8 @@ export class TextAreaInput extends Disposable { const storedMetadata: ClipboardStoredMetadata = { version: 1, isFromEmptySelection: dataToCopy.isFromEmptySelection, - multicursorText: dataToCopy.multicursorText + multicursorText: dataToCopy.multicursorText, + mode: dataToCopy.mode }; InMemoryClipboardMetadataManager.INSTANCE.set( // When writing "LINE\r\n" to the clipboard and then pasting, @@ -612,7 +593,8 @@ class ClipboardEventUtils { if ((window).clipboardData) { e.preventDefault(); - return (window).clipboardData.getData('Text'); + const text: string = (window).clipboardData.getData('Text'); + return [text, null]; } throw new Error('ClipboardEventUtils.getTextData: Cannot use text data!'); @@ -689,7 +671,15 @@ class TextAreaWrapper extends Disposable implements ITextAreaWrapper { public setSelectionRange(reason: string, selectionStart: number, selectionEnd: number): void { const textArea = this._actual.domNode; - const currentIsFocused = (document.activeElement === textArea); + let activeElement: Element | null = null; + const shadowRoot = dom.getShadowRoot(textArea); + if (shadowRoot) { + activeElement = shadowRoot.activeElement; + } else { + activeElement = document.activeElement; + } + + const currentIsFocused = (activeElement === textArea); const currentSelectionStart = textArea.selectionStart; const currentSelectionEnd = textArea.selectionEnd; diff --git a/src/vs/editor/browser/controller/textAreaState.ts b/src/vs/editor/browser/controller/textAreaState.ts index b907a3bfa6a69..f46e77022357c 100644 --- a/src/vs/editor/browser/controller/textAreaState.ts +++ b/src/vs/editor/browser/controller/textAreaState.ts @@ -96,7 +96,7 @@ export class TextAreaState { return new TextAreaState(text, 0, text.length, null, null); } - public static deduceInput(previousState: TextAreaState, currentState: TextAreaState, couldBeEmojiInput: boolean, couldBeTypingAtOffset0: boolean): ITypeData { + public static deduceInput(previousState: TextAreaState, currentState: TextAreaState, couldBeEmojiInput: boolean): ITypeData { if (!previousState) { // This is the EMPTY state return { @@ -116,18 +116,6 @@ export class TextAreaState { let currentSelectionStart = currentState.selectionStart; let currentSelectionEnd = currentState.selectionEnd; - if (couldBeTypingAtOffset0 && previousValue.length > 0 && previousSelectionStart === previousSelectionEnd && currentSelectionStart === currentSelectionEnd) { - // See https://github.com/Microsoft/vscode/issues/42251 - // where typing always happens at offset 0 in the textarea - // when using a custom title area in OSX and moving the window - if (!strings.startsWith(currentValue, previousValue) && strings.endsWith(currentValue, previousValue)) { - // Looks like something was typed at offset 0 - // ==> pretend we placed the cursor at offset 0 to begin with... - previousSelectionStart = 0; - previousSelectionEnd = 0; - } - } - // Strip the previous suffix from the value (without interfering with the current selection) const previousSuffix = previousValue.substring(previousSelectionEnd); const currentSuffix = currentValue.substring(currentSelectionEnd); @@ -226,26 +214,24 @@ export class TextAreaState { } export class PagedScreenReaderStrategy { - private static readonly _LINES_PER_PAGE = 10; - - private static _getPageOfLine(lineNumber: number): number { - return Math.floor((lineNumber - 1) / PagedScreenReaderStrategy._LINES_PER_PAGE); + private static _getPageOfLine(lineNumber: number, linesPerPage: number): number { + return Math.floor((lineNumber - 1) / linesPerPage); } - private static _getRangeForPage(page: number): Range { - const offset = page * PagedScreenReaderStrategy._LINES_PER_PAGE; + private static _getRangeForPage(page: number, linesPerPage: number): Range { + const offset = page * linesPerPage; const startLineNumber = offset + 1; - const endLineNumber = offset + PagedScreenReaderStrategy._LINES_PER_PAGE; + const endLineNumber = offset + linesPerPage; return new Range(startLineNumber, 1, endLineNumber + 1, 1); } - public static fromEditorSelection(previousState: TextAreaState, model: ISimpleModel, selection: Range, trimLongText: boolean): TextAreaState { + public static fromEditorSelection(previousState: TextAreaState, model: ISimpleModel, selection: Range, linesPerPage: number, trimLongText: boolean): TextAreaState { - const selectionStartPage = PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber); - const selectionStartPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionStartPage); + const selectionStartPage = PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber, linesPerPage); + const selectionStartPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionStartPage, linesPerPage); - const selectionEndPage = PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber); - const selectionEndPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionEndPage); + const selectionEndPage = PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber, linesPerPage); + const selectionEndPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionEndPage, linesPerPage); const pretextRange = selectionStartPageRange.intersectRanges(new Range(1, 1, selection.startLineNumber, selection.startColumn))!; let pretext = model.getValueInRange(pretextRange, EndOfLinePreference.LF); diff --git a/src/vs/editor/browser/editorBrowser.ts b/src/vs/editor/browser/editorBrowser.ts index 50eed2efb08e5..85ee85e34f7ea 100644 --- a/src/vs/editor/browser/editorBrowser.ts +++ b/src/vs/editor/browser/editorBrowser.ts @@ -6,7 +6,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { IMouseEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { OverviewRulerPosition, ConfigurationChangedEvent, EditorLayoutInfo, IComputedEditorOptions, EditorOption, FindComputedEditorOptionValueById, IEditorOptions } from 'vs/editor/common/config/editorOptions'; +import { OverviewRulerPosition, ConfigurationChangedEvent, EditorLayoutInfo, IComputedEditorOptions, EditorOption, FindComputedEditorOptionValueById, IEditorOptions, IDiffEditorOptions } from 'vs/editor/common/config/editorOptions'; import { ICursors } from 'vs/editor/common/controller/cursorCommon'; import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { IPosition, Position } from 'vs/editor/common/core/position'; @@ -16,7 +16,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon'; import { IIdentifiedSingleEditOperation, IModelDecoration, IModelDeltaDecoration, ITextModel, ICursorStateComputer } from 'vs/editor/common/model'; import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelLanguageConfigurationChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents'; import { OverviewRulerZone } from 'vs/editor/common/view/overviewZoneManager'; -import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer'; +import { IEditorWhitespace } from 'vs/editor/common/viewLayout/linesLayout'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IDiffComputationResult } from 'vs/editor/common/services/editorWorkerService'; @@ -308,6 +308,14 @@ export interface IPartialEditorMouseEvent { readonly target: IMouseTarget | null; } +/** + * A paste event originating from the editor. + */ +export interface IPasteEvent { + readonly range: Range; + readonly mode: string | null; +} + /** * An overview ruler * @internal @@ -319,6 +327,14 @@ export interface IOverviewRuler { setLayout(position: OverviewRulerPosition): void; } +/** + * Editor aria options. + * @internal + */ +export interface IEditorAriaOptions { + activeDescendant: string | undefined; +} + /** * A rich code editor. */ @@ -408,11 +424,11 @@ export interface ICodeEditor extends editorCommon.IEditor { /** * An event emitted after composition has started. */ - onCompositionStart(listener: () => void): IDisposable; + onDidCompositionStart(listener: () => void): IDisposable; /** * An event emitted after composition has ended. */ - onCompositionEnd(listener: () => void): IDisposable; + onDidCompositionEnd(listener: () => void): IDisposable; /** * An event emitted when editing failed because the editor is read-only. * @event @@ -422,9 +438,8 @@ export interface ICodeEditor extends editorCommon.IEditor { /** * An event emitted when users paste text in the editor. * @event - * @internal */ - onDidPaste(listener: (range: Range) => void): IDisposable; + onDidPaste(listener: (e: IPasteEvent) => void): IDisposable; /** * An event emitted on a "mouseup". * @event @@ -483,6 +498,11 @@ export interface ICodeEditor extends editorCommon.IEditor { * @event */ onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; + /** + * An event emitted when the content width or content height in the editor has changed. + * @event + */ + onDidContentSizeChange(listener: (e: editorCommon.IContentSizeChangedEvent) => void): IDisposable; /** * An event emitted when the scroll in the editor has changed. * @event @@ -533,12 +553,12 @@ export interface ICodeEditor extends editorCommon.IEditor { setModel(model: ITextModel | null): void; /** - * @internal + * Gets all the editor computed options. */ getOptions(): IComputedEditorOptions; /** - * @internal + * Gets a specific editor option. */ getOption(id: T): FindComputedEditorOptionValueById; @@ -559,6 +579,11 @@ export interface ICodeEditor extends editorCommon.IEditor { */ setValue(newValue: string): void; + /** + * Get the width of the editor's content. + * This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)` + */ + getContentWidth(): number; /** * Get the scrollWidth of the editor's viewport. */ @@ -568,6 +593,11 @@ export interface ICodeEditor extends editorCommon.IEditor { */ getScrollLeft(): number; + /** + * Get the height of the editor's content. + * This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)` + */ + getContentHeight(): number; /** * Get the scrollHeight of the editor's viewport. */ @@ -690,11 +720,22 @@ export interface ICodeEditor extends editorCommon.IEditor { */ setHiddenAreas(ranges: IRange[]): void; + /** + * Sets the editor aria options, primarily the active descendent. + * @internal + */ + setAriaOptions(options: IEditorAriaOptions): void; + /** * @internal */ getTelemetryData(): { [key: string]: any } | undefined; + /** + * Returns the editor's container dom node + */ + getContainerDomNode(): HTMLElement; + /** * Returns the editor's dom node */ @@ -938,6 +979,11 @@ export interface IDiffEditor extends editorCommon.IEditor { * If the diff computation is not finished or the model is missing, will return null. */ getDiffLineInformationForModified(lineNumber: number): IDiffLineInformation | null; + + /** + * Update the editor's options after the editor has been created. + */ + updateOptions(newOptions: IDiffEditorOptions): void; } /** diff --git a/src/vs/editor/browser/editorDom.ts b/src/vs/editor/browser/editorDom.ts index 92357091f0861..4042ae8262c26 100644 --- a/src/vs/editor/browser/editorDom.ts +++ b/src/vs/editor/browser/editorDom.ts @@ -84,7 +84,7 @@ export class EditorMouseEvent extends StandardMouseEvent { } export interface EditorMouseEventMerger { - (lastEvent: EditorMouseEvent, currentEvent: EditorMouseEvent): EditorMouseEvent; + (lastEvent: EditorMouseEvent | null, currentEvent: EditorMouseEvent): EditorMouseEvent; } export class EditorMouseEventFactory { @@ -124,13 +124,51 @@ export class EditorMouseEventFactory { } public onMouseMoveThrottled(target: HTMLElement, callback: (e: EditorMouseEvent) => void, merger: EditorMouseEventMerger, minimumTimeMs: number): IDisposable { - const myMerger: dom.IEventMerger = (lastEvent: EditorMouseEvent, currentEvent: MouseEvent): EditorMouseEvent => { + const myMerger: dom.IEventMerger = (lastEvent: EditorMouseEvent | null, currentEvent: MouseEvent): EditorMouseEvent => { return merger(lastEvent, this._create(currentEvent)); }; return dom.addDisposableThrottledListener(target, 'mousemove', callback, myMerger, minimumTimeMs); } } +export class EditorPointerEventFactory { + + private readonly _editorViewDomNode: HTMLElement; + + constructor(editorViewDomNode: HTMLElement) { + this._editorViewDomNode = editorViewDomNode; + } + + private _create(e: MouseEvent): EditorMouseEvent { + return new EditorMouseEvent(e, this._editorViewDomNode); + } + + public onPointerUp(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable { + return dom.addDisposableListener(target, 'pointerup', (e: MouseEvent) => { + callback(this._create(e)); + }); + } + + public onPointerDown(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable { + return dom.addDisposableListener(target, 'pointerdown', (e: MouseEvent) => { + callback(this._create(e)); + }); + } + + public onPointerLeave(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable { + return dom.addDisposableNonBubblingPointerOutListener(target, (e: MouseEvent) => { + callback(this._create(e)); + }); + } + + public onPointerMoveThrottled(target: HTMLElement, callback: (e: EditorMouseEvent) => void, merger: EditorMouseEventMerger, minimumTimeMs: number): IDisposable { + const myMerger: dom.IEventMerger = (lastEvent: EditorMouseEvent | null, currentEvent: MouseEvent): EditorMouseEvent => { + return merger(lastEvent, this._create(currentEvent)); + }; + return dom.addDisposableThrottledListener(target, 'pointermove', callback, myMerger, minimumTimeMs); + } +} + export class GlobalEditorMouseMoveMonitor extends Disposable { private readonly _editorViewDomNode: HTMLElement; @@ -144,7 +182,13 @@ export class GlobalEditorMouseMoveMonitor extends Disposable { this._keydownListener = null; } - public startMonitoring(merger: EditorMouseEventMerger, mouseMoveCallback: (e: EditorMouseEvent) => void, onStopCallback: () => void): void { + public startMonitoring( + initialElement: HTMLElement, + initialButtons: number, + merger: EditorMouseEventMerger, + mouseMoveCallback: (e: EditorMouseEvent) => void, + onStopCallback: () => void + ): void { // Add a <> keydown event listener that will cancel the monitoring // if something other than a modifier key is pressed @@ -157,11 +201,11 @@ export class GlobalEditorMouseMoveMonitor extends Disposable { this._globalMouseMoveMonitor.stopMonitoring(true); }, true); - const myMerger: dom.IEventMerger = (lastEvent: EditorMouseEvent, currentEvent: MouseEvent): EditorMouseEvent => { + const myMerger: dom.IEventMerger = (lastEvent: EditorMouseEvent | null, currentEvent: MouseEvent): EditorMouseEvent => { return merger(lastEvent, new EditorMouseEvent(currentEvent, this._editorViewDomNode)); }; - this._globalMouseMoveMonitor.startMonitoring(myMerger, mouseMoveCallback, () => { + this._globalMouseMoveMonitor.startMonitoring(initialElement, initialButtons, myMerger, mouseMoveCallback, () => { this._keydownListener!.dispose(); onStopCallback(); }); diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 8f2d7c90482f3..f6d836aac53fb 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -16,11 +16,11 @@ 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 as InstantiationServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IConstructorSignature1, ServicesAccessor as InstantiationServicesAccessor, BrandedService } 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'; +import { withNullAsUndefined, assertType } from 'vs/base/common/types'; export type ServicesAccessor = InstantiationServicesAccessor; export type IEditorContributionCtor = IConstructorSignature1; @@ -42,7 +42,7 @@ export interface ICommandKeybindingsOptions extends IKeybindings { kbExpr?: ContextKeyExpr | null; weight: number; } -export interface ICommandMenubarOptions { +export interface ICommandMenuOptions { menuId: MenuId; group: string; order: number; @@ -54,36 +54,29 @@ export interface ICommandOptions { precondition: ContextKeyExpr | undefined; kbOpts?: ICommandKeybindingsOptions; description?: ICommandHandlerDescription; - menubarOpts?: ICommandMenubarOptions; + menuOpts?: ICommandMenuOptions | ICommandMenuOptions[]; } export abstract class Command { public readonly id: string; public readonly precondition: ContextKeyExpr | undefined; private readonly _kbOpts: ICommandKeybindingsOptions | undefined; - private readonly _menubarOpts: ICommandMenubarOptions | undefined; + private readonly _menuOpts: ICommandMenuOptions | ICommandMenuOptions[] | undefined; private readonly _description: ICommandHandlerDescription | undefined; constructor(opts: ICommandOptions) { this.id = opts.id; this.precondition = opts.precondition; this._kbOpts = opts.kbOpts; - this._menubarOpts = opts.menubarOpts; + this._menuOpts = opts.menuOpts; this._description = opts.description; } public register(): void { - if (this._menubarOpts) { - MenuRegistry.appendMenuItem(this._menubarOpts.menuId, { - group: this._menubarOpts.group, - command: { - id: this.id, - title: this._menubarOpts.title, - // precondition: this.precondition - }, - when: this._menubarOpts.when, - order: this._menubarOpts.order - }); + if (Array.isArray(this._menuOpts)) { + this._menuOpts.forEach(this._registerMenuItem, this); + } else if (this._menuOpts) { + this._registerMenuItem(this._menuOpts); } if (this._kbOpts) { @@ -119,6 +112,19 @@ export abstract class Command { } } + private _registerMenuItem(item: ICommandMenuOptions): void { + MenuRegistry.appendMenuItem(item.menuId, { + group: item.group, + command: { + id: this.id, + title: item.title, + // precondition: this.precondition + }, + when: item.when, + order: item.order + }); + } + public abstract runCommand(accessor: ServicesAccessor, args: any): void | Promise; } @@ -184,44 +190,59 @@ export abstract class EditorCommand extends Command { //#region EditorAction -export interface IEditorCommandMenuOptions { +export interface IEditorActionContextMenuOptions { group: string; order: number; when?: ContextKeyExpr; + menuId?: MenuId; } export interface IActionOptions extends ICommandOptions { label: string; alias: string; - menuOpts?: IEditorCommandMenuOptions; + contextMenuOpts?: IEditorActionContextMenuOptions | IEditorActionContextMenuOptions[]; } + export abstract class EditorAction extends EditorCommand { + private static convertOptions(opts: IActionOptions): ICommandOptions { + + let menuOpts: ICommandMenuOptions[]; + if (Array.isArray(opts.menuOpts)) { + menuOpts = opts.menuOpts; + } else if (opts.menuOpts) { + menuOpts = [opts.menuOpts]; + } else { + menuOpts = []; + } + + function withDefaults(item: Partial): ICommandMenuOptions { + if (!item.menuId) { + item.menuId = MenuId.EditorContext; + } + if (!item.title) { + item.title = opts.label; + } + item.when = ContextKeyExpr.and(opts.precondition, item.when); + return item; + } + + if (Array.isArray(opts.contextMenuOpts)) { + menuOpts.push(...opts.contextMenuOpts.map(withDefaults)); + } else if (opts.contextMenuOpts) { + menuOpts.push(withDefaults(opts.contextMenuOpts)); + } + + opts.menuOpts = menuOpts; + return opts; + } + public readonly label: string; public readonly alias: string; - private readonly menuOpts: IEditorCommandMenuOptions | undefined; constructor(opts: IActionOptions) { - super(opts); + super(EditorAction.convertOptions(opts)); this.label = opts.label; this.alias = opts.alias; - this.menuOpts = opts.menuOpts; - } - - public register(): void { - - if (this.menuOpts) { - MenuRegistry.appendMenuItem(MenuId.EditorContext, { - command: { - id: this.id, - title: this.label - }, - when: ContextKeyExpr.and(this.precondition, this.menuOpts.when), - group: this.menuOpts.group, - order: this.menuOpts.order - }); - } - - super.register(); } public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise { @@ -290,6 +311,60 @@ export function registerDefaultLanguageCommand(id: string, handler: (model: ITex }); } +export function registerModelAndPositionCommand(id: string, handler: (model: ITextModel, position: Position, ...args: any[]) => any) { + CommandsRegistry.registerCommand(id, function (accessor, ...args) { + + const [resource, position] = args; + assertType(URI.isUri(resource)); + assertType(Position.isIPosition(position)); + + const model = accessor.get(IModelService).getModel(resource); + if (model) { + const editorPosition = Position.lift(position); + return handler(model, editorPosition, args.slice(2)); + } + + return accessor.get(ITextModelService).createModelReference(resource).then(reference => { + return new Promise((resolve, reject) => { + try { + const result = handler(reference.object.textEditorModel, Position.lift(position), args.slice(2)); + resolve(result); + } catch (err) { + reject(err); + } + }).finally(() => { + reference.dispose(); + }); + }); + }); +} + +export function registerModelCommand(id: string, handler: (model: ITextModel, ...args: any[]) => any) { + CommandsRegistry.registerCommand(id, function (accessor, ...args) { + + const [resource] = args; + assertType(URI.isUri(resource)); + + const model = accessor.get(IModelService).getModel(resource); + if (model) { + return handler(model, args.slice(1)); + } + + return accessor.get(ITextModelService).createModelReference(resource).then(reference => { + return new Promise((resolve, reject) => { + try { + const result = handler(reference.object.textEditorModel, args.slice(1)); + resolve(result); + } catch (err) { + reject(err); + } + }).finally(() => { + reference.dispose(); + }); + }); + }); +} + export function registerEditorCommand(editorCommand: T): T { EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand); return editorCommand; @@ -303,11 +378,11 @@ export function registerInstantiatedEditorAction(editorAction: EditorAction): vo EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction); } -export function registerEditorContribution(id: string, ctor: IEditorContributionCtor): void { +export function registerEditorContribution(id: string, ctor: { new(editor: ICodeEditor, ...services: Services): IEditorContribution }): void { EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor); } -export function registerDiffEditorContribution(id: string, ctor: IDiffEditorContributionCtor): void { +export function registerDiffEditorContribution(id: string, ctor: { new(editor: IDiffEditor, ...services: Services): IEditorContribution }): void { EditorContributionRegistry.INSTANCE.registerDiffEditorContribution(id, ctor); } @@ -355,16 +430,16 @@ class EditorContributionRegistry { this.editorCommands = Object.create(null); } - public registerEditorContribution(id: string, ctor: IEditorContributionCtor): void { - this.editorContributions.push({ id, ctor }); + public registerEditorContribution(id: string, ctor: { new(editor: ICodeEditor, ...services: Services): IEditorContribution }): void { + this.editorContributions.push({ id, ctor: ctor as IEditorContributionCtor }); } public getEditorContributions(): IEditorContributionDescription[] { return this.editorContributions.slice(0); } - public registerDiffEditorContribution(id: string, ctor: IDiffEditorContributionCtor): void { - this.diffEditorContributions.push({ id, ctor }); + public registerDiffEditorContribution(id: string, ctor: { new(editor: IDiffEditor, ...services: Services): IEditorContribution }): void { + this.diffEditorContributions.push({ id, ctor: ctor as IDiffEditorContributionCtor }); } public getDiffEditorContributions(): IDiffEditorContributionDescription[] { diff --git a/src/vs/editor/browser/services/abstractCodeEditorService.ts b/src/vs/editor/browser/services/abstractCodeEditorService.ts index 53c5bac6f2817..bb96485db3e5f 100644 --- a/src/vs/editor/browser/services/abstractCodeEditorService.ts +++ b/src/vs/editor/browser/services/abstractCodeEditorService.ts @@ -89,7 +89,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC return editorWithWidgetFocus; } - abstract registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void; + abstract registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string, editor?: ICodeEditor): void; abstract removeDecorationType(key: string): void; abstract resolveDecorationOptions(decorationTypeKey: string | undefined, writable: boolean): IModelDecorationOptions; @@ -120,6 +120,16 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC return this._transientWatchers[uri].get(key); } + public getTransientModelProperties(model: ITextModel): [string, any][] | undefined { + const uri = model.uri.toString(); + + if (!this._transientWatchers.hasOwnProperty(uri)) { + return undefined; + } + + return this._transientWatchers[uri].keys().map(key => [key, this._transientWatchers[uri].get(key)]); + } + _removeWatcher(w: ModelTransientSettingWatcher): void { delete this._transientWatchers[w.uri]; } @@ -145,4 +155,8 @@ export class ModelTransientSettingWatcher { public get(key: string): any { return this._values[key]; } + + public keys(): string[] { + return Object.keys(this._values); + } } diff --git a/src/vs/editor/browser/services/bulkEditService.ts b/src/vs/editor/browser/services/bulkEditService.ts index ada4ed7b23d2b..3d18020da6fdc 100644 --- a/src/vs/editor/browser/services/bulkEditService.ts +++ b/src/vs/editor/browser/services/bulkEditService.ts @@ -7,22 +7,30 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { WorkspaceEdit } from 'vs/editor/common/modes'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IProgress, IProgressStep } from 'vs/platform/progress/common/progress'; +import { IDisposable } from 'vs/base/common/lifecycle'; export const IBulkEditService = createDecorator('IWorkspaceEditService'); - export interface IBulkEditOptions { editor?: ICodeEditor; progress?: IProgress; + showPreview?: boolean; + label?: string; } export interface IBulkEditResult { ariaSummary: string; } +export type IBulkEditPreviewHandler = (edit: WorkspaceEdit, options?: IBulkEditOptions) => Promise; + export interface IBulkEditService { _serviceBrand: undefined; + hasPreviewHandler(): boolean; + + setPreviewHandler(handler: IBulkEditPreviewHandler): IDisposable; + apply(edit: WorkspaceEdit, options?: IBulkEditOptions): Promise; } diff --git a/src/vs/editor/browser/services/codeEditorService.ts b/src/vs/editor/browser/services/codeEditorService.ts index 0cfba7fd7fbb0..145cb9d2641d1 100644 --- a/src/vs/editor/browser/services/codeEditorService.ts +++ b/src/vs/editor/browser/services/codeEditorService.ts @@ -37,12 +37,13 @@ export interface ICodeEditorService { */ getFocusedCodeEditor(): ICodeEditor | null; - registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void; + registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string, editor?: ICodeEditor): void; removeDecorationType(key: string): void; resolveDecorationOptions(typeKey: string, writable: boolean): IModelDecorationOptions; setTransientModelProperty(model: ITextModel, key: string, value: any): void; getTransientModelProperty(model: ITextModel, key: string): any; + getTransientModelProperties(model: ITextModel): [string, any][] | undefined; getActiveCodeEditor(): ICodeEditor | null; openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise; diff --git a/src/vs/editor/browser/services/codeEditorServiceImpl.ts b/src/vs/editor/browser/services/codeEditorServiceImpl.ts index c7cf1da3f4535..944a6d0f20fa0 100644 --- a/src/vs/editor/browser/services/codeEditorServiceImpl.ts +++ b/src/vs/editor/browser/services/codeEditorServiceImpl.ts @@ -14,31 +14,101 @@ import { IModelDecorationOptions, IModelDecorationOverviewRulerOptions, Overview import { IResourceInput } from 'vs/platform/editor/common/editor'; import { ITheme, IThemeService, ThemeColor } from 'vs/platform/theme/common/themeService'; +class RefCountedStyleSheet { + + private readonly _parent: CodeEditorServiceImpl; + private readonly _editorId: string; + public readonly styleSheet: HTMLStyleElement; + private _refCount: number; + + constructor(parent: CodeEditorServiceImpl, editorId: string, styleSheet: HTMLStyleElement) { + this._parent = parent; + this._editorId = editorId; + this.styleSheet = styleSheet; + this._refCount = 0; + } + + public ref(): void { + this._refCount++; + } + + public unref(): void { + this._refCount--; + if (this._refCount === 0) { + this.styleSheet.parentNode?.removeChild(this.styleSheet); + this._parent._removeEditorStyleSheets(this._editorId); + } + } +} + +class GlobalStyleSheet { + public readonly styleSheet: HTMLStyleElement; + + constructor(styleSheet: HTMLStyleElement) { + this.styleSheet = styleSheet; + } + + public ref(): void { + } + + public unref(): void { + } +} + export abstract class CodeEditorServiceImpl extends AbstractCodeEditorService { - private readonly _styleSheet: HTMLStyleElement; + private _globalStyleSheet: GlobalStyleSheet | null; private readonly _decorationOptionProviders = new Map(); + private readonly _editorStyleSheets = new Map(); private readonly _themeService: IThemeService; - constructor(@IThemeService themeService: IThemeService, styleSheet = dom.createStyleSheet()) { + constructor(@IThemeService themeService: IThemeService, styleSheet: HTMLStyleElement | null = null) { super(); - this._styleSheet = styleSheet; + this._globalStyleSheet = styleSheet ? new GlobalStyleSheet(styleSheet) : null; this._themeService = themeService; } - public registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void { + private _getOrCreateGlobalStyleSheet(): GlobalStyleSheet { + if (!this._globalStyleSheet) { + this._globalStyleSheet = new GlobalStyleSheet(dom.createStyleSheet()); + } + return this._globalStyleSheet; + } + + private _getOrCreateStyleSheet(editor: ICodeEditor | undefined): GlobalStyleSheet | RefCountedStyleSheet { + if (!editor) { + return this._getOrCreateGlobalStyleSheet(); + } + const domNode = editor.getContainerDomNode(); + if (!dom.isInShadowDOM(domNode)) { + return this._getOrCreateGlobalStyleSheet(); + } + const editorId = editor.getId(); + if (!this._editorStyleSheets.has(editorId)) { + const refCountedStyleSheet = new RefCountedStyleSheet(this, editorId, dom.createStyleSheet(domNode)); + this._editorStyleSheets.set(editorId, refCountedStyleSheet); + } + return this._editorStyleSheets.get(editorId)!; + } + + _removeEditorStyleSheets(editorId: string): void { + this._editorStyleSheets.delete(editorId); + } + + public registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string, editor?: ICodeEditor): void { let provider = this._decorationOptionProviders.get(key); if (!provider) { + const styleSheet = this._getOrCreateStyleSheet(editor); const providerArgs: ProviderArguments = { - styleSheet: this._styleSheet, + styleSheet: styleSheet.styleSheet, key: key, parentTypeKey: parentTypeKey, options: options || Object.create(null) }; if (!parentTypeKey) { - provider = new DecorationTypeOptionsProvider(this._themeService, providerArgs); + provider = new DecorationTypeOptionsProvider(this._themeService, styleSheet, providerArgs); } else { - provider = new DecorationSubTypeOptionsProvider(this._themeService, providerArgs); + provider = new DecorationSubTypeOptionsProvider(this._themeService, styleSheet, providerArgs); } this._decorationOptionProviders.set(key, provider); } @@ -76,13 +146,16 @@ interface IModelDecorationOptionsProvider extends IDisposable { class DecorationSubTypeOptionsProvider implements IModelDecorationOptionsProvider { + private readonly _styleSheet: GlobalStyleSheet | RefCountedStyleSheet; public refCount: number; private readonly _parentTypeKey: string | undefined; private _beforeContentRules: DecorationCSSRules | null; private _afterContentRules: DecorationCSSRules | null; - constructor(themeService: IThemeService, providerArgs: ProviderArguments) { + constructor(themeService: IThemeService, styleSheet: GlobalStyleSheet | RefCountedStyleSheet, providerArgs: ProviderArguments) { + this._styleSheet = styleSheet; + this._styleSheet.ref(); this._parentTypeKey = providerArgs.parentTypeKey; this.refCount = 0; @@ -110,6 +183,7 @@ class DecorationSubTypeOptionsProvider implements IModelDecorationOptionsProvide this._afterContentRules.dispose(); this._afterContentRules = null; } + this._styleSheet.unref(); } } @@ -124,6 +198,7 @@ interface ProviderArguments { class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider { private readonly _disposables = new DisposableStore(); + private readonly _styleSheet: GlobalStyleSheet | RefCountedStyleSheet; public refCount: number; public className: string | undefined; @@ -136,7 +211,9 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider { public overviewRuler: IModelDecorationOverviewRulerOptions | undefined; public stickiness: TrackedRangeStickiness | undefined; - constructor(themeService: IThemeService, providerArgs: ProviderArguments) { + constructor(themeService: IThemeService, styleSheet: GlobalStyleSheet | RefCountedStyleSheet, providerArgs: ProviderArguments) { + this._styleSheet = styleSheet; + this._styleSheet.ref(); this.refCount = 0; const createCSSRules = (type: ModelDecorationCSSRuleType) => { @@ -202,6 +279,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider { public dispose(): void { this._disposables.dispose(); + this._styleSheet.unref(); } } diff --git a/src/vs/editor/browser/services/openerService.ts b/src/vs/editor/browser/services/openerService.ts index 48175adfb4272..4dfb00355226b 100644 --- a/src/vs/editor/browser/services/openerService.ts +++ b/src/vs/editor/browser/services/openerService.ts @@ -4,58 +4,145 @@ *--------------------------------------------------------------------------------------------*/ import * as dom from 'vs/base/browser/dom'; -import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; +import { IDisposable } from 'vs/base/common/lifecycle'; import { LinkedList } from 'vs/base/common/linkedList'; import { parse } from 'vs/base/common/marshalling'; import { Schemas } from 'vs/base/common/network'; -import * as resources from 'vs/base/common/resources'; -import { equalsIgnoreCase } from 'vs/base/common/strings'; +import { normalizePath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; -import { IOpener, IOpenerService, IValidator, IExternalUriResolver, OpenOptions, ResolveExternalUriOptions, IResolvedExternalUri, IExternalOpener } from 'vs/platform/opener/common/opener'; +import { IOpener, IOpenerService, IValidator, IExternalUriResolver, OpenOptions, ResolveExternalUriOptions, IResolvedExternalUri, IExternalOpener, matchesScheme } from 'vs/platform/opener/common/opener'; import { EditorOpenContext } from 'vs/platform/editor/common/editor'; -export class OpenerService extends Disposable implements IOpenerService { + +class CommandOpener implements IOpener { + + constructor(@ICommandService private readonly _commandService: ICommandService) { } + + async open(target: URI | string) { + if (!matchesScheme(target, Schemas.command)) { + return false; + } + // run command or bail out if command isn't known + if (typeof target === 'string') { + target = URI.parse(target); + } + if (!CommandsRegistry.getCommand(target.path)) { + throw new Error(`command '${target.path}' NOT known`); + } + // execute as command + let args: any = []; + try { + args = parse(decodeURIComponent(target.query)); + } catch { + // ignore and retry + try { + args = parse(target.query); + } catch { + // ignore error + } + } + if (!Array.isArray(args)) { + args = [args]; + } + await this._commandService.executeCommand(target.path, ...args); + return true; + } +} + +class EditorOpener implements IOpener { + + constructor(@ICodeEditorService private readonly _editorService: ICodeEditorService) { } + + async open(target: URI | string, options: OpenOptions) { + if (typeof target === 'string') { + target = URI.parse(target); + } + let selection: { startLineNumber: number; startColumn: number; } | undefined = undefined; + const match = /^L?(\d+)(?:,(\d+))?/.exec(target.fragment); + if (match) { + // support file:///some/file.js#73,84 + // support file:///some/file.js#L73 + selection = { + startLineNumber: parseInt(match[1]), + startColumn: match[2] ? parseInt(match[2]) : 1 + }; + // remove fragment + target = target.with({ fragment: '' }); + } + + if (target.scheme === Schemas.file) { + target = normalizePath(target); // workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954) + } + + await this._editorService.openCodeEditor( + { resource: target, options: { selection, context: options?.fromUserGesture ? EditorOpenContext.USER : EditorOpenContext.API } }, + this._editorService.getFocusedCodeEditor(), + options?.openToSide + ); + + return true; + } +} + +export class OpenerService implements IOpenerService { _serviceBrand: undefined; private readonly _openers = new LinkedList(); private readonly _validators = new LinkedList(); private readonly _resolvers = new LinkedList(); + private _externalOpener: IExternalOpener; constructor( - @ICodeEditorService private readonly _editorService: ICodeEditorService, - @ICommandService private readonly _commandService: ICommandService, + @ICodeEditorService editorService: ICodeEditorService, + @ICommandService commandService: ICommandService, ) { - super(); - // Default external opener is going through window.open() this._externalOpener = { openExternal: href => { - dom.windowOpenNoOpener(href); - + // ensure to open HTTP/HTTPS links into new windows + // to not trigger a navigation. Any other link is + // safe to be set as HREF to prevent a blank window + // from opening. + if (matchesScheme(href, Schemas.http) || matchesScheme(href, Schemas.https)) { + dom.windowOpenNoOpener(href); + } else { + window.location.href = href; + } return Promise.resolve(true); } }; + + // Default opener: maito, http(s), command, and catch-all-editors + this._openers.push({ + open: async (target: URI | string, options?: OpenOptions) => { + if (options?.openExternal || matchesScheme(target, Schemas.mailto) || matchesScheme(target, Schemas.http) || matchesScheme(target, Schemas.https)) { + // open externally + await this._doOpenExternal(target, options); + return true; + } + return false; + } + }); + this._openers.push(new CommandOpener(commandService)); + this._openers.push(new EditorOpener(editorService)); } registerOpener(opener: IOpener): IDisposable { - const remove = this._openers.push(opener); - + const remove = this._openers.unshift(opener); return { dispose: remove }; } registerValidator(validator: IValidator): IDisposable { const remove = this._validators.push(validator); - return { dispose: remove }; } registerExternalUriResolver(resolver: IExternalUriResolver): IDisposable { const remove = this._resolvers.push(resolver); - return { dispose: remove }; } @@ -63,30 +150,24 @@ export class OpenerService extends Disposable implements IOpenerService { this._externalOpener = externalOpener; } - async open(resource: URI, options?: OpenOptions): Promise { - - // no scheme ?!? - if (!resource.scheme) { - return Promise.resolve(false); - } + async open(target: URI | string, options?: OpenOptions): Promise { // check with contributed validators for (const validator of this._validators.toArray()) { - if (!(await validator.shouldOpen(resource))) { + if (!(await validator.shouldOpen(target))) { return false; } } // check with contributed openers for (const opener of this._openers.toArray()) { - const handled = await opener.open(resource, options); + const handled = await opener.open(target, options); if (handled) { return true; } } - // use default openers - return this._doOpen(resource, options); + return false; } async resolveExternalUri(resource: URI, options?: ResolveExternalUriOptions): Promise { @@ -100,68 +181,19 @@ export class OpenerService extends Disposable implements IOpenerService { return { resolved: resource, dispose: () => { } }; } - private async _doOpen(resource: URI, options: OpenOptions | undefined): Promise { - const { scheme, path, query, fragment } = resource; - - if (options?.openExternal || equalsIgnoreCase(scheme, Schemas.mailto) || equalsIgnoreCase(scheme, Schemas.http) || equalsIgnoreCase(scheme, Schemas.https)) { - // open externally - return this._doOpenExternal(resource, options); - } - - if (equalsIgnoreCase(scheme, Schemas.command)) { - // run command or bail out if command isn't known - if (!CommandsRegistry.getCommand(path)) { - throw new Error(`command '${path}' NOT known`); - } - // execute as command - let args: any = []; - try { - args = parse(query); - if (!Array.isArray(args)) { - args = [args]; - } - } catch (e) { - // ignore error - } - - await this._commandService.executeCommand(path, ...args); - - return true; - } + private async _doOpenExternal(resource: URI | string, options: OpenOptions | undefined): Promise { - // finally open in editor - let selection: { startLineNumber: number; startColumn: number; } | undefined = undefined; - const match = /^L?(\d+)(?:,(\d+))?/.exec(fragment); - if (match) { - // support file:///some/file.js#73,84 - // support file:///some/file.js#L73 - selection = { - startLineNumber: parseInt(match[1]), - startColumn: match[2] ? parseInt(match[2]) : 1 - }; - // remove fragment - resource = resource.with({ fragment: '' }); - } + //todo@joh IExternalUriResolver should support `uri: URI | string` + const uri = typeof resource === 'string' ? URI.parse(resource) : resource; + const { resolved } = await this.resolveExternalUri(uri, options); - if (resource.scheme === Schemas.file) { - resource = resources.normalizePath(resource); // workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954) + if (typeof resource === 'string' && uri.toString() === resolved.toString()) { + // open the url-string AS IS + return this._externalOpener.openExternal(resource); + } else { + // open URI using the toString(noEncode)+encodeURI-trick + return this._externalOpener.openExternal(encodeURI(resolved.toString(true))); } - - await this._editorService.openCodeEditor( - { resource, options: { selection, context: options?.fromUserGesture ? EditorOpenContext.USER : EditorOpenContext.API } }, - this._editorService.getFocusedCodeEditor(), - options?.openToSide - ); - - return true; - } - - private async _doOpenExternal(resource: URI, options: OpenOptions | undefined): Promise { - const { resolved } = await this.resolveExternalUri(resource, options); - - // TODO@Jo neither encodeURI nor toString(true) should be needed - // once we go with URL and not URI - return this._externalOpener.openExternal(encodeURI(resolved.toString(true))); } dispose() { diff --git a/src/vs/editor/browser/view/domLineBreaksComputer.ts b/src/vs/editor/browser/view/domLineBreaksComputer.ts new file mode 100644 index 0000000000000..81611253b0158 --- /dev/null +++ b/src/vs/editor/browser/view/domLineBreaksComputer.ts @@ -0,0 +1,302 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { ILineBreaksComputerFactory, LineBreakData, ILineBreaksComputer } from 'vs/editor/common/viewModel/splitLinesCollection'; +import { WrappingIndent } from 'vs/editor/common/config/editorOptions'; +import { FontInfo } from 'vs/editor/common/config/fontInfo'; +import { createStringBuilder, IStringBuilder } from 'vs/editor/common/core/stringBuilder'; +import { CharCode } from 'vs/base/common/charCode'; +import * as strings from 'vs/base/common/strings'; +import { Configuration } from 'vs/editor/browser/config/configuration'; + +export class DOMLineBreaksComputerFactory implements ILineBreaksComputerFactory { + + public static create(): DOMLineBreaksComputerFactory { + return new DOMLineBreaksComputerFactory(); + } + + constructor() { + } + + public createLineBreaksComputer(fontInfo: FontInfo, tabSize: number, wrappingColumn: number, wrappingIndent: WrappingIndent): ILineBreaksComputer { + tabSize = tabSize | 0; //@perf + wrappingColumn = +wrappingColumn; //@perf + + let requests: string[] = []; + return { + addRequest: (lineText: string, previousLineBreakData: LineBreakData | null) => { + requests.push(lineText); + }, + finalize: () => { + return createLineBreaks(requests, fontInfo, tabSize, wrappingColumn, wrappingIndent); + } + }; + } +} + +function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: number, firstLineBreakColumn: number, wrappingIndent: WrappingIndent): (LineBreakData | null)[] { + if (firstLineBreakColumn === -1) { + const result: null[] = []; + for (let i = 0, len = requests.length; i < len; i++) { + result[i] = null; + } + return result; + } + + const overallWidth = Math.round(firstLineBreakColumn * fontInfo.typicalHalfwidthCharacterWidth); + + // Cannot respect WrappingIndent.Indent and WrappingIndent.DeepIndent because that would require + // two dom layouts, in order to first set the width of the first line, and then set the width of the wrapped lines + if (wrappingIndent === WrappingIndent.Indent || wrappingIndent === WrappingIndent.DeepIndent) { + wrappingIndent = WrappingIndent.Same; + } + + const containerDomNode = document.createElement('div'); + Configuration.applyFontInfoSlow(containerDomNode, fontInfo); + + const sb = createStringBuilder(10000); + const firstNonWhitespaceIndices: number[] = []; + const wrappedTextIndentLengths: number[] = []; + const renderLineContents: string[] = []; + const allCharOffsets: number[][] = []; + const allVisibleColumns: number[][] = []; + for (let i = 0; i < requests.length; i++) { + const lineContent = requests[i]; + + let firstNonWhitespaceIndex = 0; + let wrappedTextIndentLength = 0; + let width = overallWidth; + + if (wrappingIndent !== WrappingIndent.None) { + firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent); + if (firstNonWhitespaceIndex === -1) { + // all whitespace line + firstNonWhitespaceIndex = 0; + + } else { + // Track existing indent + + for (let i = 0; i < firstNonWhitespaceIndex; i++) { + const charWidth = ( + lineContent.charCodeAt(i) === CharCode.Tab + ? (tabSize - (wrappedTextIndentLength % tabSize)) + : 1 + ); + wrappedTextIndentLength += charWidth; + } + + const indentWidth = Math.ceil(fontInfo.spaceWidth * wrappedTextIndentLength); + + // Force sticking to beginning of line if no character would fit except for the indentation + if (indentWidth + fontInfo.typicalFullwidthCharacterWidth > overallWidth) { + firstNonWhitespaceIndex = 0; + wrappedTextIndentLength = 0; + } else { + width = overallWidth - indentWidth; + } + } + } + + const renderLineContent = lineContent.substr(firstNonWhitespaceIndex); + const tmp = renderLine(renderLineContent, wrappedTextIndentLength, tabSize, width, sb); + firstNonWhitespaceIndices[i] = firstNonWhitespaceIndex; + wrappedTextIndentLengths[i] = wrappedTextIndentLength; + renderLineContents[i] = renderLineContent; + allCharOffsets[i] = tmp[0]; + allVisibleColumns[i] = tmp[1]; + } + containerDomNode.innerHTML = sb.build(); + + containerDomNode.style.position = 'absolute'; + containerDomNode.style.top = '10000'; + containerDomNode.style.wordWrap = 'break-word'; + document.body.appendChild(containerDomNode); + + let range = document.createRange(); + const lineDomNodes = Array.prototype.slice.call(containerDomNode.children, 0); + + let result: (LineBreakData | null)[] = []; + for (let i = 0; i < requests.length; i++) { + const lineDomNode = lineDomNodes[i]; + const breakOffsets: number[] | null = readLineBreaks(range, lineDomNode, renderLineContents[i], allCharOffsets[i]); + if (breakOffsets === null) { + result[i] = null; + continue; + } + + const firstNonWhitespaceIndex = firstNonWhitespaceIndices[i]; + const wrappedTextIndentLength = wrappedTextIndentLengths[i]; + const visibleColumns = allVisibleColumns[i]; + + const breakOffsetsVisibleColumn: number[] = []; + for (let j = 0, len = breakOffsets.length; j < len; j++) { + breakOffsetsVisibleColumn[j] = visibleColumns[breakOffsets[j]]; + } + + if (firstNonWhitespaceIndex !== 0) { + // All break offsets are relative to the renderLineContent, make them absolute again + for (let j = 0, len = breakOffsets.length; j < len; j++) { + breakOffsets[j] += firstNonWhitespaceIndex; + } + } + + result[i] = new LineBreakData(breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength); + } + + document.body.removeChild(containerDomNode); + return result; +} + +const enum Constants { + SPAN_MODULO_LIMIT = 16384 +} + +function renderLine(lineContent: string, initialVisibleColumn: number, tabSize: number, width: number, sb: IStringBuilder): [number[], number[]] { + sb.appendASCIIString('
'); + // if (containsRTL) { + // sb.appendASCIIString('" dir="ltr'); + // } + + const len = lineContent.length; + let visibleColumn = initialVisibleColumn; + let charOffset = 0; + let charOffsets: number[] = []; + let visibleColumns: number[] = []; + let nextCharCode = (0 < len ? lineContent.charCodeAt(0) : CharCode.Null); + + sb.appendASCIIString(''); + for (let charIndex = 0; charIndex < len; charIndex++) { + if (charIndex !== 0 && charIndex % Constants.SPAN_MODULO_LIMIT === 0) { + sb.appendASCIIString(''); + } + charOffsets[charIndex] = charOffset; + visibleColumns[charIndex] = visibleColumn; + const charCode = nextCharCode; + nextCharCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : CharCode.Null); + let producedCharacters = 1; + let charWidth = 1; + switch (charCode) { + case CharCode.Tab: + producedCharacters = (tabSize - (visibleColumn % tabSize)); + charWidth = producedCharacters; + for (let space = 1; space <= producedCharacters; space++) { + if (space < producedCharacters) { + sb.write1(0xA0); //   + } else { + sb.appendASCII(CharCode.Space); + } + } + break; + + case CharCode.Space: + if (nextCharCode === CharCode.Space) { + sb.write1(0xA0); //   + } else { + sb.appendASCII(CharCode.Space); + } + break; + + case CharCode.LessThan: + sb.appendASCIIString('<'); + break; + + case CharCode.GreaterThan: + sb.appendASCIIString('>'); + break; + + case CharCode.Ampersand: + sb.appendASCIIString('&'); + break; + + case CharCode.Null: + sb.appendASCIIString('�'); + break; + + case CharCode.UTF8_BOM: + case CharCode.LINE_SEPARATOR_2028: + sb.write1(0xFFFD); + break; + + default: + if (strings.isFullWidthCharacter(charCode)) { + charWidth++; + } + // if (renderControlCharacters && charCode < 32) { + // sb.write1(9216 + charCode); + // } else { + sb.write1(charCode); + // } + } + + charOffset += producedCharacters; + visibleColumn += charWidth; + } + sb.appendASCIIString(''); + + charOffsets[lineContent.length] = charOffset; + visibleColumns[lineContent.length] = visibleColumn; + + sb.appendASCIIString('
'); + + return [charOffsets, visibleColumns]; +} + +function readLineBreaks(range: Range, lineDomNode: HTMLDivElement, lineContent: string, charOffsets: number[]): number[] | null { + if (lineContent.length <= 1) { + return null; + } + const spans = Array.prototype.slice.call(lineDomNode.children, 0); + + const breakOffsets: number[] = []; + try { + discoverBreaks(range, spans, charOffsets, 0, null, lineContent.length - 1, null, breakOffsets); + } catch (err) { + console.log(err); + return null; + } + + if (breakOffsets.length === 0) { + return null; + } + + breakOffsets.push(lineContent.length); + return breakOffsets; +} + +type MaybeRects = ClientRectList | DOMRectList | null; + +function discoverBreaks(range: Range, spans: HTMLSpanElement[], charOffsets: number[], low: number, lowRects: MaybeRects, high: number, highRects: MaybeRects, result: number[]): void { + if (low === high) { + return; + } + + lowRects = lowRects || readClientRect(range, spans, charOffsets[low], charOffsets[low + 1]); + highRects = highRects || readClientRect(range, spans, charOffsets[high], charOffsets[high + 1]); + + if (Math.abs(lowRects[0].top - highRects[0].top) <= 0.1) { + // same line + return; + } + + // there is at least one line break between these two offsets + if (low + 1 === high) { + // the two characters are adjacent, so the line break must be exactly between them + result.push(high); + return; + } + + const mid = low + ((high - low) / 2) | 0; + const midRects = readClientRect(range, spans, charOffsets[mid], charOffsets[mid + 1]); + discoverBreaks(range, spans, charOffsets, low, lowRects, mid, midRects, result); + discoverBreaks(range, spans, charOffsets, mid, midRects, high, highRects, result); +} + +function readClientRect(range: Range, spans: HTMLSpanElement[], startOffset: number, endOffset: number): ClientRectList | DOMRectList { + range.setStart(spans[(startOffset / Constants.SPAN_MODULO_LIMIT) | 0].firstChild!, startOffset % Constants.SPAN_MODULO_LIMIT); + range.setEnd(spans[(endOffset / Constants.SPAN_MODULO_LIMIT) | 0].firstChild!, endOffset % Constants.SPAN_MODULO_LIMIT); + return range.getClientRects(); +} diff --git a/src/vs/editor/browser/view/viewController.ts b/src/vs/editor/browser/view/viewController.ts index 9057fdfbe2252..d99af7b2b6648 100644 --- a/src/vs/editor/browser/view/viewController.ts +++ b/src/vs/editor/browser/view/viewController.ts @@ -37,7 +37,7 @@ export interface IMouseDispatchData { export interface ICommandDelegate { executeEditorCommand(editorCommand: CoreEditorCommand, args: any): void; - paste(source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null): void; + paste(source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null, mode: string | null): void; type(source: string, text: string): void; replacePreviousChar(source: string, text: string, replaceCharCnt: number): void; compositionStart(source: string): void; @@ -69,8 +69,8 @@ export class ViewController { this.commandDelegate.executeEditorCommand(editorCommand, args); } - public paste(source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null): void { - this.commandDelegate.paste(source, text, pasteOnNewLine, multicursorText); + public paste(source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null, mode: string | null): void { + this.commandDelegate.paste(source, text, pasteOnNewLine, multicursorText, mode); } public type(source: string, text: string): void { @@ -133,7 +133,9 @@ export class ViewController { } public dispatchMouse(data: IMouseDispatchData): void { - const selectionClipboardIsOn = (platform.isLinux && this.configuration.options.get(EditorOption.selectionClipboard)); + const options = this.configuration.options; + const selectionClipboardIsOn = (platform.isLinux && options.get(EditorOption.selectionClipboard)); + const columnSelection = options.get(EditorOption.columnSelection); if (data.middleButton && !selectionClipboardIsOn) { this._columnSelect(data.position, data.mouseColumn, data.inSelectionMode); } else if (data.startedOnLineNumbers) { @@ -196,7 +198,11 @@ export class ViewController { if (data.altKey) { this._columnSelect(data.position, data.mouseColumn, true); } else { - this._moveToSelect(data.position); + if (columnSelection) { + this._columnSelect(data.position, data.mouseColumn, true); + } else { + this._moveToSelect(data.position); + } } } else { this.moveTo(data.position); diff --git a/src/vs/editor/browser/view/viewImpl.ts b/src/vs/editor/browser/view/viewImpl.ts index 42ef1f6f5425c..30971b52388ef 100644 --- a/src/vs/editor/browser/view/viewImpl.ts +++ b/src/vs/editor/browser/view/viewImpl.ts @@ -11,7 +11,7 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import { IPointerHandlerHelper } from 'vs/editor/browser/controller/mouseHandler'; import { PointerHandler } from 'vs/editor/browser/controller/pointerHandler'; import { ITextAreaHandlerHelper, TextAreaHandler } from 'vs/editor/browser/controller/textAreaHandler'; -import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { IContentWidget, IContentWidgetPosition, IOverlayWidget, IOverlayWidgetPosition, IMouseTarget, IViewZoneChangeAccessor, IEditorAriaOptions } from 'vs/editor/browser/editorBrowser'; import { ICommandDelegate, ViewController } from 'vs/editor/browser/view/viewController'; import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents'; import { ContentViewOverlays, MarginViewOverlays } from 'vs/editor/browser/view/viewOverlays'; @@ -38,6 +38,7 @@ import { ViewCursors } from 'vs/editor/browser/viewParts/viewCursors/viewCursors import { ViewZones } from 'vs/editor/browser/viewParts/viewZones/viewZones'; import { Cursor } from 'vs/editor/common/controller/cursor'; import { Position } from 'vs/editor/common/core/position'; +import { Range } from 'vs/editor/common/core/range'; import { IConfiguration } from 'vs/editor/common/editorCommon'; import { RenderingContext } from 'vs/editor/common/view/renderingContext'; import { ViewContext } from 'vs/editor/common/view/viewContext'; @@ -48,20 +49,19 @@ import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { PointerHandlerLastRenderData } from 'vs/editor/browser/controller/mouseTarget'; export interface IContentWidgetData { - widget: editorBrowser.IContentWidget; - position: editorBrowser.IContentWidgetPosition | null; + widget: IContentWidget; + position: IContentWidgetPosition | null; } export interface IOverlayWidgetData { - widget: editorBrowser.IOverlayWidget; - position: editorBrowser.IOverlayWidgetPosition | null; + widget: IOverlayWidget; + position: IOverlayWidgetPosition | null; } -const invalidFunc = () => { throw new Error(`Invalid change accessor`); }; - export class View extends ViewEventHandler { private readonly eventDispatcher: ViewEventDispatcher; @@ -118,7 +118,7 @@ export class View extends ViewEventHandler { this._context = new ViewContext(configuration, themeService.getTheme(), model, this.eventDispatcher); this._register(themeService.onThemeChange(theme => { - this._context.theme = theme; + this._context.theme.update(theme); this.eventDispatcher.emit(new viewEvents.ViewThemeChangedEvent()); this.render(true, false); })); @@ -246,8 +246,10 @@ export class View extends ViewEventHandler { this.focus(); }, - getLastViewCursorsRenderData: () => { - return this.viewCursors.getLastRenderData() || []; + getLastRenderData: (): PointerHandlerLastRenderData => { + const lastViewCursorsRenderData = this.viewCursors.getLastRenderData() || []; + const lastTextareaPosition = this._textAreaHandler.getLastRenderData(); + return new PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition); }, shouldSuppressMouseDownOnViewZone: (viewZoneId: string) => { return this.viewZones.shouldSuppressMouseDownOnViewZone(viewZoneId); @@ -307,6 +309,10 @@ export class View extends ViewEventHandler { this._applyLayout(); return false; } + public onContentSizeChanged(e: viewEvents.ViewContentSizeChangedEvent): boolean { + this.outgoingEvents.emitContentSizeChange(e); + return false; + } public onFocusChanged(e: viewEvents.ViewFocusChangedEvent): boolean { this.domNode.setClassName(this.getEditorClassName()); this._context.model.setHasFocus(e.isFocused); @@ -348,7 +354,7 @@ export class View extends ViewEventHandler { super.dispose(); } - private _renderOnce(callback: () => any): any { + private _renderOnce(callback: () => T): T { const r = safeInvokeNoArg(callback); this._scheduleRender(); return r; @@ -458,50 +464,27 @@ export class View extends ViewEventHandler { return visibleRange.left; } - public getTargetAtClientPoint(clientX: number, clientY: number): editorBrowser.IMouseTarget | null { - return this.pointerHandler.getTargetAtClientPoint(clientX, clientY); + public getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null { + const mouseTarget = this.pointerHandler.getTargetAtClientPoint(clientX, clientY); + if (!mouseTarget) { + return null; + } + return ViewOutgoingEvents.convertViewToModelMouseTarget(mouseTarget, this._context.model.coordinatesConverter); } public createOverviewRuler(cssClassName: string): OverviewRuler { return new OverviewRuler(this._context, cssClassName); } - public change(callback: (changeAccessor: editorBrowser.IViewZoneChangeAccessor) => any): boolean { - let zonesHaveChanged = false; - - this._renderOnce(() => { - const changeAccessor: editorBrowser.IViewZoneChangeAccessor = { - addZone: (zone: editorBrowser.IViewZone): string => { - zonesHaveChanged = true; - return this.viewZones.addZone(zone); - }, - removeZone: (id: string): void => { - if (!id) { - return; - } - zonesHaveChanged = this.viewZones.removeZone(id) || zonesHaveChanged; - }, - layoutZone: (id: string): void => { - if (!id) { - return; - } - zonesHaveChanged = this.viewZones.layoutZone(id) || zonesHaveChanged; - } - }; - - safeInvoke1Arg(callback, changeAccessor); - - // Invalidate changeAccessor - changeAccessor.addZone = invalidFunc; - changeAccessor.removeZone = invalidFunc; - changeAccessor.layoutZone = invalidFunc; - + public change(callback: (changeAccessor: IViewZoneChangeAccessor) => any): boolean { + return this._renderOnce(() => { + const zonesHaveChanged = this.viewZones.changeViewZones(callback); if (zonesHaveChanged) { this._context.viewLayout.onHeightMaybeChanged(); this._context.privateViewEventBus.emit(new viewEvents.ViewZonesChangedEvent()); } + return zonesHaveChanged; }); - return zonesHaveChanged; } public render(now: boolean, everything: boolean): void { @@ -532,6 +515,10 @@ export class View extends ViewEventHandler { this._textAreaHandler.refreshFocusState(); } + public setAriaOptions(options: IEditorAriaOptions): void { + this._textAreaHandler.setAriaOptions(options); + } + public addContentWidget(widgetData: IContentWidgetData): void { this.contentWidgets.addWidget(widgetData.widget); this.layoutContentWidget(widgetData); @@ -539,10 +526,15 @@ export class View extends ViewEventHandler { } public layoutContentWidget(widgetData: IContentWidgetData): void { - const newPosition = widgetData.position ? widgetData.position.position : null; - const newRange = widgetData.position ? widgetData.position.range || null : null; + let newRange = widgetData.position ? widgetData.position.range || null : null; + if (newRange === null) { + const newPosition = widgetData.position ? widgetData.position.position : null; + if (newPosition !== null) { + newRange = new Range(newPosition.lineNumber, newPosition.column, newPosition.lineNumber, newPosition.column); + } + } const newPreference = widgetData.position ? widgetData.position.preference : null; - this.contentWidgets.setWidgetPosition(widgetData.widget, newPosition, newRange, newPreference); + this.contentWidgets.setWidgetPosition(widgetData.widget, newRange, newPreference); this._scheduleRender(); } @@ -581,11 +573,3 @@ function safeInvokeNoArg(func: Function): any { onUnexpectedError(e); } } - -function safeInvoke1Arg(func: Function, arg1: any): any { - try { - return func(arg1); - } catch (e) { - onUnexpectedError(e); - } -} diff --git a/src/vs/editor/browser/view/viewOutgoingEvents.ts b/src/vs/editor/browser/view/viewOutgoingEvents.ts index dce981872952d..6ba6ff3f1234f 100644 --- a/src/vs/editor/browser/view/viewOutgoingEvents.ts +++ b/src/vs/editor/browser/view/viewOutgoingEvents.ts @@ -9,9 +9,9 @@ import { MouseTarget } from 'vs/editor/browser/controller/mouseTarget'; import { IEditorMouseEvent, IMouseTarget, IPartialEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; -import { IScrollEvent } from 'vs/editor/common/editorCommon'; +import { IScrollEvent, IContentSizeChangedEvent } from 'vs/editor/common/editorCommon'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; -import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; +import { IViewModel, ICoordinatesConverter } from 'vs/editor/common/viewModel/viewModel'; import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; export interface EventCallback { @@ -20,6 +20,7 @@ export interface EventCallback { export class ViewOutgoingEvents extends Disposable { + public onDidContentSizeChange: EventCallback | null = null; public onDidScroll: EventCallback | null = null; public onDidGainFocus: EventCallback | null = null; public onDidLoseFocus: EventCallback | null = null; @@ -41,6 +42,12 @@ export class ViewOutgoingEvents extends Disposable { this._viewModel = viewModel; } + public emitContentSizeChange(e: viewEvents.ViewContentSizeChangedEvent): void { + if (this.onDidContentSizeChange) { + this.onDidContentSizeChange(e); + } + } + public emitScrollChanged(e: viewEvents.ViewScrollChangedEvent): void { if (this.onDidScroll) { this.onDidScroll(e); @@ -132,23 +139,19 @@ export class ViewOutgoingEvents extends Disposable { } private _convertViewToModelMouseTarget(target: IMouseTarget): IMouseTarget { + return ViewOutgoingEvents.convertViewToModelMouseTarget(target, this._viewModel.coordinatesConverter); + } + + public static convertViewToModelMouseTarget(target: IMouseTarget, coordinatesConverter: ICoordinatesConverter): IMouseTarget { return new ExternalMouseTarget( target.element, target.type, target.mouseColumn, - target.position ? this._convertViewToModelPosition(target.position) : null, - target.range ? this._convertViewToModelRange(target.range) : null, + target.position ? coordinatesConverter.convertViewPositionToModelPosition(target.position) : null, + target.range ? coordinatesConverter.convertViewRangeToModelRange(target.range) : null, target.detail ); } - - private _convertViewToModelPosition(viewPosition: Position): Position { - return this._viewModel.coordinatesConverter.convertViewPositionToModelPosition(viewPosition); - } - - private _convertViewToModelRange(viewRange: Range): Range { - return this._viewModel.coordinatesConverter.convertViewRangeToModelRange(viewRange); - } } class ExternalMouseTarget implements IMouseTarget { diff --git a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts index e98cea19e9c61..c22e5e84ad00d 100644 --- a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts +++ b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts @@ -7,7 +7,6 @@ import * as dom from 'vs/base/browser/dom'; import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; import { ContentWidgetPositionPreference, IContentWidget } from 'vs/editor/browser/editorBrowser'; import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart'; -import { IPosition, Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { Constants } from 'vs/base/common/uint'; import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; @@ -112,9 +111,9 @@ export class ViewContentWidgets extends ViewPart { this.setShouldRender(); } - public setWidgetPosition(widget: IContentWidget, position: IPosition | null, range: IRange | null, preference: ContentWidgetPositionPreference[] | null): void { + public setWidgetPosition(widget: IContentWidget, range: IRange | null, preference: ContentWidgetPositionPreference[] | null): void { const myWidget = this._widgets[widget.getId()]; - myWidget.setPosition(position, range, preference); + myWidget.setPosition(range, preference); this.setShouldRender(); } @@ -187,8 +186,6 @@ class Widget { private _contentLeft: number; private _lineHeight: number; - private _position: IPosition | null; - private _viewPosition: Position | null; private _range: IRange | null; private _viewRange: Range | null; private _preference: ContentWidgetPositionPreference[] | null; @@ -217,9 +214,7 @@ class Widget { this._contentLeft = layoutInfo.contentLeft; this._lineHeight = options.get(EditorOption.lineHeight); - this._position = null; this._range = null; - this._viewPosition = null; this._viewRange = null; this._preference = []; this._cachedDomNodeClientWidth = -1; @@ -246,26 +241,19 @@ class Widget { } public onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): void { - this._setPosition(this._position, this._range); + this._setPosition(this._range); } - private _setPosition(position: IPosition | null, range: IRange | null): void { - this._position = position; + private _setPosition(range: IRange | null): void { this._range = range; - this._viewPosition = null; this._viewRange = null; - if (this._position) { - // Do not trust that widgets give a valid position - const validModelPosition = this._context.model.validateModelPosition(this._position); - if (this._context.model.coordinatesConverter.modelPositionIsVisible(validModelPosition)) { - this._viewPosition = this._context.model.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition); - } - } if (this._range) { // Do not trust that widgets give a valid position const validModelRange = this._context.model.validateModelRange(this._range); - this._viewRange = this._context.model.coordinatesConverter.convertModelRangeToViewRange(validModelRange); + if (this._context.model.coordinatesConverter.modelPositionIsVisible(validModelRange.getStartPosition()) || this._context.model.coordinatesConverter.modelPositionIsVisible(validModelRange.getEndPosition())) { + this._viewRange = this._context.model.coordinatesConverter.convertModelRangeToViewRange(validModelRange); + } } } @@ -277,8 +265,8 @@ class Widget { ); } - public setPosition(position: IPosition | null, range: IRange | null, preference: ContentWidgetPositionPreference[] | null): void { - this._setPosition(position, range); + public setPosition(range: IRange | null, preference: ContentWidgetPositionPreference[] | null): void { + this._setPosition(range); this._preference = preference; this._cachedDomNodeClientWidth = -1; this._cachedDomNodeClientHeight = -1; @@ -327,60 +315,66 @@ class Widget { }; } - private _layoutBoxInPage(topLeft: Coordinate, bottomLeft: Coordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null { - const aboveLeft0 = topLeft.left - ctx.scrollLeft; - const belowLeft0 = bottomLeft.left - ctx.scrollLeft; + private _layoutHorizontalSegmentInPage(windowSize: dom.Dimension, domNodePosition: dom.IDomNodePagePosition, left: number, width: number): [number, number] { + // Initially, the limits are defined as the dom node limits + const MIN_LIMIT = Math.max(0, domNodePosition.left - width); + const MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width); + + let absoluteLeft = domNodePosition.left + left - dom.StandardWindow.scrollX; + + if (absoluteLeft + width > MAX_LIMIT) { + const delta = absoluteLeft - (MAX_LIMIT - width); + absoluteLeft -= delta; + left -= delta; + } - let aboveTop = topLeft.top - height; - let belowTop = bottomLeft.top + this._lineHeight; - let aboveLeft = aboveLeft0 + this._contentLeft; - let belowLeft = belowLeft0 + this._contentLeft; + if (absoluteLeft < MIN_LIMIT) { + const delta = absoluteLeft - MIN_LIMIT; + absoluteLeft -= delta; + left -= delta; + } + + return [left, absoluteLeft]; + } + + private _layoutBoxInPage(topLeft: Coordinate, bottomLeft: Coordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null { + const aboveTop = topLeft.top - height; + const belowTop = bottomLeft.top + this._lineHeight; const domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode); const absoluteAboveTop = domNodePosition.top + aboveTop - dom.StandardWindow.scrollY; const absoluteBelowTop = domNodePosition.top + belowTop - dom.StandardWindow.scrollY; - let absoluteAboveLeft = domNodePosition.left + aboveLeft - dom.StandardWindow.scrollX; - let absoluteBelowLeft = domNodePosition.left + belowLeft - dom.StandardWindow.scrollX; - const INNER_WIDTH = window.innerWidth || document.documentElement!.clientWidth || document.body.clientWidth; - const INNER_HEIGHT = window.innerHeight || document.documentElement!.clientHeight || document.body.clientHeight; + const windowSize = dom.getClientArea(document.body); + const [aboveLeft, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, topLeft.left - ctx.scrollLeft + this._contentLeft, width); + const [belowLeft, absoluteBelowLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, bottomLeft.left - ctx.scrollLeft + this._contentLeft, width); - // Leave some clearance to the bottom + // Leave some clearance to the top/bottom const TOP_PADDING = 22; const BOTTOM_PADDING = 22; - const fitsAbove = (absoluteAboveTop >= TOP_PADDING), - fitsBelow = (absoluteBelowTop + height <= INNER_HEIGHT - BOTTOM_PADDING); - - if (absoluteAboveLeft + width + 20 > INNER_WIDTH) { - const delta = absoluteAboveLeft - (INNER_WIDTH - width - 20); - absoluteAboveLeft -= delta; - aboveLeft -= delta; - } - if (absoluteBelowLeft + width + 20 > INNER_WIDTH) { - const delta = absoluteBelowLeft - (INNER_WIDTH - width - 20); - absoluteBelowLeft -= delta; - belowLeft -= delta; - } - if (absoluteAboveLeft < 0) { - const delta = absoluteAboveLeft; - absoluteAboveLeft -= delta; - aboveLeft -= delta; - } - if (absoluteBelowLeft < 0) { - const delta = absoluteBelowLeft; - absoluteBelowLeft -= delta; - belowLeft -= delta; - } + const fitsAbove = (absoluteAboveTop >= TOP_PADDING); + const fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING); if (this._fixedOverflowWidgets) { - aboveTop = absoluteAboveTop; - belowTop = absoluteBelowTop; - aboveLeft = absoluteAboveLeft; - belowLeft = absoluteBelowLeft; + return { + fitsAbove, + aboveTop: Math.max(absoluteAboveTop, TOP_PADDING), + aboveLeft: absoluteAboveLeft, + fitsBelow, + belowTop: absoluteBelowTop, + belowLeft: absoluteBelowLeft + }; } - return { fitsAbove, aboveTop: Math.max(aboveTop, TOP_PADDING), aboveLeft, fitsBelow, belowTop, belowLeft }; + return { + fitsAbove, + aboveTop: Math.max(aboveTop, TOP_PADDING), + aboveLeft, + fitsBelow, + belowTop, + belowLeft + }; } private _prepareRenderWidgetAtExactPositionOverflowing(topLeft: Coordinate): Coordinate { @@ -391,45 +385,45 @@ class Widget { * Compute `this._topLeft` */ private _getTopAndBottomLeft(ctx: RenderingContext): [Coordinate, Coordinate] | [null, null] { - if (!this._viewPosition) { + if (!this._viewRange) { return [null, null]; } - const visibleRangeForPosition = ctx.visibleRangeForPosition(this._viewPosition); - if (!visibleRangeForPosition) { + const visibleRangesForRange = ctx.linesVisibleRangesForRange(this._viewRange, false); + if (!visibleRangesForRange || visibleRangesForRange.length === 0) { return [null, null]; } - const topForPosition = ctx.getVerticalOffsetForLineNumber(this._viewPosition.lineNumber) - ctx.scrollTop; - const topLeft = new Coordinate(topForPosition, visibleRangeForPosition.left); - - let largestLineNumber = this._viewPosition.lineNumber; - let smallestLeft = visibleRangeForPosition.left; - - if (this._viewRange) { - const visibleRangesForRange = ctx.linesVisibleRangesForRange(this._viewRange, false); - if (visibleRangesForRange && visibleRangesForRange.length > 0) { - for (let i = visibleRangesForRange.length - 1; i >= 0; i--) { - const visibleRangesForLine = visibleRangesForRange[i]; - if (visibleRangesForLine.lineNumber >= largestLineNumber) { - if (visibleRangesForLine.lineNumber > largestLineNumber) { - largestLineNumber = visibleRangesForLine.lineNumber; - smallestLeft = Constants.MAX_SAFE_SMALL_INTEGER; - } - for (let j = 0, lenJ = visibleRangesForLine.ranges.length; j < lenJ; j++) { - const visibleRange = visibleRangesForLine.ranges[j]; + let firstLine = visibleRangesForRange[0]; + let lastLine = visibleRangesForRange[0]; + for (const visibleRangesForLine of visibleRangesForRange) { + if (visibleRangesForLine.lineNumber < firstLine.lineNumber) { + firstLine = visibleRangesForLine; + } + if (visibleRangesForLine.lineNumber > lastLine.lineNumber) { + lastLine = visibleRangesForLine; + } + } - if (visibleRange.left < smallestLeft) { - smallestLeft = visibleRange.left; - } - } - } - } + let firstLineMinLeft = Constants.MAX_SAFE_SMALL_INTEGER;//firstLine.Constants.MAX_SAFE_SMALL_INTEGER; + for (const visibleRange of firstLine.ranges) { + if (visibleRange.left < firstLineMinLeft) { + firstLineMinLeft = visibleRange.left; } } - const topForBottomLine = ctx.getVerticalOffsetForLineNumber(largestLineNumber) - ctx.scrollTop; - const bottomLeft = new Coordinate(topForBottomLine, smallestLeft); + let lastLineMinLeft = Constants.MAX_SAFE_SMALL_INTEGER;//lastLine.Constants.MAX_SAFE_SMALL_INTEGER; + for (const visibleRange of lastLine.ranges) { + if (visibleRange.left < lastLineMinLeft) { + lastLineMinLeft = visibleRange.left; + } + } + + const topForPosition = ctx.getVerticalOffsetForLineNumber(firstLine.lineNumber) - ctx.scrollTop; + const topLeft = new Coordinate(topForPosition, firstLineMinLeft); + + const topForBottomLine = ctx.getVerticalOffsetForLineNumber(lastLine.lineNumber) - ctx.scrollTop; + const bottomLeft = new Coordinate(topForBottomLine, lastLineMinLeft); return [topLeft, bottomLeft]; } @@ -491,11 +485,11 @@ class Widget { * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly. */ public onBeforeRender(viewportData: ViewportData): void { - if (!this._viewPosition || !this._preference) { + if (!this._viewRange || !this._preference) { return; } - if (this._viewPosition.lineNumber < viewportData.startLineNumber || this._viewPosition.lineNumber > viewportData.endLineNumber) { + if (this._viewRange.endLineNumber < viewportData.startLineNumber || this._viewRange.startLineNumber > viewportData.endLineNumber) { // Outside of viewport return; } diff --git a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts index cb3e355d8c628..59fdaf045a9d7 100644 --- a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts +++ b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts @@ -57,7 +57,7 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay { const renderSelections = isRenderedUsingBorder ? this._selections.slice(0, 1) : this._selections; const cursorsLineNumbers = renderSelections.map(s => s.positionLineNumber); - cursorsLineNumbers.sort(); + cursorsLineNumbers.sort((a, b) => a - b); if (!arrays.equals(this._cursorLineNumbers, cursorsLineNumbers)) { this._cursorLineNumbers = cursorsLineNumbers; hasChanged = true; diff --git a/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts b/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts index d816f1265e829..58917246f7c49 100644 --- a/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts +++ b/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts @@ -34,6 +34,7 @@ export class EditorScrollbar extends ViewPart { const scrollbar = options.get(EditorOption.scrollbar); const mouseWheelScrollSensitivity = options.get(EditorOption.mouseWheelScrollSensitivity); const fastScrollSensitivity = options.get(EditorOption.fastScrollSensitivity); + const scrollPredominantAxis = options.get(EditorOption.scrollPredominantAxis); const scrollbarOptions: ScrollableElementCreationOptions = { listenOnDomNode: viewDomNode.domNode, @@ -50,12 +51,14 @@ export class EditorScrollbar extends ViewPart { horizontalScrollbarSize: scrollbar.horizontalScrollbarSize, horizontalSliderSize: scrollbar.horizontalSliderSize, handleMouseWheel: scrollbar.handleMouseWheel, + alwaysConsumeMouseWheel: scrollbar.alwaysConsumeMouseWheel, arrowSize: scrollbar.arrowSize, mouseWheelScrollSensitivity: mouseWheelScrollSensitivity, fastScrollSensitivity: fastScrollSensitivity, + scrollPredominantAxis: scrollPredominantAxis, }; - this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.scrollable)); + this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.getScrollable())); PartFingerprints.write(this.scrollbar.getDomNode(), PartFingerprint.ScrollableElement); this.scrollbarDomNode = createFastDomNode(this.scrollbar.getDomNode()); @@ -112,7 +115,7 @@ export class EditorScrollbar extends ViewPart { } else { this.scrollbarDomNode.setWidth(layoutInfo.contentWidth); } - this.scrollbarDomNode.setHeight(layoutInfo.contentHeight); + this.scrollbarDomNode.setHeight(layoutInfo.height); } public getOverviewRulerLayoutInfo(): IOverviewRulerLayoutInfo { @@ -139,10 +142,12 @@ export class EditorScrollbar extends ViewPart { const scrollbar = options.get(EditorOption.scrollbar); const mouseWheelScrollSensitivity = options.get(EditorOption.mouseWheelScrollSensitivity); const fastScrollSensitivity = options.get(EditorOption.fastScrollSensitivity); + const scrollPredominantAxis = options.get(EditorOption.scrollPredominantAxis); const newOpts: ScrollableElementChangeOptions = { handleMouseWheel: scrollbar.handleMouseWheel, mouseWheelScrollSensitivity: mouseWheelScrollSensitivity, - fastScrollSensitivity: fastScrollSensitivity + fastScrollSensitivity: fastScrollSensitivity, + scrollPredominantAxis: scrollPredominantAxis }; this.scrollbar.updateOptions(newOpts); } diff --git a/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts b/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts index 494b7d7ca233e..0cdd9c61cc2ed 100644 --- a/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts +++ b/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts @@ -177,7 +177,7 @@ export class GlyphMarginOverlay extends DedupOverlay { output[lineIndex] = ''; } else { output[lineIndex] = ( - '
`; - left += indentWidth; - if (left > scrollWidth || (this._maxIndentLeft > 0 && left > this._maxIndentLeft)) { - break; + if (indent >= 1) { + const leftMostVisiblePosition = ctx.visibleRangeForPosition(new Position(lineNumber, 1)); + let left = leftMostVisiblePosition ? leftMostVisiblePosition.left : 0; + for (let i = 1; i <= indent; i++) { + const className = (containsActiveIndentGuide && i === activeIndentLevel ? 'cigra' : 'cigr'); + result += `
`; + left += indentWidth; + if (left > scrollWidth || (this._maxIndentLeft > 0 && left > this._maxIndentLeft)) { + break; + } } } diff --git a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-2x.svg b/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-2x.svg deleted file mode 100644 index 1d1cda0e93e29..0000000000000 --- a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-2x.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac-2x.svg b/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac-2x.svg deleted file mode 100644 index 7f64457f78be9..0000000000000 --- a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac-2x.svg +++ /dev/null @@ -1,2 +0,0 @@ - - flipped-cursor-mac diff --git a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac.svg b/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac.svg deleted file mode 100644 index da79a9547db10..0000000000000 --- a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor-mac.svg +++ /dev/null @@ -1 +0,0 @@ -flipped-cursor-mac diff --git a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor.svg b/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor.svg deleted file mode 100644 index 0add3031fb5eb..0000000000000 --- a/src/vs/editor/browser/viewParts/lineNumbers/flipped-cursor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css b/src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css index 3cfe5e758e2d7..02def4da31f3f 100644 --- a/src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css +++ b/src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ .monaco-editor .margin-view-overlays .line-numbers { + font-variant-numeric: tabular-nums; position: absolute; text-align: right; display: inline-block; @@ -19,20 +20,6 @@ width: 100%; } -.monaco-editor .margin-view-overlays .line-numbers { - cursor: -webkit-image-set( - url('flipped-cursor.svg') 1x, - url('flipped-cursor-2x.svg') 2x - ) 30 0, default; -} - -.monaco-editor.mac .margin-view-overlays .line-numbers { - cursor: -webkit-image-set( - url('flipped-cursor-mac.svg') 1x, - url('flipped-cursor-mac-2x.svg') 2x - ) 24 3, default; -} - .monaco-editor .margin-view-overlays .line-numbers.lh-odd { margin-top: 1px; } diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index 655b93462d31c..0c1b66decdda2 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLine.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLine.ts @@ -73,6 +73,8 @@ export class ViewLineOptions { public readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all'; public readonly renderControlCharacters: boolean; public readonly spaceWidth: number; + public readonly middotWidth: number; + public readonly wsmiddotWidth: number; public readonly useMonospaceOptimizations: boolean; public readonly canUseHalfwidthRightwardsArrow: boolean; public readonly lineHeight: number; @@ -86,6 +88,8 @@ export class ViewLineOptions { this.renderWhitespace = options.get(EditorOption.renderWhitespace); this.renderControlCharacters = options.get(EditorOption.renderControlCharacters); this.spaceWidth = fontInfo.spaceWidth; + this.middotWidth = fontInfo.middotWidth; + this.wsmiddotWidth = fontInfo.wsmiddotWidth; this.useMonospaceOptimizations = ( fontInfo.isMonospace && !options.get(EditorOption.disableMonospaceOptimizations) @@ -102,6 +106,8 @@ export class ViewLineOptions { && this.renderWhitespace === other.renderWhitespace && this.renderControlCharacters === other.renderControlCharacters && this.spaceWidth === other.spaceWidth + && this.middotWidth === other.middotWidth + && this.wsmiddotWidth === other.wsmiddotWidth && this.useMonospaceOptimizations === other.useMonospaceOptimizations && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.lineHeight === other.lineHeight @@ -213,7 +219,10 @@ export class ViewLine implements IVisibleLine { lineData.tokens, actualInlineDecorations, lineData.tabSize, + lineData.startVisibleColumn, options.spaceWidth, + options.middotWidth, + options.wsmiddotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, @@ -407,7 +416,7 @@ class FastRenderedViewLine implements IRenderedViewLine { */ class RenderedViewLine implements IRenderedViewLine { - public domNode: FastDomNode; + public domNode: FastDomNode | null; public readonly input: RenderLineInput; protected readonly _characterMapping: CharacterMapping; @@ -420,7 +429,7 @@ class RenderedViewLine implements IRenderedViewLine { */ private readonly _pixelOffsetCache: Int32Array | null; - constructor(domNode: FastDomNode, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType) { + constructor(domNode: FastDomNode | null, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType) { this.domNode = domNode; this.input = renderLineInput; this._characterMapping = characterMapping; @@ -439,16 +448,19 @@ class RenderedViewLine implements IRenderedViewLine { // --- Reading from the DOM methods - protected _getReadingTarget(): HTMLElement { - return this.domNode.domNode.firstChild; + protected _getReadingTarget(myDomNode: FastDomNode): HTMLElement { + return myDomNode.domNode.firstChild; } /** * Width of the line in pixels */ public getWidth(): number { + if (!this.domNode) { + return 0; + } if (this._cachedWidth === -1) { - this._cachedWidth = this._getReadingTarget().offsetWidth; + this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth; } return this._cachedWidth; } @@ -464,14 +476,17 @@ class RenderedViewLine implements IRenderedViewLine { * Visible ranges for a model range */ public getVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { + if (!this.domNode) { + return null; + } if (this._pixelOffsetCache !== null) { // the text is LTR - const startOffset = this._readPixelOffset(startColumn, context); + const startOffset = this._readPixelOffset(this.domNode, startColumn, context); if (startOffset === -1) { return null; } - const endOffset = this._readPixelOffset(endColumn, context); + const endOffset = this._readPixelOffset(this.domNode, endColumn, context); if (endOffset === -1) { return null; } @@ -479,23 +494,23 @@ class RenderedViewLine implements IRenderedViewLine { return [new HorizontalRange(startOffset, endOffset - startOffset)]; } - return this._readVisibleRangesForRange(startColumn, endColumn, context); + return this._readVisibleRangesForRange(this.domNode, startColumn, endColumn, context); } - protected _readVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { + protected _readVisibleRangesForRange(domNode: FastDomNode, startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { if (startColumn === endColumn) { - const pixelOffset = this._readPixelOffset(startColumn, context); + const pixelOffset = this._readPixelOffset(domNode, startColumn, context); if (pixelOffset === -1) { return null; } else { return [new HorizontalRange(pixelOffset, 0)]; } } else { - return this._readRawVisibleRangesForRange(startColumn, endColumn, context); + return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context); } } - protected _readPixelOffset(column: number, context: DomReadingContext): number { + protected _readPixelOffset(domNode: FastDomNode, column: number, context: DomReadingContext): number { if (this._characterMapping.length === 0) { // This line has no content if (this._containsForeignElements === ForeignElementType.None) { @@ -507,9 +522,16 @@ class RenderedViewLine implements IRenderedViewLine { return 0; } if (this._containsForeignElements === ForeignElementType.Before) { - // We have foreign element before the (empty) line + // We have foreign elements before the (empty) line return this.getWidth(); } + // We have foreign elements before & after the (empty) line + const readingTarget = this._getReadingTarget(domNode); + if (readingTarget.firstChild) { + return (readingTarget.firstChild).offsetWidth; + } else { + return 0; + } } if (this._pixelOffsetCache !== null) { @@ -520,18 +542,18 @@ class RenderedViewLine implements IRenderedViewLine { return cachedPixelOffset; } - const result = this._actualReadPixelOffset(column, context); + const result = this._actualReadPixelOffset(domNode, column, context); this._pixelOffsetCache[column] = result; return result; } - return this._actualReadPixelOffset(column, context); + return this._actualReadPixelOffset(domNode, column, context); } - private _actualReadPixelOffset(column: number, context: DomReadingContext): number { + private _actualReadPixelOffset(domNode: FastDomNode, column: number, context: DomReadingContext): number { if (this._characterMapping.length === 0) { // This line has no content - const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(), 0, 0, 0, 0, context.clientRectDeltaLeft, context.endNode); + const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context.clientRectDeltaLeft, context.endNode); if (!r || r.length === 0) { return -1; } @@ -547,14 +569,14 @@ class RenderedViewLine implements IRenderedViewLine { const partIndex = CharacterMapping.getPartIndex(partData); const charOffsetInPart = CharacterMapping.getCharIndex(partData); - const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(), partIndex, charOffsetInPart, partIndex, charOffsetInPart, context.clientRectDeltaLeft, context.endNode); + const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), partIndex, charOffsetInPart, partIndex, charOffsetInPart, context.clientRectDeltaLeft, context.endNode); if (!r || r.length === 0) { return -1; } return r[0].left; } - private _readRawVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { + private _readRawVisibleRangesForRange(domNode: FastDomNode, startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { if (startColumn === 1 && endColumn === this._characterMapping.length) { // This branch helps IE with bidi text & gives a performance boost to other browsers when reading visible ranges for an entire line @@ -570,7 +592,7 @@ class RenderedViewLine implements IRenderedViewLine { const endPartIndex = CharacterMapping.getPartIndex(endPartData); const endCharOffsetInPart = CharacterMapping.getCharIndex(endPartData); - return RangeUtil.readHorizontalRanges(this._getReadingTarget(), startPartIndex, startCharOffsetInPart, endPartIndex, endCharOffsetInPart, context.clientRectDeltaLeft, context.endNode); + return RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startPartIndex, startCharOffsetInPart, endPartIndex, endCharOffsetInPart, context.clientRectDeltaLeft, context.endNode); } /** @@ -591,8 +613,8 @@ class RenderedViewLine implements IRenderedViewLine { } class WebKitRenderedViewLine extends RenderedViewLine { - protected _readVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { - const output = super._readVisibleRangesForRange(startColumn, endColumn, context); + protected _readVisibleRangesForRange(domNode: FastDomNode, startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { + const output = super._readVisibleRangesForRange(domNode, startColumn, endColumn, context); if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._characterMapping.length)) { return output; @@ -603,7 +625,7 @@ class WebKitRenderedViewLine extends RenderedViewLine { if (!this.input.containsRTL) { // This is an attempt to patch things up // Find position of last column - const endPixelOffset = this._readPixelOffset(endColumn, context); + const endPixelOffset = this._readPixelOffset(domNode, endColumn, context); if (endPixelOffset !== -1) { const lastRange = output[output.length - 1]; if (lastRange.left < endPixelOffset) { @@ -624,10 +646,10 @@ const createRenderedLine: (domNode: FastDomNode | null, renderLineI return createNormalRenderedLine; })(); -function createWebKitRenderedLine(domNode: FastDomNode, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType): RenderedViewLine { +function createWebKitRenderedLine(domNode: FastDomNode | null, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType): RenderedViewLine { return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements); } -function createNormalRenderedLine(domNode: FastDomNode, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType): RenderedViewLine { +function createNormalRenderedLine(domNode: FastDomNode | null, renderLineInput: RenderLineInput, characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType): RenderedViewLine { return new RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements); } diff --git a/src/vs/editor/browser/viewParts/lines/viewLines.css b/src/vs/editor/browser/viewParts/lines/viewLines.css index b6b58faacb6db..7e4ae7c0d280e 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLines.css +++ b/src/vs/editor/browser/viewParts/lines/viewLines.css @@ -37,6 +37,10 @@ width: 100%; } +.monaco-editor .mtkz { + display: inline-block; +} + /* TODO@tokenization bootstrap fix */ /*.monaco-editor .view-line > span > span { float: none; diff --git a/src/vs/editor/browser/viewParts/lines/viewLines.ts b/src/vs/editor/browser/viewParts/lines/viewLines.ts index 00b20578698fd..5b2bd0ee59134 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLines.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLines.ts @@ -589,6 +589,19 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost, if (boxEndY - boxStartY > viewportHeight) { // the box is larger than the viewport ... scroll to its top newScrollTop = boxStartY; + } else if (verticalType === viewEvents.VerticalRevealType.NearTop || verticalType === viewEvents.VerticalRevealType.NearTopIfOutsideViewport) { + if (verticalType === viewEvents.VerticalRevealType.NearTopIfOutsideViewport && viewportStartY <= boxStartY && boxEndY <= viewportEndY) { + // Box is already in the viewport... do nothing + newScrollTop = viewportStartY; + } else { + // We want a gap that is 20% of the viewport, but with a minimum of 5 lines + const desiredGapAbove = Math.max(5 * this._lineHeight, viewportHeight * 0.2); + // Try to scroll just above the box with the desired gap + const desiredScrollTop = boxStartY - desiredGapAbove; + // But ensure that the box is not pushed out of viewport + const minScrollTop = boxEndY - viewportHeight; + newScrollTop = Math.max(minScrollTop, desiredScrollTop); + } } else if (verticalType === viewEvents.VerticalRevealType.Center || verticalType === viewEvents.VerticalRevealType.CenterIfOutsideViewport) { if (verticalType === viewEvents.VerticalRevealType.CenterIfOutsideViewport && viewportStartY <= boxStartY && boxEndY <= viewportEndY) { // Box is already in the viewport... do nothing diff --git a/src/vs/editor/browser/viewParts/minimap/minimap.ts b/src/vs/editor/browser/viewParts/minimap/minimap.ts index 8e50b1e0e2d0b..5f5c5cadd9fc6 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimap.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimap.ts @@ -8,12 +8,12 @@ import * as dom from 'vs/base/browser/dom'; import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; import { GlobalMouseMoveMonitor, IStandardMouseMoveEventData, standardMouseMoveMerger } from 'vs/base/browser/globalMouseMoveMonitor'; import { CharCode } from 'vs/base/common/charCode'; -import { IDisposable } from 'vs/base/common/lifecycle'; +import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; import * as strings from 'vs/base/common/strings'; import { ILine, RenderedLinesCollection } from 'vs/editor/browser/view/viewLayer'; import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart'; -import { RenderMinimap, EditorOption, MINIMAP_GUTTER_WIDTH } from 'vs/editor/common/config/editorOptions'; +import { RenderMinimap, EditorOption, MINIMAP_GUTTER_WIDTH, EditorLayoutInfoComputer } from 'vs/editor/common/config/editorOptions'; import { Range } from 'vs/editor/common/core/range'; import { RGBA8 } from 'vs/editor/common/core/rgba'; import { IConfiguration, ScrollType } from 'vs/editor/common/editorCommon'; @@ -22,33 +22,18 @@ import { MinimapCharRenderer } from 'vs/editor/browser/viewParts/minimap/minimap import { Constants } from 'vs/editor/browser/viewParts/minimap/minimapCharSheet'; import { MinimapTokensColorTracker } from 'vs/editor/common/viewModel/minimapTokensColorTracker'; import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; -import { ViewContext } from 'vs/editor/common/view/viewContext'; +import { ViewContext, EditorTheme } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; -import { ViewLineData } from 'vs/editor/common/viewModel/viewModel'; -import { scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, minimapSelection } from 'vs/platform/theme/common/colorRegistry'; +import { ViewLineData, ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel'; +import { minimapSelection, scrollbarShadow, minimapBackground, minimapSliderBackground, minimapSliderHoverBackground, minimapSliderActiveBackground } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { ModelDecorationMinimapOptions } from 'vs/editor/common/model/textModel'; import { Selection } from 'vs/editor/common/core/selection'; import { Color } from 'vs/base/common/color'; import { GestureEvent, EventType, Gesture } from 'vs/base/browser/touch'; import { MinimapCharRendererFactory } from 'vs/editor/browser/viewParts/minimap/minimapCharRendererFactory'; -import { MinimapPosition } from 'vs/editor/common/model'; - -function getMinimapLineHeight(renderMinimap: RenderMinimap, scale: number): number { - if (renderMinimap === RenderMinimap.Text) { - return Constants.BASE_CHAR_HEIGHT * scale; - } - // RenderMinimap.Blocks - return (Constants.BASE_CHAR_HEIGHT + 1) * scale; -} - -function getMinimapCharWidth(renderMinimap: RenderMinimap, scale: number): number { - if (renderMinimap === RenderMinimap.Text) { - return Constants.BASE_CHAR_WIDTH * scale; - } - // RenderMinimap.Blocks - return Constants.BASE_CHAR_WIDTH * scale; -} +import { MinimapPosition, TextModelResolvedOptions } from 'vs/editor/common/model'; +import { once } from 'vs/base/common/functional'; /** * The orthogonal distance to the slider at which dragging "resets". This implements "snapping" @@ -61,6 +46,10 @@ class MinimapOptions { public readonly renderMinimap: RenderMinimap; + public readonly mode: 'actual' | 'cover' | 'contain'; + + public readonly minimapHeightIsEditorHeight: boolean; + public readonly scrollBeyondLastLine: boolean; public readonly showSlider: 'always' | 'mouseover'; @@ -71,10 +60,6 @@ class MinimapOptions { public readonly lineHeight: number; - public readonly fontScale: number; - - public readonly charRenderer: MinimapCharRenderer; - /** * container dom node left position (in CSS px) */ @@ -106,18 +91,27 @@ class MinimapOptions { */ public readonly canvasOuterHeight: number; - constructor(configuration: IConfiguration) { + public readonly isSampling: boolean; + public readonly editorHeight: number; + public readonly fontScale: number; + public readonly minimapLineHeight: number; + public readonly minimapCharWidth: number; + + public readonly charRenderer: () => MinimapCharRenderer; + public readonly backgroundColor: RGBA8; + + constructor(configuration: IConfiguration, theme: EditorTheme, tokensColorTracker: MinimapTokensColorTracker) { const options = configuration.options; const pixelRatio = options.get(EditorOption.pixelRatio); const layoutInfo = options.get(EditorOption.layoutInfo); const fontInfo = options.get(EditorOption.fontInfo); + const minimapOpts = options.get(EditorOption.minimap); this.renderMinimap = layoutInfo.renderMinimap | 0; + this.mode = minimapOpts.mode; + this.minimapHeightIsEditorHeight = layoutInfo.minimapHeightIsEditorHeight; this.scrollBeyondLastLine = options.get(EditorOption.scrollBeyondLastLine); - const minimapOpts = options.get(EditorOption.minimap); this.showSlider = minimapOpts.showSlider; - this.fontScale = Math.round(minimapOpts.scale * pixelRatio); - this.charRenderer = MinimapCharRendererFactory.create(this.fontScale, fontInfo.fontFamily); this.pixelRatio = pixelRatio; this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth; this.lineHeight = options.get(EditorOption.lineHeight); @@ -125,21 +119,38 @@ class MinimapOptions { this.minimapWidth = layoutInfo.minimapWidth; this.minimapHeight = layoutInfo.height; - this.canvasInnerWidth = Math.max(1, Math.floor(pixelRatio * this.minimapWidth)); - this.canvasInnerHeight = Math.max(1, Math.floor(pixelRatio * this.minimapHeight)); + this.canvasInnerWidth = layoutInfo.minimapCanvasInnerWidth; + this.canvasInnerHeight = layoutInfo.minimapCanvasInnerHeight; + this.canvasOuterWidth = layoutInfo.minimapCanvasOuterWidth; + this.canvasOuterHeight = layoutInfo.minimapCanvasOuterHeight; + + this.isSampling = layoutInfo.minimapIsSampling; + this.editorHeight = layoutInfo.height; + this.fontScale = layoutInfo.minimapScale; + this.minimapLineHeight = layoutInfo.minimapLineHeight; + this.minimapCharWidth = Constants.BASE_CHAR_WIDTH * this.fontScale; - this.canvasOuterWidth = this.canvasInnerWidth / pixelRatio; - this.canvasOuterHeight = this.canvasInnerHeight / pixelRatio; + this.charRenderer = once(() => MinimapCharRendererFactory.create(this.fontScale, fontInfo.fontFamily)); + this.backgroundColor = MinimapOptions._getMinimapBackground(theme, tokensColorTracker); + } + + private static _getMinimapBackground(theme: EditorTheme, tokensColorTracker: MinimapTokensColorTracker): RGBA8 { + const themeColor = theme.getColor(minimapBackground); + if (themeColor) { + return new RGBA8(themeColor.rgba.r, themeColor.rgba.g, themeColor.rgba.b, themeColor.rgba.a); + } + return tokensColorTracker.getColor(ColorId.DefaultBackground); } public equals(other: MinimapOptions): boolean { return (this.renderMinimap === other.renderMinimap + && this.mode === other.mode + && this.minimapHeightIsEditorHeight === other.minimapHeightIsEditorHeight && this.scrollBeyondLastLine === other.scrollBeyondLastLine && this.showSlider === other.showSlider && this.pixelRatio === other.pixelRatio && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth && this.lineHeight === other.lineHeight - && this.fontScale === other.fontScale && this.minimapLeft === other.minimapLeft && this.minimapWidth === other.minimapWidth && this.minimapHeight === other.minimapHeight @@ -147,6 +158,12 @@ class MinimapOptions { && this.canvasInnerHeight === other.canvasInnerHeight && this.canvasOuterWidth === other.canvasOuterWidth && this.canvasOuterHeight === other.canvasOuterHeight + && this.isSampling === other.isSampling + && this.editorHeight === other.editorHeight + && this.fontScale === other.fontScale + && this.minimapLineHeight === other.minimapLineHeight + && this.minimapCharWidth === other.minimapCharWidth + && this.backgroundColor.equals(other.backgroundColor) ); } } @@ -163,6 +180,7 @@ class MinimapLayout { */ public readonly scrollHeight: number; + public readonly sliderNeeded: boolean; private readonly _computedSliderRatio: number; /** @@ -186,6 +204,7 @@ class MinimapLayout { constructor( scrollTop: number, scrollHeight: number, + sliderNeeded: boolean, computedSliderRatio: number, sliderTop: number, sliderHeight: number, @@ -194,6 +213,7 @@ class MinimapLayout { ) { this.scrollTop = scrollTop; this.scrollHeight = scrollHeight; + this.sliderNeeded = sliderNeeded; this._computedSliderRatio = computedSliderRatio; this.sliderTop = sliderTop; this.sliderHeight = sliderHeight; @@ -220,15 +240,31 @@ class MinimapLayout { viewportHeight: number, viewportContainsWhitespaceGaps: boolean, lineCount: number, + realLineCount: number, scrollTop: number, scrollHeight: number, previousLayout: MinimapLayout | null ): MinimapLayout { const pixelRatio = options.pixelRatio; - const minimapLineHeight = getMinimapLineHeight(options.renderMinimap, options.fontScale); + const minimapLineHeight = options.minimapLineHeight; const minimapLinesFitting = Math.floor(options.canvasInnerHeight / minimapLineHeight); const lineHeight = options.lineHeight; + if (options.minimapHeightIsEditorHeight) { + const logicalScrollHeight = ( + realLineCount * options.lineHeight + + (options.scrollBeyondLastLine ? viewportHeight - options.lineHeight : 0) + ); + const sliderHeight = Math.max(1, Math.floor(viewportHeight * viewportHeight / logicalScrollHeight)); + const maxMinimapSliderTop = Math.max(0, options.minimapHeight - sliderHeight); + // The slider can move from 0 to `maxMinimapSliderTop` + // in the same way `scrollTop` can move from 0 to `scrollHeight` - `viewportHeight`. + const computedSliderRatio = (maxMinimapSliderTop) / (scrollHeight - viewportHeight); + const sliderTop = (scrollTop * computedSliderRatio); + const sliderNeeded = (maxMinimapSliderTop > 0); + return new MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio, sliderTop, sliderHeight, 1, lineCount); + } + // The visible line count in a viewport can change due to a number of reasons: // a) with the same viewport width, different scroll positions can result in partial lines being visible: // e.g. for a line height of 20, and a viewport height of 600 @@ -269,14 +305,14 @@ class MinimapLayout { let extraLinesAtTheBottom = 0; if (options.scrollBeyondLastLine) { const expectedViewportLineCount = viewportHeight / lineHeight; - extraLinesAtTheBottom = expectedViewportLineCount; + extraLinesAtTheBottom = expectedViewportLineCount - 1; } if (minimapLinesFitting >= lineCount + extraLinesAtTheBottom) { // All lines fit in the minimap const startLineNumber = 1; const endLineNumber = lineCount; - - return new MinimapLayout(scrollTop, scrollHeight, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber); + const sliderNeeded = (maxMinimapSliderTop > 0); + return new MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber); } else { let startLineNumber = Math.max(1, Math.floor(viewportStartLineNumber - sliderTop * pixelRatio / minimapLineHeight)); @@ -295,7 +331,7 @@ class MinimapLayout { const endLineNumber = Math.min(lineCount, startLineNumber + minimapLinesFitting - 1); - return new MinimapLayout(scrollTop, scrollHeight, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber); + return new MinimapLayout(scrollTop, scrollHeight, true, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber); } } } @@ -377,17 +413,17 @@ class RenderData { }; } - public onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean { - return this._renderedLines.onLinesChanged(e.fromLineNumber, e.toLineNumber); + public onLinesChanged(changeFromLineNumber: number, changeToLineNumber: number): boolean { + return this._renderedLines.onLinesChanged(changeFromLineNumber, changeToLineNumber); } - public onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): void { - this._renderedLines.onLinesDeleted(e.fromLineNumber, e.toLineNumber); + public onLinesDeleted(deleteFromLineNumber: number, deleteToLineNumber: number): void { + this._renderedLines.onLinesDeleted(deleteFromLineNumber, deleteToLineNumber); } - public onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): void { - this._renderedLines.onLinesInserted(e.fromLineNumber, e.toLineNumber); + public onLinesInserted(insertFromLineNumber: number, insertToLineNumber: number): void { + this._renderedLines.onLinesInserted(insertFromLineNumber, insertToLineNumber); } - public onTokensChanged(e: viewEvents.ViewTokensChangedEvent): boolean { - return this._renderedLines.onTokensChanged(e.ranges); + public onTokensChanged(ranges: { fromLineNumber: number; toLineNumber: number; }[]): boolean { + return this._renderedLines.onTokensChanged(ranges); } } @@ -444,7 +480,557 @@ class MinimapBuffers { } } -export class Minimap extends ViewPart { +export interface IMinimapModel { + readonly tokensColorTracker: MinimapTokensColorTracker; + readonly options: MinimapOptions; + + getLineCount(): number; + getRealLineCount(): number; + getLineContent(lineNumber: number): string; + getMinimapLinesRenderingData(startLineNumber: number, endLineNumber: number, needed: boolean[]): (ViewLineData | null)[]; + getSelections(): Selection[]; + getMinimapDecorationsInViewport(startLineNumber: number, endLineNumber: number): ViewModelDecoration[]; + getOptions(): TextModelResolvedOptions; + revealLineNumber(lineNumber: number): void; + setScrollTop(scrollTop: number): void; +} + +interface IMinimapRenderingContext { + readonly viewportContainsWhitespaceGaps: boolean; + + readonly scrollWidth: number; + readonly scrollHeight: number; + + readonly viewportStartLineNumber: number; + readonly viewportEndLineNumber: number; + + readonly scrollTop: number; + readonly scrollLeft: number; + + readonly viewportWidth: number; + readonly viewportHeight: number; +} + +interface SamplingStateLinesDeletedEvent { + type: 'deleted'; + _oldIndex: number; + deleteFromLineNumber: number; + deleteToLineNumber: number; +} + +interface SamplingStateLinesInsertedEvent { + type: 'inserted'; + _i: number; + insertFromLineNumber: number; + insertToLineNumber: number; +} + +interface SamplingStateFlushEvent { + type: 'flush'; +} + +type SamplingStateEvent = SamplingStateLinesInsertedEvent | SamplingStateLinesDeletedEvent | SamplingStateFlushEvent; + +class MinimapSamplingState { + + public static compute(options: MinimapOptions, viewLineCount: number, oldSamplingState: MinimapSamplingState | null): [MinimapSamplingState | null, SamplingStateEvent[]] { + if (options.renderMinimap === RenderMinimap.None || !options.isSampling) { + return [null, []]; + } + + // ratio is intentionally not part of the layout to avoid the layout changing all the time + // so we need to recompute it again... + const pixelRatio = options.pixelRatio; + const lineHeight = options.lineHeight; + const scrollBeyondLastLine = options.scrollBeyondLastLine; + const { minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({ + viewLineCount: viewLineCount, + scrollBeyondLastLine: scrollBeyondLastLine, + height: options.editorHeight, + lineHeight: lineHeight, + pixelRatio: pixelRatio + }); + const ratio = viewLineCount / minimapLineCount; + const halfRatio = ratio / 2; + + if (!oldSamplingState || oldSamplingState.minimapLines.length === 0) { + let result: number[] = []; + result[0] = 1; + if (minimapLineCount > 1) { + for (let i = 0, lastIndex = minimapLineCount - 1; i < lastIndex; i++) { + result[i] = Math.round(i * ratio + halfRatio); + } + result[minimapLineCount - 1] = viewLineCount; + } + return [new MinimapSamplingState(ratio, result), []]; + } + + const oldMinimapLines = oldSamplingState.minimapLines; + const oldLength = oldMinimapLines.length; + let result: number[] = []; + let oldIndex = 0; + let oldDeltaLineCount = 0; + let minViewLineNumber = 1; + const MAX_EVENT_COUNT = 10; // generate at most 10 events, if there are more than 10 changes, just flush all previous data + let events: SamplingStateEvent[] = []; + let lastEvent: SamplingStateEvent | null = null; + for (let i = 0; i < minimapLineCount; i++) { + const fromViewLineNumber = Math.max(minViewLineNumber, Math.round(i * ratio)); + const toViewLineNumber = Math.max(fromViewLineNumber, Math.round((i + 1) * ratio)); + + while (oldIndex < oldLength && oldMinimapLines[oldIndex] < fromViewLineNumber) { + if (events.length < MAX_EVENT_COUNT) { + const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount; + if (lastEvent && lastEvent.type === 'deleted' && lastEvent._oldIndex === oldIndex - 1) { + lastEvent.deleteToLineNumber++; + } else { + lastEvent = { type: 'deleted', _oldIndex: oldIndex, deleteFromLineNumber: oldMinimapLineNumber, deleteToLineNumber: oldMinimapLineNumber }; + events.push(lastEvent); + } + oldDeltaLineCount--; + } + oldIndex++; + } + + let selectedViewLineNumber: number; + if (oldIndex < oldLength && oldMinimapLines[oldIndex] <= toViewLineNumber) { + // reuse the old sampled line + selectedViewLineNumber = oldMinimapLines[oldIndex]; + oldIndex++; + } else { + if (i === 0) { + selectedViewLineNumber = 1; + } else if (i + 1 === minimapLineCount) { + selectedViewLineNumber = viewLineCount; + } else { + selectedViewLineNumber = Math.round(i * ratio + halfRatio); + } + if (events.length < MAX_EVENT_COUNT) { + const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount; + if (lastEvent && lastEvent.type === 'inserted' && lastEvent._i === i - 1) { + lastEvent.insertToLineNumber++; + } else { + lastEvent = { type: 'inserted', _i: i, insertFromLineNumber: oldMinimapLineNumber, insertToLineNumber: oldMinimapLineNumber }; + events.push(lastEvent); + } + oldDeltaLineCount++; + } + } + + result[i] = selectedViewLineNumber; + minViewLineNumber = selectedViewLineNumber; + } + + if (events.length < MAX_EVENT_COUNT) { + while (oldIndex < oldLength) { + const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount; + if (lastEvent && lastEvent.type === 'deleted' && lastEvent._oldIndex === oldIndex - 1) { + lastEvent.deleteToLineNumber++; + } else { + lastEvent = { type: 'deleted', _oldIndex: oldIndex, deleteFromLineNumber: oldMinimapLineNumber, deleteToLineNumber: oldMinimapLineNumber }; + events.push(lastEvent); + } + oldDeltaLineCount--; + oldIndex++; + } + } else { + // too many events, just give up + events = [{ type: 'flush' }]; + } + + return [new MinimapSamplingState(ratio, result), events]; + } + + constructor( + public readonly samplingRatio: number, + public readonly minimapLines: number[] + ) { + } + + public modelLineToMinimapLine(lineNumber: number): number { + return Math.min(this.minimapLines.length, Math.max(1, Math.round(lineNumber / this.samplingRatio))); + } + + /** + * Will return null if the model line ranges are not intersecting with a sampled model line. + */ + public modelLineRangeToMinimapLineRange(fromLineNumber: number, toLineNumber: number): [number, number] | null { + let fromLineIndex = this.modelLineToMinimapLine(fromLineNumber) - 1; + while (fromLineIndex > 0 && this.minimapLines[fromLineIndex - 1] >= fromLineNumber) { + fromLineIndex--; + } + let toLineIndex = this.modelLineToMinimapLine(toLineNumber) - 1; + while (toLineIndex + 1 < this.minimapLines.length && this.minimapLines[toLineIndex + 1] <= toLineNumber) { + toLineIndex++; + } + if (fromLineIndex === toLineIndex) { + const sampledLineNumber = this.minimapLines[fromLineIndex]; + if (sampledLineNumber < fromLineNumber || sampledLineNumber > toLineNumber) { + // This line is not part of the sampled lines ==> nothing to do + return null; + } + } + return [fromLineIndex + 1, toLineIndex + 1]; + } + + /** + * Will always return a range, even if it is not intersecting with a sampled model line. + */ + public decorationLineRangeToMinimapLineRange(startLineNumber: number, endLineNumber: number): [number, number] { + let minimapLineStart = this.modelLineToMinimapLine(startLineNumber); + let minimapLineEnd = this.modelLineToMinimapLine(endLineNumber); + if (startLineNumber !== endLineNumber && minimapLineEnd === minimapLineStart) { + if (minimapLineEnd === this.minimapLines.length) { + if (minimapLineStart > 1) { + minimapLineStart--; + } + } else { + minimapLineEnd++; + } + } + return [minimapLineStart, minimapLineEnd]; + } + + public onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): [number, number] { + // have the mapping be sticky + const deletedLineCount = e.toLineNumber - e.fromLineNumber + 1; + let changeStartIndex = this.minimapLines.length; + let changeEndIndex = 0; + for (let i = this.minimapLines.length - 1; i >= 0; i--) { + if (this.minimapLines[i] < e.fromLineNumber) { + break; + } + if (this.minimapLines[i] <= e.toLineNumber) { + // this line got deleted => move to previous available + this.minimapLines[i] = Math.max(1, e.fromLineNumber - 1); + changeStartIndex = Math.min(changeStartIndex, i); + changeEndIndex = Math.max(changeEndIndex, i); + } else { + this.minimapLines[i] -= deletedLineCount; + } + } + return [changeStartIndex, changeEndIndex]; + } + + public onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): void { + // have the mapping be sticky + const insertedLineCount = e.toLineNumber - e.fromLineNumber + 1; + for (let i = this.minimapLines.length - 1; i >= 0; i--) { + if (this.minimapLines[i] < e.fromLineNumber) { + break; + } + this.minimapLines[i] += insertedLineCount; + } + } +} + +export class Minimap extends ViewPart implements IMinimapModel { + + public readonly tokensColorTracker: MinimapTokensColorTracker; + + private _selections: Selection[]; + private _minimapSelections: Selection[] | null; + + public options: MinimapOptions; + + private _samplingState: MinimapSamplingState | null; + private _shouldCheckSampling: boolean; + + private _actual: InnerMinimap; + + constructor(context: ViewContext) { + super(context); + + this.tokensColorTracker = MinimapTokensColorTracker.getInstance(); + + this._selections = []; + this._minimapSelections = null; + + this.options = new MinimapOptions(this._context.configuration, this._context.theme, this.tokensColorTracker); + const [samplingState,] = MinimapSamplingState.compute(this.options, this._context.model.getLineCount(), null); + this._samplingState = samplingState; + this._shouldCheckSampling = false; + + this._actual = new InnerMinimap(context.theme, this); + } + + public dispose(): void { + this._actual.dispose(); + super.dispose(); + } + + public getDomNode(): FastDomNode { + return this._actual.getDomNode(); + } + + private _onOptionsMaybeChanged(): boolean { + const opts = new MinimapOptions(this._context.configuration, this._context.theme, this.tokensColorTracker); + if (this.options.equals(opts)) { + return false; + } + this.options = opts; + this._recreateLineSampling(); + this._actual.onDidChangeOptions(); + return true; + } + + // ---- begin view event handlers + + public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { + return this._onOptionsMaybeChanged(); + } + public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean { + this._selections = e.selections; + this._minimapSelections = null; + return this._actual.onSelectionChanged(); + } + public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean { + if (e.affectsMinimap) { + return this._actual.onDecorationsChanged(); + } + return false; + } + public onFlushed(e: viewEvents.ViewFlushedEvent): boolean { + if (this._samplingState) { + this._shouldCheckSampling = true; + } + return this._actual.onFlushed(); + } + public onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean { + if (this._samplingState) { + const minimapLineRange = this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber, e.toLineNumber); + if (minimapLineRange) { + return this._actual.onLinesChanged(minimapLineRange[0], minimapLineRange[1]); + } else { + return false; + } + } else { + return this._actual.onLinesChanged(e.fromLineNumber, e.toLineNumber); + } + } + public onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean { + if (this._samplingState) { + const [changeStartIndex, changeEndIndex] = this._samplingState.onLinesDeleted(e); + if (changeStartIndex <= changeEndIndex) { + this._actual.onLinesChanged(changeStartIndex + 1, changeEndIndex + 1); + } + this._shouldCheckSampling = true; + return true; + } else { + return this._actual.onLinesDeleted(e.fromLineNumber, e.toLineNumber); + } + } + public onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean { + if (this._samplingState) { + this._samplingState.onLinesInserted(e); + this._shouldCheckSampling = true; + return true; + } else { + return this._actual.onLinesInserted(e.fromLineNumber, e.toLineNumber); + } + } + public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean { + return this._actual.onScrollChanged(); + } + public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean { + this._context.model.invalidateMinimapColorCache(); + this._actual.onThemeChanged(); + this._onOptionsMaybeChanged(); + return true; + } + public onTokensChanged(e: viewEvents.ViewTokensChangedEvent): boolean { + if (this._samplingState) { + let ranges: { fromLineNumber: number; toLineNumber: number; }[] = []; + for (const range of e.ranges) { + const minimapLineRange = this._samplingState.modelLineRangeToMinimapLineRange(range.fromLineNumber, range.toLineNumber); + if (minimapLineRange) { + ranges.push({ fromLineNumber: minimapLineRange[0], toLineNumber: minimapLineRange[1] }); + } + } + if (ranges.length) { + return this._actual.onTokensChanged(ranges); + } else { + return false; + } + } else { + return this._actual.onTokensChanged(e.ranges); + } + } + public onTokensColorsChanged(e: viewEvents.ViewTokensColorsChangedEvent): boolean { + return this._actual.onTokensColorsChanged(); + } + public onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean { + return this._actual.onZonesChanged(); + } + + // --- end event handlers + + public prepareRender(ctx: RenderingContext): void { + if (this._shouldCheckSampling) { + this._shouldCheckSampling = false; + this._recreateLineSampling(); + } + } + + public render(ctx: RestrictedRenderingContext): void { + let viewportStartLineNumber = ctx.visibleRange.startLineNumber; + let viewportEndLineNumber = ctx.visibleRange.endLineNumber; + + if (this._samplingState) { + viewportStartLineNumber = this._samplingState.modelLineToMinimapLine(viewportStartLineNumber); + viewportEndLineNumber = this._samplingState.modelLineToMinimapLine(viewportEndLineNumber); + } + + const minimapCtx: IMinimapRenderingContext = { + viewportContainsWhitespaceGaps: (ctx.viewportData.whitespaceViewportData.length > 0), + + scrollWidth: ctx.scrollWidth, + scrollHeight: ctx.scrollHeight, + + viewportStartLineNumber: viewportStartLineNumber, + viewportEndLineNumber: viewportEndLineNumber, + + scrollTop: ctx.scrollTop, + scrollLeft: ctx.scrollLeft, + + viewportWidth: ctx.viewportWidth, + viewportHeight: ctx.viewportHeight, + }; + this._actual.render(minimapCtx); + } + + //#region IMinimapModel + + private _recreateLineSampling(): void { + this._minimapSelections = null; + + const wasSampling = Boolean(this._samplingState); + const [samplingState, events] = MinimapSamplingState.compute(this.options, this._context.model.getLineCount(), this._samplingState); + this._samplingState = samplingState; + + if (wasSampling && this._samplingState) { + // was sampling, is sampling + for (const event of events) { + switch (event.type) { + case 'deleted': + this._actual.onLinesDeleted(event.deleteFromLineNumber, event.deleteToLineNumber); + break; + case 'inserted': + this._actual.onLinesInserted(event.insertFromLineNumber, event.insertToLineNumber); + break; + case 'flush': + this._actual.onFlushed(); + break; + } + } + } + } + + public getLineCount(): number { + if (this._samplingState) { + return this._samplingState.minimapLines.length; + } + return this._context.model.getLineCount(); + } + + public getRealLineCount(): number { + return this._context.model.getLineCount(); + } + + public getLineContent(lineNumber: number): string { + if (this._samplingState) { + return this._context.model.getLineContent(this._samplingState.minimapLines[lineNumber - 1]); + } + return this._context.model.getLineContent(lineNumber); + } + + public getMinimapLinesRenderingData(startLineNumber: number, endLineNumber: number, needed: boolean[]): (ViewLineData | null)[] { + if (this._samplingState) { + let result: (ViewLineData | null)[] = []; + for (let lineIndex = 0, lineCount = endLineNumber - startLineNumber + 1; lineIndex < lineCount; lineIndex++) { + if (needed[lineIndex]) { + result[lineIndex] = this._context.model.getViewLineData(this._samplingState.minimapLines[startLineNumber + lineIndex - 1]); + } else { + result[lineIndex] = null; + } + } + return result; + } + return this._context.model.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed).data; + } + + public getSelections(): Selection[] { + if (this._minimapSelections === null) { + if (this._samplingState) { + this._minimapSelections = []; + for (const selection of this._selections) { + const [minimapLineStart, minimapLineEnd] = this._samplingState.decorationLineRangeToMinimapLineRange(selection.startLineNumber, selection.endLineNumber); + this._minimapSelections.push(new Selection(minimapLineStart, selection.startColumn, minimapLineEnd, selection.endColumn)); + } + } else { + this._minimapSelections = this._selections; + } + } + return this._minimapSelections; + } + + public getMinimapDecorationsInViewport(startLineNumber: number, endLineNumber: number): ViewModelDecoration[] { + let visibleRange: Range; + if (this._samplingState) { + const modelStartLineNumber = this._samplingState.minimapLines[startLineNumber - 1]; + const modelEndLineNumber = this._samplingState.minimapLines[endLineNumber - 1]; + visibleRange = new Range(modelStartLineNumber, 1, modelEndLineNumber, this._context.model.getLineMaxColumn(modelEndLineNumber)); + } else { + visibleRange = new Range(startLineNumber, 1, endLineNumber, this._context.model.getLineMaxColumn(endLineNumber)); + } + const decorations = this._context.model.getDecorationsInViewport(visibleRange); + + if (this._samplingState) { + let result: ViewModelDecoration[] = []; + for (const decoration of decorations) { + if (!decoration.options.minimap) { + continue; + } + const range = decoration.range; + const minimapStartLineNumber = this._samplingState.modelLineToMinimapLine(range.startLineNumber); + const minimapEndLineNumber = this._samplingState.modelLineToMinimapLine(range.endLineNumber); + result.push(new ViewModelDecoration(new Range(minimapStartLineNumber, range.startColumn, minimapEndLineNumber, range.endColumn), decoration.options)); + } + return result; + } + return decorations; + } + + public getOptions(): TextModelResolvedOptions { + return this._context.model.getOptions(); + } + + public revealLineNumber(lineNumber: number): void { + if (this._samplingState) { + lineNumber = this._samplingState.minimapLines[lineNumber - 1]; + } + this._context.privateViewEventBus.emit(new viewEvents.ViewRevealRangeRequestEvent( + 'mouse', + new Range(lineNumber, 1, lineNumber, 1), + viewEvents.VerticalRevealType.Center, + false, + ScrollType.Smooth + )); + } + + public setScrollTop(scrollTop: number): void { + this._context.viewLayout.setScrollPositionNow({ + scrollTop: scrollTop + }); + } + + //#endregion +} + +class InnerMinimap extends Disposable { + + private readonly _theme: EditorTheme; + private readonly _model: IMinimapModel; private readonly _domNode: FastDomNode; private readonly _shadow: FastDomNode; @@ -452,7 +1038,6 @@ export class Minimap extends ViewPart { private readonly _decorationsCanvas: FastDomNode; private readonly _slider: FastDomNode; private readonly _sliderHorizontal: FastDomNode; - private readonly _tokensColorTracker: MinimapTokensColorTracker; private readonly _mouseDownListener: IDisposable; private readonly _sliderMouseMoveMonitor: GlobalMouseMoveMonitor; private readonly _sliderMouseDownListener: IDisposable; @@ -461,21 +1046,24 @@ export class Minimap extends ViewPart { private readonly _sliderTouchMoveListener: IDisposable; private readonly _sliderTouchEndListener: IDisposable; - private _options: MinimapOptions; private _lastRenderData: RenderData | null; - private _selections: Selection[] = []; private _selectionColor: Color | undefined; private _renderDecorations: boolean = false; private _gestureInProgress: boolean = false; private _buffers: MinimapBuffers | null; - constructor(context: ViewContext) { - super(context); + constructor( + theme: EditorTheme, + model: IMinimapModel + ) { + super(); + + this._theme = theme; + this._model = model; - this._options = new MinimapOptions(this._context.configuration); this._lastRenderData = null; this._buffers = null; - this._selectionColor = this._context.theme.getColor(minimapSelection); + this._selectionColor = this._theme.getColor(minimapSelection); this._domNode = createFastDomNode(document.createElement('div')); PartFingerprints.write(this._domNode, PartFingerprint.Minimap); @@ -511,34 +1099,35 @@ export class Minimap extends ViewPart { this._sliderHorizontal.setClassName('minimap-slider-horizontal'); this._slider.appendChild(this._sliderHorizontal); - this._tokensColorTracker = MinimapTokensColorTracker.getInstance(); - this._applyLayout(); this._mouseDownListener = dom.addStandardDisposableListener(this._domNode.domNode, 'mousedown', (e) => { e.preventDefault(); - const renderMinimap = this._options.renderMinimap; + const renderMinimap = this._model.options.renderMinimap; if (renderMinimap === RenderMinimap.None) { return; } if (!this._lastRenderData) { return; } - const minimapLineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale); - const internalOffsetY = this._options.pixelRatio * e.browserEvent.offsetY; + if (this._model.options.minimapHeightIsEditorHeight) { + if (e.leftButton && this._lastRenderData) { + // pretend the click occured in the center of the slider + const position = dom.getDomNodePagePosition(this._slider.domNode); + const initialPosY = position.top + position.height / 2; + this._startSliderDragging(e.buttons, e.posx, initialPosY, e.posy, this._lastRenderData.renderedLayout); + } + return; + } + const minimapLineHeight = this._model.options.minimapLineHeight; + const internalOffsetY = (this._model.options.canvasInnerHeight / this._model.options.canvasOuterHeight) * e.browserEvent.offsetY; const lineIndex = Math.floor(internalOffsetY / minimapLineHeight); let lineNumber = lineIndex + this._lastRenderData.renderedLayout.startLineNumber; - lineNumber = Math.min(lineNumber, this._context.model.getLineCount()); - - this._context.privateViewEventBus.emit(new viewEvents.ViewRevealRangeRequestEvent( - 'mouse', - new Range(lineNumber, 1, lineNumber, 1), - viewEvents.VerticalRevealType.Center, - false, - ScrollType.Smooth - )); + lineNumber = Math.min(lineNumber, this._model.getLineCount()); + + this._model.revealLineNumber(lineNumber); }); this._sliderMouseMoveMonitor = new GlobalMouseMoveMonitor(); @@ -547,34 +1136,7 @@ export class Minimap extends ViewPart { e.preventDefault(); e.stopPropagation(); if (e.leftButton && this._lastRenderData) { - - const initialMousePosition = e.posy; - const initialMouseOrthogonalPosition = e.posx; - const initialSliderState = this._lastRenderData.renderedLayout; - this._slider.toggleClassName('active', true); - - this._sliderMouseMoveMonitor.startMonitoring( - standardMouseMoveMerger, - (mouseMoveData: IStandardMouseMoveEventData) => { - const mouseOrthogonalDelta = Math.abs(mouseMoveData.posx - initialMouseOrthogonalPosition); - - if (platform.isWindows && mouseOrthogonalDelta > MOUSE_DRAG_RESET_DISTANCE) { - // The mouse has wondered away from the scrollbar => reset dragging - this._context.viewLayout.setScrollPositionNow({ - scrollTop: initialSliderState.scrollTop - }); - return; - } - - const mouseDelta = mouseMoveData.posy - initialMousePosition; - this._context.viewLayout.setScrollPositionNow({ - scrollTop: initialSliderState.getDesiredScrollTopFromDelta(mouseDelta) - }); - }, - () => { - this._slider.toggleClassName('active', false); - } - ); + this._startSliderDragging(e.buttons, e.posx, e.posy, e.posy, this._lastRenderData.renderedLayout); } }); @@ -605,12 +1167,41 @@ export class Minimap extends ViewPart { }); } + private _startSliderDragging(initialButtons: number, initialPosX: number, initialPosY: number, posy: number, initialSliderState: MinimapLayout): void { + this._slider.toggleClassName('active', true); + + const handleMouseMove = (posy: number, posx: number) => { + const mouseOrthogonalDelta = Math.abs(posx - initialPosX); + + if (platform.isWindows && mouseOrthogonalDelta > MOUSE_DRAG_RESET_DISTANCE) { + // The mouse has wondered away from the scrollbar => reset dragging + this._model.setScrollTop(initialSliderState.scrollTop); + return; + } + + const mouseDelta = posy - initialPosY; + this._model.setScrollTop(initialSliderState.getDesiredScrollTopFromDelta(mouseDelta)); + }; + + if (posy !== initialPosY) { + handleMouseMove(posy, initialPosX); + } + + this._sliderMouseMoveMonitor.startMonitoring( + this._slider.domNode, + initialButtons, + standardMouseMoveMerger, + (mouseMoveData: IStandardMouseMoveEventData) => handleMouseMove(mouseMoveData.posy, mouseMoveData.posx), + () => { + this._slider.toggleClassName('active', false); + } + ); + } + private scrollDueToTouchEvent(touch: GestureEvent) { const startY = this._domNode.domNode.getBoundingClientRect().top; const scrollTop = this._lastRenderData!.renderedLayout.getDesiredScrollTopFromTouchLocation(touch.pageY - startY); - this._context.viewLayout.setScrollPositionNow({ - scrollTop: scrollTop - }); + this._model.setScrollTop(scrollTop); } public dispose(): void { @@ -625,7 +1216,7 @@ export class Minimap extends ViewPart { } private _getMinimapDomNodeClassName(): string { - if (this._options.showSlider === 'always') { + if (this._model.options.showSlider === 'always') { return 'minimap slider-always'; } return 'minimap slider-mouseover'; @@ -636,121 +1227,105 @@ export class Minimap extends ViewPart { } private _applyLayout(): void { - this._domNode.setLeft(this._options.minimapLeft); - this._domNode.setWidth(this._options.minimapWidth); - this._domNode.setHeight(this._options.minimapHeight); - this._shadow.setHeight(this._options.minimapHeight); - - this._canvas.setWidth(this._options.canvasOuterWidth); - this._canvas.setHeight(this._options.canvasOuterHeight); - this._canvas.domNode.width = this._options.canvasInnerWidth; - this._canvas.domNode.height = this._options.canvasInnerHeight; - - this._decorationsCanvas.setWidth(this._options.canvasOuterWidth); - this._decorationsCanvas.setHeight(this._options.canvasOuterHeight); - this._decorationsCanvas.domNode.width = this._options.canvasInnerWidth; - this._decorationsCanvas.domNode.height = this._options.canvasInnerHeight; - - this._slider.setWidth(this._options.minimapWidth); + this._domNode.setLeft(this._model.options.minimapLeft); + this._domNode.setWidth(this._model.options.minimapWidth); + this._domNode.setHeight(this._model.options.minimapHeight); + this._shadow.setHeight(this._model.options.minimapHeight); + + this._canvas.setWidth(this._model.options.canvasOuterWidth); + this._canvas.setHeight(this._model.options.canvasOuterHeight); + this._canvas.domNode.width = this._model.options.canvasInnerWidth; + this._canvas.domNode.height = this._model.options.canvasInnerHeight; + + this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth); + this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight); + this._decorationsCanvas.domNode.width = this._model.options.canvasInnerWidth; + this._decorationsCanvas.domNode.height = this._model.options.canvasInnerHeight; + + this._slider.setWidth(this._model.options.minimapWidth); } - private _getBuffer(): ImageData { + private _getBuffer(): ImageData | null { if (!this._buffers) { - this._buffers = new MinimapBuffers( - this._canvas.domNode.getContext('2d')!, - this._options.canvasInnerWidth, - this._options.canvasInnerHeight, - this._tokensColorTracker.getColor(ColorId.DefaultBackground) - ); + if (this._model.options.canvasInnerWidth > 0 && this._model.options.canvasInnerHeight > 0) { + this._buffers = new MinimapBuffers( + this._canvas.domNode.getContext('2d')!, + this._model.options.canvasInnerWidth, + this._model.options.canvasInnerHeight, + this._model.options.backgroundColor + ); + } } - return this._buffers!.getBuffer(); + return this._buffers ? this._buffers.getBuffer() : null; } - private _onOptionsMaybeChanged(): boolean { - const opts = new MinimapOptions(this._context.configuration); - if (this._options.equals(opts)) { - return false; - } - this._options = opts; + // ---- begin view event handlers + + public onDidChangeOptions(): void { this._lastRenderData = null; this._buffers = null; this._applyLayout(); this._domNode.setClassName(this._getMinimapDomNodeClassName()); - return true; } - - // ---- begin view event handlers - - public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { - return this._onOptionsMaybeChanged(); + public onSelectionChanged(): boolean { + this._renderDecorations = true; + return true; } - public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean { - this._selections = e.selections; + public onDecorationsChanged(): boolean { this._renderDecorations = true; return true; } - public onFlushed(e: viewEvents.ViewFlushedEvent): boolean { + public onFlushed(): boolean { this._lastRenderData = null; return true; } - public onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean { + public onLinesChanged(changeFromLineNumber: number, changeToLineNumber: number): boolean { if (this._lastRenderData) { - return this._lastRenderData.onLinesChanged(e); + return this._lastRenderData.onLinesChanged(changeFromLineNumber, changeToLineNumber); } return false; } - public onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean { + public onLinesDeleted(deleteFromLineNumber: number, deleteToLineNumber: number): boolean { if (this._lastRenderData) { - this._lastRenderData.onLinesDeleted(e); + this._lastRenderData.onLinesDeleted(deleteFromLineNumber, deleteToLineNumber); } return true; } - public onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean { + public onLinesInserted(insertFromLineNumber: number, insertToLineNumber: number): boolean { if (this._lastRenderData) { - this._lastRenderData.onLinesInserted(e); + this._lastRenderData.onLinesInserted(insertFromLineNumber, insertToLineNumber); } return true; } - public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean { + public onScrollChanged(): boolean { this._renderDecorations = true; return true; } - public onTokensChanged(e: viewEvents.ViewTokensChangedEvent): boolean { + public onThemeChanged(): boolean { + this._selectionColor = this._theme.getColor(minimapSelection); + this._renderDecorations = true; + return true; + } + public onTokensChanged(ranges: { fromLineNumber: number; toLineNumber: number; }[]): boolean { if (this._lastRenderData) { - return this._lastRenderData.onTokensChanged(e); + return this._lastRenderData.onTokensChanged(ranges); } return false; } - public onTokensColorsChanged(e: viewEvents.ViewTokensColorsChangedEvent): boolean { + public onTokensColorsChanged(): boolean { this._lastRenderData = null; this._buffers = null; return true; } - public onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean { + public onZonesChanged(): boolean { this._lastRenderData = null; return true; } - public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean { - this._renderDecorations = true; - return true; - } - - public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean { - this._context.model.invalidateMinimapColorCache(); - this._selectionColor = this._context.theme.getColor(minimapSelection); - this._renderDecorations = true; - return true; - } - // --- end event handlers - public prepareRender(ctx: RenderingContext): void { - // Nothing to read - } - - public render(renderingCtx: RestrictedRenderingContext): void { - const renderMinimap = this._options.renderMinimap; + public render(renderingCtx: IMinimapRenderingContext): void { + const renderMinimap = this._model.options.renderMinimap; if (renderMinimap === RenderMinimap.None) { this._shadow.setClassName('minimap-shadow-hidden'); this._sliderHorizontal.setWidth(0); @@ -764,24 +1339,26 @@ export class Minimap extends ViewPart { } const layout = MinimapLayout.create( - this._options, - renderingCtx.visibleRange.startLineNumber, - renderingCtx.visibleRange.endLineNumber, + this._model.options, + renderingCtx.viewportStartLineNumber, + renderingCtx.viewportEndLineNumber, renderingCtx.viewportHeight, - (renderingCtx.viewportData.whitespaceViewportData.length > 0), - this._context.model.getLineCount(), + renderingCtx.viewportContainsWhitespaceGaps, + this._model.getLineCount(), + this._model.getRealLineCount(), renderingCtx.scrollTop, renderingCtx.scrollHeight, this._lastRenderData ? this._lastRenderData.renderedLayout : null ); + this._slider.setDisplay(layout.sliderNeeded ? 'block' : 'none'); this._slider.setTop(layout.sliderTop); this._slider.setHeight(layout.sliderHeight); // Compute horizontal slider coordinates - const scrollLeftChars = renderingCtx.scrollLeft / this._options.typicalHalfwidthCharacterWidth; - const horizontalSliderLeft = Math.min(this._options.minimapWidth, Math.round(scrollLeftChars * getMinimapCharWidth(this._options.renderMinimap, this._options.fontScale) / this._options.pixelRatio)); + const scrollLeftChars = renderingCtx.scrollLeft / this._model.options.typicalHalfwidthCharacterWidth; + const horizontalSliderLeft = Math.min(this._model.options.minimapWidth, Math.round(scrollLeftChars * this._model.options.minimapCharWidth / this._model.options.pixelRatio)); this._sliderHorizontal.setLeft(horizontalSliderLeft); - this._sliderHorizontal.setWidth(this._options.minimapWidth - horizontalSliderLeft); + this._sliderHorizontal.setWidth(this._model.options.minimapWidth - horizontalSliderLeft); this._sliderHorizontal.setTop(0); this._sliderHorizontal.setHeight(layout.sliderHeight); @@ -792,19 +1369,20 @@ export class Minimap extends ViewPart { private renderDecorations(layout: MinimapLayout) { if (this._renderDecorations) { this._renderDecorations = false; - const decorations = this._context.model.getDecorationsInViewport(new Range(layout.startLineNumber, 1, layout.endLineNumber, this._context.model.getLineMaxColumn(layout.endLineNumber))); + const selections = this._model.getSelections(); + const decorations = this._model.getMinimapDecorationsInViewport(layout.startLineNumber, layout.endLineNumber); - const { renderMinimap, canvasInnerWidth, canvasInnerHeight } = this._options; - const lineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale); - const characterWidth = getMinimapCharWidth(renderMinimap, this._options.fontScale); - const tabSize = this._context.model.getOptions().tabSize; + const { canvasInnerWidth, canvasInnerHeight } = this._model.options; + const lineHeight = this._model.options.minimapLineHeight; + const characterWidth = this._model.options.minimapCharWidth; + const tabSize = this._model.getOptions().tabSize; const canvasContext = this._decorationsCanvas.domNode.getContext('2d')!; canvasContext.clearRect(0, 0, canvasInnerWidth, canvasInnerHeight); const lineOffsetMap = new Map(); - for (let i = 0; i < this._selections.length; i++) { - const selection = this._selections[i]; + for (let i = 0; i < selections.length; i++) { + const selection = selections[i]; for (let line = selection.startLineNumber; line <= selection.endLineNumber; line++) { this.renderDecorationOnLine(canvasContext, lineOffsetMap, selection, this._selectionColor, layout, line, lineHeight, lineHeight, tabSize, characterWidth); @@ -819,7 +1397,7 @@ export class Minimap extends ViewPart { continue; } - const decorationColor = (decoration.options.minimap).getColor(this._context.theme); + const decorationColor = (decoration.options.minimap).getColor(this._theme); for (let line = decoration.range.startLineNumber; line <= decoration.range.endLineNumber; line++) { switch (decoration.options.minimap.position) { @@ -850,11 +1428,16 @@ export class Minimap extends ViewPart { charWidth: number): void { const y = (lineNumber - layout.startLineNumber) * lineHeight; + // Skip rendering the line if it's vertically outside our viewport + if (y + height < 0 || y > this._model.options.canvasInnerHeight) { + return; + } + // Cache line offset data so that it is only read once per line let lineIndexToXOffset = lineOffsetMap.get(lineNumber); const isFirstDecorationForLine = !lineIndexToXOffset; if (!lineIndexToXOffset) { - const lineData = this._context.model.getLineContent(lineNumber); + const lineData = this._model.getLineContent(lineNumber); lineIndexToXOffset = [MINIMAP_GUTTER_WIDTH]; for (let i = 1; i < lineData.length + 1; i++) { const charCode = lineData.charCodeAt(i - 1); @@ -898,11 +1481,10 @@ export class Minimap extends ViewPart { canvasContext.fillRect(x, y, width, height); } - private renderLines(layout: MinimapLayout): RenderData { - const renderMinimap = this._options.renderMinimap; + private renderLines(layout: MinimapLayout): RenderData | null { const startLineNumber = layout.startLineNumber; const endLineNumber = layout.endLineNumber; - const minimapLineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale); + const minimapLineHeight = this._model.options.minimapLineHeight; // Check if nothing changed w.r.t. lines from last frame if (this._lastRenderData && this._lastRenderData.linesEquals(layout)) { @@ -914,9 +1496,13 @@ export class Minimap extends ViewPart { // Oh well!! We need to repaint some lines... const imageData = this._getBuffer(); + if (!imageData) { + // 0 width or 0 height canvas, nothing to do + return null; + } // Render untouched lines by using last rendered data. - let [_dirtyY1, _dirtyY2, needed] = Minimap._renderUntouchedLines( + let [_dirtyY1, _dirtyY2, needed] = InnerMinimap._renderUntouchedLines( imageData, startLineNumber, endLineNumber, @@ -925,27 +1511,39 @@ export class Minimap extends ViewPart { ); // Fetch rendering info from view model for rest of lines that need rendering. - const lineInfo = this._context.model.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed); - const tabSize = lineInfo.tabSize; - const background = this._tokensColorTracker.getColor(ColorId.DefaultBackground); - const useLighterFont = this._tokensColorTracker.backgroundIsLight(); + const lineInfo = this._model.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed); + const tabSize = this._model.getOptions().tabSize; + const background = this._model.options.backgroundColor; + const tokensColorTracker = this._model.tokensColorTracker; + const useLighterFont = tokensColorTracker.backgroundIsLight(); + const renderMinimap = this._model.options.renderMinimap; + const charRenderer = this._model.options.charRenderer(); + const fontScale = this._model.options.fontScale; + const minimapCharWidth = this._model.options.minimapCharWidth; + + const baseCharHeight = (renderMinimap === RenderMinimap.Text ? Constants.BASE_CHAR_HEIGHT : Constants.BASE_CHAR_HEIGHT + 1); + const renderMinimapLineHeight = baseCharHeight * fontScale; + const innerLinePadding = (minimapLineHeight > renderMinimapLineHeight ? Math.floor((minimapLineHeight - renderMinimapLineHeight) / 2) : 0); // Render the rest of lines let dy = 0; const renderedLines: MinimapLine[] = []; for (let lineIndex = 0, lineCount = endLineNumber - startLineNumber + 1; lineIndex < lineCount; lineIndex++) { if (needed[lineIndex]) { - Minimap._renderLine( + InnerMinimap._renderLine( imageData, background, useLighterFont, renderMinimap, - this._tokensColorTracker, - this._options.charRenderer, + minimapCharWidth, + tokensColorTracker, + charRenderer, dy, + innerLinePadding, tabSize, - lineInfo.data[lineIndex]!, - this._options.fontScale + lineInfo[lineIndex]!, + fontScale, + minimapLineHeight ); } renderedLines[lineIndex] = new MinimapLine(dy); @@ -1065,17 +1663,20 @@ export class Minimap extends ViewPart { backgroundColor: RGBA8, useLighterFont: boolean, renderMinimap: RenderMinimap, + charWidth: number, colorTracker: MinimapTokensColorTracker, minimapCharRenderer: MinimapCharRenderer, dy: number, + innerLinePadding: number, tabSize: number, lineData: ViewLineData, - fontScale: number + fontScale: number, + minimapLineHeight: number ): void { const content = lineData.content; const tokens = lineData.tokens; - const charWidth = getMinimapCharWidth(renderMinimap, fontScale); const maxDx = target.width - charWidth; + const force1pxHeight = (minimapLineHeight === 1); let dx = MINIMAP_GUTTER_WIDTH; let charIndex = 0; @@ -1107,9 +1708,9 @@ export class Minimap extends ViewPart { for (let i = 0; i < count; i++) { if (renderMinimap === RenderMinimap.Blocks) { - minimapCharRenderer.blockRenderChar(target, dx, dy, tokenColor, backgroundColor, useLighterFont); + minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, backgroundColor, useLighterFont, force1pxHeight); } else { // RenderMinimap.Text - minimapCharRenderer.renderChar(target, dx, dy, charCode, tokenColor, backgroundColor, useLighterFont); + minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, backgroundColor, fontScale, useLighterFont, force1pxHeight); } dx += charWidth; @@ -1126,20 +1727,21 @@ export class Minimap extends ViewPart { } registerThemingParticipant((theme, collector) => { - const sliderBackground = theme.getColor(scrollbarSliderBackground); + const minimapBackgroundValue = theme.getColor(minimapBackground); + if (minimapBackgroundValue) { + collector.addRule(`.monaco-editor .minimap > canvas { opacity: ${minimapBackgroundValue.rgba.a}; will-change: opacity; }`); + } + const sliderBackground = theme.getColor(minimapSliderBackground); if (sliderBackground) { - const halfSliderBackground = sliderBackground.transparent(0.5); - collector.addRule(`.monaco-editor .minimap-slider, .monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${halfSliderBackground}; }`); + collector.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${sliderBackground}; }`); } - const sliderHoverBackground = theme.getColor(scrollbarSliderHoverBackground); + const sliderHoverBackground = theme.getColor(minimapSliderHoverBackground); if (sliderHoverBackground) { - const halfSliderHoverBackground = sliderHoverBackground.transparent(0.5); - collector.addRule(`.monaco-editor .minimap-slider:hover, .monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${halfSliderHoverBackground}; }`); + collector.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${sliderHoverBackground}; }`); } - const sliderActiveBackground = theme.getColor(scrollbarSliderActiveBackground); + const sliderActiveBackground = theme.getColor(minimapSliderActiveBackground); if (sliderActiveBackground) { - const halfSliderActiveBackground = sliderActiveBackground.transparent(0.5); - collector.addRule(`.monaco-editor .minimap-slider.active, .monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${halfSliderActiveBackground}; }`); + collector.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${sliderActiveBackground}; }`); } const shadow = theme.getColor(scrollbarShadow); if (shadow) { diff --git a/src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts b/src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts index e1136ab6c286b..c30b720c207a6 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts @@ -5,6 +5,7 @@ import { RGBA8 } from 'vs/editor/common/core/rgba'; import { Constants, getCharIndex } from './minimapCharSheet'; +import { toUint8 } from 'vs/base/common/uint'; export class MinimapCharRenderer { _minimapCharRendererBrand: void; @@ -20,7 +21,7 @@ export class MinimapCharRenderer { private static soften(input: Uint8ClampedArray, ratio: number): Uint8ClampedArray { let result = new Uint8ClampedArray(input.length); for (let i = 0, len = input.length; i < len; i++) { - result[i] = input[i] * ratio; + result[i] = toUint8(input[i] * ratio); } return result; } @@ -32,17 +33,20 @@ export class MinimapCharRenderer { chCode: number, color: RGBA8, backgroundColor: RGBA8, - useLighterFont: boolean + fontScale: number, + useLighterFont: boolean, + force1pxHeight: boolean ): void { const charWidth = Constants.BASE_CHAR_WIDTH * this.scale; const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale; - if (dx + charWidth > target.width || dy + charHeight > target.height) { + const renderHeight = (force1pxHeight ? 1 : charHeight); + if (dx + charWidth > target.width || dy + renderHeight > target.height) { console.warn('bad render request outside image data'); return; } const charData = useLighterFont ? this.charDataLight : this.charDataNormal; - const charIndex = getCharIndex(chCode); + const charIndex = getCharIndex(chCode, fontScale); const destWidth = target.width * Constants.RGBA_CHANNELS_CNT; @@ -58,7 +62,7 @@ export class MinimapCharRenderer { let sourceOffset = charIndex * charWidth * charHeight; let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT; - for (let y = 0; y < charHeight; y++) { + for (let y = 0; y < renderHeight; y++) { let column = row; for (let x = 0; x < charWidth; x++) { const c = charData[sourceOffset++] / 255; @@ -78,11 +82,13 @@ export class MinimapCharRenderer { dy: number, color: RGBA8, backgroundColor: RGBA8, - useLighterFont: boolean + useLighterFont: boolean, + force1pxHeight: boolean ): void { const charWidth = Constants.BASE_CHAR_WIDTH * this.scale; const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale; - if (dx + charWidth > target.width || dy + charHeight > target.height) { + const renderHeight = (force1pxHeight ? 1 : charHeight); + if (dx + charWidth > target.width || dy + renderHeight > target.height) { console.warn('bad render request outside image data'); return; } @@ -106,7 +112,7 @@ export class MinimapCharRenderer { const dest = target.data; let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT; - for (let y = 0; y < charHeight; y++) { + for (let y = 0; y < renderHeight; y++) { let column = row; for (let x = 0; x < charWidth; x++) { dest[column++] = colorR; diff --git a/src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts b/src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts index b0b91e2bca00a..46c6c8e27a992 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts @@ -5,7 +5,9 @@ import { MinimapCharRenderer } from 'vs/editor/browser/viewParts/minimap/minimapCharRenderer'; import { allCharCodes } from 'vs/editor/browser/viewParts/minimap/minimapCharSheet'; +import { prebakedMiniMaps } from 'vs/editor/browser/viewParts/minimap/minimapPreBaked'; import { Constants } from './minimapCharSheet'; +import { toUint8 } from 'vs/base/common/uint'; /** * Creates character renderers. It takes a 'scale' that determines how large @@ -28,10 +30,16 @@ export class MinimapCharRendererFactory { return this.lastCreated; } - const factory = MinimapCharRendererFactory.createFromSampleData( - MinimapCharRendererFactory.createSampleData(fontFamily).data, - scale - ); + let factory: MinimapCharRenderer; + if (prebakedMiniMaps[scale]) { + factory = new MinimapCharRenderer(prebakedMiniMaps[scale](), scale); + } else { + factory = MinimapCharRendererFactory.createFromSampleData( + MinimapCharRendererFactory.createSampleData(fontFamily).data, + scale + ); + } + this.lastFontFamily = fontFamily; this.lastCreated = factory; return factory; @@ -128,7 +136,7 @@ export class MinimapCharRendererFactory { const final = value / samples; brightest = Math.max(brightest, final); - dest[targetIndex++] = final; + dest[targetIndex++] = toUint8(final); } } diff --git a/src/vs/editor/browser/viewParts/minimap/minimapCharSheet.ts b/src/vs/editor/browser/viewParts/minimap/minimapCharSheet.ts index af7b0eae4f8de..cda6dc9e7ee56 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimapCharSheet.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimapCharSheet.ts @@ -29,9 +29,13 @@ export const allCharCodes: ReadonlyArray = (() => { return v; })(); -export const getCharIndex = (chCode: number) => { +export const getCharIndex = (chCode: number, fontScale: number) => { chCode -= Constants.START_CH_CODE; if (chCode < 0 || chCode > Constants.CHAR_COUNT) { + if (fontScale <= 2) { + // for smaller scales, we can get away with using any ASCII character... + return (chCode + Constants.CHAR_COUNT) % Constants.CHAR_COUNT; + } return Constants.CHAR_COUNT - 1; // unknown symbol } diff --git a/src/vs/editor/browser/viewParts/minimap/minimapPreBaked.ts b/src/vs/editor/browser/viewParts/minimap/minimapPreBaked.ts new file mode 100644 index 0000000000000..578805adb446a --- /dev/null +++ b/src/vs/editor/browser/viewParts/minimap/minimapPreBaked.ts @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { once } from 'vs/base/common/functional'; + +const charTable: { [hex: string]: number } = { + '0': 0, + '1': 1, + '2': 2, + '3': 3, + '4': 4, + '5': 5, + '6': 6, + '7': 7, + '8': 8, + '9': 9, + A: 10, + B: 11, + C: 12, + D: 13, + E: 14, + F: 15 +}; + +const decodeData = (str: string) => { + const output = new Uint8ClampedArray(str.length / 2); + for (let i = 0; i < str.length; i += 2) { + output[i >> 1] = (charTable[str[i]] << 4) | (charTable[str[i + 1]] & 0xF); + } + + return output; +}; + +/* +const encodeData = (data: Uint8ClampedArray, length: string) => { + const chars = '0123456789ABCDEF'; + let output = ''; + for (let i = 0; i < data.length; i++) { + output += chars[data[i] >> 4] + chars[data[i] & 0xf]; + } + return output; +}; +*/ + +/** + * Map of minimap scales to prebaked sample data at those scales. We don't + * sample much larger data, because then font family becomes visible, which + * is use-configurable. + */ +export const prebakedMiniMaps: { [scale: number]: () => Uint8ClampedArray } = { + 1: once(() => + decodeData( + '0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792' + ) + ), + 2: once(() => + decodeData( + '000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126' + ) + ) +}; diff --git a/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts b/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts index 687b9985268b1..bd1aa10f8a8f0 100644 --- a/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts +++ b/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts @@ -12,9 +12,8 @@ import { IConfiguration } from 'vs/editor/common/editorCommon'; import { TokenizationRegistry } from 'vs/editor/common/modes'; import { editorCursorForeground, editorOverviewRulerBorder } from 'vs/editor/common/view/editorColorRegistry'; import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; -import { ViewContext } from 'vs/editor/common/view/viewContext'; +import { ViewContext, EditorTheme } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; -import { ITheme } from 'vs/platform/theme/common/themeService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; class Settings { @@ -42,7 +41,7 @@ class Settings { public readonly x: number[]; public readonly w: number[]; - constructor(config: IConfiguration, theme: ITheme) { + constructor(config: IConfiguration, theme: EditorTheme) { const options = config.options; this.lineHeight = options.get(EditorOption.lineHeight); this.pixelRatio = options.get(EditorOption.pixelRatio); @@ -74,8 +73,14 @@ class Settings { this.right = position.right; this.domWidth = position.width; this.domHeight = position.height; - this.canvasWidth = (this.domWidth * this.pixelRatio) | 0; - this.canvasHeight = (this.domHeight * this.pixelRatio) | 0; + if (this.overviewRulerLanes === 0) { + // overview ruler is off + this.canvasWidth = 0; + this.canvasHeight = 0; + } else { + this.canvasWidth = (this.domWidth * this.pixelRatio) | 0; + this.canvasHeight = (this.domHeight * this.pixelRatio) | 0; + } const [x, w] = this._initLanes(1, this.canvasWidth, this.overviewRulerLanes); this.x = x; @@ -271,7 +276,10 @@ export class DecorationsOverviewRuler extends ViewPart { return true; } public onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean { - return true; + if (e.affectsOverviewRuler) { + return true; + } + return false; } public onFlushed(e: viewEvents.ViewFlushedEvent): boolean { return true; @@ -303,6 +311,11 @@ export class DecorationsOverviewRuler extends ViewPart { } private _render(): void { + if (this._settings.overviewRulerLanes === 0) { + // overview ruler is off + this._domNode.setBackgroundColor(this._settings.backgroundColor ? this._settings.backgroundColor : ''); + return; + } const canvasWidth = this._settings.canvasWidth; const canvasHeight = this._settings.canvasHeight; const lineHeight = this._settings.lineHeight; diff --git a/src/vs/editor/browser/viewParts/rulers/rulers.ts b/src/vs/editor/browser/viewParts/rulers/rulers.ts index 0f22de06a7372..68621081a8e86 100644 --- a/src/vs/editor/browser/viewParts/rulers/rulers.ts +++ b/src/vs/editor/browser/viewParts/rulers/rulers.ts @@ -11,13 +11,13 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v import { ViewContext } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { EditorOption, IRulerOption } from 'vs/editor/common/config/editorOptions'; export class Rulers extends ViewPart { public domNode: FastDomNode; private readonly _renderedRulers: FastDomNode[]; - private _rulers: number[]; + private _rulers: IRulerOption[]; private _typicalHalfwidthCharacterWidth: number; constructor(context: ViewContext) { @@ -92,9 +92,11 @@ export class Rulers extends ViewPart { for (let i = 0, len = this._rulers.length; i < len; i++) { const node = this._renderedRulers[i]; + const ruler = this._rulers[i]; + node.setBoxShadow(ruler.color ? `1px 0 0 0 ${ruler.color} inset` : ``); node.setHeight(Math.min(ctx.scrollHeight, 1000000)); - node.setLeft(this._rulers[i] * this._typicalHalfwidthCharacterWidth); + node.setLeft(ruler.column * this._typicalHalfwidthCharacterWidth); } } } diff --git a/src/vs/editor/browser/viewParts/selections/selections.ts b/src/vs/editor/browser/viewParts/selections/selections.ts index fa2dd7220331b..d50b0f5679b3f 100644 --- a/src/vs/editor/browser/viewParts/selections/selections.ts +++ b/src/vs/editor/browser/viewParts/selections/selections.ts @@ -369,7 +369,7 @@ export class SelectionsOverlay extends DynamicViewOverlay { private _previousFrameVisibleRangesWithStyle: (LineVisibleRangesWithStyle[] | null)[] = []; public prepareRender(ctx: RenderingContext): void { - // Build HTML for inner corners separate from HTML for the the rest of selections, + // Build HTML for inner corners separate from HTML for the rest of selections, // as the inner corner HTML can interfere with that of other selections. // In final render, make sure to place the inner corner HTML before the rest of selection HTML. See issue #77777. const output: [string, string][] = []; diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css index d77870c24a21b..59b084e5922ab 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css @@ -15,7 +15,7 @@ /* -- smooth-caret-animation -- */ .monaco-editor .cursors-layer.cursor-smooth-caret-animation > .cursor { - transition: 80ms; + transition: all 80ms; } /* -- block-outline-style -- */ @@ -85,4 +85,4 @@ .cursor-expand > .cursor { animation: monaco-cursor-expand 0.5s ease-in-out 0s 20 alternate; -} \ No newline at end of file +} diff --git a/src/vs/editor/browser/viewParts/viewZones/viewZones.ts b/src/vs/editor/browser/viewParts/viewZones/viewZones.ts index 6d7e14730894b..5e28b7785ecfc 100644 --- a/src/vs/editor/browser/viewParts/viewZones/viewZones.ts +++ b/src/vs/editor/browser/viewParts/viewZones/viewZones.ts @@ -5,7 +5,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; import { onUnexpectedError } from 'vs/base/common/errors'; -import { IViewZone } from 'vs/editor/browser/editorBrowser'; +import { IViewZone, IViewZoneChangeAccessor } from 'vs/editor/browser/editorBrowser'; import { ViewPart } from 'vs/editor/browser/view/viewPart'; import { Position } from 'vs/editor/common/core/position'; import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; @@ -13,7 +13,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { IViewWhitespaceViewportData } from 'vs/editor/common/viewModel/viewModel'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; - +import { IWhitespaceChangeAccessor, IEditorWhitespace } from 'vs/editor/common/viewLayout/linesLayout'; export interface IMyViewZone { whitespaceId: string; @@ -29,6 +29,8 @@ interface IComputedViewZoneProps { minWidthInPx: number; } +const invalidFunc = () => { throw new Error(`Invalid change accessor`); }; + export class ViewZones extends ViewPart { private _zones: { [id: string]: IMyViewZone; }; @@ -72,20 +74,29 @@ export class ViewZones extends ViewPart { // ---- begin view event handlers private _recomputeWhitespacesProps(): boolean { - let hadAChange = false; - - const keys = Object.keys(this._zones); - for (let i = 0, len = keys.length; i < len; i++) { - const id = keys[i]; - const zone = this._zones[id]; - const props = this._computeWhitespaceProps(zone.delegate); - if (this._context.viewLayout.changeWhitespace(id, props.afterViewLineNumber, props.heightInPx)) { - this._safeCallOnComputedHeight(zone.delegate, props.heightInPx); - hadAChange = true; - } + const whitespaces = this._context.viewLayout.getWhitespaces(); + const oldWhitespaces = new Map(); + for (const whitespace of whitespaces) { + oldWhitespaces.set(whitespace.id, whitespace); } + return this._context.viewLayout.changeWhitespace((whitespaceAccessor: IWhitespaceChangeAccessor) => { + let hadAChange = false; + + const keys = Object.keys(this._zones); + for (let i = 0, len = keys.length; i < len; i++) { + const id = keys[i]; + const zone = this._zones[id]; + const props = this._computeWhitespaceProps(zone.delegate); + const oldWhitespace = oldWhitespaces.get(id); + if (oldWhitespace && (oldWhitespace.afterLineNumber !== props.afterViewLineNumber || oldWhitespace.height !== props.heightInPx)) { + whitespaceAccessor.changeOneWhitespace(id, props.afterViewLineNumber, props.heightInPx); + this._safeCallOnComputedHeight(zone.delegate, props.heightInPx); + hadAChange = true; + } + } - return hadAChange; + return hadAChange; + }); } public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { @@ -138,7 +149,6 @@ export class ViewZones extends ViewPart { return 10000; } - private _computeWhitespaceProps(zone: IViewZone): IComputedViewZoneProps { if (zone.afterLineNumber === 0) { return { @@ -188,9 +198,44 @@ export class ViewZones extends ViewPart { }; } - public addZone(zone: IViewZone): string { + public changeViewZones(callback: (changeAccessor: IViewZoneChangeAccessor) => any): boolean { + + return this._context.viewLayout.changeWhitespace((whitespaceAccessor: IWhitespaceChangeAccessor) => { + let zonesHaveChanged = false; + + const changeAccessor: IViewZoneChangeAccessor = { + addZone: (zone: IViewZone): string => { + zonesHaveChanged = true; + return this._addZone(whitespaceAccessor, zone); + }, + removeZone: (id: string): void => { + if (!id) { + return; + } + zonesHaveChanged = this._removeZone(whitespaceAccessor, id) || zonesHaveChanged; + }, + layoutZone: (id: string): void => { + if (!id) { + return; + } + zonesHaveChanged = this._layoutZone(whitespaceAccessor, id) || zonesHaveChanged; + } + }; + + safeInvoke1Arg(callback, changeAccessor); + + // Invalidate changeAccessor + changeAccessor.addZone = invalidFunc; + changeAccessor.removeZone = invalidFunc; + changeAccessor.layoutZone = invalidFunc; + + return zonesHaveChanged; + }); + } + + private _addZone(whitespaceAccessor: IWhitespaceChangeAccessor, zone: IViewZone): string { const props = this._computeWhitespaceProps(zone); - const whitespaceId = this._context.viewLayout.addWhitespace(props.afterViewLineNumber, this._getZoneOrdinal(zone), props.heightInPx, props.minWidthInPx); + const whitespaceId = whitespaceAccessor.insertWhitespace(props.afterViewLineNumber, this._getZoneOrdinal(zone), props.heightInPx, props.minWidthInPx); const myZone: IMyViewZone = { whitespaceId: whitespaceId, @@ -224,11 +269,11 @@ export class ViewZones extends ViewPart { return myZone.whitespaceId; } - public removeZone(id: string): boolean { + private _removeZone(whitespaceAccessor: IWhitespaceChangeAccessor, id: string): boolean { if (this._zones.hasOwnProperty(id)) { const zone = this._zones[id]; delete this._zones[id]; - this._context.viewLayout.removeWhitespace(zone.whitespaceId); + whitespaceAccessor.removeWhitespace(zone.whitespaceId); zone.domNode.removeAttribute('monaco-visible-view-zone'); zone.domNode.removeAttribute('monaco-view-zone'); @@ -247,21 +292,20 @@ export class ViewZones extends ViewPart { return false; } - public layoutZone(id: string): boolean { - let changed = false; + private _layoutZone(whitespaceAccessor: IWhitespaceChangeAccessor, id: string): boolean { if (this._zones.hasOwnProperty(id)) { const zone = this._zones[id]; const props = this._computeWhitespaceProps(zone.delegate); // const newOrdinal = this._getZoneOrdinal(zone.delegate); - changed = this._context.viewLayout.changeWhitespace(zone.whitespaceId, props.afterViewLineNumber, props.heightInPx) || changed; + whitespaceAccessor.changeOneWhitespace(zone.whitespaceId, props.afterViewLineNumber, props.heightInPx); // TODO@Alex: change `newOrdinal` too - if (changed) { - this._safeCallOnComputedHeight(zone.delegate, props.heightInPx); - this.setShouldRender(); - } + this._safeCallOnComputedHeight(zone.delegate, props.heightInPx); + this.setShouldRender(); + + return true; } - return changed; + return false; } public shouldSuppressMouseDownOnViewZone(id: string): boolean { @@ -365,3 +409,11 @@ export class ViewZones extends ViewPart { } } } + +function safeInvoke1Arg(func: Function, arg1: any): any { + try { + return func(arg1); + } catch (e) { + onUnexpectedError(e); + } +} diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 83e47a48f1dd3..c8be02dfba7e7 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -22,7 +22,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService import { ICommandDelegate } from 'vs/editor/browser/view/viewController'; import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl'; import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents'; -import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, IEditorConstructionOptions } from 'vs/editor/common/config/editorOptions'; +import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, IEditorConstructionOptions, filterValidationDecorations } from 'vs/editor/common/config/editorOptions'; import { Cursor, CursorStateChangedEvent } from 'vs/editor/common/controller/cursor'; import { CursorColumns, ICursors } from 'vs/editor/common/controller/cursorCommon'; import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; @@ -40,7 +40,7 @@ import * as modes from 'vs/editor/common/modes'; import { editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity } from 'vs/editor/common/view/editorColorRegistry'; import { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorWarningBorder, editorWarningForeground, editorForeground } from 'vs/platform/theme/common/colorRegistry'; import { VerticalRevealType } from 'vs/editor/common/view/viewEvents'; -import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer'; +import { IEditorWhitespace } from 'vs/editor/common/viewLayout/linesLayout'; import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; @@ -50,11 +50,11 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { MonospaceLineBreaksComputerFactory } from 'vs/editor/common/viewModel/monospaceLineBreaksComputer'; +import { DOMLineBreaksComputerFactory } from 'vs/editor/browser/view/domLineBreaksComputer'; let EDITOR_ID = 0; -const SHOW_UNUSED_ENABLED_CLASS = 'showUnused'; - export interface ICodeEditorWidgetOptions { /** * Is this a simple widget (not a real code editor) ? @@ -156,13 +156,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE private readonly _onDidType: Emitter = this._register(new Emitter()); public readonly onDidType = this._onDidType.event; - private readonly _onCompositionStart: Emitter = this._register(new Emitter()); - public readonly onCompositionStart = this._onCompositionStart.event; + private readonly _onDidCompositionStart: Emitter = this._register(new Emitter()); + public readonly onDidCompositionStart = this._onDidCompositionStart.event; - private readonly _onCompositionEnd: Emitter = this._register(new Emitter()); - public readonly onCompositionEnd = this._onCompositionEnd.event; + private readonly _onDidCompositionEnd: Emitter = this._register(new Emitter()); + public readonly onDidCompositionEnd = this._onDidCompositionEnd.event; - private readonly _onDidPaste: Emitter = this._register(new Emitter()); + private readonly _onDidPaste: Emitter = this._register(new Emitter()); public readonly onDidPaste = this._onDidPaste.event; private readonly _onMouseUp: Emitter = this._register(new Emitter()); @@ -195,6 +195,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE private readonly _onKeyDown: Emitter = this._register(new Emitter()); public readonly onKeyDown: Event = this._onKeyDown.event; + private readonly _onDidContentSizeChange: Emitter = this._register(new Emitter()); + public readonly onDidContentSizeChange: Event = this._onDidContentSizeChange.event; + private readonly _onDidScrollChange: Emitter = this._register(new Emitter()); public readonly onDidScrollChange: Event = this._onDidScrollChange.event; @@ -263,11 +266,6 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE const layoutInfo = options.get(EditorOption.layoutInfo); this._onDidLayoutChange.fire(layoutInfo); } - if (options.get(EditorOption.showUnused)) { - this._domElement.classList.add(SHOW_UNUSED_ENABLED_CLASS); - } else { - this._domElement.classList.remove(SHOW_UNUSED_ENABLED_CLASS); - } })); this._contextKeyService = this._register(contextKeyService.createScoped(this._domElement)); @@ -417,9 +415,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE // Current model is the new model return; } - + const hasTextFocus = this.hasTextFocus(); const detachedModel = this._detachModel(); this._attachModel(model); + if (hasTextFocus && this.hasModel()) { + this.focus(); + } const e: editorCommon.IModelChangedEvent = { oldModelUrl: detachedModel ? detachedModel.uri : null, @@ -556,6 +557,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE this._revealLine(lineNumber, VerticalRevealType.CenterIfOutsideViewport, scrollType); } + public revealLineNearTop(lineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this._revealLine(lineNumber, VerticalRevealType.NearTop, scrollType); + } + private _revealLine(lineNumber: number, revealType: VerticalRevealType, scrollType: editorCommon.ScrollType): void { if (typeof lineNumber !== 'number') { throw new Error('Invalid arguments'); @@ -596,6 +601,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE ); } + public revealPositionNearTop(position: IPosition, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this._revealPosition( + position, + VerticalRevealType.NearTop, + true, + scrollType + ); + } + private _revealPosition(position: IPosition, verticalType: VerticalRevealType, revealHorizontal: boolean, scrollType: editorCommon.ScrollType): void { if (!Position.isIPosition(position)) { throw new Error('Invalid arguments'); @@ -684,6 +698,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE ); } + public revealLinesNearTop(startLineNumber: number, endLineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this._revealLines( + startLineNumber, + endLineNumber, + VerticalRevealType.NearTop, + scrollType + ); + } + private _revealLines(startLineNumber: number, endLineNumber: number, verticalType: VerticalRevealType, scrollType: editorCommon.ScrollType): void { if (typeof startLineNumber !== 'number' || typeof endLineNumber !== 'number') { throw new Error('Invalid arguments'); @@ -724,6 +747,24 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE ); } + public revealRangeNearTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this._revealRange( + range, + VerticalRevealType.NearTop, + true, + scrollType + ); + } + + public revealRangeNearTopIfOutsideViewport(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this._revealRange( + range, + VerticalRevealType.NearTopIfOutsideViewport, + true, + scrollType + ); + } + public revealRangeAtTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { this._revealRange( range, @@ -761,6 +802,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE this._modelData.cursor.setSelections(source, ranges); } + public getContentWidth(): number { + if (!this._modelData) { + return -1; + } + return this._modelData.viewModel.viewLayout.getContentWidth(); + } + public getScrollWidth(): number { if (!this._modelData) { return -1; @@ -774,6 +822,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE return this._modelData.viewModel.viewLayout.getCurrentScrollLeft(); } + public getContentHeight(): number { + if (!this._modelData) { + return -1; + } + return this._modelData.viewModel.viewLayout.getContentHeight(); + } + public getScrollHeight(): number { if (!this._modelData) { return -1; @@ -874,6 +929,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE public onHide(): void { this._modelData?.view.refreshFocusState(); + this._focusTracker.refreshState(); } public getContribution(id: string): T { @@ -934,19 +990,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE const endPosition = this._modelData.cursor.getSelection().getStartPosition(); if (source === 'keyboard') { this._onDidPaste.fire( - new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column) + { + range: new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column), + mode: payload.mode + } ); } return; } - if (handlerId === editorCommon.Handler.CompositionStart) { - this._onCompositionStart.fire(); - } - if (handlerId === editorCommon.Handler.CompositionEnd) { - this._onCompositionEnd.fire(); - } - const action = this.getAction(handlerId); if (action) { Promise.resolve(action.run()).then(undefined, onUnexpectedError); @@ -962,6 +1014,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE } this._modelData.cursor.trigger(source, handlerId, payload); + + if (handlerId === editorCommon.Handler.CompositionStart) { + this._onDidCompositionStart.fire(); + } + if (handlerId === editorCommon.Handler.CompositionEnd) { + this._onDidCompositionEnd.fire(); + } } private _triggerEditorCommand(source: string, handlerId: string, payload: any): boolean { @@ -1045,7 +1104,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE if (!this._modelData) { return null; } - return this._modelData.model.getLineDecorations(lineNumber, this._id, this._configuration.options.get(EditorOption.readOnly)); + return this._modelData.model.getLineDecorations(lineNumber, this._id, filterValidationDecorations(this._configuration.options)); } public deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[] { @@ -1149,6 +1208,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE return this._modelData.view.createOverviewRuler(cssClassName); } + public getContainerDomNode(): HTMLElement { + return this._domElement; + } + public getDomNode(): HTMLElement | null { if (!this._modelData || !this._modelData.hasRealView) { return null; @@ -1314,6 +1377,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE this._modelData.view.render(true, forceRedraw); } + public setAriaOptions(options: editorBrowser.IEditorAriaOptions): void { + if (!this._modelData || !this._modelData.hasRealView) { + return; + } + this._modelData.view.setAriaOptions(options); + } + public applyFontInfo(target: HTMLElement): void { Configuration.applyFontInfoSlow(target, this._configuration.options.get(EditorOption.fontInfo)); } @@ -1332,7 +1402,14 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE model.onBeforeAttached(); - const viewModel = new ViewModel(this._id, this._configuration, model, (callback) => dom.scheduleAtNextAnimationFrame(callback)); + const viewModel = new ViewModel( + this._id, + this._configuration, + model, + DOMLineBreaksComputerFactory.create(), + MonospaceLineBreaksComputerFactory.create(this._configuration.options), + (callback) => dom.scheduleAtNextAnimationFrame(callback) + ); listenersToRemove.push(model.onDidChangeDecorations((e) => this._onDidChangeModelDecorations.fire(e))); listenersToRemove.push(model.onDidChangeLanguage((e) => { @@ -1411,8 +1488,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE executeEditorCommand: (editorCommand: CoreEditorCommand, args: any): void => { editorCommand.runCoreEditorCommand(cursor, args); }, - paste: (source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null) => { - this.trigger(source, editorCommon.Handler.Paste, { text, pasteOnNewLine, multicursorText }); + paste: (source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null, mode: string | null) => { + this.trigger(source, editorCommon.Handler.Paste, { text, pasteOnNewLine, multicursorText, mode }); }, type: (source: string, text: string) => { this.trigger(source, editorCommon.Handler.Type, { text }); @@ -1435,11 +1512,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE executeEditorCommand: (editorCommand: CoreEditorCommand, args: any): void => { editorCommand.runCoreEditorCommand(cursor, args); }, - paste: (source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null) => { + paste: (source: string, text: string, pasteOnNewLine: boolean, multicursorText: string[] | null, mode: string | null) => { this._commandService.executeCommand(editorCommon.Handler.Paste, { text: text, pasteOnNewLine: pasteOnNewLine, - multicursorText: multicursorText + multicursorText: multicursorText, + mode }); }, type: (source: string, text: string) => { @@ -1465,10 +1543,18 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE }; } + const onDidChangeTextFocus = (textFocus: boolean) => { + if (this._modelData) { + this._modelData.cursor.setHasFocus(textFocus); + } + this._editorTextFocus.setValue(textFocus); + }; + const viewOutgoingEvents = new ViewOutgoingEvents(viewModel); + viewOutgoingEvents.onDidContentSizeChange = (e) => this._onDidContentSizeChange.fire(e); viewOutgoingEvents.onDidScroll = (e) => this._onDidScrollChange.fire(e); - viewOutgoingEvents.onDidGainFocus = () => this._editorTextFocus.setValue(true); - viewOutgoingEvents.onDidLoseFocus = () => this._editorTextFocus.setValue(false); + viewOutgoingEvents.onDidGainFocus = () => onDidChangeTextFocus(true); + viewOutgoingEvents.onDidLoseFocus = () => onDidChangeTextFocus(false); viewOutgoingEvents.onContextMenu = (e) => this._onContextMenu.fire(e); viewOutgoingEvents.onMouseDown = (e) => this._onMouseDown.fire(e); viewOutgoingEvents.onMouseUp = (e) => this._onMouseUp.fire(e); @@ -1509,7 +1595,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE this._modelData = null; this._domElement.removeAttribute('data-mode-id'); - if (removeDomNode) { + if (removeDomNode && this._domElement.contains(removeDomNode)) { this._domElement.removeChild(removeDomNode); } @@ -1517,7 +1603,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE } private _registerDecorationType(key: string, options: editorCommon.IDecorationRenderOptions, parentTypeKey?: string): void { - this._codeEditorService.registerDecorationType(key, options, parentTypeKey); + this._codeEditorService.registerDecorationType(key, options, parentTypeKey, this); } private _removeDecorationType(key: string): void { @@ -1574,11 +1660,13 @@ export class BooleanEventEmitter extends Disposable { class EditorContextKeysManager extends Disposable { private readonly _editor: CodeEditorWidget; + private readonly _editorSimpleInput: IContextKey; private readonly _editorFocus: IContextKey; private readonly _textInputFocus: IContextKey; private readonly _editorTextFocus: IContextKey; private readonly _editorTabMovesFocus: IContextKey; private readonly _editorReadonly: IContextKey; + private readonly _editorColumnSelection: IContextKey; private readonly _hasMultipleSelections: IContextKey; private readonly _hasNonEmptySelection: IContextKey; private readonly _canUndo: IContextKey; @@ -1593,11 +1681,14 @@ class EditorContextKeysManager extends Disposable { this._editor = editor; contextKeyService.createKey('editorId', editor.getId()); + + this._editorSimpleInput = EditorContextKeys.editorSimpleInput.bindTo(contextKeyService); this._editorFocus = EditorContextKeys.focus.bindTo(contextKeyService); this._textInputFocus = EditorContextKeys.textInputFocus.bindTo(contextKeyService); this._editorTextFocus = EditorContextKeys.editorTextFocus.bindTo(contextKeyService); this._editorTabMovesFocus = EditorContextKeys.tabMovesFocus.bindTo(contextKeyService); this._editorReadonly = EditorContextKeys.readOnly.bindTo(contextKeyService); + this._editorColumnSelection = EditorContextKeys.columnSelection.bindTo(contextKeyService); this._hasMultipleSelections = EditorContextKeys.hasMultipleSelections.bindTo(contextKeyService); this._hasNonEmptySelection = EditorContextKeys.hasNonEmptySelection.bindTo(contextKeyService); this._canUndo = EditorContextKeys.canUndo.bindTo(contextKeyService); @@ -1616,6 +1707,8 @@ class EditorContextKeysManager extends Disposable { this._updateFromSelection(); this._updateFromFocus(); this._updateFromModel(); + + this._editorSimpleInput.set(this._editor.isSimpleWidget); } private _updateFromConfig(): void { @@ -1623,6 +1716,7 @@ class EditorContextKeysManager extends Disposable { this._editorTabMovesFocus.set(options.get(EditorOption.tabFocusMode)); this._editorReadonly.set(options.get(EditorOption.readOnly)); + this._editorColumnSelection.set(options.get(EditorOption.columnSelection)); } private _updateFromSelection(): void { @@ -1806,6 +1900,12 @@ class CodeEditorWidgetFocusTracker extends Disposable { public hasFocus(): boolean { return this._hasFocus; } + + public refreshState(): void { + if (this._domFocusTracker.refreshState) { + this._domFocusTracker.refreshState(); + } + } } const squigglyStart = encodeURIComponent(`newDecorations.zones[i]; - viewZone.suppressMouseDown = false; + viewZone.suppressMouseDown = true; let zoneId = viewChangeAccessor.addZone(viewZone); this._zones.push(zoneId); this._zonesMap[String(zoneId)] = true; - if (newDecorations.zones[i].diff && viewZone.marginDomNode && this._clipboardService) { + if (newDecorations.zones[i].diff && viewZone.marginDomNode) { + viewZone.suppressMouseDown = false; this.inlineDiffMargins.push(new InlineDiffMargin(zoneId, viewZone.marginDomNode, editor, newDecorations.zones[i].diff!, this._contextMenuService, this._clipboardService)); } } @@ -176,10 +178,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE private readonly _overviewDomElement: HTMLElement; private readonly _overviewViewportDomElement: FastDomNode; - private _width: number; - private _height: number; - private _reviewHeight: number; - private readonly _measureDomElementToken: IntervalTimer | null; + private readonly _elementSizeObserver: ElementSizeObserver; private readonly originalEditor: CodeEditorWidget; private readonly _originalDomNode: HTMLElement; @@ -221,7 +220,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE constructor( domElement: HTMLElement, options: IDiffEditorOptions, - clipboardService: IClipboardService | null, + @IClipboardService clipboardService: IClipboardService, @IEditorWorkerService editorWorkerService: IEditorWorkerService, @IContextKeyService contextKeyService: IContextKeyService, @IInstantiationService instantiationService: IInstantiationService, @@ -323,9 +322,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._isVisible = true; this._isHandlingScrollEvent = false; - this._width = 0; - this._height = 0; - this._reviewHeight = 0; + this._elementSizeObserver = this._register(new ElementSizeObserver(this._containerDomElement, undefined, () => this._onDidContainerSizeChanged())); + if (options.automaticLayout) { + this._elementSizeObserver.startObserving(); + } this._diffComputationResult = null; @@ -354,12 +354,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._containerDomElement.appendChild(this._reviewPane.shadow.domNode); this._containerDomElement.appendChild(this._reviewPane.actionBarContainer.domNode); - if (options.automaticLayout) { - this._measureDomElementToken = new IntervalTimer(); - this._measureDomElementToken.cancelAndSet(() => this._measureDomElement(false), 100); - } else { - this._measureDomElementToken = null; - } + // enableSplitViewResizing this._enableSplitViewResizing = true; @@ -557,10 +552,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._beginUpdateDecorationsTimeout = -1; } - if (this._measureDomElementToken) { - this._measureDomElementToken.dispose(); - } - this._cleanViewZonesAndDecorations(); if (this._originalOverviewRuler) { @@ -762,6 +753,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this.modifiedEditor.revealLineInCenterIfOutsideViewport(lineNumber, scrollType); } + public revealLineNearTop(lineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this.modifiedEditor.revealLineNearTop(lineNumber, scrollType); + } + public revealPosition(position: IPosition, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { this.modifiedEditor.revealPosition(position, scrollType); } @@ -774,6 +769,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this.modifiedEditor.revealPositionInCenterIfOutsideViewport(position, scrollType); } + public revealPositionNearTop(position: IPosition, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this.modifiedEditor.revealPositionNearTop(position, scrollType); + } + public getSelection(): Selection | null { return this.modifiedEditor.getSelection(); } @@ -806,6 +805,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this.modifiedEditor.revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType); } + public revealLinesNearTop(startLineNumber: number, endLineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this.modifiedEditor.revealLinesNearTop(startLineNumber, endLineNumber, scrollType); + } + public revealRange(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth, revealVerticalInCenter: boolean = false, revealHorizontal: boolean = true): void { this.modifiedEditor.revealRange(range, scrollType, revealVerticalInCenter, revealHorizontal); } @@ -818,6 +821,14 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this.modifiedEditor.revealRangeInCenterIfOutsideViewport(range, scrollType); } + public revealRangeNearTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this.modifiedEditor.revealRangeNearTop(range, scrollType); + } + + public revealRangeNearTopIfOutsideViewport(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { + this.modifiedEditor.revealRangeNearTopIfOutsideViewport(range, scrollType); + } + public revealRangeAtTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void { this.modifiedEditor.revealRangeAtTop(range, scrollType); } @@ -844,7 +855,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE } public layout(dimension?: editorCommon.IDimension): void { - this._measureDomElement(false, dimension); + this._elementSizeObserver.observe(dimension); } public focus(): void { @@ -885,35 +896,21 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE //------------ begin layouting methods - private _measureDomElement(forceDoLayoutCall: boolean, dimensions?: editorCommon.IDimension): void { - dimensions = dimensions || { - width: this._containerDomElement.clientWidth, - height: this._containerDomElement.clientHeight - }; - - if (dimensions.width <= 0) { - this._width = 0; - this._height = 0; - this._reviewHeight = 0; - return; - } - - if (!forceDoLayoutCall && dimensions.width === this._width && dimensions.height === this._height) { - // Nothing has changed - return; - } - - this._width = dimensions.width; - this._height = dimensions.height; - this._reviewHeight = this._reviewPane.isVisible() ? this._height : 0; - + private _onDidContainerSizeChanged(): void { this._doLayout(); } + private _getReviewHeight(): number { + return this._reviewPane.isVisible() ? this._elementSizeObserver.getHeight() : 0; + } + private _layoutOverviewRulers(): void { if (!this._originalOverviewRuler || !this._modifiedOverviewRuler) { return; } + const height = this._elementSizeObserver.getHeight(); + const reviewHeight = this._getReviewHeight(); + let freeSpace = DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH - 2 * DiffEditorWidget.ONE_OVERVIEW_WIDTH; let layoutInfo = this.modifiedEditor.getLayoutInfo(); if (layoutInfo) { @@ -921,13 +918,13 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE top: 0, width: DiffEditorWidget.ONE_OVERVIEW_WIDTH, right: freeSpace + DiffEditorWidget.ONE_OVERVIEW_WIDTH, - height: (this._height - this._reviewHeight) + height: (height - reviewHeight) }); this._modifiedOverviewRuler.setLayout({ top: 0, right: 0, width: DiffEditorWidget.ONE_OVERVIEW_WIDTH, - height: (this._height - this._reviewHeight) + height: (height - reviewHeight) }); } } @@ -1072,33 +1069,38 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE } public doLayout(): void { - this._measureDomElement(true); + this._elementSizeObserver.observe(); + this._doLayout(); } private _doLayout(): void { + const width = this._elementSizeObserver.getWidth(); + const height = this._elementSizeObserver.getHeight(); + const reviewHeight = this._getReviewHeight(); + let splitPoint = this._strategy.layout(); this._originalDomNode.style.width = splitPoint + 'px'; this._originalDomNode.style.left = '0px'; - this._modifiedDomNode.style.width = (this._width - splitPoint) + 'px'; + this._modifiedDomNode.style.width = (width - splitPoint) + 'px'; this._modifiedDomNode.style.left = splitPoint + 'px'; this._overviewDomElement.style.top = '0px'; - this._overviewDomElement.style.height = (this._height - this._reviewHeight) + 'px'; + this._overviewDomElement.style.height = (height - reviewHeight) + 'px'; this._overviewDomElement.style.width = DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH + 'px'; - this._overviewDomElement.style.left = (this._width - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH) + 'px'; + this._overviewDomElement.style.left = (width - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH) + 'px'; this._overviewViewportDomElement.setWidth(DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH); this._overviewViewportDomElement.setHeight(30); - this.originalEditor.layout({ width: splitPoint, height: (this._height - this._reviewHeight) }); - this.modifiedEditor.layout({ width: this._width - splitPoint - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH, height: (this._height - this._reviewHeight) }); + this.originalEditor.layout({ width: splitPoint, height: (height - reviewHeight) }); + this.modifiedEditor.layout({ width: width - splitPoint - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH, height: (height - reviewHeight) }); if (this._originalOverviewRuler || this._modifiedOverviewRuler) { this._layoutOverviewRulers(); } - this._reviewPane.layout(this._height - this._reviewHeight, this._width, this._reviewHeight); + this._reviewPane.layout(height - reviewHeight, width, reviewHeight); this._layoutOverviewViewport(); } @@ -1123,11 +1125,11 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE let scrollTop = this.modifiedEditor.getScrollTop(); let scrollHeight = this.modifiedEditor.getScrollHeight(); - let computedAvailableSize = Math.max(0, layoutInfo.contentHeight); + let computedAvailableSize = Math.max(0, layoutInfo.height); let computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * 0); let computedRatio = scrollHeight > 0 ? (computedRepresentableSize / scrollHeight) : 0; - let computedSliderSize = Math.max(0, Math.floor(layoutInfo.contentHeight * computedRatio)); + let computedSliderSize = Math.max(0, Math.floor(layoutInfo.height * computedRatio)); let computedSliderPosition = Math.floor(scrollTop * computedRatio); return { @@ -1139,11 +1141,11 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE private _createDataSource(): IDataSource { return { getWidth: () => { - return this._width; + return this._elementSizeObserver.getWidth(); }, getHeight: () => { - return (this._height - this._reviewHeight); + return (this._elementSizeObserver.getHeight() - this._getReviewHeight()); }, getContainerDomNode: () => { @@ -1177,7 +1179,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE } // Just do a layout, the strategy might need it - this._measureDomElement(true); + this._doLayout(); } private _getLineChangeAtOrBeforeLineNumber(lineNumber: number, startLineNumberExtractor: (lineChange: editorCommon.ILineChange) => number): editorCommon.ILineChange | null { @@ -1376,12 +1378,16 @@ abstract class ViewZonesComputer { private readonly lineChanges: editorCommon.ILineChange[]; private readonly originalForeignVZ: IEditorWhitespace[]; + private readonly originalLineHeight: number; private readonly modifiedForeignVZ: IEditorWhitespace[]; + private readonly modifiedLineHeight: number; - constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[]) { + constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], originalLineHeight: number, modifiedForeignVZ: IEditorWhitespace[], modifiedLineHeight: number) { this.lineChanges = lineChanges; this.originalForeignVZ = originalForeignVZ; + this.originalLineHeight = originalLineHeight; this.modifiedForeignVZ = modifiedForeignVZ; + this.modifiedLineHeight = modifiedLineHeight; } public getViewZones(): IEditorsZones { @@ -1456,7 +1462,7 @@ abstract class ViewZonesComputer { stepOriginal.push({ afterLineNumber: viewZoneLineNumber, - heightInLines: modifiedForeignVZ.current.heightInLines, + heightInLines: modifiedForeignVZ.current.height / this.modifiedLineHeight, domNode: null, marginDomNode: marginDomNode }); @@ -1473,7 +1479,7 @@ abstract class ViewZonesComputer { } stepModified.push({ afterLineNumber: viewZoneLineNumber, - heightInLines: originalForeignVZ.current.heightInLines, + heightInLines: originalForeignVZ.current.height / this.originalLineHeight, domNode: null }); originalForeignVZ.advance(); @@ -1606,7 +1612,7 @@ const DECORATIONS = { }), lineInsertWithSign: ModelDecorationOptions.register({ className: 'line-insert', - linesDecorationsClassName: 'insert-sign', + linesDecorationsClassName: 'insert-sign codicon codicon-add', marginClassName: 'line-insert', isWholeLine: true }), @@ -1618,7 +1624,7 @@ const DECORATIONS = { }), lineDeleteWithSign: ModelDecorationOptions.register({ className: 'line-delete', - linesDecorationsClassName: 'delete-sign', + linesDecorationsClassName: 'delete-sign codicon codicon-remove', marginClassName: 'line-delete', isWholeLine: true @@ -1732,7 +1738,7 @@ class DiffEditorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffE } protected _getViewZones(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[], originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor): IEditorsZones { - let c = new SideBySideViewZonesComputer(lineChanges, originalForeignVZ, modifiedForeignVZ); + let c = new SideBySideViewZonesComputer(lineChanges, originalForeignVZ, originalEditor.getOption(EditorOption.lineHeight), modifiedForeignVZ, modifiedEditor.getOption(EditorOption.lineHeight)); return c.getViewZones(); } @@ -1859,8 +1865,8 @@ class DiffEditorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffE class SideBySideViewZonesComputer extends ViewZonesComputer { - constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[]) { - super(lineChanges, originalForeignVZ, modifiedForeignVZ); + constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], originalLineHeight: number, modifiedForeignVZ: IEditorWhitespace[], modifiedLineHeight: number) { + super(lineChanges, originalForeignVZ, originalLineHeight, modifiedForeignVZ, modifiedLineHeight); } protected _createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(): HTMLDivElement | null { @@ -2020,7 +2026,7 @@ class InlineViewZonesComputer extends ViewZonesComputer { private readonly renderIndicators: boolean; constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[], originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor, renderIndicators: boolean) { - super(lineChanges, originalForeignVZ, modifiedForeignVZ); + super(lineChanges, originalForeignVZ, originalEditor.getOption(EditorOption.lineHeight), modifiedForeignVZ, modifiedEditor.getOption(EditorOption.lineHeight)); this.originalModel = originalEditor.getModel()!; this.modifiedEditorOptions = modifiedEditor.getOptions(); this.modifiedEditorTabSize = modifiedEditor.getModel()!.getOptions().tabSize; @@ -2077,7 +2083,7 @@ class InlineViewZonesComputer extends ViewZonesComputer { if (this.renderIndicators) { let index = lineNumber - lineChange.originalStartLineNumber; marginHTML = marginHTML.concat([ - `
` + `
` ]); } } @@ -2139,7 +2145,10 @@ class InlineViewZonesComputer extends ViewZonesComputer { lineTokens, actualDecorations, tabSize, + 0, fontInfo.spaceWidth, + fontInfo.middotWidth, + fontInfo.wsmiddotWidth, options.get(EditorOption.stopRenderingLineAfter), options.get(EditorOption.renderWhitespace), options.get(EditorOption.renderControlCharacters), @@ -2202,4 +2211,32 @@ registerThemingParticipant((theme, collector) => { if (border) { collector.addRule(`.monaco-diff-editor.side-by-side .editor.modified { border-left: 1px solid ${border}; }`); } + + const scrollbarSliderBackgroundColor = theme.getColor(scrollbarSliderBackground); + if (scrollbarSliderBackgroundColor) { + collector.addRule(` + .monaco-diff-editor .diffViewport { + background: ${scrollbarSliderBackgroundColor}; + } + `); + } + + const scrollbarSliderHoverBackgroundColor = theme.getColor(scrollbarSliderHoverBackground); + if (scrollbarSliderHoverBackgroundColor) { + collector.addRule(` + .monaco-diff-editor .diffViewport:hover { + background: ${scrollbarSliderHoverBackgroundColor}; + } + `); + } + + const scrollbarSliderActiveBackgroundColor = theme.getColor(scrollbarSliderActiveBackground); + if (scrollbarSliderActiveBackgroundColor) { + collector.addRule(` + .monaco-diff-editor .diffViewport:active { + background: ${scrollbarSliderActiveBackgroundColor}; + } + `); + } + }); diff --git a/src/vs/editor/browser/widget/diffReview.ts b/src/vs/editor/browser/widget/diffReview.ts index 8a915a659ff8c..cfa24de682ff0 100644 --- a/src/vs/editor/browser/widget/diffReview.ts +++ b/src/vs/editor/browser/widget/diffReview.ts @@ -695,7 +695,7 @@ export class DiffReview extends Disposable { if (originalLine !== 0) { originalLineNumber.appendChild(document.createTextNode(String(originalLine))); } else { - originalLineNumber.innerHTML = ' '; + originalLineNumber.innerHTML = ' '; } cell.appendChild(originalLineNumber); @@ -707,13 +707,13 @@ export class DiffReview extends Disposable { if (modifiedLine !== 0) { modifiedLineNumber.appendChild(document.createTextNode(String(modifiedLine))); } else { - modifiedLineNumber.innerHTML = ' '; + modifiedLineNumber.innerHTML = ' '; } cell.appendChild(modifiedLineNumber); const spacer = document.createElement('span'); spacer.className = spacerClassName; - spacer.innerHTML = '  '; + spacer.innerHTML = '  '; cell.appendChild(spacer); let lineContent: string; @@ -780,7 +780,10 @@ export class DiffReview extends Disposable { lineTokens, [], tabSize, + 0, fontInfo.spaceWidth, + fontInfo.middotWidth, + fontInfo.wsmiddotWidth, options.get(EditorOption.stopRenderingLineAfter), options.get(EditorOption.renderWhitespace), options.get(EditorOption.renderControlCharacters), diff --git a/src/vs/editor/browser/widget/inlineDiffMargin.ts b/src/vs/editor/browser/widget/inlineDiffMargin.ts index 90bb8d9165a3d..9e61bc0b05e53 100644 --- a/src/vs/editor/browser/widget/inlineDiffMargin.ts +++ b/src/vs/editor/browser/widget/inlineDiffMargin.ts @@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions'; import { Disposable } from 'vs/base/common/lifecycle'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; -import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { Range } from 'vs/editor/common/core/range'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; @@ -57,7 +57,7 @@ export class InlineDiffMargin extends Disposable { this._marginDomNode.style.zIndex = '10'; this._diffActions = document.createElement('div'); - this._diffActions.className = 'lightbulb-glyph'; + this._diffActions.className = 'codicon codicon-lightbulb lightbulb-glyph'; this._diffActions.style.position = 'absolute'; const lineHeight = editor.getOption(EditorOption.lineHeight); const lineFeed = editor.getModel()!.getEOL(); @@ -150,8 +150,8 @@ export class InlineDiffMargin extends Disposable { })); - this._register(editor.onMouseMove((e: editorBrowser.IEditorMouseEvent) => { - if (e.target.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) { + this._register(editor.onMouseMove((e: IEditorMouseEvent) => { + if (e.target.type === MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === MouseTargetType.GUTTER_VIEW_ZONE) { const viewZoneId = e.target.detail.viewZoneId; if (viewZoneId === this._viewZoneId) { @@ -165,12 +165,12 @@ export class InlineDiffMargin extends Disposable { } })); - this._register(editor.onMouseDown((e: editorBrowser.IEditorMouseEvent) => { + this._register(editor.onMouseDown((e: IEditorMouseEvent) => { if (!e.event.rightButton) { return; } - if (e.target.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) { + if (e.target.type === MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === MouseTargetType.GUTTER_VIEW_ZONE) { const viewZoneId = e.target.detail.viewZoneId; if (viewZoneId === this._viewZoneId) { diff --git a/src/vs/editor/browser/widget/media/addition-dark.svg b/src/vs/editor/browser/widget/media/addition-dark.svg deleted file mode 100644 index 4d9389336b93e..0000000000000 --- a/src/vs/editor/browser/widget/media/addition-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/addition-light.svg b/src/vs/editor/browser/widget/media/addition-light.svg deleted file mode 100644 index 01a9de7d5abc4..0000000000000 --- a/src/vs/editor/browser/widget/media/addition-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/close-dark.svg b/src/vs/editor/browser/widget/media/close-dark.svg deleted file mode 100644 index 6d16d212ae504..0000000000000 --- a/src/vs/editor/browser/widget/media/close-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/close-light.svg b/src/vs/editor/browser/widget/media/close-light.svg deleted file mode 100644 index 742fcae4ae7d6..0000000000000 --- a/src/vs/editor/browser/widget/media/close-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/deletion-dark.svg b/src/vs/editor/browser/widget/media/deletion-dark.svg deleted file mode 100644 index 4c5a9c1e3a5d2..0000000000000 --- a/src/vs/editor/browser/widget/media/deletion-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/deletion-light.svg b/src/vs/editor/browser/widget/media/deletion-light.svg deleted file mode 100644 index d12a8ee3135d2..0000000000000 --- a/src/vs/editor/browser/widget/media/deletion-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/diffEditor.css b/src/vs/editor/browser/widget/media/diffEditor.css index d1d0e48f366df..eda4e7755fb38 100644 --- a/src/vs/editor/browser/widget/media/diffEditor.css +++ b/src/vs/editor/browser/widget/media/diffEditor.css @@ -8,19 +8,14 @@ z-index: 9; } +.monaco-diff-editor .diffOverview .diffViewport { + z-index: 10; +} + /* colors not externalized: using transparancy on background */ .monaco-diff-editor.vs .diffOverview { background: rgba(0, 0, 0, 0.03); } .monaco-diff-editor.vs-dark .diffOverview { background: rgba(255, 255, 255, 0.01); } -.monaco-diff-editor .diffViewport { - box-shadow: inset 0px 0px 1px 0px #B9B9B9; - background: rgba(0, 0, 0, 0.10); -} - -.monaco-diff-editor.vs-dark .diffViewport, -.monaco-diff-editor.hc-black .diffViewport { - background: rgba(255, 255, 255, 0.10); -} .monaco-scrollable-element.modified-in-monaco-diff-editor.vs .scrollbar { background: rgba(0,0,0,0); } .monaco-scrollable-element.modified-in-monaco-diff-editor.vs-dark .scrollbar { background: rgba(0,0,0,0); } .monaco-scrollable-element.modified-in-monaco-diff-editor.hc-black .scrollbar { background: none; } @@ -37,11 +32,10 @@ .monaco-diff-editor .insert-sign, .monaco-editor .delete-sign, .monaco-diff-editor .delete-sign { - background-size: 60%; - opacity: 0.7; - background-repeat: no-repeat; - background-position: 75% center; - background-size: 11px 11px; + font-size: 11px !important; + opacity: 0.7 !important; + display: flex !important; + align-items: center; } .monaco-editor.hc-black .insert-sign, .monaco-diff-editor.hc-black .insert-sign, @@ -49,27 +43,6 @@ .monaco-diff-editor.hc-black .delete-sign { opacity: 1; } -.monaco-editor .insert-sign, -.monaco-diff-editor .insert-sign { - background-image: url('addition-light.svg'); -} -.monaco-editor .delete-sign, -.monaco-diff-editor .delete-sign { - background-image: url('deletion-light.svg'); -} - -.monaco-editor.vs-dark .insert-sign, -.monaco-diff-editor.vs-dark .insert-sign, -.monaco-editor.hc-black .insert-sign, -.monaco-diff-editor.hc-black .insert-sign { - background-image: url('addition-dark.svg'); -} -.monaco-editor.vs-dark .delete-sign, -.monaco-diff-editor.vs-dark .delete-sign, -.monaco-editor.hc-black .delete-sign, -.monaco-diff-editor.hc-black .delete-sign { - background-image: url('deletion-dark.svg'); -} .monaco-editor .inline-deleted-margin-view-zone { text-align: right; @@ -94,15 +67,6 @@ display: inline-block; } -.monaco-editor .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { - background: url('lightbulb-light.svg') center center no-repeat; -} - -.monaco-editor.vs-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph, -.monaco-editor.hc-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { - background: url('lightbulb-dark.svg') center center no-repeat; -} - .monaco-editor .margin-view-zones .lightbulb-glyph:hover { cursor: pointer; } diff --git a/src/vs/editor/browser/widget/media/diffReview.css b/src/vs/editor/browser/widget/media/diffReview.css index f8db5bb1c67ef..b2b17028489ab 100644 --- a/src/vs/editor/browser/widget/media/diffReview.css +++ b/src/vs/editor/browser/widget/media/diffReview.css @@ -58,10 +58,3 @@ height: 16px; margin: 2px 0; } -.monaco-diff-editor .action-label.icon.close-diff-review { - background: url('close-light.svg') center center no-repeat; -} -.monaco-diff-editor.hc-black .action-label.icon.close-diff-review, -.monaco-diff-editor.vs-dark .action-label.icon.close-diff-review { - background: url('close-dark.svg') center center no-repeat; -} diff --git a/src/vs/editor/browser/widget/media/lightbulb-dark.svg b/src/vs/editor/browser/widget/media/lightbulb-dark.svg deleted file mode 100644 index 5fe8931a8159c..0000000000000 --- a/src/vs/editor/browser/widget/media/lightbulb-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/editor/browser/widget/media/lightbulb-light.svg b/src/vs/editor/browser/widget/media/lightbulb-light.svg deleted file mode 100644 index 191c566fd2cb5..0000000000000 --- a/src/vs/editor/browser/widget/media/lightbulb-light.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/vs/editor/common/commands/replaceCommand.ts b/src/vs/editor/common/commands/replaceCommand.ts index 4ae44cf28c154..3e628f2db760f 100644 --- a/src/vs/editor/common/commands/replaceCommand.ts +++ b/src/vs/editor/common/commands/replaceCommand.ts @@ -122,17 +122,19 @@ export class ReplaceCommandThatPreservesSelection implements ICommand { private readonly _range: Range; private readonly _text: string; private readonly _initialSelection: Selection; + private readonly _forceMoveMarkers: boolean; private _selectionId: string | null; - constructor(editRange: Range, text: string, initialSelection: Selection) { + constructor(editRange: Range, text: string, initialSelection: Selection, forceMoveMarkers: boolean = false) { this._range = editRange; this._text = text; this._initialSelection = initialSelection; + this._forceMoveMarkers = forceMoveMarkers; this._selectionId = null; } public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { - builder.addEditOperation(this._range, this._text); + builder.addTrackedEditOperation(this._range, this._text, this._forceMoveMarkers); this._selectionId = builder.trackSelection(this._initialSelection); } diff --git a/src/vs/editor/common/commands/shiftCommand.ts b/src/vs/editor/common/commands/shiftCommand.ts index 78a23889a2fb4..742ad42fa9c88 100644 --- a/src/vs/editor/common/commands/shiftCommand.ts +++ b/src/vs/editor/common/commands/shiftCommand.ts @@ -11,6 +11,7 @@ import { Selection, SelectionDirection } from 'vs/editor/common/core/selection'; import { ICommand, ICursorStateComputerData, IEditOperationBuilder } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; export interface IShiftCommandOpts { isUnshift: boolean; @@ -18,6 +19,7 @@ export interface IShiftCommandOpts { indentSize: number; insertSpaces: boolean; useTabStops: boolean; + autoIndent: EditorAutoIndentStrategy; } const repeatCache: { [str: string]: string[]; } = Object.create(null); @@ -111,7 +113,7 @@ export class ShiftCommand implements ICommand { if (this._opts.useTabStops) { // keep track of previous line's "miss-alignment" let previousLineExtraSpaces = 0, extraSpaces = 0; - for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++ , previousLineExtraSpaces = extraSpaces) { + for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++, previousLineExtraSpaces = extraSpaces) { extraSpaces = 0; let lineText = model.getLineContent(lineNumber); let indentationEndIndex = strings.firstNonWhitespaceIndex(lineText); @@ -137,7 +139,7 @@ export class ShiftCommand implements ICommand { // The current line is "miss-aligned", so let's see if this is expected... // This can only happen when it has trailing commas in the indent if (model.isCheapToTokenize(lineNumber - 1)) { - let enterAction = LanguageConfigurationRegistry.getRawEnterActionAtPosition(model, lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)); + let enterAction = LanguageConfigurationRegistry.getEnterAction(this._opts.autoIndent, model, new Range(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1), lineNumber - 1, model.getLineMaxColumn(lineNumber - 1))); if (enterAction) { extraSpaces = previousLineExtraSpaces; if (enterAction.appendText) { diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 5ef39172f5e72..af8e96020e689 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -11,7 +11,7 @@ import * as arrays from 'vs/base/common/arrays'; import { IEditorOptions, editorOptionsRegistry, ValidatedEditorOptions, IEnvironmentalOptions, IComputedEditorOptions, ConfigurationChangedEvent, EDITOR_MODEL_DEFAULTS, EditorOption, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IConfiguration, IDimension } from 'vs/editor/common/editorCommon'; import { ConfigurationScope, Extensions, IConfigurationNode, IConfigurationRegistry, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; @@ -256,6 +256,20 @@ function migrateOptions(options: IEditorOptions): void { enabled: false }; } + + const autoIndent = options.autoIndent; + if (autoIndent === true) { + options.autoIndent = 'full'; + } else if (autoIndent === false) { + options.autoIndent = 'advanced'; + } + + const matchBrackets = options.matchBrackets; + if (matchBrackets === true) { + options.matchBrackets = 'always'; + } else if (matchBrackets === false) { + options.matchBrackets = 'never'; + } } function deepCloneAndMigrateOptions(_options: IEditorOptions): IEditorOptions { @@ -264,7 +278,7 @@ function deepCloneAndMigrateOptions(_options: IEditorOptions): IEditorOptions { return options; } -export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration { +export abstract class CommonEditorConfiguration extends Disposable implements IConfiguration { private _onDidChange = this._register(new Emitter()); public readonly onDidChange: Event = this._onDidChange.event; @@ -273,6 +287,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed public options!: ComputedEditorOptions; private _isDominatedByLongLines: boolean; + private _viewLineCount: number; private _lineNumbersDigitCount: number; private _rawOptions: IEditorOptions; @@ -284,6 +299,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed this.isSimpleWidget = isSimpleWidget; this._isDominatedByLongLines = false; + this._viewLineCount = 1; this._lineNumbersDigitCount = 1; this._rawOptions = deepCloneAndMigrateOptions(_options); @@ -294,7 +310,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed this._register(TabFocus.onDidChangeTabFocus(_ => this._recomputeOptions())); } - public observeReferenceElement(dimension?: editorCommon.IDimension): void { + public observeReferenceElement(dimension?: IDimension): void { } public dispose(): void { @@ -333,6 +349,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed fontInfo: this.readConfiguration(bareFontInfo), extraEditorClassName: partialEnv.extraEditorClassName, isDominatedByLongLines: this._isDominatedByLongLines, + viewLineCount: this._viewLineCount, lineNumbersDigitCount: this._lineNumbersDigitCount, emptySelectionClipboard: partialEnv.emptySelectionClipboard, pixelRatio: partialEnv.pixelRatio, @@ -391,11 +408,19 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed } public setMaxLineNumber(maxLineNumber: number): void { - let digitCount = CommonEditorConfiguration._digitCount(maxLineNumber); - if (this._lineNumbersDigitCount === digitCount) { + const lineNumbersDigitCount = CommonEditorConfiguration._digitCount(maxLineNumber); + if (this._lineNumbersDigitCount === lineNumbersDigitCount) { + return; + } + this._lineNumbersDigitCount = lineNumbersDigitCount; + this._recomputeOptions(); + } + + public setViewLineCount(viewLineCount: number): void { + if (this._viewLineCount === viewLineCount) { return; } - this._lineNumbersDigitCount = digitCount; + this._viewLineCount = viewLineCount; this._recomputeOptions(); } @@ -418,8 +443,7 @@ export const editorConfigurationBaseNode = Object.freeze({ order: 5, type: 'object', title: nls.localize('editorConfigurationTitle', "Editor"), - overridable: true, - scope: ConfigurationScope.RESOURCE, + scope: ConfigurationScope.LANGUAGE_OVERRIDABLE, }); const configurationRegistry = Registry.as(Extensions.Configuration); @@ -471,6 +495,11 @@ const editorConfiguration: IConfigurationNode = { default: true, description: nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.") }, + 'editor.semanticHighlighting.enabled': { + type: 'boolean', + default: true, + description: nls.localize('semanticHighlighting.enabled', "Controls whether the semanticHighlighting is shown for the languages that support it.") + }, 'editor.stablePeek': { type: 'boolean', default: false, diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index de2c41dddd370..eb7a44e4089ce 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -31,6 +31,17 @@ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'bracket */ export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; +/** + * Configuration options for auto indentation in the editor + */ +export const enum EditorAutoIndentStrategy { + None = 0, + Keep = 1, + Brackets = 2, + Advanced = 3, + Full = 4 +} + /** * Configuration options for the editor. */ @@ -47,7 +58,7 @@ export interface IEditorOptions { * Render vertical lines at the specified columns. * Defaults to empty array. */ - rulers?: number[]; + rulers?: (number | IRulerOption)[]; /** * A string containing the word separators used when doing word navigation. * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? @@ -63,7 +74,7 @@ export interface IEditorOptions { * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). * Otherwise, line numbers will not be rendered. - * Defaults to true. + * Defaults to `on`. */ lineNumbers?: LineNumbersType; /** @@ -124,6 +135,11 @@ export interface IEditorOptions { * Defaults to false. */ readOnly?: boolean; + /** + * Should the editor render validation decorations. + * Defaults to editable. + */ + renderValidationDecorations?: 'editable' | 'on' | 'off'; /** * Control the behavior and rendering of the scrollbars. */ @@ -186,8 +202,8 @@ export interface IEditorOptions { */ fontLigatures?: boolean | string; /** - * Disable the use of `will-change` for the editor margin and lines layers. - * The usage of `will-change` acts as a hint for browsers to create an extra layer. + * Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers. + * The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer. * Defaults to false. */ disableLayerHinting?: boolean; @@ -250,21 +266,21 @@ export interface IEditorOptions { * Defaults to 'same' in vscode and to 'none' in monaco-editor. */ wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent'; + /** + * Controls the wrapping strategy to use. + * Defaults to 'simple'. + */ + wrappingStrategy?: 'simple' | 'advanced'; /** * Configure word wrapping characters. A break will be introduced before these characters. - * Defaults to '{([+'. + * Defaults to '([{‘“〈《「『【〔([{「£¥$£¥++'. */ wordWrapBreakBeforeCharacters?: string; /** * Configure word wrapping characters. A break will be introduced after these characters. - * Defaults to ' \t})]?|&,;'. + * Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'. */ wordWrapBreakAfterCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found. - * Defaults to '.'. - */ - wordWrapBreakObtrusiveCharacters?: string; /** * Performance guard: Stop rendering a line after x characters. * Defaults to 10000. @@ -284,6 +300,10 @@ export interface IEditorOptions { * Enable inline color decorators and color picker rendering. */ colorDecorators?: boolean; + /** + * Control the behaviour of comments in the editor. + */ + comments?: IEditorCommentsOptions; /** * Enable custom contextmenu. * Defaults to true. @@ -299,6 +319,16 @@ export interface IEditorOptions { * Defaults to 5. */ fastScrollSensitivity?: number; + /** + * Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad. + * Defaults to true. + */ + scrollPredominantAxis?: boolean; + /** + * Enable that the selection with the mouse and keys is doing column selection. + * Defaults to false. + */ + columnSelection?: boolean; /** * The modifier to be used to add multiple cursors with the mouse. * Defaults to 'alt' @@ -319,6 +349,10 @@ export interface IEditorOptions { * Defaults to 'auto'. It is best to leave this to 'auto'. */ accessibilitySupport?: 'auto' | 'off' | 'on'; + /** + * Controls the number of lines in the editor that can be read out by a screen reader + */ + accessibilityPageSize?: number; /** * Suggest options. */ @@ -337,6 +371,10 @@ export interface IEditorOptions { * Defaults to 10 (ms) */ quickSuggestionsDelay?: number; + /** + * Controls the spacing around the editor. + */ + padding?: IEditorPaddingOptions; /** * Parameter hint options. */ @@ -361,10 +399,10 @@ export interface IEditorOptions { */ autoSurround?: EditorAutoSurroundStrategy; /** - * Enable auto indentation adjustment. - * Defaults to false. + * Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines. + * Defaults to advanced. */ - autoIndent?: boolean; + autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full'; /** * Enable format on type. * Defaults to false. @@ -449,7 +487,7 @@ export interface IEditorOptions { */ codeActionsOnSaveTimeout?: number; /** - * Enable code folding + * Enable code folding. * Defaults to true. */ folding?: boolean; @@ -458,6 +496,11 @@ export interface IEditorOptions { * Defaults to 'auto'. */ foldingStrategy?: 'auto' | 'indentation'; + /** + * Enable highlight for folded regions. + * Defaults to true. + */ + foldingHighlight?: boolean; /** * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter. * Defaults to 'mouseover'. @@ -465,9 +508,9 @@ export interface IEditorOptions { showFoldingControls?: 'always' | 'mouseover'; /** * Enable highlighting of matching brackets. - * Defaults to true. + * Defaults to 'always'. */ - matchBrackets?: boolean; + matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. * Defaults to none. @@ -521,6 +564,16 @@ export interface IEditorOptions { * Controls fading out of unused variables. */ showUnused?: boolean; + /** + * Controls whether to focus the inline editor in the peek widget by default. + * Defaults to false. + */ + peekWidgetDefaultFocus?: 'tree' | 'editor'; + /** + * Controls whether the definition link opens element in the peek widget. + * Defaults to false. + */ + definitionLinkOpensInPeek?: boolean; } export interface IEditorConstructionOptions extends IEditorOptions { @@ -585,9 +638,6 @@ export class ConfigurationChangedEvent { constructor(values: boolean[]) { this._values = values; } - /** - * @internal - */ public hasChanged(id: EditorOption): boolean { return this._values[id]; } @@ -610,7 +660,7 @@ export class ValidatedEditorOptions { } /** - * @internal + * All computed editor options. */ export interface IComputedEditorOptions { get(id: T): FindComputedEditorOptionValueById; @@ -627,6 +677,7 @@ export interface IEnvironmentalOptions { readonly fontInfo: FontInfo; readonly extraEditorClassName: string; readonly isDominatedByLongLines: boolean; + readonly viewLineCount: number; readonly lineNumbersDigitCount: number; readonly emptySelectionClipboard: boolean; readonly pixelRatio: number; @@ -634,13 +685,10 @@ export interface IEnvironmentalOptions { readonly accessibilitySupport: AccessibilitySupport; } -/** - * @internal - */ export interface IEditorOption { readonly id: K1; readonly name: string; - readonly defaultValue: V; + defaultValue: V; /** * @internal */ @@ -915,6 +963,20 @@ class EditorEnumOption extends Bas //#endregion +//#region autoIndent + +function _autoIndentFromString(autoIndent: 'none' | 'keep' | 'brackets' | 'advanced' | 'full'): EditorAutoIndentStrategy { + switch (autoIndent) { + case 'none': return EditorAutoIndentStrategy.None; + case 'keep': return EditorAutoIndentStrategy.Keep; + case 'brackets': return EditorAutoIndentStrategy.Brackets; + case 'advanced': return EditorAutoIndentStrategy.Advanced; + case 'full': return EditorAutoIndentStrategy.Full; + } +} + +//#endregion + //#region accessibilitySupport class EditorAccessibilitySupport extends BaseEditorOption { @@ -956,6 +1018,52 @@ class EditorAccessibilitySupport extends BaseEditorOption>; + +class EditorComments extends BaseEditorOption { + + constructor() { + const defaults: EditorCommentsOptions = { + insertSpace: true, + }; + super( + EditorOption.comments, 'comments', defaults, + { + 'editor.comments.insertSpace': { + type: 'boolean', + default: defaults.insertSpace, + description: nls.localize('comments.insertSpace', "Controls whether a space character is inserted when commenting.") + }, + } + ); + } + + public validate(_input: any): EditorCommentsOptions { + if (typeof _input !== 'object') { + return this.defaultValue; + } + const input = _input as IEditorCommentsOptions; + return { + insertSpace: EditorBooleanOption.boolean(input.insertSpace, this.defaultValue.insertSpace), + }; + } +} + +//#endregion + //#region cursorBlinking /** @@ -1080,6 +1188,9 @@ class EditorClassName extends ComputedEditorOption>; @@ -1321,8 +1437,13 @@ class EditorGoToLocation extends BaseEditorOption(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']), multipleTypeDefinitions: input.multipleTypeDefinitions ?? EditorStringEnumOption.stringSet(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']), multipleDeclarations: input.multipleDeclarations ?? EditorStringEnumOption.stringSet(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']), - multipleImplemenations: input.multipleImplemenations ?? EditorStringEnumOption.stringSet(input.multipleImplemenations, 'peek', ['peek', 'gotoAndPeek', 'goto']), + multipleImplementations: input.multipleImplementations ?? EditorStringEnumOption.stringSet(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']), multipleReferences: input.multipleReferences ?? EditorStringEnumOption.stringSet(input.multipleReferences, 'peek', ['peek', 'gotoAndPeek', 'goto']), + alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand), + alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand), + alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand), + alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand), + alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand), }; } } @@ -1504,10 +1655,6 @@ export interface EditorLayoutInfo { * The width of the glyph margin. */ readonly glyphMarginWidth: number; - /** - * The height of the glyph margin. - */ - readonly glyphMarginHeight: number; /** * Left position for the line numbers. @@ -1517,10 +1664,6 @@ export interface EditorLayoutInfo { * The width of the line numbers. */ readonly lineNumbersWidth: number; - /** - * The height of the line numbers. - */ - readonly lineNumbersHeight: number; /** * Left position for the line decorations. @@ -1530,10 +1673,6 @@ export interface EditorLayoutInfo { * The width of the line decorations. */ readonly decorationsWidth: number; - /** - * The height of the line decorations. - */ - readonly decorationsHeight: number; /** * Left position for the content (actual text) @@ -1543,10 +1682,6 @@ export interface EditorLayoutInfo { * The width of the content (actual text) */ readonly contentWidth: number; - /** - * The height of the content (actual height) - */ - readonly contentHeight: number; /** * The position for the minimap @@ -1556,6 +1691,14 @@ export interface EditorLayoutInfo { * The width of the minimap */ readonly minimapWidth: number; + readonly minimapHeightIsEditorHeight: boolean; + readonly minimapIsSampling: boolean; + readonly minimapScale: number; + readonly minimapLineHeight: number; + readonly minimapCanvasInnerWidth: number; + readonly minimapCanvasInnerHeight: number; + readonly minimapCanvasOuterWidth: number; + readonly minimapCanvasOuterHeight: number; /** * Minimap render type @@ -1589,6 +1732,7 @@ export interface EditorLayoutInfoComputerEnv { outerWidth: number; outerHeight: number; lineHeight: number; + viewLineCount: number; lineNumbersDigitCount: number; typicalHalfwidthCharacterWidth: number; maxDigitWidth: number; @@ -1612,6 +1756,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption= 2 ? Math.round(minimap.scale * 2) : minimap.scale); + let minimapScale = (pixelRatio >= 2 ? Math.round(minimap.scale * 2) : minimap.scale); const minimapMaxColumn = minimap.maxColumn | 0; + const minimapMode = minimap.mode; const scrollbar = options.get(EditorOption.scrollbar); const verticalScrollbarWidth = scrollbar.verticalScrollbarSize | 0; @@ -1676,19 +1837,65 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption 1) { + minimapHeightIsEditorHeight = true; + minimapIsSampling = true; + minimapScale = 1; + minimapLineHeight = 1; + minimapCharWidth = minimapScale / pixelRatio; + } else { + const effectiveMinimapHeight = Math.ceil((viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight); + if (minimapMode === 'cover' || effectiveMinimapHeight > minimapCanvasInnerHeight) { + minimapHeightIsEditorHeight = true; + const configuredFontScale = minimapScale; + minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio))); + minimapScale = Math.min(configuredFontScale + 1, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight))); + if (minimapScale > configuredFontScale) { + minimapWidthMultiplier = Math.min(2, minimapScale / configuredFontScale); + } + minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier; + minimapCanvasInnerHeight = Math.ceil((Math.max(typicalViewportLineCount, viewLineCount + extraLinesBeyondLastLine)) * minimapLineHeight); + } + } + } + renderMinimap = minimapRenderCharacters ? RenderMinimap.Text : RenderMinimap.Blocks; // Given: @@ -1720,6 +1927,10 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption(input.mode, this.defaultValue.mode, ['actual', 'cover', 'contain']), side: EditorStringEnumOption.stringSet<'right' | 'left'>(input.side, this.defaultValue.side, ['right', 'left']), showSlider: EditorStringEnumOption.stringSet<'always' | 'mouseover'>(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']), renderCharacters: EditorBooleanOption.boolean(input.renderCharacters, this.defaultValue.renderCharacters), @@ -1955,6 +2187,65 @@ function _multiCursorModifierFromString(multiCursorModifier: 'ctrlCmd' | 'alt'): //#endregion +//#region padding + +/** + * Configuration options for editor padding + */ +export interface IEditorPaddingOptions { + /** + * Spacing between top edge of editor and first line. + */ + top?: number; + /** + * Spacing between bottom edge of editor and last line. + */ + bottom?: number; +} + +export interface InternalEditorPaddingOptions { + readonly top: number; + readonly bottom: number; +} + +class EditorPadding extends BaseEditorOption { + + constructor() { + super( + EditorOption.padding, 'padding', { top: 0, bottom: 0 }, + { + 'editor.padding.top': { + type: 'number', + default: 0, + minimum: 0, + maximum: 1000, + description: nls.localize('padding.top', "Controls the amount of space between the top edge of the editor and the first line.") + }, + 'editor.padding.bottom': { + type: 'number', + default: 0, + minimum: 0, + maximum: 1000, + description: nls.localize('padding.bottom', "Controls the amount of space between the bottom edge of the editor and the last line.") + } + } + ); + } + + public validate(_input: any): InternalEditorPaddingOptions { + if (typeof _input !== 'object') { + return this.defaultValue; + } + const input = _input as IEditorPaddingOptions; + + return { + top: EditorIntOption.clampedInt(input.top, 0, 0, 1000), + bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1000) + }; + } +} +//#endregion + //#region parameterHints /** @@ -2176,18 +2467,54 @@ class EditorRenderLineNumbersOption extends BaseEditorOption { +export interface IRulerOption { + readonly column: number; + readonly color: string | null; +} + +class EditorRulers extends BaseEditorOption { constructor() { - const defaults: number[] = []; + const defaults: IRulerOption[] = []; + const columnSchema: IJSONSchema = { type: 'number', description: nls.localize('rulers.size', "Number of monospace characters at which this editor ruler will render.") }; super( EditorOption.rulers, 'rulers', defaults, { type: 'array', items: { - type: 'number' + anyOf: [ + columnSchema, + { + type: [ + 'object' + ], + properties: { + column: columnSchema, + color: { + type: 'string', + description: nls.localize('rulers.color', "Color of this editor ruler."), + format: 'color-hex' + } + } + } + ] }, default: defaults, description: nls.localize('rulers', "Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.") @@ -2195,13 +2522,24 @@ class EditorRulers extends SimpleEditorOption { ); } - public validate(input: any): number[] { + public validate(input: any): IRulerOption[] { if (Array.isArray(input)) { - let rulers: number[] = []; - for (let value of input) { - rulers.push(EditorIntOption.clampedInt(value, 0, 0, 10000)); + let rulers: IRulerOption[] = []; + for (let _element of input) { + if (typeof _element === 'number') { + rulers.push({ + column: EditorIntOption.clampedInt(_element, 0, 0, 10000), + color: null + }); + } else if (typeof _element === 'object') { + const element = _element as IRulerOption; + rulers.push({ + column: EditorIntOption.clampedInt(element.column, 0, 0, 10000), + color: element.color + }); + } } - rulers.sort(); + rulers.sort((a, b) => a.column - b.column); return rulers; } return this.defaultValue; @@ -2251,6 +2589,11 @@ export interface IEditorScrollbarOptions { * Defaults to true. */ handleMouseWheel?: boolean; + /** + * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events). + * Defaults to true. + */ + alwaysConsumeMouseWheel?: boolean; /** * Height in pixels for the horizontal scrollbar. * Defaults to 10 (px). @@ -2281,6 +2624,7 @@ export interface InternalEditorScrollbarOptions { readonly verticalHasArrows: boolean; readonly horizontalHasArrows: boolean; readonly handleMouseWheel: boolean; + readonly alwaysConsumeMouseWheel: boolean; readonly horizontalScrollbarSize: number; readonly horizontalSliderSize: number; readonly verticalScrollbarSize: number; @@ -2315,6 +2659,7 @@ class EditorScrollbar extends BaseEditorOption>; @@ -2486,7 +2840,8 @@ class EditorSuggest extends BaseEditorOption(option: IEditorOption): IEd return option; } -/** - * @internal - */ export const enum EditorOption { acceptSuggestionOnCommitCharacter, acceptSuggestionOnEnter, accessibilitySupport, + accessibilityPageSize, ariaLabel, autoClosingBrackets, autoClosingOvertype, @@ -2928,6 +3299,8 @@ export const enum EditorOption { autoSurround, codeLens, colorDecorators, + columnSelection, + comments, contextmenu, copyWithSyntaxHighlighting, cursorBlinking, @@ -2946,6 +3319,7 @@ export const enum EditorOption { fixedOverflowWidgets, folding, foldingStrategy, + foldingHighlight, fontFamily, fontInfo, fontLigatures, @@ -2977,7 +3351,10 @@ export const enum EditorOption { occurrencesHighlight, overviewRulerBorder, overviewRulerLanes, + padding, parameterHints, + peekWidgetDefaultFocus, + definitionLinkOpensInPeek, quickSuggestions, quickSuggestionsDelay, readOnly, @@ -2985,6 +3362,7 @@ export const enum EditorOption { renderIndentGuides, renderFinalNewline, renderLineHighlight, + renderValidationDecorations, renderWhitespace, revealHorizontalRightPadding, roundedSelection, @@ -2992,6 +3370,7 @@ export const enum EditorOption { scrollbar, scrollBeyondLastColumn, scrollBeyondLastLine, + scrollPredominantAxis, selectionClipboard, selectionHighlight, selectOnLineNumbers, @@ -3011,10 +3390,10 @@ export const enum EditorOption { wordWrap, wordWrapBreakAfterCharacters, wordWrapBreakBeforeCharacters, - wordWrapBreakObtrusiveCharacters, wordWrapColumn, wordWrapMinified, wrappingIndent, + wrappingStrategy, // Leave these at the end (because they have dependencies!) editorClassName, @@ -3025,7 +3404,19 @@ export const enum EditorOption { } /** - * @internal + * WORKAROUND: TS emits "any" for complex editor options values (anything except string, bool, enum, etc. ends up being "any") + * @monacodtsreplace + * /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/ + * /comments, any/comments, EditorCommentsOptions/ + * /find, any/find, EditorFindOptions/ + * /fontInfo, any/fontInfo, FontInfo/ + * /gotoLocation, any/gotoLocation, GoToLocationOptions/ + * /hover, any/hover, EditorHoverOptions/ + * /lightbulb, any/lightbulb, EditorLightbulbOptions/ + * /minimap, any/minimap, EditorMinimapOptions/ + * /parameterHints, any/parameterHints, InternalParameterHintOptions/ + * /quickSuggestions, any/quickSuggestions, ValidQuickSuggestionsOptions/ + * /suggest, any/suggest, InternalSuggestOptions/ */ export const EditorOptions = { acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption( @@ -3046,6 +3437,8 @@ export const EditorOptions = { } )), accessibilitySupport: register(new EditorAccessibilitySupport()), + accessibilityPageSize: register(new EditorIntOption(EditorOption.accessibilityPageSize, 'accessibilityPageSize', 10, 1, Constants.MAX_SAFE_SMALL_INTEGER, + { description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.") })), ariaLabel: register(new EditorStringOption( EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content") )), @@ -3090,9 +3483,21 @@ export const EditorOptions = { description: nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.") } )), - autoIndent: register(new EditorBooleanOption( - EditorOption.autoIndent, 'autoIndent', true, - { description: nls.localize('autoIndent', "Controls whether the editor should automatically adjust the indentation when users type, paste or move lines. Extensions with indentation rules of the language must be available.") } + autoIndent: register(new EditorEnumOption( + EditorOption.autoIndent, 'autoIndent', + EditorAutoIndentStrategy.Full, 'full', + ['none', 'keep', 'brackets', 'advanced', 'full'], + _autoIndentFromString, + { + enumDescriptions: [ + nls.localize('editor.autoIndent.none', "The editor will not insert indentation automatically."), + nls.localize('editor.autoIndent.keep', "The editor will keep the current line's indentation."), + nls.localize('editor.autoIndent.brackets', "The editor will keep the current line's indentation and honor language defined brackets."), + nls.localize('editor.autoIndent.advanced', "The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."), + nls.localize('editor.autoIndent.full', "The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages."), + ], + description: nls.localize('autoIndent', "Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.") + } )), automaticLayout: register(new EditorBooleanOption( EditorOption.automaticLayout, 'automaticLayout', false, @@ -3119,6 +3524,11 @@ export const EditorOptions = { EditorOption.colorDecorators, 'colorDecorators', true, { description: nls.localize('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.") } )), + columnSelection: register(new EditorBooleanOption( + EditorOption.columnSelection, 'columnSelection', false, + { description: nls.localize('columnSelection', "Enable that the selection with the mouse and keys is doing column selection.") } + )), + comments: register(new EditorComments()), contextmenu: register(new EditorBooleanOption( EditorOption.contextmenu, 'contextmenu', true, )), @@ -3197,7 +3607,17 @@ export const EditorOptions = { EditorOption.foldingStrategy, 'foldingStrategy', 'auto' as 'auto' | 'indentation', ['auto', 'indentation'] as const, - { markdownDescription: nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.") } + { + enumDescriptions: [ + nls.localize('foldingStrategy.auto', "Use a language-specific folding strategy if available, else the indentation-based one."), + nls.localize('foldingStrategy.indentation', "Use the indentation-based folding strategy."), + ], + description: nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges.") + } + )), + foldingHighlight: register(new EditorBooleanOption( + EditorOption.foldingHighlight, 'foldingHighlight', true, + { description: nls.localize('foldingHighlight', "Controls whether the editor should highlight folded ranges.") } )), fontFamily: register(new EditorStringOption( EditorOption.fontFamily, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily, @@ -3249,15 +3669,17 @@ export const EditorOptions = { lineNumbers: register(new EditorRenderLineNumbersOption()), lineNumbersMinChars: register(new EditorIntOption( EditorOption.lineNumbersMinChars, 'lineNumbersMinChars', - 5, 1, 10 + 5, 1, 300 )), links: register(new EditorBooleanOption( EditorOption.links, 'links', true, { description: nls.localize('links', "Controls whether the editor should detect links and make them clickable.") } )), - matchBrackets: register(new EditorBooleanOption( - EditorOption.matchBrackets, 'matchBrackets', true, - { description: nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.") } + matchBrackets: register(new EditorStringEnumOption( + EditorOption.matchBrackets, 'matchBrackets', + 'always' as 'never' | 'near' | 'always', + ['always', 'near', 'never'] as const, + { description: nls.localize('matchBrackets', "Highlight matching brackets.") } )), minimap: register(new EditorMinimap()), mouseStyle: register(new EditorStringEnumOption( @@ -3321,7 +3743,24 @@ export const EditorOptions = { EditorOption.overviewRulerLanes, 'overviewRulerLanes', 3, 0, 3 )), + padding: register(new EditorPadding()), parameterHints: register(new EditorParameterHints()), + peekWidgetDefaultFocus: register(new EditorStringEnumOption( + EditorOption.peekWidgetDefaultFocus, 'peekWidgetDefaultFocus', + 'tree' as 'tree' | 'editor', + ['tree', 'editor'] as const, + { + enumDescriptions: [ + nls.localize('peekWidgetDefaultFocus.tree', "Focus the tree when opening peek"), + nls.localize('peekWidgetDefaultFocus.editor', "Focus the editor when opening peek") + ], + description: nls.localize('peekWidgetDefaultFocus', "Controls whether to focus the inline editor or the tree in the peek widget.") + } + )), + definitionLinkOpensInPeek: register(new EditorBooleanOption( + EditorOption.definitionLinkOpensInPeek, 'definitionLinkOpensInPeek', false, + { description: nls.localize('definitionLinkOpensInPeek', "Controls whether the definition link opens element in the peek widget.") } + )), quickSuggestions: register(new EditorQuickSuggestions()), quickSuggestionsDelay: register(new EditorIntOption( EditorOption.quickSuggestionsDelay, 'quickSuggestionsDelay', @@ -3357,9 +3796,14 @@ export const EditorOptions = { description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.") } )), + renderValidationDecorations: register(new EditorStringEnumOption( + EditorOption.renderValidationDecorations, 'renderValidationDecorations', + 'editable' as 'editable' | 'on' | 'off', + ['editable', 'on', 'off'] as const + )), renderWhitespace: register(new EditorStringEnumOption( EditorOption.renderWhitespace, 'renderWhitespace', - 'none' as 'none' | 'boundary' | 'selection' | 'all', + 'selection' as 'selection' | 'none' | 'boundary' | 'all', ['none', 'boundary', 'selection', 'all'] as const, { enumDescriptions: [ @@ -3390,6 +3834,10 @@ export const EditorOptions = { EditorOption.scrollBeyondLastLine, 'scrollBeyondLastLine', true, { description: nls.localize('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.") } )), + scrollPredominantAxis: register(new EditorBooleanOption( + EditorOption.scrollPredominantAxis, 'scrollPredominantAxis', true, + { description: nls.localize('scrollPredominantAxis', "Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.") } + )), selectionClipboard: register(new EditorBooleanOption( EditorOption.selectionClipboard, 'selectionClipboard', true, { @@ -3408,7 +3856,13 @@ export const EditorOptions = { EditorOption.showFoldingControls, 'showFoldingControls', 'mouseover' as 'always' | 'mouseover', ['always', 'mouseover'] as const, - { description: nls.localize('showFoldingControls', "Controls whether the fold controls on the gutter are automatically hidden.") } + { + enumDescriptions: [ + nls.localize('showFoldingControls.always', "Always show the folding controls."), + nls.localize('showFoldingControls.mouseover', "Only show the folding controls when the mouse is over the gutter."), + ], + description: nls.localize('showFoldingControls', "Controls when the folding controls on the gutter are shown.") + } )), showUnused: register(new EditorBooleanOption( EditorOption.showUnused, 'showUnused', true, @@ -3518,16 +3972,12 @@ export const EditorOptions = { )), wordWrapBreakAfterCharacters: register(new EditorStringOption( EditorOption.wordWrapBreakAfterCharacters, 'wordWrapBreakAfterCharacters', - ' \t})]?|/&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」', + ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」', )), wordWrapBreakBeforeCharacters: register(new EditorStringOption( EditorOption.wordWrapBreakBeforeCharacters, 'wordWrapBreakBeforeCharacters', '([{‘“〈《「『【〔([{「£¥$£¥++' )), - wordWrapBreakObtrusiveCharacters: register(new EditorStringOption( - EditorOption.wordWrapBreakObtrusiveCharacters, 'wordWrapBreakObtrusiveCharacters', - '.' - )), wordWrapColumn: register(new EditorIntOption( EditorOption.wordWrapColumn, 'wordWrapColumn', 80, 1, Constants.MAX_SAFE_SMALL_INTEGER, @@ -3559,28 +4009,28 @@ export const EditorOptions = { description: nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."), } )), + wrappingStrategy: register(new EditorStringEnumOption( + EditorOption.wrappingStrategy, 'wrappingStrategy', + 'simple' as 'simple' | 'advanced', + ['simple', 'advanced'] as const, + { + enumDescriptions: [ + nls.localize('wrappingStrategy.simple', "Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."), + nls.localize('wrappingStrategy.advanced', "Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.") + ], + description: nls.localize('wrappingStrategy', "Controls the algorithm that computes wrapping points.") + } + )), // Leave these at the end (because they have dependencies!) editorClassName: register(new EditorClassName()), pixelRatio: register(new EditorPixelRatio()), tabFocusMode: register(new EditorTabFocusMode()), layoutInfo: register(new EditorLayoutInfoComputer()), - wrappingInfo: register(new EditorWrappingInfoComputer()), + wrappingInfo: register(new EditorWrappingInfoComputer()) }; -/** - * @internal - */ type EditorOptionsType = typeof EditorOptions; -/** - * @internal - */ type FindEditorOptionsKeyById = { [K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never }[keyof EditorOptionsType]; -/** - * @internal - */ type ComputedEditorOptionValue> = T extends IEditorOption ? R : never; -/** - * @internal - */ export type FindComputedEditorOptionValueById = NonNullable]>>; diff --git a/src/vs/editor/common/config/fontInfo.ts b/src/vs/editor/common/config/fontInfo.ts index 16719602fa143..e5d21cb623a9b 100644 --- a/src/vs/editor/common/config/fontInfo.ts +++ b/src/vs/editor/common/config/fontInfo.ts @@ -134,6 +134,8 @@ export class FontInfo extends BareFontInfo { readonly typicalFullwidthCharacterWidth: number; readonly canUseHalfwidthRightwardsArrow: boolean; readonly spaceWidth: number; + readonly middotWidth: number; + readonly wsmiddotWidth: number; readonly maxDigitWidth: number; /** @@ -152,6 +154,8 @@ export class FontInfo extends BareFontInfo { typicalFullwidthCharacterWidth: number; canUseHalfwidthRightwardsArrow: boolean; spaceWidth: number; + middotWidth: number; + wsmiddotWidth: number; maxDigitWidth: number; }, isTrusted: boolean) { super(opts); @@ -161,6 +165,8 @@ export class FontInfo extends BareFontInfo { this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth; this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow; this.spaceWidth = opts.spaceWidth; + this.middotWidth = opts.middotWidth; + this.wsmiddotWidth = opts.wsmiddotWidth; this.maxDigitWidth = opts.maxDigitWidth; } @@ -179,6 +185,8 @@ export class FontInfo extends BareFontInfo { && this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.spaceWidth === other.spaceWidth + && this.middotWidth === other.middotWidth + && this.wsmiddotWidth === other.wsmiddotWidth && this.maxDigitWidth === other.maxDigitWidth ); } diff --git a/src/vs/editor/common/controller/cursor.ts b/src/vs/editor/common/controller/cursor.ts index 80e20c21d7f6f..cd488b900ac8f 100644 --- a/src/vs/editor/common/controller/cursor.ts +++ b/src/vs/editor/common/controller/cursor.ts @@ -12,11 +12,11 @@ import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperat import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { TypeOperations, TypeWithAutoClosingCommand } from 'vs/editor/common/controller/cursorTypeOperations'; import { Position } from 'vs/editor/common/core/position'; -import { Range } from 'vs/editor/common/core/range'; +import { Range, IRange } from 'vs/editor/common/core/range'; import { ISelection, Selection, SelectionDirection } from 'vs/editor/common/core/selection'; import * as editorCommon from 'vs/editor/common/editorCommon'; -import { IIdentifiedSingleEditOperation, ITextModel, TrackedRangeStickiness, IModelDeltaDecoration, ICursorStateComputer } from 'vs/editor/common/model'; -import { RawContentChangedType } from 'vs/editor/common/model/textModelEvents'; +import { ITextModel, TrackedRangeStickiness, IModelDeltaDecoration, ICursorStateComputer, IIdentifiedSingleEditOperation, IValidEditOperation } from 'vs/editor/common/model'; +import { RawContentChangedType, ModelRawContentChangedEvent } from 'vs/editor/common/model/textModelEvents'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; import { dispose } from 'vs/base/common/lifecycle'; @@ -186,6 +186,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { public context: CursorContext; private _cursors: CursorCollection; + private _hasFocus: boolean; private _isHandling: boolean; private _isDoingComposition: boolean; private _selectionsWhenCompositionStarted: Selection[] | null; @@ -202,6 +203,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { this.context = new CursorContext(this._configuration, this._model, this._viewModel); this._cursors = new CursorCollection(this.context); + this._hasFocus = false; this._isHandling = false; this._isDoingComposition = false; this._selectionsWhenCompositionStarted = null; @@ -215,8 +217,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { return; } - let hadFlushEvent = e.containsEvent(RawContentChangedType.Flush); - this._onModelContentChanged(hadFlushEvent); + this._onModelContentChanged(e); })); this._register(viewModel.addEventListener((events: viewEvents.ViewEvent[]) => { @@ -264,6 +265,10 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { super.dispose(); } + public setHasFocus(hasFocus: boolean): void { + this._hasFocus = hasFocus; + } + private _validateAutoClosedActions(): void { if (this._autoClosedActions.length > 0) { let selections: Range[] = this._cursors.getSelections(); @@ -392,8 +397,9 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { this.reveal('restoreState', true, RevealTarget.Primary, editorCommon.ScrollType.Immediate); } - private _onModelContentChanged(hadFlushEvent: boolean): void { + private _onModelContentChanged(e: ModelRawContentChangedEvent): void { + const hadFlushEvent = e.containsEvent(RawContentChangedType.Flush); this._prevEditOperationType = EditOperationType.Other; if (hadFlushEvent) { @@ -403,8 +409,13 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { this._validateAutoClosedActions(); this._emitStateChangedIfNecessary('model', CursorChangeReason.ContentFlush, null); } else { - const selectionsFromMarkers = this._cursors.readSelectionFromMarkers(); - this.setStates('modelChange', CursorChangeReason.RecoverFromMarkers, CursorState.fromModelSelections(selectionsFromMarkers)); + if (this._hasFocus && e.resultingSelection && e.resultingSelection.length > 0) { + const cursorState = CursorState.fromModelSelections(e.resultingSelection); + this.setStates('modelChange', e.isUndoing ? CursorChangeReason.Undo : e.isRedoing ? CursorChangeReason.Redo : CursorChangeReason.RecoverFromMarkers, cursorState); + } else { + const selectionsFromMarkers = this._cursors.readSelectionFromMarkers(); + this.setStates('modelChange', CursorChangeReason.RecoverFromMarkers, CursorState.fromModelSelections(selectionsFromMarkers)); + } } } @@ -545,7 +556,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { // Let the view get the event first. try { const eventsCollector = this._beginEmit(); - eventsCollector.emit(new viewEvents.ViewCursorStateChangedEvent(viewSelections)); + eventsCollector.emit(new viewEvents.ViewCursorStateChangedEvent(viewSelections, selections)); } finally { this._endEmit(); } @@ -704,11 +715,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { const oldState = new CursorModelState(this._model, this); let cursorChangeReason = CursorChangeReason.NotSet; - if (handlerId !== H.Undo && handlerId !== H.Redo) { - // TODO@Alex: if the undo/redo stack contains non-null selections - // it would also be OK to stop tracking selections here - this._cursors.stopTrackingSelections(); - } + this._cursors.stopTrackingSelections(); // ensure valid state on all cursors this._cursors.ensureValidState(); @@ -727,23 +734,13 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { case H.Paste: cursorChangeReason = CursorChangeReason.Paste; - this._paste(payload.text, payload.pasteOnNewLine, payload.multicursorText); + this._paste(payload.text, payload.pasteOnNewLine, payload.multicursorText || []); break; case H.Cut: this._cut(); break; - case H.Undo: - cursorChangeReason = CursorChangeReason.Undo; - this._interpretCommandResult(this._model.undo()); - break; - - case H.Redo: - cursorChangeReason = CursorChangeReason.Redo; - this._interpretCommandResult(this._model.redo()); - break; - case H.ExecuteCommand: this._externalExecuteCommand(payload); break; @@ -762,9 +759,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors { this._isHandling = false; - if (handlerId !== H.Undo && handlerId !== H.Redo) { - this._cursors.startTrackingSelections(); - } + this._cursors.startTrackingSelections(); this._validateAutoClosedActions(); @@ -903,8 +898,8 @@ class CommandExecutor { if (commandsData.hadTrackedEditOperation && filteredOperations.length > 0) { filteredOperations[0]._isTracked = true; } - let selectionsAfter = ctx.model.pushEditOperations(ctx.selectionsBefore, filteredOperations, (inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[] => { - let groupedInverseEditOperations: IIdentifiedSingleEditOperation[][] = []; + let selectionsAfter = ctx.model.pushEditOperations(ctx.selectionsBefore, filteredOperations, (inverseEditOperations: IValidEditOperation[]): Selection[] => { + let groupedInverseEditOperations: IValidEditOperation[][] = []; for (let i = 0; i < ctx.selectionsBefore.length; i++) { groupedInverseEditOperations[i] = []; } @@ -915,7 +910,7 @@ class CommandExecutor { } groupedInverseEditOperations[op.identifier.major].push(op); } - const minorBasedSorter = (a: IIdentifiedSingleEditOperation, b: IIdentifiedSingleEditOperation) => { + const minorBasedSorter = (a: IValidEditOperation, b: IValidEditOperation) => { return a.identifier!.minor - b.identifier!.minor; }; let cursorSelections: Selection[] = []; @@ -1000,8 +995,8 @@ class CommandExecutor { let operations: IIdentifiedSingleEditOperation[] = []; let operationMinor = 0; - const addEditOperation = (selection: Range, text: string | null) => { - if (selection.isEmpty() && text === '') { + const addEditOperation = (range: IRange, text: string | null, forceMoveMarkers: boolean = false) => { + if (Range.isEmpty(range) && text === '') { // This command wants to add a no-op => no thank you return; } @@ -1010,20 +1005,21 @@ class CommandExecutor { major: majorIdentifier, minor: operationMinor++ }, - range: selection, + range: range, text: text, - forceMoveMarkers: false, + forceMoveMarkers: forceMoveMarkers, isAutoWhitespaceEdit: command.insertsAutoWhitespace }); }; let hadTrackedEditOperation = false; - const addTrackedEditOperation = (selection: Range, text: string | null) => { + const addTrackedEditOperation = (selection: IRange, text: string | null, forceMoveMarkers?: boolean) => { hadTrackedEditOperation = true; - addEditOperation(selection, text); + addEditOperation(selection, text, forceMoveMarkers); }; - const trackSelection = (selection: Selection, trackPreviousOnEmpty?: boolean) => { + const trackSelection = (_selection: ISelection, trackPreviousOnEmpty?: boolean) => { + const selection = Selection.liftSelection(_selection); let stickiness: TrackedRangeStickiness; if (selection.isEmpty()) { if (typeof trackPreviousOnEmpty === 'boolean') { @@ -1093,7 +1089,7 @@ class CommandExecutor { const previousOp = operations[i - 1]; const currentOp = operations[i]; - if (previousOp.range.getStartPosition().isBefore(currentOp.range.getEndPosition())) { + if (Range.getStartPosition(previousOp.range).isBefore(Range.getEndPosition(currentOp.range))) { let loserMajor: number; diff --git a/src/vs/editor/common/controller/cursorCommon.ts b/src/vs/editor/common/controller/cursorCommon.ts index 009744c4ee796..ac2699979188a 100644 --- a/src/vs/editor/common/controller/cursorCommon.ts +++ b/src/vs/editor/common/controller/cursorCommon.ts @@ -6,7 +6,7 @@ import { CharCode } from 'vs/base/common/charCode'; import { onUnexpectedError } from 'vs/base/common/errors'; import * as strings from 'vs/base/common/strings'; -import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, ConfigurationChangedEvent, EditorAutoClosingOvertypeStrategy, EditorOption } from 'vs/editor/common/config/editorOptions'; +import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, ConfigurationChangedEvent, EditorAutoClosingOvertypeStrategy, EditorOption, EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -103,7 +103,7 @@ export class CursorConfiguration { public readonly autoClosingQuotes: EditorAutoClosingStrategy; public readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; public readonly autoSurround: EditorAutoSurroundStrategy; - public readonly autoIndent: boolean; + public readonly autoIndent: EditorAutoIndentStrategy; public readonly autoClosingPairsOpen2: Map; public readonly autoClosingPairsClose2: Map; public readonly surroundingPairs: CharacterMap; @@ -523,12 +523,15 @@ export class CursorColumns { if (codePoint === CharCode.Tab) { result = CursorColumns.nextRenderTabStop(result, tabSize); } else { + let graphemeBreakType = strings.getGraphemeBreakType(codePoint); while (i < endOffset) { const nextCodePoint = strings.getNextCodePoint(lineContent, endOffset, i); - if (!strings.isUnicodeMark(nextCodePoint)) { + const nextGraphemeBreakType = strings.getGraphemeBreakType(nextCodePoint); + if (strings.breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) { break; } i += (nextCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = nextGraphemeBreakType; } if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) { result = result + 2; @@ -582,12 +585,15 @@ export class CursorColumns { if (codePoint === CharCode.Tab) { afterVisibleColumn = CursorColumns.nextRenderTabStop(beforeVisibleColumn, tabSize); } else { + let graphemeBreakType = strings.getGraphemeBreakType(codePoint); while (i < lineLength) { const nextCodePoint = strings.getNextCodePoint(lineContent, lineLength, i); - if (!strings.isUnicodeMark(nextCodePoint)) { + const nextGraphemeBreakType = strings.getGraphemeBreakType(nextCodePoint); + if (strings.breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) { break; } i += (nextCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1); + graphemeBreakType = nextGraphemeBreakType; } if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) { afterVisibleColumn = beforeVisibleColumn + 2; diff --git a/src/vs/editor/common/controller/cursorMoveOperations.ts b/src/vs/editor/common/controller/cursorMoveOperations.ts index 1d414dd1f32a1..df45d78e9f9d4 100644 --- a/src/vs/editor/common/controller/cursorMoveOperations.ts +++ b/src/vs/editor/common/controller/cursorMoveOperations.ts @@ -7,6 +7,7 @@ import { CursorColumns, CursorConfiguration, ICursorSimpleModel, SingleCursorSta import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import * as strings from 'vs/base/common/strings'; +import { Constants } from 'vs/base/common/uint'; export class CursorPosition { _cursorPositionBrand: void; @@ -214,7 +215,7 @@ export class MoveOperations { public static moveToEndOfLine(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, inSelectionMode: boolean): SingleCursorState { let lineNumber = cursor.position.lineNumber; let maxColumn = model.getLineMaxColumn(lineNumber); - return cursor.move(inSelectionMode, lineNumber, maxColumn, 0); + return cursor.move(inSelectionMode, lineNumber, maxColumn, Constants.MAX_SAFE_SMALL_INTEGER - maxColumn); } public static moveToBeginningOfBuffer(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, inSelectionMode: boolean): SingleCursorState { diff --git a/src/vs/editor/common/controller/cursorTypeOperations.ts b/src/vs/editor/common/controller/cursorTypeOperations.ts index ba0be3d53174d..64db6112da9a7 100644 --- a/src/vs/editor/common/controller/cursorTypeOperations.ts +++ b/src/vs/editor/common/controller/cursorTypeOperations.ts @@ -19,6 +19,7 @@ import { ITextModel } from 'vs/editor/common/model'; import { EnterAction, IndentAction, StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { IElectricAction } from 'vs/editor/common/modes/supports/electricCharacter'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; export class TypeOperations { @@ -34,7 +35,8 @@ export class TypeOperations { tabSize: config.tabSize, indentSize: config.indentSize, insertSpaces: config.insertSpaces, - useTabStops: config.useTabStops + useTabStops: config.useTabStops, + autoIndent: config.autoIndent }); } return commands; @@ -48,7 +50,8 @@ export class TypeOperations { tabSize: config.tabSize, indentSize: config.indentSize, insertSpaces: config.insertSpaces, - useTabStops: config.useTabStops + useTabStops: config.useTabStops, + autoIndent: config.autoIndent }); } return commands; @@ -91,7 +94,7 @@ export class TypeOperations { if (pasteOnNewLine) { // Paste entire line at the beginning of line let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1); - commands[i] = new ReplaceCommandThatPreservesSelection(typeSelection, text, selection); + commands[i] = new ReplaceCommandThatPreservesSelection(typeSelection, text, selection, true); } else { commands[i] = new ReplaceCommand(selection, text); } @@ -149,15 +152,15 @@ export class TypeOperations { let action: IndentAction | EnterAction | null = null; let indentation: string = ''; - let expectedIndentAction = config.autoIndent ? LanguageConfigurationRegistry.getInheritIndentForLine(model, lineNumber, false) : null; + const expectedIndentAction = LanguageConfigurationRegistry.getInheritIndentForLine(config.autoIndent, model, lineNumber, false); if (expectedIndentAction) { action = expectedIndentAction.action; indentation = expectedIndentAction.indentation; } else if (lineNumber > 1) { let lastLineNumber: number; for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) { - let lineText = model.getLineContent(lastLineNumber); - let nonWhitespaceIdx = strings.lastNonWhitespaceIndex(lineText); + const lineText = model.getLineContent(lastLineNumber); + const nonWhitespaceIdx = strings.lastNonWhitespaceIndex(lineText); if (nonWhitespaceIdx >= 0) { break; } @@ -168,14 +171,10 @@ export class TypeOperations { return null; } - let maxColumn = model.getLineMaxColumn(lastLineNumber); - let expectedEnterAction = LanguageConfigurationRegistry.getEnterAction(model, new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn)); + const maxColumn = model.getLineMaxColumn(lastLineNumber); + const expectedEnterAction = LanguageConfigurationRegistry.getEnterAction(config.autoIndent, model, new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn)); if (expectedEnterAction) { - indentation = expectedEnterAction.indentation; - action = expectedEnterAction.enterAction; - if (action) { - indentation += action.appendText; - } + indentation = expectedEnterAction.indentation + expectedEnterAction.appendText; } } @@ -251,7 +250,8 @@ export class TypeOperations { tabSize: config.tabSize, indentSize: config.indentSize, insertSpaces: config.insertSpaces, - useTabStops: config.useTabStops + useTabStops: config.useTabStops, + autoIndent: config.autoIndent }); } } @@ -289,104 +289,97 @@ export class TypeOperations { } private static _enter(config: CursorConfiguration, model: ITextModel, keepPosition: boolean, range: Range): ICommand { - if (!model.isCheapToTokenize(range.getStartPosition().lineNumber)) { + if (config.autoIndent === EditorAutoIndentStrategy.None) { + return TypeOperations._typeCommand(range, '\n', keepPosition); + } + if (!model.isCheapToTokenize(range.getStartPosition().lineNumber) || config.autoIndent === EditorAutoIndentStrategy.Keep) { let lineText = model.getLineContent(range.startLineNumber); let indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1); return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition); } - let r = LanguageConfigurationRegistry.getEnterAction(model, range); + const r = LanguageConfigurationRegistry.getEnterAction(config.autoIndent, model, range); if (r) { - let enterAction = r.enterAction; - let indentation = r.indentation; - - if (enterAction.indentAction === IndentAction.None) { + if (r.indentAction === IndentAction.None) { // Nothing special - return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation + enterAction.appendText), keepPosition); + return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition); - } else if (enterAction.indentAction === IndentAction.Indent) { + } else if (r.indentAction === IndentAction.Indent) { // Indent once - return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation + enterAction.appendText), keepPosition); + return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition); - } else if (enterAction.indentAction === IndentAction.IndentOutdent) { + } else if (r.indentAction === IndentAction.IndentOutdent) { // Ultra special - let normalIndent = config.normalizeIndentation(indentation); - let increasedIndent = config.normalizeIndentation(indentation + enterAction.appendText); + const normalIndent = config.normalizeIndentation(r.indentation); + const increasedIndent = config.normalizeIndentation(r.indentation + r.appendText); - let typeText = '\n' + increasedIndent + '\n' + normalIndent; + const typeText = '\n' + increasedIndent + '\n' + normalIndent; if (keepPosition) { return new ReplaceCommandWithoutChangingPosition(range, typeText, true); } else { return new ReplaceCommandWithOffsetCursorState(range, typeText, -1, increasedIndent.length - normalIndent.length, true); } - } else if (enterAction.indentAction === IndentAction.Outdent) { - let actualIndentation = TypeOperations.unshiftIndent(config, indentation); - return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(actualIndentation + enterAction.appendText), keepPosition); + } else if (r.indentAction === IndentAction.Outdent) { + const actualIndentation = TypeOperations.unshiftIndent(config, r.indentation); + return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition); } } - // no enter rules applied, we should check indentation rules then. - if (!config.autoIndent) { - // Nothing special - let lineText = model.getLineContent(range.startLineNumber); - let indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1); - return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition); - } - - let ir = LanguageConfigurationRegistry.getIndentForEnter(model, range, { - unshiftIndent: (indent) => { - return TypeOperations.unshiftIndent(config, indent); - }, - shiftIndent: (indent) => { - return TypeOperations.shiftIndent(config, indent); - }, - normalizeIndentation: (indent) => { - return config.normalizeIndentation(indent); - } - }, config.autoIndent); + const lineText = model.getLineContent(range.startLineNumber); + const indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1); - let lineText = model.getLineContent(range.startLineNumber); - let indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1); + if (config.autoIndent >= EditorAutoIndentStrategy.Full) { + const ir = LanguageConfigurationRegistry.getIndentForEnter(config.autoIndent, model, range, { + unshiftIndent: (indent) => { + return TypeOperations.unshiftIndent(config, indent); + }, + shiftIndent: (indent) => { + return TypeOperations.shiftIndent(config, indent); + }, + normalizeIndentation: (indent) => { + return config.normalizeIndentation(indent); + } + }); - if (ir) { - let oldEndViewColumn = CursorColumns.visibleColumnFromColumn2(config, model, range.getEndPosition()); - let oldEndColumn = range.endColumn; + if (ir) { + let oldEndViewColumn = CursorColumns.visibleColumnFromColumn2(config, model, range.getEndPosition()); + const oldEndColumn = range.endColumn; - let beforeText = '\n'; - if (indentation !== config.normalizeIndentation(ir.beforeEnter)) { - beforeText = config.normalizeIndentation(ir.beforeEnter) + lineText.substring(indentation.length, range.startColumn - 1) + '\n'; - range = new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn); - } + let beforeText = '\n'; + if (indentation !== config.normalizeIndentation(ir.beforeEnter)) { + beforeText = config.normalizeIndentation(ir.beforeEnter) + lineText.substring(indentation.length, range.startColumn - 1) + '\n'; + range = new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn); + } - let newLineContent = model.getLineContent(range.endLineNumber); - let firstNonWhitespace = strings.firstNonWhitespaceIndex(newLineContent); - if (firstNonWhitespace >= 0) { - range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1)); - } else { - range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber)); - } + const newLineContent = model.getLineContent(range.endLineNumber); + const firstNonWhitespace = strings.firstNonWhitespaceIndex(newLineContent); + if (firstNonWhitespace >= 0) { + range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1)); + } else { + range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber)); + } - if (keepPosition) { - return new ReplaceCommandWithoutChangingPosition(range, beforeText + config.normalizeIndentation(ir.afterEnter), true); - } else { - let offset = 0; - if (oldEndColumn <= firstNonWhitespace + 1) { - if (!config.insertSpaces) { - oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize); + if (keepPosition) { + return new ReplaceCommandWithoutChangingPosition(range, beforeText + config.normalizeIndentation(ir.afterEnter), true); + } else { + let offset = 0; + if (oldEndColumn <= firstNonWhitespace + 1) { + if (!config.insertSpaces) { + oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize); + } + offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0); } - offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0); + return new ReplaceCommandWithOffsetCursorState(range, beforeText + config.normalizeIndentation(ir.afterEnter), 0, offset, true); } - return new ReplaceCommandWithOffsetCursorState(range, beforeText + config.normalizeIndentation(ir.afterEnter), 0, offset, true); } - - } else { - return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition); } + + return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition); } private static _isAutoIndentType(config: CursorConfiguration, model: ITextModel, selections: Selection[]): boolean { - if (!config.autoIndent) { + if (config.autoIndent < EditorAutoIndentStrategy.Full) { return false; } @@ -400,8 +393,8 @@ export class TypeOperations { } private static _runAutoIndentType(config: CursorConfiguration, model: ITextModel, range: Range, ch: string): ICommand | null { - let currentIndentation = LanguageConfigurationRegistry.getIndentationAtPosition(model, range.startLineNumber, range.startColumn); - let actualIndentation = LanguageConfigurationRegistry.getIndentActionForType(model, range, ch, { + const currentIndentation = LanguageConfigurationRegistry.getIndentationAtPosition(model, range.startLineNumber, range.startColumn); + const actualIndentation = LanguageConfigurationRegistry.getIndentActionForType(config.autoIndent, model, range, ch, { shiftIndent: (indentation) => { return TypeOperations.shiftIndent(config, indentation); }, @@ -415,7 +408,7 @@ export class TypeOperations { } if (actualIndentation !== config.normalizeIndentation(currentIndentation)) { - let firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range.startLineNumber); + const firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range.startLineNumber); if (firstNonWhitespace === 0) { return TypeOperations._typeCommand( new Range(range.startLineNumber, 0, range.endLineNumber, range.endColumn), @@ -459,9 +452,10 @@ export class TypeOperations { return false; } - // Do not over-type after a backslash + // Do not over-type quotes after a backslash + const chIsQuote = isQuote(ch); const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : CharCode.Null; - if (beforeCharacter === CharCode.Backslash) { + if (beforeCharacter === CharCode.Backslash && chIsQuote) { return false; } @@ -498,15 +492,20 @@ export class TypeOperations { }); } + private static _autoClosingPairIsSymmetric(autoClosingPair: StandardAutoClosingPairConditional): boolean { + const { open, close } = autoClosingPair; + return (open.indexOf(close) >= 0 || close.indexOf(open) >= 0); + } + private static _isBeforeClosingBrace(config: CursorConfiguration, autoClosingPair: StandardAutoClosingPairConditional, characterAfter: string) { const otherAutoClosingPairs = config.autoClosingPairsClose2.get(characterAfter); if (!otherAutoClosingPairs) { return false; } - const thisBraceIsSymmetric = (autoClosingPair.open === autoClosingPair.close); + const thisBraceIsSymmetric = TypeOperations._autoClosingPairIsSymmetric(autoClosingPair); for (const otherAutoClosingPair of otherAutoClosingPairs) { - const otherBraceIsSymmetric = (otherAutoClosingPair.open === otherAutoClosingPair.close); + const otherBraceIsSymmetric = TypeOperations._autoClosingPairIsSymmetric(otherAutoClosingPair); if (!thisBraceIsSymmetric && otherBraceIsSymmetric) { continue; } diff --git a/src/vs/editor/common/controller/cursorWordOperations.ts b/src/vs/editor/common/controller/cursorWordOperations.ts index 300174e613aa8..84a9dcd96d29d 100644 --- a/src/vs/editor/common/controller/cursorWordOperations.ts +++ b/src/vs/editor/common/controller/cursorWordOperations.ts @@ -289,17 +289,26 @@ export class WordOperations { column = model.getLineMaxColumn(lineNumber); } } else if (wordNavigationType === WordNavigationType.WordAccessibility) { + if (movedDown) { + // If we move to the next line, pretend that the cursor is right before the first character. + // This is needed when the first word starts right at the first character - and in order not to miss it, + // we need to start before. + column = 0; + } while ( nextWordOnLine - && nextWordOnLine.wordType === WordType.Separator + && (nextWordOnLine.wordType === WordType.Separator + || nextWordOnLine.start + 1 <= column + ) ) { // Skip over a word made up of one single separator + // Also skip over word if it begins before current cursor position to ascertain we're moving forward at least 1 character. nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1)); } if (nextWordOnLine) { - column = nextWordOnLine.end + 1; + column = nextWordOnLine.start + 1; } else { column = model.getLineMaxColumn(lineNumber); } diff --git a/src/vs/editor/common/core/characterClassifier.ts b/src/vs/editor/common/core/characterClassifier.ts index 214bb2abf0533..e5aac27c816bb 100644 --- a/src/vs/editor/common/core/characterClassifier.ts +++ b/src/vs/editor/common/core/characterClassifier.ts @@ -12,14 +12,14 @@ export class CharacterClassifier { /** * Maintain a compact (fully initialized ASCII map for quickly classifying ASCII characters - used more often in code). */ - private _asciiMap: Uint8Array; + protected _asciiMap: Uint8Array; /** * The entire map (sparse array). */ - private _map: Map; + protected _map: Map; - private _defaultValue: number; + protected _defaultValue: number; constructor(_defaultValue: T) { let defaultValue = toUint8(_defaultValue); diff --git a/src/vs/editor/common/core/lineTokens.ts b/src/vs/editor/common/core/lineTokens.ts index ffc1f05f49e92..51aa6a93ca83f 100644 --- a/src/vs/editor/common/core/lineTokens.ts +++ b/src/vs/editor/common/core/lineTokens.ts @@ -67,6 +67,11 @@ export class LineTokens implements IViewLineTokens { return 0; } + public getMetadata(tokenIndex: number): number { + const metadata = this._tokens[(tokenIndex << 1) + 1]; + return metadata; + } + public getLanguageId(tokenIndex: number): LanguageId { const metadata = this._tokens[(tokenIndex << 1) + 1]; return TokenMetadata.getLanguageId(metadata); @@ -132,8 +137,8 @@ export class LineTokens implements IViewLineTokens { while (low < high) { - let mid = low + Math.floor((high - low) / 2); - let endOffset = tokens[(mid << 1)]; + const mid = low + Math.floor((high - low) / 2); + const endOffset = tokens[(mid << 1)]; if (endOffset === desiredIndex) { return mid + 1; diff --git a/src/vs/editor/common/core/range.ts b/src/vs/editor/common/core/range.ts index e212e757dce02..d684e3b952008 100644 --- a/src/vs/editor/common/core/range.ts +++ b/src/vs/editor/common/core/range.ts @@ -264,14 +264,28 @@ export class Range { * Return the end position (which will be after or equal to the start position) */ public getEndPosition(): Position { - return new Position(this.endLineNumber, this.endColumn); + return Range.getEndPosition(this); + } + + /** + * Return the end position (which will be after or equal to the start position) + */ + public static getEndPosition(range: IRange): Position { + return new Position(range.endLineNumber, range.endColumn); } /** * Return the start position (which will be before or equal to the end position) */ public getStartPosition(): Position { - return new Position(this.startLineNumber, this.startColumn); + return Range.getStartPosition(this); + } + + /** + * Return the start position (which will be before or equal to the end position) + */ + public static getStartPosition(range: IRange): Position { + return new Position(range.startLineNumber, range.startColumn); } /** diff --git a/src/vs/editor/common/core/rgba.ts b/src/vs/editor/common/core/rgba.ts index 3a19425bc4d4c..3cfbf4e0488ba 100644 --- a/src/vs/editor/common/core/rgba.ts +++ b/src/vs/editor/common/core/rgba.ts @@ -36,6 +36,15 @@ export class RGBA8 { this.a = RGBA8._clamp(a); } + public equals(other: RGBA8): boolean { + return ( + this.r === other.r + && this.g === other.g + && this.b === other.b + && this.a === other.a + ); + } + private static _clamp(c: number): number { if (c < 0) { return 0; diff --git a/src/vs/editor/common/core/stringBuilder.ts b/src/vs/editor/common/core/stringBuilder.ts index 36cbe87f54e7d..661fd6642e25c 100644 --- a/src/vs/editor/common/core/stringBuilder.ts +++ b/src/vs/editor/common/core/stringBuilder.ts @@ -5,7 +5,7 @@ import * as strings from 'vs/base/common/strings'; -declare var TextDecoder: any; // TODO@TypeScript +declare const TextDecoder: any; // TODO@TypeScript interface TextDecoder { decode(view: Uint16Array): string; } diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index 679cb6760233f..e176e90ede30a 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -10,7 +10,7 @@ import { ConfigurationChangedEvent, IComputedEditorOptions, IEditorOptions } fro import { IPosition, Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { ISelection, Selection } from 'vs/editor/common/core/selection'; -import { IIdentifiedSingleEditOperation, IModelDecorationsChangeAccessor, ITextModel, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model'; +import { IModelDecorationsChangeAccessor, ITextModel, OverviewRulerLane, TrackedRangeStickiness, IValidEditOperation } from 'vs/editor/common/model'; import { ThemeColor } from 'vs/platform/theme/common/themeService'; /** @@ -22,7 +22,7 @@ export interface IEditOperationBuilder { * @param range The range to replace (delete). May be empty to represent a simple insert. * @param text The text to replace with. May be null to represent a simple delete. */ - addEditOperation(range: Range, text: string | null): void; + addEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void; /** * Add a new edit operation (a replace operation). @@ -30,7 +30,7 @@ export interface IEditOperationBuilder { * @param range The range to replace (delete). May be empty to represent a simple insert. * @param text The text to replace with. May be null to represent a simple delete. */ - addTrackedEditOperation(range: Range, text: string | null): void; + addTrackedEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void; /** * Track `selection` when applying edit operations. @@ -51,7 +51,7 @@ export interface ICursorStateComputerData { /** * Get the inverse edit operations of the added edit operations. */ - getInverseEditOperations(): IIdentifiedSingleEditOperation[]; + getInverseEditOperations(): IValidEditOperation[]; /** * Get a previously tracked selection. * @param id The unique identifier returned by `trackSelection`. @@ -154,6 +154,7 @@ export interface IConfiguration extends IDisposable { readonly options: IComputedEditorOptions; setMaxLineNumber(maxLineNumber: number): void; + setViewLineCount(viewLineCount: number): void; updateOptions(newOptions: IEditorOptions): void; getRawOptions(): IEditorOptions; observeReferenceElement(dimension?: IDimension): void; @@ -174,6 +175,14 @@ export interface IScrollEvent { readonly scrollHeightChanged: boolean; } +export interface IContentSizeChangedEvent { + readonly contentWidth: number; + readonly contentHeight: number; + + readonly contentWidthChanged: boolean; + readonly contentHeightChanged: boolean; +} + export interface INewScrollPosition { scrollLeft?: number; scrollTop?: number; @@ -347,6 +356,12 @@ export interface IEditor { */ revealLineInCenterIfOutsideViewport(lineNumber: number, scrollType?: ScrollType): void; + /** + * Scroll vertically as necessary and reveal a line close to the top of the viewport, + * optimized for viewing a code definition. + */ + revealLineNearTop(lineNumber: number, scrollType?: ScrollType): void; + /** * Scroll vertically or horizontally as necessary and reveal a position. */ @@ -362,6 +377,12 @@ export interface IEditor { */ revealPositionInCenterIfOutsideViewport(position: IPosition, scrollType?: ScrollType): void; + /** + * Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport, + * optimized for viewing a code definition. + */ + revealPositionNearTop(position: IPosition, scrollType?: ScrollType): void; + /** * Returns the primary selection of the editor. */ @@ -414,6 +435,12 @@ export interface IEditor { */ revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; + /** + * Scroll vertically as necessary and reveal lines close to the top of the viewport, + * optimized for viewing a code definition. + */ + revealLinesNearTop(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; + /** * Scroll vertically or horizontally as necessary and reveal a range. */ @@ -434,6 +461,18 @@ export interface IEditor { */ revealRangeInCenterIfOutsideViewport(range: IRange, scrollType?: ScrollType): void; + /** + * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, + * optimized for viewing a code definition. + */ + revealRangeNearTop(range: IRange, scrollType?: ScrollType): void; + + /** + * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, + * optimized for viewing a code definition. Only if it lies outside the viewport. + */ + revealRangeNearTopIfOutsideViewport(range: IRange, scrollType?: ScrollType): void; + /** * Directly trigger a handler or an editor action. * @param source The source of the call. @@ -639,9 +678,5 @@ export const Handler = { CompositionStart: 'compositionStart', CompositionEnd: 'compositionEnd', Paste: 'paste', - Cut: 'cut', - - Undo: 'undo', - Redo: 'redo', }; diff --git a/src/vs/editor/common/editorContextKeys.ts b/src/vs/editor/common/editorContextKeys.ts index 6d401cb5805d4..0166842056904 100644 --- a/src/vs/editor/common/editorContextKeys.ts +++ b/src/vs/editor/common/editorContextKeys.ts @@ -6,6 +6,8 @@ import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; export namespace EditorContextKeys { + + export const editorSimpleInput = new RawContextKey('editorSimpleInput', false); /** * A context key that is set when the editor's text has focus (cursor is blinking). */ @@ -21,6 +23,7 @@ export namespace EditorContextKeys { export const textInputFocus = new RawContextKey('textInputFocus', false); export const readOnly = new RawContextKey('editorReadonly', false); + export const columnSelection = new RawContextKey('editorColumnSelection', false); export const writable: ContextKeyExpr = readOnly.toNegated(); export const hasNonEmptySelection = new RawContextKey('editorHasSelection', false); export const hasOnlyEmptySelection: ContextKeyExpr = hasNonEmptySelection.toNegated(); diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index 25289e8e7f2ee..2bf83cca8278c 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -14,7 +14,7 @@ import { IModelContentChange, IModelContentChangedEvent, IModelDecorationsChange import { SearchData } from 'vs/editor/common/model/textModelSearch'; import { LanguageId, LanguageIdentifier, FormattingOptions } from 'vs/editor/common/modes'; import { ThemeColor } from 'vs/platform/theme/common/themeService'; -import { MultilineTokens } from 'vs/editor/common/model/tokensStore'; +import { MultilineTokens, MultilineTokens2 } from 'vs/editor/common/model/tokensStore'; /** * Vertical Lane in the overview ruler of the editor. @@ -290,6 +290,7 @@ export const enum EndOfLineSequence { /** * An identifier for a single edit operation. + * @internal */ export interface ISingleEditOperationIdentifier { /** @@ -334,7 +335,7 @@ export interface IIdentifiedSingleEditOperation { /** * The range to replace. This can be empty to emulate a simple insert. */ - range: Range; + range: IRange; /** * The text to replace with. This can be null to emulate a simple delete. */ @@ -357,6 +358,34 @@ export interface IIdentifiedSingleEditOperation { _isTracked?: boolean; } +export interface IValidEditOperation { + /** + * An identifier associated with this single edit operation. + * @internal + */ + identifier: ISingleEditOperationIdentifier | null; + /** + * The range to replace. This can be empty to emulate a simple insert. + */ + range: Range; + /** + * The text to replace with. This can be null to emulate a simple delete. + */ + text: string | null; + /** + * This indicates that this operation has "insert" semantics. + * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. + */ + forceMoveMarkers: boolean; +} + +/** + * @internal + */ +export interface IValidEditOperations { + operations: IValidEditOperation[]; +} + /** * A callback that can compute the cursor state after applying a series of edit operations. */ @@ -364,7 +393,7 @@ export interface ICursorStateComputer { /** * A callback that can compute the resulting cursors state after some edit operations have been executed. */ - (inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[] | null; + (inverseEditOperations: IValidEditOperation[]): Selection[] | null; } export class TextModelResolvedOptions { @@ -386,7 +415,7 @@ export class TextModelResolvedOptions { defaultEOL: DefaultEndOfLine; trimAutoWhitespace: boolean; }) { - this.tabSize = src.tabSize | 0; + this.tabSize = Math.max(1, src.tabSize | 0); this.indentSize = src.tabSize | 0; this.insertSpaces = Boolean(src.insertSpaces); this.defaultEOL = src.defaultEOL | 0; @@ -792,6 +821,11 @@ export interface ITextModel { */ setTokens(tokens: MultilineTokens[]): void; + /** + * @internal + */ + setSemanticTokens(tokens: MultilineTokens2[] | null): void; + /** * Flush all tokenization state. * @internal @@ -893,7 +927,7 @@ export interface ITextModel { * @param position The position at which to start the search. * @internal */ - findEnclosingBrackets(position: IPosition): [Range, Range] | null; + findEnclosingBrackets(position: IPosition, maxDuration?: number): [Range, Range] | null; /** * Given a `position`, if the position is on top or near a bracket, @@ -1043,7 +1077,7 @@ export interface ITextModel { * @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed. * @return The cursor state returned by the `cursorStateComputer`. */ - pushEditOperations(beforeCursorState: Selection[], editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null; + pushEditOperations(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null; /** * Change the end of line sequence. This is the preferred way of @@ -1057,7 +1091,7 @@ export interface ITextModel { * @param operations The edit operations. * @return The inverse edit operations, that, when applied, will bring the model back to the previous state. */ - applyEdits(operations: IIdentifiedSingleEditOperation[]): IIdentifiedSingleEditOperation[]; + applyEdits(operations: IIdentifiedSingleEditOperation[]): IValidEditOperation[]; /** * Change the end of line sequence without recording in the undo stack. @@ -1065,12 +1099,17 @@ export interface ITextModel { */ setEOL(eol: EndOfLineSequence): void; + /** + * @internal + */ + _applyUndoRedoEdits(edits: IValidEditOperations[], eol: EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): IValidEditOperations[]; + /** * Undo edit operations until the first previous stop point created by `pushStackElement`. * The inverse edit operations will be pushed on the redo stack. * @internal */ - undo(): Selection[] | null; + undo(): void; /** * Is there anything in the undo stack? @@ -1083,7 +1122,7 @@ export interface ITextModel { * The inverse edit operations will be pushed on the undo stack. * @internal */ - redo(): Selection[] | null; + redo(): void; /** * Is there anything in the redo stack? @@ -1200,6 +1239,20 @@ export const enum ModelConstants { FIRST_LINE_DETECTION_LENGTH_LIMIT = 1000 } +/** + * @internal + */ +export class ValidAnnotatedEditOperation implements IIdentifiedSingleEditOperation { + constructor( + public readonly identifier: ISingleEditOperationIdentifier | null, + public readonly range: Range, + public readonly text: string | null, + public readonly forceMoveMarkers: boolean, + public readonly isAutoWhitespaceEdit: boolean, + public readonly _isTracked: boolean, + ) { } +} + /** * @internal */ @@ -1228,7 +1281,7 @@ export interface ITextBuffer { getLineLastNonWhitespaceColumn(lineNumber: number): number; setEOL(newEOL: '\r\n' | '\n'): void; - applyEdits(rawOperations: IIdentifiedSingleEditOperation[], recordTrimAutoWhitespace: boolean): ApplyEditsResult; + applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean): ApplyEditsResult; findMatchesLineByLine(searchRange: Range, searchData: SearchData, captureMatches: boolean, limitResultCount: number): FindMatch[]; } @@ -1238,7 +1291,7 @@ export interface ITextBuffer { export class ApplyEditsResult { constructor( - public readonly reverseEdits: IIdentifiedSingleEditOperation[], + public readonly reverseEdits: IValidEditOperation[], public readonly changes: IInternalModelContentChange[], public readonly trimAutoWhitespaceLineNumbers: number[] | null ) { } diff --git a/src/vs/editor/common/model/editStack.ts b/src/vs/editor/common/model/editStack.ts index add6b310ea56c..c0aee2abe1000 100644 --- a/src/vs/editor/common/model/editStack.ts +++ b/src/vs/editor/common/model/editStack.ts @@ -3,178 +3,205 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as nls from 'vs/nls'; import { onUnexpectedError } from 'vs/base/common/errors'; import { Selection } from 'vs/editor/common/core/selection'; -import { EndOfLineSequence, ICursorStateComputer, IIdentifiedSingleEditOperation } from 'vs/editor/common/model'; +import { EndOfLineSequence, ICursorStateComputer, IIdentifiedSingleEditOperation, IValidEditOperation, ITextModel, IValidEditOperations } from 'vs/editor/common/model'; import { TextModel } from 'vs/editor/common/model/textModel'; +import { IUndoRedoService, IResourceUndoRedoElement, UndoRedoElementType, IWorkspaceUndoRedoElement } from 'vs/platform/undoRedo/common/undoRedo'; +import { URI } from 'vs/base/common/uri'; +import { getComparisonKey as uriGetComparisonKey } from 'vs/base/common/resources'; + +export class EditStackElement implements IResourceUndoRedoElement { + + public readonly type = UndoRedoElementType.Resource; + public readonly label: string; + private _isOpen: boolean; + public readonly model: ITextModel; + private readonly _beforeVersionId: number; + private readonly _beforeEOL: EndOfLineSequence; + private readonly _beforeCursorState: Selection[] | null; + private _afterVersionId: number; + private _afterEOL: EndOfLineSequence; + private _afterCursorState: Selection[] | null; + private _edits: IValidEditOperations[]; + + public get resource(): URI { + return this.model.uri; + } + + constructor(model: ITextModel, beforeCursorState: Selection[] | null) { + this.label = nls.localize('edit', "Typing"); + this._isOpen = true; + this.model = model; + this._beforeVersionId = this.model.getAlternativeVersionId(); + this._beforeEOL = getModelEOL(this.model); + this._beforeCursorState = beforeCursorState; + this._afterVersionId = this._beforeVersionId; + this._afterEOL = this._beforeEOL; + this._afterCursorState = this._beforeCursorState; + this._edits = []; + } -interface IEditOperation { - operations: IIdentifiedSingleEditOperation[]; -} + public canAppend(model: ITextModel): boolean { + return (this._isOpen && this.model === model); + } -interface IStackElement { - readonly beforeVersionId: number; - readonly beforeCursorState: Selection[] | null; - readonly afterCursorState: Selection[] | null; - readonly afterVersionId: number; + public append(model: ITextModel, operations: IValidEditOperation[], afterEOL: EndOfLineSequence, afterVersionId: number, afterCursorState: Selection[] | null): void { + if (operations.length > 0) { + this._edits.push({ operations: operations }); + } + this._afterEOL = afterEOL; + this._afterVersionId = afterVersionId; + this._afterCursorState = afterCursorState; + } + + public close(): void { + this._isOpen = false; + } - undo(model: TextModel): void; - redo(model: TextModel): void; + public undo(): void { + this._isOpen = false; + this._edits.reverse(); + this._edits = this.model._applyUndoRedoEdits(this._edits, this._beforeEOL, true, false, this._beforeVersionId, this._beforeCursorState); + } + + public redo(): void { + this._edits.reverse(); + this._edits = this.model._applyUndoRedoEdits(this._edits, this._afterEOL, false, true, this._afterVersionId, this._afterCursorState); + } } -class EditStackElement implements IStackElement { - public readonly beforeVersionId: number; - public readonly beforeCursorState: Selection[]; - public afterCursorState: Selection[] | null; - public afterVersionId: number; +export class MultiModelEditStackElement implements IWorkspaceUndoRedoElement { - public editOperations: IEditOperation[]; + public readonly type = UndoRedoElementType.Workspace; + public readonly label: string; + private _isOpen: boolean; - constructor(beforeVersionId: number, beforeCursorState: Selection[]) { - this.beforeVersionId = beforeVersionId; - this.beforeCursorState = beforeCursorState; - this.afterCursorState = null; - this.afterVersionId = -1; - this.editOperations = []; + private readonly _editStackElementsArr: EditStackElement[]; + private readonly _editStackElementsMap: Map; + + public get resources(): readonly URI[] { + return this._editStackElementsArr.map(editStackElement => editStackElement.model.uri); } - public undo(model: TextModel): void { - // Apply all operations in reverse order - for (let i = this.editOperations.length - 1; i >= 0; i--) { - this.editOperations[i] = { - operations: model.applyEdits(this.editOperations[i].operations) - }; + constructor( + label: string, + editStackElements: EditStackElement[] + ) { + this.label = label; + this._isOpen = true; + this._editStackElementsArr = editStackElements.slice(0); + this._editStackElementsMap = new Map(); + for (const editStackElement of this._editStackElementsArr) { + const key = uriGetComparisonKey(editStackElement.model.uri); + this._editStackElementsMap.set(key, editStackElement); } } - public redo(model: TextModel): void { - // Apply all operations - for (let i = 0; i < this.editOperations.length; i++) { - this.editOperations[i] = { - operations: model.applyEdits(this.editOperations[i].operations) - }; + public canAppend(model: ITextModel): boolean { + if (!this._isOpen) { + return false; + } + const key = uriGetComparisonKey(model.uri); + if (this._editStackElementsMap.has(key)) { + const editStackElement = this._editStackElementsMap.get(key)!; + return editStackElement.canAppend(model); } + return false; } -} -function getModelEOL(model: TextModel): EndOfLineSequence { - const eol = model.getEOL(); - if (eol === '\n') { - return EndOfLineSequence.LF; - } else { - return EndOfLineSequence.CRLF; + public append(model: ITextModel, operations: IValidEditOperation[], afterEOL: EndOfLineSequence, afterVersionId: number, afterCursorState: Selection[] | null): void { + const key = uriGetComparisonKey(model.uri); + const editStackElement = this._editStackElementsMap.get(key)!; + editStackElement.append(model, operations, afterEOL, afterVersionId, afterCursorState); } -} -class EOLStackElement implements IStackElement { - public readonly beforeVersionId: number; - public readonly beforeCursorState: Selection[] | null; - public readonly afterCursorState: Selection[] | null; - public afterVersionId: number; + public close(): void { + this._isOpen = false; + } - public eol: EndOfLineSequence; + public undo(): void { + this._isOpen = false; - constructor(beforeVersionId: number, setEOL: EndOfLineSequence) { - this.beforeVersionId = beforeVersionId; - this.beforeCursorState = null; - this.afterCursorState = null; - this.afterVersionId = -1; - this.eol = setEOL; + for (const editStackElement of this._editStackElementsArr) { + editStackElement.undo(); + } } - public undo(model: TextModel): void { - let redoEOL = getModelEOL(model); - model.setEOL(this.eol); - this.eol = redoEOL; + public redo(): void { + for (const editStackElement of this._editStackElementsArr) { + editStackElement.redo(); + } } - public redo(model: TextModel): void { - let undoEOL = getModelEOL(model); - model.setEOL(this.eol); - this.eol = undoEOL; + public split(): IResourceUndoRedoElement[] { + return this._editStackElementsArr; } } -export interface IUndoRedoResult { - selections: Selection[] | null; - recordedVersionId: number; +function getModelEOL(model: ITextModel): EndOfLineSequence { + const eol = model.getEOL(); + if (eol === '\n') { + return EndOfLineSequence.LF; + } else { + return EndOfLineSequence.CRLF; + } +} + +function isKnownStackElement(element: IResourceUndoRedoElement | IWorkspaceUndoRedoElement | null): element is EditStackElement | MultiModelEditStackElement { + if (!element) { + return false; + } + return ((element instanceof EditStackElement) || (element instanceof MultiModelEditStackElement)); } export class EditStack { - private readonly model: TextModel; - private currentOpenStackElement: IStackElement | null; - private past: IStackElement[]; - private future: IStackElement[]; + private readonly _model: TextModel; + private readonly _undoRedoService: IUndoRedoService; - constructor(model: TextModel) { - this.model = model; - this.currentOpenStackElement = null; - this.past = []; - this.future = []; + constructor(model: TextModel, undoRedoService: IUndoRedoService) { + this._model = model; + this._undoRedoService = undoRedoService; } public pushStackElement(): void { - if (this.currentOpenStackElement !== null) { - this.past.push(this.currentOpenStackElement); - this.currentOpenStackElement = null; + const lastElement = this._undoRedoService.getLastElement(this._model.uri); + if (isKnownStackElement(lastElement)) { + lastElement.close(); } } public clear(): void { - this.currentOpenStackElement = null; - this.past = []; - this.future = []; + this._undoRedoService.removeElements(this._model.uri); } - public pushEOL(eol: EndOfLineSequence): void { - // No support for parallel universes :( - this.future = []; - - if (this.currentOpenStackElement) { - this.pushStackElement(); + private _getOrCreateEditStackElement(beforeCursorState: Selection[] | null): EditStackElement | MultiModelEditStackElement { + const lastElement = this._undoRedoService.getLastElement(this._model.uri); + if (isKnownStackElement(lastElement) && lastElement.canAppend(this._model)) { + return lastElement; } - - const prevEOL = getModelEOL(this.model); - let stackElement = new EOLStackElement(this.model.getAlternativeVersionId(), prevEOL); - - this.model.setEOL(eol); - - stackElement.afterVersionId = this.model.getVersionId(); - this.currentOpenStackElement = stackElement; - this.pushStackElement(); + const newElement = new EditStackElement(this._model, beforeCursorState); + this._undoRedoService.pushElement(newElement); + return newElement; } - public pushEditOperation(beforeCursorState: Selection[], editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer | null): Selection[] | null { - // No support for parallel universes :( - this.future = []; - - let stackElement: EditStackElement | null = null; - - if (this.currentOpenStackElement) { - if (this.currentOpenStackElement instanceof EditStackElement) { - stackElement = this.currentOpenStackElement; - } else { - this.pushStackElement(); - } - } - - if (!this.currentOpenStackElement) { - stackElement = new EditStackElement(this.model.getAlternativeVersionId(), beforeCursorState); - this.currentOpenStackElement = stackElement; - } - - const inverseEditOperation: IEditOperation = { - operations: this.model.applyEdits(editOperations) - }; + public pushEOL(eol: EndOfLineSequence): void { + const editStackElement = this._getOrCreateEditStackElement(null); + this._model.setEOL(eol); + editStackElement.append(this._model, [], getModelEOL(this._model), this._model.getAlternativeVersionId(), null); + } - stackElement!.editOperations.push(inverseEditOperation); - stackElement!.afterCursorState = EditStack._computeCursorState(cursorStateComputer, inverseEditOperation.operations); - stackElement!.afterVersionId = this.model.getVersionId(); - return stackElement!.afterCursorState; + public pushEditOperation(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer | null): Selection[] | null { + const editStackElement = this._getOrCreateEditStackElement(beforeCursorState); + const inverseEditOperations = this._model.applyEdits(editOperations); + const afterCursorState = EditStack._computeCursorState(cursorStateComputer, inverseEditOperations); + editStackElement.append(this._model, inverseEditOperations, getModelEOL(this._model), this._model.getAlternativeVersionId(), afterCursorState); + return afterCursorState; } - private static _computeCursorState(cursorStateComputer: ICursorStateComputer | null, inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[] | null { + private static _computeCursorState(cursorStateComputer: ICursorStateComputer | null, inverseEditOperations: IValidEditOperation[]): Selection[] | null { try { return cursorStateComputer ? cursorStateComputer(inverseEditOperations) : null; } catch (e) { @@ -182,62 +209,4 @@ export class EditStack { return null; } } - - public undo(): IUndoRedoResult | null { - - this.pushStackElement(); - - if (this.past.length > 0) { - const pastStackElement = this.past.pop()!; - - try { - pastStackElement.undo(this.model); - } catch (e) { - onUnexpectedError(e); - this.clear(); - return null; - } - - this.future.push(pastStackElement); - - return { - selections: pastStackElement.beforeCursorState, - recordedVersionId: pastStackElement.beforeVersionId - }; - } - - return null; - } - - public canUndo(): boolean { - return (this.past.length > 0) || this.currentOpenStackElement !== null; - } - - public redo(): IUndoRedoResult | null { - - if (this.future.length > 0) { - const futureStackElement = this.future.pop()!; - - try { - futureStackElement.redo(this.model); - } catch (e) { - onUnexpectedError(e); - this.clear(); - return null; - } - - this.past.push(futureStackElement); - - return { - selections: futureStackElement.afterCursorState, - recordedVersionId: futureStackElement.afterVersionId - }; - } - - return null; - } - - public canRedo(): boolean { - return (this.future.length > 0); - } } diff --git a/src/vs/editor/common/model/indentationGuesser.ts b/src/vs/editor/common/model/indentationGuesser.ts index b1790f97bdbdc..396f4cbb9559f 100644 --- a/src/vs/editor/common/model/indentationGuesser.ts +++ b/src/vs/editor/common/model/indentationGuesser.ts @@ -72,11 +72,12 @@ function spacesDiff(a: string, aLength: number, b: string, bLength: number, resu if (spacesDiff > 0 && 0 <= bSpacesCnt - 1 && bSpacesCnt - 1 < a.length && bSpacesCnt < b.length) { if (b.charCodeAt(bSpacesCnt) !== CharCode.Space && a.charCodeAt(bSpacesCnt - 1) === CharCode.Space) { - // This looks like an alignment desire: e.g. - // const a = b + c, - // d = b - c; - - result.looksLikeAlignment = true; + if (a.charCodeAt(a.length - 1) === CharCode.Comma) { + // This looks like an alignment desire: e.g. + // const a = b + c, + // d = b - c; + result.looksLikeAlignment = true; + } } } return; diff --git a/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts b/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts index 1c844dd66c4bb..05d11060137ab 100644 --- a/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts +++ b/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts @@ -511,7 +511,93 @@ export class PieceTreeBase { } public getLinesContent(): string[] { - return this.getContentOfSubTree(this.root).split(/\r\n|\r|\n/); + let lines: string[] = []; + let linesLength = 0; + let currentLine = ''; + let danglingCR = false; + + this.iterate(this.root, node => { + if (node === SENTINEL) { + return true; + } + + const piece = node.piece; + let pieceLength = piece.length; + if (pieceLength === 0) { + return true; + } + + const buffer = this._buffers[piece.bufferIndex].buffer; + const lineStarts = this._buffers[piece.bufferIndex].lineStarts; + + const pieceStartLine = piece.start.line; + const pieceEndLine = piece.end.line; + let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column; + + if (danglingCR) { + if (buffer.charCodeAt(pieceStartOffset) === CharCode.LineFeed) { + // pretend the \n was in the previous piece.. + pieceStartOffset++; + pieceLength--; + } + lines[linesLength++] = currentLine; + currentLine = ''; + danglingCR = false; + if (pieceLength === 0) { + return true; + } + } + + if (pieceStartLine === pieceEndLine) { + // this piece has no new lines + if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === CharCode.CarriageReturn) { + danglingCR = true; + currentLine += buffer.substr(pieceStartOffset, pieceLength - 1); + } else { + currentLine += buffer.substr(pieceStartOffset, pieceLength); + } + return true; + } + + // add the text before the first line start in this piece + currentLine += ( + this._EOLNormalized + ? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength)) + : buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\r\n|\r|\n)$/, '') + ); + lines[linesLength++] = currentLine; + + for (let line = pieceStartLine + 1; line < pieceEndLine; line++) { + currentLine = ( + this._EOLNormalized + ? buffer.substring(lineStarts[line], lineStarts[line + 1] - this._EOLLength) + : buffer.substring(lineStarts[line], lineStarts[line + 1]).replace(/(\r\n|\r|\n)$/, '') + ); + lines[linesLength++] = currentLine; + } + + if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === CharCode.CarriageReturn) { + danglingCR = true; + if (piece.end.column === 0) { + // The last line ended with a \r, let's undo the push, it will be pushed by next iteration + linesLength--; + } else { + currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column - 1); + } + } else { + currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column); + } + + return true; + }); + + if (danglingCR) { + lines[linesLength++] = currentLine; + currentLine = ''; + } + + lines[linesLength++] = currentLine; + return lines; } public getLength(): number { @@ -584,7 +670,7 @@ export class PieceTreeBase { if (searcher._wordSeparators) { searchText = buffer.buffer.substring(start, end); offsetInBuffer = (offset: number) => offset + start; - searcher.reset(-1); + searcher.reset(0); } else { searchText = buffer.buffer; offsetInBuffer = (offset: number) => offset; @@ -728,7 +814,7 @@ export class PieceTreeBase { // #endregion // #region Piece Table - insert(offset: number, value: string, eolNormalized: boolean = false): void { + public insert(offset: number, value: string, eolNormalized: boolean = false): void { this._EOLNormalized = this._EOLNormalized && eolNormalized; this._lastVisitedLine.lineNumber = 0; this._lastVisitedLine.value = ''; @@ -826,7 +912,7 @@ export class PieceTreeBase { this.computeBufferMetadata(); } - delete(offset: number, cnt: number): void { + public delete(offset: number, cnt: number): void { this._lastVisitedLine.lineNumber = 0; this._lastVisitedLine.value = ''; @@ -899,7 +985,7 @@ export class PieceTreeBase { this.computeBufferMetadata(); } - insertContentToNodeLeft(value: string, node: TreeNode) { + private insertContentToNodeLeft(value: string, node: TreeNode) { // we are inserting content to the beginning of node let nodesToDel: TreeNode[] = []; if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) { @@ -934,7 +1020,7 @@ export class PieceTreeBase { this.deleteNodes(nodesToDel); } - insertContentToNodeRight(value: string, node: TreeNode) { + private insertContentToNodeRight(value: string, node: TreeNode) { // we are inserting to the right of this node. if (this.adjustCarriageReturnFromNext(value, node)) { // move \n to the new node. @@ -952,9 +1038,9 @@ export class PieceTreeBase { this.validateCRLFWithPrevNode(newNode); } - positionInBuffer(node: TreeNode, remainder: number): BufferCursor; - positionInBuffer(node: TreeNode, remainder: number, ret: BufferCursor): null; - positionInBuffer(node: TreeNode, remainder: number, ret?: BufferCursor): BufferCursor | null { + private positionInBuffer(node: TreeNode, remainder: number): BufferCursor; + private positionInBuffer(node: TreeNode, remainder: number, ret: BufferCursor): null; + private positionInBuffer(node: TreeNode, remainder: number, ret?: BufferCursor): BufferCursor | null { let piece = node.piece; let bufferIndex = node.piece.bufferIndex; let lineStarts = this._buffers[bufferIndex].lineStarts; @@ -1002,7 +1088,7 @@ export class PieceTreeBase { }; } - getLineFeedCnt(bufferIndex: number, start: BufferCursor, end: BufferCursor): number { + private getLineFeedCnt(bufferIndex: number, start: BufferCursor, end: BufferCursor): number { // we don't need to worry about start: abc\r|\n, or abc|\r, or abc|\n, or abc|\r\n doesn't change the fact that, there is one line break after start. // now let's take care of end: abc\r|\n, if end is in between \r and \n, we need to add line feed count by 1 if (end.column === 0) { @@ -1032,18 +1118,18 @@ export class PieceTreeBase { } } - offsetInBuffer(bufferIndex: number, cursor: BufferCursor): number { + private offsetInBuffer(bufferIndex: number, cursor: BufferCursor): number { let lineStarts = this._buffers[bufferIndex].lineStarts; return lineStarts[cursor.line] + cursor.column; } - deleteNodes(nodes: TreeNode[]): void { + private deleteNodes(nodes: TreeNode[]): void { for (let i = 0; i < nodes.length; i++) { rbDelete(this, nodes[i]); } } - createNewPieces(text: string): Piece[] { + private createNewPieces(text: string): Piece[] { if (text.length > AverageBufferSize) { // the content is large, operations like substring, charCode becomes slow // so here we split it into smaller chunks, just like what we did for CR/LF normalization @@ -1128,11 +1214,11 @@ export class PieceTreeBase { return [newPiece]; } - getLinesRawContent(): string { + public getLinesRawContent(): string { return this.getContentOfSubTree(this.root); } - getLineRawContent(lineNumber: number, endOffset: number = 0): string { + public getLineRawContent(lineNumber: number, endOffset: number = 0): string { let x = this.root; let ret = ''; @@ -1204,7 +1290,7 @@ export class PieceTreeBase { return ret; } - computeBufferMetadata() { + private computeBufferMetadata() { let x = this.root; let lfCnt = 1; @@ -1222,7 +1308,7 @@ export class PieceTreeBase { } // #region node operations - getIndexOf(node: TreeNode, accumulatedValue: number): { index: number, remainder: number } { + private getIndexOf(node: TreeNode, accumulatedValue: number): { index: number, remainder: number } { let piece = node.piece; let pos = this.positionInBuffer(node, accumulatedValue); let lineCnt = pos.line - piece.start.line; @@ -1239,7 +1325,7 @@ export class PieceTreeBase { return { index: lineCnt, remainder: pos.column }; } - getAccumulatedValue(node: TreeNode, index: number) { + private getAccumulatedValue(node: TreeNode, index: number) { if (index < 0) { return 0; } @@ -1253,7 +1339,7 @@ export class PieceTreeBase { } } - deleteNodeTail(node: TreeNode, pos: BufferCursor) { + private deleteNodeTail(node: TreeNode, pos: BufferCursor) { const piece = node.piece; const originalLFCnt = piece.lineFeedCnt; const originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end); @@ -1277,7 +1363,7 @@ export class PieceTreeBase { updateTreeMetadata(this, node, size_delta, lf_delta); } - deleteNodeHead(node: TreeNode, pos: BufferCursor) { + private deleteNodeHead(node: TreeNode, pos: BufferCursor) { const piece = node.piece; const originalLFCnt = piece.lineFeedCnt; const originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start); @@ -1299,7 +1385,7 @@ export class PieceTreeBase { updateTreeMetadata(this, node, size_delta, lf_delta); } - shrinkNode(node: TreeNode, start: BufferCursor, end: BufferCursor) { + private shrinkNode(node: TreeNode, start: BufferCursor, end: BufferCursor) { const piece = node.piece; const originalStartPos = piece.start; const originalEndPos = piece.end; @@ -1334,7 +1420,7 @@ export class PieceTreeBase { this.validateCRLFWithPrevNode(newNode); } - appendToNode(node: TreeNode, value: string): void { + private appendToNode(node: TreeNode, value: string): void { if (this.adjustCarriageReturnFromNext(value, node)) { value += '\n'; } @@ -1374,7 +1460,7 @@ export class PieceTreeBase { updateTreeMetadata(this, node, value.length, lf_delta); } - nodeAt(offset: number): NodePosition { + private nodeAt(offset: number): NodePosition { let x = this.root; let cache = this._searchCache.get(offset); if (cache) { @@ -1409,7 +1495,7 @@ export class PieceTreeBase { return null!; } - nodeAt2(lineNumber: number, column: number): NodePosition { + private nodeAt2(lineNumber: number, column: number): NodePosition { let x = this.root; let nodeStartOffset = 0; @@ -1476,7 +1562,7 @@ export class PieceTreeBase { return null!; } - nodeCharCodeAt(node: TreeNode, offset: number): number { + private nodeCharCodeAt(node: TreeNode, offset: number): number { if (node.piece.lineFeedCnt < 1) { return -1; } @@ -1485,7 +1571,7 @@ export class PieceTreeBase { return buffer.buffer.charCodeAt(newOffset); } - offsetOfNode(node: TreeNode): number { + private offsetOfNode(node: TreeNode): number { if (!node) { return 0; } @@ -1504,11 +1590,11 @@ export class PieceTreeBase { // #endregion // #region CRLF - shouldCheckCRLF() { + private shouldCheckCRLF() { return !(this._EOLNormalized && this._EOL === '\n'); } - startWithLF(val: string | TreeNode): boolean { + private startWithLF(val: string | TreeNode): boolean { if (typeof val === 'string') { return val.charCodeAt(0) === 10; } @@ -1532,7 +1618,7 @@ export class PieceTreeBase { return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10; } - endWithCR(val: string | TreeNode): boolean { + private endWithCR(val: string | TreeNode): boolean { if (typeof val === 'string') { return val.charCodeAt(val.length - 1) === 13; } @@ -1544,7 +1630,7 @@ export class PieceTreeBase { return this.nodeCharCodeAt(val, val.piece.length - 1) === 13; } - validateCRLFWithPrevNode(nextNode: TreeNode) { + private validateCRLFWithPrevNode(nextNode: TreeNode) { if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) { let node = nextNode.prev(); if (this.endWithCR(node)) { @@ -1553,7 +1639,7 @@ export class PieceTreeBase { } } - validateCRLFWithNextNode(node: TreeNode) { + private validateCRLFWithNextNode(node: TreeNode) { if (this.shouldCheckCRLF() && this.endWithCR(node)) { let nextNode = node.next(); if (this.startWithLF(nextNode)) { @@ -1562,7 +1648,7 @@ export class PieceTreeBase { } } - fixCRLF(prev: TreeNode, next: TreeNode) { + private fixCRLF(prev: TreeNode, next: TreeNode) { let nodesToDel: TreeNode[] = []; // update node let lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts; @@ -1617,7 +1703,7 @@ export class PieceTreeBase { } } - adjustCarriageReturnFromNext(value: string, node: TreeNode): boolean { + private adjustCarriageReturnFromNext(value: string, node: TreeNode): boolean { if (this.shouldCheckCRLF() && this.endWithCR(value)) { let nextNode = node.next(); if (this.startWithLF(nextNode)) { @@ -1667,7 +1753,7 @@ export class PieceTreeBase { return callback(node) && this.iterate(node.right, callback); } - getNodeContent(node: TreeNode) { + private getNodeContent(node: TreeNode) { if (node === SENTINEL) { return ''; } @@ -1695,7 +1781,7 @@ export class PieceTreeBase { * / * z */ - rbInsertRight(node: TreeNode | null, p: Piece): TreeNode { + private rbInsertRight(node: TreeNode | null, p: Piece): TreeNode { let z = new TreeNode(p, NodeColor.Red); z.left = SENTINEL; z.right = SENTINEL; @@ -1727,7 +1813,7 @@ export class PieceTreeBase { * \ * z */ - rbInsertLeft(node: TreeNode | null, p: Piece): TreeNode { + private rbInsertLeft(node: TreeNode | null, p: Piece): TreeNode { let z = new TreeNode(p, NodeColor.Red); z.left = SENTINEL; z.right = SENTINEL; @@ -1751,7 +1837,7 @@ export class PieceTreeBase { return z; } - getContentOfSubTree(node: TreeNode): string { + private getContentOfSubTree(node: TreeNode): string { let str = ''; this.iterate(node, node => { diff --git a/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts b/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts index a987231c3abee..0d9c539ff8a6a 100644 --- a/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts +++ b/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts @@ -6,7 +6,7 @@ import * as strings from 'vs/base/common/strings'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; -import { ApplyEditsResult, EndOfLinePreference, FindMatch, IIdentifiedSingleEditOperation, IInternalModelContentChange, ISingleEditOperationIdentifier, ITextBuffer, ITextSnapshot } from 'vs/editor/common/model'; +import { ApplyEditsResult, EndOfLinePreference, FindMatch, IInternalModelContentChange, ISingleEditOperationIdentifier, ITextBuffer, ITextSnapshot, ValidAnnotatedEditOperation, IValidEditOperation } from 'vs/editor/common/model'; import { PieceTreeBase, StringBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase'; import { SearchData } from 'vs/editor/common/model/textModelSearch'; @@ -21,7 +21,7 @@ export interface IValidatedEditOperation { isAutoWhitespaceEdit: boolean; } -export interface IReverseSingleEditOperation extends IIdentifiedSingleEditOperation { +export interface IReverseSingleEditOperation extends IValidEditOperation { sortIndex: number; } @@ -201,7 +201,7 @@ export class PieceTreeTextBuffer implements ITextBuffer { this._pieceTree.setEOL(newEOL); } - public applyEdits(rawOperations: IIdentifiedSingleEditOperation[], recordTrimAutoWhitespace: boolean): ApplyEditsResult { + public applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean): ApplyEditsResult { let mightContainRTL = this._mightContainRTL; let mightContainNonBasicASCII = this._mightContainNonBasicASCII; let canReduceOperations = true; diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index ff39a2066f64f..89050a1e6dedc 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -29,11 +29,14 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode'; import { ignoreBracketsInToken } from 'vs/editor/common/modes/supports'; import { BracketsUtils, RichEditBracket, RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets'; -import { ITheme, ThemeColor } from 'vs/platform/theme/common/themeService'; +import { ThemeColor } from 'vs/platform/theme/common/themeService'; import { withUndefinedAsNull } from 'vs/base/common/types'; import { VSBufferReadableStream, VSBuffer } from 'vs/base/common/buffer'; -import { TokensStore, MultilineTokens, countEOL } from 'vs/editor/common/model/tokensStore'; +import { TokensStore, MultilineTokens, countEOL, MultilineTokens2, TokensStore2 } from 'vs/editor/common/model/tokensStore'; import { Color } from 'vs/base/common/color'; +import { Constants } from 'vs/base/common/uint'; +import { EditorTheme } from 'vs/editor/common/view/viewContext'; +import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; function createTextBufferBuilder() { return new PieceTreeTextBufferBuilder(); @@ -157,6 +160,17 @@ class TextModelSnapshot implements model.ITextSnapshot { const invalidFunc = () => { throw new Error(`Invalid change accessor`); }; +const enum StringOffsetValidationType { + /** + * Even allowed in surrogate pairs + */ + Relaxed = 0, + /** + * Not allowed in surrogate pairs + */ + SurrogatePairs = 1, +} + export class TextModel extends Disposable implements model.ITextModel { private static readonly MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB @@ -174,10 +188,6 @@ export class TextModel extends Disposable implements model.ITextModel { largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations, }; - public static createFromString(text: string, options: model.ITextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS, languageIdentifier: LanguageIdentifier | null = null, uri: URI | null = null): TextModel { - return new TextModel(text, options, languageIdentifier, uri); - } - public static resolveOptions(textBuffer: model.ITextBuffer, options: model.ITextModelCreationOptions): model.TextModelResolvedOptions { if (options.detectIndentation) { const guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces); @@ -240,6 +250,7 @@ export class TextModel extends Disposable implements model.ITextModel { public readonly id: string; public readonly isForSimpleWidget: boolean; private readonly _associatedResource: URI; + private readonly _undoRedoService: IUndoRedoService; private _attachedEditorCount: number; private _buffer: model.ITextBuffer; private _options: model.TextModelResolvedOptions; @@ -255,7 +266,7 @@ export class TextModel extends Disposable implements model.ITextModel { private readonly _isTooLargeForTokenization: boolean; //#region Editing - private _commandManager: EditStack; + private readonly _commandManager: EditStack; private _isUndoing: boolean; private _isRedoing: boolean; private _trimAutoWhitespaceLines: number[] | null; @@ -276,10 +287,17 @@ export class TextModel extends Disposable implements model.ITextModel { private _languageIdentifier: LanguageIdentifier; private readonly _languageRegistryListener: IDisposable; private readonly _tokens: TokensStore; + private readonly _tokens2: TokensStore2; private readonly _tokenization: TextModelTokenization; //#endregion - constructor(source: string | model.ITextBufferFactory, creationOptions: model.ITextModelCreationOptions, languageIdentifier: LanguageIdentifier | null, associatedResource: URI | null = null) { + constructor( + source: string | model.ITextBufferFactory, + creationOptions: model.ITextModelCreationOptions, + languageIdentifier: LanguageIdentifier | null, + associatedResource: URI | null = null, + undoRedoService: IUndoRedoService + ) { super(); // Generate a new unique model id @@ -291,6 +309,7 @@ export class TextModel extends Disposable implements model.ITextModel { } else { this._associatedResource = associatedResource; } + this._undoRedoService = undoRedoService; this._attachedEditorCount = 0; this._buffer = createTextBuffer(source, creationOptions.defaultEOL); @@ -333,12 +352,13 @@ export class TextModel extends Disposable implements model.ITextModel { this._decorations = Object.create(null); this._decorationsTree = new DecorationsTrees(); - this._commandManager = new EditStack(this); + this._commandManager = new EditStack(this, undoRedoService); this._isUndoing = false; this._isRedoing = false; this._trimAutoWhitespaceLines = null; this._tokens = new TokensStore(); + this._tokens2 = new TokensStore2(); this._tokenization = new TextModelTokenization(this); } @@ -347,6 +367,7 @@ export class TextModel extends Disposable implements model.ITextModel { this._onWillDispose.fire(); this._languageRegistryListener.dispose(); this._tokenization.dispose(); + this._undoRedoService.removeElements(this.uri); this._isDisposed = true; super.dispose(); this._isDisposing = false; @@ -414,13 +435,14 @@ export class TextModel extends Disposable implements model.ITextModel { // Flush all tokens this._tokens.flush(); + this._tokens2.flush(); // Destroy all my decorations this._decorations = Object.create(null); this._decorationsTree = new DecorationsTrees(); // Destroy my edit history and settings - this._commandManager = new EditStack(this); + this._commandManager.clear(); this._trimAutoWhitespaceLines = null; this._emitContentChangedEvent( @@ -669,7 +691,7 @@ export class TextModel extends Disposable implements model.ITextModel { public getOffsetAt(rawPosition: IPosition): number { this._assertNotDisposed(); - let position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, false); + let position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, StringOffsetValidationType.Relaxed); return this._buffer.getOffsetAt(position.lineNumber, position.column); } @@ -864,10 +886,7 @@ export class TextModel extends Disposable implements model.ITextModel { return new Range(startLineNumber, startColumn, endLineNumber, endColumn); } - /** - * @param strict Do NOT allow a position inside a high-low surrogate pair - */ - private _isValidPosition(lineNumber: number, column: number, strict: boolean): boolean { + private _isValidPosition(lineNumber: number, column: number, validationType: StringOffsetValidationType): boolean { if (typeof lineNumber !== 'number' || typeof column !== 'number') { return false; } @@ -889,14 +908,19 @@ export class TextModel extends Disposable implements model.ITextModel { return false; } + if (column === 1) { + return true; + } + const maxColumn = this.getLineMaxColumn(lineNumber); if (column > maxColumn) { return false; } - if (strict) { - const [charStartOffset,] = strings.getCharContainingOffset(this._buffer.getLineContent(lineNumber), column - 1); - if (column !== charStartOffset + 1) { + if (validationType === StringOffsetValidationType.SurrogatePairs) { + // !!At this point, column > 1 + const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2); + if (strings.isHighSurrogate(charCodeBefore)) { return false; } } @@ -904,10 +928,7 @@ export class TextModel extends Disposable implements model.ITextModel { return true; } - /** - * @param strict Do NOT allow a position inside a high-low surrogate pair - */ - private _validatePosition(_lineNumber: number, _column: number, strict: boolean): Position { + private _validatePosition(_lineNumber: number, _column: number, validationType: StringOffsetValidationType): Position { const lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1); const column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1); const lineCount = this._buffer.getLineCount(); @@ -929,10 +950,13 @@ export class TextModel extends Disposable implements model.ITextModel { return new Position(lineNumber, maxColumn); } - if (strict) { - const [charStartOffset,] = strings.getCharContainingOffset(this._buffer.getLineContent(lineNumber), column - 1); - if (column !== charStartOffset + 1) { - return new Position(lineNumber, charStartOffset + 1); + if (validationType === StringOffsetValidationType.SurrogatePairs) { + // If the position would end up in the middle of a high-low surrogate pair, + // we move it to before the pair + // !!At this point, column > 1 + const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2); + if (strings.isHighSurrogate(charCodeBefore)) { + return new Position(lineNumber, column - 1); } } @@ -940,94 +964,95 @@ export class TextModel extends Disposable implements model.ITextModel { } public validatePosition(position: IPosition): Position { + const validationType = StringOffsetValidationType.SurrogatePairs; this._assertNotDisposed(); // Avoid object allocation and cover most likely case if (position instanceof Position) { - if (this._isValidPosition(position.lineNumber, position.column, true)) { + if (this._isValidPosition(position.lineNumber, position.column, validationType)) { return position; } } - return this._validatePosition(position.lineNumber, position.column, true); + return this._validatePosition(position.lineNumber, position.column, validationType); } - /** - * @param strict Do NOT allow a range to have its boundaries inside a high-low surrogate pair - */ - private _isValidRange(range: Range, strict: boolean): boolean { + private _isValidRange(range: Range, validationType: StringOffsetValidationType): boolean { const startLineNumber = range.startLineNumber; const startColumn = range.startColumn; const endLineNumber = range.endLineNumber; const endColumn = range.endColumn; - if (!this._isValidPosition(startLineNumber, startColumn, false)) { + if (!this._isValidPosition(startLineNumber, startColumn, StringOffsetValidationType.Relaxed)) { return false; } - if (!this._isValidPosition(endLineNumber, endColumn, false)) { + if (!this._isValidPosition(endLineNumber, endColumn, StringOffsetValidationType.Relaxed)) { return false; } - if (strict) { - const startLineContent = this._buffer.getLineContent(startLineNumber); - if (startColumn < startLineContent.length + 1) { - const [charStartOffset,] = strings.getCharContainingOffset(startLineContent, startColumn - 1); - if (startColumn !== charStartOffset + 1) { - return false; - } - } + if (validationType === StringOffsetValidationType.SurrogatePairs) { + const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0); + const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0); - if (endColumn >= 2) { - const endLineContent = (endLineNumber === startLineNumber ? startLineContent : this._buffer.getLineContent(endLineNumber)); - const [, charEndOffset] = strings.getCharContainingOffset(endLineContent, endColumn - 2); - if (endColumn !== charEndOffset + 1) { - return false; - } - } + const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart); + const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd); - return true; + if (!startInsideSurrogatePair && !endInsideSurrogatePair) { + return true; + } + return false; } return true; } public validateRange(_range: IRange): Range { + const validationType = StringOffsetValidationType.SurrogatePairs; this._assertNotDisposed(); // Avoid object allocation and cover most likely case if ((_range instanceof Range) && !(_range instanceof Selection)) { - if (this._isValidRange(_range, true)) { + if (this._isValidRange(_range, validationType)) { return _range; } } - const start = this._validatePosition(_range.startLineNumber, _range.startColumn, false); - const end = this._validatePosition(_range.endLineNumber, _range.endColumn, false); + const start = this._validatePosition(_range.startLineNumber, _range.startColumn, StringOffsetValidationType.Relaxed); + const end = this._validatePosition(_range.endLineNumber, _range.endColumn, StringOffsetValidationType.Relaxed); const startLineNumber = start.lineNumber; - let startColumn = start.column; + const startColumn = start.column; const endLineNumber = end.lineNumber; - let endColumn = end.column; - const isEmpty = (startLineNumber === endLineNumber && startColumn === endColumn); - - const startLineContent = this._buffer.getLineContent(startLineNumber); - if (startColumn < startLineContent.length + 1) { - const [charStartOffset,] = strings.getCharContainingOffset(startLineContent, startColumn - 1); - if (startColumn !== charStartOffset + 1) { - if (isEmpty) { - // do not expand a collapsed range, simply move it to a valid location - return new Range(startLineNumber, charStartOffset + 1, startLineNumber, charStartOffset + 1); - } - startColumn = charStartOffset + 1; + const endColumn = end.column; + + if (validationType === StringOffsetValidationType.SurrogatePairs) { + const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0); + const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0); + + const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart); + const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd); + + if (!startInsideSurrogatePair && !endInsideSurrogatePair) { + return new Range(startLineNumber, startColumn, endLineNumber, endColumn); + } + + if (startLineNumber === endLineNumber && startColumn === endColumn) { + // do not expand a collapsed range, simply move it to a valid location + return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1); + } + + if (startInsideSurrogatePair && endInsideSurrogatePair) { + // expand range at both ends + return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1); } - } - if (endColumn >= 2) { - const endLineContent = (endLineNumber === startLineNumber ? startLineContent : this._buffer.getLineContent(endLineNumber)); - const [, charEndOffset] = strings.getCharContainingOffset(endLineContent, endColumn - 2); - if (endColumn !== charEndOffset + 1) { - endColumn = charEndOffset + 1; + if (startInsideSurrogatePair) { + // only expand range at the start + return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn); } + + // only expand range at the end + return new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1); } return new Range(startLineNumber, startColumn, endLineNumber, endColumn); @@ -1135,18 +1160,40 @@ export class TextModel extends Disposable implements model.ITextModel { } } - public pushEditOperations(beforeCursorState: Selection[], editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null): Selection[] | null { + private _validateEditOperation(rawOperation: model.IIdentifiedSingleEditOperation): model.ValidAnnotatedEditOperation { + if (rawOperation instanceof model.ValidAnnotatedEditOperation) { + return rawOperation; + } + return new model.ValidAnnotatedEditOperation( + rawOperation.identifier || null, + this.validateRange(rawOperation.range), + rawOperation.text, + rawOperation.forceMoveMarkers || false, + rawOperation.isAutoWhitespaceEdit || false, + rawOperation._isTracked || false + ); + } + + private _validateEditOperations(rawOperations: model.IIdentifiedSingleEditOperation[]): model.ValidAnnotatedEditOperation[] { + const result: model.ValidAnnotatedEditOperation[] = []; + for (let i = 0, len = rawOperations.length; i < len; i++) { + result[i] = this._validateEditOperation(rawOperations[i]); + } + return result; + } + + public pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null): Selection[] | null { try { this._onDidChangeDecorations.beginDeferredEmit(); this._eventEmitter.beginDeferredEmit(); - return this._pushEditOperations(beforeCursorState, editOperations, cursorStateComputer); + return this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer); } finally { this._eventEmitter.endDeferredEmit(); this._onDidChangeDecorations.endDeferredEmit(); } } - private _pushEditOperations(beforeCursorState: Selection[], editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null): Selection[] | null { + private _pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.ValidAnnotatedEditOperation[], cursorStateComputer: model.ICursorStateComputer | null): Selection[] | null { if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) { // Go through each saved line number and insert a trim whitespace edit // if it is safe to do so (no conflicts with other edits). @@ -1161,22 +1208,24 @@ export class TextModel extends Disposable implements model.ITextModel { // Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor // We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace let editsAreNearCursors = true; - for (let i = 0, len = beforeCursorState.length; i < len; i++) { - let sel = beforeCursorState[i]; - let foundEditNearSel = false; - for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) { - let editRange = incomingEdits[j].range; - let selIsAbove = editRange.startLineNumber > sel.endLineNumber; - let selIsBelow = sel.startLineNumber > editRange.endLineNumber; - if (!selIsAbove && !selIsBelow) { - foundEditNearSel = true; + if (beforeCursorState) { + for (let i = 0, len = beforeCursorState.length; i < len; i++) { + let sel = beforeCursorState[i]; + let foundEditNearSel = false; + for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) { + let editRange = incomingEdits[j].range; + let selIsAbove = editRange.startLineNumber > sel.endLineNumber; + let selIsBelow = sel.startLineNumber > editRange.endLineNumber; + if (!selIsAbove && !selIsBelow) { + foundEditNearSel = true; + break; + } + } + if (!foundEditNearSel) { + editsAreNearCursors = false; break; } } - if (!foundEditNearSel) { - editsAreNearCursors = false; - break; - } } if (editsAreNearCursors) { @@ -1219,10 +1268,8 @@ export class TextModel extends Disposable implements model.ITextModel { } if (allowTrimLine) { - editOperations.push({ - range: new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn), - text: null - }); + const trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn); + editOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false)); } } @@ -1233,21 +1280,39 @@ export class TextModel extends Disposable implements model.ITextModel { return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer); } - public applyEdits(rawOperations: model.IIdentifiedSingleEditOperation[]): model.IIdentifiedSingleEditOperation[] { + _applyUndoRedoEdits(edits: model.IValidEditOperations[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): model.IValidEditOperations[] { try { this._onDidChangeDecorations.beginDeferredEmit(); this._eventEmitter.beginDeferredEmit(); - return this._applyEdits(rawOperations); + this._isUndoing = isUndoing; + this._isRedoing = isRedoing; + let reverseEdits: model.IValidEditOperations[] = []; + for (let i = 0, len = edits.length; i < len; i++) { + reverseEdits[i] = { operations: this.applyEdits(edits[i].operations) }; + } + this.setEOL(eol); + this._overwriteAlternativeVersionId(resultingAlternativeVersionId); + return reverseEdits; } finally { - this._eventEmitter.endDeferredEmit(); + this._isUndoing = false; + this._isRedoing = false; + this._eventEmitter.endDeferredEmit(resultingSelection); this._onDidChangeDecorations.endDeferredEmit(); } } - private _applyEdits(rawOperations: model.IIdentifiedSingleEditOperation[]): model.IIdentifiedSingleEditOperation[] { - for (let i = 0, len = rawOperations.length; i < len; i++) { - rawOperations[i].range = this.validateRange(rawOperations[i].range); + public applyEdits(rawOperations: model.IIdentifiedSingleEditOperation[]): model.IValidEditOperation[] { + try { + this._onDidChangeDecorations.beginDeferredEmit(); + this._eventEmitter.beginDeferredEmit(); + return this._doApplyEdits(this._validateEditOperations(rawOperations)); + } finally { + this._eventEmitter.endDeferredEmit(); + this._onDidChangeDecorations.endDeferredEmit(); } + } + + private _doApplyEdits(rawOperations: model.ValidAnnotatedEditOperation[]): model.IValidEditOperation[] { const oldLineCount = this._buffer.getLineCount(); const result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace); @@ -1262,8 +1327,9 @@ export class TextModel extends Disposable implements model.ITextModel { let lineCount = oldLineCount; for (let i = 0, len = contentChanges.length; i < len; i++) { const change = contentChanges[i]; - const [eolCount, firstLineLength] = countEOL(change.text); + const [eolCount, firstLineLength, lastLineLength] = countEOL(change.text); this._tokens.acceptEdit(change.range, eolCount, firstLineLength); + this._tokens2.acceptEdit(change.range, eolCount, firstLineLength, lastLineLength, change.text.length > 0 ? change.text.charCodeAt(0) : CharCode.Null); this._onDidChangeDecorations.fire(); this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers); @@ -1327,62 +1393,20 @@ export class TextModel extends Disposable implements model.ITextModel { return result.reverseEdits; } - private _undo(): Selection[] | null { - this._isUndoing = true; - let r = this._commandManager.undo(); - this._isUndoing = false; - - if (!r) { - return null; - } - - this._overwriteAlternativeVersionId(r.recordedVersionId); - - return r.selections; - } - - public undo(): Selection[] | null { - try { - this._onDidChangeDecorations.beginDeferredEmit(); - this._eventEmitter.beginDeferredEmit(); - return this._undo(); - } finally { - this._eventEmitter.endDeferredEmit(); - this._onDidChangeDecorations.endDeferredEmit(); - } + public undo(): void { + this._undoRedoService.undo(this.uri); } public canUndo(): boolean { - return this._commandManager.canUndo(); + return this._undoRedoService.canUndo(this.uri); } - private _redo(): Selection[] | null { - this._isRedoing = true; - let r = this._commandManager.redo(); - this._isRedoing = false; - - if (!r) { - return null; - } - - this._overwriteAlternativeVersionId(r.recordedVersionId); - - return r.selections; - } - - public redo(): Selection[] | null { - try { - this._onDidChangeDecorations.beginDeferredEmit(); - this._eventEmitter.beginDeferredEmit(); - return this._redo(); - } finally { - this._eventEmitter.endDeferredEmit(); - this._onDidChangeDecorations.endDeferredEmit(); - } + public redo(): void { + this._undoRedoService.redo(this.uri); } public canRedo(): boolean { - return this._commandManager.canRedo(); + return this._undoRedoService.canRedo(this.uri); } //#endregion @@ -1403,19 +1427,15 @@ export class TextModel extends Disposable implements model.ITextModel { private _changeDecorations(ownerId: number, callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T): T | null { let changeAccessor: model.IModelDecorationsChangeAccessor = { addDecoration: (range: IRange, options: model.IModelDecorationOptions): string => { - this._onDidChangeDecorations.fire(); return this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0]; }, changeDecoration: (id: string, newRange: IRange): void => { - this._onDidChangeDecorations.fire(); this._changeDecorationImpl(id, newRange); }, changeDecorationOptions: (id: string, options: model.IModelDecorationOptions) => { - this._onDidChangeDecorations.fire(); this._changeDecorationOptionsImpl(id, _normalizeOptions(options)); }, removeDecoration: (id: string): void => { - this._onDidChangeDecorations.fire(); this._deltaDecorationsImpl(ownerId, [id], []); }, deltaDecorations: (oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[]): string[] => { @@ -1423,7 +1443,6 @@ export class TextModel extends Disposable implements model.ITextModel { // nothing to do return []; } - this._onDidChangeDecorations.fire(); return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations); } }; @@ -1454,7 +1473,6 @@ export class TextModel extends Disposable implements model.ITextModel { try { this._onDidChangeDecorations.beginDeferredEmit(); - this._onDidChangeDecorations.fire(); return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations); } finally { this._onDidChangeDecorations.endDeferredEmit(); @@ -1602,6 +1620,7 @@ export class TextModel extends Disposable implements model.ITextModel { this._decorationsTree.delete(node); node.reset(this.getVersionId(), startOffset, endOffset, range); this._decorationsTree.insert(node); + this._onDidChangeDecorations.checkAffectedAndFire(node.options); } private _changeDecorationOptionsImpl(decorationId: string, options: ModelDecorationOptions): void { @@ -1613,6 +1632,9 @@ export class TextModel extends Disposable implements model.ITextModel { const nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false); const nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false); + this._onDidChangeDecorations.checkAffectedAndFire(node.options); + this._onDidChangeDecorations.checkAffectedAndFire(options); + if (nodeWasInOverviewRuler !== nodeIsInOverviewRuler) { // Delete + Insert due to an overview ruler status change this._decorationsTree.delete(node); @@ -1646,6 +1668,7 @@ export class TextModel extends Disposable implements model.ITextModel { // (2) remove the node from the tree (if it exists) if (node) { this._decorationsTree.delete(node); + this._onDidChangeDecorations.checkAffectedAndFire(node.options); } } @@ -1668,6 +1691,7 @@ export class TextModel extends Disposable implements model.ITextModel { node.ownerId = ownerId; node.reset(versionId, startOffset, endOffset, range); node.setOptions(options); + this._onDidChangeDecorations.checkAffectedAndFire(options); this._decorationsTree.insert(node); @@ -1693,7 +1717,7 @@ export class TextModel extends Disposable implements model.ITextModel { throw new Error('Illegal value for lineNumber'); } - this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), tokens); + this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), tokens, false); } public setTokens(tokens: MultilineTokens[]): void { @@ -1705,15 +1729,42 @@ export class TextModel extends Disposable implements model.ITextModel { for (let i = 0, len = tokens.length; i < len; i++) { const element = tokens[i]; - ranges.push({ fromLineNumber: element.startLineNumber, toLineNumber: element.startLineNumber + element.tokens.length - 1 }); + let minChangedLineNumber = 0; + let maxChangedLineNumber = 0; + let hasChange = false; for (let j = 0, lenJ = element.tokens.length; j < lenJ; j++) { - this.setLineTokens(element.startLineNumber + j, element.tokens[j]); + const lineNumber = element.startLineNumber + j; + if (hasChange) { + this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), element.tokens[j], false); + maxChangedLineNumber = lineNumber; + } else { + const lineHasChange = this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), element.tokens[j], true); + if (lineHasChange) { + hasChange = true; + minChangedLineNumber = lineNumber; + maxChangedLineNumber = lineNumber; + } + } + } + if (hasChange) { + ranges.push({ fromLineNumber: minChangedLineNumber, toLineNumber: maxChangedLineNumber }); } } + if (ranges.length > 0) { + this._emitModelTokensChangedEvent({ + tokenizationSupportChanged: false, + ranges: ranges + }); + } + } + + public setSemanticTokens(tokens: MultilineTokens2[] | null): void { + this._tokens2.set(tokens); + this._emitModelTokensChangedEvent({ tokenizationSupportChanged: false, - ranges: ranges + ranges: [{ fromLineNumber: 1, toLineNumber: this.getLineCount() }] }); } @@ -1734,6 +1785,15 @@ export class TextModel extends Disposable implements model.ITextModel { }); } + public clearSemanticTokens(): void { + this._tokens2.flush(); + + this._emitModelTokensChangedEvent({ + tokenizationSupportChanged: false, + ranges: [{ fromLineNumber: 1, toLineNumber: this.getLineCount() }] + }); + } + private _emitModelTokensChangedEvent(e: IModelTokensChangedEvent): void { if (!this._isDisposing) { this._onDidChangeTokens.fire(e); @@ -1772,7 +1832,8 @@ export class TextModel extends Disposable implements model.ITextModel { private _getLineTokens(lineNumber: number): LineTokens { const lineText = this.getLineContent(lineNumber); - return this._tokens.getTokens(this._languageIdentifier.id, lineNumber - 1, lineText); + const syntacticTokens = this._tokens.getTokens(this._languageIdentifier.id, lineNumber - 1, lineText); + return this._tokens2.addSemanticTokens(lineNumber, syntacticTokens); } public getLanguageIdentifier(): LanguageIdentifier { @@ -1909,6 +1970,7 @@ export class TextModel extends Disposable implements model.ITextModel { private _matchBracket(position: Position): [Range, Range] | null { const lineNumber = position.lineNumber; const lineTokens = this._getLineTokens(lineNumber); + const tokenCount = lineTokens.getCount(); const lineText = this._buffer.getLineContent(lineNumber); const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1); @@ -1921,6 +1983,15 @@ export class TextModel extends Disposable implements model.ITextModel { if (currentModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))) { // limit search to not go before `maxBracketLength` let searchStartOffset = Math.max(0, position.column - 1 - currentModeBrackets.maxBracketLength); + for (let i = tokenIndex - 1; i >= 0; i--) { + const tokenEndOffset = lineTokens.getEndOffset(i); + if (tokenEndOffset <= searchStartOffset) { + break; + } + if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i))) { + searchStartOffset = tokenEndOffset; + } + } // limit search to not go after `maxBracketLength` const searchEndOffset = Math.min(lineText.length, position.column - 1 + currentModeBrackets.maxBracketLength); @@ -1960,7 +2031,16 @@ export class TextModel extends Disposable implements model.ITextModel { if (prevModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(prevTokenIndex))) { // limit search in case previous token is very large, there's no need to go beyond `maxBracketLength` const searchStartOffset = Math.max(0, position.column - 1 - prevModeBrackets.maxBracketLength); - const searchEndOffset = Math.min(lineText.length, position.column - 1 + prevModeBrackets.maxBracketLength); + let searchEndOffset = Math.min(lineText.length, position.column - 1 + prevModeBrackets.maxBracketLength); + for (let i = prevTokenIndex + 1; i < tokenCount; i++) { + const tokenStartOffset = lineTokens.getStartOffset(i); + if (tokenStartOffset >= searchEndOffset) { + break; + } + if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i))) { + searchEndOffset = tokenStartOffset; + } + } const foundBracket = BracketsUtils.findPrevBracketInRange(prevModeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset); // check that we didn't hit a bracket too far away from position @@ -2318,16 +2398,21 @@ export class TextModel extends Disposable implements model.ITextModel { return null; } - public findEnclosingBrackets(_position: IPosition): [Range, Range] | null { + public findEnclosingBrackets(_position: IPosition, maxDuration = Constants.MAX_SAFE_SMALL_INTEGER): [Range, Range] | null { const position = this.validatePosition(_position); const lineCount = this.getLineCount(); + const savedCounts = new Map(); let counts: number[] = []; - const resetCounts = (modeBrackets: RichEditBrackets | null) => { - counts = []; - for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) { - counts[i] = 0; + const resetCounts = (languageId: number, modeBrackets: RichEditBrackets | null) => { + if (!savedCounts.has(languageId)) { + let tmp = []; + for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) { + tmp[i] = 0; + } + savedCounts.set(languageId, tmp); } + counts = savedCounts.get(languageId)!; }; const searchInRange = (modeBrackets: RichEditBrackets, lineNumber: number, lineText: string, searchStartOffset: number, searchEndOffset: number): [Range, Range] | null => { while (true) { @@ -2357,7 +2442,12 @@ export class TextModel extends Disposable implements model.ITextModel { let languageId: LanguageId = -1; let modeBrackets: RichEditBrackets | null = null; + const startTime = Date.now(); for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) { + const elapsedTime = Date.now() - startTime; + if (elapsedTime > maxDuration) { + return null; + } const lineTokens = this._getLineTokens(lineNumber); const tokenCount = lineTokens.getCount(); const lineText = this._buffer.getLineContent(lineNumber); @@ -2373,7 +2463,7 @@ export class TextModel extends Disposable implements model.ITextModel { if (languageId !== tokenLanguageId) { languageId = tokenLanguageId; modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId); - resetCounts(modeBrackets); + resetCounts(languageId, modeBrackets); } } @@ -2392,7 +2482,7 @@ export class TextModel extends Disposable implements model.ITextModel { } languageId = tokenLanguageId; modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId); - resetCounts(modeBrackets); + resetCounts(languageId, modeBrackets); } const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))); @@ -2573,14 +2663,16 @@ export class TextModel extends Disposable implements model.ITextModel { let goDown = true; let indent = 0; + let initialIndent = 0; + for (let distance = 0; goUp || goDown; distance++) { const upLineNumber = lineNumber - distance; const downLineNumber = lineNumber + distance; - if (distance !== 0 && (upLineNumber < 1 || upLineNumber < minLineNumber)) { + if (distance > 1 && (upLineNumber < 1 || upLineNumber < minLineNumber)) { goUp = false; } - if (distance !== 0 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) { + if (distance > 1 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) { goDown = false; } if (distance > 50000) { @@ -2589,10 +2681,9 @@ export class TextModel extends Disposable implements model.ITextModel { goDown = false; } + let upLineIndentLevel: number = -1; if (goUp) { // compute indent level going up - let upLineIndentLevel: number; - const currentIndent = this._computeIndentLevel(upLineNumber - 1); if (currentIndent >= 0) { // This line has content (besides whitespace) @@ -2604,30 +2695,11 @@ export class TextModel extends Disposable implements model.ITextModel { up_resolveIndents(upLineNumber); upLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, up_aboveContentLineIndent, up_belowContentLineIndent); } - - if (distance === 0) { - // This is the initial line number - startLineNumber = upLineNumber; - endLineNumber = downLineNumber; - indent = upLineIndentLevel; - if (indent === 0) { - // No need to continue - return { startLineNumber, endLineNumber, indent }; - } - continue; - } - - if (upLineIndentLevel >= indent) { - startLineNumber = upLineNumber; - } else { - goUp = false; - } } + let downLineIndentLevel = -1; if (goDown) { // compute indent level going down - let downLineIndentLevel: number; - const currentIndent = this._computeIndentLevel(downLineNumber - 1); if (currentIndent >= 0) { // This line has content (besides whitespace) @@ -2639,7 +2711,50 @@ export class TextModel extends Disposable implements model.ITextModel { down_resolveIndents(downLineNumber); downLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, down_aboveContentLineIndent, down_belowContentLineIndent); } + } + + if (distance === 0) { + initialIndent = upLineIndentLevel; + continue; + } + + if (distance === 1) { + if (downLineNumber <= lineCount && downLineIndentLevel >= 0 && initialIndent + 1 === downLineIndentLevel) { + // This is the beginning of a scope, we have special handling here, since we want the + // child scope indent to be active, not the parent scope + goUp = false; + startLineNumber = downLineNumber; + endLineNumber = downLineNumber; + indent = downLineIndentLevel; + continue; + } + if (upLineNumber >= 1 && upLineIndentLevel >= 0 && upLineIndentLevel - 1 === initialIndent) { + // This is the end of a scope, just like above + goDown = false; + startLineNumber = upLineNumber; + endLineNumber = upLineNumber; + indent = upLineIndentLevel; + continue; + } + + startLineNumber = lineNumber; + endLineNumber = lineNumber; + indent = initialIndent; + if (indent === 0) { + // No need to continue + return { startLineNumber, endLineNumber, indent }; + } + } + + if (goUp) { + if (upLineIndentLevel >= indent) { + startLineNumber = upLineNumber; + } else { + goUp = false; + } + } + if (goDown) { if (downLineIndentLevel >= indent) { endLineNumber = downLineNumber; } else { @@ -2853,7 +2968,7 @@ export class ModelDecorationOverviewRulerOptions extends DecorationOptions { this.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center); } - public getColor(theme: ITheme): string { + public getColor(theme: EditorTheme): string { if (!this._resolvedColor) { if (theme.type !== 'light' && this.darkColor) { this._resolvedColor = this._resolveColor(this.darkColor, theme); @@ -2868,7 +2983,7 @@ export class ModelDecorationOverviewRulerOptions extends DecorationOptions { this._resolvedColor = null; } - private _resolveColor(color: string | ThemeColor, theme: ITheme): string { + private _resolveColor(color: string | ThemeColor, theme: EditorTheme): string { if (typeof color === 'string') { return color; } @@ -2890,7 +3005,7 @@ export class ModelDecorationMinimapOptions extends DecorationOptions { this.position = options.position; } - public getColor(theme: ITheme): Color | undefined { + public getColor(theme: EditorTheme): Color | undefined { if (!this._resolvedColor) { if (theme.type !== 'light' && this.darkColor) { this._resolvedColor = this._resolveColor(this.darkColor, theme); @@ -2906,7 +3021,7 @@ export class ModelDecorationMinimapOptions extends DecorationOptions { this._resolvedColor = undefined; } - private _resolveColor(color: string | ThemeColor, theme: ITheme): Color | undefined { + private _resolveColor(color: string | ThemeColor, theme: EditorTheme): Color | undefined { if (typeof color === 'string') { return Color.fromHex(color); } @@ -2990,11 +3105,15 @@ export class DidChangeDecorationsEmitter extends Disposable { private _deferredCnt: number; private _shouldFire: boolean; + private _affectsMinimap: boolean; + private _affectsOverviewRuler: boolean; constructor() { super(); this._deferredCnt = 0; this._shouldFire = false; + this._affectsMinimap = false; + this._affectsOverviewRuler = false; } public beginDeferredEmit(): void { @@ -3005,13 +3124,31 @@ export class DidChangeDecorationsEmitter extends Disposable { this._deferredCnt--; if (this._deferredCnt === 0) { if (this._shouldFire) { + const event: IModelDecorationsChangedEvent = { + affectsMinimap: this._affectsMinimap, + affectsOverviewRuler: this._affectsOverviewRuler, + }; this._shouldFire = false; - this._actual.fire({}); + this._affectsMinimap = false; + this._affectsOverviewRuler = false; + this._actual.fire(event); } } } + public checkAffectedAndFire(options: ModelDecorationOptions): void { + if (!this._affectsMinimap) { + this._affectsMinimap = options.minimap && options.minimap.position ? true : false; + } + if (!this._affectsOverviewRuler) { + this._affectsOverviewRuler = options.overviewRuler && options.overviewRuler.color ? true : false; + } + this._shouldFire = true; + } + public fire(): void { + this._affectsMinimap = true; + this._affectsOverviewRuler = true; this._shouldFire = true; } } @@ -3041,10 +3178,11 @@ export class DidChangeContentEmitter extends Disposable { this._deferredCnt++; } - public endDeferredEmit(): void { + public endDeferredEmit(resultingSelection: Selection[] | null = null): void { this._deferredCnt--; if (this._deferredCnt === 0) { if (this._deferredEvent !== null) { + this._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection; const e = this._deferredEvent; this._deferredEvent = null; this._fastEmitter.fire(e); diff --git a/src/vs/editor/common/model/textModelEvents.ts b/src/vs/editor/common/model/textModelEvents.ts index fc84cb84f9345..17f45db65ad99 100644 --- a/src/vs/editor/common/model/textModelEvents.ts +++ b/src/vs/editor/common/model/textModelEvents.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IRange } from 'vs/editor/common/core/range'; +import { Selection } from 'vs/editor/common/core/selection'; /** * An event describing that the current mode associated with a model has changed. @@ -76,10 +77,13 @@ export interface IModelContentChangedEvent { * An event describing that model decorations have changed. */ export interface IModelDecorationsChangedEvent { + readonly affectsMinimap: boolean; + readonly affectsOverviewRuler: boolean; } /** * An event describing that some ranges of lines have been tokenized (their tokens have changed). + * @internal */ export interface IModelTokensChangedEvent { readonly tokenizationSupportChanged: boolean; @@ -222,11 +226,14 @@ export class ModelRawContentChangedEvent { */ public readonly isRedoing: boolean; + public resultingSelection: Selection[] | null; + constructor(changes: ModelRawChange[], versionId: number, isUndoing: boolean, isRedoing: boolean) { this.changes = changes; this.versionId = versionId; this.isUndoing = isUndoing; this.isRedoing = isRedoing; + this.resultingSelection = null; } public containsEvent(type: RawContentChangedType): boolean { diff --git a/src/vs/editor/common/model/tokensStore.ts b/src/vs/editor/common/model/tokensStore.ts index d965bcf8937ea..c662f820c9ca5 100644 --- a/src/vs/editor/common/model/tokensStore.ts +++ b/src/vs/editor/common/model/tokensStore.ts @@ -11,9 +11,10 @@ import { ColorId, FontStyle, LanguageId, MetadataConsts, StandardTokenType, Toke import { writeUInt32BE, readUInt32BE } from 'vs/base/common/buffer'; import { CharCode } from 'vs/base/common/charCode'; -export function countEOL(text: string): [number, number] { +export function countEOL(text: string): [number, number, number] { let eolCount = 0; let firstLineLength = 0; + let lastLineStart = 0; for (let i = 0, len = text.length; i < len; i++) { const chr = text.charCodeAt(i); @@ -28,17 +29,19 @@ export function countEOL(text: string): [number, number] { } else { // \r... case } + lastLineStart = i + 1; } else if (chr === CharCode.LineFeed) { if (eolCount === 0) { firstLineLength = i; } eolCount++; + lastLineStart = i + 1; } } if (eolCount === 0) { firstLineLength = text.length; } - return [eolCount, firstLineLength]; + return [eolCount, firstLineLength, text.length - lastLineStart]; } function getDefaultMetadata(topLevelLanguageId: LanguageId): number { @@ -109,6 +112,459 @@ export class MultilineTokensBuilder { } } +export interface IEncodedTokens { + getTokenCount(): number; + getDeltaLine(tokenIndex: number): number; + getMaxDeltaLine(): number; + getStartCharacter(tokenIndex: number): number; + getEndCharacter(tokenIndex: number): number; + getMetadata(tokenIndex: number): number; + + clear(): void; + acceptDeleteRange(horizontalShiftForFirstLineTokens: number, startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void; + acceptInsertText(deltaLine: number, character: number, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void; +} + +export class SparseEncodedTokens implements IEncodedTokens { + /** + * The encoding of tokens is: + * 4*i deltaLine (from `startLineNumber`) + * 4*i+1 startCharacter (from the line start) + * 4*i+2 endCharacter (from the line start) + * 4*i+3 metadata + */ + private _tokens: Uint32Array; + private _tokenCount: number; + + constructor(tokens: Uint32Array) { + this._tokens = tokens; + this._tokenCount = tokens.length / 4; + } + + public getMaxDeltaLine(): number { + const tokenCount = this.getTokenCount(); + if (tokenCount === 0) { + return -1; + } + return this.getDeltaLine(tokenCount - 1); + } + + public getTokenCount(): number { + return this._tokenCount; + } + + public getDeltaLine(tokenIndex: number): number { + return this._tokens[4 * tokenIndex]; + } + + public getStartCharacter(tokenIndex: number): number { + return this._tokens[4 * tokenIndex + 1]; + } + + public getEndCharacter(tokenIndex: number): number { + return this._tokens[4 * tokenIndex + 2]; + } + + public getMetadata(tokenIndex: number): number { + return this._tokens[4 * tokenIndex + 3]; + } + + public clear(): void { + this._tokenCount = 0; + } + + public acceptDeleteRange(horizontalShiftForFirstLineTokens: number, startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void { + // This is a bit complex, here are the cases I used to think about this: + // + // 1. The token starts before the deletion range + // 1a. The token is completely before the deletion range + // ----------- + // xxxxxxxxxxx + // 1b. The token starts before, the deletion range ends after the token + // ----------- + // xxxxxxxxxxx + // 1c. The token starts before, the deletion range ends precisely with the token + // --------------- + // xxxxxxxx + // 1d. The token starts before, the deletion range is inside the token + // --------------- + // xxxxx + // + // 2. The token starts at the same position with the deletion range + // 2a. The token starts at the same position, and ends inside the deletion range + // ------- + // xxxxxxxxxxx + // 2b. The token starts at the same position, and ends at the same position as the deletion range + // ---------- + // xxxxxxxxxx + // 2c. The token starts at the same position, and ends after the deletion range + // ------------- + // xxxxxxx + // + // 3. The token starts inside the deletion range + // 3a. The token is inside the deletion range + // ------- + // xxxxxxxxxxxxx + // 3b. The token starts inside the deletion range, and ends at the same position as the deletion range + // ---------- + // xxxxxxxxxxxxx + // 3c. The token starts inside the deletion range, and ends after the deletion range + // ------------ + // xxxxxxxxxxx + // + // 4. The token starts after the deletion range + // ----------- + // xxxxxxxx + // + const tokens = this._tokens; + const tokenCount = this._tokenCount; + const deletedLineCount = (endDeltaLine - startDeltaLine); + let newTokenCount = 0; + let hasDeletedTokens = false; + for (let i = 0; i < tokenCount; i++) { + const srcOffset = 4 * i; + let tokenDeltaLine = tokens[srcOffset]; + let tokenStartCharacter = tokens[srcOffset + 1]; + let tokenEndCharacter = tokens[srcOffset + 2]; + const tokenMetadata = tokens[srcOffset + 3]; + + if (tokenDeltaLine < startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter <= startCharacter)) { + // 1a. The token is completely before the deletion range + // => nothing to do + newTokenCount++; + continue; + } else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter < startCharacter) { + // 1b, 1c, 1d + // => the token survives, but it needs to shrink + if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) { + // 1d. The token starts before, the deletion range is inside the token + // => the token shrinks by the deletion character count + tokenEndCharacter -= (endCharacter - startCharacter); + } else { + // 1b. The token starts before, the deletion range ends after the token + // 1c. The token starts before, the deletion range ends precisely with the token + // => the token shrinks its ending to the deletion start + tokenEndCharacter = startCharacter; + } + } else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter === startCharacter) { + // 2a, 2b, 2c + if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) { + // 2c. The token starts at the same position, and ends after the deletion range + // => the token shrinks by the deletion character count + tokenEndCharacter -= (endCharacter - startCharacter); + } else { + // 2a. The token starts at the same position, and ends inside the deletion range + // 2b. The token starts at the same position, and ends at the same position as the deletion range + // => the token is deleted + hasDeletedTokens = true; + continue; + } + } else if (tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter < endCharacter)) { + // 3a, 3b, 3c + if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) { + // 3c. The token starts inside the deletion range, and ends after the deletion range + // => the token moves left and shrinks + if (tokenDeltaLine === startDeltaLine) { + // the deletion started on the same line as the token + // => the token moves left and shrinks + tokenStartCharacter = startCharacter; + tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter); + } else { + // the deletion started on a line above the token + // => the token moves to the beginning of the line + tokenStartCharacter = 0; + tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter); + } + } else { + // 3a. The token is inside the deletion range + // 3b. The token starts inside the deletion range, and ends at the same position as the deletion range + // => the token is deleted + hasDeletedTokens = true; + continue; + } + } else if (tokenDeltaLine > endDeltaLine) { + // 4. (partial) The token starts after the deletion range, on a line below... + if (deletedLineCount === 0 && !hasDeletedTokens) { + // early stop, there is no need to walk all the tokens and do nothing... + newTokenCount = tokenCount; + break; + } + tokenDeltaLine -= deletedLineCount; + } else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) { + // 4. (continued) The token starts after the deletion range, on the last line where a deletion occurs + if (horizontalShiftForFirstLineTokens && tokenDeltaLine === 0) { + tokenStartCharacter += horizontalShiftForFirstLineTokens; + tokenEndCharacter += horizontalShiftForFirstLineTokens; + } + tokenDeltaLine -= deletedLineCount; + tokenStartCharacter -= (endCharacter - startCharacter); + tokenEndCharacter -= (endCharacter - startCharacter); + } else { + throw new Error(`Not possible!`); + } + + const destOffset = 4 * newTokenCount; + tokens[destOffset] = tokenDeltaLine; + tokens[destOffset + 1] = tokenStartCharacter; + tokens[destOffset + 2] = tokenEndCharacter; + tokens[destOffset + 3] = tokenMetadata; + newTokenCount++; + } + + this._tokenCount = newTokenCount; + } + + public acceptInsertText(deltaLine: number, character: number, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void { + // Here are the cases I used to think about this: + // + // 1. The token is completely before the insertion point + // ----------- | + // 2. The token ends precisely at the insertion point + // -----------| + // 3. The token contains the insertion point + // -----|------ + // 4. The token starts precisely at the insertion point + // |----------- + // 5. The token is completely after the insertion point + // | ----------- + // + const isInsertingPreciselyOneWordCharacter = ( + eolCount === 0 + && firstLineLength === 1 + && ( + (firstCharCode >= CharCode.Digit0 && firstCharCode <= CharCode.Digit9) + || (firstCharCode >= CharCode.A && firstCharCode <= CharCode.Z) + || (firstCharCode >= CharCode.a && firstCharCode <= CharCode.z) + ) + ); + const tokens = this._tokens; + const tokenCount = this._tokenCount; + for (let i = 0; i < tokenCount; i++) { + const offset = 4 * i; + let tokenDeltaLine = tokens[offset]; + let tokenStartCharacter = tokens[offset + 1]; + let tokenEndCharacter = tokens[offset + 2]; + + if (tokenDeltaLine < deltaLine || (tokenDeltaLine === deltaLine && tokenEndCharacter < character)) { + // 1. The token is completely before the insertion point + // => nothing to do + continue; + } else if (tokenDeltaLine === deltaLine && tokenEndCharacter === character) { + // 2. The token ends precisely at the insertion point + // => expand the end character only if inserting precisely one character that is a word character + if (isInsertingPreciselyOneWordCharacter) { + tokenEndCharacter += 1; + } else { + continue; + } + } else if (tokenDeltaLine === deltaLine && tokenStartCharacter < character && character < tokenEndCharacter) { + // 3. The token contains the insertion point + if (eolCount === 0) { + // => just expand the end character + tokenEndCharacter += firstLineLength; + } else { + // => cut off the token + tokenEndCharacter = character; + } + } else { + // 4. or 5. + if (tokenDeltaLine === deltaLine && tokenStartCharacter === character) { + // 4. The token starts precisely at the insertion point + // => grow the token (by keeping its start constant) only if inserting precisely one character that is a word character + // => otherwise behave as in case 5. + if (isInsertingPreciselyOneWordCharacter) { + continue; + } + } + // => the token must move and keep its size constant + if (tokenDeltaLine === deltaLine) { + tokenDeltaLine += eolCount; + // this token is on the line where the insertion is taking place + if (eolCount === 0) { + tokenStartCharacter += firstLineLength; + tokenEndCharacter += firstLineLength; + } else { + const tokenLength = tokenEndCharacter - tokenStartCharacter; + tokenStartCharacter = lastLineLength + (tokenStartCharacter - character); + tokenEndCharacter = tokenStartCharacter + tokenLength; + } + } else { + tokenDeltaLine += eolCount; + } + } + + tokens[offset] = tokenDeltaLine; + tokens[offset + 1] = tokenStartCharacter; + tokens[offset + 2] = tokenEndCharacter; + } + } +} + +export class LineTokens2 { + + private readonly _actual: IEncodedTokens; + private readonly _startTokenIndex: number; + private readonly _endTokenIndex: number; + + constructor(actual: IEncodedTokens, startTokenIndex: number, endTokenIndex: number) { + this._actual = actual; + this._startTokenIndex = startTokenIndex; + this._endTokenIndex = endTokenIndex; + } + + public getCount(): number { + return this._endTokenIndex - this._startTokenIndex + 1; + } + + public getStartCharacter(tokenIndex: number): number { + return this._actual.getStartCharacter(this._startTokenIndex + tokenIndex); + } + + public getEndCharacter(tokenIndex: number): number { + return this._actual.getEndCharacter(this._startTokenIndex + tokenIndex); + } + + public getMetadata(tokenIndex: number): number { + return this._actual.getMetadata(this._startTokenIndex + tokenIndex); + } +} + +export class MultilineTokens2 { + + public startLineNumber: number; + public endLineNumber: number; + public tokens: IEncodedTokens; + + constructor(startLineNumber: number, tokens: IEncodedTokens) { + this.startLineNumber = startLineNumber; + this.tokens = tokens; + this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine(); + } + + private _updateEndLineNumber(): void { + this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine(); + } + + public getLineTokens(lineNumber: number): LineTokens2 | null { + if (this.startLineNumber <= lineNumber && lineNumber <= this.endLineNumber) { + const findResult = MultilineTokens2._findTokensWithLine(this.tokens, lineNumber - this.startLineNumber); + if (findResult) { + const [startTokenIndex, endTokenIndex] = findResult; + return new LineTokens2(this.tokens, startTokenIndex, endTokenIndex); + } + } + return null; + } + + private static _findTokensWithLine(tokens: IEncodedTokens, deltaLine: number): [number, number] | null { + let low = 0; + let high = tokens.getTokenCount() - 1; + + while (low < high) { + const mid = low + Math.floor((high - low) / 2); + const midDeltaLine = tokens.getDeltaLine(mid); + + if (midDeltaLine < deltaLine) { + low = mid + 1; + } else if (midDeltaLine > deltaLine) { + high = mid - 1; + } else { + let min = mid; + while (min > low && tokens.getDeltaLine(min - 1) === deltaLine) { + min--; + } + let max = mid; + while (max < high && tokens.getDeltaLine(max + 1) === deltaLine) { + max++; + } + return [min, max]; + } + } + + if (tokens.getDeltaLine(low) === deltaLine) { + return [low, low]; + } + + return null; + } + + public applyEdit(range: IRange, text: string): void { + const [eolCount, firstLineLength, lastLineLength] = countEOL(text); + this.acceptEdit(range, eolCount, firstLineLength, lastLineLength, text.length > 0 ? text.charCodeAt(0) : CharCode.Null); + } + + public acceptEdit(range: IRange, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void { + this._acceptDeleteRange(range); + this._acceptInsertText(new Position(range.startLineNumber, range.startColumn), eolCount, firstLineLength, lastLineLength, firstCharCode); + this._updateEndLineNumber(); + } + + private _acceptDeleteRange(range: IRange): void { + if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) { + // Nothing to delete + return; + } + + const firstLineIndex = range.startLineNumber - this.startLineNumber; + const lastLineIndex = range.endLineNumber - this.startLineNumber; + + if (lastLineIndex < 0) { + // this deletion occurs entirely before this block, so we only need to adjust line numbers + const deletedLinesCount = lastLineIndex - firstLineIndex; + this.startLineNumber -= deletedLinesCount; + return; + } + + const tokenMaxDeltaLine = this.tokens.getMaxDeltaLine(); + + if (firstLineIndex >= tokenMaxDeltaLine + 1) { + // this deletion occurs entirely after this block, so there is nothing to do + return; + } + + if (firstLineIndex < 0 && lastLineIndex >= tokenMaxDeltaLine + 1) { + // this deletion completely encompasses this block + this.startLineNumber = 0; + this.tokens.clear(); + return; + } + + if (firstLineIndex < 0) { + const deletedBefore = -firstLineIndex; + this.startLineNumber -= deletedBefore; + + this.tokens.acceptDeleteRange(range.startColumn - 1, 0, 0, lastLineIndex, range.endColumn - 1); + } else { + this.tokens.acceptDeleteRange(0, firstLineIndex, range.startColumn - 1, lastLineIndex, range.endColumn - 1); + } + } + + private _acceptInsertText(position: Position, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void { + + if (eolCount === 0 && firstLineLength === 0) { + // Nothing to insert + return; + } + + const lineIndex = position.lineNumber - this.startLineNumber; + + if (lineIndex < 0) { + // this insertion occurs before this block, so we only need to adjust line numbers + this.startLineNumber += eolCount; + return; + } + + const tokenMaxDeltaLine = this.tokens.getMaxDeltaLine(); + + if (lineIndex >= tokenMaxDeltaLine + 1) { + // this insertion occurs after this block, so there is nothing to do + return; + } + + this.tokens.acceptInsertText(lineIndex, position.column - 1, eolCount, firstLineLength, lastLineLength, firstCharCode); + } +} + export class MultilineTokens { public startLineNumber: number; @@ -193,6 +649,7 @@ export class MultilineTokens { // this deletion completely encompasses this block this.startLineNumber = 0; this.tokens = []; + return; } if (firstLineIndex === lastLineIndex) { @@ -289,6 +746,132 @@ function toUint32Array(arr: Uint32Array | ArrayBuffer): Uint32Array { } } +export class TokensStore2 { + + private _pieces: MultilineTokens2[]; + + constructor() { + this._pieces = []; + } + + public flush(): void { + this._pieces = []; + } + + public set(pieces: MultilineTokens2[] | null) { + this._pieces = pieces || []; + } + + public addSemanticTokens(lineNumber: number, aTokens: LineTokens): LineTokens { + const pieces = this._pieces; + + if (pieces.length === 0) { + return aTokens; + } + + const pieceIndex = TokensStore2._findFirstPieceWithLine(pieces, lineNumber); + const bTokens = this._pieces[pieceIndex].getLineTokens(lineNumber); + + if (!bTokens) { + return aTokens; + } + + const aLen = aTokens.getCount(); + const bLen = bTokens.getCount(); + + let aIndex = 0; + let result: number[] = [], resultLen = 0; + for (let bIndex = 0; bIndex < bLen; bIndex++) { + const bStartCharacter = bTokens.getStartCharacter(bIndex); + const bEndCharacter = bTokens.getEndCharacter(bIndex); + const bMetadata = bTokens.getMetadata(bIndex); + + const bMask = ( + ((bMetadata & MetadataConsts.SEMANTIC_USE_ITALIC) ? MetadataConsts.ITALIC_MASK : 0) + | ((bMetadata & MetadataConsts.SEMANTIC_USE_BOLD) ? MetadataConsts.BOLD_MASK : 0) + | ((bMetadata & MetadataConsts.SEMANTIC_USE_UNDERLINE) ? MetadataConsts.UNDERLINE_MASK : 0) + | ((bMetadata & MetadataConsts.SEMANTIC_USE_FOREGROUND) ? MetadataConsts.FOREGROUND_MASK : 0) + | ((bMetadata & MetadataConsts.SEMANTIC_USE_BACKGROUND) ? MetadataConsts.BACKGROUND_MASK : 0) + ) >>> 0; + const aMask = (~bMask) >>> 0; + + // push any token from `a` that is before `b` + while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) { + result[resultLen++] = aTokens.getEndOffset(aIndex); + result[resultLen++] = aTokens.getMetadata(aIndex); + aIndex++; + } + + // push the token from `a` if it intersects the token from `b` + if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) { + result[resultLen++] = bStartCharacter; + result[resultLen++] = aTokens.getMetadata(aIndex); + } + + // skip any tokens from `a` that are contained inside `b` + while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) { + result[resultLen++] = aTokens.getEndOffset(aIndex); + result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask); + aIndex++; + } + + if (aIndex < aLen && aTokens.getEndOffset(aIndex) === bEndCharacter) { + // `a` ends exactly at the same spot as `b`! + result[resultLen++] = aTokens.getEndOffset(aIndex); + result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask); + aIndex++; + } else { + const aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1); + + // push the token from `b` + result[resultLen++] = bEndCharacter; + result[resultLen++] = (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask); + } + } + + // push the remaining tokens from `a` + while (aIndex < aLen) { + result[resultLen++] = aTokens.getEndOffset(aIndex); + result[resultLen++] = aTokens.getMetadata(aIndex); + aIndex++; + } + + return new LineTokens(new Uint32Array(result), aTokens.getLineContent()); + } + + private static _findFirstPieceWithLine(pieces: MultilineTokens2[], lineNumber: number): number { + let low = 0; + let high = pieces.length - 1; + + while (low < high) { + let mid = low + Math.floor((high - low) / 2); + + if (pieces[mid].endLineNumber < lineNumber) { + low = mid + 1; + } else if (pieces[mid].startLineNumber > lineNumber) { + high = mid - 1; + } else { + while (mid > low && pieces[mid - 1].startLineNumber <= lineNumber && lineNumber <= pieces[mid - 1].endLineNumber) { + mid--; + } + return mid; + } + } + + return low; + } + + //#region Editing + + public acceptEdit(range: IRange, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void { + for (const piece of this._pieces) { + piece.acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode); + } + } + + //#endregion +} + export class TokensStore { private _lineTokens: (Uint32Array | ArrayBuffer | null)[]; private _len: number; @@ -381,10 +964,35 @@ export class TokensStore { this._len += insertCount; } - public setTokens(topLevelLanguageId: LanguageId, lineIndex: number, lineTextLength: number, _tokens: Uint32Array | ArrayBuffer | null): void { + public setTokens(topLevelLanguageId: LanguageId, lineIndex: number, lineTextLength: number, _tokens: Uint32Array | ArrayBuffer | null, checkEquality: boolean): boolean { const tokens = TokensStore._massageTokens(topLevelLanguageId, lineTextLength, _tokens); this._ensureLine(lineIndex); + const oldTokens = this._lineTokens[lineIndex]; this._lineTokens[lineIndex] = tokens; + + if (checkEquality) { + return !TokensStore._equals(oldTokens, tokens); + } + return false; + } + + private static _equals(_a: Uint32Array | ArrayBuffer | null, _b: Uint32Array | ArrayBuffer | null) { + if (!_a || !_b) { + return !_a && !_b; + } + + const a = toUint32Array(_a); + const b = toUint32Array(_b); + + if (a.length !== b.length) { + return false; + } + for (let i = 0, len = a.length; i < len; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; } //#region Editing diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 67a01dd72cc78..c348245a8ece8 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -125,6 +125,16 @@ export const enum MetadataConsts { FOREGROUND_MASK = 0b00000000011111111100000000000000, BACKGROUND_MASK = 0b11111111100000000000000000000000, + ITALIC_MASK = 0b00000000000000000000100000000000, + BOLD_MASK = 0b00000000000000000001000000000000, + UNDERLINE_MASK = 0b00000000000000000010000000000000, + + SEMANTIC_USE_ITALIC = 0b00000000000000000000000000000001, + SEMANTIC_USE_BOLD = 0b00000000000000000000000000000010, + SEMANTIC_USE_UNDERLINE = 0b00000000000000000000000000000100, + SEMANTIC_USE_FOREGROUND = 0b00000000000000000000000000001000, + SEMANTIC_USE_BACKGROUND = 0b00000000000000000000000000010000, + LANGUAGEID_OFFSET = 0, TOKEN_TYPE_OFFSET = 8, FONT_STYLE_OFFSET = 11, @@ -255,6 +265,34 @@ export interface HoverProvider { provideHover(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult; } +/** + * An evaluatable expression represents additional information for an expression in a document. Evaluatable expression are + * evaluated by a debugger or runtime and their result is rendered in a tooltip-like widget. + */ +export interface EvaluatableExpression { + /** + * The range to which this expression applies. + */ + range: IRange; + /* + * This expression overrides the expression extracted from the range. + */ + expression?: string; +} + +/** + * The hover provider interface defines the contract between extensions and + * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature. + */ +export interface EvaluatableExpressionProvider { + /** + * Provide a hover for the given position and document. Multiple hovers at the same + * position will be merged by the editor. A hover can have a range which defaults + * to the word range at the position when omitted. + */ + provideEvaluatableExpression(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult; +} + export const enum CompletionItemKind { Method, Function, @@ -367,6 +405,28 @@ export let completionKindFromString: { }; })(); +export interface CompletionItemLabel { + /** + * The function or variable. Rendered leftmost. + */ + name: string; + + /** + * The signature without the return type. Render after `name`. + */ + signature?: string; + + /** + * The fully qualified name, like package name or file path. Rendered after `signature`. + */ + qualifier?: string; + + /** + * The return-type of a function or type of a property/variable. Rendered rightmost. + */ + type?: string; +} + export const enum CompletionItemTag { Deprecated = 1 } @@ -394,7 +454,7 @@ export interface CompletionItem { * this is also the text that is inserted when selecting * this completion. */ - label: string; + label: string | CompletionItemLabel; /** * The kind of this completion item. Based on the kind * an icon is chosen by the editor. @@ -434,7 +494,7 @@ export interface CompletionItem { preselect?: boolean; /** * A string or snippet that should be inserted in a document when selecting - * this completion. + * this completion. When `falsy` the [label](#CompletionItem.label) * is used. */ insertText: string; @@ -546,13 +606,14 @@ export interface CodeAction { diagnostics?: IMarkerData[]; kind?: string; isPreferred?: boolean; + disabled?: string; } /** * @internal */ -export const enum CodeActionTrigger { - Automatic = 1, +export const enum CodeActionTriggerType { + Auto = 1, Manual = 2, } @@ -561,7 +622,7 @@ export const enum CodeActionTrigger { */ export interface CodeActionContext { only?: string; - trigger: CodeActionTrigger; + trigger: CodeActionTriggerType; } export interface CodeActionList extends IDisposable { @@ -574,6 +635,9 @@ export interface CodeActionList extends IDisposable { * @internal */ export interface CodeActionProvider { + + displayName?: string + /** * Provide commands for the given document and range. */ @@ -582,7 +646,14 @@ export interface CodeActionProvider { /** * Optional list of CodeActionKinds that this provider returns. */ - providedCodeActionKinds?: ReadonlyArray; + readonly providedCodeActionKinds?: ReadonlyArray; + + readonly documentation?: ReadonlyArray<{ readonly kind: string, readonly command: Command }>; + + /** + * @internal + */ + _getAdditionalMenuItems?(context: CodeActionContext, actions: readonly CodeAction[]): Command[]; } /** @@ -1231,31 +1302,57 @@ export class FoldingRangeKind { /** * @internal */ -export function isResourceFileEdit(thing: any): thing is ResourceFileEdit { - return isObject(thing) && (Boolean((thing).newUri) || Boolean((thing).oldUri)); +export namespace WorkspaceFileEdit { + /** + * @internal + */ + export function is(thing: any): thing is WorkspaceFileEdit { + return isObject(thing) && (Boolean((thing).newUri) || Boolean((thing).oldUri)); + } } /** * @internal */ -export function isResourceTextEdit(thing: any): thing is ResourceTextEdit { - return isObject(thing) && (thing).resource && Array.isArray((thing).edits); +export namespace WorkspaceTextEdit { + /** + * @internal + */ + export function is(thing: any): thing is WorkspaceTextEdit { + return isObject(thing) && URI.isUri((thing).resource) && isObject((thing).edit); + } +} + +export interface WorkspaceEditMetadata { + needsConfirmation: boolean; + label: string; + description?: string; + iconPath?: { id: string } | URI | { light: URI, dark: URI }; +} + +export interface WorkspaceFileEditOptions { + overwrite?: boolean; + ignoreIfNotExists?: boolean; + ignoreIfExists?: boolean; + recursive?: boolean; } -export interface ResourceFileEdit { - oldUri: URI; - newUri: URI; - options: { overwrite?: boolean, ignoreIfNotExists?: boolean, ignoreIfExists?: boolean, recursive?: boolean }; +export interface WorkspaceFileEdit { + oldUri?: URI; + newUri?: URI; + options?: WorkspaceFileEditOptions; + metadata?: WorkspaceEditMetadata; } -export interface ResourceTextEdit { +export interface WorkspaceTextEdit { resource: URI; + edit: TextEdit; modelVersionId?: number; - edits: TextEdit[]; + metadata?: WorkspaceEditMetadata; } export interface WorkspaceEdit { - edits: Array; + edits: Array; } export interface Rejection { @@ -1271,6 +1368,14 @@ export interface RenameProvider { resolveRenameLocation?(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult; } +/** + * @internal + */ +export interface AuthenticationSession { + id: string; + accessToken(): Promise; + accountName: string; +} export interface Command { id: string; @@ -1462,6 +1567,38 @@ export interface CodeLensProvider { resolveCodeLens?(model: model.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult; } +export interface SemanticTokensLegend { + readonly tokenTypes: string[]; + readonly tokenModifiers: string[]; +} + +export interface SemanticTokens { + readonly resultId?: string; + readonly data: Uint32Array; +} + +export interface SemanticTokensEdit { + readonly start: number; + readonly deleteCount: number; + readonly data?: Uint32Array; +} + +export interface SemanticTokensEdits { + readonly resultId?: string; + readonly edits: SemanticTokensEdit[]; +} + +export interface DocumentSemanticTokensProvider { + getLegend(): SemanticTokensLegend; + provideDocumentSemanticTokens(model: model.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult; + releaseDocumentSemanticTokens(resultId: string | undefined): void; +} + +export interface DocumentRangeSemanticTokensProvider { + getLegend(): SemanticTokensLegend; + provideDocumentRangeSemanticTokens(model: model.ITextModel, range: Range, token: CancellationToken): ProviderResult; +} + // --- feature registries ------ /** @@ -1489,6 +1626,11 @@ export const SignatureHelpProviderRegistry = new LanguageFeatureRegistry(); +/** + * @internal + */ +export const EvaluatableExpressionProviderRegistry = new LanguageFeatureRegistry(); + /** * @internal */ @@ -1564,6 +1706,16 @@ export const SelectionRangeRegistry = new LanguageFeatureRegistry(); +/** + * @internal + */ +export const DocumentSemanticTokensProviderRegistry = new LanguageFeatureRegistry(); + +/** + * @internal + */ +export const DocumentRangeSemanticTokensProviderRegistry = new LanguageFeatureRegistry(); + /** * @internal */ diff --git a/src/vs/editor/common/modes/languageConfiguration.ts b/src/vs/editor/common/modes/languageConfiguration.ts index 686c7a0dab200..98a3984944417 100644 --- a/src/vs/editor/common/modes/languageConfiguration.ts +++ b/src/vs/editor/common/modes/languageConfiguration.ts @@ -228,6 +228,28 @@ export interface EnterAction { removeText?: number; } +/** + * @internal + */ +export interface CompleteEnterAction { + /** + * Describe what to do with the indentation. + */ + indentAction: IndentAction; + /** + * Describes text to be appended after the new line and after the indentation. + */ + appendText: string; + /** + * Describes the number of characters to remove from the new line's indentation. + */ + removeText: number; + /** + * The line's indentation minus removeText + */ + indentation: string; +} + /** * @internal */ diff --git a/src/vs/editor/common/modes/languageConfigurationRegistry.ts b/src/vs/editor/common/modes/languageConfigurationRegistry.ts index cee0469e30e0e..daadeebb57e1f 100644 --- a/src/vs/editor/common/modes/languageConfigurationRegistry.ts +++ b/src/vs/editor/common/modes/languageConfigurationRegistry.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { onUnexpectedError } from 'vs/base/common/errors'; import { Emitter, Event } from 'vs/base/common/event'; import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import * as strings from 'vs/base/common/strings'; @@ -12,13 +11,14 @@ import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; import { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper'; import { LanguageId, LanguageIdentifier } from 'vs/editor/common/modes'; -import { EnterAction, FoldingRules, IAutoClosingPair, IndentAction, IndentationRule, LanguageConfiguration, StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration'; -import { createScopedLineTokens } from 'vs/editor/common/modes/supports'; +import { EnterAction, FoldingRules, IAutoClosingPair, IndentAction, IndentationRule, LanguageConfiguration, StandardAutoClosingPairConditional, CompleteEnterAction } from 'vs/editor/common/modes/languageConfiguration'; +import { createScopedLineTokens, ScopedLineTokens } from 'vs/editor/common/modes/supports'; import { CharacterPairSupport } from 'vs/editor/common/modes/supports/characterPair'; import { BracketElectricCharacterSupport, IElectricAction } from 'vs/editor/common/modes/supports/electricCharacter'; import { IndentConsts, IndentRulesSupport } from 'vs/editor/common/modes/supports/indentRules'; -import { IOnEnterSupportOptions, OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter'; +import { OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter'; import { RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; /** * Interface used to support insertion of mode specific comments. @@ -48,11 +48,11 @@ export class RichEditSupport { private readonly _languageIdentifier: LanguageIdentifier; private _brackets: RichEditBrackets | null; private _electricCharacter: BracketElectricCharacterSupport | null; + private readonly _onEnterSupport: OnEnterSupport | null; public readonly comments: ICommentsConfiguration | null; public readonly characterPair: CharacterPairSupport; public readonly wordDefinition: RegExp; - public readonly onEnter: OnEnterSupport | null; public readonly indentRulesSupport: IndentRulesSupport | null; public readonly indentationRules: IndentationRule | undefined; public readonly foldingRules: FoldingRules; @@ -70,8 +70,7 @@ export class RichEditSupport { this._conf = RichEditSupport._mergeConf(prev, rawConf); - this.onEnter = RichEditSupport._handleOnEnter(this._conf); - + this._onEnterSupport = (this._conf.brackets || this._conf.indentationRules || this._conf.onEnterRules ? new OnEnterSupport(this._conf) : null); this.comments = RichEditSupport._handleComments(this._conf); this.characterPair = new CharacterPairSupport(this._conf); @@ -102,6 +101,13 @@ export class RichEditSupport { return this._electricCharacter; } + public onEnter(autoIndent: EditorAutoIndentStrategy, oneLineAboveText: string, beforeEnterText: string, afterEnterText: string): EnterAction | null { + if (!this._onEnterSupport) { + return null; + } + return this._onEnterSupport.onEnter(autoIndent, oneLineAboveText, beforeEnterText, afterEnterText); + } + private static _mergeConf(prev: LanguageConfiguration | null, current: LanguageConfiguration): LanguageConfiguration { return { comments: (prev ? current.comments || prev.comments : current.comments), @@ -117,29 +123,6 @@ export class RichEditSupport { }; } - private static _handleOnEnter(conf: LanguageConfiguration): OnEnterSupport | null { - // on enter - let onEnter: IOnEnterSupportOptions = {}; - let empty = true; - - if (conf.brackets) { - empty = false; - onEnter.brackets = conf.brackets; - } - if (conf.indentationRules) { - empty = false; - } - if (conf.onEnterRules) { - empty = false; - onEnter.regExpRules = conf.onEnterRules; - } - - if (!empty) { - return new OnEnterSupport(onEnter); - } - return null; - } - private static _handleComments(conf: LanguageConfiguration): ICommentsConfiguration | null { let commentRule = conf.comments; if (!commentRule) { @@ -170,7 +153,7 @@ export class LanguageConfigurationChangeEvent { export class LanguageConfigurationRegistryImpl { - private readonly _entries = new Map(); + private readonly _entries = new Map(); private readonly _onDidChange = new Emitter(); public readonly onDidChange: Event = this._onDidChange.event; @@ -291,6 +274,16 @@ export class LanguageConfigurationRegistryImpl { return ensureValidWordDefinition(value.wordDefinition || null); } + public getWordDefinitions(): [LanguageId, RegExp][] { + let result: [LanguageId, RegExp][] = []; + this._entries.forEach((value, language) => { + if (value) { + result.push([language, value.wordDefinition]); + } + }); + return result; + } + public getFoldingRules(languageId: LanguageId): FoldingRules { let value = this._getRichEditSupport(languageId); if (!value) { @@ -351,8 +344,12 @@ export class LanguageConfigurationRegistryImpl { * * This function only return the inherited indent based on above lines, it doesn't check whether current line should decrease or not. */ - public getInheritIndentForLine(model: IVirtualModel, lineNumber: number, honorIntentialIndent: boolean = true): { indentation: string; action: IndentAction | null; line?: number; } | null { - let indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id); + public getInheritIndentForLine(autoIndent: EditorAutoIndentStrategy, model: IVirtualModel, lineNumber: number, honorIntentialIndent: boolean = true): { indentation: string; action: IndentAction | null; line?: number; } | null { + if (autoIndent < EditorAutoIndentStrategy.Full) { + return null; + } + + const indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id); if (!indentRulesSupport) { return null; } @@ -364,7 +361,7 @@ export class LanguageConfigurationRegistryImpl { }; } - let precedingUnIgnoredLine = this.getPrecedingValidLine(model, lineNumber, indentRulesSupport); + const precedingUnIgnoredLine = this.getPrecedingValidLine(model, lineNumber, indentRulesSupport); if (precedingUnIgnoredLine < 0) { return null; } else if (precedingUnIgnoredLine < 1) { @@ -374,8 +371,7 @@ export class LanguageConfigurationRegistryImpl { }; } - let precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine); - + const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine); if (indentRulesSupport.shouldIncrease(precedingUnIgnoredLineContent) || indentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLineContent)) { return { indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent), @@ -402,9 +398,9 @@ export class LanguageConfigurationRegistryImpl { }; } - let previousLine = precedingUnIgnoredLine - 1; + const previousLine = precedingUnIgnoredLine - 1; - let previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine)); + const previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine)); if (!(previousLineIndentMetadata & (IndentConsts.INCREASE_MASK | IndentConsts.DECREASE_MASK)) && (previousLineIndentMetadata & IndentConsts.INDENT_NEXTLINE_MASK)) { let stopLine = 0; @@ -432,7 +428,7 @@ export class LanguageConfigurationRegistryImpl { } else { // search from precedingUnIgnoredLine until we find one whose indent is not temporary for (let i = precedingUnIgnoredLine; i > 0; i--) { - let lineContent = model.getLineContent(i); + const lineContent = model.getLineContent(i); if (indentRulesSupport.shouldIncrease(lineContent)) { return { indentation: strings.getLeadingWhitespace(lineContent), @@ -472,27 +468,28 @@ export class LanguageConfigurationRegistryImpl { } } - public getGoodIndentForLine(virtualModel: IVirtualModel, languageId: LanguageId, lineNumber: number, indentConverter: IIndentConverter): string | null { - let indentRulesSupport = this.getIndentRulesSupport(languageId); + public getGoodIndentForLine(autoIndent: EditorAutoIndentStrategy, virtualModel: IVirtualModel, languageId: LanguageId, lineNumber: number, indentConverter: IIndentConverter): string | null { + if (autoIndent < EditorAutoIndentStrategy.Full) { + return null; + } + + const richEditSupport = this._getRichEditSupport(languageId); + if (!richEditSupport) { + return null; + } + + const indentRulesSupport = this.getIndentRulesSupport(languageId); if (!indentRulesSupport) { return null; } - let indent = this.getInheritIndentForLine(virtualModel, lineNumber); - let lineContent = virtualModel.getLineContent(lineNumber); + const indent = this.getInheritIndentForLine(autoIndent, virtualModel, lineNumber); + const lineContent = virtualModel.getLineContent(lineNumber); if (indent) { - let inheritLine = indent.line; + const inheritLine = indent.line; if (inheritLine !== undefined) { - let onEnterSupport = this._getOnEnterSupport(languageId); - let enterResult: EnterAction | null = null; - try { - if (onEnterSupport) { - enterResult = onEnterSupport.onEnter('', virtualModel.getLineContent(inheritLine), ''); - } - } catch (e) { - onUnexpectedError(e); - } + const enterResult = richEditSupport.onEnter(autoIndent, '', virtualModel.getLineContent(inheritLine), ''); if (enterResult) { let indentation = strings.getLeadingWhitespace(virtualModel.getLineContent(inheritLine)); @@ -539,16 +536,17 @@ export class LanguageConfigurationRegistryImpl { return null; } - public getIndentForEnter(model: ITextModel, range: Range, indentConverter: IIndentConverter, autoIndent: boolean): { beforeEnter: string, afterEnter: string } | null { + public getIndentForEnter(autoIndent: EditorAutoIndentStrategy, model: ITextModel, range: Range, indentConverter: IIndentConverter): { beforeEnter: string, afterEnter: string } | null { + if (autoIndent < EditorAutoIndentStrategy.Full) { + return null; + } model.forceTokenization(range.startLineNumber); - let lineTokens = model.getLineTokens(range.startLineNumber); - - let beforeEnterText; - let afterEnterText; - let scopedLineTokens = createScopedLineTokens(lineTokens, range.startColumn - 1); - let scopedLineText = scopedLineTokens.getLineContent(); + const lineTokens = model.getLineTokens(range.startLineNumber); + const scopedLineTokens = createScopedLineTokens(lineTokens, range.startColumn - 1); + const scopedLineText = scopedLineTokens.getLineContent(); let embeddedLanguage = false; + let beforeEnterText: string; if (scopedLineTokens.firstCharOffset > 0 && lineTokens.getLanguageId(0) !== scopedLineTokens.languageId) { // we are in the embeded language content embeddedLanguage = true; // if embeddedLanguage is true, then we don't touch the indentation of current line @@ -557,6 +555,7 @@ export class LanguageConfigurationRegistryImpl { beforeEnterText = lineTokens.getLineContent().substring(0, range.startColumn - 1); } + let afterEnterText: string; if (range.isEmpty()) { afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset); } else { @@ -564,31 +563,15 @@ export class LanguageConfigurationRegistryImpl { afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset); } - let indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId); - + const indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId); if (!indentRulesSupport) { return null; } - let beforeEnterResult = beforeEnterText; - let beforeEnterIndent = strings.getLeadingWhitespace(beforeEnterText); - - if (!autoIndent && !embeddedLanguage) { - let beforeEnterIndentAction = this.getInheritIndentForLine(model, range.startLineNumber); + const beforeEnterResult = beforeEnterText; + const beforeEnterIndent = strings.getLeadingWhitespace(beforeEnterText); - if (indentRulesSupport.shouldDecrease(beforeEnterText)) { - if (beforeEnterIndentAction) { - beforeEnterIndent = beforeEnterIndentAction.indentation; - if (beforeEnterIndentAction.action !== IndentAction.Indent) { - beforeEnterIndent = indentConverter.unshiftIndent(beforeEnterIndent); - } - } - } - - beforeEnterResult = beforeEnterIndent + strings.ltrim(strings.ltrim(beforeEnterText, ' '), '\t'); - } - - let virtualModel: IVirtualModel = { + const virtualModel: IVirtualModel = { getLineTokens: (lineNumber: number) => { return model.getLineTokens(lineNumber); }, @@ -607,10 +590,10 @@ export class LanguageConfigurationRegistryImpl { } }; - let currentLineIndent = strings.getLeadingWhitespace(lineTokens.getLineContent()); - let afterEnterAction = this.getInheritIndentForLine(virtualModel, range.startLineNumber + 1); + const currentLineIndent = strings.getLeadingWhitespace(lineTokens.getLineContent()); + const afterEnterAction = this.getInheritIndentForLine(autoIndent, virtualModel, range.startLineNumber + 1); if (!afterEnterAction) { - let beforeEnter = embeddedLanguage ? currentLineIndent : beforeEnterIndent; + const beforeEnter = embeddedLanguage ? currentLineIndent : beforeEnterIndent; return { beforeEnter: beforeEnter, afterEnter: beforeEnter @@ -637,18 +620,21 @@ export class LanguageConfigurationRegistryImpl { * We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of * this line doesn't match decreaseIndentPattern, we should not adjust the indentation. */ - public getIndentActionForType(model: ITextModel, range: Range, ch: string, indentConverter: IIndentConverter): string | null { - let scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn); - let indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId); + public getIndentActionForType(autoIndent: EditorAutoIndentStrategy, model: ITextModel, range: Range, ch: string, indentConverter: IIndentConverter): string | null { + if (autoIndent < EditorAutoIndentStrategy.Full) { + return null; + } + const scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn); + const indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId); if (!indentRulesSupport) { return null; } - let scopedLineText = scopedLineTokens.getLineContent(); - let beforeTypeText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset); - let afterTypeText; + const scopedLineText = scopedLineTokens.getLineContent(); + const beforeTypeText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset); // selection support + let afterTypeText: string; if (range.isEmpty()) { afterTypeText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset); } else { @@ -661,13 +647,12 @@ export class LanguageConfigurationRegistryImpl { if (!indentRulesSupport.shouldDecrease(beforeTypeText + afterTypeText) && indentRulesSupport.shouldDecrease(beforeTypeText + ch + afterTypeText)) { // after typing `ch`, the content matches decreaseIndentPattern, we should adjust the indent to a good manner. // 1. Get inherited indent action - let r = this.getInheritIndentForLine(model, range.startLineNumber, false); + const r = this.getInheritIndentForLine(autoIndent, model, range.startLineNumber, false); if (!r) { return null; } let indentation = r.indentation; - if (r.action !== IndentAction.Indent) { indentation = indentConverter.unshiftIndent(indentation); } @@ -679,15 +664,13 @@ export class LanguageConfigurationRegistryImpl { } public getIndentMetadata(model: ITextModel, lineNumber: number): number | null { - let indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id); + const indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id); if (!indentRulesSupport) { return null; } - if (lineNumber < 1 || lineNumber > model.getLineCount()) { return null; } - return indentRulesSupport.getIndentMetadata(model.getLineContent(lineNumber)); } @@ -695,34 +678,18 @@ export class LanguageConfigurationRegistryImpl { // begin onEnter - private _getOnEnterSupport(languageId: LanguageId): OnEnterSupport | null { - let value = this._getRichEditSupport(languageId); - if (!value) { + public getEnterAction(autoIndent: EditorAutoIndentStrategy, model: ITextModel, range: Range): CompleteEnterAction | null { + const scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn); + const richEditSupport = this._getRichEditSupport(scopedLineTokens.languageId); + if (!richEditSupport) { return null; } - return value.onEnter || null; - } - public getRawEnterActionAtPosition(model: ITextModel, lineNumber: number, column: number): EnterAction | null { - let r = this.getEnterAction(model, new Range(lineNumber, column, lineNumber, column)); - - return r ? r.enterAction : null; - } - - public getEnterAction(model: ITextModel, range: Range): { enterAction: EnterAction; indentation: string; } | null { - let indentation = this.getIndentationAtPosition(model, range.startLineNumber, range.startColumn); - - let scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn); - let onEnterSupport = this._getOnEnterSupport(scopedLineTokens.languageId); - if (!onEnterSupport) { - return null; - } - - let scopedLineText = scopedLineTokens.getLineContent(); - let beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset); - let afterEnterText; + const scopedLineText = scopedLineTokens.getLineContent(); + const beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset); // selection support + let afterEnterText: string; if (range.isEmpty()) { afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset); } else { @@ -730,73 +697,70 @@ export class LanguageConfigurationRegistryImpl { afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset); } - let lineNumber = range.startLineNumber; let oneLineAboveText = ''; - - if (lineNumber > 1 && scopedLineTokens.firstCharOffset === 0) { + if (range.startLineNumber > 1 && scopedLineTokens.firstCharOffset === 0) { // This is not the first line and the entire line belongs to this mode - let oneLineAboveScopedLineTokens = this.getScopedLineTokens(model, lineNumber - 1); + const oneLineAboveScopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber - 1); if (oneLineAboveScopedLineTokens.languageId === scopedLineTokens.languageId) { // The line above ends with text belonging to the same mode oneLineAboveText = oneLineAboveScopedLineTokens.getLineContent(); } } - let enterResult: EnterAction | null = null; - try { - enterResult = onEnterSupport.onEnter(oneLineAboveText, beforeEnterText, afterEnterText); - } catch (e) { - onUnexpectedError(e); - } - + const enterResult = richEditSupport.onEnter(autoIndent, oneLineAboveText, beforeEnterText, afterEnterText); if (!enterResult) { return null; - } else { - // Here we add `\t` to appendText first because enterAction is leveraging appendText and removeText to change indentation. - if (!enterResult.appendText) { - if ( - (enterResult.indentAction === IndentAction.Indent) || - (enterResult.indentAction === IndentAction.IndentOutdent) - ) { - enterResult.appendText = '\t'; - } else { - enterResult.appendText = ''; - } + } + + const indentAction = enterResult.indentAction; + let appendText = enterResult.appendText; + const removeText = enterResult.removeText || 0; + + // Here we add `\t` to appendText first because enterAction is leveraging appendText and removeText to change indentation. + if (!appendText) { + if ( + (indentAction === IndentAction.Indent) || + (indentAction === IndentAction.IndentOutdent) + ) { + appendText = '\t'; + } else { + appendText = ''; } } - if (enterResult.removeText) { - indentation = indentation.substring(0, indentation.length - enterResult.removeText); + let indentation = this.getIndentationAtPosition(model, range.startLineNumber, range.startColumn); + if (removeText) { + indentation = indentation.substring(0, indentation.length - removeText); } return { - enterAction: enterResult, - indentation: indentation, + indentAction: indentAction, + appendText: appendText, + removeText: removeText, + indentation: indentation }; } public getIndentationAtPosition(model: ITextModel, lineNumber: number, column: number): string { - let lineText = model.getLineContent(lineNumber); + const lineText = model.getLineContent(lineNumber); let indentation = strings.getLeadingWhitespace(lineText); if (indentation.length > column - 1) { indentation = indentation.substring(0, column - 1); } - return indentation; } - private getScopedLineTokens(model: ITextModel, lineNumber: number, columnNumber?: number) { + private getScopedLineTokens(model: ITextModel, lineNumber: number, columnNumber?: number): ScopedLineTokens { model.forceTokenization(lineNumber); - let lineTokens = model.getLineTokens(lineNumber); - let column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1); - let scopedLineTokens = createScopedLineTokens(lineTokens, column); - return scopedLineTokens; + const lineTokens = model.getLineTokens(lineNumber); + const column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1); + return createScopedLineTokens(lineTokens, column); } // end onEnter public getBracketsSupport(languageId: LanguageId): RichEditBrackets | null { - let value = this._getRichEditSupport(languageId); + const value = this._getRichEditSupport(languageId); if (!value) { return null; } diff --git a/src/vs/editor/common/modes/linkComputer.ts b/src/vs/editor/common/modes/linkComputer.ts index 9d38173653648..f3097d5f6f429 100644 --- a/src/vs/editor/common/modes/linkComputer.ts +++ b/src/vs/editor/common/modes/linkComputer.ts @@ -223,6 +223,7 @@ export class LinkComputer { let state = State.Start; let hasOpenParens = false; let hasOpenSquareBracket = false; + let inSquareBrackets = false; let hasOpenCurlyBracket = false; while (j < len) { @@ -241,10 +242,12 @@ export class LinkComputer { chClass = (hasOpenParens ? CharacterClass.None : CharacterClass.ForceTermination); break; case CharCode.OpenSquareBracket: + inSquareBrackets = true; hasOpenSquareBracket = true; chClass = CharacterClass.None; break; case CharCode.CloseSquareBracket: + inSquareBrackets = false; chClass = (hasOpenSquareBracket ? CharacterClass.None : CharacterClass.ForceTermination); break; case CharCode.OpenCurlyBrace: @@ -268,6 +271,14 @@ export class LinkComputer { // `*` terminates a link if the link began with `*` chClass = (linkBeginChCode === CharCode.Asterisk) ? CharacterClass.ForceTermination : CharacterClass.None; break; + case CharCode.Pipe: + // `|` terminates a link if the link began with `|` + chClass = (linkBeginChCode === CharCode.Pipe) ? CharacterClass.ForceTermination : CharacterClass.None; + break; + case CharCode.Space: + // ` ` allow space in between [ and ] + chClass = (inSquareBrackets ? CharacterClass.None : CharacterClass.ForceTermination); + break; default: chClass = classifier.get(chCode); } diff --git a/src/vs/editor/common/modes/supports.ts b/src/vs/editor/common/modes/supports.ts index b8cb5201ca770..f6de5f27172f5 100644 --- a/src/vs/editor/common/modes/supports.ts +++ b/src/vs/editor/common/modes/supports.ts @@ -62,6 +62,11 @@ export class ScopedLineTokens { return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset); } + public getActualLineContentBefore(offset: number): string { + const actualLineContent = this._actual.getLineContent(); + return actualLineContent.substring(0, this.firstCharOffset + offset); + } + public getTokenCount(): number { return this._lastTokenIndex - this._firstTokenIndex; } diff --git a/src/vs/editor/common/modes/supports/electricCharacter.ts b/src/vs/editor/common/modes/supports/electricCharacter.ts index 9dee3d4ac889a..ead8e6da3a68a 100644 --- a/src/vs/editor/common/modes/supports/electricCharacter.ts +++ b/src/vs/editor/common/modes/supports/electricCharacter.ts @@ -49,28 +49,27 @@ export class BracketElectricCharacterSupport { return null; } - let tokenIndex = context.findTokenIndexAtOffset(column - 1); + const tokenIndex = context.findTokenIndexAtOffset(column - 1); if (ignoreBracketsInToken(context.getStandardTokenType(tokenIndex))) { return null; } - let reversedBracketRegex = this._richEditBrackets.reversedRegex; - let text = context.getLineContent().substring(0, column - 1) + character; + const reversedBracketRegex = this._richEditBrackets.reversedRegex; + const text = context.getLineContent().substring(0, column - 1) + character; - let r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length); + const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length); if (!r) { return null; } - let bracketText = text.substring(r.startColumn - 1, r.endColumn - 1); - bracketText = bracketText.toLowerCase(); + const bracketText = text.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase(); - let isOpen = this._richEditBrackets.textIsOpenBracket[bracketText]; + const isOpen = this._richEditBrackets.textIsOpenBracket[bracketText]; if (isOpen) { return null; } - let textBeforeBracket = text.substring(0, r.startColumn - 1); + const textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1); if (!/^\s*$/.test(textBeforeBracket)) { // There is other text on the line before the bracket return null; diff --git a/src/vs/editor/common/modes/supports/onEnter.ts b/src/vs/editor/common/modes/supports/onEnter.ts index 6021d4bf8e377..f42cc4a4da22e 100644 --- a/src/vs/editor/common/modes/supports/onEnter.ts +++ b/src/vs/editor/common/modes/supports/onEnter.ts @@ -6,10 +6,11 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import * as strings from 'vs/base/common/strings'; import { CharacterPair, EnterAction, IndentAction, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; export interface IOnEnterSupportOptions { brackets?: CharacterPair[]; - regExpRules?: OnEnterRule[]; + onEnterRules?: OnEnterRule[]; } interface IProcessedBracketPair { @@ -24,7 +25,7 @@ export class OnEnterSupport { private readonly _brackets: IProcessedBracketPair[]; private readonly _regExpRules: OnEnterRule[]; - constructor(opts?: IOnEnterSupportOptions) { + constructor(opts: IOnEnterSupportOptions) { opts = opts || {}; opts.brackets = opts.brackets || [ ['(', ')'], @@ -45,49 +46,54 @@ export class OnEnterSupport { }); } }); - this._regExpRules = opts.regExpRules || []; + this._regExpRules = opts.onEnterRules || []; } - public onEnter(oneLineAboveText: string, beforeEnterText: string, afterEnterText: string): EnterAction | null { + public onEnter(autoIndent: EditorAutoIndentStrategy, oneLineAboveText: string, beforeEnterText: string, afterEnterText: string): EnterAction | null { // (1): `regExpRules` - for (let i = 0, len = this._regExpRules.length; i < len; i++) { - let rule = this._regExpRules[i]; - const regResult = [{ - reg: rule.beforeText, - text: beforeEnterText - }, { - reg: rule.afterText, - text: afterEnterText - }, { - reg: rule.oneLineAboveText, - text: oneLineAboveText - }].every((obj): boolean => { - return obj.reg ? obj.reg.test(obj.text) : true; - }); - - if (regResult) { - return rule.action; + if (autoIndent >= EditorAutoIndentStrategy.Advanced) { + for (let i = 0, len = this._regExpRules.length; i < len; i++) { + let rule = this._regExpRules[i]; + const regResult = [{ + reg: rule.beforeText, + text: beforeEnterText + }, { + reg: rule.afterText, + text: afterEnterText + }, { + reg: rule.oneLineAboveText, + text: oneLineAboveText + }].every((obj): boolean => { + return obj.reg ? obj.reg.test(obj.text) : true; + }); + + if (regResult) { + return rule.action; + } } } - // (2): Special indent-outdent - if (beforeEnterText.length > 0 && afterEnterText.length > 0) { - for (let i = 0, len = this._brackets.length; i < len; i++) { - let bracket = this._brackets[i]; - if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) { - return { indentAction: IndentAction.IndentOutdent }; + if (autoIndent >= EditorAutoIndentStrategy.Brackets) { + if (beforeEnterText.length > 0 && afterEnterText.length > 0) { + for (let i = 0, len = this._brackets.length; i < len; i++) { + let bracket = this._brackets[i]; + if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) { + return { indentAction: IndentAction.IndentOutdent }; + } } } } // (4): Open bracket based logic - if (beforeEnterText.length > 0) { - for (let i = 0, len = this._brackets.length; i < len; i++) { - let bracket = this._brackets[i]; - if (bracket.openRegExp.test(beforeEnterText)) { - return { indentAction: IndentAction.Indent }; + if (autoIndent >= EditorAutoIndentStrategy.Brackets) { + if (beforeEnterText.length > 0) { + for (let i = 0, len = this._brackets.length; i < len; i++) { + let bracket = this._brackets[i]; + if (bracket.openRegExp.test(beforeEnterText)) { + return { indentAction: IndentAction.Indent }; + } } } } diff --git a/src/vs/editor/common/modes/textToHtmlTokenizer.ts b/src/vs/editor/common/modes/textToHtmlTokenizer.ts index e98f2b37f1952..c8c4acac43090 100644 --- a/src/vs/editor/common/modes/textToHtmlTokenizer.ts +++ b/src/vs/editor/common/modes/textToHtmlTokenizer.ts @@ -46,7 +46,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize; tabsCharDelta += insertSpacesCount - 1; while (insertSpacesCount > 0) { - partContent += useNbsp ? ' ' : ' '; + partContent += useNbsp ? ' ' : ' '; insertSpacesCount--; } break; @@ -78,7 +78,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens break; case CharCode.Space: - partContent += useNbsp ? ' ' : ' '; + partContent += useNbsp ? ' ' : ' '; break; default: diff --git a/src/vs/editor/common/services/editorSimpleWorker.ts b/src/vs/editor/common/services/editorSimpleWorker.ts index 01ca792e4970d..3e5361ce764c6 100644 --- a/src/vs/editor/common/services/editorSimpleWorker.ts +++ b/src/vs/editor/common/services/editorSimpleWorker.ts @@ -13,7 +13,7 @@ import { IRequestHandler } from 'vs/base/common/worker/simpleWorker'; import { IPosition, Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { DiffComputer } from 'vs/editor/common/diff/diffComputer'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IChange } from 'vs/editor/common/editorCommon'; import { EndOfLineSequence, IWordAtPosition } from 'vs/editor/common/model'; import { IModelChangedEvent, MirrorTextModel as BaseMirrorModel } from 'vs/editor/common/model/mirrorTextModel'; import { ensureValidWordDefinition, getWordAtText } from 'vs/editor/common/model/wordHelper'; @@ -322,7 +322,7 @@ export interface IForeignModuleFactory { (ctx: IWorkerContext, createData: any): any; } -declare var require: any; +declare const require: any; /** * @internal @@ -419,7 +419,7 @@ export class EditorSimpleWorker implements IRequestHandler, IDisposable { return true; } - public async computeDirtyDiff(originalUrl: string, modifiedUrl: string, ignoreTrimWhitespace: boolean): Promise { + public async computeDirtyDiff(originalUrl: string, modifiedUrl: string, ignoreTrimWhitespace: boolean): Promise { let original = this._getModel(originalUrl); let modified = this._getModel(modifiedUrl); if (!original || !modified) { diff --git a/src/vs/editor/common/services/editorWorkerServiceImpl.ts b/src/vs/editor/common/services/editorWorkerServiceImpl.ts index f2061ba0b4c27..0afaa0abca4f7 100644 --- a/src/vs/editor/common/services/editorWorkerServiceImpl.ts +++ b/src/vs/editor/common/services/editorWorkerServiceImpl.ts @@ -10,14 +10,14 @@ import { SimpleWorkerClient, logOnceWebWorkerWarning, IWorkerClient } from 'vs/b import { DefaultWorkerFactory } from 'vs/base/worker/defaultWorkerFactory'; import { IPosition, Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IChange } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; import * as modes from 'vs/editor/common/modes'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { EditorSimpleWorker } from 'vs/editor/common/services/editorSimpleWorker'; import { IDiffComputationResult, IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; +import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService'; import { regExpFlags } from 'vs/base/common/strings'; import { isNonEmptyArray } from 'vs/base/common/arrays'; import { ILogService } from 'vs/platform/log/common/log'; @@ -45,11 +45,13 @@ function canSyncModel(modelService: IModelService, resource: URI): boolean { } export class EditorWorkerServiceImpl extends Disposable implements IEditorWorkerService { - public _serviceBrand: undefined; + + _serviceBrand: undefined; private readonly _modelService: IModelService; private readonly _workerManager: WorkerManager; private readonly _logService: ILogService; + constructor( @IModelService modelService: IModelService, @ITextResourceConfigurationService configurationService: ITextResourceConfigurationService, @@ -60,7 +62,7 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker this._workerManager = this._register(new WorkerManager(this._modelService)); this._logService = logService; - // todo@joh make sure this happens only once + // register default link-provider and default completions-provider this._register(modes.LinkProviderRegistry.register('*', { provideLinks: (model, token) => { if (!canSyncModel(this._modelService, model.uri)) { @@ -90,7 +92,7 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker return (canSyncModel(this._modelService, original) && canSyncModel(this._modelService, modified)); } - public computeDirtyDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean): Promise { + public computeDirtyDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean): Promise { return this._workerManager.withWorker().then(client => client.computeDirtyDiff(original, modified, ignoreTrimWhitespace)); } @@ -236,7 +238,7 @@ class WorkerManager extends Disposable { public withWorker(): Promise { this._lastWorkerUsedTime = (new Date()).getTime(); if (!this._editorWorkerClient) { - this._editorWorkerClient = new EditorWorkerClient(this._modelService, 'editorWorkerService'); + this._editorWorkerClient = new EditorWorkerClient(this._modelService, false, 'editorWorkerService'); } return Promise.resolve(this._editorWorkerClient); } @@ -374,13 +376,15 @@ export class EditorWorkerHost { export class EditorWorkerClient extends Disposable { private readonly _modelService: IModelService; + private readonly _keepIdleModels: boolean; private _worker: IWorkerClient | null; private readonly _workerFactory: DefaultWorkerFactory; private _modelManager: EditorModelManager | null; - constructor(modelService: IModelService, label: string | undefined) { + constructor(modelService: IModelService, keepIdleModels: boolean, label: string | undefined) { super(); this._modelService = modelService; + this._keepIdleModels = keepIdleModels; this._workerFactory = new DefaultWorkerFactory(label); this._worker = null; this._modelManager = null; @@ -417,7 +421,7 @@ export class EditorWorkerClient extends Disposable { private _getOrCreateModelManager(proxy: EditorSimpleWorker): EditorModelManager { if (!this._modelManager) { - this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, false)); + this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, this._keepIdleModels)); } return this._modelManager; } @@ -435,7 +439,7 @@ export class EditorWorkerClient extends Disposable { }); } - public computeDirtyDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean): Promise { + public computeDirtyDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean): Promise { return this._withSyncedResources([original, modified]).then(proxy => { return proxy.computeDirtyDiff(original.toString(), modified.toString(), ignoreTrimWhitespace); }); diff --git a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts index fbf9037fa919f..78820460000b1 100644 --- a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts +++ b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts @@ -17,6 +17,7 @@ import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDeco import { Schemas } from 'vs/base/common/network'; import { Emitter, Event } from 'vs/base/common/event'; import { withUndefinedAsNull } from 'vs/base/common/types'; +import { minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry'; function MODEL_ID(resource: URI): string { return resource.toString(); @@ -37,7 +38,9 @@ class MarkerDecorations extends Disposable { } public update(markers: IMarker[], newDecorations: IModelDeltaDecoration[]): void { - const ids = this.model.deltaDecorations(keys(this._markersData), newDecorations); + const oldIds = keys(this._markersData); + this._markersData.clear(); + const ids = this.model.deltaDecorations(oldIds, newDecorations); for (let index = 0; index < ids.length; index++) { this._markersData.set(ids[index], markers[index]); } @@ -144,12 +147,10 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor let ret = Range.lift(rawMarker); - if (rawMarker.severity === MarkerSeverity.Hint) { - if (!rawMarker.tags || rawMarker.tags.indexOf(MarkerTag.Unnecessary) === -1) { - // * never render hints on multiple lines - // * make enough space for three dots - ret = ret.setEndPosition(ret.startLineNumber, ret.startColumn + 2); - } + if (rawMarker.severity === MarkerSeverity.Hint && !this._hasMarkerTag(rawMarker, MarkerTag.Unnecessary) && !this._hasMarkerTag(rawMarker, MarkerTag.Deprecated)) { + // * never render hints on multiple lines + // * make enough space for three dots + ret = ret.setEndPosition(ret.startLineNumber, ret.startColumn + 2); } ret = model.validateRange(ret); @@ -185,7 +186,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor private _createDecorationOption(marker: IMarker): IModelDecorationOptions { - let className: string; + let className: string | undefined; let color: ThemeColor | undefined = undefined; let zIndex: number; let inlineClassName: string | undefined = undefined; @@ -193,7 +194,9 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor switch (marker.severity) { case MarkerSeverity.Hint: - if (marker.tags && marker.tags.indexOf(MarkerTag.Unnecessary) >= 0) { + if (this._hasMarkerTag(marker, MarkerTag.Deprecated)) { + className = undefined; + } else if (this._hasMarkerTag(marker, MarkerTag.Unnecessary)) { className = ClassName.EditorUnnecessaryDecoration; } else { className = ClassName.EditorHintDecoration; @@ -205,7 +208,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor color = themeColorFromId(overviewRulerWarning); zIndex = 20; minimap = { - color, + color: themeColorFromId(minimapWarning), position: MinimapPosition.Inline }; break; @@ -220,7 +223,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor color = themeColorFromId(overviewRulerError); zIndex = 30; minimap = { - color, + color: themeColorFromId(minimapError), position: MinimapPosition.Inline }; break; @@ -248,4 +251,11 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor inlineClassName, }; } + + private _hasMarkerTag(marker: IMarker, tag: MarkerTag): boolean { + if (marker.tags) { + return marker.tags.indexOf(tag) >= 0; + } + return false; + } } diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 5b5070184eae1..20e32b9d2a71e 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -6,19 +6,30 @@ import { Emitter, Event } from 'vs/base/common/event'; import { Disposable, IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; +import * as errors from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Range } from 'vs/editor/common/core/range'; -import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model'; +import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions, IValidEditOperation } from 'vs/editor/common/model'; import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel'; -import { IModelLanguageChangedEvent } from 'vs/editor/common/model/textModelEvents'; -import { LanguageIdentifier } from 'vs/editor/common/modes'; +import { IModelLanguageChangedEvent, IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents'; +import { LanguageIdentifier, DocumentSemanticTokensProviderRegistry, DocumentSemanticTokensProvider, SemanticTokensLegend, SemanticTokens, SemanticTokensEdits, TokenMetadata, FontStyle, MetadataConsts } from 'vs/editor/common/modes'; import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegistry'; import { ILanguageSelection } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; +import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { RunOnceScheduler } from 'vs/base/common/async'; +import { CancellationTokenSource } from 'vs/base/common/cancellation'; +import { SparseEncodedTokens, MultilineTokens2 } from 'vs/editor/common/model/tokensStore'; +import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { ILogService, LogLevel } from 'vs/platform/log/common/log'; +import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; + +export interface IEditorSemanticHighlightingOptions { + enabled?: boolean; +} function MODEL_ID(resource: URI): string { return resource.toString(); @@ -93,6 +104,7 @@ export class ModelServiceImpl extends Disposable implements IModelService { private readonly _configurationService: IConfigurationService; private readonly _configurationServiceSubscription: IDisposable; private readonly _resourcePropertiesService: ITextResourcePropertiesService; + private readonly _undoRedoService: IUndoRedoService; private readonly _onModelAdded: Emitter = this._register(new Emitter()); public readonly onModelAdded: Event = this._onModelAdded.event; @@ -114,16 +126,22 @@ export class ModelServiceImpl extends Disposable implements IModelService { constructor( @IConfigurationService configurationService: IConfigurationService, - @ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService + @ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService, + @IThemeService themeService: IThemeService, + @ILogService logService: ILogService, + @IUndoRedoService undoRedoService: IUndoRedoService ) { super(); this._configurationService = configurationService; this._resourcePropertiesService = resourcePropertiesService; + this._undoRedoService = undoRedoService; this._models = {}; this._modelCreationOptionsByLanguageAndResource = Object.create(null); this._configurationServiceSubscription = this._configurationService.onDidChangeConfiguration(e => this._updateModelOptions()); this._updateModelOptions(); + + this._register(new SemanticColoringFeature(this, themeService, configurationService, logService)); } private static _readModelOptions(config: IRawConfig, isForSimpleWidget: boolean): ITextModelCreationOptions { @@ -258,7 +276,7 @@ export class ModelServiceImpl extends Disposable implements IModelService { private _createModelData(value: string | ITextBufferFactory, languageIdentifier: LanguageIdentifier, resource: URI | undefined, isForSimpleWidget: boolean): ModelData { // create & save the model const options = this.getCreationOptions(languageIdentifier.language, resource, isForSimpleWidget); - const model: TextModel = new TextModel(value, options, languageIdentifier, resource); + const model: TextModel = new TextModel(value, options, languageIdentifier, resource, this._undoRedoService); const modelId = MODEL_ID(model.uri); if (this._models[modelId]) { @@ -291,7 +309,7 @@ export class ModelServiceImpl extends Disposable implements IModelService { model.pushEditOperations( [], ModelServiceImpl._computeEdits(model, textBuffer), - (inverseEditOperations: IIdentifiedSingleEditOperation[]) => [] + (inverseEditOperations: IValidEditOperation[]) => [] ); model.pushStackElement(); } @@ -430,3 +448,555 @@ export class ModelServiceImpl extends Disposable implements IModelService { export interface ILineSequence { getLineContent(lineNumber: number): string; } + +class SemanticColoringFeature extends Disposable { + + private static readonly SETTING_ID = 'editor.semanticHighlighting'; + + private _watchers: Record; + private _semanticStyling: SemanticStyling; + private _configurationService: IConfigurationService; + + constructor(modelService: IModelService, themeService: IThemeService, configurationService: IConfigurationService, logService: ILogService) { + super(); + this._configurationService = configurationService; + this._watchers = Object.create(null); + this._semanticStyling = this._register(new SemanticStyling(themeService, logService)); + + const isSemanticColoringEnabled = (model: ITextModel) => { + const options = configurationService.getValue(SemanticColoringFeature.SETTING_ID, { overrideIdentifier: model.getLanguageIdentifier().language, resource: model.uri }); + return options && options.enabled; + }; + const register = (model: ITextModel) => { + this._watchers[model.uri.toString()] = new ModelSemanticColoring(model, themeService, this._semanticStyling); + }; + const deregister = (model: ITextModel, modelSemanticColoring: ModelSemanticColoring) => { + modelSemanticColoring.dispose(); + delete this._watchers[model.uri.toString()]; + }; + this._register(modelService.onModelAdded((model) => { + if (isSemanticColoringEnabled(model)) { + register(model); + } + })); + this._register(modelService.onModelRemoved((model) => { + const curr = this._watchers[model.uri.toString()]; + if (curr) { + deregister(model, curr); + } + })); + this._configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration(SemanticColoringFeature.SETTING_ID)) { + for (let model of modelService.getModels()) { + const curr = this._watchers[model.uri.toString()]; + if (isSemanticColoringEnabled(model)) { + if (!curr) { + register(model); + } + } else { + if (curr) { + deregister(model, curr); + } + } + } + } + }); + } +} + +class SemanticStyling extends Disposable { + + private _caches: WeakMap; + + constructor( + private readonly _themeService: IThemeService, + private readonly _logService: ILogService + ) { + super(); + this._caches = new WeakMap(); + if (this._themeService) { + // workaround for tests which use undefined... :/ + this._register(this._themeService.onThemeChange(() => { + this._caches = new WeakMap(); + })); + } + } + + public get(provider: DocumentSemanticTokensProvider): SemanticColoringProviderStyling { + if (!this._caches.has(provider)) { + this._caches.set(provider, new SemanticColoringProviderStyling(provider.getLegend(), this._themeService, this._logService)); + } + return this._caches.get(provider)!; + } +} + +const enum Constants { + NO_STYLING = 0b01111111111111111111111111111111 +} + +class HashTableEntry { + public readonly tokenTypeIndex: number; + public readonly tokenModifierSet: number; + public readonly metadata: number; + public next: HashTableEntry | null; + + constructor(tokenTypeIndex: number, tokenModifierSet: number, metadata: number) { + this.tokenTypeIndex = tokenTypeIndex; + this.tokenModifierSet = tokenModifierSet; + this.metadata = metadata; + this.next = null; + } +} + +class HashTable { + + private static _SIZES = [3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143]; + + private _elementsCount: number; + private _currentLengthIndex: number; + private _currentLength: number; + private _growCount: number; + private _elements: (HashTableEntry | null)[]; + + constructor() { + this._elementsCount = 0; + this._currentLengthIndex = 0; + this._currentLength = HashTable._SIZES[this._currentLengthIndex]; + this._growCount = Math.round(this._currentLengthIndex + 1 < HashTable._SIZES.length ? 2 / 3 * this._currentLength : 0); + this._elements = []; + HashTable._nullOutEntries(this._elements, this._currentLength); + } + + private static _nullOutEntries(entries: (HashTableEntry | null)[], length: number): void { + for (let i = 0; i < length; i++) { + entries[i] = null; + } + } + + private _hashFunc(tokenTypeIndex: number, tokenModifierSet: number): number { + return ((((tokenTypeIndex << 5) - tokenTypeIndex) + tokenModifierSet) | 0) % this._currentLength; // tokenTypeIndex * 31 + tokenModifierSet, keep as int32 + } + + public get(tokenTypeIndex: number, tokenModifierSet: number): HashTableEntry | null { + const hash = this._hashFunc(tokenTypeIndex, tokenModifierSet); + + let p = this._elements[hash]; + while (p) { + if (p.tokenTypeIndex === tokenTypeIndex && p.tokenModifierSet === tokenModifierSet) { + return p; + } + p = p.next; + } + + return null; + } + + public add(tokenTypeIndex: number, tokenModifierSet: number, metadata: number): void { + this._elementsCount++; + if (this._growCount !== 0 && this._elementsCount >= this._growCount) { + // expand! + const oldElements = this._elements; + + this._currentLengthIndex++; + this._currentLength = HashTable._SIZES[this._currentLengthIndex]; + this._growCount = Math.round(this._currentLengthIndex + 1 < HashTable._SIZES.length ? 2 / 3 * this._currentLength : 0); + this._elements = []; + HashTable._nullOutEntries(this._elements, this._currentLength); + + for (const first of oldElements) { + let p = first; + while (p) { + const oldNext = p.next; + p.next = null; + this._add(p); + p = oldNext; + } + } + } + this._add(new HashTableEntry(tokenTypeIndex, tokenModifierSet, metadata)); + } + + private _add(element: HashTableEntry): void { + const hash = this._hashFunc(element.tokenTypeIndex, element.tokenModifierSet); + element.next = this._elements[hash]; + this._elements[hash] = element; + } +} + +class SemanticColoringProviderStyling { + + private readonly _hashTable: HashTable; + + constructor( + private readonly _legend: SemanticTokensLegend, + private readonly _themeService: IThemeService, + private readonly _logService: ILogService + ) { + this._hashTable = new HashTable(); + } + + public getMetadata(tokenTypeIndex: number, tokenModifierSet: number): number { + const entry = this._hashTable.get(tokenTypeIndex, tokenModifierSet); + let metadata: number; + if (entry) { + metadata = entry.metadata; + } else { + const tokenType = this._legend.tokenTypes[tokenTypeIndex]; + const tokenModifiers: string[] = []; + let modifierSet = tokenModifierSet; + for (let modifierIndex = 0; modifierSet > 0 && modifierIndex < this._legend.tokenModifiers.length; modifierIndex++) { + if (modifierSet & 1) { + tokenModifiers.push(this._legend.tokenModifiers[modifierIndex]); + } + modifierSet = modifierSet >> 1; + } + + const tokenStyle = this._themeService.getTheme().getTokenStyleMetadata(tokenType, tokenModifiers); + if (typeof tokenStyle === 'undefined') { + metadata = Constants.NO_STYLING; + } else { + metadata = 0; + if (typeof tokenStyle.italic !== 'undefined') { + const italicBit = (tokenStyle.italic ? FontStyle.Italic : 0) << MetadataConsts.FONT_STYLE_OFFSET; + metadata |= italicBit | MetadataConsts.SEMANTIC_USE_ITALIC; + } + if (typeof tokenStyle.bold !== 'undefined') { + const boldBit = (tokenStyle.bold ? FontStyle.Bold : 0) << MetadataConsts.FONT_STYLE_OFFSET; + metadata |= boldBit | MetadataConsts.SEMANTIC_USE_BOLD; + } + if (typeof tokenStyle.underline !== 'undefined') { + const underlineBit = (tokenStyle.underline ? FontStyle.Underline : 0) << MetadataConsts.FONT_STYLE_OFFSET; + metadata |= underlineBit | MetadataConsts.SEMANTIC_USE_UNDERLINE; + } + if (tokenStyle.foreground) { + const foregroundBits = (tokenStyle.foreground) << MetadataConsts.FOREGROUND_OFFSET; + metadata |= foregroundBits | MetadataConsts.SEMANTIC_USE_FOREGROUND; + } + if (metadata === 0) { + // Nothing! + metadata = Constants.NO_STYLING; + } + } + this._hashTable.add(tokenTypeIndex, tokenModifierSet, metadata); + } + if (this._logService.getLevel() === LogLevel.Trace) { + const type = this._legend.tokenTypes[tokenTypeIndex]; + const modifiers = tokenModifierSet ? ' ' + this._legend.tokenModifiers.filter((_, i) => tokenModifierSet & (1 << i)).join(' ') : ''; + this._logService.trace(`tokenStyleMetadata ${entry ? '[CACHED] ' : ''}${type}${modifiers}: foreground ${TokenMetadata.getForeground(metadata)}, fontStyle ${TokenMetadata.getFontStyle(metadata).toString(2)}`); + } + return metadata; + } + + +} + +const enum SemanticColoringConstants { + /** + * Let's aim at having 8KB buffers if possible... + * So that would be 8192 / (5 * 4) = 409.6 tokens per area + */ + DesiredTokensPerArea = 400, + + /** + * Try to keep the total number of areas under 1024 if possible, + * simply compensate by having more tokens per area... + */ + DesiredMaxAreas = 1024, +} + +class SemanticTokensResponse { + constructor( + private readonly _provider: DocumentSemanticTokensProvider, + public readonly resultId: string | undefined, + public readonly data: Uint32Array + ) { } + + public dispose(): void { + this._provider.releaseDocumentSemanticTokens(this.resultId); + } +} + +class ModelSemanticColoring extends Disposable { + + private _isDisposed: boolean; + private readonly _model: ITextModel; + private readonly _semanticStyling: SemanticStyling; + private readonly _fetchSemanticTokens: RunOnceScheduler; + private _currentResponse: SemanticTokensResponse | null; + private _currentRequestCancellationTokenSource: CancellationTokenSource | null; + + constructor(model: ITextModel, themeService: IThemeService, stylingProvider: SemanticStyling) { + super(); + + this._isDisposed = false; + this._model = model; + this._semanticStyling = stylingProvider; + this._fetchSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchSemanticTokensNow(), 300)); + this._currentResponse = null; + this._currentRequestCancellationTokenSource = null; + + this._register(this._model.onDidChangeContent(e => { + if (!this._fetchSemanticTokens.isScheduled()) { + this._fetchSemanticTokens.schedule(); + } + })); + this._register(DocumentSemanticTokensProviderRegistry.onDidChange(e => this._fetchSemanticTokens.schedule())); + if (themeService) { + // workaround for tests which use undefined... :/ + this._register(themeService.onThemeChange(_ => { + // clear out existing tokens + this._setSemanticTokens(null, null, null, []); + this._fetchSemanticTokens.schedule(); + })); + } + this._fetchSemanticTokens.schedule(0); + } + + public dispose(): void { + if (this._currentResponse) { + this._currentResponse.dispose(); + this._currentResponse = null; + } + if (this._currentRequestCancellationTokenSource) { + this._currentRequestCancellationTokenSource.cancel(); + this._currentRequestCancellationTokenSource = null; + } + this._setSemanticTokens(null, null, null, []); + this._isDisposed = true; + + super.dispose(); + } + + private _fetchSemanticTokensNow(): void { + if (this._currentRequestCancellationTokenSource) { + // there is already a request running, let it finish... + return; + } + const provider = this._getSemanticColoringProvider(); + if (!provider) { + return; + } + this._currentRequestCancellationTokenSource = new CancellationTokenSource(); + + const pendingChanges: IModelContentChangedEvent[] = []; + const contentChangeListener = this._model.onDidChangeContent((e) => { + pendingChanges.push(e); + }); + + const styling = this._semanticStyling.get(provider); + + const lastResultId = this._currentResponse ? this._currentResponse.resultId || null : null; + const request = Promise.resolve(provider.provideDocumentSemanticTokens(this._model, lastResultId, this._currentRequestCancellationTokenSource.token)); + + request.then((res) => { + this._currentRequestCancellationTokenSource = null; + contentChangeListener.dispose(); + this._setSemanticTokens(provider, res || null, styling, pendingChanges); + }, (err) => { + if (!err || typeof err.message !== 'string' || err.message.indexOf('busy') === -1) { + errors.onUnexpectedError(err); + } + + // Semantic tokens eats up all errors and considers errors to mean that the result is temporarily not available + // The API does not have a special error kind to express this... + this._currentRequestCancellationTokenSource = null; + contentChangeListener.dispose(); + + if (pendingChanges.length > 0) { + // More changes occurred while the request was running + if (!this._fetchSemanticTokens.isScheduled()) { + this._fetchSemanticTokens.schedule(); + } + } + }); + } + + private static _isSemanticTokens(v: SemanticTokens | SemanticTokensEdits): v is SemanticTokens { + return v && !!((v).data); + } + + private static _isSemanticTokensEdits(v: SemanticTokens | SemanticTokensEdits): v is SemanticTokensEdits { + return v && Array.isArray((v).edits); + } + + private static _copy(src: Uint32Array, srcOffset: number, dest: Uint32Array, destOffset: number, length: number): void { + for (let i = 0; i < length; i++) { + dest[destOffset + i] = src[srcOffset + i]; + } + } + + private _setSemanticTokens(provider: DocumentSemanticTokensProvider | null, tokens: SemanticTokens | SemanticTokensEdits | null, styling: SemanticColoringProviderStyling | null, pendingChanges: IModelContentChangedEvent[]): void { + const currentResponse = this._currentResponse; + if (this._currentResponse) { + this._currentResponse.dispose(); + this._currentResponse = null; + } + if (this._isDisposed) { + // disposed! + if (provider && tokens) { + provider.releaseDocumentSemanticTokens(tokens.resultId); + } + return; + } + if (!provider || !tokens || !styling) { + this._model.setSemanticTokens(null); + return; + } + + if (ModelSemanticColoring._isSemanticTokensEdits(tokens)) { + if (!currentResponse) { + // not possible! + this._model.setSemanticTokens(null); + return; + } + if (tokens.edits.length === 0) { + // nothing to do! + tokens = { + resultId: tokens.resultId, + data: currentResponse.data + }; + } else { + let deltaLength = 0; + for (const edit of tokens.edits) { + deltaLength += (edit.data ? edit.data.length : 0) - edit.deleteCount; + } + + const srcData = currentResponse.data; + const destData = new Uint32Array(srcData.length + deltaLength); + + let srcLastStart = srcData.length; + let destLastStart = destData.length; + for (let i = tokens.edits.length - 1; i >= 0; i--) { + const edit = tokens.edits[i]; + + const copyCount = srcLastStart - (edit.start + edit.deleteCount); + if (copyCount > 0) { + ModelSemanticColoring._copy(srcData, srcLastStart - copyCount, destData, destLastStart - copyCount, copyCount); + destLastStart -= copyCount; + } + + if (edit.data) { + ModelSemanticColoring._copy(edit.data, 0, destData, destLastStart - edit.data.length, edit.data.length); + destLastStart -= edit.data.length; + } + + srcLastStart = edit.start; + } + + if (srcLastStart > 0) { + ModelSemanticColoring._copy(srcData, 0, destData, 0, srcLastStart); + } + + tokens = { + resultId: tokens.resultId, + data: destData + }; + } + } + + if (ModelSemanticColoring._isSemanticTokens(tokens)) { + + this._currentResponse = new SemanticTokensResponse(provider, tokens.resultId, tokens.data); + + const srcData = tokens.data; + const tokenCount = (tokens.data.length / 5) | 0; + const tokensPerArea = Math.max(Math.ceil(tokenCount / SemanticColoringConstants.DesiredMaxAreas), SemanticColoringConstants.DesiredTokensPerArea); + + const result: MultilineTokens2[] = []; + + let tokenIndex = 0; + let lastLineNumber = 1; + let lastStartCharacter = 0; + while (tokenIndex < tokenCount) { + const tokenStartIndex = tokenIndex; + let tokenEndIndex = Math.min(tokenStartIndex + tokensPerArea, tokenCount); + + // Keep tokens on the same line in the same area... + if (tokenEndIndex < tokenCount) { + + let smallTokenEndIndex = tokenEndIndex; + while (smallTokenEndIndex - 1 > tokenStartIndex && srcData[5 * smallTokenEndIndex] === 0) { + smallTokenEndIndex--; + } + + if (smallTokenEndIndex - 1 === tokenStartIndex) { + // there are so many tokens on this line that our area would be empty, we must now go right + let bigTokenEndIndex = tokenEndIndex; + while (bigTokenEndIndex + 1 < tokenCount && srcData[5 * bigTokenEndIndex] === 0) { + bigTokenEndIndex++; + } + tokenEndIndex = bigTokenEndIndex; + } else { + tokenEndIndex = smallTokenEndIndex; + } + } + + let destData = new Uint32Array((tokenEndIndex - tokenStartIndex) * 4); + let destOffset = 0; + let areaLine = 0; + while (tokenIndex < tokenEndIndex) { + const srcOffset = 5 * tokenIndex; + const deltaLine = srcData[srcOffset]; + const deltaCharacter = srcData[srcOffset + 1]; + const lineNumber = lastLineNumber + deltaLine; + const startCharacter = (deltaLine === 0 ? lastStartCharacter + deltaCharacter : deltaCharacter); + const length = srcData[srcOffset + 2]; + const tokenTypeIndex = srcData[srcOffset + 3]; + const tokenModifierSet = srcData[srcOffset + 4]; + const metadata = styling.getMetadata(tokenTypeIndex, tokenModifierSet); + + if (metadata !== Constants.NO_STYLING) { + if (areaLine === 0) { + areaLine = lineNumber; + } + destData[destOffset] = lineNumber - areaLine; + destData[destOffset + 1] = startCharacter; + destData[destOffset + 2] = startCharacter + length; + destData[destOffset + 3] = metadata; + destOffset += 4; + } + + lastLineNumber = lineNumber; + lastStartCharacter = startCharacter; + tokenIndex++; + } + + if (destOffset !== destData.length) { + destData = destData.subarray(0, destOffset); + } + + const tokens = new MultilineTokens2(areaLine, new SparseEncodedTokens(destData)); + result.push(tokens); + } + + // Adjust incoming semantic tokens + if (pendingChanges.length > 0) { + // More changes occurred while the request was running + // We need to: + // 1. Adjust incoming semantic tokens + // 2. Request them again + for (const change of pendingChanges) { + for (const area of result) { + for (const singleChange of change.changes) { + area.applyEdit(singleChange.range, singleChange.text); + } + } + } + + if (!this._fetchSemanticTokens.isScheduled()) { + this._fetchSemanticTokens.schedule(); + } + } + + this._model.setSemanticTokens(result); + return; + } + + this._model.setSemanticTokens(null); + } + + private _getSemanticColoringProvider(): DocumentSemanticTokensProvider | null { + const result = DocumentSemanticTokensProviderRegistry.ordered(this._model); + return (result.length > 0 ? result[0] : null); + } +} diff --git a/src/vs/editor/common/services/resolverService.ts b/src/vs/editor/common/services/resolverService.ts index b425ebb8fde77..46da05998eadb 100644 --- a/src/vs/editor/common/services/resolverService.ts +++ b/src/vs/editor/common/services/resolverService.ts @@ -52,7 +52,20 @@ export interface ITextEditorModel extends IEditorModel { createSnapshot(this: IResolvedTextEditorModel): ITextSnapshot; createSnapshot(this: ITextEditorModel): ITextSnapshot | null; + /** + * Signals if this model is readonly or not. + */ isReadonly(): boolean; + + /** + * Figure out if this model is resolved or not. + */ + isResolved(): this is IResolvedTextEditorModel; + + /** + * The mode id of the text model if known. + */ + getMode(): string | undefined; } export interface IResolvedTextEditorModel extends ITextEditorModel { diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts deleted file mode 100644 index 08983dc17b4fc..0000000000000 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { Emitter, Event } from 'vs/base/common/event'; -import { Disposable } from 'vs/base/common/lifecycle'; -import { URI } from 'vs/base/common/uri'; -import { IPosition, Position } from 'vs/editor/common/core/position'; -import { IModeService } from 'vs/editor/common/services/modeService'; -import { IModelService } from 'vs/editor/common/services/modelService'; -import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; -import { IConfigurationChangeEvent, IConfigurationService } from 'vs/platform/configuration/common/configuration'; - -export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService { - - public _serviceBrand: undefined; - - private readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); - public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; - - constructor( - @IConfigurationService private readonly configurationService: IConfigurationService, - @IModelService private readonly modelService: IModelService, - @IModeService private readonly modeService: IModeService, - ) { - super(); - this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(e))); - } - - getValue(resource: URI, section?: string): T; - getValue(resource: URI, at?: IPosition, section?: string): T; - getValue(resource: URI, arg2?: any, arg3?: any): T { - if (typeof arg3 === 'string') { - return this._getValue(resource, Position.isIPosition(arg2) ? arg2 : null, arg3); - } - return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined); - } - - private _getValue(resource: URI, position: IPosition | null, section: string | undefined): T { - const language = resource ? this.getLanguage(resource, position) : undefined; - if (typeof section === 'undefined') { - return this.configurationService.getValue({ resource, overrideIdentifier: language }); - } - return this.configurationService.getValue(section, { resource, overrideIdentifier: language }); - } - - private getLanguage(resource: URI, position: IPosition | null): string | null { - const model = this.modelService.getModel(resource); - if (model) { - return position ? this.modeService.getLanguageIdentifier(model.getLanguageIdAtPosition(position.lineNumber, position.column))!.language : model.getLanguageIdentifier().language; - } - return this.modeService.getModeIdByFilepathOrFirstLine(resource); - - } -} \ No newline at end of file diff --git a/src/vs/editor/common/services/resourceConfiguration.ts b/src/vs/editor/common/services/textResourceConfigurationService.ts similarity index 53% rename from src/vs/editor/common/services/resourceConfiguration.ts rename to src/vs/editor/common/services/textResourceConfigurationService.ts index 0e122347e34f8..d83fc390eef78 100644 --- a/src/vs/editor/common/services/resourceConfiguration.ts +++ b/src/vs/editor/common/services/textResourceConfigurationService.ts @@ -6,11 +6,29 @@ import { Event } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; import { IPosition } from 'vs/editor/common/core/position'; -import { IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; +import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export const ITextResourceConfigurationService = createDecorator('textResourceConfigurationService'); +export interface ITextResourceConfigurationChangeEvent { + + /** + * All affected keys. Also includes language overrides and keys changed under language overrides. + */ + readonly affectedKeys: string[]; + + /** + * Returns `true` if the given section has changed for the given resource. + * + * Example: To check if the configuration section has changed for a given resource use `e.affectsConfiguration(resource, section)`. + * + * @param resource Resource for which the configuration has to be checked. + * @param section Section of the configuration + */ + affectsConfiguration(resource: URI, section: string): boolean; +} + export interface ITextResourceConfigurationService { _serviceBrand: undefined; @@ -18,7 +36,7 @@ export interface ITextResourceConfigurationService { /** * Event that fires when the configuration changes. */ - onDidChangeConfiguration: Event; + onDidChangeConfiguration: Event; /** * Fetches the value of the section for the given resource by applying language overrides. @@ -32,6 +50,20 @@ export interface ITextResourceConfigurationService { getValue(resource: URI | undefined, section?: string): T; getValue(resource: URI | undefined, position?: IPosition, section?: string): T; + /** + * Update the configuration value for the given resource at the effective location. + * + * - If configurationTarget is not specified, target will be derived by checking where the configuration is defined. + * - If the language overrides for the give resource contains the configuration, then it is updated. + * + * @param resource Resource for which the configuration has to be updated + * @param key Configuration key + * @param value Configuration value + * @param configurationTarget Optional target into which the configuration has to be updated. + * If not specified, target will be derived by checking where the configuration is defined. + */ + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise; + } export const ITextResourcePropertiesService = createDecorator('textResourcePropertiesService'); @@ -44,4 +76,4 @@ export interface ITextResourcePropertiesService { * Returns the End of Line characters for the given resource */ getEOL(resource: URI | undefined, language?: string): string; -} \ No newline at end of file +} diff --git a/src/vs/editor/common/services/textResourceConfigurationServiceImpl.ts b/src/vs/editor/common/services/textResourceConfigurationServiceImpl.ts new file mode 100644 index 0000000000000..e5ee5d45986d2 --- /dev/null +++ b/src/vs/editor/common/services/textResourceConfigurationServiceImpl.ts @@ -0,0 +1,126 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Emitter, Event } from 'vs/base/common/event'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { URI } from 'vs/base/common/uri'; +import { IPosition, Position } from 'vs/editor/common/core/position'; +import { IModeService } from 'vs/editor/common/services/modeService'; +import { IModelService } from 'vs/editor/common/services/modelService'; +import { ITextResourceConfigurationService, ITextResourceConfigurationChangeEvent } from 'vs/editor/common/services/textResourceConfigurationService'; +import { IConfigurationService, ConfigurationTarget, IConfigurationValue, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; + +export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService { + + public _serviceBrand: undefined; + + private readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); + public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; + + constructor( + @IConfigurationService private readonly configurationService: IConfigurationService, + @IModelService private readonly modelService: IModelService, + @IModeService private readonly modeService: IModeService, + ) { + super(); + this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e)))); + } + + getValue(resource: URI, section?: string): T; + getValue(resource: URI, at?: IPosition, section?: string): T; + getValue(resource: URI, arg2?: any, arg3?: any): T { + if (typeof arg3 === 'string') { + return this._getValue(resource, Position.isIPosition(arg2) ? arg2 : null, arg3); + } + return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined); + } + + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { + const language = this.getLanguage(resource, null); + const configurationValue = this.configurationService.inspect(key, { resource, overrideIdentifier: language }); + if (configurationTarget === undefined) { + configurationTarget = this.deriveConfigurationTarget(configurationValue, language); + } + switch (configurationTarget) { + case ConfigurationTarget.MEMORY: + return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language); + case ConfigurationTarget.WORKSPACE_FOLDER: + return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language); + case ConfigurationTarget.WORKSPACE: + return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language); + case ConfigurationTarget.USER_REMOTE: + return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language); + default: + return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language); + } + } + + private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, overriddenValue: any | undefined, resource: URI, language: string | null): Promise { + if (language && overriddenValue !== undefined) { + return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget); + } else { + return this.configurationService.updateValue(key, value, { resource }, configurationTarget); + } + } + + private deriveConfigurationTarget(configurationValue: IConfigurationValue, language: string | null): ConfigurationTarget { + if (language) { + if (configurationValue.memory?.override !== undefined) { + return ConfigurationTarget.MEMORY; + } + if (configurationValue.workspaceFolder?.override !== undefined) { + return ConfigurationTarget.WORKSPACE_FOLDER; + } + if (configurationValue.workspace?.override !== undefined) { + return ConfigurationTarget.WORKSPACE; + } + if (configurationValue.userRemote?.override !== undefined) { + return ConfigurationTarget.USER_REMOTE; + } + if (configurationValue.userLocal?.override !== undefined) { + return ConfigurationTarget.USER_LOCAL; + } + } + if (configurationValue.memory?.value !== undefined) { + return ConfigurationTarget.MEMORY; + } + if (configurationValue.workspaceFolder?.value !== undefined) { + return ConfigurationTarget.WORKSPACE_FOLDER; + } + if (configurationValue.workspace?.value !== undefined) { + return ConfigurationTarget.WORKSPACE; + } + if (configurationValue.userRemote?.value !== undefined) { + return ConfigurationTarget.USER_REMOTE; + } + return ConfigurationTarget.USER_LOCAL; + } + + private _getValue(resource: URI, position: IPosition | null, section: string | undefined): T { + const language = resource ? this.getLanguage(resource, position) : undefined; + if (typeof section === 'undefined') { + return this.configurationService.getValue({ resource, overrideIdentifier: language }); + } + return this.configurationService.getValue(section, { resource, overrideIdentifier: language }); + } + + private getLanguage(resource: URI, position: IPosition | null): string | null { + const model = this.modelService.getModel(resource); + if (model) { + return position ? this.modeService.getLanguageIdentifier(model.getLanguageIdAtPosition(position.lineNumber, position.column))!.language : model.getLanguageIdentifier().language; + } + return this.modeService.getModeIdByFilepathOrFirstLine(resource); + } + + private toResourceConfigurationChangeEvent(configurationChangeEvent: IConfigurationChangeEvent): ITextResourceConfigurationChangeEvent { + return { + affectedKeys: configurationChangeEvent.affectedKeys, + affectsConfiguration: (resource: URI, configuration: string) => { + const overrideIdentifier = this.getLanguage(resource, null); + return configurationChangeEvent.affectsConfiguration(configuration, { resource, overrideIdentifier }); + } + }; + } +} diff --git a/src/vs/editor/common/services/webWorker.ts b/src/vs/editor/common/services/webWorker.ts index 0ae55dffaa075..55dfe84af398c 100644 --- a/src/vs/editor/common/services/webWorker.ts +++ b/src/vs/editor/common/services/webWorker.ts @@ -53,6 +53,11 @@ export interface IWebWorkerOptions { * An object that can be used by the web worker to make calls back to the main thread. */ host?: any; + /** + * Keep idle models. + * Defaults to false, which means that idle models will stop syncing after a while. + */ + keepIdleModels?: boolean; } class MonacoWebWorkerImpl extends EditorWorkerClient implements MonacoWebWorker { @@ -63,7 +68,7 @@ class MonacoWebWorkerImpl extends EditorWorkerClient implements MonacoWebWork private _foreignProxy: Promise | null; constructor(modelService: IModelService, opts: IWebWorkerOptions) { - super(modelService, opts.label); + super(modelService, opts.keepIdleModels || false, opts.label); this._foreignModuleId = opts.moduleId; this._foreignModuleCreateData = opts.createData || null; this._foreignModuleHost = opts.host || null; diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index c26b7705b5ca6..14e4cfb12fc2a 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -6,16 +6,334 @@ // THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. -export enum MarkerTag { - Unnecessary = 1, - Deprecated = 2 +export enum AccessibilitySupport { + /** + * This should be the browser case where it is not known if a screen reader is attached or no. + */ + Unknown = 0, + Disabled = 1, + Enabled = 2 } -export enum MarkerSeverity { - Hint = 1, - Info = 2, - Warning = 4, - Error = 8 +export enum CompletionItemInsertTextRule { + /** + * Adjust whitespace/indentation of multiline insert texts to + * match the current line indentation. + */ + KeepWhitespace = 1, + /** + * `insertText` is a snippet. + */ + InsertAsSnippet = 4 +} + +export enum CompletionItemKind { + Method = 0, + Function = 1, + Constructor = 2, + Field = 3, + Variable = 4, + Class = 5, + Struct = 6, + Interface = 7, + Module = 8, + Property = 9, + Event = 10, + Operator = 11, + Unit = 12, + Value = 13, + Constant = 14, + Enum = 15, + EnumMember = 16, + Keyword = 17, + Text = 18, + Color = 19, + File = 20, + Reference = 21, + Customcolor = 22, + Folder = 23, + TypeParameter = 24, + Snippet = 25 +} + +export enum CompletionItemTag { + Deprecated = 1 +} + +/** + * How a suggest provider was triggered. + */ +export enum CompletionTriggerKind { + Invoke = 0, + TriggerCharacter = 1, + TriggerForIncompleteCompletions = 2 +} + +/** + * A positioning preference for rendering content widgets. + */ +export enum ContentWidgetPositionPreference { + /** + * Place the content widget exactly at a position + */ + EXACT = 0, + /** + * Place the content widget above a position + */ + ABOVE = 1, + /** + * Place the content widget below a position + */ + BELOW = 2 +} + +/** + * Describes the reason the cursor has changed its position. + */ +export enum CursorChangeReason { + /** + * Unknown or not set. + */ + NotSet = 0, + /** + * A `model.setValue()` was called. + */ + ContentFlush = 1, + /** + * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers. + */ + RecoverFromMarkers = 2, + /** + * There was an explicit user gesture. + */ + Explicit = 3, + /** + * There was a Paste. + */ + Paste = 4, + /** + * There was an Undo. + */ + Undo = 5, + /** + * There was a Redo. + */ + Redo = 6 +} + +/** + * The default end of line to use when instantiating models. + */ +export enum DefaultEndOfLine { + /** + * Use line feed (\n) as the end of line character. + */ + LF = 1, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 2 +} + +/** + * A document highlight kind. + */ +export enum DocumentHighlightKind { + /** + * A textual occurrence. + */ + Text = 0, + /** + * Read-access of a symbol, like reading a variable. + */ + Read = 1, + /** + * Write-access of a symbol, like writing to a variable. + */ + Write = 2 +} + +/** + * Configuration options for auto indentation in the editor + */ +export enum EditorAutoIndentStrategy { + None = 0, + Keep = 1, + Brackets = 2, + Advanced = 3, + Full = 4 +} + +export enum EditorOption { + acceptSuggestionOnCommitCharacter = 0, + acceptSuggestionOnEnter = 1, + accessibilitySupport = 2, + accessibilityPageSize = 3, + ariaLabel = 4, + autoClosingBrackets = 5, + autoClosingOvertype = 6, + autoClosingQuotes = 7, + autoIndent = 8, + automaticLayout = 9, + autoSurround = 10, + codeLens = 11, + colorDecorators = 12, + columnSelection = 13, + comments = 14, + contextmenu = 15, + copyWithSyntaxHighlighting = 16, + cursorBlinking = 17, + cursorSmoothCaretAnimation = 18, + cursorStyle = 19, + cursorSurroundingLines = 20, + cursorSurroundingLinesStyle = 21, + cursorWidth = 22, + disableLayerHinting = 23, + disableMonospaceOptimizations = 24, + dragAndDrop = 25, + emptySelectionClipboard = 26, + extraEditorClassName = 27, + fastScrollSensitivity = 28, + find = 29, + fixedOverflowWidgets = 30, + folding = 31, + foldingStrategy = 32, + foldingHighlight = 33, + fontFamily = 34, + fontInfo = 35, + fontLigatures = 36, + fontSize = 37, + fontWeight = 38, + formatOnPaste = 39, + formatOnType = 40, + glyphMargin = 41, + gotoLocation = 42, + hideCursorInOverviewRuler = 43, + highlightActiveIndentGuide = 44, + hover = 45, + inDiffEditor = 46, + letterSpacing = 47, + lightbulb = 48, + lineDecorationsWidth = 49, + lineHeight = 50, + lineNumbers = 51, + lineNumbersMinChars = 52, + links = 53, + matchBrackets = 54, + minimap = 55, + mouseStyle = 56, + mouseWheelScrollSensitivity = 57, + mouseWheelZoom = 58, + multiCursorMergeOverlapping = 59, + multiCursorModifier = 60, + multiCursorPaste = 61, + occurrencesHighlight = 62, + overviewRulerBorder = 63, + overviewRulerLanes = 64, + padding = 65, + parameterHints = 66, + peekWidgetDefaultFocus = 67, + definitionLinkOpensInPeek = 68, + quickSuggestions = 69, + quickSuggestionsDelay = 70, + readOnly = 71, + renderControlCharacters = 72, + renderIndentGuides = 73, + renderFinalNewline = 74, + renderLineHighlight = 75, + renderValidationDecorations = 76, + renderWhitespace = 77, + revealHorizontalRightPadding = 78, + roundedSelection = 79, + rulers = 80, + scrollbar = 81, + scrollBeyondLastColumn = 82, + scrollBeyondLastLine = 83, + scrollPredominantAxis = 84, + selectionClipboard = 85, + selectionHighlight = 86, + selectOnLineNumbers = 87, + showFoldingControls = 88, + showUnused = 89, + snippetSuggestions = 90, + smoothScrolling = 91, + stopRenderingLineAfter = 92, + suggest = 93, + suggestFontSize = 94, + suggestLineHeight = 95, + suggestOnTriggerCharacters = 96, + suggestSelection = 97, + tabCompletion = 98, + useTabStops = 99, + wordSeparators = 100, + wordWrap = 101, + wordWrapBreakAfterCharacters = 102, + wordWrapBreakBeforeCharacters = 103, + wordWrapColumn = 104, + wordWrapMinified = 105, + wrappingIndent = 106, + wrappingStrategy = 107, + editorClassName = 108, + pixelRatio = 109, + tabFocusMode = 110, + layoutInfo = 111, + wrappingInfo = 112 +} + +/** + * End of line character preference. + */ +export enum EndOfLinePreference { + /** + * Use the end of line character identified in the text buffer. + */ + TextDefined = 0, + /** + * Use line feed (\n) as the end of line character. + */ + LF = 1, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 2 +} + +/** + * End of line character preference. + */ +export enum EndOfLineSequence { + /** + * Use line feed (\n) as the end of line character. + */ + LF = 0, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 1 +} + +/** + * Describes what to do with the indentation when pressing Enter. + */ +export enum IndentAction { + /** + * Insert new line and copy the previous line's indentation. + */ + None = 0, + /** + * Insert new line and indent once (relative to the previous line's indentation). + */ + Indent = 1, + /** + * Insert two new lines: + * - the first one indented which will hold the cursor + * - the second one at the same indentation level + */ + IndentOutdent = 2, + /** + * Insert new line and outdent once (relative to the previous line's indentation). + */ + Outdent = 3 } /** @@ -199,34 +517,16 @@ export enum KeyCode { MAX_VALUE = 112 } -/** - * The direction of a selection. - */ -export enum SelectionDirection { - /** - * The selection starts above where it ends. - */ - LTR = 0, - /** - * The selection starts below where it ends. - */ - RTL = 1 -} - -export enum ScrollbarVisibility { - Auto = 1, - Hidden = 2, - Visible = 3 +export enum MarkerSeverity { + Hint = 1, + Info = 2, + Warning = 4, + Error = 8 } -/** - * Vertical Lane in the overview ruler of the editor. - */ -export enum OverviewRulerLane { - Left = 1, - Center = 2, - Right = 4, - Full = 7 +export enum MarkerTag { + Unnecessary = 1, + Deprecated = 2 } /** @@ -238,60 +538,107 @@ export enum MinimapPosition { } /** - * End of line character preference. + * Type of hit element with the mouse in the editor. */ -export enum EndOfLinePreference { +export enum MouseTargetType { /** - * Use the end of line character identified in the text buffer. + * Mouse is on top of an unknown element. */ - TextDefined = 0, + UNKNOWN = 0, /** - * Use line feed (\n) as the end of line character. + * Mouse is on top of the textarea used for input. */ - LF = 1, + TEXTAREA = 1, /** - * Use carriage return and line feed (\r\n) as the end of line character. + * Mouse is on top of the glyph margin */ - CRLF = 2 -} - -/** - * The default end of line to use when instantiating models. - */ -export enum DefaultEndOfLine { + GUTTER_GLYPH_MARGIN = 2, /** - * Use line feed (\n) as the end of line character. + * Mouse is on top of the line numbers */ - LF = 1, + GUTTER_LINE_NUMBERS = 3, /** - * Use carriage return and line feed (\r\n) as the end of line character. + * Mouse is on top of the line decorations */ - CRLF = 2 + GUTTER_LINE_DECORATIONS = 4, + /** + * Mouse is on top of the whitespace left in the gutter by a view zone. + */ + GUTTER_VIEW_ZONE = 5, + /** + * Mouse is on top of text in the content. + */ + CONTENT_TEXT = 6, + /** + * Mouse is on top of empty space in the content (e.g. after line text or below last line) + */ + CONTENT_EMPTY = 7, + /** + * Mouse is on top of a view zone in the content. + */ + CONTENT_VIEW_ZONE = 8, + /** + * Mouse is on top of a content widget. + */ + CONTENT_WIDGET = 9, + /** + * Mouse is on top of the decorations overview ruler. + */ + OVERVIEW_RULER = 10, + /** + * Mouse is on top of a scrollbar. + */ + SCROLLBAR = 11, + /** + * Mouse is on top of an overlay widget. + */ + OVERLAY_WIDGET = 12, + /** + * Mouse is outside of the editor. + */ + OUTSIDE_EDITOR = 13 } /** - * End of line character preference. + * A positioning preference for rendering overlay widgets. */ -export enum EndOfLineSequence { +export enum OverlayWidgetPositionPreference { /** - * Use line feed (\n) as the end of line character. + * Position the overlay widget in the top right corner */ - LF = 0, + TOP_RIGHT_CORNER = 0, /** - * Use carriage return and line feed (\r\n) as the end of line character. + * Position the overlay widget in the bottom right corner */ - CRLF = 1 + BOTTOM_RIGHT_CORNER = 1, + /** + * Position the overlay widget in the top center + */ + TOP_CENTER = 2 } /** - * Describes the behavior of decorations when typing/editing near their edges. - * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` + * Vertical Lane in the overview ruler of the editor. */ -export enum TrackedRangeStickiness { - AlwaysGrowsWhenTypingAtEdges = 0, - NeverGrowsWhenTypingAtEdges = 1, - GrowsOnlyWhenTypingBefore = 2, - GrowsOnlyWhenTypingAfter = 3 +export enum OverviewRulerLane { + Left = 1, + Center = 2, + Right = 4, + Full = 7 +} + +export enum RenderLineNumbersType { + Off = 0, + On = 1, + Relative = 2, + Interval = 3, + Custom = 4 +} + +export enum RenderMinimap { + None = 0, + Text = 1, + Blocks = 2 } export enum ScrollType { @@ -299,47 +646,66 @@ export enum ScrollType { Immediate = 1 } +export enum ScrollbarVisibility { + Auto = 1, + Hidden = 2, + Visible = 3 +} + /** - * Describes the reason the cursor has changed its position. + * The direction of a selection. */ -export enum CursorChangeReason { - /** - * Unknown or not set. - */ - NotSet = 0, - /** - * A `model.setValue()` was called. - */ - ContentFlush = 1, - /** - * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers. - */ - RecoverFromMarkers = 2, - /** - * There was an explicit user gesture. - */ - Explicit = 3, - /** - * There was a Paste. - */ - Paste = 4, +export enum SelectionDirection { /** - * There was an Undo. + * The selection starts above where it ends. */ - Undo = 5, + LTR = 0, /** - * There was a Redo. + * The selection starts below where it ends. */ - Redo = 6 + RTL = 1 } -export enum AccessibilitySupport { - /** - * This should be the browser case where it is not known if a screen reader is attached or no. - */ - Unknown = 0, - Disabled = 1, - Enabled = 2 +export enum SignatureHelpTriggerKind { + Invoke = 1, + TriggerCharacter = 2, + ContentChange = 3 +} + +/** + * A symbol kind. + */ +export enum SymbolKind { + File = 0, + Module = 1, + Namespace = 2, + Package = 3, + Class = 4, + Method = 5, + Property = 6, + Field = 7, + Constructor = 8, + Enum = 9, + Interface = 10, + Function = 11, + Variable = 12, + Constant = 13, + String = 14, + Number = 15, + Boolean = 16, + Array = 17, + Object = 18, + Key = 19, + Null = 20, + EnumMember = 21, + Struct = 22, + Event = 23, + Operator = 24, + TypeParameter = 25 +} + +export enum SymbolTag { + Deprecated = 1 } /** @@ -402,18 +768,15 @@ export enum TextEditorCursorStyle { UnderlineThin = 6 } -export enum RenderMinimap { - None = 0, - Text = 1, - Blocks = 2 -} - -export enum RenderLineNumbersType { - Off = 0, - On = 1, - Relative = 2, - Interval = 3, - Custom = 4 +/** + * Describes the behavior of decorations when typing/editing near their edges. + * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` + */ +export enum TrackedRangeStickiness { + AlwaysGrowsWhenTypingAtEdges = 0, + NeverGrowsWhenTypingAtEdges = 1, + GrowsOnlyWhenTypingBefore = 2, + GrowsOnlyWhenTypingAfter = 3 } /** @@ -436,240 +799,4 @@ export enum WrappingIndent { * DeepIndent => wrapped lines get +2 indentation toward the parent. */ DeepIndent = 3 -} - -/** - * A positioning preference for rendering content widgets. - */ -export enum ContentWidgetPositionPreference { - /** - * Place the content widget exactly at a position - */ - EXACT = 0, - /** - * Place the content widget above a position - */ - ABOVE = 1, - /** - * Place the content widget below a position - */ - BELOW = 2 -} - -/** - * A positioning preference for rendering overlay widgets. - */ -export enum OverlayWidgetPositionPreference { - /** - * Position the overlay widget in the top right corner - */ - TOP_RIGHT_CORNER = 0, - /** - * Position the overlay widget in the bottom right corner - */ - BOTTOM_RIGHT_CORNER = 1, - /** - * Position the overlay widget in the top center - */ - TOP_CENTER = 2 -} - -/** - * Type of hit element with the mouse in the editor. - */ -export enum MouseTargetType { - /** - * Mouse is on top of an unknown element. - */ - UNKNOWN = 0, - /** - * Mouse is on top of the textarea used for input. - */ - TEXTAREA = 1, - /** - * Mouse is on top of the glyph margin - */ - GUTTER_GLYPH_MARGIN = 2, - /** - * Mouse is on top of the line numbers - */ - GUTTER_LINE_NUMBERS = 3, - /** - * Mouse is on top of the line decorations - */ - GUTTER_LINE_DECORATIONS = 4, - /** - * Mouse is on top of the whitespace left in the gutter by a view zone. - */ - GUTTER_VIEW_ZONE = 5, - /** - * Mouse is on top of text in the content. - */ - CONTENT_TEXT = 6, - /** - * Mouse is on top of empty space in the content (e.g. after line text or below last line) - */ - CONTENT_EMPTY = 7, - /** - * Mouse is on top of a view zone in the content. - */ - CONTENT_VIEW_ZONE = 8, - /** - * Mouse is on top of a content widget. - */ - CONTENT_WIDGET = 9, - /** - * Mouse is on top of the decorations overview ruler. - */ - OVERVIEW_RULER = 10, - /** - * Mouse is on top of a scrollbar. - */ - SCROLLBAR = 11, - /** - * Mouse is on top of an overlay widget. - */ - OVERLAY_WIDGET = 12, - /** - * Mouse is outside of the editor. - */ - OUTSIDE_EDITOR = 13 -} - -/** - * Describes what to do with the indentation when pressing Enter. - */ -export enum IndentAction { - /** - * Insert new line and copy the previous line's indentation. - */ - None = 0, - /** - * Insert new line and indent once (relative to the previous line's indentation). - */ - Indent = 1, - /** - * Insert two new lines: - * - the first one indented which will hold the cursor - * - the second one at the same indentation level - */ - IndentOutdent = 2, - /** - * Insert new line and outdent once (relative to the previous line's indentation). - */ - Outdent = 3 -} - -export enum CompletionItemKind { - Method = 0, - Function = 1, - Constructor = 2, - Field = 3, - Variable = 4, - Class = 5, - Struct = 6, - Interface = 7, - Module = 8, - Property = 9, - Event = 10, - Operator = 11, - Unit = 12, - Value = 13, - Constant = 14, - Enum = 15, - EnumMember = 16, - Keyword = 17, - Text = 18, - Color = 19, - File = 20, - Reference = 21, - Customcolor = 22, - Folder = 23, - TypeParameter = 24, - Snippet = 25 -} - -export enum CompletionItemTag { - Deprecated = 1 -} - -export enum CompletionItemInsertTextRule { - /** - * Adjust whitespace/indentation of multiline insert texts to - * match the current line indentation. - */ - KeepWhitespace = 1, - /** - * `insertText` is a snippet. - */ - InsertAsSnippet = 4 -} - -/** - * How a suggest provider was triggered. - */ -export enum CompletionTriggerKind { - Invoke = 0, - TriggerCharacter = 1, - TriggerForIncompleteCompletions = 2 -} - -export enum SignatureHelpTriggerKind { - Invoke = 1, - TriggerCharacter = 2, - ContentChange = 3 -} - -/** - * A document highlight kind. - */ -export enum DocumentHighlightKind { - /** - * A textual occurrence. - */ - Text = 0, - /** - * Read-access of a symbol, like reading a variable. - */ - Read = 1, - /** - * Write-access of a symbol, like writing to a variable. - */ - Write = 2 -} - -/** - * A symbol kind. - */ -export enum SymbolKind { - File = 0, - Module = 1, - Namespace = 2, - Package = 3, - Class = 4, - Method = 5, - Property = 6, - Field = 7, - Constructor = 8, - Enum = 9, - Interface = 10, - Function = 11, - Variable = 12, - Constant = 13, - String = 14, - Number = 15, - Boolean = 16, - Array = 17, - Object = 18, - Key = 19, - Null = 20, - EnumMember = 21, - Struct = 22, - Event = 23, - Operator = 24, - TypeParameter = 25 -} - -export enum SymbolTag { - Deprecated = 1 } \ No newline at end of file diff --git a/src/vs/editor/common/view/editorColorRegistry.ts b/src/vs/editor/common/view/editorColorRegistry.ts index 23d5e072b9dba..83cb17204f65e 100644 --- a/src/vs/editor/common/view/editorColorRegistry.ts +++ b/src/vs/editor/common/view/editorColorRegistry.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { Color, RGBA } from 'vs/base/common/color'; -import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry'; +import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder, editorFindMatchHighlight } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; /** @@ -15,6 +15,8 @@ export const editorLineHighlight = registerColor('editor.lineHighlightBackground export const editorLineHighlightBorder = registerColor('editor.lineHighlightBorder', { dark: '#282828', light: '#eeeeee', hc: '#f38518' }, nls.localize('lineHighlightBorderBox', 'Background color for the border around the line at the cursor position.')); export const editorRangeHighlight = registerColor('editor.rangeHighlightBackground', { dark: '#ffffff0b', light: '#fdff0033', hc: null }, nls.localize('rangeHighlight', 'Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations.'), true); export const editorRangeHighlightBorder = registerColor('editor.rangeHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'), true); +export const editorSymbolHighlight = registerColor('editor.symbolHighlightBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hc: null }, nls.localize('symbolHighlight', 'Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations.'), true); +export const editorSymbolHighlightBorder = registerColor('editor.symbolHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'), true); export const editorCursorForeground = registerColor('editorCursor.foreground', { dark: '#AEAFAD', light: Color.black, hc: Color.white }, nls.localize('caret', 'Color of the editor cursor.')); export const editorCursorBackground = registerColor('editorCursor.background', null, nls.localize('editorCursorBackground', 'The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.')); @@ -73,8 +75,19 @@ registerThemingParticipant((theme, collector) => { collector.addRule(`.monaco-editor .rangeHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${rangeHighlightBorder}; }`); } + const symbolHighlight = theme.getColor(editorSymbolHighlight); + if (symbolHighlight) { + collector.addRule(`.monaco-editor .symbolHighlight { background-color: ${symbolHighlight}; }`); + } + + const symbolHighlightBorder = theme.getColor(editorSymbolHighlightBorder); + if (symbolHighlightBorder) { + collector.addRule(`.monaco-editor .symbolHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${symbolHighlightBorder}; }`); + } + const invisibles = theme.getColor(editorWhitespaces); if (invisibles) { - collector.addRule(`.vs-whitespace { color: ${invisibles} !important; }`); + collector.addRule(`.monaco-editor .mtkw { color: ${invisibles} !important; }`); + collector.addRule(`.monaco-editor .mtkz { color: ${invisibles} !important; }`); } }); diff --git a/src/vs/editor/common/view/viewContext.ts b/src/vs/editor/common/view/viewContext.ts index 5f4c9be5889ca..793a3a173a5b8 100644 --- a/src/vs/editor/common/view/viewContext.ts +++ b/src/vs/editor/common/view/viewContext.ts @@ -7,7 +7,30 @@ import { IConfiguration } from 'vs/editor/common/editorCommon'; import { ViewEventDispatcher } from 'vs/editor/common/view/viewEventDispatcher'; import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler'; import { IViewLayout, IViewModel } from 'vs/editor/common/viewModel/viewModel'; -import { ITheme } from 'vs/platform/theme/common/themeService'; +import { ITheme, ThemeType } from 'vs/platform/theme/common/themeService'; +import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry'; +import { Color } from 'vs/base/common/color'; + +export class EditorTheme { + + private _theme: ITheme; + + public get type(): ThemeType { + return this._theme.type; + } + + constructor(theme: ITheme) { + this._theme = theme; + } + + public update(theme: ITheme): void { + this._theme = theme; + } + + public getColor(color: ColorIdentifier): Color | undefined { + return this._theme.getColor(color); + } +} export class ViewContext { @@ -15,8 +38,7 @@ export class ViewContext { public readonly model: IViewModel; public readonly viewLayout: IViewLayout; public readonly privateViewEventBus: ViewEventDispatcher; - - public theme: ITheme; // will be updated + public readonly theme: EditorTheme; constructor( configuration: IConfiguration, @@ -25,7 +47,7 @@ export class ViewContext { privateViewEventBus: ViewEventDispatcher ) { this.configuration = configuration; - this.theme = theme; + this.theme = new EditorTheme(theme); this.model = model; this.viewLayout = model.viewLayout; this.privateViewEventBus = privateViewEventBus; diff --git a/src/vs/editor/common/view/viewEvents.ts b/src/vs/editor/common/view/viewEvents.ts index c82cf9ac36071..cb3129b9a18b2 100644 --- a/src/vs/editor/common/view/viewEvents.ts +++ b/src/vs/editor/common/view/viewEvents.ts @@ -9,25 +9,27 @@ import { ScrollEvent } from 'vs/base/common/scrollable'; import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import { ScrollType } from 'vs/editor/common/editorCommon'; +import { ScrollType, IContentSizeChangedEvent } from 'vs/editor/common/editorCommon'; +import { IModelDecorationsChangedEvent } from 'vs/editor/common/model/textModelEvents'; export const enum ViewEventType { ViewConfigurationChanged = 1, - ViewCursorStateChanged = 2, - ViewDecorationsChanged = 3, - ViewFlushed = 4, - ViewFocusChanged = 5, - ViewLineMappingChanged = 6, - ViewLinesChanged = 7, - ViewLinesDeleted = 8, - ViewLinesInserted = 9, - ViewRevealRangeRequest = 10, - ViewScrollChanged = 11, - ViewTokensChanged = 12, - ViewTokensColorsChanged = 13, - ViewZonesChanged = 14, - ViewThemeChanged = 15, - ViewLanguageConfigurationChanged = 16 + ViewContentSizeChanged = 2, + ViewCursorStateChanged = 3, + ViewDecorationsChanged = 4, + ViewFlushed = 5, + ViewFocusChanged = 6, + ViewLanguageConfigurationChanged = 7, + ViewLineMappingChanged = 8, + ViewLinesChanged = 9, + ViewLinesDeleted = 10, + ViewLinesInserted = 11, + ViewRevealRangeRequest = 12, + ViewScrollChanged = 13, + ViewThemeChanged = 14, + ViewTokensChanged = 15, + ViewTokensColorsChanged = 16, + ViewZonesChanged = 17, } export class ViewConfigurationChangedEvent { @@ -45,17 +47,35 @@ export class ViewConfigurationChangedEvent { } } +export class ViewContentSizeChangedEvent implements IContentSizeChangedEvent { + + public readonly type = ViewEventType.ViewContentSizeChanged; + + public readonly contentWidth: number; + public readonly contentHeight: number; + + public readonly contentWidthChanged: boolean; + public readonly contentHeightChanged: boolean; + + constructor(source: IContentSizeChangedEvent) { + this.contentWidth = source.contentWidth; + this.contentHeight = source.contentHeight; + + this.contentWidthChanged = source.contentWidthChanged; + this.contentHeightChanged = source.contentHeightChanged; + } +} + export class ViewCursorStateChangedEvent { public readonly type = ViewEventType.ViewCursorStateChanged; - /** - * The primary selection is always at index 0. - */ public readonly selections: Selection[]; + public readonly modelSelections: Selection[]; - constructor(selections: Selection[]) { + constructor(selections: Selection[], modelSelections: Selection[]) { this.selections = selections; + this.modelSelections = modelSelections; } } @@ -63,8 +83,17 @@ export class ViewDecorationsChangedEvent { public readonly type = ViewEventType.ViewDecorationsChanged; - constructor() { - // Nothing to do + readonly affectsMinimap: boolean; + readonly affectsOverviewRuler: boolean; + + constructor(source: IModelDecorationsChangedEvent | null) { + if (source) { + this.affectsMinimap = source.affectsMinimap; + this.affectsOverviewRuler = source.affectsOverviewRuler; + } else { + this.affectsMinimap = true; + this.affectsOverviewRuler = true; + } } } @@ -88,6 +117,11 @@ export class ViewFocusChangedEvent { } } +export class ViewLanguageConfigurationEvent { + + public readonly type = ViewEventType.ViewLanguageConfigurationChanged; +} + export class ViewLineMappingChangedEvent { public readonly type = ViewEventType.ViewLineMappingChanged; @@ -159,7 +193,9 @@ export const enum VerticalRevealType { Center = 1, CenterIfOutsideViewport = 2, Top = 3, - Bottom = 4 + Bottom = 4, + NearTop = 5, + NearTopIfOutsideViewport = 6, } export class ViewRevealRangeRequestEvent { @@ -221,6 +257,11 @@ export class ViewScrollChangedEvent { } } +export class ViewThemeChangedEvent { + + public readonly type = ViewEventType.ViewThemeChanged; +} + export class ViewTokensChangedEvent { public readonly type = ViewEventType.ViewTokensChanged; @@ -241,11 +282,6 @@ export class ViewTokensChangedEvent { } } -export class ViewThemeChangedEvent { - - public readonly type = ViewEventType.ViewThemeChanged; -} - export class ViewTokensColorsChangedEvent { public readonly type = ViewEventType.ViewTokensColorsChanged; @@ -264,28 +300,24 @@ export class ViewZonesChangedEvent { } } -export class ViewLanguageConfigurationEvent { - - public readonly type = ViewEventType.ViewLanguageConfigurationChanged; -} - export type ViewEvent = ( ViewConfigurationChangedEvent + | ViewContentSizeChangedEvent | ViewCursorStateChangedEvent | ViewDecorationsChangedEvent | ViewFlushedEvent | ViewFocusChangedEvent - | ViewLinesChangedEvent + | ViewLanguageConfigurationEvent | ViewLineMappingChangedEvent + | ViewLinesChangedEvent | ViewLinesDeletedEvent | ViewLinesInsertedEvent | ViewRevealRangeRequestEvent | ViewScrollChangedEvent + | ViewThemeChangedEvent | ViewTokensChangedEvent | ViewTokensColorsChangedEvent | ViewZonesChangedEvent - | ViewThemeChangedEvent - | ViewLanguageConfigurationEvent ); export interface IViewEventListener { diff --git a/src/vs/editor/common/viewLayout/linesLayout.ts b/src/vs/editor/common/viewLayout/linesLayout.ts index d6673ac8b8fbe..c549df8d22c4f 100644 --- a/src/vs/editor/common/viewLayout/linesLayout.ts +++ b/src/vs/editor/common/viewLayout/linesLayout.ts @@ -4,84 +4,324 @@ *--------------------------------------------------------------------------------------------*/ import { IPartialViewLinesViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'; -import { IEditorWhitespace, WhitespaceComputer } from 'vs/editor/common/viewLayout/whitespaceComputer'; import { IViewWhitespaceViewportData } from 'vs/editor/common/viewModel/viewModel'; +import * as strings from 'vs/base/common/strings'; + +export interface IEditorWhitespace { + readonly id: string; + readonly afterLineNumber: number; + readonly height: number; +} + +/** + * An accessor that allows for whtiespace to be added, removed or changed in bulk. + */ +export interface IWhitespaceChangeAccessor { + insertWhitespace(afterLineNumber: number, ordinal: number, heightInPx: number, minWidth: number): string; + changeOneWhitespace(id: string, newAfterLineNumber: number, newHeight: number): void; + removeWhitespace(id: string): void; +} + +interface IPendingChange { id: string; newAfterLineNumber: number; newHeight: number; } +interface IPendingRemove { id: string; } + +class PendingChanges { + private _hasPending: boolean; + private _inserts: EditorWhitespace[]; + private _changes: IPendingChange[]; + private _removes: IPendingRemove[]; + + constructor() { + this._hasPending = false; + this._inserts = []; + this._changes = []; + this._removes = []; + } + + public insert(x: EditorWhitespace): void { + this._hasPending = true; + this._inserts.push(x); + } + + public change(x: IPendingChange): void { + this._hasPending = true; + this._changes.push(x); + } + + public remove(x: IPendingRemove): void { + this._hasPending = true; + this._removes.push(x); + } + + public mustCommit(): boolean { + return this._hasPending; + } + + public commit(linesLayout: LinesLayout): void { + if (!this._hasPending) { + return; + } + + const inserts = this._inserts; + const changes = this._changes; + const removes = this._removes; + + this._hasPending = false; + this._inserts = []; + this._changes = []; + this._removes = []; + + linesLayout._commitPendingChanges(inserts, changes, removes); + } +} + +export class EditorWhitespace implements IEditorWhitespace { + public id: string; + public afterLineNumber: number; + public ordinal: number; + public height: number; + public minWidth: number; + public prefixSum: number; + + constructor(id: string, afterLineNumber: number, ordinal: number, height: number, minWidth: number) { + this.id = id; + this.afterLineNumber = afterLineNumber; + this.ordinal = ordinal; + this.height = height; + this.minWidth = minWidth; + this.prefixSum = 0; + } +} /** * Layouting of objects that take vertical space (by having a height) and push down other objects. * * These objects are basically either text (lines) or spaces between those lines (whitespaces). * This provides commodity operations for working with lines that contain whitespace that pushes lines lower (vertically). - * This is written with no knowledge of an editor in mind. */ export class LinesLayout { - /** - * Keep track of the total number of lines. - * This is useful for doing binary searches or for doing hit-testing. - */ - private _lineCount: number; + private static INSTANCE_COUNT = 0; - /** - * The height of a line in pixels. - */ + private readonly _instanceId: string; + private readonly _pendingChanges: PendingChanges; + private _lastWhitespaceId: number; + private _arr: EditorWhitespace[]; + private _prefixSumValidIndex: number; + private _minWidth: number; + private _lineCount: number; private _lineHeight: number; + private _paddingTop: number; + private _paddingBottom: number; + + constructor(lineCount: number, lineHeight: number, paddingTop: number, paddingBottom: number) { + this._instanceId = strings.singleLetterHash(++LinesLayout.INSTANCE_COUNT); + this._pendingChanges = new PendingChanges(); + this._lastWhitespaceId = 0; + this._arr = []; + this._prefixSumValidIndex = -1; + this._minWidth = -1; /* marker for not being computed */ + this._lineCount = lineCount; + this._lineHeight = lineHeight; + this._paddingTop = paddingTop; + this._paddingBottom = paddingBottom; + } /** - * Contains whitespace information in pixels + * Find the insertion index for a new value inside a sorted array of values. + * If the value is already present in the sorted array, the insertion index will be after the already existing value. */ - private readonly _whitespaces: WhitespaceComputer; + public static findInsertionIndex(arr: EditorWhitespace[], afterLineNumber: number, ordinal: number): number { + let low = 0; + let high = arr.length; - constructor(lineCount: number, lineHeight: number) { - this._lineCount = lineCount; - this._lineHeight = lineHeight; - this._whitespaces = new WhitespaceComputer(); + while (low < high) { + const mid = ((low + high) >>> 1); + + if (afterLineNumber === arr[mid].afterLineNumber) { + if (ordinal < arr[mid].ordinal) { + high = mid; + } else { + low = mid + 1; + } + } else if (afterLineNumber < arr[mid].afterLineNumber) { + high = mid; + } else { + low = mid + 1; + } + } + + return low; } /** * Change the height of a line in pixels. */ public setLineHeight(lineHeight: number): void { + this._checkPendingChanges(); this._lineHeight = lineHeight; } + /** + * Changes the padding used to calculate vertical offsets. + */ + public setPadding(paddingTop: number, paddingBottom: number): void { + this._paddingTop = paddingTop; + this._paddingBottom = paddingBottom; + } + /** * Set the number of lines. * * @param lineCount New number of lines. */ public onFlushed(lineCount: number): void { + this._checkPendingChanges(); this._lineCount = lineCount; } - /** - * Insert a new whitespace of a certain height after a line number. - * The whitespace has a "sticky" characteristic. - * Irrespective of edits above or below `afterLineNumber`, the whitespace will follow the initial line. - * - * @param afterLineNumber The conceptual position of this whitespace. The whitespace will follow this line as best as possible even when deleting/inserting lines above/below. - * @param heightInPx The height of the whitespace, in pixels. - * @return An id that can be used later to mutate or delete the whitespace - */ - public insertWhitespace(afterLineNumber: number, ordinal: number, heightInPx: number, minWidth: number): string { - return this._whitespaces.insertWhitespace(afterLineNumber, ordinal, heightInPx, minWidth); + public changeWhitespace(callback: (accessor: IWhitespaceChangeAccessor) => T): T { + try { + const accessor = { + insertWhitespace: (afterLineNumber: number, ordinal: number, heightInPx: number, minWidth: number): string => { + afterLineNumber = afterLineNumber | 0; + ordinal = ordinal | 0; + heightInPx = heightInPx | 0; + minWidth = minWidth | 0; + + const id = this._instanceId + (++this._lastWhitespaceId); + this._pendingChanges.insert(new EditorWhitespace(id, afterLineNumber, ordinal, heightInPx, minWidth)); + return id; + }, + changeOneWhitespace: (id: string, newAfterLineNumber: number, newHeight: number): void => { + newAfterLineNumber = newAfterLineNumber | 0; + newHeight = newHeight | 0; + + this._pendingChanges.change({ id, newAfterLineNumber, newHeight }); + }, + removeWhitespace: (id: string): void => { + this._pendingChanges.remove({ id }); + } + }; + return callback(accessor); + } finally { + this._pendingChanges.commit(this); + } } - /** - * Change properties associated with a certain whitespace. - */ - public changeWhitespace(id: string, newAfterLineNumber: number, newHeight: number): boolean { - return this._whitespaces.changeWhitespace(id, newAfterLineNumber, newHeight); + public _commitPendingChanges(inserts: EditorWhitespace[], changes: IPendingChange[], removes: IPendingRemove[]): void { + if (inserts.length > 0 || removes.length > 0) { + this._minWidth = -1; /* marker for not being computed */ + } + + if (inserts.length + changes.length + removes.length <= 1) { + // when only one thing happened, handle it "delicately" + for (const insert of inserts) { + this._insertWhitespace(insert); + } + for (const change of changes) { + this._changeOneWhitespace(change.id, change.newAfterLineNumber, change.newHeight); + } + for (const remove of removes) { + const index = this._findWhitespaceIndex(remove.id); + if (index === -1) { + continue; + } + this._removeWhitespace(index); + } + return; + } + + // simply rebuild the entire datastructure + + const toRemove = new Set(); + for (const remove of removes) { + toRemove.add(remove.id); + } + + const toChange = new Map(); + for (const change of changes) { + toChange.set(change.id, change); + } + + const applyRemoveAndChange = (whitespaces: EditorWhitespace[]): EditorWhitespace[] => { + let result: EditorWhitespace[] = []; + for (const whitespace of whitespaces) { + if (toRemove.has(whitespace.id)) { + continue; + } + if (toChange.has(whitespace.id)) { + const change = toChange.get(whitespace.id)!; + whitespace.afterLineNumber = change.newAfterLineNumber; + whitespace.height = change.newHeight; + } + result.push(whitespace); + } + return result; + }; + + const result = applyRemoveAndChange(this._arr).concat(applyRemoveAndChange(inserts)); + result.sort((a, b) => { + if (a.afterLineNumber === b.afterLineNumber) { + return a.ordinal - b.ordinal; + } + return a.afterLineNumber - b.afterLineNumber; + }); + + this._arr = result; + this._prefixSumValidIndex = -1; } - /** - * Remove an existing whitespace. - * - * @param id The whitespace to remove - * @return Returns true if the whitespace is found and it is removed. - */ - public removeWhitespace(id: string): boolean { - return this._whitespaces.removeWhitespace(id); + private _checkPendingChanges(): void { + if (this._pendingChanges.mustCommit()) { + this._pendingChanges.commit(this); + } + } + + private _insertWhitespace(whitespace: EditorWhitespace): void { + const insertIndex = LinesLayout.findInsertionIndex(this._arr, whitespace.afterLineNumber, whitespace.ordinal); + this._arr.splice(insertIndex, 0, whitespace); + this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, insertIndex - 1); + } + + private _findWhitespaceIndex(id: string): number { + const arr = this._arr; + for (let i = 0, len = arr.length; i < len; i++) { + if (arr[i].id === id) { + return i; + } + } + return -1; + } + + private _changeOneWhitespace(id: string, newAfterLineNumber: number, newHeight: number): void { + const index = this._findWhitespaceIndex(id); + if (index === -1) { + return; + } + if (this._arr[index].height !== newHeight) { + this._arr[index].height = newHeight; + this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, index - 1); + } + if (this._arr[index].afterLineNumber !== newAfterLineNumber) { + // `afterLineNumber` changed for this whitespace + + // Record old whitespace + const whitespace = this._arr[index]; + + // Since changing `afterLineNumber` can trigger a reordering, we're gonna remove this whitespace + this._removeWhitespace(index); + + whitespace.afterLineNumber = newAfterLineNumber; + + // And add it again + this._insertWhitespace(whitespace); + } + } + + private _removeWhitespace(removeIndex: number): void { + this._arr.splice(removeIndex, 1); + this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, removeIndex - 1); } /** @@ -91,8 +331,24 @@ export class LinesLayout { * @param toLineNumber The line number at which the deletion ended, inclusive */ public onLinesDeleted(fromLineNumber: number, toLineNumber: number): void { + this._checkPendingChanges(); + fromLineNumber = fromLineNumber | 0; + toLineNumber = toLineNumber | 0; + this._lineCount -= (toLineNumber - fromLineNumber + 1); - this._whitespaces.onLinesDeleted(fromLineNumber, toLineNumber); + for (let i = 0, len = this._arr.length; i < len; i++) { + const afterLineNumber = this._arr[i].afterLineNumber; + + if (fromLineNumber <= afterLineNumber && afterLineNumber <= toLineNumber) { + // The line this whitespace was after has been deleted + // => move whitespace to before first deleted line + this._arr[i].afterLineNumber = fromLineNumber - 1; + } else if (afterLineNumber > toLineNumber) { + // The line this whitespace was after has been moved up + // => move whitespace up + this._arr[i].afterLineNumber -= (toLineNumber - fromLineNumber + 1); + } + } } /** @@ -102,8 +358,53 @@ export class LinesLayout { * @param toLineNumber The line number at which the insertion ended, inclusive. */ public onLinesInserted(fromLineNumber: number, toLineNumber: number): void { + this._checkPendingChanges(); + fromLineNumber = fromLineNumber | 0; + toLineNumber = toLineNumber | 0; + this._lineCount += (toLineNumber - fromLineNumber + 1); - this._whitespaces.onLinesInserted(fromLineNumber, toLineNumber); + for (let i = 0, len = this._arr.length; i < len; i++) { + const afterLineNumber = this._arr[i].afterLineNumber; + + if (fromLineNumber <= afterLineNumber) { + this._arr[i].afterLineNumber += (toLineNumber - fromLineNumber + 1); + } + } + } + + /** + * Get the sum of all the whitespaces. + */ + public getWhitespacesTotalHeight(): number { + this._checkPendingChanges(); + if (this._arr.length === 0) { + return 0; + } + return this.getWhitespacesAccumulatedHeight(this._arr.length - 1); + } + + /** + * Return the sum of the heights of the whitespaces at [0..index]. + * This includes the whitespace at `index`. + * + * @param index The index of the whitespace. + * @return The sum of the heights of all whitespaces before the one at `index`, including the one at `index`. + */ + public getWhitespacesAccumulatedHeight(index: number): number { + this._checkPendingChanges(); + index = index | 0; + + let startIndex = Math.max(0, this._prefixSumValidIndex + 1); + if (startIndex === 0) { + this._arr[0].prefixSum = this._arr[0].height; + startIndex++; + } + + for (let i = startIndex; i <= index; i++) { + this._arr[i].prefixSum = this._arr[i - 1].prefixSum + this._arr[i].height; + } + this._prefixSumValidIndex = Math.max(this._prefixSumValidIndex, index); + return this._arr[index].prefixSum; } /** @@ -112,9 +413,80 @@ export class LinesLayout { * @return The sum of heights for all objects. */ public getLinesTotalHeight(): number { - let linesHeight = this._lineHeight * this._lineCount; - let whitespacesHeight = this._whitespaces.getTotalHeight(); - return linesHeight + whitespacesHeight; + this._checkPendingChanges(); + const linesHeight = this._lineHeight * this._lineCount; + const whitespacesHeight = this.getWhitespacesTotalHeight(); + + return linesHeight + whitespacesHeight + this._paddingTop + this._paddingBottom; + } + + /** + * Returns the accumulated height of whitespaces before the given line number. + * + * @param lineNumber The line number + */ + public getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber: number): number { + this._checkPendingChanges(); + lineNumber = lineNumber | 0; + + const lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber); + + if (lastWhitespaceBeforeLineNumber === -1) { + return 0; + } + + return this.getWhitespacesAccumulatedHeight(lastWhitespaceBeforeLineNumber); + } + + private _findLastWhitespaceBeforeLineNumber(lineNumber: number): number { + lineNumber = lineNumber | 0; + + // Find the whitespace before line number + const arr = this._arr; + let low = 0; + let high = arr.length - 1; + + while (low <= high) { + const delta = (high - low) | 0; + const halfDelta = (delta / 2) | 0; + const mid = (low + halfDelta) | 0; + + if (arr[mid].afterLineNumber < lineNumber) { + if (mid + 1 >= arr.length || arr[mid + 1].afterLineNumber >= lineNumber) { + return mid; + } else { + low = (mid + 1) | 0; + } + } else { + high = (mid - 1) | 0; + } + } + + return -1; + } + + private _findFirstWhitespaceAfterLineNumber(lineNumber: number): number { + lineNumber = lineNumber | 0; + + const lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber); + const firstWhitespaceAfterLineNumber = lastWhitespaceBeforeLineNumber + 1; + + if (firstWhitespaceAfterLineNumber < this._arr.length) { + return firstWhitespaceAfterLineNumber; + } + + return -1; + } + + /** + * Find the index of the first whitespace which has `afterLineNumber` >= `lineNumber`. + * @return The index of the first whitespace with `afterLineNumber` >= `lineNumber` or -1 if no whitespace is found. + */ + public getFirstWhitespaceIndexAfterLineNumber(lineNumber: number): number { + this._checkPendingChanges(); + lineNumber = lineNumber | 0; + + return this._findFirstWhitespaceAfterLineNumber(lineNumber); } /** @@ -124,6 +496,7 @@ export class LinesLayout { * @return The sum of heights for all objects above `lineNumber`. */ public getVerticalOffsetForLineNumber(lineNumber: number): number { + this._checkPendingChanges(); lineNumber = lineNumber | 0; let previousLinesHeight: number; @@ -133,36 +506,40 @@ export class LinesLayout { previousLinesHeight = 0; } - let previousWhitespacesHeight = this._whitespaces.getAccumulatedHeightBeforeLineNumber(lineNumber); - - return previousLinesHeight + previousWhitespacesHeight; - } + const previousWhitespacesHeight = this.getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber); - /** - * Returns the accumulated height of whitespaces before the given line number. - * - * @param lineNumber The line number - */ - public getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber: number): number { - return this._whitespaces.getAccumulatedHeightBeforeLineNumber(lineNumber); + return previousLinesHeight + previousWhitespacesHeight + this._paddingTop; } /** * Returns if there is any whitespace in the document. */ public hasWhitespace(): boolean { - return this._whitespaces.getCount() > 0; + this._checkPendingChanges(); + return this.getWhitespacesCount() > 0; } + /** + * The maximum min width for all whitespaces. + */ public getWhitespaceMinWidth(): number { - return this._whitespaces.getMinWidth(); + this._checkPendingChanges(); + if (this._minWidth === -1) { + let minWidth = 0; + for (let i = 0, len = this._arr.length; i < len; i++) { + minWidth = Math.max(minWidth, this._arr[i].minWidth); + } + this._minWidth = minWidth; + } + return this._minWidth; } /** * Check if `verticalOffset` is below all lines. */ public isAfterLines(verticalOffset: number): boolean { - let totalHeight = this.getLinesTotalHeight(); + this._checkPendingChanges(); + const totalHeight = this.getLinesTotalHeight(); return verticalOffset > totalHeight; } @@ -175,6 +552,7 @@ export class LinesLayout { * @return The line number at or after vertical offset `verticalOffset`. */ public getLineNumberAtOrAfterVerticalOffset(verticalOffset: number): number { + this._checkPendingChanges(); verticalOffset = verticalOffset | 0; if (verticalOffset < 0) { @@ -187,9 +565,9 @@ export class LinesLayout { let maxLineNumber = linesCount; while (minLineNumber < maxLineNumber) { - let midLineNumber = ((minLineNumber + maxLineNumber) / 2) | 0; + const midLineNumber = ((minLineNumber + maxLineNumber) / 2) | 0; - let midLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(midLineNumber) | 0; + const midLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(midLineNumber) | 0; if (verticalOffset >= midLineNumberVerticalOffset + lineHeight) { // vertical offset is after mid line number @@ -218,6 +596,7 @@ export class LinesLayout { * @return A structure describing the lines positioned between `verticalOffset1` and `verticalOffset2`. */ public getLinesViewportData(verticalOffset1: number, verticalOffset2: number): IPartialViewLinesViewportData { + this._checkPendingChanges(); verticalOffset1 = verticalOffset1 | 0; verticalOffset2 = verticalOffset2 | 0; const lineHeight = this._lineHeight; @@ -230,8 +609,8 @@ export class LinesLayout { let endLineNumber = this._lineCount | 0; // Also keep track of what whitespace we've got - let whitespaceIndex = this._whitespaces.getFirstWhitespaceIndexAfterLineNumber(startLineNumber) | 0; - const whitespaceCount = this._whitespaces.getCount() | 0; + let whitespaceIndex = this.getFirstWhitespaceIndexAfterLineNumber(startLineNumber) | 0; + const whitespaceCount = this.getWhitespacesCount() | 0; let currentWhitespaceHeight: number; let currentWhitespaceAfterLineNumber: number; @@ -240,8 +619,8 @@ export class LinesLayout { currentWhitespaceAfterLineNumber = endLineNumber + 1; currentWhitespaceHeight = 0; } else { - currentWhitespaceAfterLineNumber = this._whitespaces.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0; - currentWhitespaceHeight = this._whitespaces.getHeightForWhitespaceIndex(whitespaceIndex) | 0; + currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0; + currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0; } let currentVerticalOffset = startLineNumberVerticalOffset; @@ -258,7 +637,7 @@ export class LinesLayout { currentLineRelativeOffset -= bigNumbersDelta; } - let linesOffsets: number[] = []; + const linesOffsets: number[] = []; const verticalCenter = verticalOffset1 + (verticalOffset2 - verticalOffset1) / 2; let centeredLineNumber = -1; @@ -267,8 +646,8 @@ export class LinesLayout { for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) { if (centeredLineNumber === -1) { - let currentLineTop = currentVerticalOffset; - let currentLineBottom = currentVerticalOffset + lineHeight; + const currentLineTop = currentVerticalOffset; + const currentLineBottom = currentVerticalOffset + lineHeight; if ((currentLineTop <= verticalCenter && verticalCenter < currentLineBottom) || currentLineTop > verticalCenter) { centeredLineNumber = lineNumber; } @@ -291,8 +670,8 @@ export class LinesLayout { if (whitespaceIndex >= whitespaceCount) { currentWhitespaceAfterLineNumber = endLineNumber + 1; } else { - currentWhitespaceAfterLineNumber = this._whitespaces.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0; - currentWhitespaceHeight = this._whitespaces.getHeightForWhitespaceIndex(whitespaceIndex) | 0; + currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0; + currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0; } } @@ -335,9 +714,10 @@ export class LinesLayout { } public getVerticalOffsetForWhitespaceIndex(whitespaceIndex: number): number { + this._checkPendingChanges(); whitespaceIndex = whitespaceIndex | 0; - let afterLineNumber = this._whitespaces.getAfterLineNumberForWhitespaceIndex(whitespaceIndex); + const afterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex); let previousLinesHeight: number; if (afterLineNumber >= 1) { @@ -348,38 +728,36 @@ export class LinesLayout { let previousWhitespacesHeight: number; if (whitespaceIndex > 0) { - previousWhitespacesHeight = this._whitespaces.getAccumulatedHeight(whitespaceIndex - 1); + previousWhitespacesHeight = this.getWhitespacesAccumulatedHeight(whitespaceIndex - 1); } else { previousWhitespacesHeight = 0; } - return previousLinesHeight + previousWhitespacesHeight; + return previousLinesHeight + previousWhitespacesHeight + this._paddingTop; } public getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset: number): number { + this._checkPendingChanges(); verticalOffset = verticalOffset | 0; - let midWhitespaceIndex: number, - minWhitespaceIndex = 0, - maxWhitespaceIndex = this._whitespaces.getCount() - 1, - midWhitespaceVerticalOffset: number, - midWhitespaceHeight: number; + let minWhitespaceIndex = 0; + let maxWhitespaceIndex = this.getWhitespacesCount() - 1; if (maxWhitespaceIndex < 0) { return -1; } // Special case: nothing to be found - let maxWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(maxWhitespaceIndex); - let maxWhitespaceHeight = this._whitespaces.getHeightForWhitespaceIndex(maxWhitespaceIndex); + const maxWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(maxWhitespaceIndex); + const maxWhitespaceHeight = this.getHeightForWhitespaceIndex(maxWhitespaceIndex); if (verticalOffset >= maxWhitespaceVerticalOffset + maxWhitespaceHeight) { return -1; } while (minWhitespaceIndex < maxWhitespaceIndex) { - midWhitespaceIndex = Math.floor((minWhitespaceIndex + maxWhitespaceIndex) / 2); + const midWhitespaceIndex = Math.floor((minWhitespaceIndex + maxWhitespaceIndex) / 2); - midWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(midWhitespaceIndex); - midWhitespaceHeight = this._whitespaces.getHeightForWhitespaceIndex(midWhitespaceIndex); + const midWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(midWhitespaceIndex); + const midWhitespaceHeight = this.getHeightForWhitespaceIndex(midWhitespaceIndex); if (verticalOffset >= midWhitespaceVerticalOffset + midWhitespaceHeight) { // vertical offset is after whitespace @@ -402,27 +780,28 @@ export class LinesLayout { * @return Precisely the whitespace that is layouted at `verticaloffset` or null. */ public getWhitespaceAtVerticalOffset(verticalOffset: number): IViewWhitespaceViewportData | null { + this._checkPendingChanges(); verticalOffset = verticalOffset | 0; - let candidateIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset); + const candidateIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset); if (candidateIndex < 0) { return null; } - if (candidateIndex >= this._whitespaces.getCount()) { + if (candidateIndex >= this.getWhitespacesCount()) { return null; } - let candidateTop = this.getVerticalOffsetForWhitespaceIndex(candidateIndex); + const candidateTop = this.getVerticalOffsetForWhitespaceIndex(candidateIndex); if (candidateTop > verticalOffset) { return null; } - let candidateHeight = this._whitespaces.getHeightForWhitespaceIndex(candidateIndex); - let candidateId = this._whitespaces.getIdForWhitespaceIndex(candidateIndex); - let candidateAfterLineNumber = this._whitespaces.getAfterLineNumberForWhitespaceIndex(candidateIndex); + const candidateHeight = this.getHeightForWhitespaceIndex(candidateIndex); + const candidateId = this.getIdForWhitespaceIndex(candidateIndex); + const candidateAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(candidateIndex); return { id: candidateId, @@ -440,11 +819,12 @@ export class LinesLayout { * @return An array with all the whitespaces in the viewport. If no whitespace is in viewport, the array is empty. */ public getWhitespaceViewportData(verticalOffset1: number, verticalOffset2: number): IViewWhitespaceViewportData[] { + this._checkPendingChanges(); verticalOffset1 = verticalOffset1 | 0; verticalOffset2 = verticalOffset2 | 0; - let startIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset1); - let endIndex = this._whitespaces.getCount() - 1; + const startIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset1); + const endIndex = this.getWhitespacesCount() - 1; if (startIndex < 0) { return []; @@ -452,15 +832,15 @@ export class LinesLayout { let result: IViewWhitespaceViewportData[] = []; for (let i = startIndex; i <= endIndex; i++) { - let top = this.getVerticalOffsetForWhitespaceIndex(i); - let height = this._whitespaces.getHeightForWhitespaceIndex(i); + const top = this.getVerticalOffsetForWhitespaceIndex(i); + const height = this.getHeightForWhitespaceIndex(i); if (top >= verticalOffset2) { break; } result.push({ - id: this._whitespaces.getIdForWhitespaceIndex(i), - afterLineNumber: this._whitespaces.getAfterLineNumberForWhitespaceIndex(i), + id: this.getIdForWhitespaceIndex(i), + afterLineNumber: this.getAfterLineNumberForWhitespaceIndex(i), verticalOffset: top, height: height }); @@ -473,6 +853,54 @@ export class LinesLayout { * Get all whitespaces. */ public getWhitespaces(): IEditorWhitespace[] { - return this._whitespaces.getWhitespaces(this._lineHeight); + this._checkPendingChanges(); + return this._arr.slice(0); + } + + /** + * The number of whitespaces. + */ + public getWhitespacesCount(): number { + this._checkPendingChanges(); + return this._arr.length; + } + + /** + * Get the `id` for whitespace at index `index`. + * + * @param index The index of the whitespace. + * @return `id` of whitespace at `index`. + */ + public getIdForWhitespaceIndex(index: number): string { + this._checkPendingChanges(); + index = index | 0; + + return this._arr[index].id; + } + + /** + * Get the `afterLineNumber` for whitespace at index `index`. + * + * @param index The index of the whitespace. + * @return `afterLineNumber` of whitespace at `index`. + */ + public getAfterLineNumberForWhitespaceIndex(index: number): number { + this._checkPendingChanges(); + index = index | 0; + + return this._arr[index].afterLineNumber; + } + + /** + * Get the `height` for whitespace at index `index`. + * + * @param index The index of the whitespace. + * @return `height` of whitespace at `index`. + */ + public getHeightForWhitespaceIndex(index: number): number { + this._checkPendingChanges(); + index = index | 0; + + return this._arr[index].height; } } diff --git a/src/vs/editor/common/viewLayout/viewLayout.ts b/src/vs/editor/common/viewLayout/viewLayout.ts index 74fca28d02999..4187f4da60b1f 100644 --- a/src/vs/editor/common/viewLayout/viewLayout.ts +++ b/src/vs/editor/common/viewLayout/viewLayout.ts @@ -3,43 +3,179 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Event } from 'vs/base/common/event'; +import { Event, Emitter } from 'vs/base/common/event'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; -import { IScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable'; +import { IScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility, INewScrollPosition } from 'vs/base/common/scrollable'; import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions'; -import * as editorCommon from 'vs/editor/common/editorCommon'; -import { LinesLayout } from 'vs/editor/common/viewLayout/linesLayout'; +import { IConfiguration, IContentSizeChangedEvent } from 'vs/editor/common/editorCommon'; +import { LinesLayout, IEditorWhitespace, IWhitespaceChangeAccessor } from 'vs/editor/common/viewLayout/linesLayout'; import { IPartialViewLinesViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'; -import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer'; import { IViewLayout, IViewWhitespaceViewportData, Viewport } from 'vs/editor/common/viewModel/viewModel'; const SMOOTH_SCROLLING_TIME = 125; +class EditorScrollDimensions { + + public readonly width: number; + public readonly contentWidth: number; + public readonly scrollWidth: number; + + public readonly height: number; + public readonly contentHeight: number; + public readonly scrollHeight: number; + + constructor( + width: number, + contentWidth: number, + height: number, + contentHeight: number, + ) { + width = width | 0; + contentWidth = contentWidth | 0; + height = height | 0; + contentHeight = contentHeight | 0; + + if (width < 0) { + width = 0; + } + if (contentWidth < 0) { + contentWidth = 0; + } + + if (height < 0) { + height = 0; + } + if (contentHeight < 0) { + contentHeight = 0; + } + + this.width = width; + this.contentWidth = contentWidth; + this.scrollWidth = Math.max(width, contentWidth); + + this.height = height; + this.contentHeight = contentHeight; + this.scrollHeight = Math.max(height, contentHeight); + } + + public equals(other: EditorScrollDimensions): boolean { + return ( + this.width === other.width + && this.contentWidth === other.contentWidth + && this.height === other.height + && this.contentHeight === other.contentHeight + ); + } +} + +class EditorScrollable extends Disposable { + + private readonly _scrollable: Scrollable; + private _dimensions: EditorScrollDimensions; + + public readonly onDidScroll: Event; + + private readonly _onDidContentSizeChange = this._register(new Emitter()); + public readonly onDidContentSizeChange: Event = this._onDidContentSizeChange.event; + + constructor(smoothScrollDuration: number, scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable) { + super(); + this._dimensions = new EditorScrollDimensions(0, 0, 0, 0); + this._scrollable = this._register(new Scrollable(smoothScrollDuration, scheduleAtNextAnimationFrame)); + this.onDidScroll = this._scrollable.onScroll; + } + + public getScrollable(): Scrollable { + return this._scrollable; + } + + public setSmoothScrollDuration(smoothScrollDuration: number): void { + this._scrollable.setSmoothScrollDuration(smoothScrollDuration); + } + + public validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition { + return this._scrollable.validateScrollPosition(scrollPosition); + } + + public getScrollDimensions(): EditorScrollDimensions { + return this._dimensions; + } + + public setScrollDimensions(dimensions: EditorScrollDimensions): void { + if (this._dimensions.equals(dimensions)) { + return; + } + + const oldDimensions = this._dimensions; + this._dimensions = dimensions; + + this._scrollable.setScrollDimensions({ + width: dimensions.width, + scrollWidth: dimensions.scrollWidth, + height: dimensions.height, + scrollHeight: dimensions.scrollHeight + }); + + const contentWidthChanged = (oldDimensions.contentWidth !== dimensions.contentWidth); + const contentHeightChanged = (oldDimensions.contentHeight !== dimensions.contentHeight); + if (contentWidthChanged || contentHeightChanged) { + this._onDidContentSizeChange.fire({ + contentWidth: dimensions.contentWidth, + contentHeight: dimensions.contentHeight, + + contentWidthChanged: contentWidthChanged, + contentHeightChanged: contentHeightChanged + }); + } + } + + public getFutureScrollPosition(): IScrollPosition { + return this._scrollable.getFutureScrollPosition(); + } + + public getCurrentScrollPosition(): IScrollPosition { + return this._scrollable.getCurrentScrollPosition(); + } + + public setScrollPositionNow(update: INewScrollPosition): void { + this._scrollable.setScrollPositionNow(update); + } + + public setScrollPositionSmooth(update: INewScrollPosition): void { + this._scrollable.setScrollPositionSmooth(update); + } +} + export class ViewLayout extends Disposable implements IViewLayout { - private readonly _configuration: editorCommon.IConfiguration; + private readonly _configuration: IConfiguration; private readonly _linesLayout: LinesLayout; - public readonly scrollable: Scrollable; + private readonly _scrollable: EditorScrollable; public readonly onDidScroll: Event; + public readonly onDidContentSizeChange: Event; - constructor(configuration: editorCommon.IConfiguration, lineCount: number, scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable) { + constructor(configuration: IConfiguration, lineCount: number, scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable) { super(); this._configuration = configuration; const options = this._configuration.options; const layoutInfo = options.get(EditorOption.layoutInfo); + const padding = options.get(EditorOption.padding); - this._linesLayout = new LinesLayout(lineCount, options.get(EditorOption.lineHeight)); + this._linesLayout = new LinesLayout(lineCount, options.get(EditorOption.lineHeight), padding.top, padding.bottom); - this.scrollable = this._register(new Scrollable(0, scheduleAtNextAnimationFrame)); + this._scrollable = this._register(new EditorScrollable(0, scheduleAtNextAnimationFrame)); this._configureSmoothScrollDuration(); - this.scrollable.setScrollDimensions({ - width: layoutInfo.contentWidth, - height: layoutInfo.contentHeight - }); - this.onDidScroll = this.scrollable.onScroll; + this._scrollable.setScrollDimensions(new EditorScrollDimensions( + layoutInfo.contentWidth, + 0, + layoutInfo.height, + 0 + )); + this.onDidScroll = this._scrollable.onDidScroll; + this.onDidContentSizeChange = this._scrollable.onDidContentSizeChange; this._updateHeight(); } @@ -48,12 +184,16 @@ export class ViewLayout extends Disposable implements IViewLayout { super.dispose(); } + public getScrollable(): Scrollable { + return this._scrollable.getScrollable(); + } + public onHeightMaybeChanged(): void { this._updateHeight(); } private _configureSmoothScrollDuration(): void { - this.scrollable.setSmoothScrollDuration(this._configuration.options.get(EditorOption.smoothScrolling) ? SMOOTH_SCROLLING_TIME : 0); + this._scrollable.setSmoothScrollDuration(this._configuration.options.get(EditorOption.smoothScrolling) ? SMOOTH_SCROLLING_TIME : 0); } // ---- begin view event handlers @@ -63,19 +203,22 @@ export class ViewLayout extends Disposable implements IViewLayout { if (e.hasChanged(EditorOption.lineHeight)) { this._linesLayout.setLineHeight(options.get(EditorOption.lineHeight)); } + if (e.hasChanged(EditorOption.padding)) { + const padding = options.get(EditorOption.padding); + this._linesLayout.setPadding(padding.top, padding.bottom); + } if (e.hasChanged(EditorOption.layoutInfo)) { const layoutInfo = options.get(EditorOption.layoutInfo); const width = layoutInfo.contentWidth; - const height = layoutInfo.contentHeight; - const scrollDimensions = this.scrollable.getScrollDimensions(); + const height = layoutInfo.height; + const scrollDimensions = this._scrollable.getScrollDimensions(); const scrollWidth = scrollDimensions.scrollWidth; - const scrollHeight = this._getTotalHeight(width, height, scrollWidth); - - this.scrollable.setScrollDimensions({ - width: width, - height: height, - scrollHeight: scrollHeight - }); + this._scrollable.setScrollDimensions(new EditorScrollDimensions( + width, + scrollDimensions.contentWidth, + height, + this._getContentHeight(width, height, scrollWidth) + )); } else { this._updateHeight(); } @@ -109,7 +252,7 @@ export class ViewLayout extends Disposable implements IViewLayout { return scrollbar.horizontalScrollbarSize; } - private _getTotalHeight(width: number, height: number, scrollWidth: number): number { + private _getContentHeight(width: number, height: number, scrollWidth: number): number { const options = this._configuration.options; let result = this._linesLayout.getLinesTotalHeight(); @@ -119,25 +262,27 @@ export class ViewLayout extends Disposable implements IViewLayout { result += this._getHorizontalScrollbarHeight(width, scrollWidth); } - return Math.max(height, result); + return result; } private _updateHeight(): void { - const scrollDimensions = this.scrollable.getScrollDimensions(); + const scrollDimensions = this._scrollable.getScrollDimensions(); const width = scrollDimensions.width; const height = scrollDimensions.height; const scrollWidth = scrollDimensions.scrollWidth; - const scrollHeight = this._getTotalHeight(width, height, scrollWidth); - this.scrollable.setScrollDimensions({ - scrollHeight: scrollHeight - }); + this._scrollable.setScrollDimensions(new EditorScrollDimensions( + width, + scrollDimensions.contentWidth, + height, + this._getContentHeight(width, height, scrollWidth) + )); } // ---- Layouting logic public getCurrentViewport(): Viewport { - const scrollDimensions = this.scrollable.getScrollDimensions(); - const currentScrollPosition = this.scrollable.getCurrentScrollPosition(); + const scrollDimensions = this._scrollable.getScrollDimensions(); + const currentScrollPosition = this._scrollable.getCurrentScrollPosition(); return new Viewport( currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, @@ -147,8 +292,8 @@ export class ViewLayout extends Disposable implements IViewLayout { } public getFutureViewport(): Viewport { - const scrollDimensions = this.scrollable.getScrollDimensions(); - const currentScrollPosition = this.scrollable.getFutureScrollPosition(); + const scrollDimensions = this._scrollable.getScrollDimensions(); + const currentScrollPosition = this._scrollable.getFutureScrollPosition(); return new Viewport( currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, @@ -157,23 +302,37 @@ export class ViewLayout extends Disposable implements IViewLayout { ); } - private _computeScrollWidth(maxLineWidth: number, viewportWidth: number): number { + private _computeContentWidth(maxLineWidth: number): number { const options = this._configuration.options; const wrappingInfo = options.get(EditorOption.wrappingInfo); - let isViewportWrapping = wrappingInfo.isViewportWrapping; - if (!isViewportWrapping) { - const extraHorizontalSpace = options.get(EditorOption.scrollBeyondLastColumn) * options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; + const fontInfo = options.get(EditorOption.fontInfo); + if (wrappingInfo.isViewportWrapping) { + const layoutInfo = options.get(EditorOption.layoutInfo); + const minimap = options.get(EditorOption.minimap); + if (maxLineWidth > layoutInfo.contentWidth + fontInfo.typicalHalfwidthCharacterWidth) { + // This is a case where viewport wrapping is on, but the line extends above the viewport + if (minimap.enabled && minimap.side === 'right') { + // We need to accomodate the scrollbar width + return maxLineWidth + layoutInfo.verticalScrollbarWidth; + } + } + return maxLineWidth; + } else { + const extraHorizontalSpace = options.get(EditorOption.scrollBeyondLastColumn) * fontInfo.typicalHalfwidthCharacterWidth; const whitespaceMinWidth = this._linesLayout.getWhitespaceMinWidth(); - return Math.max(maxLineWidth + extraHorizontalSpace, viewportWidth, whitespaceMinWidth); + return Math.max(maxLineWidth + extraHorizontalSpace, whitespaceMinWidth); } - return Math.max(maxLineWidth, viewportWidth); } public onMaxLineWidthChanged(maxLineWidth: number): void { - let newScrollWidth = this._computeScrollWidth(maxLineWidth, this.getCurrentViewport().width); - this.scrollable.setScrollDimensions({ - scrollWidth: newScrollWidth - }); + const scrollDimensions = this._scrollable.getScrollDimensions(); + // const newScrollWidth = ; + this._scrollable.setScrollDimensions(new EditorScrollDimensions( + scrollDimensions.width, + this._computeContentWidth(maxLineWidth), + scrollDimensions.height, + scrollDimensions.contentHeight + )); // The height might depend on the fact that there is a horizontal scrollbar or not this._updateHeight(); @@ -182,7 +341,7 @@ export class ViewLayout extends Disposable implements IViewLayout { // ---- view state public saveState(): { scrollTop: number; scrollTopWithoutViewZones: number; scrollLeft: number; } { - const currentScrollPosition = this.scrollable.getFutureScrollPosition(); + const currentScrollPosition = this._scrollable.getFutureScrollPosition(); let scrollTop = currentScrollPosition.scrollTop; let firstLineNumberInViewport = this._linesLayout.getLineNumberAtOrAfterVerticalOffset(scrollTop); let whitespaceAboveFirstLine = this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(firstLineNumberInViewport); @@ -194,15 +353,8 @@ export class ViewLayout extends Disposable implements IViewLayout { } // ---- IVerticalLayoutProvider - - public addWhitespace(afterLineNumber: number, ordinal: number, height: number, minWidth: number): string { - return this._linesLayout.insertWhitespace(afterLineNumber, ordinal, height, minWidth); - } - public changeWhitespace(id: string, newAfterLineNumber: number, newHeight: number): boolean { - return this._linesLayout.changeWhitespace(id, newAfterLineNumber, newHeight); - } - public removeWhitespace(id: string): boolean { - return this._linesLayout.removeWhitespace(id); + public changeWhitespace(callback: (accessor: IWhitespaceChangeAccessor) => T): T { + return this._linesLayout.changeWhitespace(callback); } public getVerticalOffsetForLineNumber(lineNumber: number): number { return this._linesLayout.getVerticalOffsetForLineNumber(lineNumber); @@ -223,7 +375,7 @@ export class ViewLayout extends Disposable implements IViewLayout { } public getLinesViewportDataAtScrollTop(scrollTop: number): IPartialViewLinesViewportData { // do some minimal validations on scrollTop - const scrollDimensions = this.scrollable.getScrollDimensions(); + const scrollDimensions = this._scrollable.getScrollDimensions(); if (scrollTop + scrollDimensions.height > scrollDimensions.scrollHeight) { scrollTop = scrollDimensions.scrollHeight - scrollDimensions.height; } @@ -242,40 +394,47 @@ export class ViewLayout extends Disposable implements IViewLayout { // ---- IScrollingProvider - + public getContentWidth(): number { + const scrollDimensions = this._scrollable.getScrollDimensions(); + return scrollDimensions.contentWidth; + } public getScrollWidth(): number { - const scrollDimensions = this.scrollable.getScrollDimensions(); + const scrollDimensions = this._scrollable.getScrollDimensions(); return scrollDimensions.scrollWidth; } + public getContentHeight(): number { + const scrollDimensions = this._scrollable.getScrollDimensions(); + return scrollDimensions.contentHeight; + } public getScrollHeight(): number { - const scrollDimensions = this.scrollable.getScrollDimensions(); + const scrollDimensions = this._scrollable.getScrollDimensions(); return scrollDimensions.scrollHeight; } public getCurrentScrollLeft(): number { - const currentScrollPosition = this.scrollable.getCurrentScrollPosition(); + const currentScrollPosition = this._scrollable.getCurrentScrollPosition(); return currentScrollPosition.scrollLeft; } public getCurrentScrollTop(): number { - const currentScrollPosition = this.scrollable.getCurrentScrollPosition(); + const currentScrollPosition = this._scrollable.getCurrentScrollPosition(); return currentScrollPosition.scrollTop; } - public validateScrollPosition(scrollPosition: editorCommon.INewScrollPosition): IScrollPosition { - return this.scrollable.validateScrollPosition(scrollPosition); + public validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition { + return this._scrollable.validateScrollPosition(scrollPosition); } - public setScrollPositionNow(position: editorCommon.INewScrollPosition): void { - this.scrollable.setScrollPositionNow(position); + public setScrollPositionNow(position: INewScrollPosition): void { + this._scrollable.setScrollPositionNow(position); } - public setScrollPositionSmooth(position: editorCommon.INewScrollPosition): void { - this.scrollable.setScrollPositionSmooth(position); + public setScrollPositionSmooth(position: INewScrollPosition): void { + this._scrollable.setScrollPositionSmooth(position); } public deltaScrollNow(deltaScrollLeft: number, deltaScrollTop: number): void { - const currentScrollPosition = this.scrollable.getCurrentScrollPosition(); - this.scrollable.setScrollPositionNow({ + const currentScrollPosition = this._scrollable.getCurrentScrollPosition(); + this._scrollable.setScrollPositionNow({ scrollLeft: currentScrollPosition.scrollLeft + deltaScrollLeft, scrollTop: currentScrollPosition.scrollTop + deltaScrollTop }); diff --git a/src/vs/editor/common/viewLayout/viewLineRenderer.ts b/src/vs/editor/common/viewLayout/viewLineRenderer.ts index 5298d234529bc..05e628ab09500 100644 --- a/src/vs/editor/common/viewLayout/viewLineRenderer.ts +++ b/src/vs/editor/common/viewLayout/viewLineRenderer.ts @@ -66,7 +66,10 @@ export class RenderLineInput { public readonly lineTokens: IViewLineTokens; public readonly lineDecorations: LineDecoration[]; public readonly tabSize: number; + public readonly startVisibleColumn: number; public readonly spaceWidth: number; + public readonly renderSpaceWidth: number; + public readonly renderSpaceCharCode: number; public readonly stopRenderingLineAfter: number; public readonly renderWhitespace: RenderWhitespace; public readonly renderControlCharacters: boolean; @@ -89,7 +92,10 @@ export class RenderLineInput { lineTokens: IViewLineTokens, lineDecorations: LineDecoration[], tabSize: number, + startVisibleColumn: number, spaceWidth: number, + middotWidth: number, + wsmiddotWidth: number, stopRenderingLineAfter: number, renderWhitespace: 'none' | 'boundary' | 'selection' | 'all', renderControlCharacters: boolean, @@ -106,6 +112,7 @@ export class RenderLineInput { this.lineTokens = lineTokens; this.lineDecorations = lineDecorations; this.tabSize = tabSize; + this.startVisibleColumn = startVisibleColumn; this.spaceWidth = spaceWidth; this.stopRenderingLineAfter = stopRenderingLineAfter; this.renderWhitespace = ( @@ -120,6 +127,16 @@ export class RenderLineInput { this.renderControlCharacters = renderControlCharacters; this.fontLigatures = fontLigatures; this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a, b) => a.startOffset < b.startOffset ? -1 : 1); + + const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth); + const middotDiff = Math.abs(middotWidth - spaceWidth); + if (wsmiddotDiff < middotDiff) { + this.renderSpaceWidth = wsmiddotWidth; + this.renderSpaceCharCode = 0x2E31; // U+2E31 - WORD SEPARATOR MIDDLE DOT + } else { + this.renderSpaceWidth = middotWidth; + this.renderSpaceCharCode = 0xB7; // U+00B7 - MIDDLE DOT + } } private sameSelection(otherSelections: LineRange[] | null): boolean { @@ -154,7 +171,10 @@ export class RenderLineInput { && this.containsRTL === other.containsRTL && this.fauxIndentLength === other.fauxIndentLength && this.tabSize === other.tabSize + && this.startVisibleColumn === other.startVisibleColumn && this.spaceWidth === other.spaceWidth + && this.renderSpaceWidth === other.renderSpaceWidth + && this.renderSpaceCharCode === other.renderSpaceCharCode && this.stopRenderingLineAfter === other.stopRenderingLineAfter && this.renderWhitespace === other.renderWhitespace && this.renderControlCharacters === other.renderControlCharacters @@ -314,21 +334,24 @@ export function renderViewLine(input: RenderLineInput, sb: IStringBuilder): Rend if (input.lineDecorations.length > 0) { // This line is empty, but it contains inline decorations - let classNames: string[] = []; + const beforeClassNames: string[] = []; + const afterClassNames: string[] = []; for (let i = 0, len = input.lineDecorations.length; i < len; i++) { const lineDecoration = input.lineDecorations[i]; if (lineDecoration.type === InlineDecorationType.Before) { - classNames.push(input.lineDecorations[i].className); + beforeClassNames.push(input.lineDecorations[i].className); containsForeignElements |= ForeignElementType.Before; } if (lineDecoration.type === InlineDecorationType.After) { - classNames.push(input.lineDecorations[i].className); + afterClassNames.push(input.lineDecorations[i].className); containsForeignElements |= ForeignElementType.After; } } if (containsForeignElements !== ForeignElementType.None) { - content = ``; + const beforeSpan = (beforeClassNames.length > 0 ? `` : ``); + const afterSpan = (afterClassNames.length > 0 ? `` : ``); + content = `${beforeSpan}${afterSpan}`; } } @@ -368,9 +391,12 @@ class ResolvedRenderLineInput { public readonly isOverflowing: boolean, public readonly parts: LinePart[], public readonly containsForeignElements: ForeignElementType, + public readonly fauxIndentLength: number, public readonly tabSize: number, + public readonly startVisibleColumn: number, public readonly containsRTL: boolean, public readonly spaceWidth: number, + public readonly renderSpaceCharCode: number, public readonly renderWhitespace: RenderWhitespace, public readonly renderControlCharacters: boolean, ) { @@ -379,7 +405,6 @@ class ResolvedRenderLineInput { } function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput { - const useMonospaceOptimizations = input.useMonospaceOptimizations; const lineContent = input.lineContent; let isOverflowing: boolean; @@ -395,7 +420,7 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput let tokens = transformAndRemoveOverflowing(input.lineTokens, input.fauxIndentLength, len); if (input.renderWhitespace === RenderWhitespace.All || input.renderWhitespace === RenderWhitespace.Boundary || (input.renderWhitespace === RenderWhitespace.Selection && !!input.selectionsOnLine)) { - tokens = _applyRenderWhitespace(lineContent, len, input.continuesWithWrappedLine, tokens, input.fauxIndentLength, input.tabSize, useMonospaceOptimizations, input.selectionsOnLine, input.renderWhitespace === RenderWhitespace.Boundary); + tokens = _applyRenderWhitespace(input, lineContent, len, tokens); } let containsForeignElements = ForeignElementType.None; if (input.lineDecorations.length > 0) { @@ -418,16 +443,19 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput } return new ResolvedRenderLineInput( - useMonospaceOptimizations, + input.useMonospaceOptimizations, input.canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, tokens, containsForeignElements, + input.fauxIndentLength, input.tabSize, + input.startVisibleColumn, input.containsRTL, input.spaceWidth, + input.renderSpaceCharCode, input.renderWhitespace, input.renderControlCharacters ); @@ -533,11 +561,20 @@ function splitLargeTokens(lineContent: string, tokens: LinePart[], onlyAtSpaces: } /** - * Whitespace is rendered by "replacing" tokens with a special-purpose `vs-whitespace` type that is later recognized in the rendering phase. + * Whitespace is rendered by "replacing" tokens with a special-purpose `mtkw` type that is later recognized in the rendering phase. * Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as  . * The rendering phase will generate `style="width:..."` for these tokens. */ -function _applyRenderWhitespace(lineContent: string, len: number, continuesWithWrappedLine: boolean, tokens: LinePart[], fauxIndentLength: number, tabSize: number, useMonospaceOptimizations: boolean, selections: LineRange[] | null, onlyBoundary: boolean): LinePart[] { +function _applyRenderWhitespace(input: RenderLineInput, lineContent: string, len: number, tokens: LinePart[]): LinePart[] { + + const continuesWithWrappedLine = input.continuesWithWrappedLine; + const fauxIndentLength = input.fauxIndentLength; + const tabSize = input.tabSize; + const startVisibleColumn = input.startVisibleColumn; + const useMonospaceOptimizations = input.useMonospaceOptimizations; + const selections = input.selectionsOnLine; + const onlyBoundary = (input.renderWhitespace === RenderWhitespace.Boundary); + const generateLinePartForEachWhitespace = (input.renderSpaceWidth !== input.spaceWidth); let result: LinePart[] = [], resultLen = 0; let tokenIndex = 0; @@ -555,21 +592,10 @@ function _applyRenderWhitespace(lineContent: string, len: number, continuesWithW lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent); } - let tmpIndent = 0; - for (let charIndex = 0; charIndex < fauxIndentLength; charIndex++) { - const chCode = lineContent.charCodeAt(charIndex); - if (chCode === CharCode.Tab) { - tmpIndent = tabSize; - } else if (strings.isFullWidthCharacter(chCode)) { - tmpIndent += 2; - } else { - tmpIndent++; - } - } - tmpIndent = tmpIndent % tabSize; let wasInWhitespace = false; let currentSelectionIndex = 0; let currentSelection = selections && selections[currentSelectionIndex]; + let tmpIndent = startVisibleColumn % tabSize; for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) { const chCode = lineContent.charCodeAt(charIndex); @@ -611,7 +637,14 @@ function _applyRenderWhitespace(lineContent: string, len: number, continuesWithW // was in whitespace token if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) { // leaving whitespace token or entering a new indent - result[resultLen++] = new LinePart(charIndex, 'vs-whitespace'); + if (generateLinePartForEachWhitespace) { + const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength); + for (let i = lastEndIndex + 1; i <= charIndex; i++) { + result[resultLen++] = new LinePart(i, 'mtkw'); + } + } else { + result[resultLen++] = new LinePart(charIndex, 'mtkw'); + } tmpIndent = tmpIndent % tabSize; } } else { @@ -656,7 +689,18 @@ function _applyRenderWhitespace(lineContent: string, len: number, continuesWithW } } - result[resultLen++] = new LinePart(len, generateWhitespace ? 'vs-whitespace' : tokenType); + if (generateWhitespace) { + if (generateLinePartForEachWhitespace) { + const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength); + for (let i = lastEndIndex + 1; i <= len; i++) { + result[resultLen++] = new LinePart(i, 'mtkw'); + } + } else { + result[resultLen++] = new LinePart(len, 'mtkw'); + } + } else { + result[resultLen++] = new LinePart(len, tokenType); + } return result; } @@ -729,16 +773,19 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render const len = input.len; const isOverflowing = input.isOverflowing; const parts = input.parts; + const fauxIndentLength = input.fauxIndentLength; const tabSize = input.tabSize; + const startVisibleColumn = input.startVisibleColumn; const containsRTL = input.containsRTL; const spaceWidth = input.spaceWidth; + const renderSpaceCharCode = input.renderSpaceCharCode; const renderWhitespace = input.renderWhitespace; const renderControlCharacters = input.renderControlCharacters; const characterMapping = new CharacterMapping(len + 1, parts.length); let charIndex = 0; - let tabsCharDelta = 0; + let visibleColumn = startVisibleColumn; let charOffsetInPart = 0; let prevPartContentCnt = 0; @@ -752,11 +799,12 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render const part = parts[partIndex]; const partEndIndex = part.endIndex; const partType = part.type; - const partRendersWhitespace = (renderWhitespace !== RenderWhitespace.None && (partType.indexOf('vs-whitespace') >= 0)); + const partRendersWhitespace = (renderWhitespace !== RenderWhitespace.None && (partType.indexOf('mtkw') >= 0)); + const partRendersWhitespaceWithWidth = partRendersWhitespace && !fontIsMonospace && (partType === 'mtkw'/*only whitespace*/ || !containsForeignElements); charOffsetInPart = 0; sb.appendASCIIString(' 0) { - if (!canUseHalfwidthRightwardsArrow || insertSpacesCount > 1) { - sb.write1(0x2192); // RIGHTWARDS ARROW - } else { - sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW - } - insertSpacesCount--; + charWidth = (tabSize - (visibleColumn % tabSize)) | 0; + + if (!canUseHalfwidthRightwardsArrow || charWidth > 1) { + sb.write1(0x2192); // RIGHTWARDS ARROW + } else { + sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW } - while (insertSpacesCount > 0) { + for (let space = 2; space <= charWidth; space++) { sb.write1(0xA0); //   - insertSpacesCount--; } - } else { - // must be CharCode.Space - sb.write1(0xB7); // · + + } else { // must be CharCode.Space + charWidth = 1; + + sb.write1(renderSpaceCharCode); // · or word separator middle dot } - charOffsetInPart++; + charOffsetInPart += charWidth; + if (charIndex >= fauxIndentLength) { + visibleColumn += charWidth; + } } prevPartContentCnt = partContentCnt; @@ -833,63 +875,59 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset); const charCode = lineContent.charCodeAt(charIndex); + let producedCharacters = 1; + let charWidth = 1; + switch (charCode) { case CharCode.Tab: - let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize; - tabsCharDelta += insertSpacesCount - 1; - charOffsetInPart += insertSpacesCount - 1; - while (insertSpacesCount > 0) { + producedCharacters = (tabSize - (visibleColumn % tabSize)); + charWidth = producedCharacters; + for (let space = 1; space <= producedCharacters; space++) { sb.write1(0xA0); //   - partContentCnt++; - insertSpacesCount--; } break; case CharCode.Space: sb.write1(0xA0); //   - partContentCnt++; break; case CharCode.LessThan: sb.appendASCIIString('<'); - partContentCnt++; break; case CharCode.GreaterThan: sb.appendASCIIString('>'); - partContentCnt++; break; case CharCode.Ampersand: sb.appendASCIIString('&'); - partContentCnt++; break; case CharCode.Null: sb.appendASCIIString('�'); - partContentCnt++; break; case CharCode.UTF8_BOM: case CharCode.LINE_SEPARATOR_2028: sb.write1(0xFFFD); - partContentCnt++; break; default: if (strings.isFullWidthCharacter(charCode)) { - tabsCharDelta++; + charWidth++; } if (renderControlCharacters && charCode < 32) { sb.write1(9216 + charCode); - partContentCnt++; } else { sb.write1(charCode); - partContentCnt++; } } - charOffsetInPart++; + charOffsetInPart += producedCharacters; + partContentCnt += producedCharacters; + if (charIndex >= fauxIndentLength) { + visibleColumn += charWidth; + } } prevPartContentCnt = partContentCnt; diff --git a/src/vs/editor/common/viewLayout/whitespaceComputer.ts b/src/vs/editor/common/viewLayout/whitespaceComputer.ts deleted file mode 100644 index 8e5dd347e8306..0000000000000 --- a/src/vs/editor/common/viewLayout/whitespaceComputer.ts +++ /dev/null @@ -1,493 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as strings from 'vs/base/common/strings'; - -export interface IEditorWhitespace { - readonly id: string; - readonly afterLineNumber: number; - readonly heightInLines: number; -} - -/** - * Represent whitespaces in between lines and provide fast CRUD management methods. - * The whitespaces are sorted ascending by `afterLineNumber`. - */ -export class WhitespaceComputer { - - private static INSTANCE_COUNT = 0; - - private readonly _instanceId: string; - - /** - * heights[i] is the height in pixels for whitespace at index i - */ - private readonly _heights: number[]; - - /** - * minWidths[i] is the min width in pixels for whitespace at index i - */ - private readonly _minWidths: number[]; - - /** - * afterLineNumbers[i] is the line number whitespace at index i is after - */ - private readonly _afterLineNumbers: number[]; - - /** - * ordinals[i] is the orinal of the whitespace at index i - */ - private readonly _ordinals: number[]; - - /** - * prefixSum[i] = SUM(heights[j]), 1 <= j <= i - */ - private readonly _prefixSum: number[]; - - /** - * prefixSum[i], 1 <= i <= prefixSumValidIndex can be trusted - */ - private _prefixSumValidIndex: number; - - /** - * ids[i] is the whitespace id of whitespace at index i - */ - private readonly _ids: string[]; - - /** - * index at which a whitespace is positioned (inside heights, afterLineNumbers, prefixSum members) - */ - private readonly _whitespaceId2Index: { - [id: string]: number; - }; - - /** - * last whitespace id issued - */ - private _lastWhitespaceId: number; - - private _minWidth: number; - - constructor() { - this._instanceId = strings.singleLetterHash(++WhitespaceComputer.INSTANCE_COUNT); - this._heights = []; - this._minWidths = []; - this._ids = []; - this._afterLineNumbers = []; - this._ordinals = []; - this._prefixSum = []; - this._prefixSumValidIndex = -1; - this._whitespaceId2Index = {}; - this._lastWhitespaceId = 0; - this._minWidth = -1; /* marker for not being computed */ - } - - /** - * Find the insertion index for a new value inside a sorted array of values. - * If the value is already present in the sorted array, the insertion index will be after the already existing value. - */ - public static findInsertionIndex(sortedArray: number[], value: number, ordinals: number[], valueOrdinal: number): number { - let low = 0; - let high = sortedArray.length; - - while (low < high) { - let mid = ((low + high) >>> 1); - - if (value === sortedArray[mid]) { - if (valueOrdinal < ordinals[mid]) { - high = mid; - } else { - low = mid + 1; - } - } else if (value < sortedArray[mid]) { - high = mid; - } else { - low = mid + 1; - } - } - - return low; - } - - /** - * Insert a new whitespace of a certain height after a line number. - * The whitespace has a "sticky" characteristic. - * Irrespective of edits above or below `afterLineNumber`, the whitespace will follow the initial line. - * - * @param afterLineNumber The conceptual position of this whitespace. The whitespace will follow this line as best as possible even when deleting/inserting lines above/below. - * @param heightInPx The height of the whitespace, in pixels. - * @return An id that can be used later to mutate or delete the whitespace - */ - public insertWhitespace(afterLineNumber: number, ordinal: number, heightInPx: number, minWidth: number): string { - afterLineNumber = afterLineNumber | 0; - ordinal = ordinal | 0; - heightInPx = heightInPx | 0; - minWidth = minWidth | 0; - - let id = this._instanceId + (++this._lastWhitespaceId); - let insertionIndex = WhitespaceComputer.findInsertionIndex(this._afterLineNumbers, afterLineNumber, this._ordinals, ordinal); - this._insertWhitespaceAtIndex(id, insertionIndex, afterLineNumber, ordinal, heightInPx, minWidth); - this._minWidth = -1; /* marker for not being computed */ - return id; - } - - private _insertWhitespaceAtIndex(id: string, insertIndex: number, afterLineNumber: number, ordinal: number, heightInPx: number, minWidth: number): void { - insertIndex = insertIndex | 0; - afterLineNumber = afterLineNumber | 0; - ordinal = ordinal | 0; - heightInPx = heightInPx | 0; - minWidth = minWidth | 0; - - this._heights.splice(insertIndex, 0, heightInPx); - this._minWidths.splice(insertIndex, 0, minWidth); - this._ids.splice(insertIndex, 0, id); - this._afterLineNumbers.splice(insertIndex, 0, afterLineNumber); - this._ordinals.splice(insertIndex, 0, ordinal); - this._prefixSum.splice(insertIndex, 0, 0); - - let keys = Object.keys(this._whitespaceId2Index); - for (let i = 0, len = keys.length; i < len; i++) { - let sid = keys[i]; - let oldIndex = this._whitespaceId2Index[sid]; - if (oldIndex >= insertIndex) { - this._whitespaceId2Index[sid] = oldIndex + 1; - } - } - - this._whitespaceId2Index[id] = insertIndex; - this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, insertIndex - 1); - } - - /** - * Change properties associated with a certain whitespace. - */ - public changeWhitespace(id: string, newAfterLineNumber: number, newHeight: number): boolean { - newAfterLineNumber = newAfterLineNumber | 0; - newHeight = newHeight | 0; - - let hasChanges = false; - hasChanges = this.changeWhitespaceHeight(id, newHeight) || hasChanges; - hasChanges = this.changeWhitespaceAfterLineNumber(id, newAfterLineNumber) || hasChanges; - return hasChanges; - } - - /** - * Change the height of an existing whitespace - * - * @param id The whitespace to change - * @param newHeightInPx The new height of the whitespace, in pixels - * @return Returns true if the whitespace is found and if the new height is different than the old height - */ - public changeWhitespaceHeight(id: string, newHeightInPx: number): boolean { - newHeightInPx = newHeightInPx | 0; - - if (this._whitespaceId2Index.hasOwnProperty(id)) { - let index = this._whitespaceId2Index[id]; - if (this._heights[index] !== newHeightInPx) { - this._heights[index] = newHeightInPx; - this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, index - 1); - return true; - } - } - return false; - } - - /** - * Change the line number after which an existing whitespace flows. - * - * @param id The whitespace to change - * @param newAfterLineNumber The new line number the whitespace will follow - * @return Returns true if the whitespace is found and if the new line number is different than the old line number - */ - public changeWhitespaceAfterLineNumber(id: string, newAfterLineNumber: number): boolean { - newAfterLineNumber = newAfterLineNumber | 0; - - if (this._whitespaceId2Index.hasOwnProperty(id)) { - let index = this._whitespaceId2Index[id]; - if (this._afterLineNumbers[index] !== newAfterLineNumber) { - // `afterLineNumber` changed for this whitespace - - // Record old ordinal - let ordinal = this._ordinals[index]; - - // Record old height - let heightInPx = this._heights[index]; - - // Record old min width - let minWidth = this._minWidths[index]; - - // Since changing `afterLineNumber` can trigger a reordering, we're gonna remove this whitespace - this.removeWhitespace(id); - - // And add it again - let insertionIndex = WhitespaceComputer.findInsertionIndex(this._afterLineNumbers, newAfterLineNumber, this._ordinals, ordinal); - this._insertWhitespaceAtIndex(id, insertionIndex, newAfterLineNumber, ordinal, heightInPx, minWidth); - - return true; - } - } - return false; - } - - /** - * Remove an existing whitespace. - * - * @param id The whitespace to remove - * @return Returns true if the whitespace is found and it is removed. - */ - public removeWhitespace(id: string): boolean { - if (this._whitespaceId2Index.hasOwnProperty(id)) { - let index = this._whitespaceId2Index[id]; - delete this._whitespaceId2Index[id]; - this._removeWhitespaceAtIndex(index); - this._minWidth = -1; /* marker for not being computed */ - return true; - } - - return false; - } - - private _removeWhitespaceAtIndex(removeIndex: number): void { - removeIndex = removeIndex | 0; - - this._heights.splice(removeIndex, 1); - this._minWidths.splice(removeIndex, 1); - this._ids.splice(removeIndex, 1); - this._afterLineNumbers.splice(removeIndex, 1); - this._ordinals.splice(removeIndex, 1); - this._prefixSum.splice(removeIndex, 1); - this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, removeIndex - 1); - - let keys = Object.keys(this._whitespaceId2Index); - for (let i = 0, len = keys.length; i < len; i++) { - let sid = keys[i]; - let oldIndex = this._whitespaceId2Index[sid]; - if (oldIndex >= removeIndex) { - this._whitespaceId2Index[sid] = oldIndex - 1; - } - } - } - - /** - * Notify the computer that lines have been deleted (a continuous zone of lines). - * This gives it a chance to update `afterLineNumber` for whitespaces, giving the "sticky" characteristic. - * - * @param fromLineNumber The line number at which the deletion started, inclusive - * @param toLineNumber The line number at which the deletion ended, inclusive - */ - public onLinesDeleted(fromLineNumber: number, toLineNumber: number): void { - fromLineNumber = fromLineNumber | 0; - toLineNumber = toLineNumber | 0; - - for (let i = 0, len = this._afterLineNumbers.length; i < len; i++) { - let afterLineNumber = this._afterLineNumbers[i]; - - if (fromLineNumber <= afterLineNumber && afterLineNumber <= toLineNumber) { - // The line this whitespace was after has been deleted - // => move whitespace to before first deleted line - this._afterLineNumbers[i] = fromLineNumber - 1; - } else if (afterLineNumber > toLineNumber) { - // The line this whitespace was after has been moved up - // => move whitespace up - this._afterLineNumbers[i] -= (toLineNumber - fromLineNumber + 1); - } - } - } - - /** - * Notify the computer that lines have been inserted (a continuous zone of lines). - * This gives it a chance to update `afterLineNumber` for whitespaces, giving the "sticky" characteristic. - * - * @param fromLineNumber The line number at which the insertion started, inclusive - * @param toLineNumber The line number at which the insertion ended, inclusive. - */ - public onLinesInserted(fromLineNumber: number, toLineNumber: number): void { - fromLineNumber = fromLineNumber | 0; - toLineNumber = toLineNumber | 0; - - for (let i = 0, len = this._afterLineNumbers.length; i < len; i++) { - let afterLineNumber = this._afterLineNumbers[i]; - - if (fromLineNumber <= afterLineNumber) { - this._afterLineNumbers[i] += (toLineNumber - fromLineNumber + 1); - } - } - } - - /** - * Get the sum of all the whitespaces. - */ - public getTotalHeight(): number { - if (this._heights.length === 0) { - return 0; - } - return this.getAccumulatedHeight(this._heights.length - 1); - } - - /** - * Return the sum of the heights of the whitespaces at [0..index]. - * This includes the whitespace at `index`. - * - * @param index The index of the whitespace. - * @return The sum of the heights of all whitespaces before the one at `index`, including the one at `index`. - */ - public getAccumulatedHeight(index: number): number { - index = index | 0; - - let startIndex = Math.max(0, this._prefixSumValidIndex + 1); - if (startIndex === 0) { - this._prefixSum[0] = this._heights[0]; - startIndex++; - } - - for (let i = startIndex; i <= index; i++) { - this._prefixSum[i] = this._prefixSum[i - 1] + this._heights[i]; - } - this._prefixSumValidIndex = Math.max(this._prefixSumValidIndex, index); - return this._prefixSum[index]; - } - - /** - * Find all whitespaces with `afterLineNumber` < `lineNumber` and return the sum of their heights. - * - * @param lineNumber The line number whitespaces should be before. - * @return The sum of the heights of the whitespaces before `lineNumber`. - */ - public getAccumulatedHeightBeforeLineNumber(lineNumber: number): number { - lineNumber = lineNumber | 0; - - let lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber); - - if (lastWhitespaceBeforeLineNumber === -1) { - return 0; - } - - return this.getAccumulatedHeight(lastWhitespaceBeforeLineNumber); - } - - private _findLastWhitespaceBeforeLineNumber(lineNumber: number): number { - lineNumber = lineNumber | 0; - - // Find the whitespace before line number - let afterLineNumbers = this._afterLineNumbers; - let low = 0; - let high = afterLineNumbers.length - 1; - - while (low <= high) { - let delta = (high - low) | 0; - let halfDelta = (delta / 2) | 0; - let mid = (low + halfDelta) | 0; - - if (afterLineNumbers[mid] < lineNumber) { - if (mid + 1 >= afterLineNumbers.length || afterLineNumbers[mid + 1] >= lineNumber) { - return mid; - } else { - low = (mid + 1) | 0; - } - } else { - high = (mid - 1) | 0; - } - } - - return -1; - } - - private _findFirstWhitespaceAfterLineNumber(lineNumber: number): number { - lineNumber = lineNumber | 0; - - let lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber); - let firstWhitespaceAfterLineNumber = lastWhitespaceBeforeLineNumber + 1; - - if (firstWhitespaceAfterLineNumber < this._heights.length) { - return firstWhitespaceAfterLineNumber; - } - - return -1; - } - - /** - * Find the index of the first whitespace which has `afterLineNumber` >= `lineNumber`. - * @return The index of the first whitespace with `afterLineNumber` >= `lineNumber` or -1 if no whitespace is found. - */ - public getFirstWhitespaceIndexAfterLineNumber(lineNumber: number): number { - lineNumber = lineNumber | 0; - - return this._findFirstWhitespaceAfterLineNumber(lineNumber); - } - - /** - * The number of whitespaces. - */ - public getCount(): number { - return this._heights.length; - } - - /** - * The maximum min width for all whitespaces. - */ - public getMinWidth(): number { - if (this._minWidth === -1) { - let minWidth = 0; - for (let i = 0, len = this._minWidths.length; i < len; i++) { - minWidth = Math.max(minWidth, this._minWidths[i]); - } - this._minWidth = minWidth; - } - return this._minWidth; - } - - /** - * Get the `afterLineNumber` for whitespace at index `index`. - * - * @param index The index of the whitespace. - * @return `afterLineNumber` of whitespace at `index`. - */ - public getAfterLineNumberForWhitespaceIndex(index: number): number { - index = index | 0; - - return this._afterLineNumbers[index]; - } - - /** - * Get the `id` for whitespace at index `index`. - * - * @param index The index of the whitespace. - * @return `id` of whitespace at `index`. - */ - public getIdForWhitespaceIndex(index: number): string { - index = index | 0; - - return this._ids[index]; - } - - /** - * Get the `height` for whitespace at index `index`. - * - * @param index The index of the whitespace. - * @return `height` of whitespace at `index`. - */ - public getHeightForWhitespaceIndex(index: number): number { - index = index | 0; - - return this._heights[index]; - } - - /** - * Get all whitespaces. - */ - public getWhitespaces(deviceLineHeight: number): IEditorWhitespace[] { - deviceLineHeight = deviceLineHeight | 0; - - let result: IEditorWhitespace[] = []; - for (let i = 0; i < this._heights.length; i++) { - result.push({ - id: this._ids[i], - afterLineNumber: this._afterLineNumbers[i], - heightInLines: this._heights[i] / deviceLineHeight - }); - } - return result; - } -} diff --git a/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts b/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts deleted file mode 100644 index bbf71e817b93f..0000000000000 --- a/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts +++ /dev/null @@ -1,293 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { CharCode } from 'vs/base/common/charCode'; -import * as strings from 'vs/base/common/strings'; -import { WrappingIndent } from 'vs/editor/common/config/editorOptions'; -import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier'; -import { toUint32Array } from 'vs/base/common/uint'; -import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer'; -import { ILineMapperFactory, ILineMapping, OutputPosition } from 'vs/editor/common/viewModel/splitLinesCollection'; - -const enum CharacterClass { - NONE = 0, - BREAK_BEFORE = 1, - BREAK_AFTER = 2, - BREAK_OBTRUSIVE = 3, - BREAK_IDEOGRAPHIC = 4 // for Han and Kana. -} - -class WrappingCharacterClassifier extends CharacterClassifier { - - constructor(BREAK_BEFORE: string, BREAK_AFTER: string, BREAK_OBTRUSIVE: string) { - super(CharacterClass.NONE); - - for (let i = 0; i < BREAK_BEFORE.length; i++) { - this.set(BREAK_BEFORE.charCodeAt(i), CharacterClass.BREAK_BEFORE); - } - - for (let i = 0; i < BREAK_AFTER.length; i++) { - this.set(BREAK_AFTER.charCodeAt(i), CharacterClass.BREAK_AFTER); - } - - for (let i = 0; i < BREAK_OBTRUSIVE.length; i++) { - this.set(BREAK_OBTRUSIVE.charCodeAt(i), CharacterClass.BREAK_OBTRUSIVE); - } - } - - public get(charCode: number): CharacterClass { - // Initialize CharacterClass.BREAK_IDEOGRAPHIC for these Unicode ranges: - // 1. CJK Unified Ideographs (0x4E00 -- 0x9FFF) - // 2. CJK Unified Ideographs Extension A (0x3400 -- 0x4DBF) - // 3. Hiragana and Katakana (0x3040 -- 0x30FF) - if ( - (charCode >= 0x3040 && charCode <= 0x30FF) - || (charCode >= 0x3400 && charCode <= 0x4DBF) - || (charCode >= 0x4E00 && charCode <= 0x9FFF) - ) { - return CharacterClass.BREAK_IDEOGRAPHIC; - } - - return super.get(charCode); - } -} - -export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactory { - - private readonly classifier: WrappingCharacterClassifier; - - constructor(breakBeforeChars: string, breakAfterChars: string, breakObtrusiveChars: string) { - this.classifier = new WrappingCharacterClassifier(breakBeforeChars, breakAfterChars, breakObtrusiveChars); - } - - // TODO@Alex -> duplicated in lineCommentCommand - private static nextVisibleColumn(currentVisibleColumn: number, tabSize: number, isTab: boolean, columnSize: number): number { - currentVisibleColumn = +currentVisibleColumn; //@perf - tabSize = +tabSize; //@perf - columnSize = +columnSize; //@perf - - if (isTab) { - return currentVisibleColumn + (tabSize - (currentVisibleColumn % tabSize)); - } - return currentVisibleColumn + columnSize; - } - - public createLineMapping(lineText: string, tabSize: number, breakingColumn: number, columnsForFullWidthChar: number, hardWrappingIndent: WrappingIndent): ILineMapping | null { - if (breakingColumn === -1) { - return null; - } - - tabSize = +tabSize; //@perf - breakingColumn = +breakingColumn; //@perf - columnsForFullWidthChar = +columnsForFullWidthChar; //@perf - hardWrappingIndent = +hardWrappingIndent; //@perf - - let wrappedTextIndentVisibleColumn = 0; - let wrappedTextIndent = ''; - - let firstNonWhitespaceIndex = -1; - if (hardWrappingIndent !== WrappingIndent.None) { - firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineText); - if (firstNonWhitespaceIndex !== -1) { - // Track existing indent - wrappedTextIndent = lineText.substring(0, firstNonWhitespaceIndex); - for (let i = 0; i < firstNonWhitespaceIndex; i++) { - wrappedTextIndentVisibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(wrappedTextIndentVisibleColumn, tabSize, lineText.charCodeAt(i) === CharCode.Tab, 1); - } - - // Increase indent of continuation lines, if desired - let numberOfAdditionalTabs = 0; - if (hardWrappingIndent === WrappingIndent.Indent) { - numberOfAdditionalTabs = 1; - } else if (hardWrappingIndent === WrappingIndent.DeepIndent) { - numberOfAdditionalTabs = 2; - } - for (let i = 0; i < numberOfAdditionalTabs; i++) { - wrappedTextIndent += '\t'; - wrappedTextIndentVisibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(wrappedTextIndentVisibleColumn, tabSize, true, 1); - } - - // Force sticking to beginning of line if no character would fit except for the indentation - if (wrappedTextIndentVisibleColumn + columnsForFullWidthChar > breakingColumn) { - wrappedTextIndent = ''; - wrappedTextIndentVisibleColumn = 0; - } - } - } - - let classifier = this.classifier; - let lastBreakingOffset = 0; // Last 0-based offset in the lineText at which a break happened - let breakingLengths: number[] = []; // The length of each broken-up line text - let breakingLengthsIndex: number = 0; // The count of breaks already done - let visibleColumn = 0; // Visible column since the beginning of the current line - let niceBreakOffset = -1; // Last index of a character that indicates a break should happen before it (more desirable) - let niceBreakVisibleColumn = 0; // visible column if a break were to be later introduced before `niceBreakOffset` - let obtrusiveBreakOffset = -1; // Last index of a character that indicates a break should happen before it (less desirable) - let obtrusiveBreakVisibleColumn = 0; // visible column if a break were to be later introduced before `obtrusiveBreakOffset` - let len = lineText.length; - - for (let i = 0; i < len; i++) { - // At this point, there is a certainty that the character before `i` fits on the current line, - // but the character at `i` might not fit - - let charCode = lineText.charCodeAt(i); - let charCodeIsTab = (charCode === CharCode.Tab); - let charCodeClass = classifier.get(charCode); - - if (strings.isLowSurrogate(charCode)/* && i + 1 < len */) { - // A surrogate pair must always be considered as a single unit, so it is never to be broken - // => advance visibleColumn by 1 and advance to next char code... - visibleColumn = visibleColumn + 1; - continue; - } - - if (charCodeClass === CharacterClass.BREAK_BEFORE) { - // This is a character that indicates that a break should happen before it - // Since we are certain the character before `i` fits, there's no extra checking needed, - // just mark it as a nice breaking opportunity - niceBreakOffset = i; - niceBreakVisibleColumn = wrappedTextIndentVisibleColumn; - } - - // CJK breaking : before break - if (charCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && i > 0) { - let prevCode = lineText.charCodeAt(i - 1); - let prevClass = classifier.get(prevCode); - if (prevClass !== CharacterClass.BREAK_BEFORE) { // Kinsoku Shori: Don't break after a leading character, like an open bracket - niceBreakOffset = i; - niceBreakVisibleColumn = wrappedTextIndentVisibleColumn; - } - } - - let charColumnSize = 1; - if (strings.isFullWidthCharacter(charCode)) { - charColumnSize = columnsForFullWidthChar; - } - - // Advance visibleColumn with character at `i` - visibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(visibleColumn, tabSize, charCodeIsTab, charColumnSize); - - if (visibleColumn > breakingColumn && i !== 0) { - // We need to break at least before character at `i`: - // - break before niceBreakLastOffset if it exists (and re-establish a correct visibleColumn by using niceBreakVisibleColumn + charAt(i)) - // - otherwise, break before obtrusiveBreakLastOffset if it exists (and re-establish a correct visibleColumn by using obtrusiveBreakVisibleColumn + charAt(i)) - // - otherwise, break before i (and re-establish a correct visibleColumn by charAt(i)) - - let breakBeforeOffset: number; - let restoreVisibleColumnFrom: number; - - if (niceBreakOffset !== -1 && niceBreakVisibleColumn <= breakingColumn) { - - // We will break before `niceBreakLastOffset` - breakBeforeOffset = niceBreakOffset; - restoreVisibleColumnFrom = niceBreakVisibleColumn; - - } else if (obtrusiveBreakOffset !== -1 && obtrusiveBreakVisibleColumn <= breakingColumn) { - - // We will break before `obtrusiveBreakLastOffset` - breakBeforeOffset = obtrusiveBreakOffset; - restoreVisibleColumnFrom = obtrusiveBreakVisibleColumn; - - } else { - - // We will break before `i` - breakBeforeOffset = i; - restoreVisibleColumnFrom = wrappedTextIndentVisibleColumn; - - } - - // Break before character at `breakBeforeOffset` - breakingLengths[breakingLengthsIndex++] = breakBeforeOffset - lastBreakingOffset; - lastBreakingOffset = breakBeforeOffset; - - // Re-establish visibleColumn by taking character at `i` into account - visibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(restoreVisibleColumnFrom, tabSize, charCodeIsTab, charColumnSize); - - // Reset markers - niceBreakOffset = -1; - niceBreakVisibleColumn = 0; - obtrusiveBreakOffset = -1; - obtrusiveBreakVisibleColumn = 0; - } - - // At this point, there is a certainty that the character at `i` fits on the current line - - if (niceBreakOffset !== -1) { - // Advance niceBreakVisibleColumn - niceBreakVisibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(niceBreakVisibleColumn, tabSize, charCodeIsTab, charColumnSize); - } - if (obtrusiveBreakOffset !== -1) { - // Advance obtrusiveBreakVisibleColumn - obtrusiveBreakVisibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(obtrusiveBreakVisibleColumn, tabSize, charCodeIsTab, charColumnSize); - } - - if (charCodeClass === CharacterClass.BREAK_AFTER && (hardWrappingIndent === WrappingIndent.None || i >= firstNonWhitespaceIndex)) { - // This is a character that indicates that a break should happen after it - niceBreakOffset = i + 1; - niceBreakVisibleColumn = wrappedTextIndentVisibleColumn; - } - - // CJK breaking : after break - if (charCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && i < len - 1) { - let nextCode = lineText.charCodeAt(i + 1); - let nextClass = classifier.get(nextCode); - if (nextClass !== CharacterClass.BREAK_AFTER) { // Kinsoku Shori: Don't break before a trailing character, like a period - niceBreakOffset = i + 1; - niceBreakVisibleColumn = wrappedTextIndentVisibleColumn; - } - } - - if (charCodeClass === CharacterClass.BREAK_OBTRUSIVE) { - // This is an obtrusive character that indicates that a break should happen after it - obtrusiveBreakOffset = i + 1; - obtrusiveBreakVisibleColumn = wrappedTextIndentVisibleColumn; - } - } - - if (breakingLengthsIndex === 0) { - return null; - } - - // Add last segment - breakingLengths[breakingLengthsIndex++] = len - lastBreakingOffset; - - return new CharacterHardWrappingLineMapping( - new PrefixSumComputer(toUint32Array(breakingLengths)), - wrappedTextIndent - ); - } -} - -export class CharacterHardWrappingLineMapping implements ILineMapping { - - private readonly _prefixSums: PrefixSumComputer; - private readonly _wrappedLinesIndent: string; - - constructor(prefixSums: PrefixSumComputer, wrappedLinesIndent: string) { - this._prefixSums = prefixSums; - this._wrappedLinesIndent = wrappedLinesIndent; - } - - public getOutputLineCount(): number { - return this._prefixSums.getCount(); - } - - public getWrappedLinesIndent(): string { - return this._wrappedLinesIndent; - } - - public getInputOffsetOfOutputPosition(outputLineIndex: number, outputOffset: number): number { - if (outputLineIndex === 0) { - return outputOffset; - } else { - return this._prefixSums.getAccumulatedValue(outputLineIndex - 1) + outputOffset; - } - } - - public getOutputPositionOfInputOffset(inputOffset: number): OutputPosition { - let r = this._prefixSums.getIndexOf(inputOffset); - return new OutputPosition(r.index, r.remainder); - } -} diff --git a/src/vs/editor/common/viewModel/monospaceLineBreaksComputer.ts b/src/vs/editor/common/viewModel/monospaceLineBreaksComputer.ts new file mode 100644 index 0000000000000..97a3c4a7655e8 --- /dev/null +++ b/src/vs/editor/common/viewModel/monospaceLineBreaksComputer.ts @@ -0,0 +1,472 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { CharCode } from 'vs/base/common/charCode'; +import * as strings from 'vs/base/common/strings'; +import { WrappingIndent, IComputedEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions'; +import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier'; +import { ILineBreaksComputerFactory, LineBreakData, ILineBreaksComputer } from 'vs/editor/common/viewModel/splitLinesCollection'; +import { FontInfo } from 'vs/editor/common/config/fontInfo'; + +const enum CharacterClass { + NONE = 0, + BREAK_BEFORE = 1, + BREAK_AFTER = 2, + BREAK_IDEOGRAPHIC = 3 // for Han and Kana. +} + +class WrappingCharacterClassifier extends CharacterClassifier { + + constructor(BREAK_BEFORE: string, BREAK_AFTER: string) { + super(CharacterClass.NONE); + + for (let i = 0; i < BREAK_BEFORE.length; i++) { + this.set(BREAK_BEFORE.charCodeAt(i), CharacterClass.BREAK_BEFORE); + } + + for (let i = 0; i < BREAK_AFTER.length; i++) { + this.set(BREAK_AFTER.charCodeAt(i), CharacterClass.BREAK_AFTER); + } + } + + public get(charCode: number): CharacterClass { + if (charCode >= 0 && charCode < 256) { + return this._asciiMap[charCode]; + } else { + // Initialize CharacterClass.BREAK_IDEOGRAPHIC for these Unicode ranges: + // 1. CJK Unified Ideographs (0x4E00 -- 0x9FFF) + // 2. CJK Unified Ideographs Extension A (0x3400 -- 0x4DBF) + // 3. Hiragana and Katakana (0x3040 -- 0x30FF) + if ( + (charCode >= 0x3040 && charCode <= 0x30FF) + || (charCode >= 0x3400 && charCode <= 0x4DBF) + || (charCode >= 0x4E00 && charCode <= 0x9FFF) + ) { + return CharacterClass.BREAK_IDEOGRAPHIC; + } + + return (this._map.get(charCode) || this._defaultValue); + } + } +} + +let arrPool1: number[] = []; +let arrPool2: number[] = []; + +export class MonospaceLineBreaksComputerFactory implements ILineBreaksComputerFactory { + + public static create(options: IComputedEditorOptions): MonospaceLineBreaksComputerFactory { + return new MonospaceLineBreaksComputerFactory( + options.get(EditorOption.wordWrapBreakBeforeCharacters), + options.get(EditorOption.wordWrapBreakAfterCharacters) + ); + } + + private readonly classifier: WrappingCharacterClassifier; + + constructor(breakBeforeChars: string, breakAfterChars: string) { + this.classifier = new WrappingCharacterClassifier(breakBeforeChars, breakAfterChars); + } + + public createLineBreaksComputer(fontInfo: FontInfo, tabSize: number, wrappingColumn: number, wrappingIndent: WrappingIndent): ILineBreaksComputer { + tabSize = tabSize | 0; //@perf + wrappingColumn = +wrappingColumn; //@perf + + let requests: string[] = []; + let previousBreakingData: (LineBreakData | null)[] = []; + return { + addRequest: (lineText: string, previousLineBreakData: LineBreakData | null) => { + requests.push(lineText); + previousBreakingData.push(previousLineBreakData); + }, + finalize: () => { + const columnsForFullWidthChar = fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth; //@perf + let result: (LineBreakData | null)[] = []; + for (let i = 0, len = requests.length; i < len; i++) { + const previousLineBreakData = previousBreakingData[i]; + if (previousLineBreakData) { + result[i] = createLineBreaksFromPreviousLineBreaks(this.classifier, previousLineBreakData, requests[i], tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent); + } else { + result[i] = createLineBreaks(this.classifier, requests[i], tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent); + } + } + arrPool1.length = 0; + arrPool2.length = 0; + return result; + } + }; + } +} + +function createLineBreaksFromPreviousLineBreaks(classifier: WrappingCharacterClassifier, previousBreakingData: LineBreakData, lineText: string, tabSize: number, firstLineBreakColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent): LineBreakData | null { + if (firstLineBreakColumn === -1) { + return null; + } + + const len = lineText.length; + if (len <= 1) { + return null; + } + + const prevBreakingOffsets = previousBreakingData.breakOffsets; + const prevBreakingOffsetsVisibleColumn = previousBreakingData.breakOffsetsVisibleColumn; + + const wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent); + const wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength; + + let breakingOffsets: number[] = arrPool1; + let breakingOffsetsVisibleColumn: number[] = arrPool2; + let breakingOffsetsCount: number = 0; + + let breakingColumn = firstLineBreakColumn; + const prevLen = prevBreakingOffsets.length; + let prevIndex = 0; + + if (prevIndex >= 0) { + let bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn); + while (prevIndex + 1 < prevLen) { + const distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn); + if (distance >= bestDistance) { + break; + } + bestDistance = distance; + prevIndex++; + } + } + + while (prevIndex < prevLen) { + // Allow for prevIndex to be -1 (for the case where we hit a tab when walking backwards from the first break) + const prevBreakOffset = prevIndex < 0 ? 0 : prevBreakingOffsets[prevIndex]; + const prevBreakoffsetVisibleColumn = prevIndex < 0 ? 0 : prevBreakingOffsetsVisibleColumn[prevIndex]; + + let breakOffset = 0; + let breakOffsetVisibleColumn = 0; + + let forcedBreakOffset = 0; + let forcedBreakOffsetVisibleColumn = 0; + + // initially, we search as much as possible to the right (if it fits) + if (prevBreakoffsetVisibleColumn <= breakingColumn) { + let visibleColumn = prevBreakoffsetVisibleColumn; + let prevCharCode = lineText.charCodeAt(prevBreakOffset - 1); + let prevCharCodeClass = classifier.get(prevCharCode); + let entireLineFits = true; + for (let i = prevBreakOffset; i < len; i++) { + const charStartOffset = i; + const charCode = lineText.charCodeAt(i); + let charCodeClass: number; + let charWidth: number; + + if (strings.isHighSurrogate(charCode)) { + // A surrogate pair must always be considered as a single unit, so it is never to be broken + i++; + charCodeClass = CharacterClass.NONE; + charWidth = 2; + } else { + charCodeClass = classifier.get(charCode); + charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar); + } + + if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) { + breakOffset = charStartOffset; + breakOffsetVisibleColumn = visibleColumn; + } + + visibleColumn += charWidth; + + // check if adding character at `i` will go over the breaking column + if (visibleColumn > breakingColumn) { + // We need to break at least before character at `i`: + forcedBreakOffset = charStartOffset; + forcedBreakOffsetVisibleColumn = visibleColumn - charWidth; + + if (visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) { + // Cannot break at `breakOffset` => reset it if it was set + breakOffset = 0; + } + + entireLineFits = false; + break; + } + + prevCharCode = charCode; + prevCharCodeClass = charCodeClass; + } + + if (entireLineFits) { + // there is no more need to break => stop the outer loop! + if (breakingOffsetsCount > 0) { + // Add last segment + breakingOffsets[breakingOffsetsCount] = prevBreakingOffsets[prevBreakingOffsets.length - 1]; + breakingOffsetsVisibleColumn[breakingOffsetsCount] = prevBreakingOffsetsVisibleColumn[prevBreakingOffsets.length - 1]; + breakingOffsetsCount++; + } + break; + } + } + + if (breakOffset === 0) { + // must search left + let visibleColumn = prevBreakoffsetVisibleColumn; + let charCode = lineText.charCodeAt(prevBreakOffset); + let charCodeClass = classifier.get(charCode); + let hitATabCharacter = false; + for (let i = prevBreakOffset - 1; i >= 0; i--) { + const charStartOffset = i + 1; + const prevCharCode = lineText.charCodeAt(i); + + if (prevCharCode === CharCode.Tab) { + // cannot determine the width of a tab when going backwards, so we must go forwards + hitATabCharacter = true; + break; + } + + let prevCharCodeClass: number; + let prevCharWidth: number; + + if (strings.isLowSurrogate(prevCharCode)) { + // A surrogate pair must always be considered as a single unit, so it is never to be broken + i--; + prevCharCodeClass = CharacterClass.NONE; + prevCharWidth = 2; + } else { + prevCharCodeClass = classifier.get(prevCharCode); + prevCharWidth = (strings.isFullWidthCharacter(prevCharCode) ? columnsForFullWidthChar : 1); + } + + if (visibleColumn <= breakingColumn) { + if (forcedBreakOffset === 0) { + forcedBreakOffset = charStartOffset; + forcedBreakOffsetVisibleColumn = visibleColumn; + } + + if (visibleColumn <= breakingColumn - wrappedLineBreakColumn) { + // went too far! + break; + } + + if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) { + breakOffset = charStartOffset; + breakOffsetVisibleColumn = visibleColumn; + break; + } + } + + visibleColumn -= prevCharWidth; + charCode = prevCharCode; + charCodeClass = prevCharCodeClass; + } + + if (breakOffset !== 0) { + const remainingWidthOfNextLine = wrappedLineBreakColumn - (forcedBreakOffsetVisibleColumn - breakOffsetVisibleColumn); + if (remainingWidthOfNextLine <= tabSize) { + const charCodeAtForcedBreakOffset = lineText.charCodeAt(forcedBreakOffset); + let charWidth: number; + if (strings.isHighSurrogate(charCodeAtForcedBreakOffset)) { + // A surrogate pair must always be considered as a single unit, so it is never to be broken + charWidth = 2; + } else { + charWidth = computeCharWidth(charCodeAtForcedBreakOffset, forcedBreakOffsetVisibleColumn, tabSize, columnsForFullWidthChar); + } + if (remainingWidthOfNextLine - charWidth < 0) { + // it is not worth it to break at breakOffset, it just introduces an extra needless line! + breakOffset = 0; + } + } + } + + if (hitATabCharacter) { + // cannot determine the width of a tab when going backwards, so we must go forwards from the previous break + prevIndex--; + continue; + } + } + + if (breakOffset === 0) { + // Could not find a good breaking point + breakOffset = forcedBreakOffset; + breakOffsetVisibleColumn = forcedBreakOffsetVisibleColumn; + } + + breakingOffsets[breakingOffsetsCount] = breakOffset; + breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn; + breakingOffsetsCount++; + breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn; + + while (prevIndex < 0 || (prevIndex < prevLen && prevBreakingOffsetsVisibleColumn[prevIndex] < breakOffsetVisibleColumn)) { + prevIndex++; + } + + let bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn); + while (prevIndex + 1 < prevLen) { + const distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn); + if (distance >= bestDistance) { + break; + } + bestDistance = distance; + prevIndex++; + } + } + + if (breakingOffsetsCount === 0) { + return null; + } + + // Doing here some object reuse which ends up helping a huge deal with GC pauses! + breakingOffsets.length = breakingOffsetsCount; + breakingOffsetsVisibleColumn.length = breakingOffsetsCount; + arrPool1 = previousBreakingData.breakOffsets; + arrPool2 = previousBreakingData.breakOffsetsVisibleColumn; + previousBreakingData.breakOffsets = breakingOffsets; + previousBreakingData.breakOffsetsVisibleColumn = breakingOffsetsVisibleColumn; + previousBreakingData.wrappedTextIndentLength = wrappedTextIndentLength; + return previousBreakingData; +} + +function createLineBreaks(classifier: WrappingCharacterClassifier, lineText: string, tabSize: number, firstLineBreakColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent): LineBreakData | null { + if (firstLineBreakColumn === -1) { + return null; + } + + const len = lineText.length; + if (len <= 1) { + return null; + } + + const wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent); + const wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength; + + let breakingOffsets: number[] = []; + let breakingOffsetsVisibleColumn: number[] = []; + let breakingOffsetsCount: number = 0; + let breakOffset = 0; + let breakOffsetVisibleColumn = 0; + + let breakingColumn = firstLineBreakColumn; + let prevCharCode = lineText.charCodeAt(0); + let prevCharCodeClass = classifier.get(prevCharCode); + let visibleColumn = computeCharWidth(prevCharCode, 0, tabSize, columnsForFullWidthChar); + + let startOffset = 1; + if (strings.isHighSurrogate(prevCharCode)) { + // A surrogate pair must always be considered as a single unit, so it is never to be broken + visibleColumn += 1; + prevCharCode = lineText.charCodeAt(1); + prevCharCodeClass = classifier.get(prevCharCode); + startOffset++; + } + + for (let i = startOffset; i < len; i++) { + const charStartOffset = i; + const charCode = lineText.charCodeAt(i); + let charCodeClass: number; + let charWidth: number; + + if (strings.isHighSurrogate(charCode)) { + // A surrogate pair must always be considered as a single unit, so it is never to be broken + i++; + charCodeClass = CharacterClass.NONE; + charWidth = 2; + } else { + charCodeClass = classifier.get(charCode); + charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar); + } + + if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) { + breakOffset = charStartOffset; + breakOffsetVisibleColumn = visibleColumn; + } + + visibleColumn += charWidth; + + // check if adding character at `i` will go over the breaking column + if (visibleColumn > breakingColumn) { + // We need to break at least before character at `i`: + + if (breakOffset === 0 || visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) { + // Cannot break at `breakOffset`, must break at `i` + breakOffset = charStartOffset; + breakOffsetVisibleColumn = visibleColumn - charWidth; + } + + breakingOffsets[breakingOffsetsCount] = breakOffset; + breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn; + breakingOffsetsCount++; + breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn; + breakOffset = 0; + } + + prevCharCode = charCode; + prevCharCodeClass = charCodeClass; + } + + if (breakingOffsetsCount === 0) { + return null; + } + + // Add last segment + breakingOffsets[breakingOffsetsCount] = len; + breakingOffsetsVisibleColumn[breakingOffsetsCount] = visibleColumn; + + return new LineBreakData(breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength); +} + +function computeCharWidth(charCode: number, visibleColumn: number, tabSize: number, columnsForFullWidthChar: number): number { + if (charCode === CharCode.Tab) { + return (tabSize - (visibleColumn % tabSize)); + } + if (strings.isFullWidthCharacter(charCode)) { + return columnsForFullWidthChar; + } + return 1; +} + +function tabCharacterWidth(visibleColumn: number, tabSize: number): number { + return (tabSize - (visibleColumn % tabSize)); +} + +/** + * Kinsoku Shori : Don't break after a leading character, like an open bracket + * Kinsoku Shori : Don't break before a trailing character, like a period + */ +function canBreak(prevCharCode: number, prevCharCodeClass: CharacterClass, charCode: number, charCodeClass: CharacterClass): boolean { + return ( + charCode !== CharCode.Space + && ( + (prevCharCodeClass === CharacterClass.BREAK_AFTER) + || (prevCharCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && charCodeClass !== CharacterClass.BREAK_AFTER) + || (charCodeClass === CharacterClass.BREAK_BEFORE) + || (charCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && prevCharCodeClass !== CharacterClass.BREAK_BEFORE) + ) + ); +} + +function computeWrappedTextIndentLength(lineText: string, tabSize: number, firstLineBreakColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent): number { + let wrappedTextIndentLength = 0; + if (wrappingIndent !== WrappingIndent.None) { + const firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineText); + if (firstNonWhitespaceIndex !== -1) { + // Track existing indent + + for (let i = 0; i < firstNonWhitespaceIndex; i++) { + const charWidth = (lineText.charCodeAt(i) === CharCode.Tab ? tabCharacterWidth(wrappedTextIndentLength, tabSize) : 1); + wrappedTextIndentLength += charWidth; + } + + // Increase indent of continuation lines, if desired + const numberOfAdditionalTabs = (wrappingIndent === WrappingIndent.DeepIndent ? 2 : wrappingIndent === WrappingIndent.Indent ? 1 : 0); + for (let i = 0; i < numberOfAdditionalTabs; i++) { + const charWidth = tabCharacterWidth(wrappedTextIndentLength, tabSize); + wrappedTextIndentLength += charWidth; + } + + // Force sticking to beginning of line if no character would fit except for the indentation + if (wrappedTextIndentLength + columnsForFullWidthChar > firstLineBreakColumn) { + wrappedTextIndentLength = 0; + } + } + } + return wrappedTextIndentLength; +} diff --git a/src/vs/editor/common/viewModel/prefixSumComputer.ts b/src/vs/editor/common/viewModel/prefixSumComputer.ts index d4e8c1f0df259..6cb1312c07e2d 100644 --- a/src/vs/editor/common/viewModel/prefixSumComputer.ts +++ b/src/vs/editor/common/viewModel/prefixSumComputer.ts @@ -187,73 +187,3 @@ export class PrefixSumComputer { return new PrefixSumIndexOfResult(mid, accumulatedValue - midStart); } } - -export class PrefixSumComputerWithCache { - - private readonly _actual: PrefixSumComputer; - private _cacheAccumulatedValueStart: number = 0; - private _cache: PrefixSumIndexOfResult[] | null = null; - - constructor(values: Uint32Array) { - this._actual = new PrefixSumComputer(values); - this._bustCache(); - } - - private _bustCache(): void { - this._cacheAccumulatedValueStart = 0; - this._cache = null; - } - - public insertValues(insertIndex: number, insertValues: Uint32Array): void { - if (this._actual.insertValues(insertIndex, insertValues)) { - this._bustCache(); - } - } - - public changeValue(index: number, value: number): void { - if (this._actual.changeValue(index, value)) { - this._bustCache(); - } - } - - public removeValues(startIndex: number, cnt: number): void { - if (this._actual.removeValues(startIndex, cnt)) { - this._bustCache(); - } - } - - public getTotalValue(): number { - return this._actual.getTotalValue(); - } - - public getAccumulatedValue(index: number): number { - return this._actual.getAccumulatedValue(index); - } - - public getIndexOf(accumulatedValue: number): PrefixSumIndexOfResult { - accumulatedValue = Math.floor(accumulatedValue); //@perf - - if (this._cache !== null) { - let cacheIndex = accumulatedValue - this._cacheAccumulatedValueStart; - if (cacheIndex >= 0 && cacheIndex < this._cache.length) { - // Cache hit! - return this._cache[cacheIndex]; - } - } - - // Cache miss! - return this._actual.getIndexOf(accumulatedValue); - } - - /** - * Gives a hint that a lot of requests are about to come in for these accumulated values. - */ - public warmUpCache(accumulatedValueStart: number, accumulatedValueEnd: number): void { - let newCache: PrefixSumIndexOfResult[] = []; - for (let accumulatedValue = accumulatedValueStart; accumulatedValue <= accumulatedValueEnd; accumulatedValue++) { - newCache[accumulatedValue - accumulatedValueStart] = this.getIndexOf(accumulatedValue); - } - this._cache = newCache; - this._cacheAccumulatedValueStart = accumulatedValueStart; - } -} diff --git a/src/vs/editor/common/viewModel/splitLinesCollection.ts b/src/vs/editor/common/viewModel/splitLinesCollection.ts index 3cd2afbafaf85..3a3eab70a1c29 100644 --- a/src/vs/editor/common/viewModel/splitLinesCollection.ts +++ b/src/vs/editor/common/viewModel/splitLinesCollection.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as arrays from 'vs/base/common/arrays'; import { WrappingIndent } from 'vs/editor/common/config/editorOptions'; import { LineTokens } from 'vs/editor/common/core/lineTokens'; import { Position } from 'vs/editor/common/core/position'; @@ -10,13 +11,13 @@ import { IRange, Range } from 'vs/editor/common/core/range'; import { EndOfLinePreference, IActiveIndentGuideInfo, IModelDecoration, IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model'; import { ModelDecorationOptions, ModelDecorationOverviewRulerOptions } from 'vs/editor/common/model/textModel'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; -import { PrefixSumComputerWithCache } from 'vs/editor/common/viewModel/prefixSumComputer'; +import { PrefixSumIndexOfResult } from 'vs/editor/common/viewModel/prefixSumComputer'; import { ICoordinatesConverter, IOverviewRulerDecorations, ViewLineData } from 'vs/editor/common/viewModel/viewModel'; -import { ITheme } from 'vs/platform/theme/common/themeService'; import { IDisposable } from 'vs/base/common/lifecycle'; +import { FontInfo } from 'vs/editor/common/config/fontInfo'; +import { EditorTheme } from 'vs/editor/common/view/viewContext'; export class OutputPosition { - _outputPositionBrand: void; outputLineIndex: number; outputOffset: number; @@ -26,15 +27,56 @@ export class OutputPosition { } } -export interface ILineMapping { - getOutputLineCount(): number; - getWrappedLinesIndent(): string; - getInputOffsetOfOutputPosition(outputLineIndex: number, outputOffset: number): number; - getOutputPositionOfInputOffset(inputOffset: number): OutputPosition; +export class LineBreakData { + constructor( + public breakOffsets: number[], + public breakOffsetsVisibleColumn: number[], + public wrappedTextIndentLength: number + ) { } + + public static getInputOffsetOfOutputPosition(breakOffsets: number[], outputLineIndex: number, outputOffset: number): number { + if (outputLineIndex === 0) { + return outputOffset; + } else { + return breakOffsets[outputLineIndex - 1] + outputOffset; + } + } + + public static getOutputPositionOfInputOffset(breakOffsets: number[], inputOffset: number): OutputPosition { + let low = 0; + let high = breakOffsets.length - 1; + let mid = 0; + let midStart = 0; + + while (low <= high) { + mid = low + ((high - low) / 2) | 0; + + const midStop = breakOffsets[mid]; + midStart = mid > 0 ? breakOffsets[mid - 1] : 0; + + if (inputOffset < midStart) { + high = mid - 1; + } else if (inputOffset >= midStop) { + low = mid + 1; + } else { + break; + } + } + + return new OutputPosition(mid, inputOffset - midStart); + } } -export interface ILineMapperFactory { - createLineMapping(lineText: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent): ILineMapping | null; +export interface ILineBreaksComputer { + /** + * Pass in `previousLineBreakData` if the only difference is in breaking columns!!! + */ + addRequest(lineText: string, previousLineBreakData: LineBreakData | null): void; + finalize(): (LineBreakData | null)[]; +} + +export interface ILineBreaksComputerFactory { + createLineBreaksComputer(fontInfo: FontInfo, tabSize: number, wrappingColumn: number, wrappingIndent: WrappingIndent): ILineBreaksComputer; } export interface ISimpleModel { @@ -50,6 +92,7 @@ export interface ISplitLine { isVisible(): boolean; setVisible(isVisible: boolean): ISplitLine; + getLineBreakData(): LineBreakData | null; getViewLineCount(): number; getViewLineContent(model: ISimpleModel, modelLineNumber: number, outputLineIndex: number): string; getViewLineLength(model: ISimpleModel, modelLineNumber: number, outputLineIndex: number): number; @@ -66,19 +109,19 @@ export interface ISplitLine { export interface IViewModelLinesCollection extends IDisposable { createCoordinatesConverter(): ICoordinatesConverter; - setWrappingSettings(wrappingIndent: WrappingIndent, wrappingColumn: number, columnsForFullWidthChar: number): boolean; + setWrappingSettings(fontInfo: FontInfo, wrappingStrategy: 'simple' | 'advanced', wrappingColumn: number, wrappingIndent: WrappingIndent): boolean; setTabSize(newTabSize: number): boolean; getHiddenAreas(): Range[]; setHiddenAreas(_ranges: Range[]): boolean; + createLineBreaksComputer(): ILineBreaksComputer; onModelFlushed(): void; onModelLinesDeleted(versionId: number, fromLineNumber: number, toLineNumber: number): viewEvents.ViewLinesDeletedEvent | null; - onModelLinesInserted(versionId: number, fromLineNumber: number, toLineNumber: number, text: string[]): viewEvents.ViewLinesInsertedEvent | null; - onModelLineChanged(versionId: number, lineNumber: number, newText: string): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null]; + onModelLinesInserted(versionId: number, fromLineNumber: number, toLineNumber: number, lineBreaks: (LineBreakData | null)[]): viewEvents.ViewLinesInsertedEvent | null; + onModelLineChanged(versionId: number, lineNumber: number, lineBreakData: LineBreakData | null): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null]; acceptVersionId(versionId: number): void; getViewLineCount(): number; - warmUpLookupCache(viewStartLineNumber: number, viewEndLineNumber: number): void; getActiveIndentGuide(viewLineNumber: number, minLineNumber: number, maxLineNumber: number): IActiveIndentGuideInfo; getViewLinesIndentGuides(viewStartLineNumber: number, viewEndLineNumber: number): number[]; getViewLineContent(viewLineNumber: number): string; @@ -88,7 +131,7 @@ export interface IViewModelLinesCollection extends IDisposable { getViewLineData(viewLineNumber: number): ViewLineData; getViewLinesData(viewStartLineNumber: number, viewEndLineNumber: number, needed: boolean[]): Array; - getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: ITheme): IOverviewRulerDecorations; + getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: EditorTheme): IOverviewRulerDecorations; getDecorationsInRange(range: Range, ownerId: number, filterOutValidation: boolean): IModelDecoration[]; } @@ -107,9 +150,7 @@ export class CoordinatesConverter implements ICoordinatesConverter { } public convertViewRangeToModelRange(viewRange: Range): Range { - let start = this._lines.convertViewPositionToModelPosition(viewRange.startLineNumber, viewRange.startColumn); - let end = this._lines.convertViewPositionToModelPosition(viewRange.endLineNumber, viewRange.endColumn); - return new Range(start.lineNumber, start.column, end.lineNumber, end.column); + return this._lines.convertViewRangeToModelRange(viewRange); } public validateViewPosition(viewPosition: Position, expectedModelPosition: Position): Position { @@ -117,9 +158,7 @@ export class CoordinatesConverter implements ICoordinatesConverter { } public validateViewRange(viewRange: Range, expectedModelRange: Range): Range { - const validViewStart = this._lines.validateViewPosition(viewRange.startLineNumber, viewRange.startColumn, expectedModelRange.getStartPosition()); - const validViewEnd = this._lines.validateViewPosition(viewRange.endLineNumber, viewRange.endColumn, expectedModelRange.getEndPosition()); - return new Range(validViewStart.lineNumber, validViewStart.column, validViewEnd.lineNumber, validViewEnd.column); + return this._lines.validateViewRange(viewRange, expectedModelRange); } // Model -> View conversion and related methods @@ -135,7 +174,6 @@ export class CoordinatesConverter implements ICoordinatesConverter { public modelPositionIsVisible(modelPosition: Position): boolean { return this._lines.modelPositionIsVisible(modelPosition.lineNumber, modelPosition.column); } - } const enum IndentGuideRepeatOption { @@ -144,33 +182,129 @@ const enum IndentGuideRepeatOption { BlockAll = 2 } +class LineNumberMapper { + + private _counts: number[]; + private _isValid: boolean; + private _validEndIndex: number; + + private _modelToView: number[]; + private _viewToModel: number[]; + + constructor(viewLineCounts: number[]) { + this._counts = viewLineCounts; + this._isValid = false; + this._validEndIndex = -1; + this._modelToView = []; + this._viewToModel = []; + } + + private _invalidate(index: number): void { + this._isValid = false; + this._validEndIndex = Math.min(this._validEndIndex, index - 1); + } + + private _ensureValid(): void { + if (this._isValid) { + return; + } + + for (let i = this._validEndIndex + 1, len = this._counts.length; i < len; i++) { + const viewLineCount = this._counts[i]; + const viewLinesAbove = (i > 0 ? this._modelToView[i - 1] : 0); + + this._modelToView[i] = viewLinesAbove + viewLineCount; + for (let j = 0; j < viewLineCount; j++) { + this._viewToModel[viewLinesAbove + j] = i; + } + } + + // trim things + this._modelToView.length = this._counts.length; + this._viewToModel.length = this._modelToView[this._modelToView.length - 1]; + + // mark as valid + this._isValid = true; + this._validEndIndex = this._counts.length - 1; + } + + public changeValue(index: number, value: number): void { + if (this._counts[index] === value) { + // no change + return; + } + this._counts[index] = value; + this._invalidate(index); + } + + public removeValues(start: number, deleteCount: number): void { + this._counts.splice(start, deleteCount); + this._invalidate(start); + } + + public insertValues(insertIndex: number, insertArr: number[]): void { + this._counts = arrays.arrayInsert(this._counts, insertIndex, insertArr); + this._invalidate(insertIndex); + } + + public getTotalValue(): number { + this._ensureValid(); + return this._viewToModel.length; + } + + public getAccumulatedValue(index: number): number { + this._ensureValid(); + return this._modelToView[index]; + } + + public getIndexOf(accumulatedValue: number): PrefixSumIndexOfResult { + this._ensureValid(); + const modelLineIndex = this._viewToModel[accumulatedValue]; + const viewLinesAbove = (modelLineIndex > 0 ? this._modelToView[modelLineIndex - 1] : 0); + return new PrefixSumIndexOfResult(modelLineIndex, accumulatedValue - viewLinesAbove); + } +} + export class SplitLinesCollection implements IViewModelLinesCollection { private readonly model: ITextModel; private _validModelVersionId: number; + private readonly _domLineBreaksComputerFactory: ILineBreaksComputerFactory; + private readonly _monospaceLineBreaksComputerFactory: ILineBreaksComputerFactory; + + private fontInfo: FontInfo; + private tabSize: number; private wrappingColumn: number; - private columnsForFullWidthChar: number; private wrappingIndent: WrappingIndent; - private tabSize: number; + private wrappingStrategy: 'simple' | 'advanced'; private lines!: ISplitLine[]; - private prefixSumComputer!: PrefixSumComputerWithCache; - - private readonly linePositionMapperFactory: ILineMapperFactory; + private prefixSumComputer!: LineNumberMapper; private hiddenAreasIds!: string[]; - constructor(model: ITextModel, linePositionMapperFactory: ILineMapperFactory, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent) { + constructor( + model: ITextModel, + domLineBreaksComputerFactory: ILineBreaksComputerFactory, + monospaceLineBreaksComputerFactory: ILineBreaksComputerFactory, + fontInfo: FontInfo, + tabSize: number, + wrappingStrategy: 'simple' | 'advanced', + wrappingColumn: number, + wrappingIndent: WrappingIndent, + ) { this.model = model; this._validModelVersionId = -1; + this._domLineBreaksComputerFactory = domLineBreaksComputerFactory; + this._monospaceLineBreaksComputerFactory = monospaceLineBreaksComputerFactory; + this.fontInfo = fontInfo; this.tabSize = tabSize; + this.wrappingStrategy = wrappingStrategy; this.wrappingColumn = wrappingColumn; - this.columnsForFullWidthChar = columnsForFullWidthChar; this.wrappingIndent = wrappingIndent; - this.linePositionMapperFactory = linePositionMapperFactory; - this._constructLines(true); + this._constructLines(/*resetHiddenAreas*/true, null); } public dispose(): void { @@ -181,19 +315,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return new CoordinatesConverter(this); } - private _ensureValidState(): void { - let modelVersion = this.model.getVersionId(); - if (modelVersion !== this._validModelVersionId) { - // This is pretty bad, it means we lost track of the model... - throw new Error(`ViewModel is out of sync with Model!`); - } - if (this.lines.length !== this.model.getLineCount()) { - // This is pretty bad, it means we lost track of the model... - this._constructLines(false); - } - } - - private _constructLines(resetHiddenAreas: boolean): void { + private _constructLines(resetHiddenAreas: boolean, previousLineBreaks: ((LineBreakData | null)[]) | null): void { this.lines = []; if (resetHiddenAreas) { @@ -201,8 +323,14 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } let linesContent = this.model.getLinesContent(); - let lineCount = linesContent.length; - let values = new Uint32Array(lineCount); + const lineCount = linesContent.length; + const lineBreaksComputer = this.createLineBreaksComputer(); + for (let i = 0; i < lineCount; i++) { + lineBreaksComputer.addRequest(linesContent[i], previousLineBreaks ? previousLineBreaks[i] : null); + } + const linesBreaks = lineBreaksComputer.finalize(); + + let values: number[] = []; let hiddenAreas = this.hiddenAreasIds.map((areaId) => this.model.getDecorationRange(areaId)!).sort(Range.compareRangesUsingStarts); let hiddenAreaStart = 1, hiddenAreaEnd = 0; @@ -220,14 +348,14 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } let isInHiddenArea = (lineNumber >= hiddenAreaStart && lineNumber <= hiddenAreaEnd); - let line = createSplitLine(this.linePositionMapperFactory, linesContent[i], this.tabSize, this.wrappingColumn, this.columnsForFullWidthChar, this.wrappingIndent, !isInHiddenArea); + let line = createSplitLine(linesBreaks[i], !isInHiddenArea); values[i] = line.getViewLineCount(); this.lines[i] = line; } this._validModelVersionId = this.model.getVersionId(); - this.prefixSumComputer = new PrefixSumComputerWithCache(values); + this.prefixSumComputer = new LineNumberMapper(values); } public getHiddenAreas(): Range[] { @@ -351,27 +479,51 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } this.tabSize = newTabSize; - this._constructLines(false); + this._constructLines(/*resetHiddenAreas*/false, null); return true; } - public setWrappingSettings(wrappingIndent: WrappingIndent, wrappingColumn: number, columnsForFullWidthChar: number): boolean { - if (this.wrappingIndent === wrappingIndent && this.wrappingColumn === wrappingColumn && this.columnsForFullWidthChar === columnsForFullWidthChar) { + public setWrappingSettings(fontInfo: FontInfo, wrappingStrategy: 'simple' | 'advanced', wrappingColumn: number, wrappingIndent: WrappingIndent): boolean { + const equalFontInfo = this.fontInfo.equals(fontInfo); + const equalWrappingStrategy = (this.wrappingStrategy === wrappingStrategy); + const equalWrappingColumn = (this.wrappingColumn === wrappingColumn); + const equalWrappingIndent = (this.wrappingIndent === wrappingIndent); + if (equalFontInfo && equalWrappingStrategy && equalWrappingColumn && equalWrappingIndent) { return false; } - this.wrappingIndent = wrappingIndent; + const onlyWrappingColumnChanged = (equalFontInfo && equalWrappingStrategy && !equalWrappingColumn && equalWrappingIndent); + + this.fontInfo = fontInfo; + this.wrappingStrategy = wrappingStrategy; this.wrappingColumn = wrappingColumn; - this.columnsForFullWidthChar = columnsForFullWidthChar; + this.wrappingIndent = wrappingIndent; + + let previousLineBreaks: ((LineBreakData | null)[]) | null = null; + if (onlyWrappingColumnChanged) { + previousLineBreaks = []; + for (let i = 0, len = this.lines.length; i < len; i++) { + previousLineBreaks[i] = this.lines[i].getLineBreakData(); + } + } - this._constructLines(false); + this._constructLines(/*resetHiddenAreas*/false, previousLineBreaks); return true; } + public createLineBreaksComputer(): ILineBreaksComputer { + const lineBreaksComputerFactory = ( + this.wrappingStrategy === 'advanced' + ? this._domLineBreaksComputerFactory + : this._monospaceLineBreaksComputerFactory + ); + return lineBreaksComputerFactory.createLineBreaksComputer(this.fontInfo, this.tabSize, this.wrappingColumn, this.wrappingIndent); + } + public onModelFlushed(): void { - this._constructLines(true); + this._constructLines(/*resetHiddenAreas*/true, null); } public onModelLinesDeleted(versionId: number, fromLineNumber: number, toLineNumber: number): viewEvents.ViewLinesDeletedEvent | null { @@ -390,7 +542,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return new viewEvents.ViewLinesDeletedEvent(outputFromLineNumber, outputToLineNumber); } - public onModelLinesInserted(versionId: number, fromLineNumber: number, _toLineNumber: number, text: string[]): viewEvents.ViewLinesInsertedEvent | null { + public onModelLinesInserted(versionId: number, fromLineNumber: number, _toLineNumber: number, lineBreaks: (LineBreakData | null)[]): viewEvents.ViewLinesInsertedEvent | null { if (versionId <= this._validModelVersionId) { // Here we check for versionId in case the lines were reconstructed in the meantime. // We don't want to apply stale change events on top of a newer read model state. @@ -411,10 +563,10 @@ export class SplitLinesCollection implements IViewModelLinesCollection { let totalOutputLineCount = 0; let insertLines: ISplitLine[] = []; - let insertPrefixSumValues = new Uint32Array(text.length); + let insertPrefixSumValues: number[] = []; - for (let i = 0, len = text.length; i < len; i++) { - let line = createSplitLine(this.linePositionMapperFactory, text[i], this.tabSize, this.wrappingColumn, this.columnsForFullWidthChar, this.wrappingIndent, !isInHiddenArea); + for (let i = 0, len = lineBreaks.length; i < len; i++) { + let line = createSplitLine(lineBreaks[i], !isInHiddenArea); insertLines.push(line); let outputLineCount = line.getViewLineCount(); @@ -430,7 +582,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return new viewEvents.ViewLinesInsertedEvent(outputFromLineNumber, outputFromLineNumber + totalOutputLineCount - 1); } - public onModelLineChanged(versionId: number, lineNumber: number, newText: string): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null] { + public onModelLineChanged(versionId: number, lineNumber: number, lineBreakData: LineBreakData | null): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null] { if (versionId <= this._validModelVersionId) { // Here we check for versionId in case the lines were reconstructed in the meantime. // We don't want to apply stale change events on top of a newer read model state. @@ -441,7 +593,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { let oldOutputLineCount = this.lines[lineIndex].getViewLineCount(); let isVisible = this.lines[lineIndex].isVisible(); - let line = createSplitLine(this.linePositionMapperFactory, newText, this.tabSize, this.wrappingColumn, this.columnsForFullWidthChar, this.wrappingIndent, isVisible); + let line = createSplitLine(lineBreakData, isVisible); this.lines[lineIndex] = line; let newOutputLineCount = this.lines[lineIndex].getViewLineCount(); @@ -488,7 +640,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineCount(): number { - this._ensureValidState(); return this.prefixSumComputer.getTotalValue(); } @@ -496,22 +647,14 @@ export class SplitLinesCollection implements IViewModelLinesCollection { if (viewLineNumber < 1) { return 1; } - let viewLineCount = this.getViewLineCount(); + const viewLineCount = this.getViewLineCount(); if (viewLineNumber > viewLineCount) { return viewLineCount; } - return viewLineNumber; - } - - /** - * Gives a hint that a lot of requests are about to come in for these line numbers. - */ - public warmUpLookupCache(viewStartLineNumber: number, viewEndLineNumber: number): void { - this.prefixSumComputer.warmUpCache(viewStartLineNumber - 1, viewEndLineNumber - 1); + return viewLineNumber | 0; } public getActiveIndentGuide(viewLineNumber: number, minLineNumber: number, maxLineNumber: number): IActiveIndentGuideInfo { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); minLineNumber = this._toValidViewLineNumber(minLineNumber); maxLineNumber = this._toValidViewLineNumber(maxLineNumber); @@ -531,7 +674,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLinesIndentGuides(viewStartLineNumber: number, viewEndLineNumber: number): number[] { - this._ensureValidState(); viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber); viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber); @@ -602,7 +744,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineContent(viewLineNumber: number): string { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); let lineIndex = r.index; @@ -612,7 +753,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineLength(viewLineNumber: number): number { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); let lineIndex = r.index; @@ -622,7 +762,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineMinColumn(viewLineNumber: number): number { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); let lineIndex = r.index; @@ -632,7 +771,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineMaxColumn(viewLineNumber: number): number { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); let lineIndex = r.index; @@ -642,7 +780,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLineData(viewLineNumber: number): ViewLineData { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); let lineIndex = r.index; @@ -652,7 +789,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public getViewLinesData(viewStartLineNumber: number, viewEndLineNumber: number, needed: boolean[]): ViewLineData[] { - this._ensureValidState(); viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber); viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber); @@ -691,7 +827,6 @@ export class SplitLinesCollection implements IViewModelLinesCollection { } public validateViewPosition(viewLineNumber: number, viewColumn: number, expectedModelPosition: Position): Position { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); @@ -719,8 +854,13 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return this.convertModelPositionToViewPosition(expectedModelPosition.lineNumber, expectedModelPosition.column); } + public validateViewRange(viewRange: Range, expectedModelRange: Range): Range { + const validViewStart = this.validateViewPosition(viewRange.startLineNumber, viewRange.startColumn, expectedModelRange.getStartPosition()); + const validViewEnd = this.validateViewPosition(viewRange.endLineNumber, viewRange.endColumn, expectedModelRange.getEndPosition()); + return new Range(validViewStart.lineNumber, validViewStart.column, validViewEnd.lineNumber, validViewEnd.column); + } + public convertViewPositionToModelPosition(viewLineNumber: number, viewColumn: number): Position { - this._ensureValidState(); viewLineNumber = this._toValidViewLineNumber(viewLineNumber); let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1); @@ -732,8 +872,13 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return this.model.validatePosition(new Position(lineIndex + 1, inputColumn)); } + public convertViewRangeToModelRange(viewRange: Range): Range { + const start = this.convertViewPositionToModelPosition(viewRange.startLineNumber, viewRange.startColumn); + const end = this.convertViewPositionToModelPosition(viewRange.endLineNumber, viewRange.endColumn); + return new Range(start.lineNumber, start.column, end.lineNumber, end.column); + } + public convertModelPositionToViewPosition(_modelLineNumber: number, _modelColumn: number): Position { - this._ensureValidState(); const validPosition = this.model.validatePosition(new Position(_modelLineNumber, _modelColumn)); const inputLineNumber = validPosition.lineNumber; @@ -795,7 +940,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { return this.lines[lineIndex].getViewLineNumberOfModelPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1)); } - public getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: ITheme): IOverviewRulerDecorations { + public getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: EditorTheme): IOverviewRulerDecorations { const decorations = this.model.getOverviewRulerDecorations(ownerId, filterOutValidation); const result = new OverviewRulerDecorations(); for (const decoration of decorations) { @@ -898,6 +1043,10 @@ class VisibleIdentitySplitLine implements ISplitLine { return InvisibleIdentitySplitLine.INSTANCE; } + public getLineBreakData(): LineBreakData | null { + return null; + } + public getViewLineCount(): number { return 1; } @@ -926,6 +1075,7 @@ class VisibleIdentitySplitLine implements ISplitLine { false, 1, lineContent.length + 1, + 0, lineTokens.inflate() ); } @@ -968,6 +1118,10 @@ class InvisibleIdentitySplitLine implements ISplitLine { return VisibleIdentitySplitLine.INSTANCE; } + public getLineBreakData(): LineBreakData | null { + return null; + } + public getViewLineCount(): number { return 0; } @@ -1011,18 +1165,11 @@ class InvisibleIdentitySplitLine implements ISplitLine { export class SplitLine implements ISplitLine { - private readonly positionMapper: ILineMapping; - private readonly outputLineCount: number; - - private readonly wrappedIndent: string; - private readonly wrappedIndentLength: number; + private readonly _lineBreakData: LineBreakData; private _isVisible: boolean; - constructor(positionMapper: ILineMapping, isVisible: boolean) { - this.positionMapper = positionMapper; - this.wrappedIndent = this.positionMapper.getWrappedLinesIndent(); - this.wrappedIndentLength = this.wrappedIndent.length; - this.outputLineCount = this.positionMapper.getOutputLineCount(); + constructor(lineBreakData: LineBreakData, isVisible: boolean) { + this._lineBreakData = lineBreakData; this._isVisible = isVisible; } @@ -1035,22 +1182,26 @@ export class SplitLine implements ISplitLine { return this; } + public getLineBreakData(): LineBreakData | null { + return this._lineBreakData; + } + public getViewLineCount(): number { if (!this._isVisible) { return 0; } - return this.outputLineCount; + return this._lineBreakData.breakOffsets.length; } private getInputStartOffsetOfOutputLineIndex(outputLineIndex: number): number { - return this.positionMapper.getInputOffsetOfOutputPosition(outputLineIndex, 0); + return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex, 0); } private getInputEndOffsetOfOutputLineIndex(model: ISimpleModel, modelLineNumber: number, outputLineIndex: number): number { - if (outputLineIndex + 1 === this.outputLineCount) { + if (outputLineIndex + 1 === this._lineBreakData.breakOffsets.length) { return model.getLineMaxColumn(modelLineNumber) - 1; } - return this.positionMapper.getInputOffsetOfOutputPosition(outputLineIndex + 1, 0); + return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex + 1, 0); } public getViewLineContent(model: ISimpleModel, modelLineNumber: number, outputLineIndex: number): string { @@ -1067,7 +1218,7 @@ export class SplitLine implements ISplitLine { }); if (outputLineIndex > 0) { - r = this.wrappedIndent + r; + r = spaces(this._lineBreakData.wrappedTextIndentLength) + r; } return r; @@ -1082,7 +1233,7 @@ export class SplitLine implements ISplitLine { let r = endOffset - startOffset; if (outputLineIndex > 0) { - r = this.wrappedIndent.length + r; + r = this._lineBreakData.wrappedTextIndentLength + r; } return r; @@ -1093,7 +1244,7 @@ export class SplitLine implements ISplitLine { throw new Error('Not supported'); } if (outputLineIndex > 0) { - return this.wrappedIndentLength + 1; + return this._lineBreakData.wrappedTextIndentLength + 1; } return 1; } @@ -1121,25 +1272,28 @@ export class SplitLine implements ISplitLine { }); if (outputLineIndex > 0) { - lineContent = this.wrappedIndent + lineContent; + lineContent = spaces(this._lineBreakData.wrappedTextIndentLength) + lineContent; } - let minColumn = (outputLineIndex > 0 ? this.wrappedIndentLength + 1 : 1); + let minColumn = (outputLineIndex > 0 ? this._lineBreakData.wrappedTextIndentLength + 1 : 1); let maxColumn = lineContent.length + 1; let continuesWithWrappedLine = (outputLineIndex + 1 < this.getViewLineCount()); let deltaStartIndex = 0; if (outputLineIndex > 0) { - deltaStartIndex = this.wrappedIndentLength; + deltaStartIndex = this._lineBreakData.wrappedTextIndentLength; } let lineTokens = model.getLineTokens(modelLineNumber); + const startVisibleColumn = (outputLineIndex === 0 ? 0 : this._lineBreakData.breakOffsetsVisibleColumn[outputLineIndex - 1]); + return new ViewLineData( lineContent, continuesWithWrappedLine, minColumn, maxColumn, + startVisibleColumn, lineTokens.sliceAndInflate(startOffset, endOffset, deltaStartIndex) ); } @@ -1165,25 +1319,25 @@ export class SplitLine implements ISplitLine { } let adjustedColumn = outputColumn - 1; if (outputLineIndex > 0) { - if (adjustedColumn < this.wrappedIndentLength) { + if (adjustedColumn < this._lineBreakData.wrappedTextIndentLength) { adjustedColumn = 0; } else { - adjustedColumn -= this.wrappedIndentLength; + adjustedColumn -= this._lineBreakData.wrappedTextIndentLength; } } - return this.positionMapper.getInputOffsetOfOutputPosition(outputLineIndex, adjustedColumn) + 1; + return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex, adjustedColumn) + 1; } public getViewPositionOfModelPosition(deltaLineNumber: number, inputColumn: number): Position { if (!this._isVisible) { throw new Error('Not supported'); } - let r = this.positionMapper.getOutputPositionOfInputOffset(inputColumn - 1); + let r = LineBreakData.getOutputPositionOfInputOffset(this._lineBreakData.breakOffsets, inputColumn - 1); let outputLineIndex = r.outputLineIndex; let outputColumn = r.outputOffset + 1; if (outputLineIndex > 0) { - outputColumn += this.wrappedIndentLength; + outputColumn += this._lineBreakData.wrappedTextIndentLength; } // console.log('in -> out ' + deltaLineNumber + ',' + inputColumn + ' ===> ' + (deltaLineNumber+outputLineIndex) + ',' + outputColumn); @@ -1194,21 +1348,33 @@ export class SplitLine implements ISplitLine { if (!this._isVisible) { throw new Error('Not supported'); } - const r = this.positionMapper.getOutputPositionOfInputOffset(inputColumn - 1); + const r = LineBreakData.getOutputPositionOfInputOffset(this._lineBreakData.breakOffsets, inputColumn - 1); return (deltaLineNumber + r.outputLineIndex); } } -function createSplitLine(linePositionMapperFactory: ILineMapperFactory, text: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent, isVisible: boolean): ISplitLine { - let positionMapper = linePositionMapperFactory.createLineMapping(text, tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent); - if (positionMapper === null) { +let _spaces: string[] = ['']; +function spaces(count: number): string { + if (count >= _spaces.length) { + for (let i = 1; i <= count; i++) { + _spaces[i] = _makeSpaces(i); + } + } + return _spaces[count]; +} +function _makeSpaces(count: number): string { + return new Array(count + 1).join(' '); +} + +function createSplitLine(lineBreakData: LineBreakData | null, isVisible: boolean): ISplitLine { + if (lineBreakData === null) { // No mapping needed if (isVisible) { return VisibleIdentitySplitLine.INSTANCE; } return InvisibleIdentitySplitLine.INSTANCE; } else { - return new SplitLine(positionMapper, isVisible); + return new SplitLine(lineBreakData, isVisible); } } @@ -1294,10 +1460,22 @@ export class IdentityLinesCollection implements IViewModelLinesCollection { return false; } - public setWrappingSettings(_wrappingIndent: WrappingIndent, _wrappingColumn: number, _columnsForFullWidthChar: number): boolean { + public setWrappingSettings(_fontInfo: FontInfo, _wrappingStrategy: 'simple' | 'advanced', _wrappingColumn: number, _wrappingIndent: WrappingIndent): boolean { return false; } + public createLineBreaksComputer(): ILineBreaksComputer { + let result: null[] = []; + return { + addRequest: (lineText: string, previousLineBreakData: LineBreakData | null) => { + result.push(null); + }, + finalize: () => { + return result; + } + }; + } + public onModelFlushed(): void { } @@ -1305,11 +1483,11 @@ export class IdentityLinesCollection implements IViewModelLinesCollection { return new viewEvents.ViewLinesDeletedEvent(fromLineNumber, toLineNumber); } - public onModelLinesInserted(_versionId: number, fromLineNumber: number, toLineNumber: number, _text: string[]): viewEvents.ViewLinesInsertedEvent | null { + public onModelLinesInserted(_versionId: number, fromLineNumber: number, toLineNumber: number, lineBreaks: (LineBreakData | null)[]): viewEvents.ViewLinesInsertedEvent | null { return new viewEvents.ViewLinesInsertedEvent(fromLineNumber, toLineNumber); } - public onModelLineChanged(_versionId: number, lineNumber: number, _newText: string): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null] { + public onModelLineChanged(_versionId: number, lineNumber: number, lineBreakData: LineBreakData | null): [boolean, viewEvents.ViewLinesChangedEvent | null, viewEvents.ViewLinesInsertedEvent | null, viewEvents.ViewLinesDeletedEvent | null] { return [false, new viewEvents.ViewLinesChangedEvent(lineNumber, lineNumber), null, null]; } @@ -1320,9 +1498,6 @@ export class IdentityLinesCollection implements IViewModelLinesCollection { return this.model.getLineCount(); } - public warmUpLookupCache(_viewStartLineNumber: number, _viewEndLineNumber: number): void { - } - public getActiveIndentGuide(viewLineNumber: number, _minLineNumber: number, _maxLineNumber: number): IActiveIndentGuideInfo { return { startLineNumber: viewLineNumber, @@ -1364,6 +1539,7 @@ export class IdentityLinesCollection implements IViewModelLinesCollection { false, 1, lineContent.length + 1, + 0, lineTokens.inflate() ); } @@ -1385,7 +1561,7 @@ export class IdentityLinesCollection implements IViewModelLinesCollection { return result; } - public getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: ITheme): IOverviewRulerDecorations { + public getAllOverviewRulerDecorations(ownerId: number, filterOutValidation: boolean, theme: EditorTheme): IOverviewRulerDecorations { const decorations = this.model.getOverviewRulerDecorations(ownerId, filterOutValidation); const result = new OverviewRulerDecorations(); for (const decoration of decorations) { diff --git a/src/vs/editor/common/viewModel/viewEventHandler.ts b/src/vs/editor/common/viewModel/viewEventHandler.ts index e421f5ffde294..b8d0bc823a692 100644 --- a/src/vs/editor/common/viewModel/viewEventHandler.ts +++ b/src/vs/editor/common/viewModel/viewEventHandler.ts @@ -36,6 +36,9 @@ export class ViewEventHandler extends Disposable { public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { return false; } + public onContentSizeChanged(e: viewEvents.ViewContentSizeChangedEvent): boolean { + return false; + } public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean { return false; } @@ -69,6 +72,9 @@ export class ViewEventHandler extends Disposable { public onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean { return false; } + public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean { + return false; + } public onTokensChanged(e: viewEvents.ViewTokensChangedEvent): boolean { return false; } @@ -78,9 +84,6 @@ export class ViewEventHandler extends Disposable { public onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean { return false; } - public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean { - return false; - } // --- end event handlers @@ -99,6 +102,12 @@ export class ViewEventHandler extends Disposable { } break; + case viewEvents.ViewEventType.ViewContentSizeChanged: + if (this.onContentSizeChanged(e)) { + shouldRender = true; + } + break; + case viewEvents.ViewEventType.ViewCursorStateChanged: if (this.onCursorStateChanged(e)) { shouldRender = true; @@ -171,20 +180,20 @@ export class ViewEventHandler extends Disposable { } break; - case viewEvents.ViewEventType.ViewTokensColorsChanged: - if (this.onTokensColorsChanged(e)) { + case viewEvents.ViewEventType.ViewThemeChanged: + if (this.onThemeChanged(e)) { shouldRender = true; } break; - case viewEvents.ViewEventType.ViewZonesChanged: - if (this.onZonesChanged(e)) { + case viewEvents.ViewEventType.ViewTokensColorsChanged: + if (this.onTokensColorsChanged(e)) { shouldRender = true; } break; - case viewEvents.ViewEventType.ViewThemeChanged: - if (this.onThemeChanged(e)) { + case viewEvents.ViewEventType.ViewZonesChanged: + if (this.onZonesChanged(e)) { shouldRender = true; } break; diff --git a/src/vs/editor/common/viewModel/viewModel.ts b/src/vs/editor/common/viewModel/viewModel.ts index 0f16d0a84a299..529f386a13548 100644 --- a/src/vs/editor/common/viewModel/viewModel.ts +++ b/src/vs/editor/common/viewModel/viewModel.ts @@ -13,8 +13,8 @@ import { INewScrollPosition } from 'vs/editor/common/editorCommon'; import { EndOfLinePreference, IActiveIndentGuideInfo, IModelDecorationOptions, TextModelResolvedOptions } from 'vs/editor/common/model'; import { IViewEventListener } from 'vs/editor/common/view/viewEvents'; import { IPartialViewLinesViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'; -import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer'; -import { ITheme } from 'vs/platform/theme/common/themeService'; +import { IEditorWhitespace, IWhitespaceChangeAccessor } from 'vs/editor/common/viewLayout/linesLayout'; +import { EditorTheme } from 'vs/editor/common/view/viewContext'; export interface IViewWhitespaceViewportData { readonly id: string; @@ -41,7 +41,7 @@ export class Viewport { export interface IViewLayout { - readonly scrollable: Scrollable; + getScrollable(): Scrollable; onMaxLineWidthChanged(width: number): void; @@ -69,20 +69,8 @@ export interface IViewLayout { getWhitespaceAtVerticalOffset(verticalOffset: number): IViewWhitespaceViewportData | null; // --------------- Begin vertical whitespace management + changeWhitespace(callback: (accessor: IWhitespaceChangeAccessor) => T): T; - /** - * Reserve rendering space. - * @return an identifier that can be later used to remove or change the whitespace. - */ - addWhitespace(afterLineNumber: number, ordinal: number, height: number, minWidth: number): string; - /** - * Change the properties of a whitespace. - */ - changeWhitespace(id: string, newAfterLineNumber: number, newHeight: number): boolean; - /** - * Remove rendering space - */ - removeWhitespace(id: string): boolean; /** * Get the layout information for whitespaces currently in the viewport */ @@ -139,7 +127,7 @@ export interface IViewModel { getLineMaxColumn(lineNumber: number): number; getLineFirstNonWhitespaceColumn(lineNumber: number): number; getLineLastNonWhitespaceColumn(lineNumber: number): number; - getAllOverviewRulerDecorations(theme: ITheme): IOverviewRulerDecorations; + getAllOverviewRulerDecorations(theme: EditorTheme): IOverviewRulerDecorations; invalidateOverviewRulerColorCache(): void; invalidateMinimapColorCache(): void; getValueInRange(range: Range, eol: EndOfLinePreference): string; @@ -150,8 +138,8 @@ export interface IViewModel { deduceModelPositionRelativeToViewPosition(viewAnchorPosition: Position, deltaOffset: number, lineFeedCnt: number): Position; getEOL(): string; - getPlainTextToCopy(ranges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[]; - getHTMLToCopy(ranges: Range[], emptySelectionClipboard: boolean): string | null; + getPlainTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[]; + getRichTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean): { html: string, mode: string } | null; } export class MinimapLinesRenderingData { @@ -186,6 +174,10 @@ export class ViewLineData { * The maximum allowed column at this view line. */ public readonly maxColumn: number; + /** + * The visible column at the start of the line (after the fauxIndent). + */ + public readonly startVisibleColumn: number; /** * The tokens at this view line. */ @@ -196,12 +188,14 @@ export class ViewLineData { continuesWithWrappedLine: boolean, minColumn: number, maxColumn: number, + startVisibleColumn: number, tokens: IViewLineTokens ) { this.content = content; this.continuesWithWrappedLine = continuesWithWrappedLine; this.minColumn = minColumn; this.maxColumn = maxColumn; + this.startVisibleColumn = startVisibleColumn; this.tokens = tokens; } } @@ -243,6 +237,10 @@ export class ViewLineRenderingData { * The tab size for this view model. */ public readonly tabSize: number; + /** + * The visible column at the start of the line (after the fauxIndent) + */ + public readonly startVisibleColumn: number; constructor( minColumn: number, @@ -253,7 +251,8 @@ export class ViewLineRenderingData { mightContainNonBasicASCII: boolean, tokens: IViewLineTokens, inlineDecorations: InlineDecoration[], - tabSize: number + tabSize: number, + startVisibleColumn: number ) { this.minColumn = minColumn; this.maxColumn = maxColumn; @@ -266,6 +265,7 @@ export class ViewLineRenderingData { this.tokens = tokens; this.inlineDecorations = inlineDecorations; this.tabSize = tabSize; + this.startVisibleColumn = startVisibleColumn; } public static isBasicASCII(lineContent: string, mightContainNonBasicASCII: boolean): boolean { diff --git a/src/vs/editor/common/viewModel/viewModelDecorations.ts b/src/vs/editor/common/viewModel/viewModelDecorations.ts index b74baa8dd1cb7..c30da7ecdf431 100644 --- a/src/vs/editor/common/viewModel/viewModelDecorations.ts +++ b/src/vs/editor/common/viewModel/viewModelDecorations.ts @@ -10,7 +10,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon'; import { IModelDecoration, ITextModel } from 'vs/editor/common/model'; import { IViewModelLinesCollection } from 'vs/editor/common/viewModel/splitLinesCollection'; import { ICoordinatesConverter, InlineDecoration, InlineDecorationType, ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel'; -import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { filterValidationDecorations } from 'vs/editor/common/config/editorOptions'; export interface IDecorationsViewportData { /** @@ -104,7 +104,7 @@ export class ViewModelDecorations implements IDisposable { } private _getDecorationsViewportData(viewportRange: Range): IDecorationsViewportData { - const modelDecorations = this._linesCollection.getDecorationsInRange(viewportRange, this.editorId, this.configuration.options.get(EditorOption.readOnly)); + const modelDecorations = this._linesCollection.getDecorationsInRange(viewportRange, this.editorId, filterValidationDecorations(this.configuration.options)); const startLineNumber = viewportRange.startLineNumber; const endLineNumber = viewportRange.endLineNumber; diff --git a/src/vs/editor/common/viewModel/viewModelImpl.ts b/src/vs/editor/common/viewModel/viewModelImpl.ts index e08af64ebf9aa..d184fc82add57 100644 --- a/src/vs/editor/common/viewModel/viewModelImpl.ts +++ b/src/vs/editor/common/viewModel/viewModelImpl.ts @@ -6,10 +6,10 @@ import { Color } from 'vs/base/common/color'; import { IDisposable } from 'vs/base/common/lifecycle'; import * as strings from 'vs/base/common/strings'; -import { ConfigurationChangedEvent, EDITOR_FONT_DEFAULTS, EditorOption } from 'vs/editor/common/config/editorOptions'; +import { ConfigurationChangedEvent, EDITOR_FONT_DEFAULTS, EditorOption, filterValidationDecorations } from 'vs/editor/common/config/editorOptions'; import { IPosition, Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IConfiguration, IViewState } from 'vs/editor/common/editorCommon'; import { EndOfLinePreference, IActiveIndentGuideInfo, ITextModel, TrackedRangeStickiness, TextModelResolvedOptions } from 'vs/editor/common/model'; import { ModelDecorationOverviewRulerOptions, ModelDecorationMinimapOptions } from 'vs/editor/common/model/textModel'; import * as textModelEvents from 'vs/editor/common/model/textModelEvents'; @@ -18,22 +18,22 @@ import { tokenizeLineToHTML } from 'vs/editor/common/modes/textToHtmlTokenizer'; import { MinimapTokensColorTracker } from 'vs/editor/common/viewModel/minimapTokensColorTracker'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { ViewLayout } from 'vs/editor/common/viewLayout/viewLayout'; -import { CharacterHardWrappingLineMapperFactory } from 'vs/editor/common/viewModel/characterHardWrappingLineMapper'; -import { IViewModelLinesCollection, IdentityLinesCollection, SplitLinesCollection } from 'vs/editor/common/viewModel/splitLinesCollection'; +import { IViewModelLinesCollection, IdentityLinesCollection, SplitLinesCollection, ILineBreaksComputerFactory } from 'vs/editor/common/viewModel/splitLinesCollection'; import { ICoordinatesConverter, IOverviewRulerDecorations, IViewModel, MinimapLinesRenderingData, ViewLineData, ViewLineRenderingData, ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel'; import { ViewModelDecorations } from 'vs/editor/common/viewModel/viewModelDecorations'; -import { ITheme } from 'vs/platform/theme/common/themeService'; import { RunOnceScheduler } from 'vs/base/common/async'; import * as platform from 'vs/base/common/platform'; +import { EditorTheme } from 'vs/editor/common/view/viewContext'; const USE_IDENTITY_LINES_COLLECTION = true; export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel { private readonly editorId: number; - private readonly configuration: editorCommon.IConfiguration; + private readonly configuration: IConfiguration; private readonly model: ITextModel; private readonly _tokenizeViewportSoon: RunOnceScheduler; + private readonly _updateConfigurationViewLineCount: RunOnceScheduler; private hasFocus: boolean; private viewportStartLine: number; private viewportStartLineTrackedRange: string | null; @@ -43,13 +43,21 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel public readonly viewLayout: ViewLayout; private readonly decorations: ViewModelDecorations; - constructor(editorId: number, configuration: editorCommon.IConfiguration, model: ITextModel, scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable) { + constructor( + editorId: number, + configuration: IConfiguration, + model: ITextModel, + domLineBreaksComputerFactory: ILineBreaksComputerFactory, + monospaceLineBreaksComputerFactory: ILineBreaksComputerFactory, + scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable + ) { super(); this.editorId = editorId; this.configuration = configuration; this.model = model; this._tokenizeViewportSoon = this._register(new RunOnceScheduler(() => this.tokenizeViewport(), 50)); + this._updateConfigurationViewLineCount = this._register(new RunOnceScheduler(() => this._updateConfigurationViewLineCountNow(), 0)); this.hasFocus = false; this.viewportStartLine = -1; this.viewportStartLineTrackedRange = null; @@ -61,25 +69,19 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel } else { const options = this.configuration.options; - const wrappingInfo = options.get(EditorOption.wrappingInfo); const fontInfo = options.get(EditorOption.fontInfo); - const wordWrapBreakAfterCharacters = options.get(EditorOption.wordWrapBreakAfterCharacters); - const wordWrapBreakBeforeCharacters = options.get(EditorOption.wordWrapBreakBeforeCharacters); - const wordWrapBreakObtrusiveCharacters = options.get(EditorOption.wordWrapBreakObtrusiveCharacters); + const wrappingStrategy = options.get(EditorOption.wrappingStrategy); + const wrappingInfo = options.get(EditorOption.wrappingInfo); const wrappingIndent = options.get(EditorOption.wrappingIndent); - let hardWrappingLineMapperFactory = new CharacterHardWrappingLineMapperFactory( - wordWrapBreakBeforeCharacters, - wordWrapBreakAfterCharacters, - wordWrapBreakObtrusiveCharacters - ); - this.lines = new SplitLinesCollection( this.model, - hardWrappingLineMapperFactory, + domLineBreaksComputerFactory, + monospaceLineBreaksComputerFactory, + fontInfo, this.model.getOptions().tabSize, + wrappingStrategy, wrappingInfo.wrappingColumn, - fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth, wrappingIndent ); } @@ -100,6 +102,15 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel } })); + this._register(this.viewLayout.onDidContentSizeChange((e) => { + try { + const eventsCollector = this._beginEmit(); + eventsCollector.emit(new viewEvents.ViewContentSizeChangedEvent(e)); + } finally { + this._endEmit(); + } + })); + this.decorations = new ViewModelDecorations(this.editorId, this.model, this.configuration, this.lines, this.coordinatesConverter); this._registerModelEvents(); @@ -121,6 +132,8 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel this._endEmit(); } })); + + this._updateConfigurationViewLineCountNow(); } public dispose(): void { @@ -133,6 +146,10 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel this.viewportStartLineTrackedRange = this.model._setTrackedRange(this.viewportStartLineTrackedRange, null, TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges); } + private _updateConfigurationViewLineCountNow(): void { + this.configuration.setViewLineCount(this.lines.getViewLineCount()); + } + public tokenizeViewport(): void { const linesViewportData = this.viewLayout.getLinesViewportData(); const startPosition = this.coordinatesConverter.convertViewPositionToModelPosition(new Position(linesViewportData.startLineNumber, 1)); @@ -155,14 +172,15 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel let restorePreviousViewportStart = false; const options = this.configuration.options; - const wrappingInfo = options.get(EditorOption.wrappingInfo); const fontInfo = options.get(EditorOption.fontInfo); + const wrappingStrategy = options.get(EditorOption.wrappingStrategy); + const wrappingInfo = options.get(EditorOption.wrappingInfo); const wrappingIndent = options.get(EditorOption.wrappingIndent); - if (this.lines.setWrappingSettings(wrappingIndent, wrappingInfo.wrappingColumn, fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth)) { + if (this.lines.setWrappingSettings(fontInfo, wrappingStrategy, wrappingInfo.wrappingColumn, wrappingIndent)) { eventsCollector.emit(new viewEvents.ViewFlushedEvent()); eventsCollector.emit(new viewEvents.ViewLineMappingChangedEvent()); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(null)); this.decorations.onLineMappingChanged(); this.viewLayout.onFlushed(this.getLineCount()); @@ -170,12 +188,14 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel // Never change the scroll position from 0 to something else... restorePreviousViewportStart = true; } + + this._updateConfigurationViewLineCount.schedule(); } if (e.hasChanged(EditorOption.readOnly)) { // Must read again all decorations due to readOnly filtering this.decorations.reset(); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(null)); } eventsCollector.emit(new viewEvents.ViewConfigurationChangedEvent(e)); @@ -200,8 +220,26 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel const changes = e.changes; const versionId = e.versionId; - for (let j = 0, lenJ = changes.length; j < lenJ; j++) { - const change = changes[j]; + // Do a first pass to compute line mappings, and a second pass to actually interpret them + const lineBreaksComputer = this.lines.createLineBreaksComputer(); + for (const change of changes) { + switch (change.changeType) { + case textModelEvents.RawContentChangedType.LinesInserted: { + for (const line of change.detail) { + lineBreaksComputer.addRequest(line, null); + } + break; + } + case textModelEvents.RawContentChangedType.LineChanged: { + lineBreaksComputer.addRequest(change.detail, null); + break; + } + } + } + const lineBreaks = lineBreaksComputer.finalize(); + let lineBreaksOffset = 0; + + for (const change of changes) { switch (change.changeType) { case textModelEvents.RawContentChangedType.Flush: { @@ -222,7 +260,10 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel break; } case textModelEvents.RawContentChangedType.LinesInserted: { - const linesInsertedEvent = this.lines.onModelLinesInserted(versionId, change.fromLineNumber, change.toLineNumber, change.detail); + const insertedLineBreaks = lineBreaks.slice(lineBreaksOffset, lineBreaksOffset + change.detail.length); + lineBreaksOffset += change.detail.length; + + const linesInsertedEvent = this.lines.onModelLinesInserted(versionId, change.fromLineNumber, change.toLineNumber, insertedLineBreaks); if (linesInsertedEvent !== null) { eventsCollector.emit(linesInsertedEvent); this.viewLayout.onLinesInserted(linesInsertedEvent.fromLineNumber, linesInsertedEvent.toLineNumber); @@ -231,7 +272,10 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel break; } case textModelEvents.RawContentChangedType.LineChanged: { - const [lineMappingChanged, linesChangedEvent, linesInsertedEvent, linesDeletedEvent] = this.lines.onModelLineChanged(versionId, change.lineNumber, change.detail); + const changedLineBreakData = lineBreaks[lineBreaksOffset]; + lineBreaksOffset++; + + const [lineMappingChanged, linesChangedEvent, linesInsertedEvent, linesDeletedEvent] = this.lines.onModelLineChanged(versionId, change.lineNumber, changedLineBreakData); hadModelLineChangeThatChangedLineMapping = lineMappingChanged; if (linesChangedEvent) { eventsCollector.emit(linesChangedEvent); @@ -257,7 +301,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel if (!hadOtherModelChange && hadModelLineChangeThatChangedLineMapping) { eventsCollector.emit(new viewEvents.ViewLineMappingChangedEvent()); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(null)); this.decorations.onLineMappingChanged(); } } finally { @@ -267,6 +311,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel // Update the configuration and reset the centered view line this.viewportStartLine = -1; this.configuration.setMaxLineNumber(this.model.getLineCount()); + this._updateConfigurationViewLineCountNow(); // Recover viewport if (!this.hasFocus && this.model.getAttachedEditorCount() >= 2 && this.viewportStartLineTrackedRange) { @@ -320,10 +365,11 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel const eventsCollector = this._beginEmit(); eventsCollector.emit(new viewEvents.ViewFlushedEvent()); eventsCollector.emit(new viewEvents.ViewLineMappingChangedEvent()); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(null)); } finally { this._endEmit(); } + this._updateConfigurationViewLineCount.schedule(); } })); @@ -331,7 +377,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel this.decorations.onModelDecorationsChanged(); try { const eventsCollector = this._beginEmit(); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(e)); } finally { this._endEmit(); } @@ -345,7 +391,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel if (lineMappingChanged) { eventsCollector.emit(new viewEvents.ViewFlushedEvent()); eventsCollector.emit(new viewEvents.ViewLineMappingChangedEvent()); - eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent()); + eventsCollector.emit(new viewEvents.ViewDecorationsChangedEvent(null)); this.decorations.onLineMappingChanged(); this.viewLayout.onFlushed(this.getLineCount()); this.viewLayout.onHeightMaybeChanged(); @@ -353,6 +399,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel } finally { this._endEmit(); } + this._updateConfigurationViewLineCount.schedule(); } public getVisibleRanges(): Range[] { @@ -422,7 +469,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel ); } - public saveState(): editorCommon.IViewState { + public saveState(): IViewState { const compatViewState = this.viewLayout.saveState(); const scrollTop = compatViewState.scrollTop; @@ -437,7 +484,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel }; } - public reduceRestoreState(state: editorCommon.IViewState): { scrollLeft: number; scrollTop: number; } { + public reduceRestoreState(state: IViewState): { scrollLeft: number; scrollTop: number; } { if (typeof state.firstPosition === 'undefined') { // This is a view state serialized by an older version return this._reduceRestoreStateCompatibility(state); @@ -452,7 +499,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel }; } - private _reduceRestoreStateCompatibility(state: editorCommon.IViewState): { scrollLeft: number; scrollTop: number; } { + private _reduceRestoreStateCompatibility(state: IViewState): { scrollLeft: number; scrollTop: number; } { return { scrollLeft: state.scrollLeft, scrollTop: state.scrollTopWithoutViewZones! @@ -475,8 +522,6 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel * Gives a hint that a lot of requests are about to come in for these line numbers. */ public setViewport(startLineNumber: number, endLineNumber: number, centeredLineNumber: number): void { - this.lines.warmUpLookupCache(startLineNumber, endLineNumber); - this.viewportStartLine = startLineNumber; let position = this.coordinatesConverter.convertViewPositionToModelPosition(new Position(startLineNumber, this.getLineMinColumn(startLineNumber))); this.viewportStartLineTrackedRange = this.model._setTrackedRange(this.viewportStartLineTrackedRange, new Range(position.lineNumber, position.column, position.lineNumber, position.column), TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges); @@ -546,7 +591,8 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel mightContainNonBasicASCII, lineData.tokens, inlineDecorations, - tabSize + tabSize, + lineData.startVisibleColumn ); } @@ -562,8 +608,8 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel ); } - public getAllOverviewRulerDecorations(theme: ITheme): IOverviewRulerDecorations { - return this.lines.getAllOverviewRulerDecorations(this.editorId, this.configuration.options.get(EditorOption.readOnly), theme); + public getAllOverviewRulerDecorations(theme: EditorTheme): IOverviewRulerDecorations { + return this.lines.getAllOverviewRulerDecorations(this.editorId, filterValidationDecorations(this.configuration.options), theme); } public invalidateOverviewRulerColorCache(): void { @@ -623,15 +669,15 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel return this.model.getEOL(); } - public getPlainTextToCopy(ranges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[] { + public getPlainTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[] { const newLineCharacter = forceCRLF ? '\r\n' : this.model.getEOL(); - ranges = ranges.slice(0); - ranges.sort(Range.compareRangesUsingStarts); + modelRanges = modelRanges.slice(0); + modelRanges.sort(Range.compareRangesUsingStarts); let hasEmptyRange = false; let hasNonEmptyRange = false; - for (const range of ranges) { + for (const range of modelRanges) { if (range.isEmpty()) { hasEmptyRange = true; } else { @@ -645,10 +691,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel return ''; } - const modelLineNumbers = ranges.map((r) => { - const viewLineStart = new Position(r.startLineNumber, 1); - return this.coordinatesConverter.convertViewPositionToModelPosition(viewLineStart).lineNumber; - }); + const modelLineNumbers = modelRanges.map((r) => r.startLineNumber); let result = ''; for (let i = 0; i < modelLineNumbers.length; i++) { @@ -664,14 +707,14 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel // mixed empty selections and non-empty selections let result: string[] = []; let prevModelLineNumber = 0; - for (const range of ranges) { - const modelLineNumber = this.coordinatesConverter.convertViewPositionToModelPosition(new Position(range.startLineNumber, 1)).lineNumber; - if (range.isEmpty()) { + for (const modelRange of modelRanges) { + const modelLineNumber = modelRange.startLineNumber; + if (modelRange.isEmpty()) { if (modelLineNumber !== prevModelLineNumber) { result.push(this.model.getLineContent(modelLineNumber)); } } else { - result.push(this.getValueInRange(range, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined)); + result.push(this.model.getValueInRange(modelRange, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined)); } prevModelLineNumber = modelLineNumber; } @@ -679,31 +722,32 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel } let result: string[] = []; - for (const range of ranges) { - if (!range.isEmpty()) { - result.push(this.getValueInRange(range, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined)); + for (const modelRange of modelRanges) { + if (!modelRange.isEmpty()) { + result.push(this.model.getValueInRange(modelRange, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined)); } } return result.length === 1 ? result[0] : result; } - public getHTMLToCopy(viewRanges: Range[], emptySelectionClipboard: boolean): string | null { - if (this.model.getLanguageIdentifier().id === LanguageId.PlainText) { + public getRichTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean): { html: string, mode: string } | null { + const languageId = this.model.getLanguageIdentifier(); + if (languageId.id === LanguageId.PlainText) { return null; } - if (viewRanges.length !== 1) { + if (modelRanges.length !== 1) { // no multiple selection support at this time return null; } - let range = this.coordinatesConverter.convertViewRangeToModelRange(viewRanges[0]); + let range = modelRanges[0]; if (range.isEmpty()) { if (!emptySelectionClipboard) { // nothing to copy return null; } - let lineNumber = range.startLineNumber; + const lineNumber = range.startLineNumber; range = new Range(lineNumber, this.model.getLineMinColumn(lineNumber), lineNumber, this.model.getLineMaxColumn(lineNumber)); } @@ -711,19 +755,22 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel const colorMap = this._getColorMap(); const fontFamily = fontInfo.fontFamily === EDITOR_FONT_DEFAULTS.fontFamily ? fontInfo.fontFamily : `'${fontInfo.fontFamily}', ${EDITOR_FONT_DEFAULTS.fontFamily}`; - return ( - `
` - + this._getHTMLToCopy(range, colorMap) - + '
' - ); + return { + mode: languageId.language, + html: ( + `
` + + this._getHTMLToCopy(range, colorMap) + + '
' + ) + }; } private _getHTMLToCopy(modelRange: Range, colorMap: string[]): string { diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index ac8db2f732549..5e150312ce66f 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -13,7 +13,7 @@ import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorCon import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { IModelDeltaDecoration, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; @@ -103,7 +103,7 @@ class BracketsData { } } -export class BracketMatchingController extends Disposable implements editorCommon.IEditorContribution { +export class BracketMatchingController extends Disposable implements IEditorContribution { public static readonly ID = 'editor.contrib.bracketMatchingController'; public static get(editor: ICodeEditor): BracketMatchingController { @@ -116,7 +116,7 @@ export class BracketMatchingController extends Disposable implements editorCommo private _lastVersionId: number; private _decorations: string[]; private readonly _updateBracketsSoon: RunOnceScheduler; - private _matchBrackets: boolean; + private _matchBrackets: 'never' | 'near' | 'always'; constructor( editor: ICodeEditor @@ -132,7 +132,7 @@ export class BracketMatchingController extends Disposable implements editorCommo this._updateBracketsSoon.schedule(); this._register(editor.onDidChangeCursorPosition((e) => { - if (!this._matchBrackets) { + if (this._matchBrackets === 'never') { // Early exit if nothing needs to be done! // Leave some form of early exit check here if you wish to continue being a cursor position change listener ;) return; @@ -153,12 +153,13 @@ export class BracketMatchingController extends Disposable implements editorCommo this._updateBracketsSoon.schedule(); })); this._register(editor.onDidChangeConfiguration((e) => { - this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets); - if (!this._matchBrackets && this._decorations.length > 0) { - // Remove existing decorations if bracket matching is off + if (e.hasChanged(EditorOption.matchBrackets)) { + this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets); this._decorations = this._editor.deltaDecorations(this._decorations, []); + this._lastBracketsData = []; + this._lastVersionId = 0; + this._updateBracketsSoon.schedule(); } - this._updateBracketsSoon.schedule(); })); } @@ -262,7 +263,7 @@ export class BracketMatchingController extends Disposable implements editorCommo }); private _updateBrackets(): void { - if (!this._matchBrackets) { + if (this._matchBrackets === 'never') { return; } this._recomputeBrackets(); @@ -332,8 +333,8 @@ export class BracketMatchingController extends Disposable implements editorCommo } else { let brackets = model.matchBracket(position); let options = BracketMatchingController._DECORATION_OPTIONS_WITH_OVERVIEW_RULER; - if (!brackets) { - brackets = model.findEnclosingBrackets(position); + if (!brackets && this._matchBrackets === 'always') { + brackets = model.findEnclosingBrackets(position, 20 /* give at most 20ms to compute */); options = BracketMatchingController._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER; } newData[newDataLen++] = new BracketsData(position, brackets, options); diff --git a/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts b/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts index 87886115932b1..486693706a510 100644 --- a/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts +++ b/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import { Position } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { LanguageIdentifier } from 'vs/editor/common/modes'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { BracketMatchingController } from 'vs/editor/contrib/bracketMatching/bracketMatching'; @@ -31,7 +31,7 @@ suite('bracket matching', () => { test('issue #183: jump to matching bracket position', () => { let mode = new BracketMode(); - let model = TextModel.createFromString('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier()); + let model = createTextModel('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); @@ -63,7 +63,7 @@ suite('bracket matching', () => { test('Jump to next bracket', () => { let mode = new BracketMode(); - let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier()); + let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); @@ -100,7 +100,7 @@ suite('bracket matching', () => { test('Select to next bracket', () => { let mode = new BracketMode(); - let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier()); + let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); @@ -152,7 +152,7 @@ suite('bracket matching', () => { '};', ].join('\n'); const mode = new BracketMode(); - const model = TextModel.createFromString(text, undefined, mode.getLanguageIdentifier()); + const model = createTextModel(text, undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { const bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); @@ -177,7 +177,7 @@ suite('bracket matching', () => { '};', ].join('\n'); const mode = new BracketMode(); - const model = TextModel.createFromString(text, undefined, mode.getLanguageIdentifier()); + const model = createTextModel(text, undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { const bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); @@ -195,7 +195,7 @@ suite('bracket matching', () => { test('issue #45369: Select to Bracket with multicursor', () => { let mode = new BracketMode(); - let model = TextModel.createFromString('{ } { } { }', undefined, mode.getLanguageIdentifier()); + let model = createTextModel('{ } { } { }', undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts index df241dc8643c0..cb106b53b82bf 100644 --- a/src/vs/editor/contrib/clipboard/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/clipboard.ts @@ -77,11 +77,11 @@ class ExecCommandCutAction extends ExecCommandAction { alias: 'Cut', precondition: EditorContextKeys.writable, kbOpts: kbOpts, - menuOpts: { + contextMenuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 1 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '2_ccp', title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), @@ -126,11 +126,11 @@ class ExecCommandCopyAction extends ExecCommandAction { alias: 'Copy', precondition: undefined, kbOpts: kbOpts, - menuOpts: { + contextMenuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 2 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '2_ccp', title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), @@ -175,11 +175,11 @@ class ExecCommandPasteAction extends ExecCommandAction { alias: 'Paste', precondition: EditorContextKeys.writable, kbOpts: kbOpts, - menuOpts: { + contextMenuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 3 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '2_ccp', title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index 2cfc82d83cc24..6f1d102c76f3e 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -3,19 +3,20 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { equals, flatten, isNonEmptyArray, mergeSort } from 'vs/base/common/arrays'; +import { equals, flatten, isNonEmptyArray, mergeSort, coalesce } from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { illegalArgument, isPromiseCanceledError, onUnexpectedExternalError } from 'vs/base/common/errors'; +import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; +import { TextModelCancellationTokenSource } from 'vs/editor/browser/core/editorState'; import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { ITextModel } from 'vs/editor/common/model'; -import { CodeAction, CodeActionContext, CodeActionProviderRegistry, CodeActionTrigger as CodeActionTriggerKind } from 'vs/editor/common/modes'; +import * as modes from 'vs/editor/common/modes'; import { IModelService } from 'vs/editor/common/services/modelService'; import { CodeActionFilter, CodeActionKind, CodeActionTrigger, filtersAction, mayIncludeActionsOfKind } from './types'; -import { TextModelCancellationTokenSource } from 'vs/editor/browser/core/editorState'; -import { DisposableStore, IDisposable, Disposable } from 'vs/base/common/lifecycle'; +import { IProgress, Progress } from 'vs/platform/progress/common/progress'; export const codeActionCommandId = 'editor.action.codeAction'; export const refactorCommandId = 'editor.action.refactor'; @@ -24,13 +25,16 @@ export const organizeImportsCommandId = 'editor.action.organizeImports'; export const fixAllCommandId = 'editor.action.fixAll'; export interface CodeActionSet extends IDisposable { - readonly actions: readonly CodeAction[]; + readonly validActions: readonly modes.CodeAction[]; + readonly allActions: readonly modes.CodeAction[]; readonly hasAutoFix: boolean; + + readonly documentation: readonly modes.Command[]; } class ManagedCodeActionSet extends Disposable implements CodeActionSet { - private static codeActionsComparator(a: CodeAction, b: CodeAction): number { + private static codeActionsComparator(a: modes.CodeAction, b: modes.CodeAction): number { if (isNonEmptyArray(a.diagnostics)) { if (isNonEmptyArray(b.diagnostics)) { return a.diagnostics[0].message.localeCompare(b.diagnostics[0].message); @@ -44,16 +48,22 @@ class ManagedCodeActionSet extends Disposable implements CodeActionSet { } } - public readonly actions: readonly CodeAction[]; + public readonly validActions: readonly modes.CodeAction[]; + public readonly allActions: readonly modes.CodeAction[]; - public constructor(actions: readonly CodeAction[], disposables: DisposableStore) { + public constructor( + actions: readonly modes.CodeAction[], + public readonly documentation: readonly modes.Command[], + disposables: DisposableStore, + ) { super(); this._register(disposables); - this.actions = mergeSort([...actions], ManagedCodeActionSet.codeActionsComparator); + this.allActions = mergeSort([...actions], ManagedCodeActionSet.codeActionsComparator); + this.validActions = this.allActions.filter(action => !action.disabled); } public get hasAutoFix() { - return this.actions.some(fix => !!fix.kind && CodeActionKind.QuickFix.contains(new CodeActionKind(fix.kind)) && !!fix.isPreferred); + return this.validActions.some(fix => !!fix.kind && CodeActionKind.QuickFix.contains(new CodeActionKind(fix.kind)) && !!fix.isPreferred); } } @@ -61,13 +71,14 @@ export function getCodeActions( model: ITextModel, rangeOrSelection: Range | Selection, trigger: CodeActionTrigger, - token: CancellationToken + progress: IProgress, + token: CancellationToken, ): Promise { const filter = trigger.filter || {}; - const codeActionContext: CodeActionContext = { + const codeActionContext: modes.CodeActionContext = { only: filter.include?.value, - trigger: trigger.type === 'manual' ? CodeActionTriggerKind.Manual : CodeActionTriggerKind.Automatic + trigger: trigger.type, }; const cts = new TextModelCancellationTokenSource(model, token); @@ -76,31 +87,40 @@ export function getCodeActions( const disposables = new DisposableStore(); const promises = providers.map(async provider => { try { + progress.report(provider); const providedCodeActions = await provider.provideCodeActions(model, rangeOrSelection, codeActionContext, cts.token); - if (cts.token.isCancellationRequested || !providedCodeActions) { - return []; + if (providedCodeActions) { + disposables.add(providedCodeActions); } - disposables.add(providedCodeActions); - return providedCodeActions.actions.filter(action => action && filtersAction(filter, action)); + + if (cts.token.isCancellationRequested) { + return { actions: [] as modes.CodeAction[], documentation: undefined }; + } + + const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action)); + const documentation = getDocumentation(provider, filteredActions, filter.include); + return { actions: filteredActions, documentation }; } catch (err) { if (isPromiseCanceledError(err)) { throw err; } onUnexpectedExternalError(err); - return []; + return { actions: [] as modes.CodeAction[], documentation: undefined }; } }); - const listener = CodeActionProviderRegistry.onDidChange(() => { - const newProviders = CodeActionProviderRegistry.all(model); + const listener = modes.CodeActionProviderRegistry.onDidChange(() => { + const newProviders = modes.CodeActionProviderRegistry.all(model); if (!equals(newProviders, providers)) { cts.cancel(); } }); - return Promise.all(promises) - .then(flatten) - .then(actions => new ManagedCodeActionSet(actions, disposables)) + return Promise.all(promises).then(actions => { + const allActions = flatten(actions.map(x => x.actions)); + const allDocumentation = coalesce(actions.map(x => x.documentation)); + return new ManagedCodeActionSet(allActions, allDocumentation, disposables); + }) .finally(() => { listener.dispose(); cts.dispose(); @@ -111,7 +131,7 @@ function getCodeActionProviders( model: ITextModel, filter: CodeActionFilter ) { - return CodeActionProviderRegistry.all(model) + return modes.CodeActionProviderRegistry.all(model) // Don't include providers that we know will not return code actions of interest .filter(provider => { if (!provider.providedCodeActionKinds) { @@ -122,7 +142,53 @@ function getCodeActionProviders( }); } -registerLanguageCommand('_executeCodeActionProvider', async function (accessor, args): Promise> { +function getDocumentation( + provider: modes.CodeActionProvider, + providedCodeActions: readonly modes.CodeAction[], + only?: CodeActionKind +): modes.Command | undefined { + if (!provider.documentation) { + return undefined; + } + + const documentation = provider.documentation.map(entry => ({ kind: new CodeActionKind(entry.kind), command: entry.command })); + + if (only) { + let currentBest: { readonly kind: CodeActionKind, readonly command: modes.Command } | undefined; + for (const entry of documentation) { + if (entry.kind.contains(only)) { + if (!currentBest) { + currentBest = entry; + } else { + // Take best match + if (currentBest.kind.contains(entry.kind)) { + currentBest = entry; + } + } + } + } + if (currentBest) { + return currentBest?.command; + } + } + + // Otherwise, check to see if any of the provided actions match. + for (const action of providedCodeActions) { + if (!action.kind) { + continue; + } + + for (const entry of documentation) { + if (entry.kind.contains(new CodeActionKind(action.kind))) { + return entry.command; + } + } + } + + return undefined; +} + +registerLanguageCommand('_executeCodeActionProvider', async function (accessor, args): Promise> { const { resource, rangeOrSelection, kind } = args; if (!(resource instanceof URI)) { throw illegalArgument(); @@ -146,9 +212,10 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor, const codeActionSet = await getCodeActions( model, validatedRangeOrSelection, - { type: 'manual', filter: { includeSourceActions: true, include: kind && kind.value ? new CodeActionKind(kind.value) : undefined } }, + { type: modes.CodeActionTriggerType.Manual, filter: { includeSourceActions: true, include: kind && kind.value ? new CodeActionKind(kind.value) : undefined } }, + Progress.None, CancellationToken.None); setTimeout(() => codeActionSet.dispose(), 100); - return codeActionSet.actions; + return codeActionSet.validActions; }); diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index c555ceec6d6a2..185ebd8686793 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -15,22 +15,21 @@ import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService'; import { IPosition } from 'vs/editor/common/core/position'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; -import { CodeAction } from 'vs/editor/common/modes'; -import { CodeActionSet, refactorCommandId, sourceActionCommandId, codeActionCommandId, organizeImportsCommandId, fixAllCommandId } from 'vs/editor/contrib/codeAction/codeAction'; +import { CodeAction, CodeActionTriggerType } from 'vs/editor/common/modes'; +import { codeActionCommandId, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionUi } from 'vs/editor/contrib/codeAction/codeActionUi'; import { MessageController } from 'vs/editor/contrib/message/messageController'; import * as nls from 'vs/nls'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IMarkerService } from 'vs/platform/markers/common/markers'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IEditorProgressService } from 'vs/platform/progress/common/progress'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { CodeActionModel, CodeActionsState, SUPPORTED_CODE_ACTIONS } from './codeActionModel'; -import { CodeActionAutoApply, CodeActionFilter, CodeActionKind, CodeActionTrigger, CodeActionCommandArgs } from './types'; +import { CodeActionAutoApply, CodeActionCommandArgs, CodeActionFilter, CodeActionKind, CodeActionTrigger } from './types'; function contextKeyForSupportedActions(kind: CodeActionKind) { return ContextKeyExpr.regex( @@ -83,10 +82,6 @@ export class QuickFixController extends Disposable implements IEditorContributio @IMarkerService markerService: IMarkerService, @IContextKeyService contextKeyService: IContextKeyService, @IEditorProgressService progressService: IEditorProgressService, - @IContextMenuService contextMenuService: IContextMenuService, - @IKeybindingService keybindingService: IKeybindingService, - @ICommandService private readonly _commandService: ICommandService, - @IBulkEditService private readonly _bulkEditService: IBulkEditService, @IInstantiationService private readonly _instantiationService: IInstantiationService, ) { super(); @@ -102,11 +97,11 @@ export class QuickFixController extends Disposable implements IEditorContributio await this._applyCodeAction(action); } finally { if (retrigger) { - this._trigger({ type: 'auto', filter: {} }); + this._trigger({ type: CodeActionTriggerType.Auto, filter: {} }); } } } - }, contextMenuService, keybindingService)) + }, this._instantiationService)) ); } @@ -114,8 +109,8 @@ export class QuickFixController extends Disposable implements IEditorContributio this._ui.getValue().update(newState); } - public showCodeActions(actions: CodeActionSet, at: IAnchor | IPosition) { - return this._ui.getValue().showCodeActionList(actions, at); + public showCodeActions(trigger: CodeActionTrigger, actions: CodeActionSet, at: IAnchor | IPosition) { + return this._ui.getValue().showCodeActionList(trigger, actions, at, { includeDisabledActions: false }); } public manualTriggerAtCurrentPosition( @@ -129,7 +124,7 @@ export class QuickFixController extends Disposable implements IEditorContributio MessageController.get(this._editor).closeMessage(); const triggerPosition = this._editor.getPosition(); - this._trigger({ type: 'manual', filter, autoApply, context: { notAvailableMessage, position: triggerPosition } }); + this._trigger({ type: CodeActionTriggerType.Manual, filter, autoApply, context: { notAvailableMessage, position: triggerPosition } }); } private _trigger(trigger: CodeActionTrigger) { @@ -137,21 +132,41 @@ export class QuickFixController extends Disposable implements IEditorContributio } private _applyCodeAction(action: CodeAction): Promise { - return this._instantiationService.invokeFunction(applyCodeAction, action, this._bulkEditService, this._commandService, this._editor); + return this._instantiationService.invokeFunction(applyCodeAction, action, this._editor); } } export async function applyCodeAction( accessor: ServicesAccessor, action: CodeAction, - bulkEditService: IBulkEditService, - commandService: ICommandService, editor?: ICodeEditor, ): Promise { + const bulkEditService = accessor.get(IBulkEditService); + const commandService = accessor.get(ICommandService); + const telemetryService = accessor.get(ITelemetryService); const notificationService = accessor.get(INotificationService); + + type ApplyCodeActionEvent = { + codeActionTitle: string; + codeActionKind: string | undefined; + codeActionIsPreferred: boolean; + }; + type ApplyCodeEventClassification = { + codeActionTitle: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + codeActionKind: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + codeActionIsPreferred: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + }; + + telemetryService.publicLog2('codeAction.applyCodeAction', { + codeActionTitle: action.title, + codeActionKind: action.kind, + codeActionIsPreferred: !!action.isPreferred, + }); + if (action.edit) { await bulkEditService.apply(action.edit, { editor }); } + if (action.command) { try { await commandService.executeCommand(action.command.id, ...(action.command.arguments || [])); @@ -161,7 +176,6 @@ export async function applyCodeAction( typeof message === 'string' ? message : nls.localize('applyCodeActionFailed', "An unknown error occurred while applying the code action")); - } } } @@ -265,7 +279,7 @@ export class RefactorAction extends EditorAction { }, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: '1_modification', order: 2, when: ContextKeyExpr.and( @@ -308,7 +322,7 @@ export class SourceAction extends EditorAction { label: nls.localize('source.label', "Source Action..."), alias: 'Source Action...', precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider), - menuOpts: { + contextMenuOpts: { group: '1_modification', order: 2.1, when: ContextKeyExpr.and( diff --git a/src/vs/editor/contrib/codeAction/codeActionWidget.ts b/src/vs/editor/contrib/codeAction/codeActionMenu.ts similarity index 72% rename from src/vs/editor/contrib/codeAction/codeActionWidget.ts rename to src/vs/editor/contrib/codeAction/codeActionMenu.ts index a40ffdfa45c2a..b736d9c2884e8 100644 --- a/src/vs/editor/contrib/codeAction/codeActionWidget.ts +++ b/src/vs/editor/contrib/codeAction/codeActionMenu.ts @@ -4,8 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { getDomNodePagePosition } from 'vs/base/browser/dom'; +import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { IAnchor } from 'vs/base/browser/ui/contextview/contextview'; -import { Action } from 'vs/base/common/actions'; +import { Action, IAction } from 'vs/base/common/actions'; import { canceled } from 'vs/base/common/errors'; import { ResolvedKeybinding } from 'vs/base/common/keyCodes'; import { Lazy } from 'vs/base/common/lazy'; @@ -13,9 +14,9 @@ import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IPosition, Position } from 'vs/editor/common/core/position'; import { ScrollType } from 'vs/editor/common/editorCommon'; -import { CodeAction } from 'vs/editor/common/modes'; -import { CodeActionSet, refactorCommandId, sourceActionCommandId, codeActionCommandId, organizeImportsCommandId, fixAllCommandId } from 'vs/editor/contrib/codeAction/codeAction'; -import { CodeActionAutoApply, CodeActionCommandArgs, CodeActionKind } from 'vs/editor/contrib/codeAction/types'; +import { CodeAction, CodeActionProviderRegistry, Command } from 'vs/editor/common/modes'; +import { codeActionCommandId, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; +import { CodeActionAutoApply, CodeActionCommandArgs, CodeActionTrigger, CodeActionKind } from 'vs/editor/contrib/codeAction/types'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; @@ -35,11 +36,15 @@ class CodeActionAction extends Action { public readonly action: CodeAction, callback: () => Promise, ) { - super(action.command ? action.command.id : action.title, action.title, undefined, true, callback); + super(action.command ? action.command.id : action.title, action.title, undefined, !action.disabled, callback); } } -export class CodeActionWidget extends Disposable { +export interface CodeActionShowOptions { + readonly includeDisabledActions: boolean; +} + +export class CodeActionMenu extends Disposable { private _visible: boolean = false; private readonly _showingActions = this._register(new MutableDisposable()); @@ -48,9 +53,9 @@ export class CodeActionWidget extends Disposable { constructor( private readonly _editor: ICodeEditor, - private readonly _contextMenuService: IContextMenuService, - keybindingService: IKeybindingService, private readonly _delegate: CodeActionWidgetDelegate, + @IContextMenuService private readonly _contextMenuService: IContextMenuService, + @IKeybindingService keybindingService: IKeybindingService, ) { super(); @@ -63,8 +68,9 @@ export class CodeActionWidget extends Disposable { return this._visible; } - public async show(codeActions: CodeActionSet, at: IAnchor | IPosition): Promise { - if (!codeActions.actions.length) { + public async show(trigger: CodeActionTrigger, codeActions: CodeActionSet, at: IAnchor | IPosition, options: CodeActionShowOptions): Promise { + const actionsToShow = options.includeDisabledActions ? codeActions.allActions : codeActions.validActions; + if (!actionsToShow.length) { this._visible = false; return; } @@ -78,15 +84,14 @@ export class CodeActionWidget extends Disposable { this._visible = true; this._showingActions.value = codeActions; - const actions = codeActions.actions.map(action => - new CodeActionAction(action, () => this._delegate.onSelectCodeAction(action))); + const menuActions = this.getMenuActions(trigger, actionsToShow, codeActions.documentation); const anchor = Position.isIPosition(at) ? this._toCoords(at) : at || { x: 0, y: 0 }; const resolver = this._keybindingResolver.getResolver(); this._contextMenuService.showContextMenu({ getAnchor: () => anchor, - getActions: () => actions, + getActions: () => menuActions, onHide: () => { this._visible = false; this._editor.focus(); @@ -96,6 +101,37 @@ export class CodeActionWidget extends Disposable { }); } + private getMenuActions( + trigger: CodeActionTrigger, + actionsToShow: readonly CodeAction[], + documentation: readonly Command[] + ): IAction[] { + const toCodeActionAction = (action: CodeAction): CodeActionAction => new CodeActionAction(action, () => this._delegate.onSelectCodeAction(action)); + + const result: IAction[] = actionsToShow + .map(toCodeActionAction); + + const allDocumentation: Command[] = [...documentation]; + + const model = this._editor.getModel(); + if (model && result.length) { + for (const provider of CodeActionProviderRegistry.all(model)) { + if (provider._getAdditionalMenuItems) { + allDocumentation.push(...provider._getAdditionalMenuItems({ trigger: trigger.type, only: trigger.filter?.include?.value }, actionsToShow)); + } + } + } + + if (allDocumentation.length) { + result.push(new Separator(), ...allDocumentation.map(command => toCodeActionAction({ + title: command.title, + command: command, + }))); + } + + return result; + } + private _toCoords(position: IPosition): { x: number, y: number } { if (!this._editor.hasModel()) { return { x: 0, y: 0 }; diff --git a/src/vs/editor/contrib/codeAction/codeActionModel.ts b/src/vs/editor/contrib/codeAction/codeActionModel.ts index 39faf3722d13c..fc35f1398ed28 100644 --- a/src/vs/editor/contrib/codeAction/codeActionModel.ts +++ b/src/vs/editor/contrib/codeAction/codeActionModel.ts @@ -11,10 +11,10 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import { CodeActionProviderRegistry } from 'vs/editor/common/modes'; +import { CodeActionProviderRegistry, CodeActionTriggerType } from 'vs/editor/common/modes'; import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IMarkerService } from 'vs/platform/markers/common/markers'; -import { IEditorProgressService } from 'vs/platform/progress/common/progress'; +import { IEditorProgressService, Progress } from 'vs/platform/progress/common/progress'; import { getCodeActions, CodeActionSet } from './codeAction'; import { CodeActionTrigger } from './types'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; @@ -56,14 +56,14 @@ class CodeActionOracle extends Disposable { if (resources.some(resource => isEqual(resource, model.uri))) { this._autoTriggerTimer.cancelAndSet(() => { - this.trigger({ type: 'auto' }); + this.trigger({ type: CodeActionTriggerType.Auto }); }, this._delay); } } private _onCursorChange(): void { this._autoTriggerTimer.cancelAndSet(() => { - this.trigger({ type: 'auto' }); + this.trigger({ type: CodeActionTriggerType.Auto }); }, this._delay); } @@ -73,8 +73,9 @@ class CodeActionOracle extends Disposable { return undefined; } for (const marker of this._markerService.read({ resource: model.uri })) { - if (Range.intersectRanges(marker, selection)) { - return Range.lift(marker); + const markerRange = model.validateRange(marker); + if (Range.intersectRanges(markerRange, selection)) { + return Range.lift(markerRange); } } @@ -87,7 +88,7 @@ class CodeActionOracle extends Disposable { } const model = this._editor.getModel(); const selection = this._editor.getSelection(); - if (selection.isEmpty() && trigger.type === 'auto') { + if (selection.isEmpty() && trigger.type === CodeActionTriggerType.Auto) { const { lineNumber, column } = selection.getPosition(); const line = model.getLineContent(lineNumber); if (line.length === 0) { @@ -212,15 +213,15 @@ export class CodeActionModel extends Disposable { return; } - const actions = createCancelablePromise(token => getCodeActions(model, trigger.selection, trigger.trigger, token)); - if (this._progressService && trigger.trigger.type === 'manual') { + const actions = createCancelablePromise(token => getCodeActions(model, trigger.selection, trigger.trigger, Progress.None, token)); + if (this._progressService && trigger.trigger.type === CodeActionTriggerType.Manual) { this._progressService.showWhile(actions, 250); } this.setState(new CodeActionsState.Triggered(trigger.trigger, trigger.selection, trigger.position, actions)); }, undefined); - this._codeActionOracle.value.trigger({ type: 'auto' }); + this._codeActionOracle.value.trigger({ type: CodeActionTriggerType.Auto }); } else { this._supportedCodeActions.reset(); } diff --git a/src/vs/editor/contrib/codeAction/codeActionUi.ts b/src/vs/editor/contrib/codeAction/codeActionUi.ts index 5dfd9228ff0bc..7d2aeff74f3b3 100644 --- a/src/vs/editor/contrib/codeAction/codeActionUi.ts +++ b/src/vs/editor/contrib/codeAction/codeActionUi.ts @@ -3,25 +3,25 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { IAnchor } from 'vs/base/browser/ui/contextview/contextview'; +import { find } from 'vs/base/common/arrays'; import { onUnexpectedError } from 'vs/base/common/errors'; +import { Lazy } from 'vs/base/common/lazy'; import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { CodeAction } from 'vs/editor/common/modes'; +import { IPosition } from 'vs/editor/common/core/position'; +import { CodeAction, CodeActionTriggerType } from 'vs/editor/common/modes'; import { CodeActionSet } from 'vs/editor/contrib/codeAction/codeAction'; import { MessageController } from 'vs/editor/contrib/message/messageController'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { CodeActionMenu, CodeActionShowOptions } from './codeActionMenu'; import { CodeActionsState } from './codeActionModel'; -import { CodeActionAutoApply } from './types'; -import { CodeActionWidget } from './codeActionWidget'; import { LightBulbWidget } from './lightBulbWidget'; -import { IPosition } from 'vs/editor/common/core/position'; -import { IAnchor } from 'vs/base/browser/ui/contextview/contextview'; -import { Lazy } from 'vs/base/common/lazy'; +import { CodeActionAutoApply, CodeActionTrigger } from './types'; export class CodeActionUi extends Disposable { - private readonly _codeActionWidget: Lazy; + private readonly _codeActionWidget: Lazy; private readonly _lightBulbWidget: Lazy; private readonly _activeCodeActions = this._register(new MutableDisposable()); @@ -32,13 +32,12 @@ export class CodeActionUi extends Disposable { private readonly delegate: { applyCodeAction: (action: CodeAction, regtriggerAfterApply: boolean) => Promise }, - @IContextMenuService contextMenuService: IContextMenuService, - @IKeybindingService keybindingService: IKeybindingService, + @IInstantiationService instantiationService: IInstantiationService, ) { super(); this._codeActionWidget = new Lazy(() => { - return this._register(new CodeActionWidget(this._editor, contextMenuService, keybindingService, { + return this._register(instantiationService.createInstance(CodeActionMenu, this._editor, { onSelectCodeAction: async (action) => { this.delegate.applyCodeAction(action, /* retrigger */ true); } @@ -46,8 +45,8 @@ export class CodeActionUi extends Disposable { }); this._lightBulbWidget = new Lazy(() => { - const widget = this._register(new LightBulbWidget(this._editor, quickFixActionId, preferredFixActionId, keybindingService)); - this._register(widget.onClick(e => this.showCodeActionList(e.actions, e))); + const widget = this._register(instantiationService.createInstance(LightBulbWidget, this._editor, quickFixActionId, preferredFixActionId)); + this._register(widget.onClick(e => this.showCodeActionList(e.trigger, e.actions, e, { includeDisabledActions: false }))); return widget; }); } @@ -66,31 +65,45 @@ export class CodeActionUi extends Disposable { return; } - this._lightBulbWidget.getValue().update(actions, newState.position); + this._lightBulbWidget.getValue().update(actions, newState.trigger, newState.position); - if (!actions.actions.length && newState.trigger.context) { - MessageController.get(this._editor).showMessage(newState.trigger.context.notAvailableMessage, newState.trigger.context.position); - this._activeCodeActions.value = actions; - return; - } + if (newState.trigger.type === CodeActionTriggerType.Manual) { + if (newState.trigger.filter?.include) { // Triggered for specific scope + // Check to see if we want to auto apply. - if (newState.trigger.type === 'manual') { - if (newState.trigger.filter && newState.trigger.filter.include) { - // Triggered for specific scope - if (actions.actions.length > 0) { - // Apply if we only have one action or requested autoApply - if (newState.trigger.autoApply === CodeActionAutoApply.First || (newState.trigger.autoApply === CodeActionAutoApply.IfSingle && actions.actions.length === 1)) { - try { - await this.delegate.applyCodeAction(actions.actions[0], false); - } finally { - actions.dispose(); - } + const validActionToApply = this.tryGetValidActionToApply(newState.trigger, actions); + if (validActionToApply) { + try { + await this.delegate.applyCodeAction(validActionToApply, false); + } finally { + actions.dispose(); + } + return; + } + + // Check to see if there is an action that we would have applied were it not invalid + if (newState.trigger.context) { + const invalidAction = this.getInvalidActionThatWouldHaveBeenApplied(newState.trigger, actions); + if (invalidAction && invalidAction.disabled) { + MessageController.get(this._editor).showMessage(invalidAction.disabled, newState.trigger.context.position); + actions.dispose(); return; } } } + + const includeDisabledActions = !!newState.trigger.filter?.include; + if (newState.trigger.context) { + if (!actions.allActions.length || !includeDisabledActions && !actions.validActions.length) { + MessageController.get(this._editor).showMessage(newState.trigger.context.notAvailableMessage, newState.trigger.context.position); + this._activeCodeActions.value = actions; + actions.dispose(); + return; + } + } + this._activeCodeActions.value = actions; - this._codeActionWidget.getValue().show(actions, newState.position); + this._codeActionWidget.getValue().show(newState.trigger, actions, newState.position, { includeDisabledActions }); } else { // auto magically triggered if (this._codeActionWidget.getValue().isVisible) { @@ -102,7 +115,35 @@ export class CodeActionUi extends Disposable { } } - public async showCodeActionList(actions: CodeActionSet, at: IAnchor | IPosition): Promise { - this._codeActionWidget.getValue().show(actions, at); + private getInvalidActionThatWouldHaveBeenApplied(trigger: CodeActionTrigger, actions: CodeActionSet): CodeAction | undefined { + if (!actions.allActions.length) { + return undefined; + } + + if ((trigger.autoApply === CodeActionAutoApply.First && actions.validActions.length === 0) + || (trigger.autoApply === CodeActionAutoApply.IfSingle && actions.allActions.length === 1) + ) { + return find(actions.allActions, action => action.disabled); + } + + return undefined; + } + + private tryGetValidActionToApply(trigger: CodeActionTrigger, actions: CodeActionSet): CodeAction | undefined { + if (!actions.validActions.length) { + return undefined; + } + + if ((trigger.autoApply === CodeActionAutoApply.First && actions.validActions.length > 0) + || (trigger.autoApply === CodeActionAutoApply.IfSingle && actions.validActions.length === 1) + ) { + return actions.validActions[0]; + } + + return undefined; + } + + public async showCodeActionList(trigger: CodeActionTrigger, actions: CodeActionSet, at: IAnchor | IPosition, options: CodeActionShowOptions): Promise { + this._codeActionWidget.getValue().show(trigger, actions, at, options); } } diff --git a/src/vs/editor/contrib/codeAction/lightBulbWidget.ts b/src/vs/editor/contrib/codeAction/lightBulbWidget.ts index 0fc03b3a8ba4c..0471220115103 100644 --- a/src/vs/editor/contrib/codeAction/lightBulbWidget.ts +++ b/src/vs/editor/contrib/codeAction/lightBulbWidget.ts @@ -17,6 +17,8 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { editorLightBulbForeground, editorLightBulbAutoFixForeground } from 'vs/platform/theme/common/colorRegistry'; +import { Gesture } from 'vs/base/browser/touch'; +import type { CodeActionTrigger } from 'vs/editor/contrib/codeAction/types'; namespace LightBulbState { @@ -32,6 +34,7 @@ namespace LightBulbState { constructor( public readonly actions: CodeActionSet, + public readonly trigger: CodeActionTrigger, public readonly editorPosition: IPosition, public readonly widgetPosition: IContentWidgetPosition, ) { } @@ -47,7 +50,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget { private readonly _domNode: HTMLDivElement; - private readonly _onClick = this._register(new Emitter<{ x: number; y: number; actions: CodeActionSet; }>()); + private readonly _onClick = this._register(new Emitter<{ x: number; y: number; actions: CodeActionSet; trigger: CodeActionTrigger }>()); public readonly onClick = this._onClick.event; private _state: LightBulbState.State = LightBulbState.Hidden; @@ -71,7 +74,9 @@ export class LightBulbWidget extends Disposable implements IContentWidget { this.hide(); } })); - this._register(dom.addStandardDisposableListener(this._domNode, 'mousedown', e => { + + Gesture.ignoreTarget(this._domNode); + this._register(dom.addStandardDisposableGenericMouseDownListner(this._domNode, e => { if (this.state.type !== LightBulbState.Type.Showing) { return; } @@ -92,7 +97,8 @@ export class LightBulbWidget extends Disposable implements IContentWidget { this._onClick.fire({ x: e.posx, y: top + height + pad, - actions: this.state.actions + actions: this.state.actions, + trigger: this.state.trigger, }); })); this._register(dom.addDisposableListener(this._domNode, 'mouseenter', (e: MouseEvent) => { @@ -104,7 +110,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget { // showings until mouse is released this.hide(); const monitor = new GlobalMouseMoveMonitor(); - monitor.startMonitoring(standardMouseMoveMerger, () => { }, () => { + monitor.startMonitoring(e.target, e.buttons, standardMouseMoveMerger, () => { }, () => { monitor.dispose(); }); })); @@ -136,8 +142,8 @@ export class LightBulbWidget extends Disposable implements IContentWidget { return this._state.type === LightBulbState.Type.Showing ? this._state.widgetPosition : null; } - public update(actions: CodeActionSet, atPosition: IPosition) { - if (actions.actions.length <= 0) { + public update(actions: CodeActionSet, trigger: CodeActionTrigger, atPosition: IPosition) { + if (actions.validActions.length <= 0) { return this.hide(); } @@ -174,7 +180,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget { } } - this.state = new LightBulbState.Showing(actions, atPosition, { + this.state = new LightBulbState.Showing(actions, trigger, atPosition, { position: { lineNumber: effectiveLineNumber, column: 1 }, preference: LightBulbWidget._posPref }); @@ -222,8 +228,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { const editorLightBulbForegroundColor = theme.getColor(editorLightBulbForeground); if (editorLightBulbForegroundColor) { collector.addRule(` - .monaco-workbench .contentWidgets .codicon-lightbulb, - .monaco-workbench .markers-panel-container .codicon-lightbulb { + .monaco-editor .contentWidgets .codicon-lightbulb { color: ${editorLightBulbForegroundColor}; }`); } @@ -232,8 +237,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { const editorLightBulbAutoFixForegroundColor = theme.getColor(editorLightBulbAutoFixForeground); if (editorLightBulbAutoFixForegroundColor) { collector.addRule(` - .monaco-workbench .contentWidgets .codicon-lightbulb-autofix, - .monaco-workbench .markers-panel-container .codicon-lightbulb-autofix { + .monaco-editor .contentWidgets .codicon-lightbulb-autofix { color: ${editorLightBulbAutoFixForegroundColor}; }`); } diff --git a/src/vs/editor/contrib/codeAction/test/codeAction.test.ts b/src/vs/editor/contrib/codeAction/test/codeAction.test.ts index 730d96fc9a570..85510ab2a01c3 100644 --- a/src/vs/editor/contrib/codeAction/test/codeAction.test.ts +++ b/src/vs/editor/contrib/codeAction/test/codeAction.test.ts @@ -12,6 +12,8 @@ import { getCodeActions } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionKind } from 'vs/editor/contrib/codeAction/types'; import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { Progress } from 'vs/platform/progress/common/progress'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; function staticCodeActionProvider(...actions: modes.CodeAction[]): modes.CodeActionProvider { return new class implements modes.CodeActionProvider { @@ -69,7 +71,7 @@ suite('CodeAction', () => { bcd: { diagnostics: [], edit: new class implements modes.WorkspaceEdit { - edits!: modes.ResourceTextEdit[]; + edits!: modes.WorkspaceTextEdit[]; }, title: 'abc' } @@ -92,7 +94,7 @@ suite('CodeAction', () => { setup(function () { disposables.clear(); - model = TextModel.createFromString('test1\ntest2\ntest3', undefined, langId, uri); + model = createTextModel('test1\ntest2\ntest3', undefined, langId, uri); disposables.add(model); }); @@ -125,7 +127,7 @@ suite('CodeAction', () => { testData.tsLint.abc ]; - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'manual' }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None); assert.equal(actions.length, 6); assert.deepEqual(actions, expected); }); @@ -140,20 +142,20 @@ suite('CodeAction', () => { disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider)); { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a') } }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 2); assert.strictEqual(actions[0].title, 'a'); assert.strictEqual(actions[1].title, 'a.b'); } { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a.b') } }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); assert.strictEqual(actions[0].title, 'a.b'); } { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a.b.c') } }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b.c') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 0); } }); @@ -172,7 +174,7 @@ suite('CodeAction', () => { disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider)); - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a') } }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); assert.strictEqual(actions[0].title, 'a'); }); @@ -186,13 +188,13 @@ suite('CodeAction', () => { disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider)); { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto' }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); assert.strictEqual(actions[0].title, 'b'); } { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: CodeActionKind.Source, includeSourceActions: true } }, CancellationToken.None); + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.Source, includeSourceActions: true } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); assert.strictEqual(actions[0].title, 'a'); } @@ -208,18 +210,55 @@ suite('CodeAction', () => { disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider)); { - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { - type: 'auto', filter: { + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { + type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.Source.append('test'), excludes: [CodeActionKind.Source], includeSourceActions: true, } - }, CancellationToken.None); + }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); assert.strictEqual(actions[0].title, 'b'); } }); + test('getCodeActions no invoke a provider that has been excluded #84602', async function () { + const baseType = CodeActionKind.Refactor; + const subType = CodeActionKind.Refactor.append('sub'); + + disposables.add(modes.CodeActionProviderRegistry.register('fooLang', staticCodeActionProvider( + { title: 'a', kind: baseType.value } + ))); + + let didInvoke = false; + disposables.add(modes.CodeActionProviderRegistry.register('fooLang', new class implements modes.CodeActionProvider { + + providedCodeActionKinds = [subType.value]; + + provideCodeActions(): modes.ProviderResult { + didInvoke = true; + return { + actions: [ + { title: 'x', kind: subType.value } + ], + dispose: () => { } + }; + } + })); + + { + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { + type: modes.CodeActionTriggerType.Auto, filter: { + include: baseType, + excludes: [subType], + } + }, Progress.None, CancellationToken.None); + assert.strictEqual(didInvoke, false); + assert.equal(actions.length, 1); + assert.strictEqual(actions[0].title, 'a'); + } + }); + test('getCodeActions should not invoke code action providers filtered out by providedCodeActionKinds', async function () { let wasInvoked = false; const provider = new class implements modes.CodeActionProvider { @@ -233,12 +272,12 @@ suite('CodeAction', () => { disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider)); - const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { - type: 'auto', + const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { + type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.QuickFix } - }, CancellationToken.None); + }, Progress.None, CancellationToken.None); assert.strictEqual(actions.length, 0); assert.strictEqual(wasInvoked, false); }); diff --git a/src/vs/editor/contrib/codeAction/test/codeActionKeybindingResolver.test.ts b/src/vs/editor/contrib/codeAction/test/codeActionKeybindingResolver.test.ts index 44314a908605c..9a939303ece52 100644 --- a/src/vs/editor/contrib/codeAction/test/codeActionKeybindingResolver.test.ts +++ b/src/vs/editor/contrib/codeAction/test/codeActionKeybindingResolver.test.ts @@ -8,7 +8,7 @@ import { ChordKeybinding, KeyCode, SimpleKeybinding } from 'vs/base/common/keyCo import { OperatingSystem } from 'vs/base/common/platform'; import { refactorCommandId, organizeImportsCommandId } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionKind } from 'vs/editor/contrib/codeAction/types'; -import { CodeActionKeybindingResolver } from 'vs/editor/contrib/codeAction/codeActionWidget'; +import { CodeActionKeybindingResolver } from 'vs/editor/contrib/codeAction/codeActionMenu'; import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding'; diff --git a/src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts b/src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts index c2ef449356292..5edcc7ae851cc 100644 --- a/src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts +++ b/src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts @@ -5,6 +5,7 @@ import * as assert from 'assert'; import { DisposableStore } from 'vs/base/common/lifecycle'; +import { assertType } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Selection } from 'vs/editor/common/core/selection'; @@ -14,6 +15,7 @@ import { CodeActionModel, CodeActionsState } from 'vs/editor/contrib/codeAction/ import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; import { MarkerService } from 'vs/platform/markers/common/markerService'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; const testProvider = { provideCodeActions(): modes.CodeActionList { @@ -37,7 +39,7 @@ suite('CodeActionModel', () => { setup(() => { disposables.clear(); markerService = new MarkerService(); - model = TextModel.createFromString('foobar foo bar\nfarboo far boo', undefined, languageIdentifier, uri); + model = createTextModel('foobar foo bar\nfarboo far boo', undefined, languageIdentifier, uri); editor = createTestCodeEditor({ model: model }); editor.setPosition({ lineNumber: 1, column: 1 }); }); @@ -55,13 +57,15 @@ suite('CodeActionModel', () => { const contextKeys = new MockContextKeyService(); const model = disposables.add(new CodeActionModel(editor, markerService, contextKeys, undefined)); - disposables.add(model.onDidChangeState((e: CodeActionsState.Triggered) => { - assert.equal(e.trigger.type, 'auto'); + disposables.add(model.onDidChangeState((e: CodeActionsState.State) => { + assertType(e.type === CodeActionsState.Type.Triggered); + + assert.strictEqual(e.trigger.type, modes.CodeActionTriggerType.Auto); assert.ok(e.actions); e.actions.then(fixes => { model.dispose(); - assert.equal(fixes.actions.length, 1); + assert.equal(fixes.validActions.length, 1); done(); }, done); })); @@ -94,12 +98,14 @@ suite('CodeActionModel', () => { return new Promise((resolve, reject) => { const contextKeys = new MockContextKeyService(); const model = disposables.add(new CodeActionModel(editor, markerService, contextKeys, undefined)); - disposables.add(model.onDidChangeState((e: CodeActionsState.Triggered) => { - assert.equal(e.trigger.type, 'auto'); + disposables.add(model.onDidChangeState((e: CodeActionsState.State) => { + assertType(e.type === CodeActionsState.Type.Triggered); + + assert.equal(e.trigger.type, modes.CodeActionTriggerType.Auto); assert.ok(e.actions); e.actions.then(fixes => { model.dispose(); - assert.equal(fixes.actions.length, 1); + assert.equal(fixes.validActions.length, 1); resolve(undefined); }, reject); })); @@ -130,8 +136,10 @@ suite('CodeActionModel', () => { await new Promise(resolve => { const contextKeys = new MockContextKeyService(); const model = disposables.add(new CodeActionModel(editor, markerService, contextKeys, undefined)); - disposables.add(model.onDidChangeState((e: CodeActionsState.Triggered) => { - assert.equal(e.trigger.type, 'auto'); + disposables.add(model.onDidChangeState((e: CodeActionsState.State) => { + assertType(e.type === CodeActionsState.Type.Triggered); + + assert.equal(e.trigger.type, modes.CodeActionTriggerType.Auto); const selection = e.rangeOrSelection; assert.deepEqual(selection.selectionStartLineNumber, 1); assert.deepEqual(selection.selectionStartColumn, 1); @@ -153,8 +161,10 @@ suite('CodeActionModel', () => { let triggerCount = 0; const contextKeys = new MockContextKeyService(); const model = disposables.add(new CodeActionModel(editor, markerService, contextKeys, undefined)); - disposables.add(model.onDidChangeState((e: CodeActionsState.Triggered) => { - assert.equal(e.trigger.type, 'auto'); + disposables.add(model.onDidChangeState((e: CodeActionsState.State) => { + assertType(e.type === CodeActionsState.Type.Triggered); + + assert.equal(e.trigger.type, modes.CodeActionTriggerType.Auto); ++triggerCount; // give time for second trigger before completing test diff --git a/src/vs/editor/contrib/codeAction/types.ts b/src/vs/editor/contrib/codeAction/types.ts index 650be89e98c72..b8f8c5e741e84 100644 --- a/src/vs/editor/contrib/codeAction/types.ts +++ b/src/vs/editor/contrib/codeAction/types.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { startsWith } from 'vs/base/common/strings'; -import { CodeAction } from 'vs/editor/common/modes'; +import { CodeAction, CodeActionTriggerType } from 'vs/editor/common/modes'; import { Position } from 'vs/editor/common/core/position'; export class CodeActionKind { @@ -58,6 +58,12 @@ export function mayIncludeActionsOfKind(filter: CodeActionFilter, providedKind: return false; } + if (filter.excludes) { + if (filter.excludes.some(exclude => excludesAction(providedKind, exclude, filter.include))) { + return false; + } + } + // Don't return source actions unless they are explicitly requested if (!filter.includeSourceActions && CodeActionKind.Source.contains(providedKind)) { return false; @@ -77,10 +83,7 @@ export function filtersAction(filter: CodeActionFilter, action: CodeAction): boo } if (filter.excludes) { - if (actionKind && filter.excludes.some(exclude => { - // Excludes are overwritten by includes - return exclude.contains(actionKind) && (!filter.include || !filter.include.contains(actionKind)); - })) { + if (actionKind && filter.excludes.some(exclude => excludesAction(actionKind, exclude, filter.include))) { return false; } } @@ -101,8 +104,19 @@ export function filtersAction(filter: CodeActionFilter, action: CodeAction): boo return true; } +function excludesAction(providedKind: CodeActionKind, exclude: CodeActionKind, include: CodeActionKind | undefined): boolean { + if (!exclude.contains(providedKind)) { + return false; + } + if (include && exclude.contains(include)) { + // The include is more specific, don't filter out + return false; + } + return true; +} + export interface CodeActionTrigger { - readonly type: 'auto' | 'manual'; + readonly type: CodeActionTriggerType; readonly filter?: CodeActionFilter; readonly autoApply?: CodeActionAutoApply; readonly context?: { diff --git a/src/vs/editor/contrib/codelens/codelensController.ts b/src/vs/editor/contrib/codelens/codelensController.ts index e61b9acafb18e..2b4865134c38e 100644 --- a/src/vs/editor/contrib/codelens/codelensController.ts +++ b/src/vs/editor/contrib/codelens/codelensController.ts @@ -7,9 +7,9 @@ import { CancelablePromise, RunOnceScheduler, createCancelablePromise, disposabl import { onUnexpectedError, onUnexpectedExternalError } from 'vs/base/common/errors'; import { toDisposable, DisposableStore, dispose } from 'vs/base/common/lifecycle'; import { StableEditorScrollState } from 'vs/editor/browser/core/editorState'; -import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { ICodeEditor, MouseTargetType, IViewZoneChangeAccessor, IActiveCodeEditor } from 'vs/editor/browser/editorBrowser'; import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { IModelDecorationsChangeAccessor } from 'vs/editor/common/model'; import { CodeLensProviderRegistry, CodeLens } from 'vs/editor/common/modes'; import { CodeLensModel, getCodeLensData, CodeLensItem } from 'vs/editor/contrib/codelens/codelens'; @@ -18,8 +18,10 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { ICodeLensCache } from 'vs/editor/contrib/codelens/codeLensCache'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import * as dom from 'vs/base/browser/dom'; +import { hash } from 'vs/base/common/hash'; -export class CodeLensContribution implements editorCommon.IEditorContribution { +export class CodeLensContribution implements IEditorContribution { public static readonly ID: string = 'css.editor.codeLens'; @@ -27,6 +29,8 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { private readonly _globalToDispose = new DisposableStore(); private readonly _localToDispose = new DisposableStore(); + private readonly _styleElement: HTMLStyleElement; + private readonly _styleClassName: string; private _lenses: CodeLensWidget[] = []; private _currentFindCodeLensSymbolsPromise: CancelablePromise | undefined; private _oldCodeLensModels = new DisposableStore(); @@ -36,7 +40,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { private _detectVisibleLenses: RunOnceScheduler | undefined; constructor( - private readonly _editor: editorBrowser.ICodeEditor, + private readonly _editor: ICodeEditor, @ICommandService private readonly _commandService: ICommandService, @INotificationService private readonly _notificationService: INotificationService, @ICodeLensCache private readonly _codeLensCache: ICodeLensCache @@ -53,7 +57,20 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { } })); this._globalToDispose.add(CodeLensProviderRegistry.onDidChange(this._onModelChange, this)); + this._globalToDispose.add(this._editor.onDidChangeConfiguration(e => { + if (e.hasChanged(EditorOption.fontInfo)) { + this._updateLensStyle(); + } + })); this._onModelChange(); + + this._styleClassName = hash(this._editor.getId()).toString(16); + this._styleElement = dom.createStyleSheet( + dom.isInShadowDOM(this._editor.getContainerDomNode()) + ? this._editor.getContainerDomNode() + : undefined + ); + this._updateLensStyle(); } dispose(): void { @@ -63,6 +80,21 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { dispose(this._currentCodeLensModel); } + private _updateLensStyle(): void { + const options = this._editor.getOptions(); + const fontInfo = options.get(EditorOption.fontInfo); + const lineHeight = options.get(EditorOption.lineHeight); + + + const height = Math.round(lineHeight * 1.1); + const fontSize = Math.round(fontInfo.fontSize * 0.9); + const newStyle = ` + .monaco-editor .codelens-decoration.${this._styleClassName} { height: ${height}px; line-height: ${lineHeight}px; font-size: ${fontSize}px; padding-right: ${Math.round(fontInfo.fontSize * 0.45)}px;} + .monaco-editor .codelens-decoration.${this._styleClassName} > a > .codicon { line-height: ${lineHeight}px; font-size: ${fontSize}px; } + `; + this._styleElement.innerHTML = newStyle; + } + private _localDispose(): void { if (this._currentFindCodeLensSymbolsPromise) { this._currentFindCodeLensSymbolsPromise.cancel(); @@ -200,17 +232,17 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { this._disposeAllLenses(undefined, undefined); } })); - this._localToDispose.add(this._editor.onDidChangeConfiguration(e => { - if (e.hasChanged(EditorOption.fontInfo)) { - for (const lens of this._lenses) { - lens.updateHeight(); - } - } - })); this._localToDispose.add(this._editor.onMouseUp(e => { - if (e.target.type === editorBrowser.MouseTargetType.CONTENT_WIDGET && e.target.element && e.target.element.tagName === 'A') { + if (e.target.type !== MouseTargetType.CONTENT_WIDGET) { + return; + } + let target = e.target.element; + if (target?.tagName === 'SPAN') { + target = target.parentElement; + } + if (target?.tagName === 'A') { for (const lens of this._lenses) { - let command = lens.getCommand(e.target.element as HTMLLinkElement); + let command = lens.getCommand(target as HTMLLinkElement); if (command) { this._commandService.executeCommand(command.id, ...(command.arguments || [])).catch(err => this._notificationService.error(err)); break; @@ -221,9 +253,11 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { scheduler.schedule(); } - private _disposeAllLenses(decChangeAccessor: IModelDecorationsChangeAccessor | undefined, viewZoneChangeAccessor: editorBrowser.IViewZoneChangeAccessor | undefined): void { - let helper = new CodeLensHelper(); - this._lenses.forEach((lens) => lens.dispose(helper, viewZoneChangeAccessor)); + private _disposeAllLenses(decChangeAccessor: IModelDecorationsChangeAccessor | undefined, viewZoneChangeAccessor: IViewZoneChangeAccessor | undefined): void { + const helper = new CodeLensHelper(); + for (const lens of this._lenses) { + lens.dispose(helper, viewZoneChangeAccessor); + } if (decChangeAccessor) { helper.commit(decChangeAccessor); } @@ -276,7 +310,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { groupsIndex++; codeLensIndex++; } else { - this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); + this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); codeLensIndex++; groupsIndex++; } @@ -290,7 +324,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { // Create extra symbols while (groupsIndex < groups.length) { - this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); + this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule())); groupsIndex++; } @@ -343,7 +377,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { }); return Promise.all(promises).then(() => { - if (!token.isCancellationRequested) { + if (!token.isCancellationRequested && !lenses[i].isDisposed()) { lenses[i].updateCommands(resolvedSymbols); } }); diff --git a/src/vs/editor/contrib/codelens/codelensWidget.css b/src/vs/editor/contrib/codelens/codelensWidget.css index e266cf8b6a826..7bd66d08fd825 100644 --- a/src/vs/editor/contrib/codelens/codelensWidget.css +++ b/src/vs/editor/contrib/codelens/codelensWidget.css @@ -23,12 +23,16 @@ } .monaco-editor .codelens-decoration > a:hover { - text-decoration: underline; cursor: pointer; } -.monaco-editor .codelens-decoration.invisible-cl { - opacity: 0; +.monaco-editor .codelens-decoration .codicon { + vertical-align: middle; + color: currentColor !important; +} + +.monaco-editor .codelens-decoration > a:hover .codicon::before { + cursor: pointer; } @keyframes fadein { diff --git a/src/vs/editor/contrib/codelens/codelensWidget.ts b/src/vs/editor/contrib/codelens/codelensWidget.ts index c048a6f15410c..622e7785aaf33 100644 --- a/src/vs/editor/contrib/codelens/codelensWidget.ts +++ b/src/vs/editor/contrib/codelens/codelensWidget.ts @@ -5,9 +5,9 @@ import 'vs/css!./codelensWidget'; import * as dom from 'vs/base/browser/dom'; -import { coalesce, isFalsyOrEmpty } from 'vs/base/common/arrays'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; -import * as editorBrowser from 'vs/editor/browser/editorBrowser'; +import { renderCodicons } from 'vs/base/common/codicons'; +import { escape } from 'vs/base/common/strings'; +import { IViewZone, IContentWidget, IActiveCodeEditor, IContentWidgetPosition, ContentWidgetPositionPreference, IViewZoneChangeAccessor } from 'vs/editor/browser/editorBrowser'; import { Range } from 'vs/editor/common/core/range'; import { IModelDecorationsChangeAccessor, IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; @@ -16,9 +16,8 @@ import { editorCodeLensForeground } from 'vs/editor/common/view/editorColorRegis import { CodeLensItem } from 'vs/editor/contrib/codelens/codelens'; import { editorActiveLinkForeground } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { EditorOption } from 'vs/editor/common/config/editorOptions'; -class CodeLensViewZone implements editorBrowser.IViewZone { +class CodeLensViewZone implements IViewZone { readonly heightInLines: number; readonly suppressMouseDown: boolean; @@ -48,7 +47,7 @@ class CodeLensViewZone implements editorBrowser.IViewZone { } } -class CodeLensContentWidget implements editorBrowser.IContentWidget { +class CodeLensContentWidget implements IContentWidget { private static _idPool: number = 0; @@ -58,69 +57,65 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget { private readonly _id: string; private readonly _domNode: HTMLElement; - private readonly _editor: editorBrowser.ICodeEditor; + private readonly _editor: IActiveCodeEditor; private readonly _commands = new Map(); - private _widgetPosition?: editorBrowser.IContentWidgetPosition; + private _widgetPosition?: IContentWidgetPosition; + private _isEmpty: boolean = true; constructor( - editor: editorBrowser.ICodeEditor, - symbolRange: Range, - data: CodeLensItem[] + editor: IActiveCodeEditor, + className: string, + line: number, ) { - this._id = 'codeLensWidget' + (++CodeLensContentWidget._idPool); this._editor = editor; + this._id = `codelens.widget-${(CodeLensContentWidget._idPool++)}`; - this.setSymbolRange(symbolRange); + this.updatePosition(line); this._domNode = document.createElement('span'); - this._domNode.innerHTML = ' '; - dom.addClass(this._domNode, 'codelens-decoration'); - this.updateHeight(); - this.withCommands(data.map(data => data.symbol), false); + this._domNode.className = `codelens-decoration ${className}`; } - updateHeight(): void { - const options = this._editor.getOptions(); - const fontInfo = options.get(EditorOption.fontInfo); - const lineHeight = options.get(EditorOption.lineHeight); - this._domNode.style.height = `${Math.round(lineHeight * 1.1)}px`; - this._domNode.style.lineHeight = `${lineHeight}px`; - this._domNode.style.fontSize = `${Math.round(fontInfo.fontSize * 0.9)}px`; - this._domNode.style.paddingRight = `${Math.round(fontInfo.fontSize * 0.45)}px`; - this._domNode.innerHTML = ' '; - } - - withCommands(inSymbols: Array, animate: boolean): void { + withCommands(lenses: Array, animate: boolean): void { this._commands.clear(); - const symbols = coalesce(inSymbols); - if (isFalsyOrEmpty(symbols)) { - this._domNode.innerHTML = 'no commands'; - return; - } - - let html: string[] = []; - for (let i = 0; i < symbols.length; i++) { - const command = symbols[i].command; - if (command) { - const title = renderCodicons(command.title); - let part: string; - if (command.id) { - part = `
${title}`; - this._commands.set(String(i), command); + let innerHtml = ''; + let hasSymbol = false; + for (let i = 0; i < lenses.length; i++) { + const lens = lenses[i]; + if (!lens) { + continue; + } + hasSymbol = true; + if (lens.command) { + const title = renderCodicons(escape(lens.command.title)); + if (lens.command.id) { + innerHtml += `${title}`; + this._commands.set(String(i), lens.command); } else { - part = `${title}`; + innerHtml += `${title}`; + } + if (i + 1 < lenses.length) { + innerHtml += ' | '; } - html.push(part); } } - const wasEmpty = this._domNode.innerHTML === '' || this._domNode.innerHTML === ' '; - this._domNode.innerHTML = html.join(' | '); - this._editor.layoutContentWidget(this); - if (wasEmpty && animate) { - dom.addClass(this._domNode, 'fadein'); + if (!hasSymbol) { + // symbols but no commands + this._domNode.innerHTML = 'no commands'; + + } else { + // symbols and commands + if (!innerHtml) { + innerHtml = ' '; + } + this._domNode.innerHTML = innerHtml; + if (this._isEmpty && animate) { + dom.addClass(this._domNode, 'fadein'); + } + this._isEmpty = false; } } @@ -138,25 +133,17 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget { return this._domNode; } - setSymbolRange(range: Range): void { - if (!this._editor.hasModel()) { - return; - } - const lineNumber = range.startLineNumber; - const column = this._editor.getModel().getLineFirstNonWhitespaceColumn(lineNumber); + updatePosition(line: number): void { + const column = this._editor.getModel().getLineFirstNonWhitespaceColumn(line); this._widgetPosition = { - position: { lineNumber: lineNumber, column: column }, - preference: [editorBrowser.ContentWidgetPositionPreference.ABOVE] + position: { lineNumber: line, column: column }, + preference: [ContentWidgetPositionPreference.ABOVE] }; } - getPosition(): editorBrowser.IContentWidgetPosition | null { + getPosition(): IContentWidgetPosition | null { return this._widgetPosition || null; } - - isVisible(): boolean { - return this._domNode.hasAttribute('monaco-visible-content-widget'); - } } export interface IDecorationIdCallback { @@ -194,27 +181,40 @@ export class CodeLensHelper { export class CodeLensWidget { - private readonly _editor: editorBrowser.ICodeEditor; + private readonly _editor: IActiveCodeEditor; + private readonly _className: string; private readonly _viewZone!: CodeLensViewZone; private readonly _viewZoneId!: string; - private readonly _contentWidget!: CodeLensContentWidget; + + private _contentWidget?: CodeLensContentWidget; private _decorationIds: string[]; private _data: CodeLensItem[]; + private _isDisposed: boolean = false; constructor( data: CodeLensItem[], - editor: editorBrowser.ICodeEditor, + editor: IActiveCodeEditor, + className: string, helper: CodeLensHelper, - viewZoneChangeAccessor: editorBrowser.IViewZoneChangeAccessor, + viewZoneChangeAccessor: IViewZoneChangeAccessor, updateCallback: Function ) { this._editor = editor; + this._className = className; this._data = data; - this._decorationIds = new Array(this._data.length); + // create combined range, track all ranges with decorations, + // check if there is already something to render + this._decorationIds = []; let range: Range | undefined; + let lenses: CodeLens[] = []; + this._data.forEach((codeLensData, i) => { + if (codeLensData.symbol.command) { + lenses.push(codeLensData.symbol); + } + helper.addDecoration({ range: codeLensData.symbol.range, options: ModelDecorationOptions.EMPTY @@ -228,43 +228,51 @@ export class CodeLensWidget { } }); - if (range) { - this._contentWidget = new CodeLensContentWidget(editor, range, this._data); - this._viewZone = new CodeLensViewZone(range.startLineNumber - 1, updateCallback); + this._viewZone = new CodeLensViewZone(range!.startLineNumber - 1, updateCallback); + this._viewZoneId = viewZoneChangeAccessor.addZone(this._viewZone); - this._viewZoneId = viewZoneChangeAccessor.addZone(this._viewZone); - this._editor.addContentWidget(this._contentWidget); + if (lenses.length > 0) { + this._createContentWidgetIfNecessary(); + this._contentWidget!.withCommands(lenses, false); } } - dispose(helper: CodeLensHelper, viewZoneChangeAccessor?: editorBrowser.IViewZoneChangeAccessor): void { - while (this._decorationIds.length) { - helper.removeDecoration(this._decorationIds.pop()!); + private _createContentWidgetIfNecessary(): void { + if (!this._contentWidget) { + this._contentWidget = new CodeLensContentWidget(this._editor, this._className, this._viewZone.afterLineNumber + 1); + this._editor.addContentWidget(this._contentWidget!); } + } + + dispose(helper: CodeLensHelper, viewZoneChangeAccessor?: IViewZoneChangeAccessor): void { + this._decorationIds.forEach(helper.removeDecoration, helper); + this._decorationIds = []; if (viewZoneChangeAccessor) { viewZoneChangeAccessor.removeZone(this._viewZoneId); } - this._editor.removeContentWidget(this._contentWidget); + if (this._contentWidget) { + this._editor.removeContentWidget(this._contentWidget); + this._contentWidget = undefined; + } + this._isDisposed = true; + } + + isDisposed(): boolean { + return this._isDisposed; } isValid(): boolean { - if (!this._editor.hasModel()) { - return false; - } - const model = this._editor.getModel(); return this._decorationIds.some((id, i) => { - const range = model.getDecorationRange(id); + const range = this._editor.getModel().getDecorationRange(id); const symbol = this._data[i].symbol; return !!(range && Range.isEmpty(symbol.range) === range.isEmpty()); }); } updateCodeLensSymbols(data: CodeLensItem[], helper: CodeLensHelper): void { - while (this._decorationIds.length) { - helper.removeDecoration(this._decorationIds.pop()!); - } + this._decorationIds.forEach(helper.removeDecoration, helper); + this._decorationIds = []; this._data = data; - this._decorationIds = new Array(this._data.length); this._data.forEach((codeLensData, i) => { helper.addDecoration({ range: codeLensData.symbol.range, @@ -274,7 +282,7 @@ export class CodeLensWidget { } computeIfNecessary(model: ITextModel): CodeLensItem[] | null { - if (!this._contentWidget.isVisible()) { + if (!this._viewZone.domNode.hasAttribute('monaco-visible-view-zone')) { return null; } @@ -289,7 +297,10 @@ export class CodeLensWidget { } updateCommands(symbols: Array): void { - this._contentWidget.withCommands(symbols, true); + + this._createContentWidgetIfNecessary(); + this._contentWidget!.withCommands(symbols, true); + for (let i = 0; i < this._data.length; i++) { const resolved = symbols[i]; if (resolved) { @@ -299,33 +310,29 @@ export class CodeLensWidget { } } - updateHeight(): void { - this._contentWidget.updateHeight(); - } - getCommand(link: HTMLLinkElement): Command | undefined { - return this._contentWidget.getCommand(link); + return this._contentWidget?.getCommand(link); } getLineNumber(): number { - if (this._editor.hasModel()) { - const range = this._editor.getModel().getDecorationRange(this._decorationIds[0]); - if (range) { - return range.startLineNumber; - } + const range = this._editor.getModel().getDecorationRange(this._decorationIds[0]); + if (range) { + return range.startLineNumber; } return -1; } - update(viewZoneChangeAccessor: editorBrowser.IViewZoneChangeAccessor): void { - if (this.isValid() && this._editor.hasModel()) { + update(viewZoneChangeAccessor: IViewZoneChangeAccessor): void { + if (this.isValid()) { const range = this._editor.getModel().getDecorationRange(this._decorationIds[0]); if (range) { this._viewZone.afterLineNumber = range.startLineNumber - 1; viewZoneChangeAccessor.layoutZone(this._viewZoneId); - this._contentWidget.setSymbolRange(range); - this._editor.layoutContentWidget(this._contentWidget); + if (this._contentWidget) { + this._contentWidget.updatePosition(range.startLineNumber); + this._editor.layoutContentWidget(this._contentWidget); + } } } } @@ -335,9 +342,11 @@ registerThemingParticipant((theme, collector) => { const codeLensForeground = theme.getColor(editorCodeLensForeground); if (codeLensForeground) { collector.addRule(`.monaco-editor .codelens-decoration { color: ${codeLensForeground}; }`); + collector.addRule(`.monaco-editor .codelens-decoration .codicon { color: ${codeLensForeground}; }`); } const activeLinkForeground = theme.getColor(editorActiveLinkForeground); if (activeLinkForeground) { collector.addRule(`.monaco-editor .codelens-decoration > a:hover { color: ${activeLinkForeground} !important; }`); + collector.addRule(`.monaco-editor .codelens-decoration > a:hover .codicon { color: ${activeLinkForeground} !important; }`); } }); diff --git a/src/vs/editor/contrib/colorPicker/colorDetector.ts b/src/vs/editor/contrib/colorPicker/colorDetector.ts index 9e2113c38d90a..90f0db8ac6783 100644 --- a/src/vs/editor/contrib/colorPicker/colorDetector.ts +++ b/src/vs/editor/contrib/colorPicker/colorDetector.ts @@ -192,7 +192,7 @@ export class ColorDetector extends Disposable implements IEditorContribution { border: 'solid 0.1em #eee' } } - }); + }, undefined, this._editor); } newDecorationsTypes[key] = true; diff --git a/src/vs/editor/contrib/colorPicker/colorPickerWidget.ts b/src/vs/editor/contrib/colorPicker/colorPickerWidget.ts index 4a74a4a5e0d12..68de080e7d6b7 100644 --- a/src/vs/editor/contrib/colorPicker/colorPickerWidget.ts +++ b/src/vs/editor/contrib/colorPicker/colorPickerWidget.ts @@ -150,7 +150,7 @@ class SaturationBox extends Disposable { this.layout(); - this._register(dom.addDisposableListener(this.domNode, dom.EventType.MOUSE_DOWN, e => this.onMouseDown(e))); + this._register(dom.addDisposableGenericMouseDownListner(this.domNode, e => this.onMouseDown(e))); this._register(this.model.onDidChangeColor(this.onDidChangeColor, this)); this.monitor = null; } @@ -163,9 +163,9 @@ class SaturationBox extends Disposable { this.onDidChangePosition(e.offsetX, e.offsetY); } - this.monitor.startMonitoring(standardMouseMoveMerger, event => this.onDidChangePosition(event.posx - origin.left, event.posy - origin.top), () => null); + this.monitor.startMonitoring(e.target, e.buttons, standardMouseMoveMerger, event => this.onDidChangePosition(event.posx - origin.left, event.posy - origin.top), () => null); - const mouseUpListener = dom.addDisposableListener(document, dom.EventType.MOUSE_UP, () => { + const mouseUpListener = dom.addDisposableGenericMouseUpListner(document, () => { this._onColorFlushed.fire(); mouseUpListener.dispose(); if (this.monitor) { @@ -250,7 +250,7 @@ abstract class Strip extends Disposable { this.slider = dom.append(this.domNode, $('.slider')); this.slider.style.top = `0px`; - this._register(dom.addDisposableListener(this.domNode, dom.EventType.MOUSE_DOWN, e => this.onMouseDown(e))); + this._register(dom.addDisposableGenericMouseDownListner(this.domNode, e => this.onMouseDown(e))); this.layout(); } @@ -270,9 +270,9 @@ abstract class Strip extends Disposable { this.onDidChangeTop(e.offsetY); } - monitor.startMonitoring(standardMouseMoveMerger, event => this.onDidChangeTop(event.posy - origin.top), () => null); + monitor.startMonitoring(e.target, e.buttons, standardMouseMoveMerger, event => this.onDidChangeTop(event.posy - origin.top), () => null); - const mouseUpListener = dom.addDisposableListener(document, dom.EventType.MOUSE_UP, () => { + const mouseUpListener = dom.addDisposableGenericMouseUpListner(document, () => { this._onColorFlushed.fire(); mouseUpListener.dispose(); monitor.stopMonitoring(true); diff --git a/src/vs/editor/contrib/comment/blockCommentCommand.ts b/src/vs/editor/contrib/comment/blockCommentCommand.ts index 5c5273c9c3595..0a6d6a59ea585 100644 --- a/src/vs/editor/contrib/comment/blockCommentCommand.ts +++ b/src/vs/editor/contrib/comment/blockCommentCommand.ts @@ -8,17 +8,19 @@ import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; -import { IIdentifiedSingleEditOperation, ITextModel } from 'vs/editor/common/model'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; +import { ITextModel, IIdentifiedSingleEditOperation } from 'vs/editor/common/model'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; -export class BlockCommentCommand implements editorCommon.ICommand { +export class BlockCommentCommand implements ICommand { private readonly _selection: Selection; + private readonly _insertSpace: boolean; private _usedEndToken: string | null; - constructor(selection: Selection) { + constructor(selection: Selection, insertSpace: boolean) { this._selection = selection; + this._insertSpace = insertSpace; this._usedEndToken = null; } @@ -53,7 +55,7 @@ export class BlockCommentCommand implements editorCommon.ICommand { return true; } - private _createOperationsForBlockComment(selection: Range, startToken: string, endToken: string, model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + private _createOperationsForBlockComment(selection: Range, startToken: string, endToken: string, insertSpace: boolean, model: ITextModel, builder: IEditOperationBuilder): void { const startLineNumber = selection.startLineNumber; const startColumn = selection.startColumn; const endLineNumber = selection.endLineNumber; @@ -91,25 +93,21 @@ export class BlockCommentCommand implements editorCommon.ICommand { if (startTokenIndex !== -1 && endTokenIndex !== -1) { // Consider spaces as part of the comment tokens - if (startTokenIndex + startToken.length < startLineText.length) { - if (startLineText.charCodeAt(startTokenIndex + startToken.length) === CharCode.Space) { - // Pretend the start token contains a trailing space - startToken = startToken + ' '; - } + if (insertSpace && startTokenIndex + startToken.length < startLineText.length && startLineText.charCodeAt(startTokenIndex + startToken.length) === CharCode.Space) { + // Pretend the start token contains a trailing space + startToken = startToken + ' '; } - if (endTokenIndex > 0) { - if (endLineText.charCodeAt(endTokenIndex - 1) === CharCode.Space) { - // Pretend the end token contains a leading space - endToken = ' ' + endToken; - endTokenIndex -= 1; - } + if (insertSpace && endTokenIndex > 0 && endLineText.charCodeAt(endTokenIndex - 1) === CharCode.Space) { + // Pretend the end token contains a leading space + endToken = ' ' + endToken; + endTokenIndex -= 1; } ops = BlockCommentCommand._createRemoveBlockCommentOperations( new Range(startLineNumber, startTokenIndex + startToken.length + 1, endLineNumber, endTokenIndex + 1), startToken, endToken ); } else { - ops = BlockCommentCommand._createAddBlockCommentOperations(selection, startToken, endToken); + ops = BlockCommentCommand._createAddBlockCommentOperations(selection, startToken, endToken, this._insertSpace); this._usedEndToken = ops.length === 1 ? endToken : null; } @@ -144,15 +142,15 @@ export class BlockCommentCommand implements editorCommon.ICommand { return res; } - public static _createAddBlockCommentOperations(r: Range, startToken: string, endToken: string): IIdentifiedSingleEditOperation[] { + public static _createAddBlockCommentOperations(r: Range, startToken: string, endToken: string, insertSpace: boolean): IIdentifiedSingleEditOperation[] { let res: IIdentifiedSingleEditOperation[] = []; if (!Range.isEmpty(r)) { // Insert block comment start - res.push(EditOperation.insert(new Position(r.startLineNumber, r.startColumn), startToken + ' ')); + res.push(EditOperation.insert(new Position(r.startLineNumber, r.startColumn), startToken + (insertSpace ? ' ' : ''))); // Insert block comment end - res.push(EditOperation.insert(new Position(r.endLineNumber, r.endColumn), ' ' + endToken)); + res.push(EditOperation.insert(new Position(r.endLineNumber, r.endColumn), (insertSpace ? ' ' : '') + endToken)); } else { // Insert both continuously res.push(EditOperation.replace(new Range( @@ -164,7 +162,7 @@ export class BlockCommentCommand implements editorCommon.ICommand { return res; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { const startLineNumber = this._selection.startLineNumber; const startColumn = this._selection.startColumn; @@ -176,10 +174,10 @@ export class BlockCommentCommand implements editorCommon.ICommand { return; } - this._createOperationsForBlockComment(this._selection, config.blockCommentStartToken, config.blockCommentEndToken, model, builder); + this._createOperationsForBlockComment(this._selection, config.blockCommentStartToken, config.blockCommentEndToken, this._insertSpace, model, builder); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { const inverseEditOperations = helper.getInverseEditOperations(); if (inverseEditOperations.length === 2) { const startTokenEditOperation = inverseEditOperations[0]; diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts index 5c6118a3f6f1f..243a45655bfd9 100644 --- a/src/vs/editor/contrib/comment/comment.ts +++ b/src/vs/editor/contrib/comment/comment.ts @@ -12,6 +12,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { BlockCommentCommand } from 'vs/editor/contrib/comment/blockCommentCommand'; import { LineCommentCommand, Type } from 'vs/editor/contrib/comment/lineCommentCommand'; import { MenuId } from 'vs/platform/actions/common/actions'; +import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; abstract class CommentLineAction extends EditorAction { @@ -28,13 +29,14 @@ abstract class CommentLineAction extends EditorAction { return; } - let model = editor.getModel(); - let commands: ICommand[] = []; - let selections = editor.getSelections(); - let opts = model.getOptions(); + const model = editor.getModel(); + const commands: ICommand[] = []; + const selections = editor.getSelections(); + const modelOptions = model.getOptions(); + const commentsOptions = editor.getOption(EditorOption.comments); for (const selection of selections) { - commands.push(new LineCommentCommand(selection, opts.tabSize, this._type)); + commands.push(new LineCommentCommand(selection, modelOptions.tabSize, this._type, commentsOptions.insertSpace)); } editor.pushUndoStop(); @@ -56,7 +58,7 @@ class ToggleCommentLineAction extends CommentLineAction { primary: KeyMod.CtrlCmd | KeyCode.US_SLASH, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '5_insert', title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment"), @@ -112,7 +114,7 @@ class BlockCommentAction extends EditorAction { linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '5_insert', title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment"), @@ -126,10 +128,11 @@ class BlockCommentAction extends EditorAction { return; } - let commands: ICommand[] = []; - let selections = editor.getSelections(); + const commentsOptions = editor.getOption(EditorOption.comments); + const commands: ICommand[] = []; + const selections = editor.getSelections(); for (const selection of selections) { - commands.push(new BlockCommentCommand(selection)); + commands.push(new BlockCommentCommand(selection, commentsOptions.insertSpace)); } editor.pushUndoStop(); diff --git a/src/vs/editor/contrib/comment/lineCommentCommand.ts b/src/vs/editor/contrib/comment/lineCommentCommand.ts index 5c3716ed79cdb..bf088f0d67c30 100644 --- a/src/vs/editor/contrib/comment/lineCommentCommand.ts +++ b/src/vs/editor/contrib/comment/lineCommentCommand.ts @@ -9,7 +9,7 @@ import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { IIdentifiedSingleEditOperation, ITextModel } from 'vs/editor/common/model'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { BlockCommentCommand } from 'vs/editor/contrib/comment/blockCommentCommand'; @@ -47,20 +47,22 @@ export const enum Type { ForceRemove = 2 } -export class LineCommentCommand implements editorCommon.ICommand { +export class LineCommentCommand implements ICommand { private readonly _selection: Selection; + private readonly _tabSize: number; + private readonly _type: Type; + private readonly _insertSpace: boolean; private _selectionId: string | null; private _deltaColumn: number; private _moveEndPositionDown: boolean; - private readonly _tabSize: number; - private readonly _type: Type; - constructor(selection: Selection, tabSize: number, type: Type) { + constructor(selection: Selection, tabSize: number, type: Type, insertSpace: boolean) { this._selection = selection; - this._selectionId = null; this._tabSize = tabSize; this._type = type; + this._insertSpace = insertSpace; + this._selectionId = null; this._deltaColumn = 0; this._moveEndPositionDown = false; } @@ -98,7 +100,7 @@ export class LineCommentCommand implements editorCommon.ICommand { * Analyze lines and decide which lines are relevant and what the toggle should do. * Also, build up several offsets and lengths useful in the generation of editor operations. */ - public static _analyzeLines(type: Type, model: ISimpleModel, lines: ILinePreflightData[], startLineNumber: number): IPreflightData { + public static _analyzeLines(type: Type, insertSpace: boolean, model: ISimpleModel, lines: ILinePreflightData[], startLineNumber: number): IPreflightData { let onlyWhitespaceLines = true; let shouldRemoveComments: boolean; @@ -145,7 +147,8 @@ export class LineCommentCommand implements editorCommon.ICommand { } } - if (shouldRemoveComments) { + if (shouldRemoveComments && insertSpace) { + // Remove a following space if present const commentStrEndOffset = lineContentStartOffset + lineData.commentStrLength; if (commentStrEndOffset < lineContent.length && lineContent.charCodeAt(commentStrEndOffset) === CharCode.Space) { lineData.commentStrLength += 1; @@ -173,7 +176,7 @@ export class LineCommentCommand implements editorCommon.ICommand { /** * Analyze all lines and decide exactly what to do => not supported | insert line comments | remove line comments */ - public static _gatherPreflightData(type: Type, model: ITextModel, startLineNumber: number, endLineNumber: number): IPreflightData { + public static _gatherPreflightData(type: Type, insertSpace: boolean, model: ITextModel, startLineNumber: number, endLineNumber: number): IPreflightData { const lines = LineCommentCommand._gatherPreflightCommentStrings(model, startLineNumber, endLineNumber); if (lines === null) { return { @@ -181,13 +184,13 @@ export class LineCommentCommand implements editorCommon.ICommand { }; } - return LineCommentCommand._analyzeLines(type, model, lines, startLineNumber); + return LineCommentCommand._analyzeLines(type, insertSpace, model, lines, startLineNumber); } /** * Given a successful analysis, execute either insert line comments, either remove line comments */ - private _executeLineComments(model: ISimpleModel, builder: editorCommon.IEditOperationBuilder, data: IPreflightDataSupported, s: Selection): void { + private _executeLineComments(model: ISimpleModel, builder: IEditOperationBuilder, data: IPreflightDataSupported, s: Selection): void { let ops: IIdentifiedSingleEditOperation[]; @@ -195,14 +198,14 @@ export class LineCommentCommand implements editorCommon.ICommand { ops = LineCommentCommand._createRemoveLineCommentsOperations(data.lines, s.startLineNumber); } else { LineCommentCommand._normalizeInsertionPoint(model, data.lines, s.startLineNumber, this._tabSize); - ops = LineCommentCommand._createAddLineCommentsOperations(data.lines, s.startLineNumber); + ops = this._createAddLineCommentsOperations(data.lines, s.startLineNumber); } const cursorPosition = new Position(s.positionLineNumber, s.positionColumn); for (let i = 0, len = ops.length; i < len; i++) { builder.addEditOperation(ops[i].range, ops[i].text); - if (ops[i].range.isEmpty() && ops[i].range.getStartPosition().equals(cursorPosition)) { + if (Range.isEmpty(ops[i].range) && Range.getStartPosition(ops[i].range).equals(cursorPosition)) { const lineContent = model.getLineContent(cursorPosition.lineNumber); if (lineContent.length + 1 === cursorPosition.column) { this._deltaColumn = (ops[i].text || '').length; @@ -266,7 +269,7 @@ export class LineCommentCommand implements editorCommon.ICommand { /** * Given an unsuccessful analysis, delegate to the block comment command */ - private _executeBlockComment(model: ITextModel, builder: editorCommon.IEditOperationBuilder, s: Selection): void { + private _executeBlockComment(model: ITextModel, builder: IEditOperationBuilder, s: Selection): void { model.tokenizeIfCheap(s.startLineNumber); let languageId = model.getLanguageIdAtPosition(s.startLineNumber, 1); let config = LanguageConfigurationRegistry.getComments(languageId); @@ -288,11 +291,17 @@ export class LineCommentCommand implements editorCommon.ICommand { firstNonWhitespaceIndex = lineContent.length; } ops = BlockCommentCommand._createAddBlockCommentOperations( - new Range(s.startLineNumber, firstNonWhitespaceIndex + 1, s.startLineNumber, lineContent.length + 1), startToken, endToken + new Range(s.startLineNumber, firstNonWhitespaceIndex + 1, s.startLineNumber, lineContent.length + 1), + startToken, + endToken, + this._insertSpace ); } else { ops = BlockCommentCommand._createAddBlockCommentOperations( - new Range(s.startLineNumber, model.getLineFirstNonWhitespaceColumn(s.startLineNumber), s.endLineNumber, model.getLineMaxColumn(s.endLineNumber)), startToken, endToken + new Range(s.startLineNumber, model.getLineFirstNonWhitespaceColumn(s.startLineNumber), s.endLineNumber, model.getLineMaxColumn(s.endLineNumber)), + startToken, + endToken, + this._insertSpace ); } @@ -307,7 +316,7 @@ export class LineCommentCommand implements editorCommon.ICommand { } } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { let s = this._selection; this._moveEndPositionDown = false; @@ -317,7 +326,7 @@ export class LineCommentCommand implements editorCommon.ICommand { s = s.setEndPosition(s.endLineNumber - 1, model.getLineMaxColumn(s.endLineNumber - 1)); } - const data = LineCommentCommand._gatherPreflightData(this._type, model, s.startLineNumber, s.endLineNumber); + const data = LineCommentCommand._gatherPreflightData(this._type, this._insertSpace, model, s.startLineNumber, s.endLineNumber); if (data.supported) { return this._executeLineComments(model, builder, data, s); } @@ -325,7 +334,7 @@ export class LineCommentCommand implements editorCommon.ICommand { return this._executeBlockComment(model, builder, s); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { let result = helper.getTrackedSelection(this._selectionId!); if (this._moveEndPositionDown) { @@ -365,8 +374,10 @@ export class LineCommentCommand implements editorCommon.ICommand { /** * Generate edit operations in the add line comment case */ - public static _createAddLineCommentsOperations(lines: ILinePreflightData[], startLineNumber: number): IIdentifiedSingleEditOperation[] { + private _createAddLineCommentsOperations(lines: ILinePreflightData[], startLineNumber: number): IIdentifiedSingleEditOperation[] { let res: IIdentifiedSingleEditOperation[] = []; + const afterCommentStr = this._insertSpace ? ' ' : ''; + for (let i = 0, len = lines.length; i < len; i++) { const lineData = lines[i]; @@ -375,13 +386,12 @@ export class LineCommentCommand implements editorCommon.ICommand { continue; } - res.push(EditOperation.insert(new Position(startLineNumber + i, lineData.commentStrOffset + 1), lineData.commentStr + ' ')); + res.push(EditOperation.insert(new Position(startLineNumber + i, lineData.commentStrOffset + 1), lineData.commentStr + afterCommentStr)); } return res; } - // TODO@Alex -> duplicated in characterHardWrappingLineMapper private static nextVisibleColumn(currentVisibleColumn: number, tabSize: number, isTab: boolean, columnSize: number): number { if (isTab) { return currentVisibleColumn + (tabSize - (currentVisibleColumn % tabSize)); diff --git a/src/vs/editor/contrib/comment/test/blockCommentCommand.test.ts b/src/vs/editor/contrib/comment/test/blockCommentCommand.test.ts index 8576680d71beb..19a5be49ffb50 100644 --- a/src/vs/editor/contrib/comment/test/blockCommentCommand.test.ts +++ b/src/vs/editor/contrib/comment/test/blockCommentCommand.test.ts @@ -9,7 +9,7 @@ import { CommentMode } from 'vs/editor/test/common/commentMode'; function testBlockCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: '!@#', blockComment: ['<0', '0>'] }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new BlockCommentCommand(sel), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new BlockCommentCommand(sel, true), expectedLines, expectedSelection); mode.dispose(); } @@ -468,4 +468,45 @@ suite('Editor Contrib - Block Comment Command', () => { new Selection(1, 1, 1, 1) ); }); + + test('', () => { + }); + + test('insertSpace false', () => { + function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { + let mode = new CommentMode({ lineComment: '!@#', blockComment: ['<0', '0>'] }); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new BlockCommentCommand(sel, false), expectedLines, expectedSelection); + mode.dispose(); + } + + testLineCommentCommand( + [ + 'some text' + ], + new Selection(1, 1, 1, 5), + [ + '<0some0> text' + ], + new Selection(1, 3, 1, 7) + ); + }); + + test('insertSpace false does not remove space', () => { + function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { + let mode = new CommentMode({ lineComment: '!@#', blockComment: ['<0', '0>'] }); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new BlockCommentCommand(sel, false), expectedLines, expectedSelection); + mode.dispose(); + } + + testLineCommentCommand( + [ + '<0 some 0> text' + ], + new Selection(1, 4, 1, 8), + [ + ' some text' + ], + new Selection(1, 1, 1, 7) + ); + }); }); diff --git a/src/vs/editor/contrib/comment/test/lineCommentCommand.test.ts b/src/vs/editor/contrib/comment/test/lineCommentCommand.test.ts index 5f8b23c6ed74f..66593786b9652 100644 --- a/src/vs/editor/contrib/comment/test/lineCommentCommand.test.ts +++ b/src/vs/editor/contrib/comment/test/lineCommentCommand.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { Selection } from 'vs/editor/common/core/selection'; import { TokenizationResult2 } from 'vs/editor/common/core/token'; @@ -18,13 +19,13 @@ suite('Editor Contrib - Line Comment Command', () => { function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: '!@#', blockComment: [''] }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, true), expectedLines, expectedSelection); mode.dispose(); } function testAddLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: '!@#', blockComment: [''] }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.ForceAdd), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.ForceAdd, true), expectedLines, expectedSelection); mode.dispose(); } @@ -46,7 +47,7 @@ suite('Editor Contrib - Line Comment Command', () => { test('case insensitive', function () { function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: 'rem' }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, true), expectedLines, expectedSelection); mode.dispose(); } @@ -85,7 +86,7 @@ suite('Editor Contrib - Line Comment Command', () => { test('_analyzeLines', () => { let r: IPreflightData; - r = LineCommentCommand._analyzeLines(Type.Toggle, createSimpleModel([ + r = LineCommentCommand._analyzeLines(Type.Toggle, true, createSimpleModel([ '\t\t', ' ', ' c', @@ -116,7 +117,7 @@ suite('Editor Contrib - Line Comment Command', () => { assert.equal(r.lines[3].commentStrOffset, 2); - r = LineCommentCommand._analyzeLines(Type.Toggle, createSimpleModel([ + r = LineCommentCommand._analyzeLines(Type.Toggle, true, createSimpleModel([ '\t\t', ' rem ', ' !@# c', @@ -626,13 +627,51 @@ suite('Editor Contrib - Line Comment Command', () => { new Selection(2, 11, 1, 1) ); }); + + test('insertSpace false', () => { + function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { + let mode = new CommentMode({ lineComment: '!@#' }); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, false), expectedLines, expectedSelection); + mode.dispose(); + } + + testLineCommentCommand( + [ + 'some text' + ], + new Selection(1, 1, 1, 1), + [ + '!@#some text' + ], + new Selection(1, 4, 1, 4) + ); + }); + + test('insertSpace false does not remove space', () => { + function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { + let mode = new CommentMode({ lineComment: '!@#' }); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, false), expectedLines, expectedSelection); + mode.dispose(); + } + + testLineCommentCommand( + [ + '!@# some text' + ], + new Selection(1, 1, 1, 1), + [ + ' some text' + ], + new Selection(1, 1, 1, 1) + ); + }); }); suite('Editor Contrib - Line Comment As Block Comment', () => { function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: '', blockComment: ['(', ')'] }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, true), expectedLines, expectedSelection); mode.dispose(); } @@ -743,7 +782,7 @@ suite('Editor Contrib - Line Comment As Block Comment', () => { suite('Editor Contrib - Line Comment As Block Comment 2', () => { function testLineCommentCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { let mode = new CommentMode({ lineComment: null, blockComment: [''] }); - testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle), expectedLines, expectedSelection); + testCommand(lines, mode.getLanguageIdentifier(), selection, (sel) => new LineCommentCommand(sel, 4, Type.Toggle, true), expectedLines, expectedSelection); mode.dispose(); } @@ -984,7 +1023,7 @@ suite('Editor Contrib - Line Comment in mixed modes', () => { lines, outerMode.getLanguageIdentifier(), selection, - (sel) => new LineCommentCommand(sel, 4, Type.Toggle), + (sel) => new LineCommentCommand(sel, 4, Type.Toggle, true), expectedLines, expectedSelection, true diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index ea1d5f26b1747..6114c170cce89 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -15,7 +15,7 @@ import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/brows import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; -import { IMenuService, MenuId } from 'vs/platform/actions/common/actions'; +import { IMenuService, MenuId, SubmenuItemAction } from 'vs/platform/actions/common/actions'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; @@ -23,6 +23,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import { ITextModel } from 'vs/editor/common/model'; import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { ContextSubMenu } from 'vs/base/browser/contextmenu'; export class ContextMenuController implements IEditorContribution { @@ -128,7 +129,7 @@ export class ContextMenuController implements IEditorContribution { } // Find actions available for menu - const menuActions = this._getMenuActions(this._editor.getModel()); + const menuActions = this._getMenuActions(this._editor.getModel(), MenuId.EditorContext); // Show menu if we have actions to show if (menuActions.length > 0) { @@ -136,19 +137,40 @@ export class ContextMenuController implements IEditorContribution { } } - private _getMenuActions(model: ITextModel): ReadonlyArray { + private _getMenuActions(model: ITextModel, menuId: MenuId): IAction[] { const result: IAction[] = []; - let contextMenu = this._menuService.createMenu(MenuId.EditorContext, this._contextKeyService); - const groups = contextMenu.getActions({ arg: model.uri }); - contextMenu.dispose(); + // get menu groups + const menu = this._menuService.createMenu(menuId, this._contextKeyService); + const groups = menu.getActions({ arg: model.uri }); + menu.dispose(); + // translate them into other actions for (let group of groups) { const [, actions] = group; - result.push(...actions); - result.push(new Separator()); + let addedItems = 0; + for (const action of actions) { + if (action instanceof SubmenuItemAction) { + const subActions = this._getMenuActions(model, action.item.submenu); + if (subActions.length > 0) { + result.push(new ContextSubMenu(action.label, subActions)); + addedItems++; + } + } else { + result.push(action); + addedItems++; + } + } + + if (addedItems) { + result.push(new Separator()); + } } - result.pop(); // remove last separator + + if (result.length) { + result.pop(); // remove last separator + } + return result; } diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts index aecd70264982a..c23dea3649b70 100644 --- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts +++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts @@ -9,7 +9,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; import { Selection } from 'vs/editor/common/core/selection'; -import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; @@ -35,6 +35,14 @@ class CursorState { } } +class StackElement { + constructor( + public readonly cursorState: CursorState, + public readonly scrollTop: number, + public readonly scrollLeft: number + ) { } +} + export class CursorUndoRedoController extends Disposable implements IEditorContribution { public static readonly ID = 'editor.contrib.cursorUndoRedoController'; @@ -46,8 +54,8 @@ export class CursorUndoRedoController extends Disposable implements IEditorContr private readonly _editor: ICodeEditor; private _isCursorUndoRedo: boolean; - private _undoStack: CursorState[]; - private _redoStack: CursorState[]; + private _undoStack: StackElement[]; + private _redoStack: StackElement[]; constructor(editor: ICodeEditor) { super(); @@ -76,9 +84,9 @@ export class CursorUndoRedoController extends Disposable implements IEditorContr return; } const prevState = new CursorState(e.oldSelections); - const isEqualToLastUndoStack = (this._undoStack.length > 0 && this._undoStack[this._undoStack.length - 1].equals(prevState)); + const isEqualToLastUndoStack = (this._undoStack.length > 0 && this._undoStack[this._undoStack.length - 1].cursorState.equals(prevState)); if (!isEqualToLastUndoStack) { - this._undoStack.push(prevState); + this._undoStack.push(new StackElement(prevState, editor.getScrollTop(), editor.getScrollLeft())); this._redoStack = []; if (this._undoStack.length > 50) { // keep the cursor undo stack bounded @@ -93,7 +101,7 @@ export class CursorUndoRedoController extends Disposable implements IEditorContr return; } - this._redoStack.push(new CursorState(this._editor.getSelections())); + this._redoStack.push(new StackElement(new CursorState(this._editor.getSelections()), this._editor.getScrollTop(), this._editor.getScrollLeft())); this._applyState(this._undoStack.pop()!); } @@ -102,14 +110,17 @@ export class CursorUndoRedoController extends Disposable implements IEditorContr return; } - this._undoStack.push(new CursorState(this._editor.getSelections())); + this._undoStack.push(new StackElement(new CursorState(this._editor.getSelections()), this._editor.getScrollTop(), this._editor.getScrollLeft())); this._applyState(this._redoStack.pop()!); } - private _applyState(state: CursorState): void { + private _applyState(stackElement: StackElement): void { this._isCursorUndoRedo = true; - this._editor.setSelections(state.selections); - this._editor.revealRangeInCenterIfOutsideViewport(state.selections[0], ScrollType.Smooth); + this._editor.setSelections(stackElement.cursorState.selections); + this._editor.setScrollPosition({ + scrollTop: stackElement.scrollTop, + scrollLeft: stackElement.scrollLeft + }); this._isCursorUndoRedo = false; } } diff --git a/src/vs/editor/contrib/dnd/dnd.ts b/src/vs/editor/contrib/dnd/dnd.ts index f9c0cd0090276..599e804eb05df 100644 --- a/src/vs/editor/contrib/dnd/dnd.ts +++ b/src/vs/editor/contrib/dnd/dnd.ts @@ -8,9 +8,9 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { Disposable } from 'vs/base/common/lifecycle'; import { isMacintosh } from 'vs/base/common/platform'; import { KeyCode } from 'vs/base/common/keyCodes'; -import { ICodeEditor, IEditorMouseEvent, IMouseTarget, MouseTargetType } from 'vs/editor/browser/editorBrowser'; +import { ICodeEditor, IEditorMouseEvent, IMouseTarget, MouseTargetType, IPartialEditorMouseEvent } from 'vs/editor/browser/editorBrowser'; import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; @@ -29,7 +29,7 @@ function hasTriggerModifier(e: IKeyboardEvent | IMouseEvent): boolean { } } -export class DragAndDropController extends Disposable implements editorCommon.IEditorContribution { +export class DragAndDropController extends Disposable implements IEditorContribution { public static readonly ID = 'editor.contrib.dragAndDrop'; @@ -50,7 +50,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE this._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(e))); this._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(e))); this._register(this._editor.onMouseDrag((e: IEditorMouseEvent) => this._onEditorMouseDrag(e))); - this._register(this._editor.onMouseDrop((e: IEditorMouseEvent) => this._onEditorMouseDrop(e))); + this._register(this._editor.onMouseDrop((e: IPartialEditorMouseEvent) => this._onEditorMouseDrop(e))); this._register(this._editor.onKeyDown((e: IKeyboardEvent) => this.onEditorKeyDown(e))); this._register(this._editor.onKeyUp((e: IKeyboardEvent) => this.onEditorKeyUp(e))); this._register(this._editor.onDidBlurEditorWidget(() => this.onEditorBlur())); @@ -68,7 +68,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE } private onEditorKeyDown(e: IKeyboardEvent): void { - if (!this._editor.getOption(EditorOption.dragAndDrop)) { + if (!this._editor.getOption(EditorOption.dragAndDrop) || this._editor.getOption(EditorOption.columnSelection)) { return; } @@ -84,7 +84,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE } private onEditorKeyUp(e: IKeyboardEvent): void { - if (!this._editor.getOption(EditorOption.dragAndDrop)) { + if (!this._editor.getOption(EditorOption.dragAndDrop) || this._editor.getOption(EditorOption.columnSelection)) { return; } @@ -143,7 +143,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE } } - private _onEditorMouseDrop(mouseEvent: IEditorMouseEvent): void { + private _onEditorMouseDrop(mouseEvent: IPartialEditorMouseEvent): void { if (mouseEvent.target && (this._hitContent(mouseEvent.target) || this._hitMargin(mouseEvent.target)) && mouseEvent.target.position) { let newCursorPosition = new Position(mouseEvent.target.position.lineNumber, mouseEvent.target.position.column); @@ -201,7 +201,7 @@ export class DragAndDropController extends Disposable implements editorCommon.IE }]; this._dndDecorationIds = this._editor.deltaDecorations(this._dndDecorationIds, newDecorations); - this._editor.revealPosition(position, editorCommon.ScrollType.Immediate); + this._editor.revealPosition(position, ScrollType.Immediate); } private _removeDecoration(): void { diff --git a/src/vs/editor/contrib/dnd/dragAndDropCommand.ts b/src/vs/editor/contrib/dnd/dragAndDropCommand.ts index 8d1d8a32b020a..e6d7b427ae59d 100644 --- a/src/vs/editor/contrib/dnd/dragAndDropCommand.ts +++ b/src/vs/editor/contrib/dnd/dragAndDropCommand.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { Selection } from 'vs/editor/common/core/selection'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; -export class DragAndDropCommand implements editorCommon.ICommand { +export class DragAndDropCommand implements ICommand { private readonly selection: Selection; private readonly targetPosition: Position; @@ -24,7 +24,7 @@ export class DragAndDropCommand implements editorCommon.ICommand { this.targetSelection = null; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { let text = model.getValueInRange(this.selection); if (!this.copy) { builder.addEditOperation(this.selection, null); @@ -102,7 +102,7 @@ export class DragAndDropCommand implements editorCommon.ICommand { } } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { return this.targetSelection!; } } diff --git a/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css b/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css index 0885772974fd4..a7ba268d15811 100644 --- a/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css +++ b/src/vs/editor/contrib/documentSymbols/media/symbol-icons.css @@ -3,22 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -.monaco-workbench .monaco-icon-label.deprecated { +.monaco-icon-label.deprecated { text-decoration: line-through; opacity: 0.66; } - -.monaco-workbench .symbol-icon.inline { - display: flex; - align-items: center; - padding-left: 0; -} - -.monaco-workbench .symbol-icon.block { - display: inline-block; - height: 14px; - width: 16px; - min-height: 14px; - min-width: 16px; - background-position: center; -} diff --git a/src/vs/editor/contrib/documentSymbols/outlineTree.ts b/src/vs/editor/contrib/documentSymbols/outlineTree.ts index 970453bc12b53..03068119208e3 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineTree.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineTree.ts @@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom'; import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel'; import { IIdentityProvider, IKeyboardNavigationLabelProvider, IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IDataSource, ITreeNode, ITreeRenderer, ITreeSorter, ITreeFilter } from 'vs/base/browser/ui/tree/tree'; -import { values, forEach } from 'vs/base/common/collections'; +import { values } from 'vs/base/common/collections'; import { createMatches, FuzzyScore } from 'vs/base/common/filters'; import 'vs/css!./media/outlineTree'; import 'vs/css!./media/symbol-icons'; @@ -22,6 +22,8 @@ import { MarkerSeverity } from 'vs/platform/markers/common/markers'; import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { registerColor, listErrorForeground, listWarningForeground, foreground } from 'vs/platform/theme/common/colorRegistry'; import { IdleValue } from 'vs/base/common/async'; +import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService'; +import { URI } from 'vs/base/common/uri'; export type OutlineItem = OutlineGroup | OutlineElement; @@ -278,27 +280,26 @@ export class OutlineFilter implements ITreeFilter { [SymbolKind.TypeParameter]: 'showTypeParameters', }); - private readonly _filteredTypes = new Set(); - constructor( private readonly _prefix: string, - @IConfigurationService private readonly _configService: IConfigurationService, - ) { - this.update(); - } - - update() { - this._filteredTypes.clear(); - forEach(OutlineFilter.configNameToKind, entry => { - const key = `${this._prefix}.${entry.key}`; - if (this._configService.getValue(key) === false) { - this._filteredTypes.add(entry.value); - } - }); - } + @ITextResourceConfigurationService private readonly _textResourceConfigService: ITextResourceConfigurationService, + ) { } filter(element: OutlineItem): boolean { - return !(element instanceof OutlineElement) || !this._filteredTypes.has(element.symbol.kind); + const outline = OutlineModel.get(element); + let uri: URI | undefined; + + if (outline) { + uri = outline.textModel.uri; + } + + if (!(element instanceof OutlineElement)) { + return true; + } + + const configName = OutlineFilter.kindToConfigName[element.symbol.kind]; + const configKey = `${this._prefix}.${configName}`; + return this._textResourceConfigService.getValue(uri, configKey); } } @@ -539,300 +540,168 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { const symbolIconArrayColor = theme.getColor(SYMBOL_ICON_ARRAY_FOREGROUND); if (symbolIconArrayColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-array { - color: ${symbolIconArrayColor} !important; - } - `); + collector.addRule(`.codicon-symbol-array { color: ${symbolIconArrayColor} !important; }`); } const symbolIconBooleanColor = theme.getColor(SYMBOL_ICON_BOOLEAN_FOREGROUND); if (symbolIconBooleanColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-boolean { - color: ${symbolIconBooleanColor} !important; - } - `); + collector.addRule(`.codicon-symbol-boolean { color: ${symbolIconBooleanColor} !important; }`); } const symbolIconClassColor = theme.getColor(SYMBOL_ICON_CLASS_FOREGROUND); if (symbolIconClassColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-class { - color: ${symbolIconClassColor} !important; - } - `); + collector.addRule(`.codicon-symbol-class { color: ${symbolIconClassColor} !important; }`); } const symbolIconMethodColor = theme.getColor(SYMBOL_ICON_METHOD_FOREGROUND); if (symbolIconMethodColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-method { - color: ${symbolIconMethodColor} !important; - } - `); + collector.addRule(`.codicon-symbol-method { color: ${symbolIconMethodColor} !important; }`); } const symbolIconColorColor = theme.getColor(SYMBOL_ICON_COLOR_FOREGROUND); if (symbolIconColorColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-color { - color: ${symbolIconColorColor} !important; - } - `); + collector.addRule(`.codicon-symbol-color { color: ${symbolIconColorColor} !important; }`); } const symbolIconConstantColor = theme.getColor(SYMBOL_ICON_CONSTANT_FOREGROUND); if (symbolIconConstantColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-constant { - color: ${symbolIconConstantColor} !important; - } - `); + collector.addRule(`.codicon-symbol-constant { color: ${symbolIconConstantColor} !important; }`); } const symbolIconConstructorColor = theme.getColor(SYMBOL_ICON_CONSTRUCTOR_FOREGROUND); if (symbolIconConstructorColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-constructor { - color: ${symbolIconConstructorColor} !important; - } - `); + collector.addRule(`.codicon-symbol-constructor { color: ${symbolIconConstructorColor} !important; }`); } const symbolIconEnumeratorColor = theme.getColor(SYMBOL_ICON_ENUMERATOR_FOREGROUND); if (symbolIconEnumeratorColor) { collector.addRule(` - .monaco-workbench .codicon-symbol-value, - .monaco-workbench .codicon-symbol-enum { - color: ${symbolIconEnumeratorColor} !important; - } - `); + .codicon-symbol-value,.codicon-symbol-enum { color: ${symbolIconEnumeratorColor} !important; }`); } const symbolIconEnumeratorMemberColor = theme.getColor(SYMBOL_ICON_ENUMERATOR_MEMBER_FOREGROUND); if (symbolIconEnumeratorMemberColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-enum-member { - color: ${symbolIconEnumeratorMemberColor} !important; - } - `); + collector.addRule(`.codicon-symbol-enum-member { color: ${symbolIconEnumeratorMemberColor} !important; }`); } const symbolIconEventColor = theme.getColor(SYMBOL_ICON_EVENT_FOREGROUND); if (symbolIconEventColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-event { - color: ${symbolIconEventColor} !important; - } - `); + collector.addRule(`.codicon-symbol-event { color: ${symbolIconEventColor} !important; }`); } const symbolIconFieldColor = theme.getColor(SYMBOL_ICON_FIELD_FOREGROUND); if (symbolIconFieldColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-field { - color: ${symbolIconFieldColor} !important; - } - `); + collector.addRule(`.codicon-symbol-field { color: ${symbolIconFieldColor} !important; }`); } const symbolIconFileColor = theme.getColor(SYMBOL_ICON_FILE_FOREGROUND); if (symbolIconFileColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-file { - color: ${symbolIconFileColor} !important; - } - `); + collector.addRule(`.codicon-symbol-file { color: ${symbolIconFileColor} !important; }`); } const symbolIconFolderColor = theme.getColor(SYMBOL_ICON_FOLDER_FOREGROUND); if (symbolIconFolderColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-folder { - color: ${symbolIconFolderColor} !important; - } - `); + collector.addRule(`.codicon-symbol-folder { color: ${symbolIconFolderColor} !important; }`); } const symbolIconFunctionColor = theme.getColor(SYMBOL_ICON_FUNCTION_FOREGROUND); if (symbolIconFunctionColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-function { - color: ${symbolIconFunctionColor} !important; - } - `); + collector.addRule(`.codicon-symbol-function { color: ${symbolIconFunctionColor} !important; }`); } const symbolIconInterfaceColor = theme.getColor(SYMBOL_ICON_INTERFACE_FOREGROUND); if (symbolIconInterfaceColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-interface { - color: ${symbolIconInterfaceColor} !important; - } - `); + collector.addRule(`.codicon-symbol-interface { color: ${symbolIconInterfaceColor} !important; }`); } const symbolIconKeyColor = theme.getColor(SYMBOL_ICON_KEY_FOREGROUND); if (symbolIconKeyColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-key { - color: ${symbolIconKeyColor} !important; - } - `); + collector.addRule(`.codicon-symbol-key { color: ${symbolIconKeyColor} !important; }`); } const symbolIconKeywordColor = theme.getColor(SYMBOL_ICON_KEYWORD_FOREGROUND); if (symbolIconKeywordColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-keyword { - color: ${symbolIconKeywordColor} !important; - } - `); + collector.addRule(`.codicon-symbol-keyword { color: ${symbolIconKeywordColor} !important; }`); } const symbolIconModuleColor = theme.getColor(SYMBOL_ICON_MODULE_FOREGROUND); if (symbolIconModuleColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-module { - color: ${symbolIconModuleColor} !important; - } - `); + collector.addRule(`.codicon-symbol-module { color: ${symbolIconModuleColor} !important; }`); } const outlineNamespaceColor = theme.getColor(SYMBOL_ICON_NAMESPACE_FOREGROUND); if (outlineNamespaceColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-namespace { - color: ${outlineNamespaceColor} !important; - } - `); + collector.addRule(`.codicon-symbol-namespace { color: ${outlineNamespaceColor} !important; }`); } const symbolIconNullColor = theme.getColor(SYMBOL_ICON_NULL_FOREGROUND); if (symbolIconNullColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-null { - color: ${symbolIconNullColor} !important; - } - `); + collector.addRule(`.codicon-symbol-null { color: ${symbolIconNullColor} !important; }`); } const symbolIconNumberColor = theme.getColor(SYMBOL_ICON_NUMBER_FOREGROUND); if (symbolIconNumberColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-number { - color: ${symbolIconNumberColor} !important; - } - `); + collector.addRule(`.codicon-symbol-number { color: ${symbolIconNumberColor} !important; }`); } const symbolIconObjectColor = theme.getColor(SYMBOL_ICON_OBJECT_FOREGROUND); if (symbolIconObjectColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-object { - color: ${symbolIconObjectColor} !important; - } - `); + collector.addRule(`.codicon-symbol-object { color: ${symbolIconObjectColor} !important; }`); } const symbolIconOperatorColor = theme.getColor(SYMBOL_ICON_OPERATOR_FOREGROUND); if (symbolIconOperatorColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-operator { - color: ${symbolIconOperatorColor} !important; - } - `); + collector.addRule(`.codicon-symbol-operator { color: ${symbolIconOperatorColor} !important; }`); } const symbolIconPackageColor = theme.getColor(SYMBOL_ICON_PACKAGE_FOREGROUND); if (symbolIconPackageColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-package { - color: ${symbolIconPackageColor} !important; - } - `); + collector.addRule(`.codicon-symbol-package { color: ${symbolIconPackageColor} !important; }`); } const symbolIconPropertyColor = theme.getColor(SYMBOL_ICON_PROPERTY_FOREGROUND); if (symbolIconPropertyColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-property { - color: ${symbolIconPropertyColor} !important; - } - `); + collector.addRule(`.codicon-symbol-property { color: ${symbolIconPropertyColor} !important; }`); } const symbolIconReferenceColor = theme.getColor(SYMBOL_ICON_REFERENCE_FOREGROUND); if (symbolIconReferenceColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-reference { - color: ${symbolIconReferenceColor} !important; - } - `); + collector.addRule(`.codicon-symbol-reference { color: ${symbolIconReferenceColor} !important; }`); } const symbolIconSnippetColor = theme.getColor(SYMBOL_ICON_SNIPPET_FOREGROUND); if (symbolIconSnippetColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-snippet { - color: ${symbolIconSnippetColor} !important; - } - `); + collector.addRule(`.codicon-symbol-snippet { color: ${symbolIconSnippetColor} !important; }`); } const symbolIconStringColor = theme.getColor(SYMBOL_ICON_STRING_FOREGROUND); if (symbolIconStringColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-string { - color: ${symbolIconStringColor} !important; - } - `); + collector.addRule(`.codicon-symbol-string { color: ${symbolIconStringColor} !important; }`); } const symbolIconStructColor = theme.getColor(SYMBOL_ICON_STRUCT_FOREGROUND); if (symbolIconStructColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-struct { - color: ${symbolIconStructColor} !important; - } - `); + collector.addRule(`.codicon-symbol-struct { color: ${symbolIconStructColor} !important; }`); } const symbolIconTextColor = theme.getColor(SYMBOL_ICON_TEXT_FOREGROUND); if (symbolIconTextColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-text { - color: ${symbolIconTextColor} !important; - } - `); + collector.addRule(`.codicon-symbol-text { color: ${symbolIconTextColor} !important; }`); } const symbolIconTypeParameterColor = theme.getColor(SYMBOL_ICON_TYPEPARAMETER_FOREGROUND); if (symbolIconTypeParameterColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-type-parameter { - color: ${symbolIconTypeParameterColor} !important; - } - `); + collector.addRule(`.codicon-symbol-type-parameter { color: ${symbolIconTypeParameterColor} !important; }`); } const symbolIconUnitColor = theme.getColor(SYMBOL_ICON_UNIT_FOREGROUND); if (symbolIconUnitColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-unit { - color: ${symbolIconUnitColor} !important; - } - `); + collector.addRule(`.codicon-symbol-unit { color: ${symbolIconUnitColor} !important; }`); } const symbolIconVariableColor = theme.getColor(SYMBOL_ICON_VARIABLE_FOREGROUND); if (symbolIconVariableColor) { - collector.addRule(` - .monaco-workbench .codicon-symbol-variable { - color: ${symbolIconVariableColor} !important; - } - `); + collector.addRule(`.codicon-symbol-variable { color: ${symbolIconVariableColor} !important; }`); } }); diff --git a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts index b41a7f8dd8f27..64b8efa88a8b7 100644 --- a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts +++ b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts @@ -8,7 +8,7 @@ import { OutlineElement, OutlineGroup, OutlineModel } from '../outlineModel'; import { SymbolKind, DocumentSymbol, DocumentSymbolProviderRegistry } from 'vs/editor/common/modes'; import { Range } from 'vs/editor/common/core/range'; import { IMarker, MarkerSeverity } from 'vs/platform/markers/common/markers'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { URI } from 'vs/base/common/uri'; import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; @@ -16,7 +16,7 @@ suite('OutlineModel', function () { test('OutlineModel#create, cached', async function () { - let model = TextModel.createFromString('foo', undefined, undefined, URI.file('/fome/path.foo')); + let model = createTextModel('foo', undefined, undefined, URI.file('/fome/path.foo')); let count = 0; let reg = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, { provideDocumentSymbols() { @@ -42,7 +42,7 @@ suite('OutlineModel', function () { test('OutlineModel#create, cached/cancel', async function () { - let model = TextModel.createFromString('foo', undefined, undefined, URI.file('/fome/path.foo')); + let model = createTextModel('foo', undefined, undefined, URI.file('/fome/path.foo')); let isCancelled = false; let reg = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, { diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index ae3626007578f..fee09b8429d8e 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -10,7 +10,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import * as strings from 'vs/base/common/strings'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction, EditorCommand, ServicesAccessor, registerEditorAction, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { CONTEXT_FIND_INPUT_FOCUSED, CONTEXT_FIND_WIDGET_VISIBLE, FIND_IDS, FindModelBoundToEditorModel, ToggleCaseSensitiveKeybinding, ToggleRegexKeybinding, ToggleSearchScopeKeybinding, ToggleWholeWordKeybinding, CONTEXT_REPLACE_INPUT_FOCUSED } from 'vs/editor/contrib/find/findModel'; import { FindOptionsWidget } from 'vs/editor/contrib/find/findOptionsWidget'; @@ -68,7 +68,7 @@ export interface IFindStartOptions { updateSearchScope: boolean; } -export class CommonFindController extends Disposable implements editorCommon.IEditorContribution { +export class CommonFindController extends Disposable implements IEditorContribution { public static readonly ID = 'editor.contrib.findController'; @@ -455,7 +455,7 @@ export class StartFindAction extends EditorAction { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '3_find', title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), @@ -701,7 +701,7 @@ export class StartFindReplaceAction extends EditorAction { mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarEditMenu, group: '3_find', title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace"), diff --git a/src/vs/editor/contrib/find/findModel.ts b/src/vs/editor/contrib/find/findModel.ts index da67f86eb78ba..0653ac4f5c4cd 100644 --- a/src/vs/editor/contrib/find/findModel.ts +++ b/src/vs/editor/contrib/find/findModel.ts @@ -13,7 +13,7 @@ import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { Constants } from 'vs/base/common/uint'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ScrollType, ICommand } from 'vs/editor/common/editorCommon'; import { EndOfLinePreference, FindMatch, ITextModel } from 'vs/editor/common/model'; import { SearchParams } from 'vs/editor/common/model/textModelSearch'; import { FindDecorations } from 'vs/editor/contrib/find/findDecorations'; @@ -209,7 +209,7 @@ export class FindModelBoundToEditorModel { let findScope = this._decorations.getFindScope(); if (findScope) { // Reveal the selection so user is reminded that 'selection find' is on. - this._editor.revealRangeInCenterIfOutsideViewport(findScope, editorCommon.ScrollType.Smooth); + this._editor.revealRangeInCenterIfOutsideViewport(findScope, ScrollType.Smooth); } return true; } @@ -225,7 +225,7 @@ export class FindModelBoundToEditorModel { ); this._editor.setSelection(match); - this._editor.revealRangeInCenterIfOutsideViewport(match, editorCommon.ScrollType.Smooth); + this._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth); } private _prevSearchPosition(before: Position) { @@ -536,7 +536,7 @@ export class FindModelBoundToEditorModel { this._editor.setSelections(selections); } - private _executeEditorCommand(source: string, command: editorCommon.ICommand): void { + private _executeEditorCommand(source: string, command: ICommand): void { try { this._ignoreModelContentChanged = true; this._editor.pushUndoStop(); diff --git a/src/vs/editor/contrib/find/findWidget.css b/src/vs/editor/contrib/find/findWidget.css index 5cabcc69c61d1..4882113bec5b7 100644 --- a/src/vs/editor/contrib/find/findWidget.css +++ b/src/vs/editor/contrib/find/findWidget.css @@ -3,31 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* Checkbox */ - -.monaco-checkbox .codicon-selection { - width: 12px; - height: 12px; - border: 1px solid black; - background-color: transparent; - display: inline-block; -} - -.monaco-checkbox .checkbox { - position: absolute; - overflow: hidden; - clip: rect(0 0 0 0); - height: 1px; - width: 1px; - margin: -1px; - padding: 0; - border: 0; -} - -.monaco-checkbox .checkbox:checked + .codicon-selection { - background-color: black; -} - /* Find widget */ .monaco-editor .find-widget { position: absolute; @@ -38,7 +13,7 @@ transition: transform 200ms linear; padding: 0 4px; box-sizing: border-box; - transform: translateY(Calc(-100% - 10px)); /* shadow (10px) */ + transform: translateY(calc(-100% - 10px)); /* shadow (10px) */ } .monaco-editor .find-widget textarea { @@ -65,7 +40,6 @@ .monaco-editor .find-widget .monaco-inputbox .input { background-color: transparent; - /* Style to compensate for //winjs */ min-height: 0; } @@ -185,40 +159,6 @@ cursor: default; } -.monaco-editor .find-widget .monaco-checkbox { - width: 20px; - height: 20px; - display: inline-block; - vertical-align: middle; - margin-left: 3px; -} - -.monaco-editor .find-widget .monaco-checkbox .codicon-selection { - display: flex; - align-items: center; - justify-content: center; - width: 20px; - height: 20px; - border: none; -} - -.monaco-editor .find-widget .monaco-checkbox .checkbox:disabled + .codicon-selection { - opacity: 0.3; - cursor: default; -} - -.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled) + .codicon-selection { - cursor: pointer; -} - -.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .codicon-selection { - background-color: #DDD; -} - -.monaco-editor .find-widget .monaco-checkbox .checkbox:checked + .codicon-selection { - background-color: rgba(100, 100, 100, 0.2); -} - .monaco-editor .find-widget > .replace-part { display: none; } @@ -239,8 +179,7 @@ } /* REDUCED */ -.monaco-editor .find-widget.reduced-find-widget .matchesCount, -.monaco-editor .find-widget.reduced-find-widget .monaco-checkbox { +.monaco-editor .find-widget.reduced-find-widget .matchesCount { display:none; } @@ -272,13 +211,8 @@ margin-left: -4px; } -.monaco-editor.vs-dark .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .codicon-selection { - background-color: rgba(255, 255, 255, 0.1); -} - .monaco-editor.hc-black .find-widget .button:not(.disabled):hover, -.monaco-editor.vs-dark .find-widget .button:not(.disabled):hover, -.monaco-editor.vs-dark .find-widget .monaco-checkbox:not(.disabled):hover { +.monaco-editor.vs-dark .find-widget .button:not(.disabled):hover { background-color: rgba(255, 255, 255, 0.1); } @@ -287,7 +221,3 @@ top: 1px; left: 2px; } - -.monaco-editor.hc-black .find-widget .monaco-checkbox .checkbox:checked + .codicon-selection { - background-color: rgba(255, 255, 255, 0.1); -} diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index 5c9aee4a2ed60..440c78fef7272 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -56,14 +56,14 @@ const NLS_REPLACE_ALL_BTN_LABEL = nls.localize('label.replaceAllButton', "Replac const NLS_TOGGLE_REPLACE_MODE_BTN_LABEL = nls.localize('label.toggleReplaceButton', "Toggle Replace mode"); const NLS_MATCHES_COUNT_LIMIT_TITLE = nls.localize('title.matchesCountLimit', "Only the first {0} results are highlighted, but all find operations work on the entire text.", MATCHES_LIMIT); const NLS_MATCHES_LOCATION = nls.localize('label.matchesLocation', "{0} of {1}"); -const NLS_NO_RESULTS = nls.localize('label.noResults', "No Results"); +const NLS_NO_RESULTS = nls.localize('label.noResults', "No results"); const FIND_WIDGET_INITIAL_WIDTH = 419; const PART_WIDTH = 275; const FIND_INPUT_AREA_WIDTH = PART_WIDTH - 54; let MAX_MATCHES_COUNT_WIDTH = 69; -let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */; +// let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */; const FIND_INPUT_AREA_HEIGHT = 33; // The height of Find Widget when Replace Input is not visible. const ctrlEnterReplaceAllWarningPromptedKey = 'ctrlEnterReplaceAll.windows.donotask'; @@ -415,11 +415,20 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas if (label === NLS_NO_RESULTS) { return searchString === '' ? nls.localize('ariaSearchNoResultEmpty', "{0} found", label) - : nls.localize('ariaSearchNoResult', "{0} found for {1}", label, searchString); + : nls.localize('ariaSearchNoResult', "{0} found for '{1}'", label, searchString); } - return currentMatch - ? nls.localize('ariaSearchNoResultWithLineNum', "{0} found for {1} at {2}", label, searchString, currentMatch.startLineNumber + ':' + currentMatch.startColumn) - : nls.localize('ariaSearchNoResultWithLineNumNoCurrentMatch', "{0} found for {1}", label, searchString); + if (currentMatch) { + const ariaLabel = nls.localize('ariaSearchNoResultWithLineNum', "{0} found for '{1}', at {2}", label, searchString, currentMatch.startLineNumber + ':' + currentMatch.startColumn); + const model = this._codeEditor.getModel(); + if (model && (currentMatch.startLineNumber <= model.getLineCount()) && (currentMatch.startLineNumber >= 1)) { + const lineContent = model.getLineContent(currentMatch.startLineNumber); + return `${lineContent}, ${ariaLabel}`; + } + + return ariaLabel; + } + + return nls.localize('ariaSearchNoResultWithLineNumNoCurrentMatch', "{0} found for '{1}'", label, searchString); } /** @@ -603,7 +612,14 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return; } else { - const scrollAdjustment = this._getHeight(); + let scrollAdjustment = this._getHeight(); + + // if the editor has top padding, factor that into the zone height + scrollAdjustment -= this._codeEditor.getOption(EditorOption.padding).top; + if (scrollAdjustment <= 0) { + return; + } + viewZone.heightInPx = scrollAdjustment; this._viewZoneId = accessor.addZone(viewZone); @@ -706,10 +722,12 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas if (this._resized) { this._findInput.inputBox.layout(); - let findInputWidth = this._findInput.inputBox.width; + let findInputWidth = this._findInput.inputBox.element.clientWidth; if (findInputWidth > 0) { this._replaceInput.width = findInputWidth; } + } else if (this._isReplaceVisible) { + this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } } @@ -906,7 +924,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return null; } try { - /* tslint:disable-next-line:no-unused-expression */ new RegExp(value); return null; } catch (e) { @@ -1159,13 +1176,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return; } - const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth!) || 0; if (width > maxWidth) { return; } this._domNode.style.width = `${width}px`; - this._findInput.inputBox.width = inputBoxWidth; if (this._isReplaceVisible) { this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } @@ -1197,10 +1212,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas */ } - const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; this._domNode.style.width = `${width}px`; - this._findInput.inputBox.width = inputBoxWidth; if (this._isReplaceVisible) { this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } @@ -1343,20 +1356,10 @@ registerThemingParticipant((theme, collector) => { } } - const inputActiveBorder = theme.getColor(inputActiveOptionBorder); - if (inputActiveBorder) { - collector.addRule(`.monaco-editor .find-widget .monaco-checkbox .checkbox:checked + .label { border: 1px solid ${inputActiveBorder.toString()}; }`); - } - - const inputActiveBackground = theme.getColor(inputActiveOptionBackground); - if (inputActiveBackground) { - collector.addRule(`.monaco-editor .find-widget .monaco-checkbox .checkbox:checked + .label { background-color: ${inputActiveBackground.toString()}; }`); - } - // This rule is used to override the outline color for synthetic-focus find input. const focusOutline = theme.getColor(focusBorder); if (focusOutline) { - collector.addRule(`.monaco-workbench .monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${focusOutline}; }`); + collector.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${focusOutline}; }`); } }); diff --git a/src/vs/editor/contrib/find/replaceAllCommand.ts b/src/vs/editor/contrib/find/replaceAllCommand.ts index bdf2942f014af..fb2de090a52a7 100644 --- a/src/vs/editor/contrib/find/replaceAllCommand.ts +++ b/src/vs/editor/contrib/find/replaceAllCommand.ts @@ -5,7 +5,7 @@ import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; interface IEditOperation { @@ -13,7 +13,7 @@ interface IEditOperation { text: string; } -export class ReplaceAllCommand implements editorCommon.ICommand { +export class ReplaceAllCommand implements ICommand { private readonly _editorSelection: Selection; private _trackedEditorSelectionId: string | null; @@ -27,7 +27,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand { this._trackedEditorSelectionId = null; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { if (this._ranges.length > 0) { // Collect all edit operations let ops: IEditOperation[] = []; @@ -66,7 +66,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand { this._trackedEditorSelectionId = builder.trackSelection(this._editorSelection); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { return helper.getTrackedSelection(this._trackedEditorSelectionId!); } } diff --git a/src/vs/editor/contrib/find/test/find.test.ts b/src/vs/editor/contrib/find/test/find.test.ts index 1cfc4f135f09f..a0e8e987ef3d0 100644 --- a/src/vs/editor/contrib/find/test/find.test.ts +++ b/src/vs/editor/contrib/find/test/find.test.ts @@ -75,7 +75,7 @@ suite('Find', () => { let searchStringSelectionTwoLines = getSelectionSearchString(editor); assert.equal(searchStringSelectionTwoLines, null); - // Select end of first line newline and and chunk of second + // Select end of first line newline and chunk of second editor.setSelection(new Range(1, 7, 2, 4)); let searchStringSelectionSpanLines = getSelectionSearchString(editor); assert.equal(searchStringSelectionSpanLines, null); diff --git a/src/vs/editor/contrib/find/test/findModel.test.ts b/src/vs/editor/contrib/find/test/findModel.test.ts index df936e17485d2..f82c0d542ae72 100644 --- a/src/vs/editor/contrib/find/test/findModel.test.ts +++ b/src/vs/editor/contrib/find/test/findModel.test.ts @@ -15,6 +15,9 @@ import { TextModel } from 'vs/editor/common/model/textModel'; import { FindModelBoundToEditorModel } from 'vs/editor/contrib/find/findModel'; import { FindReplaceState } from 'vs/editor/contrib/find/findState'; import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; +import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService'; +import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService'; +import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService'; suite('FindModel', () => { @@ -44,7 +47,7 @@ suite('FindModel', () => { const factory = ptBuilder.finish(); withTestCodeEditor([], { - model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null) + model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null, new UndoRedoService(new TestDialogService(), new TestNotificationService())) }, (editor, cursor) => callback(editor as unknown as IActiveCodeEditor, cursor) ); diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index d000560f648ab..bae5307d991a3 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -14,12 +14,12 @@ import { ScrollType, IEditorContribution } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction, registerInstantiatedEditorAction } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; -import { FoldingModel, setCollapseStateAtLevel, CollapseMemento, setCollapseStateLevelsDown, setCollapseStateLevelsUp, setCollapseStateForMatchingLines, setCollapseStateForType, toggleCollapseState } from 'vs/editor/contrib/folding/foldingModel'; +import { FoldingModel, setCollapseStateAtLevel, CollapseMemento, setCollapseStateLevelsDown, setCollapseStateLevelsUp, setCollapseStateForMatchingLines, setCollapseStateForType, toggleCollapseState, setCollapseStateUp } from 'vs/editor/contrib/folding/foldingModel'; import { FoldingDecorationProvider } from './foldingDecorations'; import { FoldingRegions, FoldingRegion } from './foldingRanges'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions'; -import { IMarginData, IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget'; +import { IMarginData } from 'vs/editor/browser/controller/mouseTarget'; import { HiddenRangeModel } from 'vs/editor/contrib/folding/hiddenRangeModel'; import { IRange } from 'vs/editor/common/core/range'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; @@ -32,6 +32,8 @@ import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/f import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { onUnexpectedError } from 'vs/base/common/errors'; import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { registerColor, editorSelectionBackground, transparent } from 'vs/platform/theme/common/colorRegistry'; const CONTEXT_FOLDING_ENABLED = new RawContextKey('foldingEnabled', false); @@ -59,7 +61,6 @@ export class FoldingController extends Disposable implements IEditorContribution private readonly editor: ICodeEditor; private _isEnabled: boolean; - private _autoHideFoldingControls: boolean; private _useFoldingProviders: boolean; private readonly foldingDecorationProvider: FoldingDecorationProvider; @@ -89,7 +90,6 @@ export class FoldingController extends Disposable implements IEditorContribution this.editor = editor; const options = this.editor.getOptions(); this._isEnabled = options.get(EditorOption.folding); - this._autoHideFoldingControls = options.get(EditorOption.showFoldingControls) === 'mouseover'; this._useFoldingProviders = options.get(EditorOption.foldingStrategy) !== 'indentation'; this.foldingModel = null; @@ -103,32 +103,30 @@ export class FoldingController extends Disposable implements IEditorContribution this.mouseDownInfo = null; this.foldingDecorationProvider = new FoldingDecorationProvider(editor); - this.foldingDecorationProvider.autoHideFoldingControls = this._autoHideFoldingControls; + this.foldingDecorationProvider.autoHideFoldingControls = options.get(EditorOption.showFoldingControls) === 'mouseover'; + this.foldingDecorationProvider.showFoldingHighlights = options.get(EditorOption.foldingHighlight); this.foldingEnabled = CONTEXT_FOLDING_ENABLED.bindTo(this.contextKeyService); this.foldingEnabled.set(this._isEnabled); this._register(this.editor.onDidChangeModel(() => this.onModelChanged())); this._register(this.editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => { - if (e.hasChanged(EditorOption.folding) || e.hasChanged(EditorOption.showFoldingControls) || e.hasChanged(EditorOption.foldingStrategy)) { - let oldIsEnabled = this._isEnabled; + if (e.hasChanged(EditorOption.folding)) { const options = this.editor.getOptions(); this._isEnabled = options.get(EditorOption.folding); this.foldingEnabled.set(this._isEnabled); - if (oldIsEnabled !== this._isEnabled) { - this.onModelChanged(); - } - let oldShowFoldingControls = this._autoHideFoldingControls; - this._autoHideFoldingControls = options.get(EditorOption.showFoldingControls) === 'mouseover'; - if (oldShowFoldingControls !== this._autoHideFoldingControls) { - this.foldingDecorationProvider.autoHideFoldingControls = this._autoHideFoldingControls; - this.onModelContentChanged(); - } - let oldUseFoldingProviders = this._useFoldingProviders; + this.onModelChanged(); + } + if (e.hasChanged(EditorOption.showFoldingControls) || e.hasChanged(EditorOption.foldingHighlight)) { + const options = this.editor.getOptions(); + this.foldingDecorationProvider.autoHideFoldingControls = options.get(EditorOption.showFoldingControls) === 'mouseover'; + this.foldingDecorationProvider.showFoldingHighlights = options.get(EditorOption.foldingHighlight); + this.onModelContentChanged(); + } + if (e.hasChanged(EditorOption.foldingStrategy)) { + const options = this.editor.getOptions(); this._useFoldingProviders = options.get(EditorOption.foldingStrategy) !== 'indentation'; - if (oldUseFoldingProviders !== this._useFoldingProviders) { - this.onFoldingStrategyChanged(); - } + this.onFoldingStrategyChanged(); } })); this.onModelChanged(); @@ -366,15 +364,6 @@ export class FoldingController extends Disposable implements IEditorContribution iconClicked = true; break; - case MouseTargetType.CONTENT_EMPTY: { - if (this.hiddenRangeModel.hasRanges()) { - const data = e.target.detail as IEmptyContentData; - if (!data.isAfterLines) { - break; - } - } - return; - } case MouseTargetType.CONTENT_TEXT: { if (this.hiddenRangeModel.hasRanges()) { let model = this.editor.getModel(); @@ -421,9 +410,18 @@ export class FoldingController extends Disposable implements IEditorContribution if (region && region.startLineNumber === lineNumber) { let isCollapsed = region.isCollapsed; if (iconClicked || isCollapsed) { - let toToggle = [region]; - if (e.event.middleButton || e.event.shiftKey) { - toToggle.push(...foldingModel.getRegionsInside(region, r => r.isCollapsed === isCollapsed)); + let toToggle = []; + let recursive = e.event.middleButton || e.event.shiftKey; + if (recursive) { + for (const r of foldingModel.getRegionsInside(region)) { + if (r.isCollapsed === isCollapsed) { + toToggle.push(r); + } + } + } + // when recursive, first only collapse all children. If all are already folded or there are no children, also fold parent. + if (isCollapsed || !recursive || toToggle.length === 0) { + toToggle.push(region); } foldingModel.toggleCollapseState(toToggle); this.reveal({ lineNumber, column: 1 }); @@ -610,9 +608,10 @@ class FoldAction extends FoldingAction { { name: 'Fold editor argument', description: `Property-value pairs that can be passed through this argument: - * 'levels': Number of levels to fold. Defaults to 1. + * 'levels': Number of levels to fold. * 'direction': If 'up', folds given number of levels up otherwise folds down. * 'selectionLines': The start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used. + If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead. `, constraint: foldingArgumentsConstraint, schema: { @@ -620,12 +619,10 @@ class FoldAction extends FoldingAction { 'properties': { 'levels': { 'type': 'number', - 'default': 1 }, 'direction': { 'type': 'string', 'enum': ['up', 'down'], - 'default': 'down' }, 'selectionLines': { 'type': 'array', @@ -642,12 +639,20 @@ class FoldAction extends FoldingAction { } invoke(_foldingController: FoldingController, foldingModel: FoldingModel, editor: ICodeEditor, args: FoldingArguments): void { - let levels = args && args.levels || 1; let lineNumbers = this.getLineNumbers(args, editor); - if (args && args.direction === 'up') { - setCollapseStateLevelsUp(foldingModel, true, levels, lineNumbers); + + const levels = args && args.levels; + const direction = args && args.direction; + + if (typeof levels !== 'number' && typeof direction !== 'string') { + // fold the region at the location or if already collapsed, the first uncollapsed parent instead. + setCollapseStateUp(foldingModel, true, lineNumbers); } else { - setCollapseStateLevelsDown(foldingModel, true, levels, lineNumbers); + if (direction === 'up') { + setCollapseStateLevelsUp(foldingModel, true, levels || 1, lineNumbers); + } else { + setCollapseStateLevelsDown(foldingModel, true, levels || 1, lineNumbers); + } } } } @@ -879,3 +884,12 @@ for (let i = 1; i <= 7; i++) { }) ); } + +export const foldBackgroundBackground = registerColor('editor.foldBackground', { light: transparent(editorSelectionBackground, 0.3), dark: transparent(editorSelectionBackground, 0.3), hc: null }, nls.localize('foldBackgroundBackground', "Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."), true); + +registerThemingParticipant((theme, collector) => { + const foldBackground = theme.getColor(foldBackgroundBackground); + if (foldBackground) { + collector.addRule(`.monaco-editor .folded-background { background-color: ${foldBackground}; }`); + } +}); diff --git a/src/vs/editor/contrib/folding/foldingDecorations.ts b/src/vs/editor/contrib/folding/foldingDecorations.ts index 333ad459db090..0ec51779f7204 100644 --- a/src/vs/editor/contrib/folding/foldingDecorations.ts +++ b/src/vs/editor/contrib/folding/foldingDecorations.ts @@ -16,6 +16,14 @@ export class FoldingDecorationProvider implements IDecorationProvider { linesDecorationsClassName: 'codicon codicon-chevron-right' }); + private static readonly COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION = ModelDecorationOptions.register({ + stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, + afterContentClassName: 'inline-folded', + className: 'folded-background', + isWholeLine: true, + linesDecorationsClassName: 'codicon codicon-chevron-right' + }); + private static readonly EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({ stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, linesDecorationsClassName: 'codicon codicon-chevron-down' @@ -28,12 +36,14 @@ export class FoldingDecorationProvider implements IDecorationProvider { public autoHideFoldingControls: boolean = true; + public showFoldingHighlights: boolean = true; + constructor(private readonly editor: ICodeEditor) { } getDecorationOption(isCollapsed: boolean): ModelDecorationOptions { if (isCollapsed) { - return FoldingDecorationProvider.COLLAPSED_VISUAL_DECORATION; + return this.showFoldingHighlights ? FoldingDecorationProvider.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION : FoldingDecorationProvider.COLLAPSED_VISUAL_DECORATION; } else if (this.autoHideFoldingControls) { return FoldingDecorationProvider.EXPANDED_AUTO_HIDE_VISUAL_DECORATION; } else { diff --git a/src/vs/editor/contrib/folding/foldingModel.ts b/src/vs/editor/contrib/folding/foldingModel.ts index 44feb79cdf23a..917217b929b6f 100644 --- a/src/vs/editor/contrib/folding/foldingModel.ts +++ b/src/vs/editor/contrib/folding/foldingModel.ts @@ -90,7 +90,6 @@ export class FoldingModel { }; newEditorDecorations.push({ range: decorationRange, options: this._decorationProvider.getDecorationOption(isCollapsed) }); }; - let i = 0; let nextCollapsed = () => { while (i < this._regions.length) { @@ -204,7 +203,7 @@ export class FoldingModel { return null; } - getRegionsInside(region: FoldingRegion | null, filter?: (r: FoldingRegion, level?: number) => boolean): FoldingRegion[] { + getRegionsInside(region: FoldingRegion | null, filter?: RegionFilter | RegionFilterWithLevel): FoldingRegion[] { let result: FoldingRegion[] = []; let index = region ? region.regionIndex + 1 : 0; let endLineNumber = region ? region.endLineNumber : Number.MAX_VALUE; @@ -229,7 +228,7 @@ export class FoldingModel { for (let i = index, len = this._regions.length; i < len; i++) { let current = this._regions.toRegion(i); if (this._regions.getStartLineNumber(i) < endLineNumber) { - if (!filter || filter(current)) { + if (!filter || (filter as RegionFilter)(current)) { result.push(current); } } else { @@ -242,6 +241,10 @@ export class FoldingModel { } +type RegionFilter = (r: FoldingRegion) => boolean; +type RegionFilterWithLevel = (r: FoldingRegion, level: number) => boolean; + + /** * Collapse or expand the regions at the given locations * @param levels The number of levels. Use 1 to only impact the regions at the location, use Number.MAX_VALUE for all levels. @@ -270,7 +273,7 @@ export function toggleCollapseState(foldingModel: FoldingModel, levels: number, * @param levels The number of levels. Use 1 to only impact the regions at the location, use Number.MAX_VALUE for all levels. * @param lineNumbers the location of the regions to collapse or expand, or if not set, all regions in the model. */ -export function setCollapseStateLevelsDown(foldingModel: FoldingModel, doCollapse: boolean, levels = Number.MAX_VALUE, lineNumbers?: number[]) { +export function setCollapseStateLevelsDown(foldingModel: FoldingModel, doCollapse: boolean, levels = Number.MAX_VALUE, lineNumbers?: number[]): void { let toToggle: FoldingRegion[] = []; if (lineNumbers && lineNumbers.length > 0) { for (let lineNumber of lineNumbers) { @@ -296,9 +299,9 @@ export function setCollapseStateLevelsDown(foldingModel: FoldingModel, doCollaps * Collapse or expand the regions at the given locations including all parents. * @param doCollapse Wheter to collase or expand * @param levels The number of levels. Use 1 to only impact the regions at the location, use Number.MAX_VALUE for all levels. - * @param lineNumbers the location of the regions to collapse or expand, or if not set, all regions in the model. + * @param lineNumbers the location of the regions to collapse or expand. */ -export function setCollapseStateLevelsUp(foldingModel: FoldingModel, doCollapse: boolean, levels: number, lineNumbers: number[]) { +export function setCollapseStateLevelsUp(foldingModel: FoldingModel, doCollapse: boolean, levels: number, lineNumbers: number[]): void { let toToggle: FoldingRegion[] = []; for (let lineNumber of lineNumbers) { let regions = foldingModel.getAllRegionsAtLine(lineNumber, (region, level) => region.isCollapsed !== doCollapse && level <= levels); @@ -307,6 +310,22 @@ export function setCollapseStateLevelsUp(foldingModel: FoldingModel, doCollapse: foldingModel.toggleCollapseState(toToggle); } +/** + * Collapse or expand a region at the given locations. If the inner most region is already collapsed/expanded, uses the first parent instead. + * @param doCollapse Wheter to collase or expand + * @param lineNumbers the location of the regions to collapse or expand. + */ +export function setCollapseStateUp(foldingModel: FoldingModel, doCollapse: boolean, lineNumbers: number[]): void { + let toToggle: FoldingRegion[] = []; + for (let lineNumber of lineNumbers) { + let regions = foldingModel.getAllRegionsAtLine(lineNumber, (region, ) => region.isCollapsed !== doCollapse); + if (regions.length > 0) { + toToggle.push(regions[0]); + } + } + foldingModel.toggleCollapseState(toToggle); +} + /** * Folds or unfolds all regions that have a given level, except if they contain one of the blocked lines. * @param foldLevel level. Level == 1 is the top level diff --git a/src/vs/editor/contrib/folding/indentRangeProvider.ts b/src/vs/editor/contrib/folding/indentRangeProvider.ts index 68a3a366faad9..da1c2bc7b4c52 100644 --- a/src/vs/editor/contrib/folding/indentRangeProvider.ts +++ b/src/vs/editor/contrib/folding/indentRangeProvider.ts @@ -66,7 +66,7 @@ export class RangesCollector { // reverse and create arrays of the exact length let startIndexes = new Uint32Array(this._length); let endIndexes = new Uint32Array(this._length); - for (let i = this._length - 1, k = 0; i >= 0; i-- , k++) { + for (let i = this._length - 1, k = 0; i >= 0; i--, k++) { startIndexes[k] = this._startIndexes[i]; endIndexes[k] = this._endIndexes[i]; } diff --git a/src/vs/editor/contrib/folding/test/foldingModel.test.ts b/src/vs/editor/contrib/folding/test/foldingModel.test.ts index 00bc4241abc4f..97a8a209941f7 100644 --- a/src/vs/editor/contrib/folding/test/foldingModel.test.ts +++ b/src/vs/editor/contrib/folding/test/foldingModel.test.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { FoldingModel, setCollapseStateAtLevel, setCollapseStateLevelsDown, setCollapseStateLevelsUp, setCollapseStateForMatchingLines } from 'vs/editor/contrib/folding/foldingModel'; -import { TextModel, ModelDecorationOptions } from 'vs/editor/common/model/textModel'; +import { FoldingModel, setCollapseStateAtLevel, setCollapseStateLevelsDown, setCollapseStateLevelsUp, setCollapseStateForMatchingLines, setCollapseStateUp } from 'vs/editor/contrib/folding/foldingModel'; +import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider'; import { TrackedRangeStickiness, IModelDeltaDecoration, ITextModel, IModelDecorationsChangeAccessor } from 'vs/editor/common/model'; import { EditOperation } from 'vs/editor/common/core/editOperation'; @@ -92,7 +93,7 @@ suite('Folding Model', () => { /* 7*/ ' }', /* 8*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -131,7 +132,7 @@ suite('Folding Model', () => { /* 7*/ ' }', /* 8*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -177,7 +178,7 @@ suite('Folding Model', () => { /* 7*/ ' }', /* 8*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -217,7 +218,7 @@ suite('Folding Model', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -254,7 +255,7 @@ suite('Folding Model', () => { /* 7*/ ' }', /* 8*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -295,7 +296,7 @@ suite('Folding Model', () => { /* 11*/ ' }', /* 12*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -346,7 +347,7 @@ suite('Folding Model', () => { /* 10*/ '//#endregion', /* 11*/ '']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -392,7 +393,7 @@ suite('Folding Model', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -448,7 +449,7 @@ suite('Folding Model', () => { /* 15*/ ' //#endregion', /* 16*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -504,7 +505,7 @@ suite('Folding Model', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -556,7 +557,7 @@ suite('Folding Model', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); @@ -587,6 +588,50 @@ suite('Folding Model', () => { }); + test('setCollapseStateUp', () => { + let lines = [ + /* 1*/ '//#region', + /* 2*/ '//#endregion', + /* 3*/ 'class A {', + /* 4*/ ' void foo() {', + /* 5*/ ' if (true) {', + /* 6*/ ' return;', + /* 7*/ ' }', + /* 8*/ '', + /* 9*/ ' if (true) {', + /* 10*/ ' return;', + /* 11*/ ' }', + /* 12*/ ' }', + /* 13*/ '}']; + + let textModel = createTextModel(lines.join('\n')); + try { + let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); + + let ranges = computeRanges(textModel, false, { start: /^\/\/#region$/, end: /^\/\/#endregion$/ }); + foldingModel.update(ranges); + + let r1 = r(1, 2, false); + let r2 = r(3, 12, false); + let r3 = r(4, 11, false); + let r4 = r(5, 6, false); + let r5 = r(9, 10, false); + assertRanges(foldingModel, [r1, r2, r3, r4, r5]); + + setCollapseStateUp(foldingModel, true, [5]); + assertFoldedRanges(foldingModel, [r4], '1'); + + setCollapseStateUp(foldingModel, true, [5]); + assertFoldedRanges(foldingModel, [r3, r4], '2'); + + setCollapseStateUp(foldingModel, true, [4]); + assertFoldedRanges(foldingModel, [r2, r3, r4], '2'); + } finally { + textModel.dispose(); + } + + }); + test('setCollapseStateForMatchingLines', () => { let lines = [ @@ -604,7 +649,7 @@ suite('Folding Model', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); diff --git a/src/vs/editor/contrib/folding/test/foldingRanges.test.ts b/src/vs/editor/contrib/folding/test/foldingRanges.test.ts index dd572ec9850e8..214135a9c8cb3 100644 --- a/src/vs/editor/contrib/folding/test/foldingRanges.test.ts +++ b/src/vs/editor/contrib/folding/test/foldingRanges.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider'; import { FoldingMarkers } from 'vs/editor/common/modes/languageConfiguration'; import { MAX_FOLDING_REGIONS } from 'vs/editor/contrib/folding/foldingRanges'; @@ -26,7 +26,7 @@ suite('FoldingRanges', () => { for (let i = 0; i < nRegions; i++) { lines.push('#endregion'); } - let model = TextModel.createFromString(lines.join('\n')); + let model = createTextModel(lines.join('\n')); let actual = computeRanges(model, false, markers, MAX_FOLDING_REGIONS); assert.equal(actual.length, nRegions, 'len'); for (let i = 0; i < nRegions; i++) { @@ -53,7 +53,7 @@ suite('FoldingRanges', () => { /* 12*/ ' }', /* 13*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); try { let actual = computeRanges(textModel, false, markers); // let r0 = r(1, 2); @@ -91,7 +91,7 @@ suite('FoldingRanges', () => { for (let i = 0; i < nRegions; i++) { lines.push('#endregion'); } - let model = TextModel.createFromString(lines.join('\n')); + let model = createTextModel(lines.join('\n')); let actual = computeRanges(model, false, markers, MAX_FOLDING_REGIONS); assert.equal(actual.length, nRegions, 'len'); for (let i = 0; i < nRegions; i++) { diff --git a/src/vs/editor/contrib/folding/test/hiddenRangeModel.test.ts b/src/vs/editor/contrib/folding/test/hiddenRangeModel.test.ts index 18fa5acd3fe8d..9db5f45e4fb20 100644 --- a/src/vs/editor/contrib/folding/test/hiddenRangeModel.test.ts +++ b/src/vs/editor/contrib/folding/test/hiddenRangeModel.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { FoldingModel } from 'vs/editor/contrib/folding/foldingModel'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider'; import { TestDecorationProvider } from './foldingModel.test'; import { HiddenRangeModel } from 'vs/editor/contrib/folding/hiddenRangeModel'; @@ -38,7 +38,7 @@ suite('Hidden Range Model', () => { /* 9*/ ' }', /* 10*/ '}']; - let textModel = TextModel.createFromString(lines.join('\n')); + let textModel = createTextModel(lines.join('\n')); let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel)); let hiddenRangeModel = new HiddenRangeModel(foldingModel); diff --git a/src/vs/editor/contrib/folding/test/indentFold.test.ts b/src/vs/editor/contrib/folding/test/indentFold.test.ts index ed51ec95bac4d..ccdb26a756ee2 100644 --- a/src/vs/editor/contrib/folding/test/indentFold.test.ts +++ b/src/vs/editor/contrib/folding/test/indentFold.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; interface IndentRange { start: number; @@ -47,7 +47,7 @@ suite('Indentation Folding', () => { let r8 = r(13, 14);//4 let r9 = r(15, 16);//0 - let model = TextModel.createFromString(lines.join('\n')); + let model = createTextModel(lines.join('\n')); function assertLimit(maxEntries: number, expectedRanges: IndentRange[], message: string) { let indentRanges = computeRanges(model, true, undefined, maxEntries); diff --git a/src/vs/editor/contrib/folding/test/indentRangeProvider.test.ts b/src/vs/editor/contrib/folding/test/indentRangeProvider.test.ts index 07e2025666796..8a4dbe7f38a24 100644 --- a/src/vs/editor/contrib/folding/test/indentRangeProvider.test.ts +++ b/src/vs/editor/contrib/folding/test/indentRangeProvider.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider'; import { FoldingMarkers } from 'vs/editor/common/modes/languageConfiguration'; @@ -15,7 +15,7 @@ interface ExpectedIndentRange { } function assertRanges(lines: string[], expected: ExpectedIndentRange[], offside: boolean, markers?: FoldingMarkers): void { - let model = TextModel.createFromString(lines.join('\n')); + let model = createTextModel(lines.join('\n')); let actual = computeRanges(model, offside, markers); let actualRanges: ExpectedIndentRange[] = []; diff --git a/src/vs/editor/contrib/folding/test/syntaxFold.test.ts b/src/vs/editor/contrib/folding/test/syntaxFold.test.ts index 480b84e5d7cdd..86a4280259eb9 100644 --- a/src/vs/editor/contrib/folding/test/syntaxFold.test.ts +++ b/src/vs/editor/contrib/folding/test/syntaxFold.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import { SyntaxRangeProvider } from 'vs/editor/contrib/folding/syntaxRangeProvider'; import { FoldingRangeProvider, FoldingRange, FoldingContext, ProviderResult } from 'vs/editor/common/modes'; import { ITextModel } from 'vs/editor/common/model'; @@ -69,7 +69,7 @@ suite('Syntax folding', () => { let r8 = r(14, 15); //6 let r9 = r(22, 23); //0 - let model = TextModel.createFromString(lines.join('\n')); + let model = createTextModel(lines.join('\n')); let ranges = [r1, r2, r3, r4, r5, r6, r7, r8, r9]; let providers = [new TestFoldingRangeProvider(model, ranges)]; diff --git a/src/vs/editor/contrib/format/format.ts b/src/vs/editor/contrib/format/format.ts index cdf9ba12223f5..b18b6d63ad877 100644 --- a/src/vs/editor/contrib/format/format.ts +++ b/src/vs/editor/contrib/format/format.ts @@ -10,11 +10,11 @@ import { illegalArgument, onUnexpectedExternalError } from 'vs/base/common/error import { URI } from 'vs/base/common/uri'; import { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from 'vs/editor/browser/core/editorState'; import { IActiveCodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { registerLanguageCommand, ServicesAccessor } from 'vs/editor/browser/editorExtensions'; +import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ScrollType } from 'vs/editor/common/editorCommon'; import { ISingleEditOperation, ITextModel } from 'vs/editor/common/model'; import { DocumentFormattingEditProvider, DocumentFormattingEditProviderRegistry, DocumentRangeFormattingEditProvider, DocumentRangeFormattingEditProviderRegistry, FormattingOptions, OnTypeFormattingEditProviderRegistry, TextEdit } from 'vs/editor/common/modes'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; @@ -25,6 +25,9 @@ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable } from 'vs/base/common/lifecycle'; import { LinkedList } from 'vs/base/common/linkedList'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { assertType } from 'vs/base/common/types'; +import { IProgress } from 'vs/platform/progress/common/progress'; export function alertFormattingEdits(edits: ISingleEditOperation[]): void { @@ -176,11 +179,9 @@ export async function formatDocumentRangeWithProvider( if (isCodeEditor(editorOrModel)) { // use editor to apply edits - FormattingEdit.execute(editorOrModel, edits); + FormattingEdit.execute(editorOrModel, edits, true); alertFormattingEdits(edits); - editorOrModel.pushUndoStop(); - editorOrModel.focus(); - editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), editorCommon.ScrollType.Immediate); + editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate); } else { // use model to apply edits @@ -209,6 +210,7 @@ export async function formatDocumentWithSelectedProvider( accessor: ServicesAccessor, editorOrModel: ITextModel | IActiveCodeEditor, mode: FormattingMode, + progress: IProgress, token: CancellationToken ): Promise { @@ -217,6 +219,7 @@ export async function formatDocumentWithSelectedProvider( const provider = getRealAndSyntheticDocumentFormattersOrdered(model); const selected = await FormattingConflicts.select(provider, model, mode); if (selected) { + progress.report(selected); await instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token); } } @@ -264,13 +267,11 @@ export async function formatDocumentWithProvider( if (isCodeEditor(editorOrModel)) { // use editor to apply edits - FormattingEdit.execute(editorOrModel, edits); + FormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent); if (mode !== FormattingMode.Silent) { alertFormattingEdits(edits); - editorOrModel.pushUndoStop(); - editorOrModel.focus(); - editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), editorCommon.ScrollType.Immediate); + editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate); } } else { @@ -354,11 +355,11 @@ export function getOnTypeFormattingEdits( }); } -registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) { - const { resource, range, options } = args; - if (!(resource instanceof URI) || !Range.isIRange(range)) { - throw illegalArgument(); - } +CommandsRegistry.registerCommand('_executeFormatRangeProvider', function (accessor, ...args) { + const [resource, range, options] = args; + assertType(URI.isUri(resource)); + assertType(Range.isIRange(range)); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); @@ -366,11 +367,10 @@ registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) return getDocumentRangeFormattingEditsUntilResult(accessor.get(IEditorWorkerService), model, Range.lift(range), options, CancellationToken.None); }); -registerLanguageCommand('_executeFormatDocumentProvider', function (accessor, args) { - const { resource, options } = args; - if (!(resource instanceof URI)) { - throw illegalArgument('resource'); - } +CommandsRegistry.registerCommand('_executeFormatDocumentProvider', function (accessor, ...args) { + const [resource, options] = args; + assertType(URI.isUri(resource)); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); @@ -379,11 +379,12 @@ registerLanguageCommand('_executeFormatDocumentProvider', function (accessor, ar return getDocumentFormattingEditsUntilResult(accessor.get(IEditorWorkerService), model, options, CancellationToken.None); }); -registerLanguageCommand('_executeFormatOnTypeProvider', function (accessor, args) { - const { resource, position, ch, options } = args; - if (!(resource instanceof URI) || !Position.isIPosition(position) || typeof ch !== 'string') { - throw illegalArgument(); - } +CommandsRegistry.registerCommand('_executeFormatOnTypeProvider', function (accessor, ...args) { + const [resource, position, ch, options] = args; + assertType(URI.isUri(resource)); + assertType(Position.isIPosition(position)); + assertType(typeof ch === 'string'); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts index daded6e3e9d18..9d1c8ec0388c1 100644 --- a/src/vs/editor/contrib/format/formatActions.ts +++ b/src/vs/editor/contrib/format/formatActions.ts @@ -12,7 +12,7 @@ import { EditorAction, registerEditorAction, registerEditorContribution, Service import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { CharacterSet } from 'vs/editor/common/core/characterClassifier'; import { Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { DocumentRangeFormattingEditProviderRegistry, OnTypeFormattingEditProviderRegistry } from 'vs/editor/common/modes'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; @@ -25,8 +25,9 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { onUnexpectedError } from 'vs/base/common/errors'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { Progress } from 'vs/platform/progress/common/progress'; -class FormatOnType implements editorCommon.IEditorContribution { +class FormatOnType implements IEditorContribution { public static readonly ID = 'editor.contrib.autoFormat'; @@ -138,7 +139,7 @@ class FormatOnType implements editorCommon.IEditorContribution { } if (isNonEmptyArray(edits)) { - FormattingEdit.execute(this._editor, edits); + FormattingEdit.execute(this._editor, edits, true); alertFormattingEdits(edits); } @@ -149,7 +150,7 @@ class FormatOnType implements editorCommon.IEditorContribution { } } -class FormatOnPaste implements editorCommon.IEditorContribution { +class FormatOnPaste implements IEditorContribution { public static readonly ID = 'editor.contrib.formatOnPaste'; @@ -191,7 +192,7 @@ class FormatOnPaste implements editorCommon.IEditorContribution { return; } - this._callOnModel.add(this.editor.onDidPaste(range => this._trigger(range))); + this._callOnModel.add(this.editor.onDidPaste(({ range }) => this._trigger(range))); } private _trigger(range: Range): void { @@ -219,7 +220,7 @@ class FormatDocumentAction extends EditorAction { linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I }, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { when: EditorContextKeys.hasDocumentFormattingProvider, group: '1_modification', order: 1.3 @@ -230,7 +231,7 @@ class FormatDocumentAction extends EditorAction { async run(accessor: ServicesAccessor, editor: ICodeEditor): Promise { if (editor.hasModel()) { const instaService = accessor.get(IInstantiationService); - await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, FormattingMode.Explicit, CancellationToken.None); + await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, FormattingMode.Explicit, Progress.None, CancellationToken.None); } } } @@ -248,7 +249,7 @@ class FormatSelectionAction extends EditorAction { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F), weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection), group: '1_modification', order: 1.31 diff --git a/src/vs/editor/contrib/format/formattingEdit.ts b/src/vs/editor/contrib/format/formattingEdit.ts index 27dbbd0676231..cabb0a73d7a57 100644 --- a/src/vs/editor/contrib/format/formattingEdit.ts +++ b/src/vs/editor/contrib/format/formattingEdit.ts @@ -43,8 +43,10 @@ export class FormattingEdit { return fullModelRange.equalsRange(editRange); } - static execute(editor: ICodeEditor, _edits: TextEdit[]) { - editor.pushUndoStop(); + static execute(editor: ICodeEditor, _edits: TextEdit[], addUndoStops: boolean) { + if (addUndoStops) { + editor.pushUndoStop(); + } const edits = FormattingEdit._handleEolEdits(editor, _edits); if (edits.length === 1 && FormattingEdit._isFullModelReplaceEdit(editor, edits[0])) { // We use replace semantics and hope that markers stay put... @@ -52,6 +54,8 @@ export class FormattingEdit { } else { editor.executeEdits('formatEditsCommand', edits.map(edit => EditOperation.replaceMove(Range.lift(edit.range), edit.text))); } - editor.pushUndoStop(); + if (addUndoStops) { + editor.pushUndoStop(); + } } } diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 10cff5b6510f5..0de7e22fdb519 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -12,7 +12,7 @@ import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/cont import { IMarker, IMarkerService, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, IActionOptions, EditorAction, EditorCommand, registerEditorCommand } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IThemeService } from 'vs/platform/theme/common/themeService'; @@ -27,6 +27,8 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { Action } from 'vs/base/common/actions'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { isEqual } from 'vs/base/common/resources'; +import { IOpenerService } from 'vs/platform/opener/common/opener'; +import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'; class MarkerModel { @@ -43,7 +45,7 @@ class MarkerModel { this._markers = []; this._nextIdx = -1; this._ignoreSelectionChange = false; - this._onCurrentMarkerChanged = new Emitter(); + this._onCurrentMarkerChanged = new Emitter(); this._onMarkerSetChanged = new Emitter(); this.setMarkers(markers); @@ -189,7 +191,7 @@ class MarkerModel { } } -export class MarkerController implements editorCommon.IEditorContribution { +export class MarkerController implements IEditorContribution { public static readonly ID = 'editor.contrib.markerController'; @@ -209,7 +211,8 @@ export class MarkerController implements editorCommon.IEditorContribution { @IContextKeyService private readonly _contextKeyService: IContextKeyService, @IThemeService private readonly _themeService: IThemeService, @ICodeEditorService private readonly _editorService: ICodeEditorService, - @IKeybindingService private readonly _keybindingService: IKeybindingService + @IKeybindingService private readonly _keybindingService: IKeybindingService, + @IOpenerService private readonly _openerService: IOpenerService ) { this._editor = editor; this._widgetVisible = CONTEXT_MARKERS_NAVIGATION_VISIBLE.bindTo(this._contextKeyService); @@ -240,10 +243,10 @@ export class MarkerController implements editorCommon.IEditorContribution { const prevMarkerKeybinding = this._keybindingService.lookupKeybinding(PrevMarkerAction.ID); const nextMarkerKeybinding = this._keybindingService.lookupKeybinding(NextMarkerAction.ID); const actions = [ - new Action(PrevMarkerAction.ID, PrevMarkerAction.LABEL + (prevMarkerKeybinding ? ` (${prevMarkerKeybinding.getLabel()})` : ''), 'show-previous-problem codicon-chevron-up', this._model.canNavigate(), async () => { if (this._model) { this._model.move(false, true); } }), - new Action(NextMarkerAction.ID, NextMarkerAction.LABEL + (nextMarkerKeybinding ? ` (${nextMarkerKeybinding.getLabel()})` : ''), 'show-next-problem codicon-chevron-down', this._model.canNavigate(), async () => { if (this._model) { this._model.move(true, true); } }) + new Action(NextMarkerAction.ID, NextMarkerAction.LABEL + (nextMarkerKeybinding ? ` (${nextMarkerKeybinding.getLabel()})` : ''), 'show-next-problem codicon-chevron-down', this._model.canNavigate(), async () => { if (this._model) { this._model.move(true, true); } }), + new Action(PrevMarkerAction.ID, PrevMarkerAction.LABEL + (prevMarkerKeybinding ? ` (${prevMarkerKeybinding.getLabel()})` : ''), 'show-previous-problem codicon-chevron-up', this._model.canNavigate(), async () => { if (this._model) { this._model.move(false, true); } }) ]; - this._widget = new MarkerNavigationWidget(this._editor, actions, this._themeService); + this._widget = new MarkerNavigationWidget(this._editor, actions, this._themeService, this._openerService); this._widgetVisible.set(true); this._widget.onDidClose(() => this.closeMarkersNavigation(), this, this._disposeOnClose); @@ -301,7 +304,7 @@ export class MarkerController implements editorCommon.IEditorContribution { model.currentMarker = marker; } - private _onMarkerChanged(changedResources: URI[]): void { + private _onMarkerChanged(changedResources: readonly URI[]): void { const editorModel = this._editor.getModel(); if (!editorModel) { return; @@ -394,7 +397,7 @@ class MarkerNavigationAction extends EditorAction { return editorService.openCodeEditor({ resource: newMarker.resource, - options: { pinned: false, revealIfOpened: true, revealInCenterIfOutsideViewport: true, selection: newMarker } + options: { pinned: false, revealIfOpened: true, selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport, selection: newMarker } }, editor).then(editor => { if (!editor) { return undefined; @@ -424,7 +427,7 @@ export class NextMarkerAction extends MarkerNavigationAction { label: NextMarkerAction.LABEL, alias: 'Go to Next Problem (Error, Warning, Info)', precondition: EditorContextKeys.writable, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib } + kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib } }); } } @@ -438,7 +441,7 @@ class PrevMarkerAction extends MarkerNavigationAction { label: PrevMarkerAction.LABEL, alias: 'Go to Previous Problem (Error, Warning, Info)', precondition: EditorContextKeys.writable, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib } + kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F8, weight: KeybindingWeight.EditorContrib } }); } } diff --git a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts index 224b24b56e9be..68f5f944373b2 100644 --- a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts +++ b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts @@ -26,6 +26,7 @@ import { IAction } from 'vs/base/common/actions'; import { IActionBarOptions, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; import { SeverityIcon } from 'vs/platform/severityIcon/common/severityIcon'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { IOpenerService } from 'vs/platform/opener/common/opener'; class MessageWidget { @@ -39,7 +40,14 @@ class MessageWidget { private readonly _relatedDiagnostics = new WeakMap(); private readonly _disposables: DisposableStore = new DisposableStore(); - constructor(parent: HTMLElement, editor: ICodeEditor, onRelatedInformation: (related: IRelatedInformation) => void) { + private _codeLink?: HTMLElement; + + constructor( + parent: HTMLElement, + editor: ICodeEditor, + onRelatedInformation: (related: IRelatedInformation) => void, + private readonly _openerService: IOpenerService, + ) { this._editor = editor; const domNode = document.createElement('div'); @@ -81,12 +89,20 @@ class MessageWidget { } update({ source, message, relatedInformation, code }: IMarker): void { + let sourceAndCodeLength = (source?.length || 0) + '()'.length; + if (code) { + if (typeof code === 'string') { + sourceAndCodeLength += code.length; + } else { + sourceAndCodeLength += code.value.length; + } + } const lines = message.split(/\r\n|\r|\n/g); this._lines = lines.length; this._longestLineLength = 0; for (const line of lines) { - this._longestLineLength = Math.max(line.length, this._longestLineLength); + this._longestLineLength = Math.max(line.length + sourceAndCodeLength, this._longestLineLength); } dom.clearNode(this._messageBlock); @@ -111,10 +127,25 @@ class MessageWidget { detailsElement.appendChild(sourceElement); } if (code) { - const codeElement = document.createElement('span'); - codeElement.innerText = `(${code})`; - dom.addClass(codeElement, 'code'); - detailsElement.appendChild(codeElement); + if (typeof code === 'string') { + const codeElement = document.createElement('span'); + codeElement.innerText = `(${code})`; + dom.addClass(codeElement, 'code'); + detailsElement.appendChild(codeElement); + } else { + this._codeLink = dom.$('a.code-link'); + this._codeLink.setAttribute('href', `${code.target.toString()}`); + + this._codeLink.onclick = (e) => { + this._openerService.open(code.target); + e.preventDefault(); + e.stopPropagation(); + }; + + const codeElement = dom.append(this._codeLink, dom.$('span')); + codeElement.innerText = code.value; + detailsElement.appendChild(this._codeLink); + } } } @@ -180,7 +211,8 @@ export class MarkerNavigationWidget extends PeekViewWidget { constructor( editor: ICodeEditor, private readonly actions: ReadonlyArray, - private readonly _themeService: IThemeService + private readonly _themeService: IThemeService, + private readonly _openerService: IOpenerService ) { super(editor, { showArrow: true, showFrame: true, isAccessible: true }); this._severity = MarkerSeverity.Warning; @@ -228,7 +260,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { protected _fillHead(container: HTMLElement): void { super._fillHead(container); - this._actionbarWidget!.push(this.actions, { label: false, icon: true }); + this._actionbarWidget!.push(this.actions, { label: false, icon: true, index: 0 }); } protected _fillTitleIcon(container: HTMLElement): void { @@ -237,7 +269,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { protected _getActionBarOptions(): IActionBarOptions { return { - orientation: ActionsOrientation.HORIZONTAL_REVERSE + orientation: ActionsOrientation.HORIZONTAL }; } @@ -250,7 +282,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { this._container = document.createElement('div'); container.appendChild(this._container); - this._message = new MessageWidget(this._container, this.editor, related => this._onDidSelectRelatedInformation.fire(related)); + this._message = new MessageWidget(this._container, this.editor, related => this._onDidSelectRelatedInformation.fire(related), this._openerService); this._disposables.add(this._message); } @@ -285,6 +317,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { this._icon.className = `codicon ${SeverityIcon.className(MarkerSeverity.toSeverity(this._severity))}`; this.editor.revealPositionInCenter(position, ScrollType.Smooth); + this.editor.focus(); } updateMarker(marker: IMarker): void { @@ -329,8 +362,9 @@ export const editorMarkerNavigationInfo = registerColor('editorMarkerNavigationI export const editorMarkerNavigationBackground = registerColor('editorMarkerNavigation.background', { dark: '#2D2D30', light: Color.white, hc: '#0C141F' }, nls.localize('editorMarkerNavigationBackground', 'Editor marker navigation widget background.')); registerThemingParticipant((theme, collector) => { - const link = theme.getColor(textLinkForeground); - if (link) { - collector.addRule(`.monaco-editor .marker-widget a { color: ${link}; }`); + const linkFg = theme.getColor(textLinkForeground); + if (linkFg) { + collector.addRule(`.monaco-editor .marker-widget a { color: ${linkFg}; }`); + collector.addRule(`.monaco-editor .marker-widget a.code-link span:hover { color: ${linkFg}; }`); } }); diff --git a/src/vs/editor/contrib/gotoError/media/gotoErrorWidget.css b/src/vs/editor/contrib/gotoError/media/gotoErrorWidget.css index ee02594a087c5..c748c365bdca2 100644 --- a/src/vs/editor/contrib/gotoError/media/gotoErrorWidget.css +++ b/src/vs/editor/contrib/gotoError/media/gotoErrorWidget.css @@ -45,10 +45,27 @@ } .monaco-editor .marker-widget .descriptioncontainer .message .source, -.monaco-editor .marker-widget .descriptioncontainer .message .code { +.monaco-editor .marker-widget .descriptioncontainer .message span.code { opacity: 0.6; } +.monaco-editor .marker-widget .descriptioncontainer .message a.code-link { + opacity: 0.6; + color: inherit; +} +.monaco-editor .marker-widget .descriptioncontainer .message a.code-link:before { + content: '('; +} +.monaco-editor .marker-widget .descriptioncontainer .message a.code-link:after { + content: ')'; +} +.monaco-editor .marker-widget .descriptioncontainer .message a.code-link > span { + text-decoration: underline; + /** Hack to force underline to show **/ + border-bottom: 1px solid transparent; + text-underline-position: under; +} + .monaco-editor .marker-widget .descriptioncontainer .filename { cursor: pointer; } diff --git a/src/vs/editor/contrib/gotoSymbol/goToCommands.ts b/src/vs/editor/contrib/gotoSymbol/goToCommands.ts index 5ec0555a5efbe..86ffdbf79a1e9 100644 --- a/src/vs/editor/contrib/gotoSymbol/goToCommands.ts +++ b/src/vs/editor/contrib/gotoSymbol/goToCommands.ts @@ -21,21 +21,31 @@ import { PeekContext } from 'vs/editor/contrib/peekView/peekView'; import { ReferencesController } from 'vs/editor/contrib/gotoSymbol/peek/referencesController'; import { ReferencesModel } from 'vs/editor/contrib/gotoSymbol/referencesModel'; import * as nls from 'vs/nls'; -import { MenuId } from 'vs/platform/actions/common/actions'; +import { MenuId, MenuRegistry, ISubmenuItem } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IEditorProgressService } from 'vs/platform/progress/common/progress'; import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition, getDeclarationsAtPosition, getReferencesAtPosition } from './goToSymbol'; -import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; import { EditorStateCancellationTokenSource, CodeEditorStateFlag } from 'vs/editor/browser/core/editorState'; import { ISymbolNavigationService } from 'vs/editor/contrib/gotoSymbol/symbolNavigation'; import { EditorOption, GoToLocationValues } from 'vs/editor/common/config/editorOptions'; import { isStandalone } from 'vs/base/browser/browser'; import { URI } from 'vs/base/common/uri'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { ScrollType } from 'vs/editor/common/editorCommon'; +import { ScrollType, IEditorAction } from 'vs/editor/common/editorCommon'; import { assertType } from 'vs/base/common/types'; +import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; +import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'; + + +MenuRegistry.appendMenuItem(MenuId.EditorContext, { + submenu: MenuId.EditorContextPeek, + title: nls.localize('peek.submenu', "Peek"), + group: 'navigation', + order: 100 +}); export interface SymbolNavigationActionConfig { openToSide: boolean; @@ -74,8 +84,15 @@ abstract class SymbolNavigationAction extends EditorAction { alert(references.ariaMessage); + let altAction: IEditorAction | null | undefined; + if (references.referenceAt(model.uri, pos)) { + const altActionId = this._getAlternativeCommand(editor); + if (altActionId !== this.id) { + altAction = editor.getAction(altActionId); + } + } + const referenceCount = references.references.length; - const altAction = references.referenceAt(model.uri, pos) && editor.getAction(this._getAlternativeCommand()); if (referenceCount === 0) { // no result -> show message @@ -107,20 +124,21 @@ abstract class SymbolNavigationAction extends EditorAction { protected abstract _getNoResultFoundMessage(info: IWordAtPosition | null): string; - protected abstract _getAlternativeCommand(): string; + protected abstract _getAlternativeCommand(editor: IActiveCodeEditor): string; protected abstract _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues; private async _onResult(editorService: ICodeEditorService, symbolNavService: ISymbolNavigationService, editor: IActiveCodeEditor, model: ReferencesModel): Promise { const gotoLocation = this._getGoToPreference(editor); - if (this._configuration.openInPeek || (gotoLocation === 'peek' && model.references.length > 1)) { + if (!(editor instanceof EmbeddedCodeEditorWidget) && (this._configuration.openInPeek || (gotoLocation === 'peek' && model.references.length > 1))) { this._openInPeek(editor, model); } else { const next = model.firstReference()!; - const targetEditor = await this._openReference(editor, editorService, next, this._configuration.openToSide); - if (targetEditor && model.references.length > 1 && gotoLocation === 'gotoAndPeek') { + const peek = model.references.length > 1 && gotoLocation === 'gotoAndPeek'; + const targetEditor = await this._openReference(editor, editorService, next, this._configuration.openToSide, !peek); + if (peek && targetEditor) { this._openInPeek(targetEditor, model); } else { model.dispose(); @@ -134,9 +152,9 @@ abstract class SymbolNavigationAction extends EditorAction { } } - private _openReference(editor: ICodeEditor, editorService: ICodeEditorService, reference: Location | LocationLink, sideBySide: boolean): Promise { + private async _openReference(editor: ICodeEditor, editorService: ICodeEditorService, reference: Location | LocationLink, sideBySide: boolean, highlight: boolean): Promise { // range is the target-selection-range when we have one - // and the the fallback is the 'full' range + // and the fallback is the 'full' range let range: IRange | undefined = undefined; if (isLocationLink(reference)) { range = reference.targetSelectionRange; @@ -145,13 +163,29 @@ abstract class SymbolNavigationAction extends EditorAction { range = reference.range; } - return editorService.openCodeEditor({ + const targetEditor = await editorService.openCodeEditor({ resource: reference.uri, options: { selection: Range.collapseToStart(range), - revealInCenterIfOutsideViewport: true + selectionRevealType: TextEditorSelectionRevealType.NearTopIfOutsideViewport } }, editor, sideBySide); + + if (!targetEditor) { + return undefined; + } + + if (highlight) { + const modelNow = targetEditor.getModel(); + const ids = targetEditor.deltaDecorations([], [{ range, options: { className: 'symbolHighlight' } }]); + setTimeout(() => { + if (targetEditor.getModel() === modelNow) { + targetEditor.deltaDecorations(ids, []); + } + }, 350); + } + + return targetEditor; } private _openInPeek(target: ICodeEditor, model: ReferencesModel) { @@ -178,8 +212,8 @@ export class DefinitionAction extends SymbolNavigationAction { : nls.localize('generic.noResults', "No definition found"); } - protected _getAlternativeCommand(): string { - return 'editor.action.goToReferences'; + protected _getAlternativeCommand(editor: IActiveCodeEditor): string { + return editor.getOption(EditorOption.gotoLocation).alternativeDefinitionCommand; } protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues { @@ -212,11 +246,11 @@ registerEditorAction(class GoToDefinitionAction extends DefinitionAction { primary: goToDefinitionKb, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: 'navigation', order: 1.1 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarGoMenu, group: '4_symbol_nav', order: 2, @@ -276,6 +310,11 @@ registerEditorAction(class PeekDefinitionAction extends DefinitionAction { primary: KeyMod.Alt | KeyCode.F12, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 }, weight: KeybindingWeight.EditorContrib + }, + contextMenuOpts: { + menuId: MenuId.EditorContextPeek, + group: 'peek', + order: 2 } }); CommandsRegistry.registerCommandAlias('editor.action.previewDeclaration', PeekDefinitionAction.id); @@ -298,8 +337,8 @@ class DeclarationAction extends SymbolNavigationAction { : nls.localize('decl.generic.noResults', "No declaration found"); } - protected _getAlternativeCommand(): string { - return 'editor.action.goToReferences'; + protected _getAlternativeCommand(editor: IActiveCodeEditor): string { + return editor.getOption(EditorOption.gotoLocation).alternativeDeclarationCommand; } protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues { @@ -324,11 +363,11 @@ registerEditorAction(class GoToDeclarationAction extends DeclarationAction { EditorContextKeys.hasDeclarationProvider, EditorContextKeys.isInEmbeddedEditor.toNegated() ), - menuOpts: { + contextMenuOpts: { group: 'navigation', order: 1.3 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarGoMenu, group: '4_symbol_nav', order: 3, @@ -359,6 +398,11 @@ registerEditorAction(class PeekDeclarationAction extends DeclarationAction { PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated() ), + contextMenuOpts: { + menuId: MenuId.EditorContextPeek, + group: 'peek', + order: 3 + } }); } }); @@ -379,8 +423,8 @@ class TypeDefinitionAction extends SymbolNavigationAction { : nls.localize('goToTypeDefinition.generic.noResults', "No type definition found"); } - protected _getAlternativeCommand(): string { - return 'editor.action.goToReferences'; + protected _getAlternativeCommand(editor: IActiveCodeEditor): string { + return editor.getOption(EditorOption.gotoLocation).alternativeTypeDefinitionCommand; } protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues { @@ -409,11 +453,11 @@ registerEditorAction(class GoToTypeDefinitionAction extends TypeDefinitionAction primary: 0, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: 'navigation', order: 1.4 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarGoMenu, group: '4_symbol_nav', order: 3, @@ -440,7 +484,12 @@ registerEditorAction(class PeekTypeDefinitionAction extends TypeDefinitionAction EditorContextKeys.hasTypeDefinitionProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated() - ) + ), + contextMenuOpts: { + menuId: MenuId.EditorContextPeek, + group: 'peek', + order: 4 + } }); } }); @@ -461,12 +510,12 @@ class ImplementationAction extends SymbolNavigationAction { : nls.localize('goToImplementation.generic.noResults', "No implementation found"); } - protected _getAlternativeCommand(): string { - return ''; + protected _getAlternativeCommand(editor: IActiveCodeEditor): string { + return editor.getOption(EditorOption.gotoLocation).alternativeImplementationCommand; } protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues { - return editor.getOption(EditorOption.gotoLocation).multipleImplemenations; + return editor.getOption(EditorOption.gotoLocation).multipleImplementations; } } @@ -491,13 +540,13 @@ registerEditorAction(class GoToImplementationAction extends ImplementationAction primary: KeyMod.CtrlCmd | KeyCode.F12, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarGoMenu, group: '4_symbol_nav', order: 4, title: nls.localize({ key: 'miGotoImplementation', comment: ['&& denotes a mnemonic'] }, "Go to &&Implementations") }, - menuOpts: { + contextMenuOpts: { group: 'navigation', order: 1.45 } @@ -527,6 +576,11 @@ registerEditorAction(class PeekImplementationAction extends ImplementationAction kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12, weight: KeybindingWeight.EditorContrib + }, + contextMenuOpts: { + menuId: MenuId.EditorContextPeek, + group: 'peek', + order: 5 } }); } @@ -536,11 +590,7 @@ registerEditorAction(class PeekImplementationAction extends ImplementationAction //#region --- REFERENCES -class ReferencesAction extends SymbolNavigationAction { - - protected async _getLocationModel(model: ITextModel, position: corePosition.Position, token: CancellationToken): Promise { - return new ReferencesModel(await getReferencesAtPosition(model, position, token), nls.localize('ref.title', 'References')); - } +abstract class ReferencesAction extends SymbolNavigationAction { protected _getNoResultFoundMessage(info: IWordAtPosition | null): string { return info @@ -548,8 +598,8 @@ class ReferencesAction extends SymbolNavigationAction { : nls.localize('references.noGeneric', "No references found"); } - protected _getAlternativeCommand(): string { - return ''; + protected _getAlternativeCommand(editor: IActiveCodeEditor): string { + return editor.getOption(EditorOption.gotoLocation).alternativeReferenceCommand; } protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues { @@ -578,11 +628,11 @@ registerEditorAction(class GoToReferencesAction extends ReferencesAction { primary: KeyMod.Shift | KeyCode.F12, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: 'navigation', order: 1.45 }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarGoMenu, group: '4_symbol_nav', order: 5, @@ -590,6 +640,10 @@ registerEditorAction(class GoToReferencesAction extends ReferencesAction { }, }); } + + protected async _getLocationModel(model: ITextModel, position: corePosition.Position, token: CancellationToken): Promise { + return new ReferencesModel(await getReferencesAtPosition(model, position, true, token), nls.localize('ref.title', 'References')); + } }); registerEditorAction(class PeekReferencesAction extends ReferencesAction { @@ -607,9 +661,18 @@ registerEditorAction(class PeekReferencesAction extends ReferencesAction { EditorContextKeys.hasReferenceProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated() - ) + ), + contextMenuOpts: { + menuId: MenuId.EditorContextPeek, + group: 'peek', + order: 6 + } }); } + + protected async _getLocationModel(model: ITextModel, position: corePosition.Position, token: CancellationToken): Promise { + return new ReferencesModel(await getReferencesAtPosition(model, position, false, token), nls.localize('ref.title', 'References')); + } }); //#endregion @@ -620,14 +683,11 @@ registerEditorAction(class PeekReferencesAction extends ReferencesAction { class GenericGoToLocationAction extends SymbolNavigationAction { constructor( + config: SymbolNavigationActionConfig, private readonly _references: Location[], - private readonly _gotoMultipleBehaviour: GoToLocationValues | undefined + private readonly _gotoMultipleBehaviour: GoToLocationValues | undefined, ) { - super({ - muteMessage: true, - openInPeek: false, - openToSide: false - }, { + super(config, { id: 'editor.action.goToLocation', label: nls.localize('label.generic', "Go To Any Symbol"), alias: 'Go To Any Symbol', @@ -664,11 +724,12 @@ CommandsRegistry.registerCommand({ { name: 'multiple', description: 'Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto' }, ] }, - handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any) => { + handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any, openInPeek?: boolean) => { assertType(URI.isUri(resource)); assertType(corePosition.Position.isIPosition(position)); assertType(Array.isArray(references)); assertType(typeof multiple === 'undefined' || typeof multiple === 'string'); + assertType(typeof openInPeek === 'undefined' || typeof openInPeek === 'boolean'); const editorService = accessor.get(ICodeEditorService); const editor = await editorService.openCodeEditor({ resource }, editorService.getFocusedCodeEditor()); @@ -678,13 +739,29 @@ CommandsRegistry.registerCommand({ editor.revealPositionInCenterIfOutsideViewport(position, ScrollType.Smooth); return editor.invokeWithinContext(accessor => { - const command = new GenericGoToLocationAction(references, multiple as GoToLocationValues); + const command = new GenericGoToLocationAction({ muteMessage: true, openInPeek: Boolean(openInPeek), openToSide: false }, references, multiple as GoToLocationValues); accessor.get(IInstantiationService).invokeFunction(command.run.bind(command), editor); }); } } }); +CommandsRegistry.registerCommand({ + id: 'editor.action.peekLocations', + description: { + description: 'Peek locations from a position in a file', + args: [ + { name: 'uri', description: 'The text document in which to start', constraint: URI }, + { name: 'position', description: 'The position at which to start', constraint: corePosition.Position.isIPosition }, + { name: 'locations', description: 'An array of locations.', constraint: Array }, + { name: 'multiple', description: 'Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto' }, + ] + }, + handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any) => { + accessor.get(ICommandService).executeCommand('editor.action.goToLocations', resource, position, references, multiple, true); + } +}); + //#endregion @@ -707,7 +784,7 @@ CommandsRegistry.registerCommand({ return undefined; } - const references = createCancelablePromise(token => getReferencesAtPosition(control.getModel(), corePosition.Position.lift(position), token).then(references => new ReferencesModel(references, nls.localize('ref.title', 'References')))); + const references = createCancelablePromise(token => getReferencesAtPosition(control.getModel(), corePosition.Position.lift(position), false, token).then(references => new ReferencesModel(references, nls.localize('ref.title', 'References')))); const range = new Range(position.lineNumber, position.column, position.lineNumber, position.column); return Promise.resolve(controller.toggleWidget(range, references, false)); }); @@ -715,6 +792,6 @@ CommandsRegistry.registerCommand({ }); // use NEW command -CommandsRegistry.registerCommandAlias('editor.action.showReferences', 'editor.action.goToLocations'); +CommandsRegistry.registerCommandAlias('editor.action.showReferences', 'editor.action.peekLocations'); //#endregion diff --git a/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts b/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts index 05a509e7c8c97..e3e7ec687d567 100644 --- a/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts +++ b/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts @@ -3,10 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { flatten, coalesce } from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; -import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { ITextModel } from 'vs/editor/common/model'; import { LocationLink, DefinitionProviderRegistry, ImplementationProviderRegistry, TypeDefinitionProviderRegistry, DeclarationProviderRegistry, ProviderResult, ReferenceProviderRegistry } from 'vs/editor/common/modes'; @@ -28,9 +27,18 @@ function getLocationLinks( return undefined; }); }); - return Promise.all(promises) - .then(flatten) - .then(coalesce); + + return Promise.all(promises).then(values => { + const result: LocationLink[] = []; + for (let value of values) { + if (Array.isArray(value)) { + result.push(...value); + } else if (value) { + result.push(value); + } + } + return result; + }); } @@ -58,10 +66,10 @@ export function getTypeDefinitionsAtPosition(model: ITextModel, position: Positi }); } -export function getReferencesAtPosition(model: ITextModel, position: Position, token: CancellationToken): Promise { +export function getReferencesAtPosition(model: ITextModel, position: Position, compact: boolean, token: CancellationToken): Promise { return getLocationLinks(model, position, ReferenceProviderRegistry, async (provider, model, position) => { const result = await provider.provideReferences(model, position, { includeDeclaration: true }, token); - if (!result || result.length !== 2) { + if (!compact || !result || result.length !== 2) { return result; } const resultWithoutDeclaration = await provider.provideReferences(model, position, { includeDeclaration: false }, token); @@ -72,8 +80,8 @@ export function getReferencesAtPosition(model: ITextModel, position: Position, t }); } -registerDefaultLanguageCommand('_executeDefinitionProvider', (model, position) => getDefinitionsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeDeclarationProvider', (model, position) => getDeclarationsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeImplementationProvider', (model, position) => getImplementationsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeTypeDefinitionProvider', (model, position) => getTypeDefinitionsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeReferenceProvider', (model, position) => getReferencesAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeDefinitionProvider', (model, position) => getDefinitionsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeDeclarationProvider', (model, position) => getDeclarationsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeImplementationProvider', (model, position) => getImplementationsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeTypeDefinitionProvider', (model, position) => getTypeDefinitionsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeReferenceProvider', (model, position) => getReferencesAtPosition(model, position, false, CancellationToken.None)); diff --git a/src/vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition.ts b/src/vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition.ts index 240bf4c52df2b..a2ac8275f3790 100644 --- a/src/vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition.ts +++ b/src/vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition.ts @@ -11,7 +11,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { MarkdownString } from 'vs/base/common/htmlContent'; import { IModeService } from 'vs/editor/common/services/modeService'; import { Range, IRange } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { DefinitionProviderRegistry, LocationLink } from 'vs/editor/common/modes'; import { ICodeEditor, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; @@ -27,8 +27,12 @@ import { IWordAtPosition, IModelDeltaDecoration, ITextModel, IFoundBracket } fro import { Position } from 'vs/editor/common/core/position'; import { withNullAsUndefined } from 'vs/base/common/types'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { PeekContext } from 'vs/editor/contrib/peekView/peekView'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -export class GotoDefinitionAtPositionEditorContribution implements editorCommon.IEditorContribution { +export class GotoDefinitionAtPositionEditorContribution implements IEditorContribution { public static readonly ID = 'editor.contrib.gotodefinitionatposition'; static readonly MAX_SOURCE_PREVIEW_LINES = 8; @@ -334,8 +338,17 @@ export class GotoDefinitionAtPositionEditorContribution implements editorCommon. private gotoDefinition(position: Position, openToSide: boolean): Promise { this.editor.setPosition(position); - const action = new DefinitionAction({ openToSide, openInPeek: false, muteMessage: true }, { alias: '', label: '', id: '', precondition: undefined }); - return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor)); + const definitionLinkOpensInPeek = this.editor.getOption(EditorOption.definitionLinkOpensInPeek); + return this.editor.invokeWithinContext((accessor) => { + const canPeek = definitionLinkOpensInPeek && !this.isInPeekEditor(accessor); + const action = new DefinitionAction({ openToSide, openInPeek: canPeek, muteMessage: true }, { alias: '', label: '', id: '', precondition: undefined }); + return action.run(accessor, this.editor); + }); + } + + private isInPeekEditor(accessor: ServicesAccessor): boolean | undefined { + const contextKeyService = accessor.get(IContextKeyService); + return PeekContext.inPeekEditor.getValue(contextKeyService); } public dispose(): void { diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts index 4d22101b994b4..5d63164bab5fb 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts @@ -11,7 +11,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati import { IContextKey, IContextKeyService, RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ReferencesModel, OneReference } from '../referencesModel'; import { ReferenceWidget, LayoutData } from './referencesWidget'; @@ -23,11 +23,13 @@ import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async import { getOuterEditor, PeekContext } from 'vs/editor/contrib/peekView/peekView'; import { IListService, WorkbenchListFocusContextKey } from 'vs/platform/list/browser/listService'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; +import { KeyCode, KeyMod, KeyChord } from 'vs/base/common/keyCodes'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { EditorOption } from 'vs/editor/common/config/editorOptions'; export const ctxReferenceSearchVisible = new RawContextKey('referenceSearchVisible', false); -export abstract class ReferencesController implements editorCommon.IEditorContribution { +export abstract class ReferencesController implements IEditorContribution { static readonly ID = 'editor.contrib.referencesController'; @@ -162,7 +164,11 @@ export abstract class ReferencesController implements editorCommon.IEditorContri let pos = new Position(range.startLineNumber, range.startColumn); let selection = this._model.nearestReference(uri, pos); if (selection) { - return this._widget.setSelection(selection); + return this._widget.setSelection(selection).then(() => { + if (this._widget && this._editor.getOption(EditorOption.peekWidgetDefaultFocus) === 'editor') { + this._widget.focusOnPreviewEditor(); + } + }); } } return undefined; @@ -173,6 +179,18 @@ export abstract class ReferencesController implements editorCommon.IEditorContri }); } + changeFocusBetweenPreviewAndReferences() { + if (!this._widget) { + // can be called while still resolving... + return; + } + if (this._widget.isPreviewEditorFocused()) { + this._widget.focusOnReferenceTree(); + } else { + this._widget.focusOnPreviewEditor(); + } + } + async goToNextOrPreviousReference(fwd: boolean) { if (!this._editor.hasModel() || !this._model || !this._widget) { // can be called while still resolving... @@ -188,21 +206,26 @@ export abstract class ReferencesController implements editorCommon.IEditorContri } const target = this._model.nextOrPreviousReference(source, fwd); const editorFocus = this._editor.hasTextFocus(); + const previewEditorFocus = this._widget.isPreviewEditorFocused(); await this._widget.setSelection(target); await this._gotoReference(target); if (editorFocus) { this._editor.focus(); + } else if (this._widget && previewEditorFocus) { + this._widget.focusOnPreviewEditor(); } } - closeWidget(): void { + closeWidget(focusEditor = true): void { this._referenceSearchVisible.reset(); this._disposables.clear(); dispose(this._widget); dispose(this._model); this._widget = undefined; this._model = undefined; - this._editor.focus(); + if (focusEditor) { + this._editor.focus(); + } this._requestIdPool += 1; // Cancel pending requests } @@ -229,7 +252,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri if (this._editor === openedEditor) { // this._widget.show(range); - this._widget.focus(); + this._widget.focusOnReferenceTree(); } else { // we opened a different editor instance which means a different controller instance. @@ -279,24 +302,23 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC } KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'goToNextReference', - weight: KeybindingWeight.WorkbenchContrib + 50, - primary: KeyCode.F4, - secondary: [KeyCode.F12], - when: ctxReferenceSearchVisible, + id: 'togglePeekWidgetFocus', + weight: KeybindingWeight.EditorContrib, + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.F2), + when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor), handler(accessor) { withController(accessor, controller => { - controller.goToNextOrPreviousReference(true); + controller.changeFocusBetweenPreviewAndReferences(); }); } }); KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'goToNextReferenceFromEmbeddedEditor', - weight: KeybindingWeight.EditorContrib + 50, + id: 'goToNextReference', + weight: KeybindingWeight.EditorContrib - 10, primary: KeyCode.F4, secondary: [KeyCode.F12], - when: PeekContext.inPeekEditor, + when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor), handler(accessor) { withController(accessor, controller => { controller.goToNextOrPreviousReference(true); @@ -306,23 +328,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToPreviousReference', - weight: KeybindingWeight.WorkbenchContrib + 50, - primary: KeyMod.Shift | KeyCode.F4, - secondary: [KeyMod.Shift | KeyCode.F12], - when: ctxReferenceSearchVisible, - handler(accessor) { - withController(accessor, controller => { - controller.goToNextOrPreviousReference(false); - }); - } -}); - -KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'goToPreviousReferenceFromEmbeddedEditor', - weight: KeybindingWeight.EditorContrib + 50, + weight: KeybindingWeight.EditorContrib - 10, primary: KeyMod.Shift | KeyCode.F4, secondary: [KeyMod.Shift | KeyCode.F12], - when: PeekContext.inPeekEditor, + when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor), handler(accessor) { withController(accessor, controller => { controller.goToNextOrPreviousReference(false); @@ -330,28 +339,32 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } }); -KeybindingsRegistry.registerCommandAndKeybindingRule({ +// commands that aren't needed anymore because there is now ContextKeyExpr.OR +CommandsRegistry.registerCommandAlias('goToNextReferenceFromEmbeddedEditor', 'goToNextReference'); +CommandsRegistry.registerCommandAlias('goToPreviousReferenceFromEmbeddedEditor', 'goToPreviousReference'); + +// close +CommandsRegistry.registerCommandAlias('closeReferenceSearchEditor', 'closeReferenceSearch'); +CommandsRegistry.registerCommand( + 'closeReferenceSearch', + accessor => withController(accessor, controller => controller.closeWidget()) +); +KeybindingsRegistry.registerKeybindingRule({ id: 'closeReferenceSearch', - weight: KeybindingWeight.WorkbenchContrib + 50, + weight: KeybindingWeight.EditorContrib - 101, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], - when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')), - handler(accessor: ServicesAccessor) { - withController(accessor, controller => controller.closeWidget()); - } + when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')) }); - -KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'closeReferenceSearchEditor', - weight: KeybindingWeight.EditorContrib - 101, +KeybindingsRegistry.registerKeybindingRule({ + id: 'closeReferenceSearch', + weight: KeybindingWeight.WorkbenchContrib + 50, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], - when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')), - handler(accessor: ServicesAccessor) { - withController(accessor, controller => controller.closeWidget()); - } + when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')) }); + KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'openReferenceToSide', weight: KeybindingWeight.EditorContrib, @@ -368,3 +381,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } } }); + +CommandsRegistry.registerCommand('openReference', (accessor) => { + const listService = accessor.get(IListService); + const focus = listService.lastFocusedList?.getFocus(); + if (Array.isArray(focus) && focus[0] instanceof OneReference) { + withController(accessor, controller => controller.openReference(focus[0], false)); + } +}); diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts index 82f86384de484..dc6368509b3a1 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts @@ -6,6 +6,7 @@ import 'vs/css!./referencesWidget'; import * as dom from 'vs/base/browser/dom'; import { IMouseEvent } from 'vs/base/browser/mouseEvent'; +import { GestureEvent } from 'vs/base/browser/touch'; import { Orientation } from 'vs/base/browser/ui/sash/sash'; import { Color } from 'vs/base/common/color'; import { Emitter, Event } from 'vs/base/common/event'; @@ -16,7 +17,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IRange, Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ScrollType } from 'vs/editor/common/editorCommon'; import { IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/model'; import { ModelDecorationOptions, TextModel } from 'vs/editor/common/model/textModel'; import { Location } from 'vs/editor/common/modes'; @@ -25,14 +26,14 @@ import { AriaProvider, DataSource, Delegate, FileReferencesRenderer, OneReferenc import * as nls from 'vs/nls'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILabelService } from 'vs/platform/label/common/label'; -import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService'; +import { WorkbenchAsyncDataTree, IWorkbenchAsyncDataTreeOptions } from 'vs/platform/list/browser/listService'; import { activeContrastBorder } from 'vs/platform/theme/common/colorRegistry'; import { ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import * as peekView from 'vs/editor/contrib/peekView/peekView'; import { FileReferences, OneReference, ReferencesModel } from '../referencesModel'; -import { IAsyncDataTreeOptions } from 'vs/base/browser/ui/tree/asyncDataTree'; import { FuzzyScore } from 'vs/base/common/filters'; import { SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview'; +import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; class DecorationsManager implements IDisposable { @@ -181,6 +182,8 @@ export interface SelectionEvent { readonly element?: Location; } +class ReferencesTree extends WorkbenchAsyncDataTree { } + /** * ZoneWidget that is shown inside the editor */ @@ -195,7 +198,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget { private readonly _onDidSelectReference = new Emitter(); readonly onDidSelectReference = this._onDidSelectReference.event; - private _tree!: WorkbenchAsyncDataTree; + private _tree!: ReferencesTree; private _treeContainer!: HTMLElement; private _splitView!: SplitView; private _preview!: ICodeEditor; @@ -213,7 +216,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget { @ITextModelService private readonly _textModelResolverService: ITextModelService, @IInstantiationService private readonly _instantiationService: IInstantiationService, @peekView.IPeekViewService private readonly _peekViewService: peekView.IPeekViewService, - @ILabelService private readonly _uriLabel: ILabelService + @ILabelService private readonly _uriLabel: ILabelService, + @IUndoRedoService private readonly _undoRedoService: IUndoRedoService, ) { super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true }); @@ -247,14 +251,22 @@ export class ReferenceWidget extends peekView.PeekViewWidget { } show(where: IRange) { - this.editor.revealRangeInCenterIfOutsideViewport(where, editorCommon.ScrollType.Smooth); + this.editor.revealRangeInCenterIfOutsideViewport(where, ScrollType.Smooth); super.show(where, this.layoutData.heightInLines || 18); } - focus(): void { + focusOnReferenceTree(): void { this._tree.domFocus(); } + focusOnPreviewEditor(): void { + this._preview.focus(); + } + + isPreviewEditorFocused(): boolean { + return this._preview.hasTextFocus(); + } + protected _onTitleClick(e: IMouseEvent): void { if (this._preview && this._preview.getModel()) { this._onDidSelectReference.fire({ @@ -283,7 +295,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget { horizontal: 'auto', useShadows: true, verticalHasArrows: false, - horizontalHasArrows: false + horizontalHasArrows: false, + alwaysConsumeMouseWheel: false }, overviewRulerLanes: 2, fixedOverflowWidgets: true, @@ -293,19 +306,22 @@ export class ReferenceWidget extends peekView.PeekViewWidget { }; this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewContainer, options, this.editor); dom.hide(this._previewContainer); - this._previewNotAvailableMessage = TextModel.createFromString(nls.localize('missingPreviewMessage', "no preview available")); + this._previewNotAvailableMessage = new TextModel(nls.localize('missingPreviewMessage', "no preview available"), TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService); // tree this._treeContainer = dom.append(containerElement, dom.$('div.ref-tree.inline')); - const treeOptions: IAsyncDataTreeOptions = { + const treeOptions: IWorkbenchAsyncDataTreeOptions = { ariaLabel: nls.localize('treeAriaLabel', "References"), keyboardSupport: this._defaultTreeKeyboardSupport, accessibilityProvider: new AriaProvider(), keyboardNavigationLabelProvider: this._instantiationService.createInstance(StringRepresentationProvider), - identityProvider: new IdentityProvider() + identityProvider: new IdentityProvider(), + overrideStyles: { + listBackground: peekView.peekViewResultsBackground + } }; - this._tree = this._instantiationService.createInstance>( - WorkbenchAsyncDataTree, + this._tree = this._instantiationService.createInstance( + ReferencesTree, 'ReferencesWidget', this._treeContainer, new Delegate(), @@ -314,7 +330,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget { this._instantiationService.createInstance(OneReferenceRenderer), ], this._instantiationService.createInstance(DataSource), - treeOptions + treeOptions, ); // split stuff @@ -362,8 +378,11 @@ export class ReferenceWidget extends peekView.PeekViewWidget { if (e.browserEvent instanceof MouseEvent && (e.browserEvent.ctrlKey || e.browserEvent.metaKey || e.browserEvent.altKey)) { // modifier-click -> open to the side onEvent(e.elements[0], 'side'); - } else if (e.browserEvent instanceof KeyboardEvent || (e.browserEvent instanceof MouseEvent && e.browserEvent.detail === 2)) { - // keybinding (list service command) OR double click -> close widget and goto target + } else if (e.browserEvent instanceof KeyboardEvent || (e.browserEvent instanceof MouseEvent && e.browserEvent.detail === 2) || (e.browserEvent).tapCount === 2) { + // keybinding (list service command) + // OR double click + // OR double tap + // -> close widget and goto target onEvent(e.elements[0], 'goto'); } else { // preview location @@ -451,7 +470,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget { dom.show(this._treeContainer); dom.show(this._previewContainer); this._splitView.layout(this._dim.width); - this.focus(); + this.focusOnReferenceTree(); // pick input and a reference to begin with return this._tree.setInput(this._model.groups.length === 1 ? this._model.groups[0] : this._model); @@ -511,7 +530,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget { // show in editor const model = ref.object; if (model) { - const scrollType = this._preview.getModel() === model.textEditorModel ? editorCommon.ScrollType.Smooth : editorCommon.ScrollType.Immediate; + const scrollType = this._preview.getModel() === model.textEditorModel ? ScrollType.Smooth : ScrollType.Immediate; const sel = Range.lift(reference.range).collapseToStart(); this._previewModelReference = ref; this._preview.setModel(model.textEditorModel); diff --git a/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts b/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts index 9d9bc68a5588f..d082bb98f4314 100644 --- a/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts +++ b/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ReferencesModel, OneReference } from 'vs/editor/contrib/gotoSymbol/referencesModel'; -import { RawContextKey, IContextKeyService, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; @@ -19,6 +19,7 @@ import { localize } from 'vs/nls'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { isEqual } from 'vs/base/common/resources'; +import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'; export const ctxHasSymbols = new RawContextKey('hasSymbols', false); @@ -127,7 +128,7 @@ class SymbolNavigationService implements ISymbolNavigationService { resource: reference.uri, options: { selection: Range.collapseToStart(reference.range), - revealInCenterIfOutsideViewport: true + selectionRevealType: TextEditorSelectionRevealType.NearTopIfOutsideViewport } }, source).finally(() => { this._ignoreEditorChange = false; @@ -155,10 +156,7 @@ registerEditorCommand(new class extends EditorCommand { constructor() { super({ id: 'editor.gotoNextSymbolFromResult', - precondition: ContextKeyExpr.and( - ctxHasSymbols, - ContextKeyExpr.equals('config.editor.gotoLocation.multiple', 'goto') - ), + precondition: ctxHasSymbols, kbOpts: { weight: KeybindingWeight.EditorContrib, primary: KeyCode.F12 diff --git a/src/vs/editor/contrib/hover/getHover.ts b/src/vs/editor/contrib/hover/getHover.ts index d6adae27bdf1c..db914a798ae8c 100644 --- a/src/vs/editor/contrib/hover/getHover.ts +++ b/src/vs/editor/contrib/hover/getHover.ts @@ -6,7 +6,7 @@ import { coalesce } from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; -import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { ITextModel } from 'vs/editor/common/model'; import { Hover, HoverProviderRegistry } from 'vs/editor/common/modes'; @@ -27,7 +27,7 @@ export function getHover(model: ITextModel, position: Position, token: Cancellat return Promise.all(promises).then(coalesce); } -registerDefaultLanguageCommand('_executeHoverProvider', (model, position) => getHover(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeHoverProvider', (model, position) => getHover(model, position, CancellationToken.None)); function isValid(result: Hover) { const hasRange = (typeof result.range !== 'undefined'); diff --git a/src/vs/editor/contrib/hover/hover.css b/src/vs/editor/contrib/hover/hover.css index 3e34dec5e19de..8f35b9aec75b6 100644 --- a/src/vs/editor/contrib/hover/hover.css +++ b/src/vs/editor/contrib/hover/hover.css @@ -29,6 +29,10 @@ word-wrap: break-word; } +.monaco-editor-hover .markdown-hover > .hover-contents:not(.code-hover-contents) hr { + min-width: 100vw; +} + .monaco-editor-hover p, .monaco-editor-hover ul { margin: 8px 0; @@ -100,3 +104,26 @@ .monaco-editor-hover .hover-row.status-bar .actions .action-container .action .icon { padding-right: 4px; } + +.monaco-editor-hover .markdown-hover .hover-contents .codicon { + color: inherit; + font-size: inherit; + vertical-align: middle; +} + +.monaco-editor-hover .hover-contents a.code-link:before { + content: '('; +} +.monaco-editor-hover .hover-contents a.code-link:after { + content: ')'; +} + +.monaco-editor-hover .hover-contents a.code-link { + color: inherit; +} +.monaco-editor-hover .hover-contents a.code-link > span { + text-decoration: underline; + /** Hack to force underline to show **/ + border-bottom: 1px solid transparent; + text-underline-position: under; +} diff --git a/src/vs/editor/contrib/hover/hoverWidgets.ts b/src/vs/editor/contrib/hover/hoverWidgets.ts index 9077e4a9eb0cf..9d55f8340a6d7 100644 --- a/src/vs/editor/contrib/hover/hoverWidgets.ts +++ b/src/vs/editor/contrib/hover/hoverWidgets.ts @@ -19,7 +19,7 @@ export class ContentHoverWidget extends Widget implements IContentWidget { protected _editor: ICodeEditor; private _isVisible: boolean; private readonly _containerDomNode: HTMLElement; - private readonly _domNode: HTMLElement; + protected readonly _domNode: HTMLElement; protected _showAtPosition: Position | null; protected _showAtRange: Range | null; private _stoleFocus: boolean; diff --git a/src/vs/editor/contrib/hover/modesContentHover.ts b/src/vs/editor/contrib/hover/modesContentHover.ts index f37254d776f34..3f03ee3e82156 100644 --- a/src/vs/editor/contrib/hover/modesContentHover.ts +++ b/src/vs/editor/contrib/hover/modesContentHover.ts @@ -13,7 +13,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; -import { DocumentColorProvider, Hover as MarkdownHover, HoverProviderRegistry, IColor } from 'vs/editor/common/modes'; +import { DocumentColorProvider, Hover as MarkdownHover, HoverProviderRegistry, IColor, TokenizationRegistry, CodeActionTriggerType } from 'vs/editor/common/modes'; import { getColorPresentations } from 'vs/editor/contrib/colorPicker/color'; import { ColorDetector } from 'vs/editor/contrib/colorPicker/colorDetector'; import { ColorPickerModel } from 'vs/editor/contrib/colorPicker/colorPickerModel'; @@ -22,7 +22,7 @@ import { getHover } from 'vs/editor/contrib/hover/getHover'; import { HoverOperation, HoverStartMode, IHoverComputer } from 'vs/editor/contrib/hover/hoverOperation'; import { ContentHoverWidget } from 'vs/editor/contrib/hover/hoverWidgets'; import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { coalesce, isNonEmptyArray, asArray } from 'vs/base/common/arrays'; import { IMarker, IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { basename } from 'vs/base/common/resources'; @@ -34,11 +34,13 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; import { getCodeActions, CodeActionSet } from 'vs/editor/contrib/codeAction/codeAction'; import { QuickFixAction, QuickFixController } from 'vs/editor/contrib/codeAction/codeActionCommands'; -import { CodeActionKind } from 'vs/editor/contrib/codeAction/types'; +import { CodeActionKind, CodeActionTrigger } from 'vs/editor/contrib/codeAction/types'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { Constants } from 'vs/base/common/uint'; +import { textLinkForeground } from 'vs/platform/theme/common/colorRegistry'; +import { Progress } from 'vs/platform/progress/common/progress'; const $ = dom.$; @@ -186,6 +188,11 @@ class ModesContentComputer implements IHoverComputer { } } +const markerCodeActionTrigger: CodeActionTrigger = { + type: CodeActionTriggerType.Manual, + filter: { include: CodeActionKind.QuickFix } +}; + export class ModesContentHoverWidget extends ContentHoverWidget { static readonly ID = 'editor.contrib.modesContentHoverWidget'; @@ -199,6 +206,8 @@ export class ModesContentHoverWidget extends ContentHoverWidget { private _shouldFocus: boolean; private _colorPicker: ColorPickerWidget | null; + private _codeLink?: HTMLElement; + private readonly renderDisposable = this._register(new MutableDisposable()); constructor( @@ -207,7 +216,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget { private readonly _themeService: IThemeService, private readonly _keybindingService: IKeybindingService, private readonly _modeService: IModeService, - private readonly _openerService: IOpenerService | null = NullOpenerService, + private readonly _openerService: IOpenerService = NullOpenerService, ) { super(ModesContentHoverWidget.ID, editor); @@ -238,6 +247,12 @@ export class ModesContentHoverWidget extends ContentHoverWidget { this._register(editor.onDidChangeConfiguration((e) => { this._hoverOperation.setHoverTime(this._editor.getOption(EditorOption.hover).delay); })); + this._register(TokenizationRegistry.onDidChange((e) => { + if (this.isVisible && this._lastRange && this._messages.length > 0) { + this._domNode.textContent = ''; + this._renderMessages(this._lastRange, this._messages); + } + })); } dispose(): void { @@ -489,10 +504,35 @@ export class ModesContentHoverWidget extends ContentHoverWidget { messageElement.innerText = message; if (source || code) { - const detailsElement = dom.append(markerElement, $('span')); - detailsElement.style.opacity = '0.6'; - detailsElement.style.paddingLeft = '6px'; - detailsElement.innerText = source && code ? `${source}(${code})` : source ? source : `(${code})`; + if (typeof code === 'string') { + const detailsElement = dom.append(markerElement, $('span')); + detailsElement.style.opacity = '0.6'; + detailsElement.style.paddingLeft = '6px'; + detailsElement.innerText = source && code ? `${source}(${code})` : source ? source : `(${code})`; + } else { + if (code) { + const sourceAndCodeElement = $('span'); + if (source) { + const sourceElement = dom.append(sourceAndCodeElement, $('span')); + sourceElement.innerText = source; + } + this._codeLink = dom.append(sourceAndCodeElement, $('a.code-link')); + this._codeLink.setAttribute('href', code.target.toString()); + + this._codeLink.onclick = (e) => { + this._openerService.open(code.target); + e.preventDefault(); + e.stopPropagation(); + }; + + const codeElement = dom.append(this._codeLink, $('span')); + codeElement.innerText = code.value; + + const detailsElement = dom.append(markerElement, sourceAndCodeElement); + detailsElement.style.opacity = '0.6'; + detailsElement.style.paddingLeft = '6px'; + } + } } if (isNonEmptyArray(relatedInformation)) { @@ -548,7 +588,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget { quickfixPlaceholderElement.style.transition = ''; quickfixPlaceholderElement.style.opacity = '1'; - if (!actions.actions.length) { + if (!actions.validActions.length) { actions.dispose(); quickfixPlaceholderElement.textContent = nls.localize('noQuickFixes', "No quick fixes available"); return; @@ -569,7 +609,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget { showing = true; const controller = QuickFixController.get(this._editor); const elementPosition = dom.getDomNodePagePosition(target); - controller.showCodeActions(actions, { + controller.showCodeActions(markerCodeActionTrigger, actions, { x: elementPosition.left + 6, y: elementPosition.top + elementPosition.height + 6 }); @@ -586,7 +626,8 @@ export class ModesContentHoverWidget extends ContentHoverWidget { return getCodeActions( this._editor.getModel()!, new Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn), - { type: 'manual', filter: { include: CodeActionKind.QuickFix } }, + markerCodeActionTrigger, + Progress.None, cancellationToken); }); } @@ -637,3 +678,11 @@ function hoverContentsEquals(first: HoverPart[], second: HoverPart[]): boolean { } return true; } + +registerThemingParticipant((theme, collector) => { + const linkFg = theme.getColor(textLinkForeground); + if (linkFg) { + collector.addRule(`.monaco-editor-hover .hover-contents a.code-link span:hover { color: ${linkFg}; }`); + } +}); + diff --git a/src/vs/editor/contrib/hover/modesGlyphHover.ts b/src/vs/editor/contrib/hover/modesGlyphHover.ts index 85dece77b64b2..32c6cf146563c 100644 --- a/src/vs/editor/contrib/hover/modesGlyphHover.ts +++ b/src/vs/editor/contrib/hover/modesGlyphHover.ts @@ -97,7 +97,7 @@ export class ModesGlyphHoverWidget extends GlyphHoverWidget { constructor( editor: ICodeEditor, modeService: IModeService, - openerService: IOpenerService | null = NullOpenerService, + openerService: IOpenerService = NullOpenerService, ) { super(ModesGlyphHoverWidget.ID, editor); diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts index a64be8e0109de..0d069f4f6c372 100644 --- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts +++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; -export class InPlaceReplaceCommand implements editorCommon.ICommand { +export class InPlaceReplaceCommand implements ICommand { private readonly _editRange: Range; private readonly _originalSelection: Selection; @@ -20,11 +20,11 @@ export class InPlaceReplaceCommand implements editorCommon.ICommand { this._text = text; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { builder.addTrackedEditOperation(this._editRange, this._text); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { const inverseEditOperations = helper.getInverseEditOperations(); const srcRange = inverseEditOperations[0].range; diff --git a/src/vs/editor/contrib/indentation/indentation.ts b/src/vs/editor/contrib/indentation/indentation.ts index bbddafa5346c4..20280edd6042f 100644 --- a/src/vs/editor/contrib/indentation/indentation.ts +++ b/src/vs/editor/contrib/indentation/indentation.ts @@ -22,7 +22,7 @@ import { IndentConsts } from 'vs/editor/common/modes/supports/indentRules'; import { IModelService } from 'vs/editor/common/services/modelService'; import * as indentUtils from 'vs/editor/contrib/indentation/indentUtils'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; -import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { EditorOption, EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; export function getReindentEditOperations(model: ITextModel, startLineNumber: number, endLineNumber: number, inheritedIndent?: string): IIdentifiedSingleEditOperation[] { if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) { @@ -442,7 +442,7 @@ export class AutoIndentOnPaste implements IEditorContribution { this.callOnModel.clear(); // we are disabled - if (!this.editor.getOption(EditorOption.autoIndent) || this.editor.getOption(EditorOption.formatOnPaste)) { + if (this.editor.getOption(EditorOption.autoIndent) < EditorAutoIndentStrategy.Full || this.editor.getOption(EditorOption.formatOnPaste)) { return; } @@ -451,7 +451,7 @@ export class AutoIndentOnPaste implements IEditorContribution { return; } - this.callOnModel.add(this.editor.onDidPaste((range: Range) => { + this.callOnModel.add(this.editor.onDidPaste(({ range }) => { this.trigger(range); })); } @@ -470,6 +470,7 @@ export class AutoIndentOnPaste implements IEditorContribution { if (!model.isCheapToTokenize(range.getStartPosition().lineNumber)) { return; } + const autoIndent = this.editor.getOption(EditorOption.autoIndent); const { tabSize, indentSize, insertSpaces } = model.getOptions(); this.editor.pushUndoStop(); let textEdits: TextEdit[] = []; @@ -499,7 +500,7 @@ export class AutoIndentOnPaste implements IEditorContribution { let firstLineText = model.getLineContent(startLineNumber); if (!/\S/.test(firstLineText.substring(0, range.startColumn - 1))) { - let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(model, model.getLanguageIdentifier().id, startLineNumber, indentConverter); + let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(autoIndent, model, model.getLanguageIdentifier().id, startLineNumber, indentConverter); if (indentOfFirstLine !== null) { let oldIndentation = strings.getLeadingWhitespace(firstLineText); @@ -557,7 +558,7 @@ export class AutoIndentOnPaste implements IEditorContribution { } } }; - let indentOfSecondLine = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdentifier().id, startLineNumber + 1, indentConverter); + let indentOfSecondLine = LanguageConfigurationRegistry.getGoodIndentForLine(autoIndent, virtualModel, model.getLanguageIdentifier().id, startLineNumber + 1, indentConverter); if (indentOfSecondLine !== null) { let newSpaceCntOfSecondLine = indentUtils.getSpaceCnt(indentOfSecondLine, tabSize); let oldSpaceCntOfSecondLine = indentUtils.getSpaceCnt(strings.getLeadingWhitespace(model.getLineContent(startLineNumber + 1)), tabSize); diff --git a/src/vs/editor/contrib/linesOperations/copyLinesCommand.ts b/src/vs/editor/contrib/linesOperations/copyLinesCommand.ts index 3d20782006186..6b76a75b7632f 100644 --- a/src/vs/editor/contrib/linesOperations/copyLinesCommand.ts +++ b/src/vs/editor/contrib/linesOperations/copyLinesCommand.ts @@ -5,10 +5,10 @@ import { Range } from 'vs/editor/common/core/range'; import { Selection, SelectionDirection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; -export class CopyLinesCommand implements editorCommon.ICommand { +export class CopyLinesCommand implements ICommand { private readonly _selection: Selection; private readonly _isCopyingDown: boolean; @@ -27,7 +27,7 @@ export class CopyLinesCommand implements editorCommon.ICommand { this._endLineNumberDelta = 0; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { let s = this._selection; this._startLineNumberDelta = 0; @@ -61,7 +61,7 @@ export class CopyLinesCommand implements editorCommon.ICommand { this._selectionDirection = this._selection.getDirection(); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { let result = helper.getTrackedSelection(this._selectionId!); if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) { diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts index b615da8257b3a..c9bf8a680564b 100644 --- a/src/vs/editor/contrib/linesOperations/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts @@ -37,12 +37,36 @@ abstract class AbstractCopyLinesAction extends EditorAction { } public run(_accessor: ServicesAccessor, editor: ICodeEditor): void { + if (!editor.hasModel()) { + return; + } - const commands: ICommand[] = []; - const selections = editor.getSelections() || []; + const selections = editor.getSelections().map((selection, index) => ({ selection, index, ignore: false })); + selections.sort((a, b) => Range.compareRangesUsingStarts(a.selection, b.selection)); + + // Remove selections that would result in copying the same line + let prev = selections[0]; + for (let i = 1; i < selections.length; i++) { + const curr = selections[i]; + if (prev.selection.endLineNumber === curr.selection.startLineNumber) { + // these two selections would copy the same line + if (prev.index < curr.index) { + // prev wins + curr.ignore = true; + } else { + // curr wins + prev.ignore = true; + prev = curr; + } + } + } + const commands: ICommand[] = []; for (const selection of selections) { - commands.push(new CopyLinesCommand(selection, this.down)); + if (selection.ignore) { + continue; + } + commands.push(new CopyLinesCommand(selection.selection, this.down)); } editor.pushUndoStop(); @@ -64,7 +88,7 @@ class CopyLinesUpAction extends AbstractCopyLinesAction { linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '2_line', title: nls.localize({ key: 'miCopyLinesUp', comment: ['&& denotes a mnemonic'] }, "&&Copy Line Up"), @@ -87,7 +111,7 @@ class CopyLinesDownAction extends AbstractCopyLinesAction { linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '2_line', title: nls.localize({ key: 'miCopyLinesDown', comment: ['&& denotes a mnemonic'] }, "Co&&py Line Down"), @@ -105,7 +129,7 @@ export class DuplicateSelectionAction extends EditorAction { label: nls.localize('duplicateSelection', "Duplicate Selection"), alias: 'Duplicate Selection', precondition: EditorContextKeys.writable, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '2_line', title: nls.localize({ key: 'miDuplicateSelection', comment: ['&& denotes a mnemonic'] }, "&&Duplicate Selection"), @@ -178,7 +202,7 @@ class MoveLinesUpAction extends AbstractMoveLinesAction { linux: { primary: KeyMod.Alt | KeyCode.UpArrow }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '2_line', title: nls.localize({ key: 'miMoveLinesUp', comment: ['&& denotes a mnemonic'] }, "Mo&&ve Line Up"), @@ -201,7 +225,7 @@ class MoveLinesDownAction extends AbstractMoveLinesAction { linux: { primary: KeyMod.Alt | KeyCode.DownArrow }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '2_line', title: nls.localize({ key: 'miMoveLinesDown', comment: ['&& denotes a mnemonic'] }, "Move &&Line Down"), diff --git a/src/vs/editor/contrib/linesOperations/moveLinesCommand.ts b/src/vs/editor/contrib/linesOperations/moveLinesCommand.ts index f1b0fd7befb50..d9600938cc678 100644 --- a/src/vs/editor/contrib/linesOperations/moveLinesCommand.ts +++ b/src/vs/editor/contrib/linesOperations/moveLinesCommand.ts @@ -13,18 +13,19 @@ import { IndentAction } from 'vs/editor/common/modes/languageConfiguration'; import { IIndentConverter, LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { IndentConsts } from 'vs/editor/common/modes/supports/indentRules'; import * as indentUtils from 'vs/editor/contrib/indentation/indentUtils'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; export class MoveLinesCommand implements ICommand { private readonly _selection: Selection; private readonly _isMovingDown: boolean; - private readonly _autoIndent: boolean; + private readonly _autoIndent: EditorAutoIndentStrategy; private _selectionId: string | null; private _moveEndPositionDown?: boolean; private _moveEndLineSelectionShrink: boolean; - constructor(selection: Selection, isMovingDown: boolean, autoIndent: boolean) { + constructor(selection: Selection, isMovingDown: boolean, autoIndent: EditorAutoIndentStrategy) { this._selection = selection; this._isMovingDown = isMovingDown; this._autoIndent = autoIndent; @@ -117,7 +118,7 @@ export class MoveLinesCommand implements ICommand { return model.getLineContent(lineNumber); } }; - let indentOfMovingLine = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition( + let indentOfMovingLine = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition( movingLineNumber, 1), s.startLineNumber, indentConverter); if (indentOfMovingLine !== null) { let oldIndentation = strings.getLeadingWhitespace(model.getLineContent(movingLineNumber)); @@ -152,7 +153,7 @@ export class MoveLinesCommand implements ICommand { } }; - let newIndentatOfMovingBlock = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition( + let newIndentatOfMovingBlock = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition( movingLineNumber, 1), s.startLineNumber + 1, indentConverter); if (newIndentatOfMovingBlock !== null) { @@ -197,7 +198,7 @@ export class MoveLinesCommand implements ICommand { } } else { // it doesn't match any onEnter rule, let's check indentation rules then. - let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(virtualModel, model.getLanguageIdAtPosition(s.startLineNumber, 1), movingLineNumber, indentConverter); + let indentOfFirstLine = LanguageConfigurationRegistry.getGoodIndentForLine(this._autoIndent, virtualModel, model.getLanguageIdAtPosition(s.startLineNumber, 1), movingLineNumber, indentConverter); if (indentOfFirstLine !== null) { // adjust the indentation of the moving block let oldIndent = strings.getLeadingWhitespace(model.getLineContent(s.startLineNumber)); @@ -251,20 +252,19 @@ export class MoveLinesCommand implements ICommand { } let maxColumn = model.getLineMaxColumn(validPrecedingLine); - let enter = LanguageConfigurationRegistry.getEnterAction(model, new Range(validPrecedingLine, maxColumn, validPrecedingLine, maxColumn)); + let enter = LanguageConfigurationRegistry.getEnterAction(this._autoIndent, model, new Range(validPrecedingLine, maxColumn, validPrecedingLine, maxColumn)); if (enter) { let enterPrefix = enter.indentation; - let enterAction = enter.enterAction; - if (enterAction.indentAction === IndentAction.None) { - enterPrefix = enter.indentation + enterAction.appendText; - } else if (enterAction.indentAction === IndentAction.Indent) { - enterPrefix = enter.indentation + enterAction.appendText; - } else if (enterAction.indentAction === IndentAction.IndentOutdent) { + if (enter.indentAction === IndentAction.None) { + enterPrefix = enter.indentation + enter.appendText; + } else if (enter.indentAction === IndentAction.Indent) { + enterPrefix = enter.indentation + enter.appendText; + } else if (enter.indentAction === IndentAction.IndentOutdent) { enterPrefix = enter.indentation; - } else if (enterAction.indentAction === IndentAction.Outdent) { - enterPrefix = indentConverter.unshiftIndent(enter.indentation) + enterAction.appendText; + } else if (enter.indentAction === IndentAction.Outdent) { + enterPrefix = indentConverter.unshiftIndent(enter.indentation) + enter.appendText; } let movingLineText = model.getLineContent(line); if (this.trimLeft(movingLineText).indexOf(this.trimLeft(enterPrefix)) >= 0) { @@ -288,7 +288,7 @@ export class MoveLinesCommand implements ICommand { } private shouldAutoIndent(model: ITextModel, selection: Selection) { - if (!this._autoIndent) { + if (this._autoIndent < EditorAutoIndentStrategy.Full) { return false; } // if it's not easy to tokenize, we stop auto indent. diff --git a/src/vs/editor/contrib/linesOperations/sortLinesCommand.ts b/src/vs/editor/contrib/linesOperations/sortLinesCommand.ts index a201370cea3ba..0a1bc6bf90c18 100644 --- a/src/vs/editor/contrib/linesOperations/sortLinesCommand.ts +++ b/src/vs/editor/contrib/linesOperations/sortLinesCommand.ts @@ -6,10 +6,10 @@ import { EditOperation } from 'vs/editor/common/core/editOperation'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon'; import { IIdentifiedSingleEditOperation, ITextModel } from 'vs/editor/common/model'; -export class SortLinesCommand implements editorCommon.ICommand { +export class SortLinesCommand implements ICommand { private static _COLLATOR: Intl.Collator | null = null; public static getCollator(): Intl.Collator { @@ -29,7 +29,7 @@ export class SortLinesCommand implements editorCommon.ICommand { this.selectionId = null; } - public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void { + public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { let op = sortLines(model, this.selection, this.descending); if (op) { builder.addEditOperation(op.range, op.text); @@ -38,7 +38,7 @@ export class SortLinesCommand implements editorCommon.ICommand { this.selectionId = builder.trackSelection(this.selection); } - public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection { + public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection { return helper.getTrackedSelection(this.selectionId!); } diff --git a/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts b/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts index 586632150888c..6090bd19e7ebe 100644 --- a/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts +++ b/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts @@ -12,6 +12,19 @@ import { ITextModel } from 'vs/editor/common/model'; import { TitleCaseAction, DeleteAllLeftAction, DeleteAllRightAction, IndentLinesAction, InsertLineAfterAction, InsertLineBeforeAction, JoinLinesAction, LowerCaseAction, SortLinesAscendingAction, SortLinesDescendingAction, TransposeAction, UpperCaseAction, DeleteLinesAction } from 'vs/editor/contrib/linesOperations/linesOperations'; import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; +import type { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { EditorAction } from 'vs/editor/browser/editorExtensions'; + +function assertSelection(editor: ICodeEditor, expected: Selection | Selection[]): void { + if (!Array.isArray(expected)) { + expected = [expected]; + } + assert.deepEqual(editor.getSelections(), expected); +} + +function executeAction(action: EditorAction, editor: ICodeEditor): void { + action.run(null!, editor, undefined); +} suite('Editor Contrib - Line Operations', () => { suite('SortLinesAscendingAction', () => { @@ -26,13 +39,13 @@ suite('Editor Contrib - Line Operations', () => { let sortLinesAscendingAction = new SortLinesAscendingAction(); editor.setSelection(new Selection(1, 1, 3, 5)); - sortLinesAscendingAction.run(null!, editor); + executeAction(sortLinesAscendingAction, editor); assert.deepEqual(model.getLinesContent(), [ 'alpha', 'beta', 'omicron' ]); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 3, 7).toString()); + assertSelection(editor, new Selection(1, 1, 3, 7)); }); }); @@ -51,7 +64,7 @@ suite('Editor Contrib - Line Operations', () => { let sortLinesAscendingAction = new SortLinesAscendingAction(); editor.setSelections([new Selection(1, 1, 3, 5), new Selection(5, 1, 7, 5)]); - sortLinesAscendingAction.run(null!, editor); + executeAction(sortLinesAscendingAction, editor); assert.deepEqual(model.getLinesContent(), [ 'alpha', 'beta', @@ -84,13 +97,13 @@ suite('Editor Contrib - Line Operations', () => { let sortLinesDescendingAction = new SortLinesDescendingAction(); editor.setSelection(new Selection(1, 1, 3, 7)); - sortLinesDescendingAction.run(null!, editor); + executeAction(sortLinesDescendingAction, editor); assert.deepEqual(model.getLinesContent(), [ 'omicron', 'beta', 'alpha' ]); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 3, 5).toString()); + assertSelection(editor, new Selection(1, 1, 3, 5)); }); }); @@ -109,7 +122,7 @@ suite('Editor Contrib - Line Operations', () => { let sortLinesDescendingAction = new SortLinesDescendingAction(); editor.setSelections([new Selection(1, 1, 3, 7), new Selection(5, 1, 7, 7)]); - sortLinesDescendingAction.run(null!, editor); + executeAction(sortLinesDescendingAction, editor); assert.deepEqual(model.getLinesContent(), [ 'omicron', 'beta', @@ -143,13 +156,13 @@ suite('Editor Contrib - Line Operations', () => { let deleteAllLeftAction = new DeleteAllLeftAction(); editor.setSelection(new Selection(1, 2, 1, 2)); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'ne', '001'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(1), 'ne'); editor.setSelections([new Selection(2, 2, 2, 2), new Selection(3, 2, 3, 2)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'wo', '002'); - assert.equal(model.getLineContent(3), 'hree', '003'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(2), 'wo'); + assert.equal(model.getLineContent(3), 'hree'); }); }); @@ -164,16 +177,16 @@ suite('Editor Contrib - Line Operations', () => { let deleteAllLeftAction = new DeleteAllLeftAction(); editor.setSelection(new Selection(2, 1, 2, 1)); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'onetwo', '001'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(1), 'onetwo'); editor.setSelections([new Selection(1, 1, 1, 1), new Selection(2, 1, 2, 1)]); - deleteAllLeftAction.run(null!, editor); + executeAction(deleteAllLeftAction, editor); assert.equal(model.getLinesContent()[0], 'onetwothree'); assert.equal(model.getLinesContent().length, 1); editor.setSelection(new Selection(1, 1, 1, 1)); - deleteAllLeftAction.run(null!, editor); + executeAction(deleteAllLeftAction, editor); assert.equal(model.getLinesContent()[0], 'onetwothree'); }); }); @@ -197,7 +210,7 @@ suite('Editor Contrib - Line Operations', () => { editor.setSelections([beforeSecondWasoSelection, endOfBCCSelection, endOfNonono]); - deleteAllLeftAction.run(null!, editor); + executeAction(deleteAllLeftAction, editor); let selections = editor.getSelections()!; assert.equal(model.getLineContent(2), ''); @@ -225,7 +238,7 @@ suite('Editor Contrib - Line Operations', () => { selections[2].endColumn ], [5, 1, 5, 1]); - deleteAllLeftAction.run(null!, editor); + executeAction(deleteAllLeftAction, editor); selections = editor.getSelections()!; assert.equal(model.getLineContent(1), 'hi my name is Carlos Matos waso waso'); @@ -263,24 +276,24 @@ suite('Editor Contrib - Line Operations', () => { let deleteAllLeftAction = new DeleteAllLeftAction(); editor.setSelections([new Selection(1, 2, 1, 2), new Selection(1, 4, 1, 4)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'lo', '001'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(1), 'lo'); editor.setSelections([new Selection(2, 2, 2, 2), new Selection(2, 4, 2, 5)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'd', '002'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(2), 'd'); editor.setSelections([new Selection(3, 2, 3, 5), new Selection(3, 7, 3, 7)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(3), 'world', '003'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(3), 'world'); editor.setSelections([new Selection(4, 3, 4, 3), new Selection(4, 5, 5, 4)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(4), 'jour', '004'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(4), 'jour'); editor.setSelections([new Selection(5, 3, 6, 3), new Selection(6, 5, 7, 5), new Selection(7, 7, 7, 7)]); - deleteAllLeftAction.run(null!, editor); - assert.equal(model.getLineContent(5), 'world', '005'); + executeAction(deleteAllLeftAction, editor); + assert.equal(model.getLineContent(5), 'world'); }); }); @@ -300,11 +313,11 @@ suite('Editor Contrib - Line Operations', () => { assert.equal(model.getLineContent(1), 'Typing some text here on line one'); assert.deepEqual(editor.getSelection(), new Selection(1, 31, 1, 31)); - deleteAllLeftAction.run(null!, editor); + executeAction(deleteAllLeftAction, editor); assert.equal(model.getLineContent(1), 'one'); assert.deepEqual(editor.getSelection(), new Selection(1, 1, 1, 1)); - editor.trigger('keyboard', Handler.Undo, {}); + CoreEditingCommands.Undo.runEditorCommand(null, editor, null); assert.equal(model.getLineContent(1), 'Typing some text here on line one'); assert.deepEqual(editor.getSelection(), new Selection(1, 31, 1, 31)); }); @@ -331,29 +344,29 @@ suite('Editor Contrib - Line Operations', () => { let joinLinesAction = new JoinLinesAction(); editor.setSelection(new Selection(1, 2, 1, 2)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hello world', '001'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 6, 1, 6).toString(), '002'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(1), 'hello world'); + assertSelection(editor, new Selection(1, 6, 1, 6)); editor.setSelection(new Selection(2, 2, 2, 2)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'hello world', '003'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 7, 2, 7).toString(), '004'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(2), 'hello world'); + assertSelection(editor, new Selection(2, 7, 2, 7)); editor.setSelection(new Selection(3, 2, 3, 2)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(3), 'hello world', '005'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(3, 7, 3, 7).toString(), '006'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(3), 'hello world'); + assertSelection(editor, new Selection(3, 7, 3, 7)); editor.setSelection(new Selection(4, 2, 5, 3)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(4), 'hello world', '007'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(4, 2, 4, 8).toString(), '008'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(4), 'hello world'); + assertSelection(editor, new Selection(4, 2, 4, 8)); editor.setSelection(new Selection(5, 1, 7, 3)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(5), 'hello world', '009'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(5, 1, 5, 3).toString(), '010'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(5), 'hello world'); + assertSelection(editor, new Selection(5, 1, 5, 3)); }); }); @@ -367,10 +380,10 @@ suite('Editor Contrib - Line Operations', () => { let joinLinesAction = new JoinLinesAction(); editor.setSelection(new Selection(2, 1, 2, 1)); - joinLinesAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hello', '001'); - assert.equal(model.getLineContent(2), 'world', '002'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 6, 2, 6).toString(), '003'); + executeAction(joinLinesAction, editor); + assert.equal(model.getLineContent(1), 'hello'); + assert.equal(model.getLineContent(2), 'world'); + assertSelection(editor, new Selection(2, 6, 2, 6)); }); }); @@ -402,19 +415,16 @@ suite('Editor Contrib - Line Operations', () => { new Selection(10, 1, 10, 1) ]); - joinLinesAction.run(null!, editor); - assert.equal(model.getLinesContent().join('\n'), 'hello world\nhello world\nhello world\nhello world\n\nhello world', '001'); - assert.deepEqual(editor.getSelections()!.toString(), [ + executeAction(joinLinesAction, editor); + assert.equal(model.getLinesContent().join('\n'), 'hello world\nhello world\nhello world\nhello world\n\nhello world'); + assertSelection(editor, [ /** primary cursor */ new Selection(3, 4, 3, 8), new Selection(1, 6, 1, 6), new Selection(2, 2, 2, 8), new Selection(4, 5, 4, 9), new Selection(6, 1, 6, 1) - ].toString(), '002'); - - /** primary cursor */ - assert.deepEqual(editor.getSelection()!.toString(), new Selection(3, 4, 3, 8).toString(), '003'); + ]); }); }); @@ -433,11 +443,11 @@ suite('Editor Contrib - Line Operations', () => { assert.equal(model.getLineContent(1), 'hello my dear'); assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14)); - joinLinesAction.run(null!, editor); + executeAction(joinLinesAction, editor); assert.equal(model.getLineContent(1), 'hello my dear world'); assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14)); - editor.trigger('keyboard', Handler.Undo, {}); + CoreEditingCommands.Undo.runEditorCommand(null, editor, null); assert.equal(model.getLineContent(1), 'hello my dear'); assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14)); }); @@ -456,29 +466,29 @@ suite('Editor Contrib - Line Operations', () => { let transposeAction = new TransposeAction(); editor.setSelection(new Selection(1, 1, 1, 1)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hello world', '001'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 2, 1, 2).toString(), '002'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(1), 'hello world'); + assertSelection(editor, new Selection(1, 2, 1, 2)); editor.setSelection(new Selection(1, 6, 1, 6)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hell oworld', '003'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 7, 1, 7).toString(), '004'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(1), 'hell oworld'); + assertSelection(editor, new Selection(1, 7, 1, 7)); editor.setSelection(new Selection(1, 12, 1, 12)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hell oworl', '005'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 2, 2, 2).toString(), '006'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(1), 'hell oworl'); + assertSelection(editor, new Selection(2, 2, 2, 2)); editor.setSelection(new Selection(3, 1, 3, 1)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(3), '', '007'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(4, 1, 4, 1).toString(), '008'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(3), ''); + assertSelection(editor, new Selection(4, 1, 4, 1)); editor.setSelection(new Selection(4, 2, 4, 2)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(4), ' ', '009'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(4, 3, 4, 3).toString(), '010'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(4), ' '); + assertSelection(editor, new Selection(4, 3, 4, 3)); } ); @@ -498,24 +508,24 @@ suite('Editor Contrib - Line Operations', () => { let transposeAction = new TransposeAction(); editor.setSelection(new Selection(1, 1, 1, 1)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(2), '', '011'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 1, 2, 1).toString(), '012'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(2), ''); + assertSelection(editor, new Selection(2, 1, 2, 1)); editor.setSelection(new Selection(3, 6, 3, 6)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(4), 'oworld', '013'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(4, 2, 4, 2).toString(), '014'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(4), 'oworld'); + assertSelection(editor, new Selection(4, 2, 4, 2)); editor.setSelection(new Selection(6, 12, 6, 12)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(7), 'd', '015'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(7, 2, 7, 2).toString(), '016'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(7), 'd'); + assertSelection(editor, new Selection(7, 2, 7, 2)); editor.setSelection(new Selection(8, 12, 8, 12)); - transposeAction.run(null!, editor); - assert.equal(model.getLineContent(8), 'hello world', '019'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(8, 12, 8, 12).toString(), '020'); + executeAction(transposeAction, editor); + assert.equal(model.getLineContent(8), 'hello world'); + assertSelection(editor, new Selection(8, 12, 8, 12)); } ); }); @@ -532,44 +542,44 @@ suite('Editor Contrib - Line Operations', () => { let titlecaseAction = new TitleCaseAction(); editor.setSelection(new Selection(1, 1, 1, 12)); - uppercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'HELLO WORLD', '001'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 1, 12).toString(), '002'); + executeAction(uppercaseAction, editor); + assert.equal(model.getLineContent(1), 'HELLO WORLD'); + assertSelection(editor, new Selection(1, 1, 1, 12)); editor.setSelection(new Selection(1, 1, 1, 12)); - lowercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hello world', '003'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 1, 12).toString(), '004'); + executeAction(lowercaseAction, editor); + assert.equal(model.getLineContent(1), 'hello world'); + assertSelection(editor, new Selection(1, 1, 1, 12)); editor.setSelection(new Selection(1, 3, 1, 3)); - uppercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'HELLO world', '005'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 3, 1, 3).toString(), '006'); + executeAction(uppercaseAction, editor); + assert.equal(model.getLineContent(1), 'HELLO world'); + assertSelection(editor, new Selection(1, 3, 1, 3)); editor.setSelection(new Selection(1, 4, 1, 4)); - lowercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'hello world', '007'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 4, 1, 4).toString(), '008'); + executeAction(lowercaseAction, editor); + assert.equal(model.getLineContent(1), 'hello world'); + assertSelection(editor, new Selection(1, 4, 1, 4)); editor.setSelection(new Selection(1, 1, 1, 12)); - titlecaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), 'Hello World', '009'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 1, 12).toString(), '010'); + executeAction(titlecaseAction, editor); + assert.equal(model.getLineContent(1), 'Hello World'); + assertSelection(editor, new Selection(1, 1, 1, 12)); editor.setSelection(new Selection(2, 1, 2, 6)); - uppercaseAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'ÖÇŞĞÜ', '011'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 1, 2, 6).toString(), '012'); + executeAction(uppercaseAction, editor); + assert.equal(model.getLineContent(2), 'ÖÇŞĞÜ'); + assertSelection(editor, new Selection(2, 1, 2, 6)); editor.setSelection(new Selection(2, 1, 2, 6)); - lowercaseAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'öçşğü', '013'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 1, 2, 6).toString(), '014'); + executeAction(lowercaseAction, editor); + assert.equal(model.getLineContent(2), 'öçşğü'); + assertSelection(editor, new Selection(2, 1, 2, 6)); editor.setSelection(new Selection(2, 1, 2, 6)); - titlecaseAction.run(null!, editor); - assert.equal(model.getLineContent(2), 'Öçşğü', '015'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 1, 2, 6).toString(), '016'); + executeAction(titlecaseAction, editor); + assert.equal(model.getLineContent(2), 'Öçşğü'); + assertSelection(editor, new Selection(2, 1, 2, 6)); } ); @@ -586,27 +596,27 @@ suite('Editor Contrib - Line Operations', () => { let titlecaseAction = new TitleCaseAction(); editor.setSelection(new Selection(1, 1, 1, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(1), 'Foo Bar Baz'); editor.setSelection(new Selection(2, 1, 2, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(2), 'Foo\'Bar\'Baz'); editor.setSelection(new Selection(3, 1, 3, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(3), 'Foo[Bar]Baz'); editor.setSelection(new Selection(4, 1, 4, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(4), 'Foo`Bar~Baz'); editor.setSelection(new Selection(5, 1, 5, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(5), 'Foo^Bar%Baz'); editor.setSelection(new Selection(6, 1, 6, 12)); - titlecaseAction.run(null!, editor); + executeAction(titlecaseAction, editor); assert.equal(model.getLineContent(6), 'Foo$Bar!Baz'); } ); @@ -621,24 +631,24 @@ suite('Editor Contrib - Line Operations', () => { let lowercaseAction = new LowerCaseAction(); editor.setSelection(new Selection(1, 1, 1, 1)); - uppercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), '', '013'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 1, 1).toString(), '014'); + executeAction(uppercaseAction, editor); + assert.equal(model.getLineContent(1), ''); + assertSelection(editor, new Selection(1, 1, 1, 1)); editor.setSelection(new Selection(1, 1, 1, 1)); - lowercaseAction.run(null!, editor); - assert.equal(model.getLineContent(1), '', '015'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(1, 1, 1, 1).toString(), '016'); + executeAction(lowercaseAction, editor); + assert.equal(model.getLineContent(1), ''); + assertSelection(editor, new Selection(1, 1, 1, 1)); editor.setSelection(new Selection(2, 2, 2, 2)); - uppercaseAction.run(null!, editor); - assert.equal(model.getLineContent(2), ' ', '017'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 2, 2, 2).toString(), '018'); + executeAction(uppercaseAction, editor); + assert.equal(model.getLineContent(2), ' '); + assertSelection(editor, new Selection(2, 2, 2, 2)); editor.setSelection(new Selection(2, 2, 2, 2)); - lowercaseAction.run(null!, editor); - assert.equal(model.getLineContent(2), ' ', '019'); - assert.deepEqual(editor.getSelection()!.toString(), new Selection(2, 2, 2, 2).toString(), '020'); + executeAction(lowercaseAction, editor); + assert.equal(model.getLineContent(2), ' '); + assertSelection(editor, new Selection(2, 2, 2, 2)); } ); }); @@ -649,17 +659,17 @@ suite('Editor Contrib - Line Operations', () => { const model = editor.getModel()!; const action = new DeleteAllRightAction(); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['']); assert.deepEqual(editor.getSelections(), [new Selection(1, 1, 1, 1)]); editor.setSelection(new Selection(1, 1, 1, 1)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['']); assert.deepEqual(editor.getSelections(), [new Selection(1, 1, 1, 1)]); editor.setSelections([new Selection(1, 1, 1, 1), new Selection(1, 1, 1, 1), new Selection(1, 1, 1, 1)]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['']); assert.deepEqual(editor.getSelections(), [new Selection(1, 1, 1, 1)]); }); @@ -674,17 +684,17 @@ suite('Editor Contrib - Line Operations', () => { const action = new DeleteAllRightAction(); editor.setSelection(new Selection(1, 2, 1, 5)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['ho', 'world']); assert.deepEqual(editor.getSelections(), [new Selection(1, 2, 1, 2)]); editor.setSelection(new Selection(1, 1, 2, 4)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['ld']); assert.deepEqual(editor.getSelections(), [new Selection(1, 1, 1, 1)]); editor.setSelection(new Selection(1, 1, 1, 3)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['']); assert.deepEqual(editor.getSelections(), [new Selection(1, 1, 1, 1)]); }); @@ -699,12 +709,12 @@ suite('Editor Contrib - Line Operations', () => { const action = new DeleteAllRightAction(); editor.setSelection(new Selection(1, 3, 1, 3)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['he', 'world']); assert.deepEqual(editor.getSelections(), [new Selection(1, 3, 1, 3)]); editor.setSelection(new Selection(2, 1, 2, 1)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['he', '']); assert.deepEqual(editor.getSelections(), [new Selection(2, 1, 2, 1)]); }); @@ -719,17 +729,17 @@ suite('Editor Contrib - Line Operations', () => { const action = new DeleteAllRightAction(); editor.setSelection(new Selection(1, 6, 1, 6)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['helloworld']); assert.deepEqual(editor.getSelections(), [new Selection(1, 6, 1, 6)]); editor.setSelection(new Selection(1, 6, 1, 6)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['hello']); assert.deepEqual(editor.getSelections(), [new Selection(1, 6, 1, 6)]); editor.setSelection(new Selection(1, 6, 1, 6)); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['hello']); assert.deepEqual(editor.getSelections(), [new Selection(1, 6, 1, 6)]); }); @@ -749,34 +759,34 @@ suite('Editor Contrib - Line Operations', () => { new Selection(1, 6, 1, 6), new Selection(3, 4, 3, 4), ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['hethere', 'wor']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(2, 4, 2, 4) ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['he', 'wor']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(2, 4, 2, 4) ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['hewor']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(1, 6, 1, 6) ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['he']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3) ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['he']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3) @@ -798,20 +808,20 @@ suite('Editor Contrib - Line Operations', () => { new Selection(1, 6, 1, 6), new Selection(3, 4, 3, 4), ]); - action.run(null!, editor); + executeAction(action, editor); assert.deepEqual(model.getLinesContent(), ['hethere', 'wor']); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(2, 4, 2, 4) ]); - editor.trigger('tests', Handler.Undo, {}); + CoreEditingCommands.Undo.runEditorCommand(null, editor, null); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(1, 6, 1, 6), new Selection(3, 4, 3, 4) ]); - editor.trigger('tests', Handler.Redo, {}); + CoreEditingCommands.Redo.runEditorCommand(null, editor, null); assert.deepEqual(editor.getSelections(), [ new Selection(1, 3, 1, 3), new Selection(2, 4, 2, 4) @@ -831,7 +841,7 @@ suite('Editor Contrib - Line Operations', () => { editor.setPosition(new Position(lineNumber, column)); let insertLineBeforeAction = new InsertLineBeforeAction(); - insertLineBeforeAction.run(null!, editor); + executeAction(insertLineBeforeAction, editor); callback(editor.getModel()!, cursor); }); } @@ -872,7 +882,7 @@ suite('Editor Contrib - Line Operations', () => { editor.setPosition(new Position(lineNumber, column)); let insertLineAfterAction = new InsertLineAfterAction(); - insertLineAfterAction.run(null!, editor); + executeAction(insertLineAfterAction, editor); callback(editor.getModel()!, cursor); }); } @@ -917,7 +927,7 @@ suite('Editor Contrib - Line Operations', () => { let indentLinesAction = new IndentLinesAction(); editor.setPosition(new Position(1, 2)); - indentLinesAction.run(null!, editor); + executeAction(indentLinesAction, editor); assert.equal(model.getLineContent(1), '\tfunction baz() {'); assert.deepEqual(editor.getSelection(), new Selection(1, 3, 1, 3)); @@ -942,7 +952,7 @@ suite('Editor Contrib - Line Operations', () => { const indentLinesAction = new IndentLinesAction(); editor.setPosition(new Position(1, 1)); - indentLinesAction.run(null!, editor); + executeAction(indentLinesAction, editor); assert.equal(model.getLineContent(1), '\tSome text'); assert.deepEqual(editor.getSelection(), new Selection(1, 2, 1, 2)); }); @@ -964,7 +974,7 @@ suite('Editor Contrib - Line Operations', () => { new Selection(3, 4, 3, 4), ]); const deleteLinesAction = new DeleteLinesAction(); - deleteLinesAction.run(null!, editor); + executeAction(deleteLinesAction, editor); assert.equal(editor.getValue(), 'a\nc'); }); @@ -976,7 +986,7 @@ suite('Editor Contrib - Line Operations', () => { withTestCodeEditor(initialText, {}, (editor) => { editor.setSelections(initialSelections); const deleteLinesAction = new DeleteLinesAction(); - deleteLinesAction.run(null!, editor); + executeAction(deleteLinesAction, editor); assert.equal(editor.getValue(), resultingText.join('\n')); assert.deepEqual(editor.getSelections(), resultingSelections); diff --git a/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts b/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts index 1c7da6e5d6649..b803557c63eec 100644 --- a/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts +++ b/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts @@ -9,21 +9,22 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo import { MoveLinesCommand } from 'vs/editor/contrib/linesOperations/moveLinesCommand'; import { testCommand } from 'vs/editor/test/browser/testCommand'; import { MockMode } from 'vs/editor/test/common/mocks/mockMode'; +import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions'; function testMoveLinesDownCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { - testCommand(lines, null, selection, (sel) => new MoveLinesCommand(sel, true, false), expectedLines, expectedSelection); + testCommand(lines, null, selection, (sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Advanced), expectedLines, expectedSelection); } function testMoveLinesUpCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { - testCommand(lines, null, selection, (sel) => new MoveLinesCommand(sel, false, false), expectedLines, expectedSelection); + testCommand(lines, null, selection, (sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Advanced), expectedLines, expectedSelection); } function testMoveLinesDownWithIndentCommand(languageId: LanguageIdentifier, lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { - testCommand(lines, languageId, selection, (sel) => new MoveLinesCommand(sel, true, true), expectedLines, expectedSelection); + testCommand(lines, languageId, selection, (sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Full), expectedLines, expectedSelection); } function testMoveLinesUpWithIndentCommand(languageId: LanguageIdentifier, lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void { - testCommand(lines, languageId, selection, (sel) => new MoveLinesCommand(sel, false, true), expectedLines, expectedSelection); + testCommand(lines, languageId, selection, (sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Full), expectedLines, expectedSelection); } suite('Editor Contrib - Move Lines Command', () => { diff --git a/src/vs/editor/contrib/links/getLinks.ts b/src/vs/editor/contrib/links/getLinks.ts index df34eed560087..a85e7f8c94297 100644 --- a/src/vs/editor/contrib/links/getLinks.ts +++ b/src/vs/editor/contrib/links/getLinks.ts @@ -44,17 +44,9 @@ export class Link implements ILink { return this._link.tooltip; } - resolve(token: CancellationToken): Promise { + async resolve(token: CancellationToken): Promise { if (this._link.url) { - try { - if (typeof this._link.url === 'string') { - return Promise.resolve(URI.parse(this._link.url)); - } else { - return Promise.resolve(this._link.url); - } - } catch (e) { - return Promise.reject(new Error('invalid')); - } + return this._link.url; } if (typeof this._provider.resolveLink === 'function') { diff --git a/src/vs/editor/contrib/links/links.ts b/src/vs/editor/contrib/links/links.ts index 6bce7e78d8d45..14b1b29fd01bf 100644 --- a/src/vs/editor/contrib/links/links.ts +++ b/src/vs/editor/contrib/links/links.ts @@ -14,7 +14,7 @@ import * as platform from 'vs/base/common/platform'; import { ICodeEditor, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { IModelDecorationsChangeAccessor, IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/model'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { LinkProviderRegistry } from 'vs/editor/common/modes'; @@ -25,6 +25,10 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { editorActiveLinkForeground } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { URI } from 'vs/base/common/uri'; +import { Schemas } from 'vs/base/common/network'; +import * as resources from 'vs/base/common/resources'; +import * as strings from 'vs/base/common/strings'; function getHoverMessage(link: Link, useMetaKey: boolean): MarkdownString { const executeCmd = link.url && /^command:/i.test(link.url.toString()); @@ -97,7 +101,7 @@ class LinkOccurrence { } } -class LinkDetector implements editorCommon.IEditorContribution { +class LinkDetector implements IEditorContribution { public static readonly ID: string = 'editor.linkDetector'; @@ -291,7 +295,29 @@ class LinkDetector implements editorCommon.IEditorContribution { const { link } = occurrence; link.resolve(CancellationToken.None).then(uri => { - // open the uri + + // Support for relative file URIs of the shape file://./relativeFile.txt or file:///./relativeFile.txt + if (typeof uri === 'string' && this.editor.hasModel()) { + const modelUri = this.editor.getModel().uri; + if (modelUri.scheme === Schemas.file && strings.startsWith(uri, 'file:')) { + const parsedUri = URI.parse(uri); + if (parsedUri.scheme === Schemas.file) { + const fsPath = resources.originalFSPath(parsedUri); + + let relativePath: string | null = null; + if (strings.startsWith(fsPath, '/./')) { + relativePath = `.${fsPath.substr(1)}`; + } else if (strings.startsWith(fsPath, '//./')) { + relativePath = `.${fsPath.substr(2)}`; + } + + if (relativePath) { + uri = resources.joinPath(modelUri, relativePath); + } + } + } + } + return this.openerService.open(uri, { openToSide, fromUserGesture }); }, err => { diff --git a/src/vs/editor/contrib/markdown/markdownRenderer.ts b/src/vs/editor/contrib/markdown/markdownRenderer.ts index eb17228cfa8ba..b4bfe8ddd9e49 100644 --- a/src/vs/editor/contrib/markdown/markdownRenderer.ts +++ b/src/vs/editor/contrib/markdown/markdownRenderer.ts @@ -7,7 +7,6 @@ import { IMarkdownString } from 'vs/base/common/htmlContent'; import { renderMarkdown, MarkdownRenderOptions } from 'vs/base/browser/markdownRenderer'; import { IOpenerService, NullOpenerService } from 'vs/platform/opener/common/opener'; import { IModeService } from 'vs/editor/common/services/modeService'; -import { URI } from 'vs/base/common/uri'; import { onUnexpectedError } from 'vs/base/common/errors'; import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; @@ -29,7 +28,7 @@ export class MarkdownRenderer extends Disposable { constructor( private readonly _editor: ICodeEditor, @IModeService private readonly _modeService: IModeService, - @optional(IOpenerService) private readonly _openerService: IOpenerService | null = NullOpenerService, + @optional(IOpenerService) private readonly _openerService: IOpenerService = NullOpenerService, ) { super(); } @@ -64,15 +63,7 @@ export class MarkdownRenderer extends Disposable { codeBlockRenderCallback: () => this._onDidRenderCodeBlock.fire(), actionHandler: { callback: (content) => { - let uri: URI | undefined; - try { - uri = URI.parse(content); - } catch { - // ignore - } - if (uri && this._openerService) { - this._openerService.open(uri, { fromUserGesture: true }).catch(onUnexpectedError); - } + this._openerService.open(content, { fromUserGesture: true }).catch(onUnexpectedError); }, disposeables } diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts index e8214f9a0d923..a4fcb5f2d1a91 100644 --- a/src/vs/editor/contrib/message/messageController.ts +++ b/src/vs/editor/contrib/message/messageController.ts @@ -10,7 +10,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { IDisposable, Disposable, DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle'; import { alert } from 'vs/base/browser/ui/aria/aria'; import { Range } from 'vs/editor/common/core/range'; -import * as editorCommon from 'vs/editor/common/editorCommon'; +import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { registerEditorContribution, EditorCommand, registerEditorCommand } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor, IContentWidget, IContentWidgetPosition, ContentWidgetPositionPreference } from 'vs/editor/browser/editorBrowser'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; @@ -19,7 +19,7 @@ import { registerThemingParticipant, HIGH_CONTRAST } from 'vs/platform/theme/com import { inputValidationInfoBorder, inputValidationInfoBackground, inputValidationInfoForeground } from 'vs/platform/theme/common/colorRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -export class MessageController extends Disposable implements editorCommon.IEditorContribution { +export class MessageController extends Disposable implements IEditorContribution { public static readonly ID = 'editor.contrib.messageController'; @@ -144,7 +144,7 @@ class MessageWidget implements IContentWidget { constructor(editor: ICodeEditor, { lineNumber, column }: IPosition, text: string) { this._editor = editor; - this._editor.revealLinesInCenterIfOutsideViewport(lineNumber, lineNumber, editorCommon.ScrollType.Smooth); + this._editor.revealLinesInCenterIfOutsideViewport(lineNumber, lineNumber, ScrollType.Smooth); this._position = { lineNumber, column: column - 1 }; this._domNode = document.createElement('div'); @@ -176,7 +176,7 @@ class MessageWidget implements IContentWidget { } getPosition(): IContentWidgetPosition { - return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE] }; + return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE, ContentWidgetPositionPreference.BELOW] }; } } diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 4434040595a57..b23cc0c09f8c4 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -46,7 +46,7 @@ export class InsertCursorAbove extends EditorAction { }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miInsertCursorAbove', comment: ['&& denotes a mnemonic'] }, "&&Add Cursor Above"), @@ -95,7 +95,7 @@ export class InsertCursorBelow extends EditorAction { }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miInsertCursorBelow', comment: ['&& denotes a mnemonic'] }, "A&&dd Cursor Below"), @@ -140,7 +140,7 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miInsertCursorAtEndOfEachLineSelected', comment: ['&& denotes a mnemonic'] }, "Add C&&ursors to Line Ends"), @@ -631,6 +631,12 @@ export class MultiCursorSelectionController extends Disposable implements IEdito this._setSelections(matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn))); } } + + public selectAllUsingSelections(selections: Selection[]): void { + if (selections.length > 0) { + this._setSelections(selections); + } + } } export abstract class MultiCursorSelectionControllerAction extends EditorAction { @@ -662,7 +668,7 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr primary: KeyMod.CtrlCmd | KeyCode.KEY_D, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miAddSelectionToNextFindMatch', comment: ['&& denotes a mnemonic'] }, "Add &&Next Occurrence"), @@ -682,7 +688,7 @@ export class AddSelectionToPreviousFindMatchAction extends MultiCursorSelectionC label: nls.localize('addSelectionToPreviousFindMatch', "Add Selection To Previous Find Match"), alias: 'Add Selection To Previous Find Match', precondition: undefined, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miAddSelectionToPreviousFindMatch', comment: ['&& denotes a mnemonic'] }, "Add P&&revious Occurrence"), @@ -740,7 +746,7 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '3_multi', title: nls.localize({ key: 'miSelectHighlights', comment: ['&& denotes a mnemonic'] }, "Select All &&Occurrences"), @@ -759,13 +765,13 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction { id: 'editor.action.changeAll', label: nls.localize('changeAll.label', "Change All Occurrences"), alias: 'Change All Occurrences', - precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.editorTextFocus, EditorContextKeys.hasRenameProvider.toNegated()), + precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.editorTextFocus), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.F2, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: '1_modification', order: 1.2 } diff --git a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts index 7724699ededc9..157a018ac0da2 100644 --- a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts +++ b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts @@ -69,7 +69,8 @@ suite('Multicursor selection', () => { store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); }, remove: (key) => undefined, logStorage: () => undefined, - migrate: (toWorkspace) => Promise.resolve(undefined) + migrate: (toWorkspace) => Promise.resolve(undefined), + flush: () => undefined } as IStorageService); test('issue #8817: Cursor position changes when you cancel multicursor', () => { diff --git a/src/vs/editor/contrib/parameterHints/arrow-down-dark.svg b/src/vs/editor/contrib/parameterHints/arrow-down-dark.svg deleted file mode 100644 index b1a76d789ea95..0000000000000 --- a/src/vs/editor/contrib/parameterHints/arrow-down-dark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/editor/contrib/parameterHints/arrow-down.svg b/src/vs/editor/contrib/parameterHints/arrow-down.svg deleted file mode 100644 index d643403d75bce..0000000000000 --- a/src/vs/editor/contrib/parameterHints/arrow-down.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/editor/contrib/parameterHints/arrow-up-dark.svg b/src/vs/editor/contrib/parameterHints/arrow-up-dark.svg deleted file mode 100644 index 43f31a09521ac..0000000000000 --- a/src/vs/editor/contrib/parameterHints/arrow-up-dark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/editor/contrib/parameterHints/arrow-up.svg b/src/vs/editor/contrib/parameterHints/arrow-up.svg deleted file mode 100644 index b8072bb31bbbe..0000000000000 --- a/src/vs/editor/contrib/parameterHints/arrow-up.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.css b/src/vs/editor/contrib/parameterHints/parameterHints.css index dff7f77f9e463..03c4e2640ee95 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.css +++ b/src/vs/editor/contrib/parameterHints/parameterHints.css @@ -13,12 +13,12 @@ .monaco-editor .parameter-hints-widget > .wrapper { max-width: 440px; display: flex; - flex-direction: column; + flex-direction: row; } .monaco-editor .parameter-hints-widget.multiple { min-height: 3.3em; - padding: 0 0 0 1.9em; + padding: 0; } .monaco-editor .parameter-hints-widget.visible { @@ -33,7 +33,9 @@ .monaco-editor .parameter-hints-widget .monaco-scrollable-element, .monaco-editor .parameter-hints-widget .body { display: flex; + flex: 1; flex-direction: column; + min-height: 100%; } .monaco-editor .parameter-hints-widget .signature { @@ -53,6 +55,10 @@ white-space: initial; } +.monaco-editor .parameter-hints-widget .docs .markdown-docs code { + font-family: var(--monaco-monospace-font); +} + .monaco-editor .parameter-hints-widget .docs .code { white-space: pre-wrap; } @@ -62,20 +68,20 @@ padding: 0 0.4em; } -.monaco-editor .parameter-hints-widget .buttons { - position: absolute; +.monaco-editor .parameter-hints-widget .controls { display: none; - bottom: 0; - left: 0; + flex-direction: column; + align-items: center; + min-width: 22px; + justify-content: flex-end; } -.monaco-editor .parameter-hints-widget.multiple .buttons { - display: block; +.monaco-editor .parameter-hints-widget.multiple .controls { + display: flex; + padding: 0 2px; } .monaco-editor .parameter-hints-widget.multiple .button { - position: absolute; - left: 2px; width: 16px; height: 16px; background-repeat: no-repeat; @@ -84,28 +90,14 @@ .monaco-editor .parameter-hints-widget .button.previous { bottom: 24px; - background-image: url('arrow-up.svg'); -} - -.monaco-editor .parameter-hints-widget .button.next { - bottom: 0; - background-image: url('arrow-down.svg'); } .monaco-editor .parameter-hints-widget .overloads { - position: absolute; - display: none; text-align: center; - bottom: 14px; - left: 0; - width: 22px; height: 12px; line-height: 12px; opacity: 0.5; -} - -.monaco-editor .parameter-hints-widget.multiple .overloads { - display: block; + font-family: var(--monaco-monospace-font); } .monaco-editor .parameter-hints-widget .signature .parameter.active { @@ -117,15 +109,3 @@ font-weight: bold; margin-right: 0.5em; } - -/*** VS Dark & High Contrast*/ - -.monaco-editor.hc-black .parameter-hints-widget .button.previous, -.monaco-editor.vs-dark .parameter-hints-widget .button.previous { - background-image: url('arrow-up-dark.svg'); -} - -.monaco-editor.hc-black .parameter-hints-widget .button.next, -.monaco-editor.vs-dark .parameter-hints-widget .button.next { - background-image: url('arrow-down-dark.svg'); -} diff --git a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts index 2ac6ede62feb9..41e4a66fd1d82 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts @@ -22,6 +22,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry'; import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel'; +import { pad } from 'vs/base/common/strings'; const $ = dom.$; @@ -76,9 +77,10 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget { const wrapper = dom.append(element, $('.wrapper')); wrapper.tabIndex = -1; - const buttons = dom.append(wrapper, $('.buttons')); - const previous = dom.append(buttons, $('.button.previous')); - const next = dom.append(buttons, $('.button.next')); + const controls = dom.append(wrapper, $('.controls')); + const previous = dom.append(controls, $('.button.codicon.codicon-chevron-up')); + const overloads = dom.append(controls, $('.overloads')); + const next = dom.append(controls, $('.button.codicon.codicon-chevron-down')); const onPreviousClick = stop(domEvent(previous, 'click')); this._register(onPreviousClick(this.previous, this)); @@ -86,8 +88,6 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget { const onNextClick = stop(domEvent(next, 'click')); this._register(onNextClick(this.next, this)); - const overloads = dom.append(wrapper, $('.overloads')); - const body = $('.body'); const scrollbar = new DomScrollableElement(body, {}); this._register(scrollbar); @@ -239,12 +239,8 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget { dom.toggleClass(this.domNodes.signature, 'has-docs', hasDocs); dom.toggleClass(this.domNodes.docs, 'empty', !hasDocs); - let currentOverload = String(hints.activeSignature + 1); - if (hints.signatures.length < 10) { - currentOverload += `/${hints.signatures.length}`; - } - - this.domNodes.overloads.textContent = currentOverload; + this.domNodes.overloads.textContent = + pad(hints.activeSignature + 1, hints.signatures.length.toString().length) + '/' + hints.signatures.length; if (activeParameter) { const labelToAnnounce = this.getParameterLabel(signature, hints.activeParameter); diff --git a/src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts b/src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts index 2aa301d692a64..2d5e1967fe7a5 100644 --- a/src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts +++ b/src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts @@ -10,7 +10,7 @@ import { URI } from 'vs/base/common/uri'; import { Position } from 'vs/editor/common/core/position'; import { Handler } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; -import { TextModel } from 'vs/editor/common/model/textModel'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; import * as modes from 'vs/editor/common/modes'; import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; @@ -49,7 +49,7 @@ suite('ParameterHintsModel', () => { }); function createMockEditor(fileContents: string) { - const textModel = TextModel.createFromString(fileContents, undefined, undefined, mockFile); + const textModel = createTextModel(fileContents, undefined, undefined, mockFile); const editor = createTestCodeEditor({ model: textModel, serviceCollection: new ServiceCollection( diff --git a/src/vs/editor/contrib/peekView/media/peekViewWidget.css b/src/vs/editor/contrib/peekView/media/peekViewWidget.css index 889d1148298be..d0e9bc3c5525f 100644 --- a/src/vs/editor/contrib/peekView/media/peekViewWidget.css +++ b/src/vs/editor/contrib/peekView/media/peekViewWidget.css @@ -21,7 +21,11 @@ margin-left: 0.5em; } -.monaco-editor .peekview-widget .head .peekview-title .meta::before { +.monaco-editor .peekview-widget .head .peekview-title .meta { + white-space: nowrap; +} + +.monaco-editor .peekview-widget .head .peekview-title .meta:not(:empty)::before { content: '-'; padding: 0 0.3em; } diff --git a/src/vs/editor/contrib/peekView/peekView.ts b/src/vs/editor/contrib/peekView/peekView.ts index deaf2752ba600..32503e62570cf 100644 --- a/src/vs/editor/contrib/peekView/peekView.ts +++ b/src/vs/editor/contrib/peekView/peekView.ts @@ -260,7 +260,7 @@ export abstract class PeekViewWidget extends ZoneWidget { export const peekViewTitleBackground = registerColor('peekViewTitle.background', { dark: '#1E1E1E', light: '#FFFFFF', hc: '#0C141F' }, nls.localize('peekViewTitleBackground', 'Background color of the peek view title area.')); export const peekViewTitleForeground = registerColor('peekViewTitleLabel.foreground', { dark: '#FFFFFF', light: '#333333', hc: '#FFFFFF' }, nls.localize('peekViewTitleForeground', 'Color of the peek view title.')); -export const peekViewTitleInfoForeground = registerColor('peekViewTitleDescription.foreground', { dark: '#ccccccb3', light: '#6c6c6cb3', hc: '#FFFFFF99' }, nls.localize('peekViewTitleInfoForeground', 'Color of the peek view title info.')); +export const peekViewTitleInfoForeground = registerColor('peekViewTitleDescription.foreground', { dark: '#ccccccb3', light: '#616161e6', hc: '#FFFFFF99' }, nls.localize('peekViewTitleInfoForeground', 'Color of the peek view title info.')); export const peekViewBorder = registerColor('peekView.border', { dark: '#007acc', light: '#007acc', hc: contrastBorder }, nls.localize('peekViewBorder', 'Color of the peek view borders and arrow.')); export const peekViewResultsBackground = registerColor('peekViewResult.background', { dark: '#252526', light: '#F3F3F3', hc: Color.black }, nls.localize('peekViewResultsBackground', 'Background color of the peek view result list.')); diff --git a/src/vs/editor/contrib/quickOpen/quickOpen.ts b/src/vs/editor/contrib/quickOpen/quickOpen.ts index 2730114175b26..69c379413e2f0 100644 --- a/src/vs/editor/contrib/quickOpen/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/quickOpen.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { illegalArgument } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; -import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { DocumentSymbol } from 'vs/editor/common/modes'; import { IModelService } from 'vs/editor/common/services/modelService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { OutlineModel, OutlineElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { values } from 'vs/base/common/collections'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { assertType } from 'vs/base/common/types'; export async function getDocumentSymbols(document: ITextModel, flat: boolean, token: CancellationToken): Promise { @@ -63,26 +63,19 @@ function flatten(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideCo } -registerLanguageCommand('_executeDocumentSymbolProvider', function (accessor, args) { - const { resource } = args; - if (!(resource instanceof URI)) { - throw illegalArgument('resource'); - } +CommandsRegistry.registerCommand('_executeDocumentSymbolProvider', async function (accessor, ...args) { + const [resource] = args; + assertType(URI.isUri(resource)); + const model = accessor.get(IModelService).getModel(resource); if (model) { return getDocumentSymbols(model, false, CancellationToken.None); } - return accessor.get(ITextModelService).createModelReference(resource).then(reference => { - return new Promise((resolve, reject) => { - try { - const result = getDocumentSymbols(reference.object.textEditorModel, false, CancellationToken.None); - resolve(result); - } catch (err) { - reject(err); - } - }).finally(() => { - reference.dispose(); - }); - }); + const reference = await accessor.get(ITextModelService).createModelReference(resource); + try { + return await getDocumentSymbols(reference.object.textEditorModel, false, CancellationToken.None); + } finally { + reference.dispose(); + } }); diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index 8eb67d9fe0468..28aba650e6abe 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; -import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IEditorProgressService } from 'vs/platform/progress/common/progress'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction, EditorCommand, registerEditorCommand, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; @@ -14,7 +14,6 @@ import { ITextModel } from 'vs/editor/common/model'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { RenameInputField, CONTEXT_RENAME_INPUT_VISIBLE } from './renameInputField'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; import { WorkspaceEdit, RenameProviderRegistry, RenameProvider, RenameLocation, Rejection } from 'vs/editor/common/modes'; import { Position, IPosition } from 'vs/editor/common/core/position'; import { alert } from 'vs/base/browser/ui/aria/aria'; @@ -30,6 +29,11 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance import { DisposableStore } from 'vs/base/common/lifecycle'; import { IdleValue, raceCancellation } from 'vs/base/common/async'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { ILogService } from 'vs/platform/log/common/log'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IConfigurationRegistry, ConfigurationScope, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; +import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService'; class RenameSkeleton { @@ -109,13 +113,14 @@ class RenameController implements IEditorContribution { constructor( private readonly editor: ICodeEditor, + @IInstantiationService private readonly _instaService: IInstantiationService, @INotificationService private readonly _notificationService: INotificationService, @IBulkEditService private readonly _bulkEditService: IBulkEditService, @IEditorProgressService private readonly _progressService: IEditorProgressService, - @IContextKeyService private readonly _contextKeyService: IContextKeyService, - @IThemeService private readonly _themeService: IThemeService, + @ILogService private readonly _logService: ILogService, + @ITextResourceConfigurationService private readonly _configService: ITextResourceConfigurationService, ) { - this._renameInputField = new IdleValue(() => this._dispoableStore.add(new RenameInputField(this.editor, this._themeService, this._contextKeyService))); + this._renameInputField = this._dispoableStore.add(new IdleValue(() => this._dispoableStore.add(this._instaService.createInstance(RenameInputField, this.editor, ['acceptRenameInput', 'acceptRenameInputWithPreview'])))); } dispose(): void { @@ -174,11 +179,12 @@ class RenameController implements IEditorContribution { selectionEnd = Math.min(loc.range.endColumn, selection.endColumn) - loc.range.startColumn; } - const newNameOrFocusFlag = await this._renameInputField.getValue().getInput(loc.range, loc.text, selectionStart, selectionEnd); + const supportPreview = this._bulkEditService.hasPreviewHandler() && this._configService.getValue(this.editor.getModel().uri, 'editor.rename.enablePreview'); + const inputFieldResult = await this._renameInputField.getValue().getInput(loc.range, loc.text, selectionStart, selectionEnd, supportPreview); - - if (typeof newNameOrFocusFlag === 'boolean') { - if (newNameOrFocusFlag) { + // no result, only hint to focus the editor or not + if (typeof inputFieldResult === 'boolean') { + if (inputFieldResult) { this.editor.focus(); } return undefined; @@ -186,7 +192,7 @@ class RenameController implements IEditorContribution { this.editor.focus(); - const renameOperation = raceCancellation(skeleton.provideRenameEdits(newNameOrFocusFlag, 0, [], this._cts.token), this._cts.token).then(async renameResult => { + const renameOperation = raceCancellation(skeleton.provideRenameEdits(inputFieldResult.newName, 0, [], this._cts.token), this._cts.token).then(async renameResult => { if (!renameResult || !this.editor.hasModel()) { return; @@ -197,16 +203,22 @@ class RenameController implements IEditorContribution { return; } - const editResult = await this._bulkEditService.apply(renameResult, { editor: this.editor }); - - // alert - if (editResult.ariaSummary) { - alert(nls.localize('aria', "Successfully renamed '{0}' to '{1}'. Summary: {2}", loc!.text, newNameOrFocusFlag, editResult.ariaSummary)); - } + this._bulkEditService.apply(renameResult, { + editor: this.editor, + showPreview: inputFieldResult.wantsPreview, + label: nls.localize('label', "Renaming '{0}'", loc?.text) + }).then(result => { + if (result.ariaSummary) { + alert(nls.localize('aria', "Successfully renamed '{0}' to '{1}'. Summary: {2}", loc!.text, inputFieldResult.newName, result.ariaSummary)); + } + }).catch(err => { + this._notificationService.error(nls.localize('rename.failedApply', "Rename failed to apply edits")); + this._logService.error(err); + }); }, err => { - this._notificationService.error(nls.localize('rename.failed', "Rename failed to execute.")); - return Promise.reject(err); + this._notificationService.error(nls.localize('rename.failed', "Rename failed to compute edits")); + this._logService.error(err); }); this._progressService.showWhile(renameOperation, 250); @@ -214,8 +226,8 @@ class RenameController implements IEditorContribution { } - acceptRenameInput(): void { - this._renameInputField.getValue().acceptInput(); + acceptRenameInput(wantsPreview: boolean): void { + this._renameInputField.getValue().acceptInput(wantsPreview); } cancelRenameInput(): void { @@ -238,7 +250,7 @@ export class RenameAction extends EditorAction { primary: KeyCode.F2, weight: KeybindingWeight.EditorContrib }, - menuOpts: { + contextMenuOpts: { group: '1_modification', order: 1.1 } @@ -282,7 +294,7 @@ const RenameCommand = EditorCommand.bindToContribution(RenameC registerEditorCommand(new RenameCommand({ id: 'acceptRenameInput', precondition: CONTEXT_RENAME_INPUT_VISIBLE, - handler: x => x.acceptRenameInput(), + handler: x => x.acceptRenameInput(false), kbOpts: { weight: KeybindingWeight.EditorContrib + 99, kbExpr: EditorContextKeys.focus, @@ -290,6 +302,17 @@ registerEditorCommand(new RenameCommand({ } })); +registerEditorCommand(new RenameCommand({ + id: 'acceptRenameInputWithPreview', + precondition: ContextKeyExpr.and(CONTEXT_RENAME_INPUT_VISIBLE, ContextKeyExpr.has('config.editor.rename.enablePreview')), + handler: x => x.acceptRenameInput(true), + kbOpts: { + weight: KeybindingWeight.EditorContrib + 99, + kbExpr: EditorContextKeys.focus, + primary: KeyMod.Shift + KeyCode.Enter + } +})); + registerEditorCommand(new RenameCommand({ id: 'cancelRenameInput', precondition: CONTEXT_RENAME_INPUT_VISIBLE, @@ -311,3 +334,17 @@ registerDefaultLanguageCommand('_executeDocumentRenameProvider', function (model } return rename(model, position, newName); }); + + +//todo@joh use editor options world +Registry.as(Extensions.Configuration).registerConfiguration({ + id: 'editor', + properties: { + 'editor.rename.enablePreview': { + scope: ConfigurationScope.LANGUAGE_OVERRIDABLE, + description: nls.localize('enablePreview', "Enable/disable the ability to preview changes before renaming"), + default: true, + type: 'boolean' + } + } +}); diff --git a/src/vs/editor/contrib/rename/renameInputField.css b/src/vs/editor/contrib/rename/renameInputField.css index 0478cd7ce48c3..99757bf38a4c3 100644 --- a/src/vs/editor/contrib/rename/renameInputField.css +++ b/src/vs/editor/contrib/rename/renameInputField.css @@ -8,6 +8,20 @@ color: inherit; } +.monaco-editor .rename-box.preview { + padding: 3px 3px 0 3px; +} + .monaco-editor .rename-box .rename-input { - padding: 4px; + padding: 3px; + width: calc(100% - 6px); +} + +.monaco-editor .rename-box .rename-label { + display: none; + opacity: .8; +} + +.monaco-editor .rename-box.preview .rename-label { + display: inherit; } diff --git a/src/vs/editor/contrib/rename/renameInputField.ts b/src/vs/editor/contrib/rename/renameInputField.ts index a87899a71a1ff..1a3e60e0071e6 100644 --- a/src/vs/editor/contrib/rename/renameInputField.ts +++ b/src/vs/editor/contrib/rename/renameInputField.ts @@ -4,166 +4,185 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./renameInputField'; -import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { DisposableStore } from 'vs/base/common/lifecycle'; import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser'; import { Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { ScrollType } from 'vs/editor/common/editorCommon'; import { localize } from 'vs/nls'; import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { inputBackground, inputBorder, inputForeground, widgetShadow } from 'vs/platform/theme/common/colorRegistry'; +import { inputBackground, inputBorder, inputForeground, widgetShadow, editorWidgetBackground } from 'vs/platform/theme/common/colorRegistry'; import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { toggleClass } from 'vs/base/browser/dom'; export const CONTEXT_RENAME_INPUT_VISIBLE = new RawContextKey('renameInputVisible', false); -export class RenameInputField implements IContentWidget, IDisposable { +export interface RenameInputFieldResult { + newName: string; + wantsPreview?: boolean; +} + +export class RenameInputField implements IContentWidget { - private _editor: ICodeEditor; private _position?: Position; private _domNode?: HTMLElement; - private _inputField?: HTMLInputElement; + private _input?: HTMLInputElement; + private _label?: HTMLDivElement; private _visible?: boolean; private readonly _visibleContextKey: IContextKey; private readonly _disposables = new DisposableStore(); - // Editor.IContentWidget.allowEditorOverflow - allowEditorOverflow: boolean = true; + readonly allowEditorOverflow: boolean = true; constructor( - editor: ICodeEditor, - private readonly themeService: IThemeService, - contextKeyService: IContextKeyService, + private readonly _editor: ICodeEditor, + private readonly _acceptKeybindings: [string, string], + @IThemeService private readonly _themeService: IThemeService, + @IKeybindingService private readonly _keybindingService: IKeybindingService, + @IContextKeyService contextKeyService: IContextKeyService, ) { this._visibleContextKey = CONTEXT_RENAME_INPUT_VISIBLE.bindTo(contextKeyService); - this._editor = editor; this._editor.addContentWidget(this); - this._disposables.add(editor.onDidChangeConfiguration(e => { + this._disposables.add(this._editor.onDidChangeConfiguration(e => { if (e.hasChanged(EditorOption.fontInfo)) { - this.updateFont(); + this._updateFont(); } })); - this._disposables.add(themeService.onThemeChange(theme => this.onThemeChange(theme))); + this._disposables.add(_themeService.onThemeChange(this._updateStyles, this)); } - private onThemeChange(theme: ITheme): void { - this.updateStyles(theme); - } - - public dispose(): void { + dispose(): void { this._disposables.dispose(); this._editor.removeContentWidget(this); } - public getId(): string { + getId(): string { return '__renameInputWidget'; } - public getDomNode(): HTMLElement { + getDomNode(): HTMLElement { if (!this._domNode) { - this._inputField = document.createElement('input'); - this._inputField.className = 'rename-input'; - this._inputField.type = 'text'; - this._inputField.setAttribute('aria-label', localize('renameAriaLabel', "Rename input. Type new name and press Enter to commit.")); this._domNode = document.createElement('div'); - this._domNode.style.height = `${this._editor.getOption(EditorOption.lineHeight)}px`; this._domNode.className = 'monaco-editor rename-box'; - this._domNode.appendChild(this._inputField); - this.updateFont(); - this.updateStyles(this.themeService.getTheme()); + this._input = document.createElement('input'); + this._input.className = 'rename-input'; + this._input.type = 'text'; + this._input.setAttribute('aria-label', localize('renameAriaLabel', "Rename input. Type new name and press Enter to commit.")); + this._domNode.appendChild(this._input); + + this._label = document.createElement('div'); + this._label.className = 'rename-label'; + this._domNode.appendChild(this._label); + const updateLabel = () => { + const [accept, preview] = this._acceptKeybindings; + this._keybindingService.lookupKeybinding(accept); + this._label!.innerText = localize('label', "{0} to Rename, {1} to Preview", this._keybindingService.lookupKeybinding(accept)?.getLabel(), this._keybindingService.lookupKeybinding(preview)?.getLabel()); + }; + updateLabel(); + this._disposables.add(this._keybindingService.onDidUpdateKeybindings(updateLabel)); + + this._updateFont(); + this._updateStyles(this._themeService.getTheme()); } return this._domNode; } - private updateStyles(theme: ITheme): void { - if (!this._inputField) { + private _updateStyles(theme: ITheme): void { + if (!this._input || !this._domNode) { return; } - const background = theme.getColor(inputBackground); - const foreground = theme.getColor(inputForeground); const widgetShadowColor = theme.getColor(widgetShadow); - const border = theme.getColor(inputBorder); - - this._inputField.style.backgroundColor = background ? background.toString() : ''; - this._inputField.style.color = foreground ? foreground.toString() : null; + this._domNode.style.backgroundColor = String(theme.getColor(editorWidgetBackground) ?? ''); + this._domNode.style.boxShadow = widgetShadowColor ? ` 0 2px 8px ${widgetShadowColor}` : ''; + this._domNode.style.color = String(theme.getColor(inputForeground) ?? ''); - this._inputField.style.borderWidth = border ? '1px' : '0px'; - this._inputField.style.borderStyle = border ? 'solid' : 'none'; - this._inputField.style.borderColor = border ? border.toString() : 'none'; - - this._domNode!.style.boxShadow = widgetShadowColor ? ` 0 2px 8px ${widgetShadowColor}` : ''; + this._input.style.backgroundColor = String(theme.getColor(inputBackground) ?? ''); + // this._input.style.color = String(theme.getColor(inputForeground) ?? ''); + const border = theme.getColor(inputBorder); + this._input.style.borderWidth = border ? '1px' : '0px'; + this._input.style.borderStyle = border ? 'solid' : 'none'; + this._input.style.borderColor = border?.toString() ?? 'none'; } - private updateFont(): void { - if (!this._inputField) { + private _updateFont(): void { + if (!this._input || !this._label) { return; } const fontInfo = this._editor.getOption(EditorOption.fontInfo); - this._inputField.style.fontFamily = fontInfo.fontFamily; - this._inputField.style.fontWeight = fontInfo.fontWeight; - this._inputField.style.fontSize = `${fontInfo.fontSize}px`; + this._input.style.fontFamily = fontInfo.fontFamily; + this._input.style.fontWeight = fontInfo.fontWeight; + this._input.style.fontSize = `${fontInfo.fontSize}px`; + + this._label.style.fontSize = `${fontInfo.fontSize * 0.8}px`; } - public getPosition(): IContentWidgetPosition | null { - return this._visible - ? { position: this._position!, preference: [ContentWidgetPositionPreference.BELOW, ContentWidgetPositionPreference.ABOVE] } - : null; + getPosition(): IContentWidgetPosition | null { + if (!this._visible) { + return null; + } + return { + position: this._position!, + preference: [ContentWidgetPositionPreference.BELOW, ContentWidgetPositionPreference.ABOVE] + }; } - private _currentAcceptInput: (() => void) | null = null; - private _currentCancelInput: ((focusEditor: boolean) => void) | null = null; + private _currentAcceptInput?: (wantsPreview: boolean) => void; + private _currentCancelInput?: (focusEditor: boolean) => void; - public acceptInput(): void { + acceptInput(wantsPreview: boolean): void { if (this._currentAcceptInput) { - this._currentAcceptInput(); + this._currentAcceptInput(wantsPreview); } } - public cancelInput(focusEditor: boolean): void { + cancelInput(focusEditor: boolean): void { if (this._currentCancelInput) { this._currentCancelInput(focusEditor); } } - public getInput(where: IRange, value: string, selectionStart: number, selectionEnd: number): Promise { + getInput(where: IRange, value: string, selectionStart: number, selectionEnd: number, supportPreview: boolean): Promise { + + toggleClass(this._domNode!, 'preview', supportPreview); this._position = new Position(where.startLineNumber, where.startColumn); - this._inputField!.value = value; - this._inputField!.setAttribute('selectionStart', selectionStart.toString()); - this._inputField!.setAttribute('selectionEnd', selectionEnd.toString()); - this._inputField!.size = Math.max((where.endColumn - where.startColumn) * 1.1, 20); + this._input!.value = value; + this._input!.setAttribute('selectionStart', selectionStart.toString()); + this._input!.setAttribute('selectionEnd', selectionEnd.toString()); + this._input!.size = Math.max((where.endColumn - where.startColumn) * 1.1, 20); const disposeOnDone = new DisposableStore(); - const always = () => { - disposeOnDone.dispose(); - this._hide(); - }; - return new Promise(resolve => { + return new Promise(resolve => { this._currentCancelInput = (focusEditor) => { - this._currentAcceptInput = null; - this._currentCancelInput = null; + this._currentAcceptInput = undefined; + this._currentCancelInput = undefined; resolve(focusEditor); return true; }; - this._currentAcceptInput = () => { - if (this._inputField!.value.trim().length === 0 || this._inputField!.value === value) { + this._currentAcceptInput = (wantsPreview) => { + if (this._input!.value.trim().length === 0 || this._input!.value === value) { // empty or whitespace only or not changed this.cancelInput(true); return; } - this._currentAcceptInput = null; - this._currentCancelInput = null; - resolve(this._inputField!.value); + this._currentAcceptInput = undefined; + this._currentCancelInput = undefined; + resolve({ + newName: this._input!.value, + wantsPreview: supportPreview && wantsPreview + }); }; let onCursorChanged = () => { @@ -178,12 +197,9 @@ export class RenameInputField implements IContentWidget, IDisposable { this._show(); - }).then(newValue => { - always(); - return newValue; - }, err => { - always(); - return Promise.reject(err); + }).finally(() => { + disposeOnDone.dispose(); + this._hide(); }); } @@ -194,10 +210,10 @@ export class RenameInputField implements IContentWidget, IDisposable { this._editor.layoutContentWidget(this); setTimeout(() => { - this._inputField!.focus(); - this._inputField!.setSelectionRange( - parseInt(this._inputField!.getAttribute('selectionStart')!), - parseInt(this._inputField!.getAttribute('selectionEnd')!)); + this._input!.focus(); + this._input!.setSelectionRange( + parseInt(this._input!.getAttribute('selectionStart')!), + parseInt(this._input!.getAttribute('selectionEnd')!)); }, 100); } diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index 81b60e73d91c6..c5e66c3b2f4ca 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -7,7 +7,7 @@ import * as arrays from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { EditorAction, IActionOptions, registerEditorAction, registerEditorContribution, ServicesAccessor, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { EditorAction, IActionOptions, registerEditorAction, registerEditorContribution, ServicesAccessor, registerModelCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; @@ -167,7 +167,7 @@ class GrowSelectionAction extends AbstractSmartSelect { }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '1_basic', title: nls.localize({ key: 'miSmartSelectGrow', comment: ['&& denotes a mnemonic'] }, "&&Expand Selection"), @@ -196,7 +196,7 @@ class ShrinkSelectionAction extends AbstractSmartSelect { }, weight: KeybindingWeight.EditorContrib }, - menubarOpts: { + menuOpts: { menuId: MenuId.MenubarSelectionMenu, group: '1_basic', title: nls.localize({ key: 'miSmartSelectShrink', comment: ['&& denotes a mnemonic'] }, "&&Shrink Selection"), @@ -302,6 +302,7 @@ export function provideSelectionRanges(model: ITextModel, positions: Position[], }); } -registerDefaultLanguageCommand('_executeSelectionRangeProvider', function (model, _position, args) { - return provideSelectionRanges(model, args.positions, CancellationToken.None); +registerModelCommand('_executeSelectionRangeProvider', function (model, ...args) { + const [positions] = args; + return provideSelectionRanges(model, positions, CancellationToken.None); }); diff --git a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts index f0eedb8324d39..e56cb2bb72fc9 100644 --- a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts +++ b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts @@ -17,6 +17,11 @@ import { provideSelectionRanges } from 'vs/editor/contrib/smartSelect/smartSelec import { CancellationToken } from 'vs/base/common/cancellation'; import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSelections'; import { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/modelService.test'; +import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { NullLogService } from 'vs/platform/log/common/log'; +import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService'; +import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService'; +import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService'; class MockJSMode extends MockMode { @@ -45,7 +50,7 @@ suite('SmartSelect', () => { setup(() => { const configurationService = new TestConfigurationService(); - modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService)); + modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService(), new NullLogService(), new UndoRedoService(new TestDialogService(), new TestNotificationService())); mode = new MockJSMode(); }); @@ -178,9 +183,11 @@ suite('SmartSelect', () => { // -- bracket selections async function assertRanges(provider: SelectionRangeProvider, value: string, ...expected: IRange[]): Promise { + let index = value.indexOf('|'); + value = value.replace('|', ''); let model = modelService.createModel(value, new StaticLanguageSelector(mode.getLanguageIdentifier()), URI.parse('fake:lang')); - let pos = model.getPositionAt(value.indexOf('|')); + let pos = model.getPositionAt(index); let all = await provider.provideSelectionRanges(model, [pos], CancellationToken.None); let ranges = all![0]; @@ -195,18 +202,18 @@ suite('SmartSelect', () => { test('bracket selection', async () => { await assertRanges(new BracketSelectionRangeProvider(), '(|)', - new Range(1, 2, 1, 3), new Range(1, 1, 1, 4) + new Range(1, 2, 1, 2), new Range(1, 1, 1, 3) ); await assertRanges(new BracketSelectionRangeProvider(), '[[[](|)]]', - new Range(1, 6, 1, 7), new Range(1, 5, 1, 8), // () - new Range(1, 3, 1, 8), new Range(1, 2, 1, 9), // [[]()] - new Range(1, 2, 1, 9), new Range(1, 1, 1, 10), // [[[]()]] + new Range(1, 6, 1, 6), new Range(1, 5, 1, 7), // () + new Range(1, 3, 1, 7), new Range(1, 2, 1, 8), // [[]()] + new Range(1, 2, 1, 8), new Range(1, 1, 1, 9), // [[[]()]] ); await assertRanges(new BracketSelectionRangeProvider(), '[a[](|)a]', - new Range(1, 6, 1, 7), new Range(1, 5, 1, 8), - new Range(1, 2, 1, 9), new Range(1, 1, 1, 10), + new Range(1, 6, 1, 6), new Range(1, 5, 1, 7), + new Range(1, 2, 1, 8), new Range(1, 1, 1, 9), ); // no bracket @@ -217,23 +224,23 @@ suite('SmartSelect', () => { await assertRanges(new BracketSelectionRangeProvider(), '|[[[]()]]'); // edge - await assertRanges(new BracketSelectionRangeProvider(), '[|[[]()]]', new Range(1, 2, 1, 9), new Range(1, 1, 1, 10)); - await assertRanges(new BracketSelectionRangeProvider(), '[[[]()]|]', new Range(1, 2, 1, 9), new Range(1, 1, 1, 10)); + await assertRanges(new BracketSelectionRangeProvider(), '[|[[]()]]', new Range(1, 2, 1, 8), new Range(1, 1, 1, 9)); + await assertRanges(new BracketSelectionRangeProvider(), '[[[]()]|]', new Range(1, 2, 1, 8), new Range(1, 1, 1, 9)); - await assertRanges(new BracketSelectionRangeProvider(), 'aaa(aaa)bbb(b|b)ccc(ccc)', new Range(1, 13, 1, 16), new Range(1, 12, 1, 17)); - await assertRanges(new BracketSelectionRangeProvider(), '(aaa(aaa)bbb(b|b)ccc(ccc))', new Range(1, 14, 1, 17), new Range(1, 13, 1, 18), new Range(1, 2, 1, 26), new Range(1, 1, 1, 27)); + await assertRanges(new BracketSelectionRangeProvider(), 'aaa(aaa)bbb(b|b)ccc(ccc)', new Range(1, 13, 1, 15), new Range(1, 12, 1, 16)); + await assertRanges(new BracketSelectionRangeProvider(), '(aaa(aaa)bbb(b|b)ccc(ccc))', new Range(1, 14, 1, 16), new Range(1, 13, 1, 17), new Range(1, 2, 1, 25), new Range(1, 1, 1, 26)); }); test('bracket with leading/trailing', async () => { await assertRanges(new BracketSelectionRangeProvider(), 'for(a of b){\n foo(|);\n}', - new Range(2, 7, 2, 8), new Range(2, 6, 2, 9), + new Range(2, 7, 2, 7), new Range(2, 6, 2, 8), new Range(1, 13, 3, 1), new Range(1, 12, 3, 2), new Range(1, 1, 3, 2), new Range(1, 1, 3, 2), ); await assertRanges(new BracketSelectionRangeProvider(), 'for(a of b)\n{\n foo(|);\n}', - new Range(3, 7, 3, 8), new Range(3, 6, 3, 9), + new Range(3, 7, 3, 7), new Range(3, 6, 3, 8), new Range(2, 2, 4, 1), new Range(2, 1, 4, 2), new Range(1, 1, 4, 2), new Range(1, 1, 4, 2), ); @@ -242,60 +249,60 @@ suite('SmartSelect', () => { test('in-word ranges', async () => { await assertRanges(new WordSelectionRangeProvider(), 'f|ooBar', - new Range(1, 1, 1, 5), // foo - new Range(1, 1, 1, 8), // fooBar - new Range(1, 1, 1, 8), // doc + new Range(1, 1, 1, 4), // foo + new Range(1, 1, 1, 7), // fooBar + new Range(1, 1, 1, 7), // doc ); await assertRanges(new WordSelectionRangeProvider(), 'f|oo_Ba', - new Range(1, 1, 1, 5), - new Range(1, 1, 1, 8), - new Range(1, 1, 1, 8), + new Range(1, 1, 1, 4), + new Range(1, 1, 1, 7), + new Range(1, 1, 1, 7), ); await assertRanges(new WordSelectionRangeProvider(), 'f|oo-Ba', - new Range(1, 1, 1, 5), - new Range(1, 1, 1, 8), - new Range(1, 1, 1, 8), + new Range(1, 1, 1, 4), + new Range(1, 1, 1, 7), + new Range(1, 1, 1, 7), ); }); test('Default selection should select current word/hump first in camelCase #67493', async function () { await assertRanges(new WordSelectionRangeProvider(), 'Abs|tractSmartSelect', - new Range(1, 1, 1, 10), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 1, 1, 9), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); await assertRanges(new WordSelectionRangeProvider(), 'AbstractSma|rtSelect', - new Range(1, 9, 1, 15), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 9, 1, 14), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); await assertRanges(new WordSelectionRangeProvider(), 'Abstrac-Sma|rt-elect', - new Range(1, 9, 1, 15), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 9, 1, 14), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); await assertRanges(new WordSelectionRangeProvider(), 'Abstrac_Sma|rt_elect', - new Range(1, 9, 1, 15), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 9, 1, 14), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); await assertRanges(new WordSelectionRangeProvider(), 'Abstrac_Sma|rt-elect', - new Range(1, 9, 1, 15), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 9, 1, 14), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); await assertRanges(new WordSelectionRangeProvider(), 'Abstrac_Sma|rtSelect', - new Range(1, 9, 1, 15), - new Range(1, 1, 1, 21), - new Range(1, 1, 1, 21), + new Range(1, 9, 1, 14), + new Range(1, 1, 1, 20), + new Range(1, 1, 1, 20), ); }); @@ -319,4 +326,49 @@ suite('SmartSelect', () => { reg.dispose(); }); + + test('Expand selection in words with underscores is inconsistent #90589', async function () { + + await assertRanges(new WordSelectionRangeProvider(), 'Hel|lo_World', + new Range(1, 1, 1, 6), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello_Wo|rld', + new Range(1, 7, 1, 12), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello|_World', + new Range(1, 1, 1, 6), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello_|World', + new Range(1, 7, 1, 12), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello|-World', + new Range(1, 1, 1, 6), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello-|World', + new Range(1, 7, 1, 12), + new Range(1, 1, 1, 12), + new Range(1, 1, 1, 12), + ); + + await assertRanges(new WordSelectionRangeProvider(), 'Hello|World', + new Range(1, 6, 1, 11), + new Range(1, 1, 1, 11), + new Range(1, 1, 1, 11), + ); + }); }); diff --git a/src/vs/editor/contrib/smartSelect/wordSelections.ts b/src/vs/editor/contrib/smartSelect/wordSelections.ts index 7402202af549e..280663f59a895 100644 --- a/src/vs/editor/contrib/smartSelect/wordSelections.ts +++ b/src/vs/editor/contrib/smartSelect/wordSelections.ts @@ -40,7 +40,7 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider { // LEFT anchor (start) for (; start >= 0; start--) { let ch = word.charCodeAt(start); - if (ch === CharCode.Underline || ch === CharCode.Dash) { + if ((start !== offset) && (ch === CharCode.Underline || ch === CharCode.Dash)) { // foo-bar OR foo_bar break; } else if (isLowerAsciiLetter(ch) && isUpperAsciiLetter(lastCh)) { diff --git a/src/vs/editor/contrib/snippet/snippetParser.ts b/src/vs/editor/contrib/snippet/snippetParser.ts index 7823405f14e08..c82aebf61811b 100644 --- a/src/vs/editor/contrib/snippet/snippetParser.ts +++ b/src/vs/editor/contrib/snippet/snippetParser.ts @@ -605,7 +605,7 @@ export class SnippetParser { // fill in values for placeholders. the first placeholder of an index // that has a value defines the value for all placeholders with that index - const placeholderDefaultValues = new Map(); + const placeholderDefaultValues = new Map(); const incompletePlaceholders: Placeholder[] = []; let placeholderCount = 0; snippet.walk(marker => { diff --git a/src/vs/editor/contrib/snippet/snippetSession.ts b/src/vs/editor/contrib/snippet/snippetSession.ts index 8af3c14063be3..fd2a141e9b1bb 100644 --- a/src/vs/editor/contrib/snippet/snippetSession.ts +++ b/src/vs/editor/contrib/snippet/snippetSession.ts @@ -468,6 +468,7 @@ export class SnippetSession { // that ensures the primiary cursor stays primary despite not being // the one with lowest start position edits[idx] = EditOperation.replace(snippetSelection, snippet.toString()); + edits[idx].identifier = { major: idx, minor: 0 }; // mark the edit so only our undo edits will be used to generate end cursors snippets[idx] = new OneSnippet(editor, snippet, offset); } @@ -507,7 +508,11 @@ export class SnippetSession { if (this._snippets[0].hasPlaceholder) { return this._move(true); } else { - return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition())); + return ( + undoEdits + .filter(edit => !!edit.identifier) // only use our undo edits + .map(edit => Selection.fromPositions(edit.range.getEndPosition())) + ); } }); this._editor.revealRange(this._editor.getSelections()[0]); @@ -529,7 +534,11 @@ export class SnippetSession { if (this._snippets[0].hasPlaceholder) { return this._move(undefined); } else { - return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition())); + return ( + undoEdits + .filter(edit => !!edit.identifier) // only use our undo edits + .map(edit => Selection.fromPositions(edit.range.getEndPosition())) + ); } }); } diff --git a/src/vs/editor/contrib/snippet/test/snippetController2.test.ts b/src/vs/editor/contrib/snippet/test/snippetController2.test.ts index e2e7d2d023dd3..4f67e00ac4e44 100644 --- a/src/vs/editor/contrib/snippet/test/snippetController2.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetController2.test.ts @@ -11,6 +11,8 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { NullLogService } from 'vs/platform/log/common/log'; import { Handler } from 'vs/editor/common/editorCommon'; +import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; suite('SnippetController2', function () { @@ -35,7 +37,7 @@ suite('SnippetController2', function () { setup(function () { contextKeys = new MockContextKeyService(); - model = TextModel.createFromString('if\n $state\nfi'); + model = createTextModel('if\n $state\nfi'); editor = createTestCodeEditor({ model: model }); editor.setSelections([new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5)]); assert.equal(model.getEOL(), '\n'); @@ -428,4 +430,13 @@ suite('SnippetController2', function () { assertSelections(editor, new Selection(2, 5, 2, 5)); assertContextKeys(contextKeys, false, false, false); }); + + test('issue #90135: confusing trim whitespace edits', function () { + const ctrl = new SnippetController2(editor, logService, contextKeys); + model.setValue(''); + CoreEditingCommands.Tab.runEditorCommand(null, editor, null); + + ctrl.insert('\nfoo'); + assertSelections(editor, new Selection(2, 8, 2, 8)); + }); }); diff --git a/src/vs/editor/contrib/snippet/test/snippetSession.test.ts b/src/vs/editor/contrib/snippet/test/snippetSession.test.ts index d4ae07a4a49db..cedf6be949ef8 100644 --- a/src/vs/editor/contrib/snippet/test/snippetSession.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetSession.test.ts @@ -11,6 +11,7 @@ import { TextModel } from 'vs/editor/common/model/textModel'; import { SnippetParser } from 'vs/editor/contrib/snippet/snippetParser'; import { SnippetSession } from 'vs/editor/contrib/snippet/snippetSession'; import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; suite('SnippetSession', function () { @@ -26,7 +27,7 @@ suite('SnippetSession', function () { } setup(function () { - model = TextModel.createFromString('function foo() {\n console.log(a);\n}'); + model = createTextModel('function foo() {\n console.log(a);\n}'); editor = createTestCodeEditor({ model: model }) as IActiveCodeEditor; editor.setSelections([new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5)]); assert.equal(model.getEOL(), '\n'); diff --git a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts index 06eb5f8777c13..b7012bec4779a 100644 --- a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts @@ -12,6 +12,7 @@ import { TextModel } from 'vs/editor/common/model/textModel'; import { Workspace, toWorkspaceFolders, IWorkspace, IWorkspaceContextService, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { ILabelService } from 'vs/platform/label/common/label'; import { mock } from 'vs/editor/contrib/suggest/test/suggestModel.test'; +import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; suite('Snippet Variables Resolver', function () { @@ -25,7 +26,7 @@ suite('Snippet Variables Resolver', function () { let resolver: VariableResolver; setup(function () { - model = TextModel.createFromString([ + model = createTextModel([ 'this is line one', 'this is line two', ' this is line three' @@ -67,7 +68,7 @@ suite('Snippet Variables Resolver', function () { resolver = new ModelBasedVariableResolver( labelService, - TextModel.createFromString('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi')) + createTextModel('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi')) ); assertVariableResolve(resolver, 'TM_FILENAME', 'ghi'); if (!isWindows) { @@ -77,7 +78,7 @@ suite('Snippet Variables Resolver', function () { resolver = new ModelBasedVariableResolver( labelService, - TextModel.createFromString('', undefined, undefined, URI.parse('mem:fff.ts')) + createTextModel('', undefined, undefined, URI.parse('mem:fff.ts')) ); assertVariableResolve(resolver, 'TM_DIRECTORY', ''); assertVariableResolve(resolver, 'TM_FILEPATH', 'fff.ts'); @@ -92,7 +93,7 @@ suite('Snippet Variables Resolver', function () { } }; - const model = TextModel.createFromString([].join('\n'), undefined, undefined, URI.parse('foo:///foo/files/text.txt')); + const model = createTextModel([].join('\n'), undefined, undefined, URI.parse('foo:///foo/files/text.txt')); const resolver = new CompositeSnippetVariableResolver([new ModelBasedVariableResolver(labelService, model)]); @@ -144,19 +145,19 @@ suite('Snippet Variables Resolver', function () { resolver = new ModelBasedVariableResolver( labelService, - TextModel.createFromString('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi')) + createTextModel('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi')) ); assertVariableResolve(resolver, 'TM_FILENAME_BASE', 'ghi'); resolver = new ModelBasedVariableResolver( labelService, - TextModel.createFromString('', undefined, undefined, URI.parse('mem:.git')) + createTextModel('', undefined, undefined, URI.parse('mem:.git')) ); assertVariableResolve(resolver, 'TM_FILENAME_BASE', '.git'); resolver = new ModelBasedVariableResolver( labelService, - TextModel.createFromString('', undefined, undefined, URI.parse('mem:foo.')) + createTextModel('', undefined, undefined, URI.parse('mem:foo.')) ); assertVariableResolve(resolver, 'TM_FILENAME_BASE', 'foo'); }); diff --git a/src/vs/editor/contrib/suggest/completionModel.ts b/src/vs/editor/contrib/suggest/completionModel.ts index c1349fa7935e8..fbc6954b44d21 100644 --- a/src/vs/editor/contrib/suggest/completionModel.ts +++ b/src/vs/editor/contrib/suggest/completionModel.ts @@ -192,6 +192,7 @@ export class CompletionModel { } } + const textLabel = typeof item.completion.label === 'string' ? item.completion.label : item.completion.label.name; if (wordPos >= wordLen) { // the wordPos at which scoring starts is the whole word // and therefore the same rules as not having a word apply @@ -206,19 +207,19 @@ export class CompletionModel { if (!match) { continue; // NO match } - if (compareIgnoreCase(item.completion.filterText, item.completion.label) === 0) { + if (compareIgnoreCase(item.completion.filterText, textLabel) === 0) { // filterText and label are actually the same -> use good highlights item.score = match; } else { // re-run the scorer on the label in the hope of a result BUT use the rank // of the filterText-match - item.score = anyScore(word, wordLow, wordPos, item.completion.label, item.labelLow, 0); + item.score = anyScore(word, wordLow, wordPos, textLabel, item.labelLow, 0); item.score[0] = match[0]; // use score from filterText } } else { // by default match `word` against the `label` - let match = scoreFn(word, wordLow, wordPos, item.completion.label, item.labelLow, 0, false); + let match = scoreFn(word, wordLow, wordPos, textLabel, item.labelLow, 0, false); if (!match) { continue; // NO match } diff --git a/src/vs/editor/contrib/suggest/media/suggest.css b/src/vs/editor/contrib/suggest/media/suggest.css index a58882341b8b9..821cb7d262395 100644 --- a/src/vs/editor/contrib/suggest/media/suggest.css +++ b/src/vs/editor/contrib/suggest/media/suggest.css @@ -99,20 +99,61 @@ overflow: hidden; text-overflow: ellipsis; white-space: pre; + justify-content: space-between; +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left, +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right { + display: flex; } .monaco-editor .suggest-widget:not(.frozen) .monaco-highlighted-label .highlight { font-weight: bold; } -/** Icon styles **/ +/** Status Bar **/ + +.monaco-editor .suggest-widget > .suggest-status-bar { + visibility: hidden; + + position: absolute; + left: 0; + + box-sizing: border-box; + + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + + width: 100%; + + font-size: 80%; + + border-left-width: 1px; + border-left-style: solid; + border-right-width: 1px; + border-right-style: solid; + border-bottom-width: 1px; + border-bottom-style: solid; + + padding: 0 8px 0 4px; +} + +.monaco-editor .suggest-widget.list-right.docs-side > .suggest-status-bar { + left: auto; + right: 0; +} +.monaco-editor .suggest-widget.docs-side > .suggest-status-bar { + width: 50%; +} + +/** ReadMore Icon styles **/ .monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .header > .codicon-close, -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .readMore::before { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .readMore::before { color: inherit; - opacity: 0.6; + opacity: 1; font-size: 14px; - margin-left: 4px; cursor: pointer; } @@ -123,46 +164,128 @@ } .monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .header > .codicon-close:hover, -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .readMore:hover { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .readMore:hover { opacity: 1; } +/** signature, qualifier, type/details opacity **/ +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .signature-label, +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .qualifier-label, +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .details-label { + opacity: 0.7; +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .signature-label { + overflow: auto; + text-overflow: ellipsis; +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .qualifier-label { + margin-left: 4px; + opacity: 0.4; + font-size: 90%; + text-overflow: ellipsis; + overflow: hidden; + line-height: 17px; + align-self: center; +} + /** Type Info and icon next to the label in the focused completion item **/ -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .type-label { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .details-label { margin-left: 0.8em; - flex: 1; - text-align: right; overflow: hidden; text-overflow: ellipsis; - opacity: 0.7; white-space: nowrap; } -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .type-label > .monaco-tokenized-source { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .details-label > .monaco-tokenized-source { display: inline; } -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .readMore, -.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .type-label, -.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row.focused > .contents > .main > .readMore, -.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row.focused > .contents > .main > .type-label, -.monaco-editor .suggest-widget.docs-below .monaco-list .monaco-list-row.focused > .contents > .main > .readMore { +/** Details: if using CompletionItem#details, show on focus **/ + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .details-label, +.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row.focused > .contents > .main > .right > .details-label { display: none; } -.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused > .contents > .main > .readMore, -.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused > .contents > .main > .type-label { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused > .contents > .main > .right > .details-label { + display: inline; +} + +/** Details: if using CompletionItemLabel#details, always show **/ + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row:not(.string-label) > .contents > .main > .right > .details-label, +.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row.focused:not(.string-label) > .contents > .main > .right > .details-label { display: inline; } +/** Ellipsis on hover **/ +.monaco-editor .suggest-widget:not(.docs-side) .monaco-list .monaco-list-row:hover > .contents > .main > .right.can-expand-details > .details-label { + width: calc(100% - 26px); +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left { + flex-shrink: 1; + overflow: hidden; +} +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .monaco-icon-label { + flex-shrink: 0; +} +.monaco-editor .suggest-widget .monaco-list .monaco-list-row:not(.string-label) > .contents > .main > .left > .monaco-icon-label { + max-width: 80%; +} +.monaco-editor .suggest-widget .monaco-list .monaco-list-row.string-label > .contents > .main > .left > .monaco-icon-label { + flex-shrink: 1; +} +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right { + overflow: hidden; + margin-left: 16px; + flex-shrink: 0; + max-width: 45%; +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .right > .readMore { + display: inline-block; + position: absolute; + right: 10px; + width: 18px; + height: 18px; + visibility: hidden; +} + +/** Do NOT display ReadMore when docs is side/below **/ +.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row > .contents > .main > .right > .readMore, +.monaco-editor .suggest-widget.docs-below .monaco-list .monaco-list-row > .contents > .main > .right > .readMore { + display: none !important; +} + +/** Do NOT display ReadMore when using plain CompletionItemLabel (details/documentation might not be resolved) **/ +.monaco-editor .suggest-widget .monaco-list .monaco-list-row.string-label > .contents > .main > .right > .readMore { + display: none; +} +/** Focused item can show ReadMore, but can't when docs is side/below **/ +.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused.string-label > .contents > .main > .right > .readMore { + display: inline-block; +} + +.monaco-editor .suggest-widget.docs-side .monaco-list .monaco-list-row > .contents > .main > .right > .readMore, +.monaco-editor .suggest-widget.docs-below .monaco-list .monaco-list-row > .contents > .main > .right > .readMore { + display: none; +} + +.monaco-editor .suggest-widget .monaco-list .monaco-list-row:hover > .contents > .main > .right > .readMore { + visibility: visible; +} + /** Styles for each row in the list **/ .monaco-editor .suggest-widget .monaco-list .monaco-list-row .monaco-icon-label.deprecated { opacity: 0.66; text-decoration: unset; } -.monaco-editor .suggest-widget .monaco-list .monaco-list-row .monaco-icon-label.deprecated > .monaco-icon-label-description-container { +.monaco-editor .suggest-widget .monaco-list .monaco-list-row .monaco-icon-label.deprecated > .monaco-icon-label-container > .monaco-icon-name-container { text-decoration: line-through; } @@ -248,6 +371,7 @@ .monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs { padding: 0; white-space: initial; + min-height: calc(1rem + 8px); } .monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .docs.markdown-docs > div, @@ -276,3 +400,11 @@ border-radius: 3px; padding: 0 0.4em; } + + +/* replace/insert decorations */ + +.monaco-editor .suggest-insert-unexpected { + font-style: italic; +} + diff --git a/src/vs/editor/contrib/suggest/media/suggestStatusBar.css b/src/vs/editor/contrib/suggest/media/suggestStatusBar.css new file mode 100644 index 0000000000000..f645f3c0240c1 --- /dev/null +++ b/src/vs/editor/contrib/suggest/media/suggestStatusBar.css @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-editor .suggest-widget.with-status-bar .suggest-status-bar { + visibility: visible; +} +.monaco-editor .suggest-widget.with-status-bar > .tree { + margin-bottom: 18px; +} + +.monaco-editor .suggest-widget.with-status-bar .suggest-status-bar .action-label { + min-height: 18px; + opacity: 0.5; + color: inherit; +} + +.monaco-editor .suggest-widget.with-status-bar .suggest-status-bar .action-item:not(:last-of-type) .action-label { + margin-right: 0; +} + +.monaco-editor .suggest-widget.with-status-bar .suggest-status-bar .action-item:not(:last-of-type) .action-label::after { + content: ', '; + margin-right: 0.3em; +} + +.monaco-editor .suggest-widget.with-status-bar .monaco-list .monaco-list-row > .contents > .main > .right > .readMore, +.monaco-editor .suggest-widget.with-status-bar .monaco-list .monaco-list-row.focused.string-label > .contents > .main > .right > .readMore { + display: none; +} + +.monaco-editor .suggest-widget.with-status-bar:not(.docs-side) .monaco-list .monaco-list-row:hover > .contents > .main > .right.can-expand-details > .details-label { + width: 100%; +} diff --git a/src/vs/editor/contrib/suggest/suggest.ts b/src/vs/editor/contrib/suggest/suggest.ts index d28423e1602f1..b7fa71fefe72f 100644 --- a/src/vs/editor/contrib/suggest/suggest.ts +++ b/src/vs/editor/contrib/suggest/suggest.ts @@ -17,25 +17,38 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { Range } from 'vs/editor/common/core/range'; import { FuzzyScore } from 'vs/base/common/filters'; import { isDisposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { MenuId } from 'vs/platform/actions/common/actions'; export const Context = { Visible: new RawContextKey('suggestWidgetVisible', false), + DetailsVisible: new RawContextKey('suggestWidgetDetailsVisible', false), MultipleSuggestions: new RawContextKey('suggestWidgetMultipleSuggestions', false), MakesTextEdit: new RawContextKey('suggestionMakesTextEdit', true), - AcceptSuggestionsOnEnter: new RawContextKey('acceptSuggestionOnEnter', true) + AcceptSuggestionsOnEnter: new RawContextKey('acceptSuggestionOnEnter', true), + HasInsertAndReplaceRange: new RawContextKey('suggestionHasInsertAndReplaceRange', false), + CanResolve: new RawContextKey('suggestionCanResolve', false), }; +export const suggestWidgetStatusbarMenu = new MenuId('suggestWidgetStatusBar'); + export class CompletionItem { _brand!: 'ISuggestionItem'; + private static readonly _defaultResolve = () => Promise.resolve(); + readonly resolve: (token: CancellationToken) => Promise; + isResolved: boolean = false; + // readonly editStart: IPosition; readonly editInsertEnd: IPosition; readonly editReplaceEnd: IPosition; + // + readonly textLabel: string; + // perf readonly labelLow: string; readonly sortTextLow?: string; @@ -54,8 +67,13 @@ export class CompletionItem { readonly provider: modes.CompletionItemProvider, model: ITextModel ) { + this.textLabel = typeof completion.label === 'string' + ? completion.label + : completion.label.name; + // ensure lower-variants (perf) - this.labelLow = completion.label.toLowerCase(); + this.labelLow = this.textLabel.toLowerCase(); + this.sortTextLow = completion.sortText && completion.sortText.toLowerCase(); this.filterTextLow = completion.filterText && completion.filterText.toLowerCase(); @@ -73,15 +91,15 @@ export class CompletionItem { // create the suggestion resolver const { resolveCompletionItem } = provider; if (typeof resolveCompletionItem !== 'function') { - this.resolve = () => Promise.resolve(); + this.resolve = CompletionItem._defaultResolve; + this.isResolved = true; } else { let cached: Promise | undefined; this.resolve = (token) => { if (!cached) { - let isDone = false; - cached = Promise.resolve(resolveCompletionItem.call(provider, model, position, completion, token)).then(value => { + cached = Promise.resolve(resolveCompletionItem.call(provider, model, Position.lift(position), completion, token)).then(value => { assign(completion, value); - isDone = true; + this.isResolved = true; }, err => { if (isPromiseCanceledError(err)) { // the IPC queue will reject the request with the @@ -90,7 +108,7 @@ export class CompletionItem { } }); token.onCancellationRequested(() => { - if (!isDone) { + if (!this.isResolved) { // cancellation after the request has been // dispatched -> reset cache cached = undefined; @@ -183,7 +201,7 @@ export function provideSuggestionItems( } // fill in default sortText when missing if (!suggestion.sortText) { - suggestion.sortText = suggestion.label; + suggestion.sortText = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name; } allSuggestions.push(new CompletionItem(position, suggestion, container, provider, model)); diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index 007b89d720391..8d821f00fd085 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -23,7 +23,7 @@ import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/c import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { Context as SuggestContext, CompletionItem } from './suggest'; +import { Context as SuggestContext, CompletionItem, suggestWidgetStatusbarMenu } from './suggest'; import { SuggestAlternatives } from './suggestAlternatives'; import { State, SuggestModel } from './suggestModel'; import { ISelectedSuggestion, SuggestWidget } from './suggestWidget'; @@ -31,18 +31,18 @@ import { WordContextKey } from 'vs/editor/contrib/suggest/wordContextKey'; import { Event } from 'vs/base/common/event'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { IdleValue } from 'vs/base/common/async'; -import { isObject } from 'vs/base/common/types'; +import { isObject, assertType } from 'vs/base/common/types'; import { CommitCharacterController } from './suggestCommitCharacters'; -import { IPosition } from 'vs/editor/common/core/position'; +import { IPosition, Position } from 'vs/editor/common/core/position'; import { TrackedRangeStickiness, ITextModel } from 'vs/editor/common/model'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; import * as platform from 'vs/base/common/platform'; +import { SuggestRangeHighlighter } from 'vs/editor/contrib/suggest/suggestRangeHighlighter'; +import { MenuRegistry } from 'vs/platform/actions/common/actions'; -/** - * Stop suggest widget from disappearing when clicking into other areas - * For development purpose only - */ -const _sticky = false; +// sticky suggest widget which doesn't disappear on focus out and such +let _sticky = false; +// _sticky = Boolean("true"); // done "weirdly" so that a lint warning prevents you from pushing this class LineSuffix { @@ -101,55 +101,68 @@ export class SuggestController implements IEditorContribution { return editor.getContribution(SuggestController.ID); } - private readonly _model: SuggestModel; - private readonly _widget: IdleValue; + readonly editor: ICodeEditor; + readonly model: SuggestModel; + readonly widget: IdleValue; + private readonly _alternatives: IdleValue; private readonly _lineSuffix = new MutableDisposable(); private readonly _toDispose = new DisposableStore(); constructor( - private _editor: ICodeEditor, + editor: ICodeEditor, @IEditorWorkerService editorWorker: IEditorWorkerService, @ISuggestMemoryService private readonly _memoryService: ISuggestMemoryService, @ICommandService private readonly _commandService: ICommandService, @IContextKeyService private readonly _contextKeyService: IContextKeyService, @IInstantiationService private readonly _instantiationService: IInstantiationService, ) { - this._model = new SuggestModel(this._editor, editorWorker); + this.editor = editor; + this.model = new SuggestModel(this.editor, editorWorker); - this._widget = new IdleValue(() => { + this.widget = this._toDispose.add(new IdleValue(() => { - const widget = this._instantiationService.createInstance(SuggestWidget, this._editor); + const widget = this._instantiationService.createInstance(SuggestWidget, this.editor); this._toDispose.add(widget); this._toDispose.add(widget.onDidSelect(item => this._insertSuggestion(item, 0), this)); // Wire up logic to accept a suggestion on certain characters - const commitCharacterController = new CommitCharacterController(this._editor, widget, item => this._insertSuggestion(item, InsertFlags.NoAfterUndoStop)); + const commitCharacterController = new CommitCharacterController(this.editor, widget, item => this._insertSuggestion(item, InsertFlags.NoAfterUndoStop)); this._toDispose.add(commitCharacterController); - this._toDispose.add(this._model.onDidSuggest(e => { + this._toDispose.add(this.model.onDidSuggest(e => { if (e.completionModel.items.length === 0) { commitCharacterController.reset(); } })); // Wire up makes text edit context key - let makesTextEdit = SuggestContext.MakesTextEdit.bindTo(this._contextKeyService); + const ctxMakesTextEdit = SuggestContext.MakesTextEdit.bindTo(this._contextKeyService); + const ctxHasInsertAndReplace = SuggestContext.HasInsertAndReplaceRange.bindTo(this._contextKeyService); + const ctxCanResolve = SuggestContext.CanResolve.bindTo(this._contextKeyService); + + this._toDispose.add(toDisposable(() => { + ctxMakesTextEdit.reset(); + ctxHasInsertAndReplace.reset(); + ctxCanResolve.reset(); + })); + this._toDispose.add(widget.onDidFocus(({ item }) => { - const position = this._editor.getPosition()!; + // (ctx: makesTextEdit) + const position = this.editor.getPosition()!; const startColumn = item.editStart.column; const endColumn = position.column; let value = true; if ( - this._editor.getOption(EditorOption.acceptSuggestionOnEnter) === 'smart' - && this._model.state === State.Auto + this.editor.getOption(EditorOption.acceptSuggestionOnEnter) === 'smart' + && this.model.state === State.Auto && !item.completion.command && !item.completion.additionalTextEdits && !(item.completion.insertTextRules! & CompletionItemInsertTextRule.InsertAsSnippet) && endColumn - startColumn === item.completion.insertText.length ) { - const oldText = this._editor.getModel()!.getValueInRange({ + const oldText = this.editor.getModel()!.getValueInRange({ startLineNumber: position.lineNumber, startColumn, endLineNumber: position.lineNumber, @@ -157,71 +170,79 @@ export class SuggestController implements IEditorContribution { }); value = oldText !== item.completion.insertText; } - makesTextEdit.set(value); + ctxMakesTextEdit.set(value); + + // (ctx: hasInsertAndReplaceRange) + ctxHasInsertAndReplace.set(!Position.equals(item.editInsertEnd, item.editReplaceEnd)); + + // (ctx: canResolve) + ctxCanResolve.set(Boolean(item.provider.resolveCompletionItem) || Boolean(item.completion.documentation) || item.completion.detail !== item.completion.label); + })); + + this._toDispose.add(widget.onDetailsKeyDown(e => { + // cmd + c on macOS, ctrl + c on Win / Linux + if ( + e.toKeybinding().equals(new SimpleKeybinding(true, false, false, false, KeyCode.KEY_C)) || + (platform.isMacintosh && e.toKeybinding().equals(new SimpleKeybinding(false, false, false, true, KeyCode.KEY_C))) + ) { + e.stopPropagation(); + return; + } + + if (!e.toKeybinding().isModifierKey()) { + this.editor.focus(); + } })); - this._toDispose.add(toDisposable(() => makesTextEdit.reset())); return widget; - }); + })); - this._alternatives = new IdleValue(() => { - return this._toDispose.add(new SuggestAlternatives(this._editor, this._contextKeyService)); - }); + this._alternatives = this._toDispose.add(new IdleValue(() => { + return this._toDispose.add(new SuggestAlternatives(this.editor, this._contextKeyService)); + })); - this._toDispose.add(_instantiationService.createInstance(WordContextKey, _editor)); + this._toDispose.add(_instantiationService.createInstance(WordContextKey, editor)); - this._toDispose.add(this._model.onDidTrigger(e => { - this._widget.getValue().showTriggered(e.auto, e.shy ? 250 : 50); - this._lineSuffix.value = new LineSuffix(this._editor.getModel()!, e.position); + this._toDispose.add(this.model.onDidTrigger(e => { + this.widget.getValue().showTriggered(e.auto, e.shy ? 250 : 50); + this._lineSuffix.value = new LineSuffix(this.editor.getModel()!, e.position); })); - this._toDispose.add(this._model.onDidSuggest(e => { + this._toDispose.add(this.model.onDidSuggest(e => { if (!e.shy) { - let index = this._memoryService.select(this._editor.getModel()!, this._editor.getPosition()!, e.completionModel.items); - this._widget.getValue().showSuggestions(e.completionModel, index, e.isFrozen, e.auto); + let index = this._memoryService.select(this.editor.getModel()!, this.editor.getPosition()!, e.completionModel.items); + this.widget.getValue().showSuggestions(e.completionModel, index, e.isFrozen, e.auto); } })); - this._toDispose.add(this._model.onDidCancel(e => { + this._toDispose.add(this.model.onDidCancel(e => { if (!e.retrigger) { - this._widget.getValue().hideWidget(); + this.widget.getValue().hideWidget(); } })); - this._toDispose.add(this._editor.onDidBlurEditorWidget(() => { + this._toDispose.add(this.editor.onDidBlurEditorWidget(() => { if (!_sticky) { - this._model.cancel(); - this._model.clear(); - } - })); - - this._toDispose.add(this._widget.getValue().onDetailsKeyDown(e => { - // cmd + c on macOS, ctrl + c on Win / Linux - if ( - e.toKeybinding().equals(new SimpleKeybinding(true, false, false, false, KeyCode.KEY_C)) || - (platform.isMacintosh && e.toKeybinding().equals(new SimpleKeybinding(false, false, false, true, KeyCode.KEY_C))) - ) { - e.stopPropagation(); - return; - } - - if (!e.toKeybinding().isModifierKey()) { - this._editor.focus(); + this.model.cancel(); + this.model.clear(); } })); // Manage the acceptSuggestionsOnEnter context key let acceptSuggestionsOnEnter = SuggestContext.AcceptSuggestionsOnEnter.bindTo(_contextKeyService); let updateFromConfig = () => { - const acceptSuggestionOnEnter = this._editor.getOption(EditorOption.acceptSuggestionOnEnter); + const acceptSuggestionOnEnter = this.editor.getOption(EditorOption.acceptSuggestionOnEnter); acceptSuggestionsOnEnter.set(acceptSuggestionOnEnter === 'on' || acceptSuggestionOnEnter === 'smart'); }; - this._toDispose.add(this._editor.onDidChangeConfiguration(() => updateFromConfig())); + this._toDispose.add(this.editor.onDidChangeConfiguration(() => updateFromConfig())); updateFromConfig(); + + // create range highlighter + this._toDispose.add(new SuggestRangeHighlighter(this)); } dispose(): void { this._alternatives.dispose(); this._toDispose.dispose(); - this._widget.dispose(); - this._model.dispose(); + this.widget.dispose(); + this.model.dispose(); this._lineSuffix.dispose(); } @@ -231,73 +252,67 @@ export class SuggestController implements IEditorContribution { ): void { if (!event || !event.item) { this._alternatives.getValue().reset(); - this._model.cancel(); - this._model.clear(); + this.model.cancel(); + this.model.clear(); return; } - if (!this._editor.hasModel()) { + if (!this.editor.hasModel()) { return; } - const model = this._editor.getModel(); + const model = this.editor.getModel(); const modelVersionNow = model.getAlternativeVersionId(); const { item } = event; - const { completion: suggestion, position } = item; - const columnDelta = this._editor.getPosition().column - position.column; + const { completion: suggestion } = item; // pushing undo stops *before* additional text edits and // *after* the main edit if (!(flags & InsertFlags.NoBeforeUndoStop)) { - this._editor.pushUndoStop(); + this.editor.pushUndoStop(); } - if (Array.isArray(suggestion.additionalTextEdits)) { - this._editor.executeEdits('suggestController.additionalTextEdits', suggestion.additionalTextEdits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text))); - } + // compute overwrite[Before|After] deltas BEFORE applying extra edits + const info = this.getOverwriteInfo(item, Boolean(flags & InsertFlags.AlternativeOverwriteConfig)); // keep item in memory - this._memoryService.memorize(model, this._editor.getPosition(), item); + this._memoryService.memorize(model, this.editor.getPosition(), item); + + if (Array.isArray(suggestion.additionalTextEdits)) { + this.editor.executeEdits('suggestController.additionalTextEdits', suggestion.additionalTextEdits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text))); + } let { insertText } = suggestion; if (!(suggestion.insertTextRules! & CompletionItemInsertTextRule.InsertAsSnippet)) { insertText = SnippetParser.escape(insertText); } - const overwriteConfig = flags & InsertFlags.AlternativeOverwriteConfig - ? !this._editor.getOption(EditorOption.suggest).overwriteOnAccept - : this._editor.getOption(EditorOption.suggest).overwriteOnAccept; - - const overwriteBefore = position.column - item.editStart.column; - const overwriteAfter = (overwriteConfig ? item.editReplaceEnd.column : item.editInsertEnd.column) - position.column; - const suffixDelta = this._lineSuffix.value ? this._lineSuffix.value.delta(this._editor.getPosition()) : 0; - - SnippetController2.get(this._editor).insert(insertText, { - overwriteBefore: overwriteBefore + columnDelta, - overwriteAfter: overwriteAfter + suffixDelta, + SnippetController2.get(this.editor).insert(insertText, { + overwriteBefore: info.overwriteBefore, + overwriteAfter: info.overwriteAfter, undoStopBefore: false, undoStopAfter: false, adjustWhitespace: !(suggestion.insertTextRules! & CompletionItemInsertTextRule.KeepWhitespace) }); if (!(flags & InsertFlags.NoAfterUndoStop)) { - this._editor.pushUndoStop(); + this.editor.pushUndoStop(); } if (!suggestion.command) { // done - this._model.cancel(); - this._model.clear(); + this.model.cancel(); + this.model.clear(); } else if (suggestion.command.id === TriggerSuggestAction.id) { // retigger - this._model.trigger({ auto: true, shy: false }, true); + this.model.trigger({ auto: true, shy: false }, true); } else { // exec command, done this._commandService.executeCommand(suggestion.command.id, ...(suggestion.command.arguments ? [...suggestion.command.arguments] : [])) .catch(onUnexpectedError) - .finally(() => this._model.clear()); // <- clear only now, keep commands alive - this._model.cancel(); + .finally(() => this.model.clear()); // <- clear only now, keep commands alive + this.model.cancel(); } if (flags & InsertFlags.KeepAlternativeSuggestions) { @@ -321,30 +336,49 @@ export class SuggestController implements IEditorContribution { this._alertCompletionItem(event.item); } + getOverwriteInfo(item: CompletionItem, toggleMode: boolean): { overwriteBefore: number, overwriteAfter: number } { + assertType(this.editor.hasModel()); + + let replace = this.editor.getOption(EditorOption.suggest).insertMode === 'replace'; + if (toggleMode) { + replace = !replace; + } + const overwriteBefore = item.position.column - item.editStart.column; + const overwriteAfter = (replace ? item.editReplaceEnd.column : item.editInsertEnd.column) - item.position.column; + const columnDelta = this.editor.getPosition().column - item.position.column; + const suffixDelta = this._lineSuffix.value ? this._lineSuffix.value.delta(this.editor.getPosition()) : 0; + + return { + overwriteBefore: overwriteBefore + columnDelta, + overwriteAfter: overwriteAfter + suffixDelta + }; + } + private _alertCompletionItem({ completion: suggestion }: CompletionItem): void { + const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name; if (isNonEmptyArray(suggestion.additionalTextEdits)) { - let msg = nls.localize('arai.alert.snippet', "Accepting '{0}' made {1} additional edits", suggestion.label, suggestion.additionalTextEdits.length); + let msg = nls.localize('arai.alert.snippet', "Accepting '{0}' made {1} additional edits", textLabel, suggestion.additionalTextEdits.length); alert(msg); } } triggerSuggest(onlyFrom?: Set): void { - if (this._editor.hasModel()) { - this._model.trigger({ auto: false, shy: false }, false, onlyFrom); - this._editor.revealLine(this._editor.getPosition().lineNumber, ScrollType.Smooth); - this._editor.focus(); + if (this.editor.hasModel()) { + this.model.trigger({ auto: false, shy: false }, false, onlyFrom); + this.editor.revealLine(this.editor.getPosition().lineNumber, ScrollType.Smooth); + this.editor.focus(); } } triggerSuggestAndAcceptBest(arg: { fallback: string }): void { - if (!this._editor.hasModel()) { + if (!this.editor.hasModel()) { return; } - const positionNow = this._editor.getPosition(); + const positionNow = this.editor.getPosition(); const fallback = () => { - if (positionNow.equals(this._editor.getPosition()!)) { + if (positionNow.equals(this.editor.getPosition()!)) { this._commandService.executeCommand(arg.fallback); } }; @@ -354,14 +388,14 @@ export class SuggestController implements IEditorContribution { // snippet, other editor -> makes edit return true; } - const position = this._editor.getPosition()!; + const position = this.editor.getPosition()!; const startColumn = item.editStart.column; const endColumn = position.column; if (endColumn - startColumn !== item.completion.insertText.length) { // unequal lengths -> makes edit return true; } - const textNow = this._editor.getModel()!.getValueInRange({ + const textNow = this.editor.getModel()!.getValueInRange({ startLineNumber: position.lineNumber, startColumn, endLineNumber: position.lineNumber, @@ -371,41 +405,41 @@ export class SuggestController implements IEditorContribution { return textNow !== item.completion.insertText; }; - Event.once(this._model.onDidTrigger)(_ => { + Event.once(this.model.onDidTrigger)(_ => { // wait for trigger because only then the cancel-event is trustworthy let listener: IDisposable[] = []; - Event.any(this._model.onDidTrigger, this._model.onDidCancel)(() => { + Event.any(this.model.onDidTrigger, this.model.onDidCancel)(() => { // retrigger or cancel -> try to type default text dispose(listener); fallback(); }, undefined, listener); - this._model.onDidSuggest(({ completionModel }) => { + this.model.onDidSuggest(({ completionModel }) => { dispose(listener); if (completionModel.items.length === 0) { fallback(); return; } - const index = this._memoryService.select(this._editor.getModel()!, this._editor.getPosition()!, completionModel.items); + const index = this._memoryService.select(this.editor.getModel()!, this.editor.getPosition()!, completionModel.items); const item = completionModel.items[index]; if (!makesTextEdit(item)) { fallback(); return; } - this._editor.pushUndoStop(); + this.editor.pushUndoStop(); this._insertSuggestion({ index, item, model: completionModel }, InsertFlags.KeepAlternativeSuggestions | InsertFlags.NoBeforeUndoStop | InsertFlags.NoAfterUndoStop); }, undefined, listener); }); - this._model.trigger({ auto: false, shy: true }); - this._editor.revealLine(positionNow.lineNumber, ScrollType.Smooth); - this._editor.focus(); + this.model.trigger({ auto: false, shy: true }); + this.editor.revealLine(positionNow.lineNumber, ScrollType.Smooth); + this.editor.focus(); } acceptSelectedSuggestion(keepAlternativeSuggestions: boolean, alternativeOverwriteConfig: boolean): void { - const item = this._widget.getValue().getFocusedItem(); + const item = this.widget.getValue().getFocusedItem(); let flags = 0; if (keepAlternativeSuggestions) { flags |= InsertFlags.KeepAlternativeSuggestions; @@ -415,7 +449,6 @@ export class SuggestController implements IEditorContribution { } this._insertSuggestion(item, flags); } - acceptNextSuggestion() { this._alternatives.getValue().next(); } @@ -425,45 +458,45 @@ export class SuggestController implements IEditorContribution { } cancelSuggestWidget(): void { - this._model.cancel(); - this._model.clear(); - this._widget.getValue().hideWidget(); + this.model.cancel(); + this.model.clear(); + this.widget.getValue().hideWidget(); } selectNextSuggestion(): void { - this._widget.getValue().selectNext(); + this.widget.getValue().selectNext(); } selectNextPageSuggestion(): void { - this._widget.getValue().selectNextPage(); + this.widget.getValue().selectNextPage(); } selectLastSuggestion(): void { - this._widget.getValue().selectLast(); + this.widget.getValue().selectLast(); } selectPrevSuggestion(): void { - this._widget.getValue().selectPrevious(); + this.widget.getValue().selectPrevious(); } selectPrevPageSuggestion(): void { - this._widget.getValue().selectPreviousPage(); + this.widget.getValue().selectPreviousPage(); } selectFirstSuggestion(): void { - this._widget.getValue().selectFirst(); + this.widget.getValue().selectFirst(); } toggleSuggestionDetails(): void { - this._widget.getValue().toggleDetails(); + this.widget.getValue().toggleDetails(); } toggleExplainMode(): void { - this._widget.getValue().toggleExplainMode(); + this.widget.getValue().toggleExplainMode(); } toggleSuggestionFocus(): void { - this._widget.getValue().toggleDetailsFocus(); + this.widget.getValue().toggleDetailsFocus(); } } @@ -480,7 +513,7 @@ export class TriggerSuggestAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, - mac: { primary: KeyMod.WinCtrl | KeyCode.Space }, + mac: { primary: KeyMod.WinCtrl | KeyCode.Space, secondary: [KeyMod.Alt | KeyCode.Escape] }, weight: KeybindingWeight.EditorContrib } }); @@ -508,11 +541,8 @@ const SuggestCommand = EditorCommand.bindToContribution(Sugge registerEditorCommand(new SuggestCommand({ id: 'acceptSelectedSuggestion', precondition: SuggestContext.Visible, - handler(x, args) { - const alternative: boolean = typeof args === 'object' && typeof args.alternative === 'boolean' - ? args.alternative - : false; - x.acceptSelectedSuggestion(true, alternative); + handler(x) { + x.acceptSelectedSuggestion(true, false); } })); @@ -529,19 +559,55 @@ KeybindingsRegistry.registerKeybindingRule({ id: 'acceptSelectedSuggestion', when: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus, SuggestContext.AcceptSuggestionsOnEnter, SuggestContext.MakesTextEdit), primary: KeyCode.Enter, - weight + weight, }); -// shift+enter and shift+tab use the alternative-flag so that the suggest controller -// is doing the opposite of the editor.suggest.overwriteOnAccept-configuration -KeybindingsRegistry.registerKeybindingRule({ - id: 'acceptSelectedSuggestion', - when: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus), - primary: KeyMod.Shift | KeyCode.Tab, - secondary: [KeyMod.Shift | KeyCode.Enter], - args: { alternative: true }, - weight +MenuRegistry.appendMenuItem(suggestWidgetStatusbarMenu, { + command: { id: 'acceptSelectedSuggestion', title: nls.localize({ key: 'accept.accept', comment: ['{0} will be a keybinding, e.g "Enter to insert"'] }, "{0} to insert") }, + group: 'left', + order: 1, + when: SuggestContext.HasInsertAndReplaceRange.toNegated() +}); +MenuRegistry.appendMenuItem(suggestWidgetStatusbarMenu, { + command: { id: 'acceptSelectedSuggestion', title: nls.localize({ key: 'accept.insert', comment: ['{0} will be a keybinding, e.g "Enter to insert"'] }, "{0} to insert") }, + group: 'left', + order: 1, + when: ContextKeyExpr.and(SuggestContext.HasInsertAndReplaceRange, ContextKeyExpr.equals('config.editor.suggest.insertMode', 'insert')) }); +MenuRegistry.appendMenuItem(suggestWidgetStatusbarMenu, { + command: { id: 'acceptSelectedSuggestion', title: nls.localize({ key: 'accept.replace', comment: ['{0} will be a keybinding, e.g "Enter to replace"'] }, "{0} to replace") }, + group: 'left', + order: 1, + when: ContextKeyExpr.and(SuggestContext.HasInsertAndReplaceRange, ContextKeyExpr.equals('config.editor.suggest.insertMode', 'replace')) +}); + +registerEditorCommand(new SuggestCommand({ + id: 'acceptAlternativeSelectedSuggestion', + precondition: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus), + kbOpts: { + weight: weight, + kbExpr: EditorContextKeys.textInputFocus, + primary: KeyMod.Shift | KeyCode.Enter, + secondary: [KeyMod.Shift | KeyCode.Tab], + }, + handler(x) { + x.acceptSelectedSuggestion(false, true); + }, + menuOpts: [{ + menuId: suggestWidgetStatusbarMenu, + group: 'left', + order: 2, + when: ContextKeyExpr.and(SuggestContext.HasInsertAndReplaceRange, ContextKeyExpr.equals('config.editor.suggest.insertMode', 'insert')), + title: nls.localize({ key: 'accept.replace', comment: ['{0} will be a keybinding, e.g "Enter to replace"'] }, "{0} to replace") + }, { + menuId: suggestWidgetStatusbarMenu, + group: 'left', + order: 2, + when: ContextKeyExpr.and(SuggestContext.HasInsertAndReplaceRange, ContextKeyExpr.equals('config.editor.suggest.insertMode', 'replace')), + title: nls.localize({ key: 'accept.insert', comment: ['{0} will be a keybinding, e.g "Enter to insert"'] }, "{0} to insert") + }] +})); + // continue to support the old command CommandsRegistry.registerCommandAlias('acceptSelectedSuggestionOnEnter', 'acceptSelectedSuggestion'); @@ -629,7 +695,20 @@ registerEditorCommand(new SuggestCommand({ kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, mac: { primary: KeyMod.WinCtrl | KeyCode.Space } - } + }, + menuOpts: [{ + menuId: suggestWidgetStatusbarMenu, + group: 'right', + order: 1, + when: ContextKeyExpr.and(SuggestContext.DetailsVisible, SuggestContext.CanResolve), + title: nls.localize('detail.more', "show less") + }, { + menuId: suggestWidgetStatusbarMenu, + group: 'right', + order: 1, + when: ContextKeyExpr.and(SuggestContext.DetailsVisible.toNegated(), SuggestContext.CanResolve), + title: nls.localize('detail.less', "show more") + }] })); registerEditorCommand(new SuggestCommand({ diff --git a/src/vs/editor/contrib/suggest/suggestModel.ts b/src/vs/editor/contrib/suggest/suggestModel.ts index a6b85326cfe36..f4607a3b65c70 100644 --- a/src/vs/editor/contrib/suggest/suggestModel.ts +++ b/src/vs/editor/contrib/suggest/suggestModel.ts @@ -21,6 +21,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { WordDistance } from 'vs/editor/contrib/suggest/wordDistance'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { isLowSurrogate, isHighSurrogate } from 'vs/base/common/strings'; export interface ICancelEvent { readonly retrigger: boolean; @@ -95,7 +96,7 @@ export class SuggestModel implements IDisposable { private readonly _toDispose = new DisposableStore(); private _quickSuggestDelay: number = 10; - private _triggerCharacterListener?: IDisposable; + private readonly _triggerCharacterListener = new DisposableStore(); private readonly _triggerQuickSuggest = new TimeoutTimer(); private _state: State = State.Idle; @@ -141,10 +142,10 @@ export class SuggestModel implements IDisposable { })); let editorIsComposing = false; - this._toDispose.add(this._editor.onCompositionStart(() => { + this._toDispose.add(this._editor.onDidCompositionStart(() => { editorIsComposing = true; })); - this._toDispose.add(this._editor.onCompositionEnd(() => { + this._toDispose.add(this._editor.onDidCompositionEnd(() => { // refilter when composition ends editorIsComposing = false; this._refilterCompletionItems(); @@ -181,8 +182,7 @@ export class SuggestModel implements IDisposable { } private _updateTriggerCharacters(): void { - - dispose(this._triggerCharacterListener); + this._triggerCharacterListener.clear(); if (this._editor.getOption(EditorOption.readOnly) || !this._editor.hasModel() @@ -191,29 +191,49 @@ export class SuggestModel implements IDisposable { return; } - const supportsByTriggerCharacter: { [ch: string]: Set } = Object.create(null); + const supportsByTriggerCharacter = new Map>(); for (const support of CompletionProviderRegistry.all(this._editor.getModel())) { for (const ch of support.triggerCharacters || []) { - let set = supportsByTriggerCharacter[ch]; + let set = supportsByTriggerCharacter.get(ch); if (!set) { - set = supportsByTriggerCharacter[ch] = new Set(); + set = new Set(); set.add(getSnippetSuggestSupport()); + supportsByTriggerCharacter.set(ch, set); } set.add(support); } } - this._triggerCharacterListener = this._editor.onDidType(text => { - const lastChar = text.charAt(text.length - 1); - const supports = supportsByTriggerCharacter[lastChar]; + const checkTriggerCharacter = (text?: string) => { + + if (!text) { + // came here from the compositionEnd-event + const position = this._editor.getPosition()!; + const model = this._editor.getModel()!; + text = model.getLineContent(position.lineNumber).substr(0, position.column - 1); + } + + let lastChar = ''; + if (isLowSurrogate(text.charCodeAt(text.length - 1))) { + if (isHighSurrogate(text.charCodeAt(text.length - 2))) { + lastChar = text.substr(text.length - 2); + } + } else { + lastChar = text.charAt(text.length - 1); + } + + const supports = supportsByTriggerCharacter.get(lastChar); if (supports) { // keep existing items that where not computed by the // supports/providers that want to trigger now const items: CompletionItem[] | undefined = this._completionModel ? this._completionModel.adopt(supports) : undefined; this.trigger({ auto: true, shy: false, triggerCharacter: lastChar }, Boolean(this._completionModel), supports, items); } - }); + }; + + this._triggerCharacterListener.add(this._editor.onDidType(checkTriggerCharacter)); + this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(checkTriggerCharacter)); } // --- trigger/retrigger/cancel suggest @@ -266,9 +286,7 @@ export class SuggestModel implements IDisposable { ) { // Early exit if nothing needs to be done! // Leave some form of early exit check here if you wish to continue being a cursor position change listener ;) - if (this._state !== State.Idle) { - this.cancel(); - } + this.cancel(); return; } diff --git a/src/vs/editor/contrib/suggest/suggestRangeHighlighter.ts b/src/vs/editor/contrib/suggest/suggestRangeHighlighter.ts new file mode 100644 index 0000000000000..923e03f09bc92 --- /dev/null +++ b/src/vs/editor/contrib/suggest/suggestRangeHighlighter.ts @@ -0,0 +1,128 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle'; +import { Range } from 'vs/editor/common/core/range'; +import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { CompletionItem } from 'vs/editor/contrib/suggest/suggest'; +import { IModelDeltaDecoration } from 'vs/editor/common/model'; +import { SuggestController } from 'vs/editor/contrib/suggest/suggestController'; +import { Emitter } from 'vs/base/common/event'; +import { domEvent } from 'vs/base/browser/event'; +import { domContentLoaded } from 'vs/base/browser/dom'; + +export class SuggestRangeHighlighter { + + private readonly _disposables = new DisposableStore(); + + private _decorations: string[] = []; + private _widgetListener?: IDisposable; + private _shiftKeyListener?: IDisposable; + private _currentItem?: CompletionItem; + + constructor(private readonly _controller: SuggestController) { + + this._disposables.add(_controller.model.onDidSuggest(e => { + if (!e.shy) { + const widget = this._controller.widget.getValue(); + const focused = widget.getFocusedItem(); + if (focused) { + this._highlight(focused.item); + } + if (!this._widgetListener) { + this._widgetListener = widget.onDidFocus(e => this._highlight(e.item)); + } + } + })); + + this._disposables.add(_controller.model.onDidCancel(() => { + this._reset(); + })); + } + + dispose(): void { + this._reset(); + this._disposables.dispose(); + dispose(this._widgetListener); + dispose(this._shiftKeyListener); + } + + private _reset(): void { + this._decorations = this._controller.editor.deltaDecorations(this._decorations, []); + if (this._shiftKeyListener) { + this._shiftKeyListener.dispose(); + this._shiftKeyListener = undefined; + } + } + + private _highlight(item: CompletionItem) { + + this._currentItem = item; + const opts = this._controller.editor.getOption(EditorOption.suggest); + let newDeco: IModelDeltaDecoration[] = []; + + if (opts.insertHighlight) { + if (!this._shiftKeyListener) { + this._shiftKeyListener = shiftKey.event(() => this._highlight(this._currentItem!)); + } + + const info = this._controller.getOverwriteInfo(item, shiftKey.isPressed); + const position = this._controller.editor.getPosition()!; + + if (opts.insertMode === 'insert' && info.overwriteAfter > 0) { + // wants inserts but got replace-mode -> highlight AFTER range + newDeco = [{ + range: new Range(position.lineNumber, position.column, position.lineNumber, position.column + info.overwriteAfter), + options: { inlineClassName: 'suggest-insert-unexpected' } + }]; + + } else if (opts.insertMode === 'replace' && info.overwriteAfter === 0) { + // want replace but likely got insert -> highlight AFTER range + const wordInfo = this._controller.editor.getModel()?.getWordAtPosition(position); + if (wordInfo && wordInfo.endColumn > position.column) { + newDeco = [{ + range: new Range(position.lineNumber, position.column, position.lineNumber, wordInfo.endColumn), + options: { inlineClassName: 'suggest-insert-unexpected' } + }]; + } + } + } + + // update editor decorations + this._decorations = this._controller.editor.deltaDecorations(this._decorations, newDeco); + } +} + +const shiftKey = new class ShiftKey extends Emitter { + + private readonly _subscriptions = new DisposableStore(); + private _isPressed: boolean = false; + + constructor() { + super(); + domContentLoaded().then(() => { + this._subscriptions.add(domEvent(document.body, 'keydown')(e => this.isPressed = e.shiftKey)); + this._subscriptions.add(domEvent(document.body, 'keyup')(() => this.isPressed = false)); + this._subscriptions.add(domEvent(document.body, 'mouseleave')(() => this.isPressed = false)); + this._subscriptions.add(domEvent(document.body, 'blur')(() => this.isPressed = false)); + }); + } + + get isPressed(): boolean { + return this._isPressed; + } + + set isPressed(value: boolean) { + if (this._isPressed !== value) { + this._isPressed = value; + this.fire(value); + } + } + + dispose() { + this._subscriptions.dispose(); + super.dispose(); + } +}; diff --git a/src/vs/editor/contrib/suggest/suggestWidget.ts b/src/vs/editor/contrib/suggest/suggestWidget.ts index 00955641f28d1..5baa237e29ae1 100644 --- a/src/vs/editor/contrib/suggest/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/suggestWidget.ts @@ -4,6 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./media/suggest'; +import 'vs/css!./media/suggestStatusBar'; +import 'vs/base/browser/ui/codiconLabel/codiconLabel'; // The codicon symbol styles are defined here and must be loaded +import 'vs/editor/contrib/documentSymbols/outlineTree'; // The codicon symbol colors are defined here and must be loaded import * as nls from 'vs/nls'; import { createMatches } from 'vs/base/common/filters'; import * as strings from 'vs/base/common/strings'; @@ -18,9 +21,8 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions'; import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition, IEditorMouseEvent } from 'vs/editor/browser/editorBrowser'; -import { Context as SuggestContext, CompletionItem } from './suggest'; +import { Context as SuggestContext, CompletionItem, suggestWidgetStatusbarMenu } from './suggest'; import { CompletionModel } from './completionModel'; -import { alert } from 'vs/base/browser/ui/aria/aria'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { attachListStyler } from 'vs/platform/theme/common/styler'; import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; @@ -38,18 +40,35 @@ import { URI } from 'vs/base/common/uri'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { FileKind } from 'vs/platform/files/common/files'; import { MarkdownString } from 'vs/base/common/htmlContent'; -import { flatten } from 'vs/base/common/arrays'; +import { flatten, isFalsyOrEmpty } from 'vs/base/common/arrays'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { IMenuService } from 'vs/platform/actions/common/actions'; +import { ActionBar, IActionViewItemProvider, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; +import { IAction } from 'vs/base/common/actions'; const expandSuggestionDocsByDefault = false; interface ISuggestionTemplateData { root: HTMLElement; + + /** + * Flexbox + * < ------------- left ------------ > < --- right -- > + *