@codingame/monaco-vscode-api 1.76.9 → 1.78.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -49
- package/dist/Bibtex.tmLanguage.js +2 -0
- package/dist/Handlebars.tmLanguage.js +2 -0
- package/dist/JSON.tmLanguage.js +2 -0
- package/dist/JSONC.tmLanguage.js +2 -0
- package/dist/JavaScript.tmLanguage.js +2 -0
- package/dist/JavaScriptReact.tmLanguage.js +2 -0
- package/dist/LaTeX.tmLanguage.js +2 -0
- package/dist/MagicPython.tmLanguage.js +2 -0
- package/dist/MagicRegExp.tmLanguage.js +2 -0
- package/dist/Red-color-theme.js +2 -0
- package/dist/Regular Expressions (JavaScript).js +2 -0
- package/dist/TeX.tmLanguage.js +2 -0
- package/dist/TypeScript.tmLanguage.js +2 -0
- package/dist/TypeScriptReact.tmLanguage.js +2 -0
- package/dist/_.contribution.js +1 -1
- package/dist/abyss-color-theme.js +2 -0
- package/dist/api.js +1 -3
- package/dist/api2.js +421 -18091
- package/dist/asp-vb-net.tmlanguage.js +2 -0
- package/dist/assets/diffLineDeleted.mp3 +0 -0
- package/dist/assets/diffLineInserted.mp3 +0 -0
- package/dist/assets/diffLineModified.mp3 +0 -0
- package/dist/audioCue.js +108 -478
- package/dist/bat.js +9 -0
- package/dist/batchfile.js +2 -0
- package/dist/batchfile.tmLanguage.js +2 -0
- package/dist/button.js +35 -8
- package/dist/c.js +2 -0
- package/dist/c.tmLanguage.js +2 -0
- package/dist/clojure.js +8 -0
- package/dist/clojure.tmLanguage.js +2 -0
- package/dist/coffeescript.js +9 -0
- package/dist/coffeescript.tmLanguage.js +2 -0
- package/dist/coffeescript2.js +2 -0
- package/dist/configuration.d.ts +269 -4
- package/dist/configuration.js +4326 -328
- package/dist/configuration2.js +14 -324
- package/dist/cpp-grammar-bailout.tmLanguage.js +2 -0
- package/dist/cpp.embedded.macro.tmLanguage.js +2 -0
- package/dist/cpp.js +16 -0
- package/dist/cpp.tmLanguage.js +2 -0
- package/dist/cpp2.js +2 -0
- package/dist/csharp.js +9 -0
- package/dist/csharp.tmLanguage.js +2 -0
- package/dist/csharp2.js +2 -0
- package/dist/cshtml.tmLanguage.js +2 -0
- package/dist/css.js +8 -0
- package/dist/css.tmLanguage.js +2 -0
- package/dist/cuda-cpp.tmLanguage.js +2 -0
- package/dist/dark_plus.js +2 -0
- package/dist/dark_plus_experimental.js +2 -0
- package/dist/dark_vs.js +2 -0
- package/dist/dart.js +8 -0
- package/dist/dart.tmLanguage.js +2 -0
- package/dist/debug.js +12113 -12209
- package/dist/default-extensions/bat.js +12 -0
- package/dist/default-extensions/clojure.js +11 -0
- package/dist/default-extensions/coffeescript.js +12 -0
- package/dist/default-extensions/cpp.js +19 -0
- package/dist/default-extensions/csharp.js +12 -0
- package/dist/default-extensions/css.js +11 -0
- package/dist/default-extensions/dart.js +11 -0
- package/dist/default-extensions/diff.js +11 -0
- package/dist/default-extensions/docker.js +11 -0
- package/dist/default-extensions/fsharp.js +12 -0
- package/dist/default-extensions/go.js +11 -0
- package/dist/default-extensions/groovy.js +12 -0
- package/dist/default-extensions/handlebars.js +11 -0
- package/dist/default-extensions/hlsl.js +11 -0
- package/dist/default-extensions/html.js +13 -0
- package/dist/default-extensions/ini.js +13 -0
- package/dist/default-extensions/java.js +12 -0
- package/dist/default-extensions/javascript.js +17 -0
- package/dist/default-extensions/json.js +13 -0
- package/dist/default-extensions/julia.js +11 -0
- package/dist/default-extensions/latex.js +14 -0
- package/dist/default-extensions/less.js +11 -0
- package/dist/default-extensions/log.js +10 -0
- package/dist/default-extensions/lua.js +11 -0
- package/dist/default-extensions/make.js +11 -0
- package/dist/default-extensions/markdown-basics.js +12 -0
- package/dist/default-extensions/objective-c.js +13 -0
- package/dist/default-extensions/perl.js +13 -0
- package/dist/default-extensions/php.js +13 -0
- package/dist/default-extensions/powershell.js +11 -0
- package/dist/default-extensions/pug.js +11 -0
- package/dist/default-extensions/python.js +12 -0
- package/dist/default-extensions/r.js +11 -0
- package/dist/default-extensions/razor.js +11 -0
- package/dist/default-extensions/ruby.js +11 -0
- package/dist/default-extensions/rust.js +11 -0
- package/dist/default-extensions/scss.js +12 -0
- package/dist/default-extensions/shaderlab.js +11 -0
- package/dist/default-extensions/shellscript.js +11 -0
- package/dist/default-extensions/sql.js +11 -0
- package/dist/default-extensions/swift.js +12 -0
- package/dist/default-extensions/theme-abyss.js +10 -0
- package/dist/default-extensions/theme-defaults.js +18 -0
- package/dist/default-extensions/theme-kimbie-dark.js +10 -0
- package/dist/default-extensions/theme-monokai-dimmed.js +10 -0
- package/dist/default-extensions/theme-monokai.js +10 -0
- package/dist/default-extensions/theme-quietlight.js +10 -0
- package/dist/default-extensions/theme-red.js +10 -0
- package/dist/default-extensions/theme-seti.js +10 -0
- package/dist/default-extensions/theme-solarized-dark.js +10 -0
- package/dist/default-extensions/theme-solarized-light.js +10 -0
- package/dist/default-extensions/theme-tomorrow-night-blue.js +10 -0
- package/dist/default-extensions/typescript-basics.js +17 -0
- package/dist/default-extensions/vb.js +12 -0
- package/dist/default-extensions/xml.js +13 -0
- package/dist/default-extensions/yaml.js +13 -0
- package/dist/dialogs.js +11 -216
- package/dist/diff.js +8 -0
- package/dist/diff.tmLanguage.js +2 -0
- package/dist/dimmed-monokai-color-theme.js +2 -0
- package/dist/docker.js +8 -0
- package/dist/docker.tmLanguage.js +2 -0
- package/dist/dom.js +101 -0
- package/dist/extensionManagement.js +4 -0
- package/dist/extensions.d.ts +368 -23
- package/dist/extensions.js +4 -85
- package/dist/extensionsRegistry.js +63 -64
- package/dist/files.d.ts +845 -0
- package/dist/files.js +1805 -1151
- package/dist/files2.js +32 -0
- package/dist/fsharp.js +9 -0
- package/dist/fsharp.tmLanguage.js +2 -0
- package/dist/fsharp2.js +2 -0
- package/dist/go.js +8 -0
- package/dist/go.tmLanguage.js +2 -0
- package/dist/groovy.js +9 -0
- package/dist/groovy.tmLanguage.js +2 -0
- package/dist/groovy2.js +2 -0
- package/dist/handlebars.js +8 -0
- package/dist/hc_black.js +2 -0
- package/dist/hc_light.js +2 -0
- package/dist/hlsl.js +8 -0
- package/dist/hlsl.tmLanguage.js +2 -0
- package/dist/html-derivative.tmLanguage.js +2 -0
- package/dist/html.js +10 -0
- package/dist/html.tmLanguage.js +2 -0
- package/dist/html.tmLanguage2.js +2 -0
- package/dist/html2.js +2 -0
- package/dist/ini.js +10 -0
- package/dist/ini.language-configuration.js +2 -0
- package/dist/ini.tmLanguage.js +2 -0
- package/dist/injection.js +1 -1
- package/dist/java.js +9 -0
- package/dist/java.tmLanguage.js +2 -0
- package/dist/java2.js +2 -0
- package/dist/javascript-language-configuration.js +2 -0
- package/dist/javascript.js +14 -0
- package/dist/javascript2.js +2 -0
- package/dist/jsdoc.js.injection.tmLanguage.js +2 -0
- package/dist/jsdoc.ts.injection.tmLanguage.js +2 -0
- package/dist/json.js +10 -0
- package/dist/jsonErrorMessages.js +1 -1
- package/dist/julia.js +8 -0
- package/dist/julia.tmLanguage.js +2 -0
- package/dist/keybindings.d.ts +1 -10
- package/dist/keybindings.js +291 -353
- package/dist/kimbie-dark-color-theme.js +2 -0
- package/dist/language-configuration.js +2 -0
- package/dist/language-configuration10.js +2 -0
- package/dist/language-configuration11.js +2 -0
- package/dist/language-configuration12.js +2 -0
- package/dist/language-configuration13.js +2 -0
- package/dist/language-configuration14.js +2 -0
- package/dist/language-configuration15.js +2 -0
- package/dist/language-configuration16.js +2 -0
- package/dist/language-configuration17.js +2 -0
- package/dist/language-configuration18.js +2 -0
- package/dist/language-configuration19.js +2 -0
- package/dist/language-configuration2.js +2 -0
- package/dist/language-configuration20.js +2 -0
- package/dist/language-configuration21.js +2 -0
- package/dist/language-configuration22.js +2 -0
- package/dist/language-configuration23.js +2 -0
- package/dist/language-configuration24.js +2 -0
- package/dist/language-configuration25.js +2 -0
- package/dist/language-configuration26.js +2 -0
- package/dist/language-configuration27.js +2 -0
- package/dist/language-configuration28.js +2 -0
- package/dist/language-configuration29.js +2 -0
- package/dist/language-configuration3.js +2 -0
- package/dist/language-configuration30.js +2 -0
- package/dist/language-configuration31.js +2 -0
- package/dist/language-configuration32.js +2 -0
- package/dist/language-configuration33.js +2 -0
- package/dist/language-configuration34.js +2 -0
- package/dist/language-configuration35.js +2 -0
- package/dist/language-configuration36.js +2 -0
- package/dist/language-configuration37.js +2 -0
- package/dist/language-configuration38.js +2 -0
- package/dist/language-configuration39.js +2 -0
- package/dist/language-configuration4.js +2 -0
- package/dist/language-configuration5.js +2 -0
- package/dist/language-configuration6.js +2 -0
- package/dist/language-configuration7.js +2 -0
- package/dist/language-configuration8.js +2 -0
- package/dist/language-configuration9.js +2 -0
- package/dist/languageService.js +5 -6
- package/dist/languages.d.ts +66 -1
- package/dist/languages.js +924 -5
- package/dist/latex.js +11 -0
- package/dist/layout.contribution.darwin.js +1 -1
- package/dist/layout.contribution.linux.js +1 -1
- package/dist/layout.contribution.win.js +1 -1
- package/dist/less.js +8 -0
- package/dist/less.tmLanguage.js +2 -0
- package/dist/light_plus.js +2 -0
- package/dist/light_plus_experimental.js +2 -0
- package/dist/light_vs.js +2 -0
- package/dist/log.js +7 -0
- package/dist/log.tmLanguage.js +2 -0
- package/dist/lua.js +8 -0
- package/dist/lua.tmLanguage.js +2 -0
- package/dist/make.js +8 -0
- package/dist/make.tmLanguage.js +2 -0
- package/dist/markdown-basics.js +9 -0
- package/dist/markdown-latex-combined.tmLanguage.js +2 -0
- package/dist/markdown.js +2 -0
- package/dist/markdown.tmLanguage.js +2 -0
- package/dist/memento.js +91 -0
- package/dist/modelEditor.d.ts +1480 -138
- package/dist/modelEditor.js +8699 -326
- package/dist/monaco.d.ts +987 -15
- package/dist/monaco.js +40 -10
- package/dist/monokai-color-theme.js +2 -0
- package/dist/notifications.js +84 -64
- package/dist/objective-c.js +10 -0
- package/dist/objective-c.tmLanguage.js +2 -0
- package/dist/objective-c__.tmLanguage.js +2 -0
- package/dist/perl.js +10 -0
- package/dist/perl.language-configuration.js +2 -0
- package/dist/perl.tmLanguage.js +2 -0
- package/dist/perl6.language-configuration.js +2 -0
- package/dist/perl6.tmLanguage.js +2 -0
- package/dist/php.js +10 -0
- package/dist/php.tmLanguage.js +2 -0
- package/dist/php2.js +2 -0
- package/dist/platform.js +105 -0
- package/dist/platform.tmLanguage.js +2 -0
- package/dist/polyfill.js +52064 -11100
- package/dist/powershell.js +8 -0
- package/dist/powershell.tmLanguage.js +2 -0
- package/dist/preferences.js +2532 -0
- package/dist/properties.language-configuration.js +2 -0
- package/dist/pug.js +8 -0
- package/dist/pug.tmLanguage.js +2 -0
- package/dist/python.js +9 -0
- package/dist/quietlight-color-theme.js +2 -0
- package/dist/r.js +8 -0
- package/dist/r.tmLanguage.js +2 -0
- package/dist/razor.js +8 -0
- package/dist/rollup-vsix-plugin.d.ts +8 -0
- package/dist/rollup-vsix-plugin.js +104 -0
- package/dist/ruby.js +8 -0
- package/dist/ruby.tmLanguage.js +2 -0
- package/dist/rust.js +8 -0
- package/dist/rust.tmLanguage.js +2 -0
- package/dist/sassdoc.tmLanguage.js +2 -0
- package/dist/scss.js +9 -0
- package/dist/scss.tmLanguage.js +2 -0
- package/dist/services.d.ts +12988 -12840
- package/dist/services.js +1 -1
- package/dist/shaderlab.js +8 -0
- package/dist/shaderlab.tmLanguage.js +2 -0
- package/dist/shell-unix-bash.tmLanguage.js +2 -0
- package/dist/shellscript.js +8 -0
- package/dist/snippets.js +6 -11
- package/dist/snippetsService.js +7 -10
- package/dist/solarized-dark-color-theme.js +2 -0
- package/dist/solarized-light-color-theme.js +2 -0
- package/dist/sql.js +8 -0
- package/dist/sql.tmLanguage.js +2 -0
- package/dist/swift.js +9 -0
- package/dist/swift.tmLanguage.js +2 -0
- package/dist/swift2.js +2 -0
- package/dist/tags-language-configuration.js +2 -0
- package/dist/textmate.d.ts +0 -264
- package/dist/textmate.js +402 -66
- package/dist/theme-abyss.js +7 -0
- package/dist/theme-defaults.js +15 -0
- package/dist/theme-kimbie-dark.js +7 -0
- package/dist/theme-monokai-dimmed.js +7 -0
- package/dist/theme-monokai.js +7 -0
- package/dist/theme-quietlight.js +7 -0
- package/dist/theme-red.js +7 -0
- package/dist/theme-seti.js +7 -0
- package/dist/theme-solarized-dark.js +7 -0
- package/dist/theme-solarized-light.js +7 -0
- package/dist/theme-tomorrow-night-blue.js +7 -0
- package/dist/theme.js +5 -11
- package/dist/{contextkeys.js → theme2.js} +165 -143
- package/dist/tokenClassificationRegistry.js +46 -2
- package/dist/tomorrow-night-blue-color-theme.js +2 -0
- package/dist/typescript-basics.js +14 -0
- package/dist/typescript.js +2 -0
- package/dist/unboundCommands.js +41 -0
- package/dist/utils.js +345 -0
- package/dist/vb.js +9 -0
- package/dist/vb2.js +2 -0
- package/dist/vs-seti-icon-theme.js +2 -0
- package/dist/vs_minimal-icon-theme.js +2 -0
- package/dist/xml.js +10 -0
- package/dist/xml.language-configuration.js +2 -0
- package/dist/xml.tmLanguage.js +2 -0
- package/dist/xsl.language-configuration.js +2 -0
- package/dist/xsl.tmLanguage.js +2 -0
- package/dist/yaml.js +10 -0
- package/dist/yaml.tmLanguage.js +2 -0
- package/package.json +50 -33
- package/dist/async.js +0 -301
- package/dist/cancellation.js +0 -3
- package/dist/configurationRegistry.js +0 -441
- package/dist/extensionResourceLoader.js +0 -96
- package/dist/labels.js +0 -14
- package/dist/languageConfiguration.js +0 -919
- package/dist/layout.js +0 -47
- package/dist/layoutService.js +0 -4
- package/dist/missing-services.js +0 -5554
- package/dist/resources.js +0 -197
- package/dist/services2.js +0 -3467
- package/dist/textFileEditorModel.js +0 -2985
- package/dist/tokenClassification.d.ts +0 -7
- package/dist/tokenClassification.js +0 -277
- package/dist/variableResolver.js +0 -1711
- package/dist/workbenchThemeService.js +0 -46
- package/dist/workspaceContext.js +0 -50
- /package/dist/{languageConfiguration.d.ts → preferences.d.ts} +0 -0
package/dist/textmate.js
CHANGED
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { I as IExtensionResourceLoaderService } from './extensionResourceLoader.js';
|
|
5
|
-
import { Disposable, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
-
import { TokenizationRegistry, EncodedTokenizationResult } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
1
|
+
import { __decorate, Extensions$2, __param, ITextMateTokenizationService, IExtensionResourceLoaderService, nodeModulesAsarUnpackedPath, nodeModulesPath, IWorkbenchEnvironmentService, registerServiceInitializeParticipant, Emitter, LineRange, Range$2, nodeModulesAsarPath, registerAssets } from './polyfill.js';
|
|
2
|
+
import { DisposableStore, Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { TokenizationRegistry, LazyTokenizationSupport, EncodedTokenizationResult } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
7
4
|
import { TokenMetadata } from 'monaco-editor/esm/vs/editor/common/encodedTokenAttributes.js';
|
|
5
|
+
import { observableFromEvent, keepAlive, autorun } from './utils.js';
|
|
8
6
|
import { nullTokenizeEncoded } from 'monaco-editor/esm/vs/editor/common/languages/nullTokenize.js';
|
|
9
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
10
7
|
import { equals, compareBy, numberComparator } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
11
8
|
import { INITIAL, applyStateStackDiff } from 'vscode-textmate';
|
|
12
|
-
import {
|
|
9
|
+
import { TokenizationStateStore } from 'monaco-editor/esm/vs/editor/common/model/textModelTokens.js';
|
|
13
10
|
import { ContiguousMultilineTokensBuilder } from 'monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokensBuilder.js';
|
|
14
11
|
import { countEOL } from 'monaco-editor/esm/vs/editor/common/core/eolCounter.js';
|
|
15
12
|
import { createWebWorker } from 'monaco-editor/esm/vs/editor/browser/services/webWorker.js';
|
|
16
|
-
import {
|
|
13
|
+
import { BugIndicatingError, onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
17
14
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
18
15
|
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
19
16
|
import { ILanguageConfigurationService } from 'monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
|
|
17
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
20
18
|
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
21
19
|
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
20
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
21
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
22
22
|
import { FileAccess } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
23
23
|
import { isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
24
24
|
import { joinPath, isEqualOrParent, isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
25
|
+
import { ExtensionsRegistry } from './extensionsRegistry.js';
|
|
26
|
+
import { languagesExtPoint } from './languageService.js';
|
|
27
27
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
28
|
-
import {
|
|
28
|
+
import { IWorkbenchThemeService, getTokenClassificationRegistry, typeAndModifierIdPattern } from './tokenClassificationRegistry.js';
|
|
29
29
|
import { createStyleSheet } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
30
30
|
import { generateTokensCSSForColorMap } from 'monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js';
|
|
31
31
|
import { isObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
32
|
-
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
33
32
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
34
33
|
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
35
34
|
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
36
35
|
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
37
36
|
import _onigWasm from 'vscode-oniguruma/release/onig.wasm';
|
|
38
|
-
import
|
|
37
|
+
import getServiceOverride$1 from './files.js';
|
|
38
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
39
39
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
40
40
|
class TextMateTokenizationSupport extends Disposable {
|
|
41
|
-
constructor(_grammar, _initialState, _containsEmbeddedLanguages, _createBackgroundTokenizer) {
|
|
41
|
+
constructor(_grammar, _initialState, _containsEmbeddedLanguages, _createBackgroundTokenizer, _backgroundTokenizerShouldOnlyVerifyTokens = () => false) {
|
|
42
42
|
super();
|
|
43
43
|
this._grammar = _grammar;
|
|
44
44
|
this._initialState = _initialState;
|
|
45
45
|
this._containsEmbeddedLanguages = _containsEmbeddedLanguages;
|
|
46
46
|
this._createBackgroundTokenizer = _createBackgroundTokenizer;
|
|
47
|
+
this._backgroundTokenizerShouldOnlyVerifyTokens = _backgroundTokenizerShouldOnlyVerifyTokens;
|
|
47
48
|
this._seenLanguages = [];
|
|
48
49
|
this._onDidEncounterLanguage = this._register(( (new Emitter())));
|
|
49
50
|
this.onDidEncounterLanguage = this._onDidEncounterLanguage.event;
|
|
50
51
|
}
|
|
52
|
+
get backgroundTokenizerShouldOnlyVerifyTokens() {
|
|
53
|
+
return this._backgroundTokenizerShouldOnlyVerifyTokens();
|
|
54
|
+
}
|
|
51
55
|
getInitialState() {
|
|
52
56
|
return this._initialState;
|
|
53
57
|
}
|
|
@@ -92,22 +96,16 @@ class TextMateTokenizationSupport extends Disposable {
|
|
|
92
96
|
);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.
|
|
99
|
+
class TokenizationSupportWithLineLimit extends Disposable {
|
|
100
|
+
get backgroundTokenizerShouldOnlyVerifyTokens() {
|
|
101
|
+
return this._actual.backgroundTokenizerShouldOnlyVerifyTokens;
|
|
102
|
+
}
|
|
103
|
+
constructor(_encodedLanguageId, _actual, _maxTokenizationLineLength) {
|
|
104
|
+
super();
|
|
98
105
|
this._encodedLanguageId = _encodedLanguageId;
|
|
99
106
|
this._actual = _actual;
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
overrideIdentifier: this._languageId
|
|
103
|
-
});
|
|
104
|
-
this._configurationService.onDidChangeConfiguration(e => {
|
|
105
|
-
if (e.affectsConfiguration('editor.maxTokenizationLineLength')) {
|
|
106
|
-
this._maxTokenizationLineLength = this._configurationService.getValue('editor.maxTokenizationLineLength', {
|
|
107
|
-
overrideIdentifier: this._languageId
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
107
|
+
this._maxTokenizationLineLength = _maxTokenizationLineLength;
|
|
108
|
+
this._register(keepAlive(this._maxTokenizationLineLength));
|
|
111
109
|
}
|
|
112
110
|
getInitialState() {
|
|
113
111
|
return this._actual.getInitialState();
|
|
@@ -116,7 +114,7 @@ let TokenizationSupportWithLineLimit = class TokenizationSupportWithLineLimit {
|
|
|
116
114
|
throw new Error('Not supported!');
|
|
117
115
|
}
|
|
118
116
|
tokenizeEncoded(line, hasEOL, state) {
|
|
119
|
-
if (line.length >= this._maxTokenizationLineLength) {
|
|
117
|
+
if (line.length >= this._maxTokenizationLineLength.get()) {
|
|
120
118
|
return nullTokenizeEncoded(this._encodedLanguageId, state);
|
|
121
119
|
}
|
|
122
120
|
return this._actual.tokenizeEncoded(line, hasEOL, state);
|
|
@@ -129,22 +127,12 @@ let TokenizationSupportWithLineLimit = class TokenizationSupportWithLineLimit {
|
|
|
129
127
|
return undefined;
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
|
-
}
|
|
133
|
-
TokenizationSupportWithLineLimit = ( (__decorate([
|
|
134
|
-
( (__param(3, IConfigurationService)))
|
|
135
|
-
], TokenizationSupportWithLineLimit)));
|
|
130
|
+
}
|
|
136
131
|
class ArrayEdit {
|
|
137
132
|
constructor(
|
|
138
133
|
edits) {
|
|
139
134
|
this.edits = edits.slice().sort(compareBy(c => c.offset, numberComparator));
|
|
140
135
|
}
|
|
141
|
-
applyTo(array) {
|
|
142
|
-
for (let i = this.edits.length - 1; i >= 0; i--) {
|
|
143
|
-
const c = this.edits[i];
|
|
144
|
-
array.delete(c.offset, c.length);
|
|
145
|
-
array.insert(c.offset, c.newLength);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
136
|
applyToArray(array) {
|
|
149
137
|
for (let i = this.edits.length - 1; i >= 0; i--) {
|
|
150
138
|
const c = this.edits[i];
|
|
@@ -203,16 +191,26 @@ class CombinedIndexTransformer {
|
|
|
203
191
|
}
|
|
204
192
|
}
|
|
205
193
|
class TextMateWorkerTokenizerController extends Disposable {
|
|
206
|
-
constructor(_model, _worker, _languageIdCodec, _backgroundTokenizationStore, _initialState) {
|
|
194
|
+
constructor(_model, _worker, _languageIdCodec, _backgroundTokenizationStore, _initialState, _configurationService, _maxTokenizationLineLength) {
|
|
207
195
|
super();
|
|
208
196
|
this._model = _model;
|
|
209
197
|
this._worker = _worker;
|
|
210
198
|
this._languageIdCodec = _languageIdCodec;
|
|
211
199
|
this._backgroundTokenizationStore = _backgroundTokenizationStore;
|
|
212
200
|
this._initialState = _initialState;
|
|
201
|
+
this._configurationService = _configurationService;
|
|
202
|
+
this._maxTokenizationLineLength = _maxTokenizationLineLength;
|
|
213
203
|
this._pendingChanges = [];
|
|
214
|
-
this._states = ( (new
|
|
204
|
+
this._states = ( (new TokenizationStateStore()));
|
|
205
|
+
this._loggingEnabled = observableConfigValue$1('editor.experimental.asyncTokenizationLogging', false, this._configurationService);
|
|
206
|
+
this._register(keepAlive(this._loggingEnabled));
|
|
215
207
|
this._register(this._model.onDidChangeContent((e) => {
|
|
208
|
+
if (this.shouldLog) {
|
|
209
|
+
console.log('model change', {
|
|
210
|
+
fileName: this._model.uri.fsPath.split('\\').pop(),
|
|
211
|
+
changes: changesToString(e.changes),
|
|
212
|
+
});
|
|
213
|
+
}
|
|
216
214
|
this._worker.acceptModelChanged(( (this._model.uri.toString())), e);
|
|
217
215
|
this._pendingChanges.push(e);
|
|
218
216
|
}));
|
|
@@ -230,21 +228,45 @@ class TextMateWorkerTokenizerController extends Disposable {
|
|
|
230
228
|
EOL: this._model.getEOL(),
|
|
231
229
|
languageId,
|
|
232
230
|
encodedLanguageId,
|
|
231
|
+
maxTokenizationLineLength: this._maxTokenizationLineLength.get(),
|
|
233
232
|
});
|
|
233
|
+
this._register(autorun('update maxTokenizationLineLength', reader => {
|
|
234
|
+
const maxTokenizationLineLength = this._maxTokenizationLineLength.read(reader);
|
|
235
|
+
this._worker.acceptMaxTokenizationLineLength(( (this._model.uri.toString())), maxTokenizationLineLength);
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
get shouldLog() {
|
|
239
|
+
return this._loggingEnabled.get();
|
|
234
240
|
}
|
|
235
241
|
dispose() {
|
|
236
242
|
super.dispose();
|
|
237
243
|
this._worker.acceptRemovedModel(( (this._model.uri.toString())));
|
|
238
244
|
}
|
|
239
245
|
setTokensAndStates(versionId, rawTokens, stateDeltas) {
|
|
246
|
+
let tokens = ContiguousMultilineTokensBuilder.deserialize(( (new Uint8Array(rawTokens))));
|
|
247
|
+
if (this.shouldLog) {
|
|
248
|
+
console.log('received background tokenization result', {
|
|
249
|
+
fileName: this._model.uri.fsPath.split('\\').pop(),
|
|
250
|
+
updatedTokenLines: ( (tokens.map((t) => t.getLineRange()))).join(' & '),
|
|
251
|
+
updatedStateLines: ( (stateDeltas.map(
|
|
252
|
+
(s) => ( (( (new LineRange(s.startLineNumber, s.startLineNumber + s.stateDeltas.length))).toString()))
|
|
253
|
+
))).join(' & '),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (this.shouldLog) {
|
|
257
|
+
const changes = ( (( (this._pendingChanges.filter(c => c.versionId <= versionId).map(c => c.changes))).map(c => changesToString(c)))).join(' then ');
|
|
258
|
+
console.log('Applying changes to local states', changes);
|
|
259
|
+
}
|
|
240
260
|
while (this._pendingChanges.length > 0 &&
|
|
241
261
|
this._pendingChanges[0].versionId <= versionId) {
|
|
242
262
|
const change = this._pendingChanges.shift();
|
|
243
|
-
|
|
244
|
-
op.applyTo(this._states);
|
|
263
|
+
this._states.acceptChanges(change.changes);
|
|
245
264
|
}
|
|
246
|
-
let tokens = ContiguousMultilineTokensBuilder.deserialize(( (new Uint8Array(rawTokens))));
|
|
247
265
|
if (this._pendingChanges.length > 0) {
|
|
266
|
+
if (this.shouldLog) {
|
|
267
|
+
const changes = ( (( (this._pendingChanges.map(c => c.changes))).map(c => changesToString(c)))).join(' then ');
|
|
268
|
+
console.log('Considering non-processed changes', changes);
|
|
269
|
+
}
|
|
248
270
|
const curToFutureTransformerTokens = MonotonousIndexTransformer.fromMany(( (this._pendingChanges.map(
|
|
249
271
|
(c) => ( (new ArrayEdit( (c.changes.map((c) => ( (new SingleArrayEdit(
|
|
250
272
|
c.range.startLineNumber - 1,
|
|
@@ -273,11 +295,17 @@ class TextMateWorkerTokenizerController extends Disposable {
|
|
|
273
295
|
this._backgroundTokenizationStore.setTokens(tokens);
|
|
274
296
|
const curToFutureTransformerStates = MonotonousIndexTransformer.fromMany(( (this._pendingChanges.map((c) => lineArrayEditFromModelContentChange(c.changes)))));
|
|
275
297
|
for (const d of stateDeltas) {
|
|
276
|
-
let prevState = d.startLineNumber <= 1 ? this._initialState : this._states.
|
|
298
|
+
let prevState = d.startLineNumber <= 1 ? this._initialState : this._states.getEndState(d.startLineNumber - 1);
|
|
277
299
|
for (let i = 0; i < d.stateDeltas.length; i++) {
|
|
278
300
|
const delta = d.stateDeltas[i];
|
|
279
|
-
|
|
280
|
-
|
|
301
|
+
let state;
|
|
302
|
+
if (delta) {
|
|
303
|
+
state = applyStateStackDiff(prevState, delta);
|
|
304
|
+
this._states.setEndState(d.startLineNumber + i, state);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
state = this._states.getEndState(d.startLineNumber + i);
|
|
308
|
+
}
|
|
281
309
|
const offset = curToFutureTransformerStates.transform(d.startLineNumber + i - 1);
|
|
282
310
|
if (offset !== undefined) {
|
|
283
311
|
this._backgroundTokenizationStore.setEndState(offset + 1, state);
|
|
@@ -299,14 +327,26 @@ function lineArrayEditFromModelContentChange(c) {
|
|
|
299
327
|
)))))))
|
|
300
328
|
);
|
|
301
329
|
}
|
|
330
|
+
function changesToString(changes) {
|
|
331
|
+
return ( (changes.map(c => ( (Range$2.lift(c.range).toString())) + ' => ' + c.text))).join(' & ');
|
|
332
|
+
}
|
|
333
|
+
function observableConfigValue$1(key, defaultValue, configurationService) {
|
|
334
|
+
return observableFromEvent((handleChange) => configurationService.onDidChangeConfiguration(e => {
|
|
335
|
+
if (e.affectsConfiguration(key)) {
|
|
336
|
+
handleChange(e);
|
|
337
|
+
}
|
|
338
|
+
}), () => configurationService.getValue(key) ?? defaultValue);
|
|
339
|
+
}
|
|
302
340
|
let TextMateWorkerHost = class TextMateWorkerHost {
|
|
303
|
-
constructor(_extensionResourceLoaderService, _modelService, _languageConfigurationService, _configurationService, _languageService, _environmentService) {
|
|
341
|
+
constructor(_extensionResourceLoaderService, _modelService, _languageConfigurationService, _configurationService, _languageService, _environmentService, _notificationService, _telemetryService) {
|
|
304
342
|
this._extensionResourceLoaderService = _extensionResourceLoaderService;
|
|
305
343
|
this._modelService = _modelService;
|
|
306
344
|
this._languageConfigurationService = _languageConfigurationService;
|
|
307
345
|
this._configurationService = _configurationService;
|
|
308
346
|
this._languageService = _languageService;
|
|
309
347
|
this._environmentService = _environmentService;
|
|
348
|
+
this._notificationService = _notificationService;
|
|
349
|
+
this._telemetryService = _telemetryService;
|
|
310
350
|
this._workerProxyPromise = null;
|
|
311
351
|
this._worker = null;
|
|
312
352
|
this._workerProxy = null;
|
|
@@ -382,7 +422,7 @@ let TextMateWorkerHost = class TextMateWorkerHost {
|
|
|
382
422
|
this._workerProxy = null;
|
|
383
423
|
this._workerProxyPromise = null;
|
|
384
424
|
}
|
|
385
|
-
createBackgroundTokenizer(textModel, tokenStore) {
|
|
425
|
+
createBackgroundTokenizer(textModel, tokenStore, maxTokenizationLineLength) {
|
|
386
426
|
if (this._workerTokenizerControllers.has(( (textModel.uri.toString())))) {
|
|
387
427
|
throw new BugIndicatingError();
|
|
388
428
|
}
|
|
@@ -404,7 +444,9 @@ let TextMateWorkerHost = class TextMateWorkerHost {
|
|
|
404
444
|
workerProxy,
|
|
405
445
|
this._languageService.languageIdCodec,
|
|
406
446
|
tokenStore,
|
|
407
|
-
INITIAL
|
|
447
|
+
INITIAL,
|
|
448
|
+
this._configurationService,
|
|
449
|
+
maxTokenizationLineLength
|
|
408
450
|
)));
|
|
409
451
|
this._workerTokenizerControllers.set(( (textModel.uri.toString())), controller);
|
|
410
452
|
return toDisposable(() => {
|
|
@@ -422,6 +464,17 @@ let TextMateWorkerHost = class TextMateWorkerHost {
|
|
|
422
464
|
workerProxy?.retokenize(( (textModel.uri.toString())), startLineNumber, endLineNumberExclusive);
|
|
423
465
|
});
|
|
424
466
|
},
|
|
467
|
+
reportMismatchingTokens: (lineNumber) => {
|
|
468
|
+
if (TextMateWorkerHost._reportedMismatchingTokens) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
TextMateWorkerHost._reportedMismatchingTokens = true;
|
|
472
|
+
this._notificationService.error({
|
|
473
|
+
message: 'Async Tokenization Token Mismatch in line ' + lineNumber,
|
|
474
|
+
name: 'Async Tokenization Token Mismatch',
|
|
475
|
+
});
|
|
476
|
+
this._telemetryService.publicLog2('asyncTokenizationMismatchingTokens', {});
|
|
477
|
+
},
|
|
425
478
|
};
|
|
426
479
|
}
|
|
427
480
|
async readFile(_resource) {
|
|
@@ -436,13 +489,16 @@ let TextMateWorkerHost = class TextMateWorkerHost {
|
|
|
436
489
|
}
|
|
437
490
|
}
|
|
438
491
|
};
|
|
492
|
+
TextMateWorkerHost._reportedMismatchingTokens = false;
|
|
439
493
|
TextMateWorkerHost = ( (__decorate([
|
|
440
494
|
( (__param(0, IExtensionResourceLoaderService))),
|
|
441
495
|
( (__param(1, IModelService))),
|
|
442
496
|
( (__param(2, ILanguageConfigurationService))),
|
|
443
497
|
( (__param(3, IConfigurationService))),
|
|
444
498
|
( (__param(4, ILanguageService))),
|
|
445
|
-
( (__param(5, IEnvironmentService)))
|
|
499
|
+
( (__param(5, IEnvironmentService))),
|
|
500
|
+
( (__param(6, INotificationService))),
|
|
501
|
+
( (__param(7, ITelemetryService)))
|
|
446
502
|
], TextMateWorkerHost)));
|
|
447
503
|
function keepAliveWhenAttached(textModel, factory) {
|
|
448
504
|
const disposableStore = ( (new DisposableStore()));
|
|
@@ -698,8 +754,6 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
|
|
|
698
754
|
this._progressService = _progressService;
|
|
699
755
|
this._environmentService = _environmentService;
|
|
700
756
|
this._instantiationService = _instantiationService;
|
|
701
|
-
this._onDidEncounterLanguage = this._register(( (new Emitter())));
|
|
702
|
-
this.onDidEncounterLanguage = this._onDidEncounterLanguage.event;
|
|
703
757
|
this._createdModes = [];
|
|
704
758
|
this._encounteredLanguages = [];
|
|
705
759
|
this._debugMode = false;
|
|
@@ -718,7 +772,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
|
|
|
718
772
|
this._register(this._themeService.onDidColorThemeChange(() => {
|
|
719
773
|
this._updateTheme(this._themeService.getColorTheme(), false);
|
|
720
774
|
}));
|
|
721
|
-
this._languageService.
|
|
775
|
+
this._languageService.onDidRequestRichLanguageFeatures((languageId) => {
|
|
722
776
|
this._createdModes.push(languageId);
|
|
723
777
|
});
|
|
724
778
|
}
|
|
@@ -737,9 +791,9 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
|
|
|
737
791
|
if (def) {
|
|
738
792
|
this._grammarDefinitions.push(def);
|
|
739
793
|
if (def.language) {
|
|
740
|
-
this.
|
|
741
|
-
|
|
742
|
-
|
|
794
|
+
const lazyTokenizationSupport = ( (new LazyTokenizationSupport(() => this.createTokenizationSupport(def.language))));
|
|
795
|
+
this._tokenizersRegistrations.add(lazyTokenizationSupport);
|
|
796
|
+
this._tokenizersRegistrations.add(TokenizationRegistry.registerFactory(def.language, lazyTokenizationSupport));
|
|
743
797
|
}
|
|
744
798
|
}
|
|
745
799
|
}
|
|
@@ -887,21 +941,23 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
|
|
|
887
941
|
if (!r.grammar) {
|
|
888
942
|
return null;
|
|
889
943
|
}
|
|
944
|
+
const maxTokenizationLineLength = observableConfigValue('editor.maxTokenizationLineLength', languageId, -1, this._configurationService);
|
|
890
945
|
const tokenization = ( (new TextMateTokenizationSupport(
|
|
891
946
|
r.grammar,
|
|
892
947
|
r.initialState,
|
|
893
948
|
r.containsEmbeddedLanguages,
|
|
894
|
-
(textModel, tokenStore) => this._workerHost.createBackgroundTokenizer(textModel, tokenStore)
|
|
949
|
+
(textModel, tokenStore) => this._workerHost.createBackgroundTokenizer(textModel, tokenStore, maxTokenizationLineLength),
|
|
950
|
+
() => this._configurationService.getValue('editor.experimental.asyncTokenizationVerification')
|
|
895
951
|
)));
|
|
896
952
|
tokenization.onDidEncounterLanguage((encodedLanguageId) => {
|
|
897
953
|
if (!this._encounteredLanguages[encodedLanguageId]) {
|
|
898
954
|
const languageId = this._languageService.languageIdCodec.decodeLanguageId(encodedLanguageId);
|
|
899
955
|
this._encounteredLanguages[encodedLanguageId] = true;
|
|
900
|
-
this.
|
|
956
|
+
this._languageService.requestBasicLanguageFeatures(languageId);
|
|
901
957
|
}
|
|
902
958
|
});
|
|
903
959
|
return (
|
|
904
|
-
(new TokenizationSupportWithLineLimit(
|
|
960
|
+
(new TokenizationSupportWithLineLimit(encodedLanguageId, tokenization, maxTokenizationLineLength))
|
|
905
961
|
);
|
|
906
962
|
}
|
|
907
963
|
catch (err) {
|
|
@@ -1076,14 +1132,294 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
|
|
|
1076
1132
|
}
|
|
1077
1133
|
return true;
|
|
1078
1134
|
}
|
|
1135
|
+
function observableConfigValue(key, languageId, defaultValue, configurationService) {
|
|
1136
|
+
return observableFromEvent((handleChange) => configurationService.onDidChangeConfiguration(e => {
|
|
1137
|
+
if (e.affectsConfiguration(key, { overrideIdentifier: languageId })) {
|
|
1138
|
+
handleChange(e);
|
|
1139
|
+
}
|
|
1140
|
+
}), () => configurationService.getValue(key, { overrideIdentifier: languageId }) ?? defaultValue);
|
|
1141
|
+
}
|
|
1142
|
+
const tokenClassificationRegistry = getTokenClassificationRegistry();
|
|
1143
|
+
const tokenTypeExtPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
1144
|
+
extensionPoint: 'semanticTokenTypes',
|
|
1145
|
+
jsonSchema: {
|
|
1146
|
+
description: ( (localize('contributes.semanticTokenTypes', 'Contributes semantic token types.'))),
|
|
1147
|
+
type: 'array',
|
|
1148
|
+
items: {
|
|
1149
|
+
type: 'object',
|
|
1150
|
+
properties: {
|
|
1151
|
+
id: {
|
|
1152
|
+
type: 'string',
|
|
1153
|
+
description: ( (localize(
|
|
1154
|
+
'contributes.semanticTokenTypes.id',
|
|
1155
|
+
'The identifier of the semantic token type'
|
|
1156
|
+
))),
|
|
1157
|
+
pattern: typeAndModifierIdPattern,
|
|
1158
|
+
patternErrorMessage: ( (localize(
|
|
1159
|
+
'contributes.semanticTokenTypes.id.format',
|
|
1160
|
+
'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
|
|
1161
|
+
))),
|
|
1162
|
+
},
|
|
1163
|
+
superType: {
|
|
1164
|
+
type: 'string',
|
|
1165
|
+
description: ( (localize(
|
|
1166
|
+
'contributes.semanticTokenTypes.superType',
|
|
1167
|
+
'The super type of the semantic token type'
|
|
1168
|
+
))),
|
|
1169
|
+
pattern: typeAndModifierIdPattern,
|
|
1170
|
+
patternErrorMessage: ( (localize(
|
|
1171
|
+
'contributes.semanticTokenTypes.superType.format',
|
|
1172
|
+
'Super types should be in the form letterOrDigit[_-letterOrDigit]*'
|
|
1173
|
+
))),
|
|
1174
|
+
},
|
|
1175
|
+
description: {
|
|
1176
|
+
type: 'string',
|
|
1177
|
+
description: ( (localize(
|
|
1178
|
+
'contributes.color.description',
|
|
1179
|
+
'The description of the semantic token type'
|
|
1180
|
+
))),
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
})));
|
|
1186
|
+
const tokenModifierExtPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
1187
|
+
extensionPoint: 'semanticTokenModifiers',
|
|
1188
|
+
jsonSchema: {
|
|
1189
|
+
description: ( (localize(
|
|
1190
|
+
'contributes.semanticTokenModifiers',
|
|
1191
|
+
'Contributes semantic token modifiers.'
|
|
1192
|
+
))),
|
|
1193
|
+
type: 'array',
|
|
1194
|
+
items: {
|
|
1195
|
+
type: 'object',
|
|
1196
|
+
properties: {
|
|
1197
|
+
id: {
|
|
1198
|
+
type: 'string',
|
|
1199
|
+
description: ( (localize(
|
|
1200
|
+
'contributes.semanticTokenModifiers.id',
|
|
1201
|
+
'The identifier of the semantic token modifier'
|
|
1202
|
+
))),
|
|
1203
|
+
pattern: typeAndModifierIdPattern,
|
|
1204
|
+
patternErrorMessage: ( (localize(
|
|
1205
|
+
'contributes.semanticTokenModifiers.id.format',
|
|
1206
|
+
'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
|
|
1207
|
+
)))
|
|
1208
|
+
},
|
|
1209
|
+
description: {
|
|
1210
|
+
description: ( (localize(
|
|
1211
|
+
'contributes.semanticTokenModifiers.description',
|
|
1212
|
+
'The description of the semantic token modifier'
|
|
1213
|
+
)))
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
})));
|
|
1219
|
+
const tokenStyleDefaultsExtPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
1220
|
+
extensionPoint: 'semanticTokenScopes',
|
|
1221
|
+
jsonSchema: {
|
|
1222
|
+
description: ( (localize(
|
|
1223
|
+
'contributes.semanticTokenScopes',
|
|
1224
|
+
'Contributes semantic token scope maps.'
|
|
1225
|
+
))),
|
|
1226
|
+
type: 'array',
|
|
1227
|
+
items: {
|
|
1228
|
+
type: 'object',
|
|
1229
|
+
properties: {
|
|
1230
|
+
language: {
|
|
1231
|
+
description: ( (localize(
|
|
1232
|
+
'contributes.semanticTokenScopes.languages',
|
|
1233
|
+
'Lists the languge for which the defaults are.'
|
|
1234
|
+
))),
|
|
1235
|
+
type: 'string'
|
|
1236
|
+
},
|
|
1237
|
+
scopes: {
|
|
1238
|
+
description: ( (localize(
|
|
1239
|
+
'contributes.semanticTokenScopes.scopes',
|
|
1240
|
+
'Maps a semantic token (described by semantic token selector) to one or more textMate scopes used to represent that token.'
|
|
1241
|
+
))),
|
|
1242
|
+
type: 'object',
|
|
1243
|
+
additionalProperties: {
|
|
1244
|
+
type: 'array',
|
|
1245
|
+
items: {
|
|
1246
|
+
type: 'string'
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
})));
|
|
1254
|
+
class TokenClassificationExtensionPoints {
|
|
1255
|
+
constructor() {
|
|
1256
|
+
function validateTypeOrModifier(contribution, extensionPoint, collector) {
|
|
1257
|
+
if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
|
|
1258
|
+
collector.error(( (localize(
|
|
1259
|
+
'invalid.id',
|
|
1260
|
+
"'configuration.{0}.id' must be defined and can not be empty",
|
|
1261
|
+
extensionPoint
|
|
1262
|
+
))));
|
|
1263
|
+
return false;
|
|
1264
|
+
}
|
|
1265
|
+
if (!contribution.id.match(typeAndModifierIdPattern)) {
|
|
1266
|
+
collector.error(( (localize(
|
|
1267
|
+
'invalid.id.format',
|
|
1268
|
+
"'configuration.{0}.id' must follow the pattern letterOrDigit[-_letterOrDigit]*",
|
|
1269
|
+
extensionPoint
|
|
1270
|
+
))));
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
const superType = contribution.superType;
|
|
1274
|
+
if (superType && !superType.match(typeAndModifierIdPattern)) {
|
|
1275
|
+
collector.error(( (localize(
|
|
1276
|
+
'invalid.superType.format',
|
|
1277
|
+
"'configuration.{0}.superType' must follow the pattern letterOrDigit[-_letterOrDigit]*",
|
|
1278
|
+
extensionPoint
|
|
1279
|
+
))));
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
if (typeof contribution.description !== 'string' || contribution.id.length === 0) {
|
|
1283
|
+
collector.error(( (localize(
|
|
1284
|
+
'invalid.description',
|
|
1285
|
+
"'configuration.{0}.description' must be defined and can not be empty",
|
|
1286
|
+
extensionPoint
|
|
1287
|
+
))));
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1290
|
+
return true;
|
|
1291
|
+
}
|
|
1292
|
+
tokenTypeExtPoint.setHandler((extensions, delta) => {
|
|
1293
|
+
for (const extension of delta.added) {
|
|
1294
|
+
const extensionValue = extension.value;
|
|
1295
|
+
const collector = extension.collector;
|
|
1296
|
+
if (!extensionValue || !Array.isArray(extensionValue)) {
|
|
1297
|
+
collector.error(( (localize(
|
|
1298
|
+
'invalid.semanticTokenTypeConfiguration',
|
|
1299
|
+
"'configuration.semanticTokenType' must be an array"
|
|
1300
|
+
))));
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
for (const contribution of extensionValue) {
|
|
1304
|
+
if (validateTypeOrModifier(contribution, 'semanticTokenType', collector)) {
|
|
1305
|
+
tokenClassificationRegistry.registerTokenType(contribution.id, contribution.description, contribution.superType);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
for (const extension of delta.removed) {
|
|
1310
|
+
const extensionValue = extension.value;
|
|
1311
|
+
for (const contribution of extensionValue) {
|
|
1312
|
+
tokenClassificationRegistry.deregisterTokenType(contribution.id);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
tokenModifierExtPoint.setHandler((extensions, delta) => {
|
|
1317
|
+
for (const extension of delta.added) {
|
|
1318
|
+
const extensionValue = extension.value;
|
|
1319
|
+
const collector = extension.collector;
|
|
1320
|
+
if (!extensionValue || !Array.isArray(extensionValue)) {
|
|
1321
|
+
collector.error(( (localize(
|
|
1322
|
+
'invalid.semanticTokenModifierConfiguration',
|
|
1323
|
+
"'configuration.semanticTokenModifier' must be an array"
|
|
1324
|
+
))));
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
for (const contribution of extensionValue) {
|
|
1328
|
+
if (validateTypeOrModifier(contribution, 'semanticTokenModifier', collector)) {
|
|
1329
|
+
tokenClassificationRegistry.registerTokenModifier(contribution.id, contribution.description);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
for (const extension of delta.removed) {
|
|
1334
|
+
const extensionValue = extension.value;
|
|
1335
|
+
for (const contribution of extensionValue) {
|
|
1336
|
+
tokenClassificationRegistry.deregisterTokenModifier(contribution.id);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
tokenStyleDefaultsExtPoint.setHandler((extensions, delta) => {
|
|
1341
|
+
for (const extension of delta.added) {
|
|
1342
|
+
const extensionValue = extension.value;
|
|
1343
|
+
const collector = extension.collector;
|
|
1344
|
+
if (!extensionValue || !Array.isArray(extensionValue)) {
|
|
1345
|
+
collector.error(( (localize(
|
|
1346
|
+
'invalid.semanticTokenScopes.configuration',
|
|
1347
|
+
"'configuration.semanticTokenScopes' must be an array"
|
|
1348
|
+
))));
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
for (const contribution of extensionValue) {
|
|
1352
|
+
if (contribution.language && typeof contribution.language !== 'string') {
|
|
1353
|
+
collector.error(( (localize(
|
|
1354
|
+
'invalid.semanticTokenScopes.language',
|
|
1355
|
+
"'configuration.semanticTokenScopes.language' must be a string"
|
|
1356
|
+
))));
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
if (!contribution.scopes || typeof contribution.scopes !== 'object') {
|
|
1360
|
+
collector.error(( (localize(
|
|
1361
|
+
'invalid.semanticTokenScopes.scopes',
|
|
1362
|
+
"'configuration.semanticTokenScopes.scopes' must be defined as an object"
|
|
1363
|
+
))));
|
|
1364
|
+
continue;
|
|
1365
|
+
}
|
|
1366
|
+
for (const selectorString in contribution.scopes) {
|
|
1367
|
+
const tmScopes = contribution.scopes[selectorString];
|
|
1368
|
+
if (!Array.isArray(tmScopes) || tmScopes.some(l => typeof l !== 'string')) {
|
|
1369
|
+
collector.error(( (localize(
|
|
1370
|
+
'invalid.semanticTokenScopes.scopes.value',
|
|
1371
|
+
"'configuration.semanticTokenScopes.scopes' values must be an array of strings"
|
|
1372
|
+
))));
|
|
1373
|
+
continue;
|
|
1374
|
+
}
|
|
1375
|
+
try {
|
|
1376
|
+
const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
|
|
1377
|
+
tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( (tmScopes.map(s => s.split(' ')))) });
|
|
1378
|
+
}
|
|
1379
|
+
catch (e) {
|
|
1380
|
+
collector.error(( (localize(
|
|
1381
|
+
'invalid.semanticTokenScopes.scopes.selector',
|
|
1382
|
+
"configuration.semanticTokenScopes.scopes': Problems parsing selector {0}.",
|
|
1383
|
+
selectorString
|
|
1384
|
+
))));
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
for (const extension of delta.removed) {
|
|
1390
|
+
const extensionValue = extension.value;
|
|
1391
|
+
for (const contribution of extensionValue) {
|
|
1392
|
+
for (const selectorString in contribution.scopes) {
|
|
1393
|
+
const tmScopes = contribution.scopes[selectorString];
|
|
1394
|
+
try {
|
|
1395
|
+
const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
|
|
1396
|
+
tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( (tmScopes.map(s => s.split(' ')))) });
|
|
1397
|
+
}
|
|
1398
|
+
catch (e) {
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1079
1406
|
registerAssets({
|
|
1080
1407
|
'vscode-oniguruma/../onig.wasm': _onigWasm
|
|
1081
1408
|
});
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1409
|
+
registerServiceInitializeParticipant(async (accessor) => {
|
|
1410
|
+
accessor.get(ITextMateTokenizationService);
|
|
1411
|
+
});
|
|
1412
|
+
let ExtensionPoints = class ExtensionPoints {
|
|
1413
|
+
constructor(instantiationService) {
|
|
1414
|
+
this.instantiationService = instantiationService;
|
|
1415
|
+
this.instantiationService.createInstance(TokenClassificationExtensionPoints);
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
ExtensionPoints = __decorate([
|
|
1419
|
+
( __param(0, IInstantiationService))
|
|
1420
|
+
], ExtensionPoints);
|
|
1421
|
+
( Registry.as(Extensions$2.Workbench)).registerWorkbenchContribution(ExtensionPoints, 1 );
|
|
1085
1422
|
function getServiceOverride() {
|
|
1086
|
-
onServicesInitialized(initialize);
|
|
1087
1423
|
return {
|
|
1088
1424
|
...getServiceOverride$1(),
|
|
1089
1425
|
[( ITextMateTokenizationService.toString())]: new SyncDescriptor(TextMateTokenizationFeature)
|