@codingame/monaco-vscode-editor-api 20.1.1 → 20.2.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/package.json +3 -3
- package/vscode/src/vs/editor/editor.api.d.ts +728 -827
- package/vscode/src/vs/editor/standalone/browser/standalone-tokens.css +14 -1
- package/vscode/src/vs/editor/standalone/browser/standaloneEditor.d.ts +145 -0
- package/vscode/src/vs/editor/standalone/browser/standaloneLanguages.d.ts +232 -0
- package/vscode/src/vs/editor/standalone/browser/standaloneWebWorker.d.ts +27 -0
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCommon.d.ts +34 -0
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCompile.d.ts +9 -0
- package/vscode/src/vs/editor/standalone/common/monarch/monarchLexer.d.ts +4 -0
- package/vscode/src/vs/editor/standalone/common/monarch/monarchTypes.d.ts +89 -0
|
@@ -1,21 +1,33 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/* Default standalone editor fonts */
|
|
1
8
|
.monaco-editor.standalone {
|
|
2
9
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
|
|
3
10
|
--monaco-monospace-font: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
|
|
4
11
|
}
|
|
12
|
+
|
|
5
13
|
.monaco-menu .monaco-action-bar.vertical .action-item .action-menu-item:focus .action-label {
|
|
6
14
|
stroke-width: 1.2px;
|
|
7
15
|
}
|
|
16
|
+
|
|
8
17
|
.monaco-editor.standalone.vs-dark .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,
|
|
9
18
|
.monaco-editor.standalone.hc-black .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,
|
|
10
19
|
.monaco-editor.standalone.hc-light .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label {
|
|
11
20
|
stroke-width: 1.2px;
|
|
12
21
|
}
|
|
22
|
+
|
|
13
23
|
.monaco-hover p {
|
|
14
24
|
margin: 0;
|
|
15
25
|
}
|
|
26
|
+
|
|
27
|
+
/* See https://github.com/microsoft/monaco-editor/issues/2168#issuecomment-780078600 */
|
|
16
28
|
.monaco-aria-container {
|
|
17
29
|
position: absolute !important;
|
|
18
|
-
top: 0;
|
|
30
|
+
top: 0; /* avoid being placed underneath a sibling element */
|
|
19
31
|
height: 1px;
|
|
20
32
|
width: 1px;
|
|
21
33
|
margin: -1px;
|
|
@@ -24,6 +36,7 @@
|
|
|
24
36
|
clip: rect(1px, 1px, 1px, 1px);
|
|
25
37
|
clip-path: inset(50%);
|
|
26
38
|
}
|
|
39
|
+
|
|
27
40
|
.monaco-editor.standalone .synthetic-focus, .monaco-diff-editor.standalone .synthetic-focus,
|
|
28
41
|
.monaco-editor.standalone [tabindex="0"]:focus, .monaco-diff-editor.standalone [tabindex="0"]:focus,
|
|
29
42
|
.monaco-editor.standalone [tabindex="-1"]:focus, .monaco-diff-editor.standalone [tabindex="-1"]:focus,
|
|
@@ -14,60 +14,205 @@ import { IStandaloneThemeData } from "@codingame/monaco-vscode-api/vscode/vs/edi
|
|
|
14
14
|
import { ICommandHandler } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands";
|
|
15
15
|
import { IMarker, IMarkerData } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers";
|
|
16
16
|
import { MultiDiffEditorWidget } from "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget";
|
|
17
|
+
/**
|
|
18
|
+
* Create a new editor under `domElement`.
|
|
19
|
+
* `domElement` should be empty (not contain other dom nodes).
|
|
20
|
+
* The editor will read the size of `domElement`.
|
|
21
|
+
*/
|
|
17
22
|
export declare function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
|
|
23
|
+
/**
|
|
24
|
+
* Emitted when an editor is created.
|
|
25
|
+
* Creating a diff editor might cause this listener to be invoked with the two editors.
|
|
26
|
+
* @event
|
|
27
|
+
*/
|
|
18
28
|
export declare function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable;
|
|
29
|
+
/**
|
|
30
|
+
* Emitted when an diff editor is created.
|
|
31
|
+
* @event
|
|
32
|
+
*/
|
|
19
33
|
export declare function onDidCreateDiffEditor(listener: (diffEditor: IDiffEditor) => void): IDisposable;
|
|
34
|
+
/**
|
|
35
|
+
* Get all the created editors.
|
|
36
|
+
*/
|
|
20
37
|
export declare function getEditors(): readonly ICodeEditor[];
|
|
38
|
+
/**
|
|
39
|
+
* Get all the created diff editors.
|
|
40
|
+
*/
|
|
21
41
|
export declare function getDiffEditors(): readonly IDiffEditor[];
|
|
42
|
+
/**
|
|
43
|
+
* Create a new diff editor under `domElement`.
|
|
44
|
+
* `domElement` should be empty (not contain other dom nodes).
|
|
45
|
+
* The editor will read the size of `domElement`.
|
|
46
|
+
*/
|
|
22
47
|
export declare function createDiffEditor(domElement: HTMLElement, options?: IStandaloneDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
|
|
23
48
|
export declare function createMultiFileDiffEditor(domElement: HTMLElement, override?: IEditorOverrideServices): MultiDiffEditorWidget;
|
|
49
|
+
/**
|
|
50
|
+
* Description of a command contribution
|
|
51
|
+
*/
|
|
24
52
|
export interface ICommandDescriptor {
|
|
53
|
+
/**
|
|
54
|
+
* An unique identifier of the contributed command.
|
|
55
|
+
*/
|
|
25
56
|
id: string;
|
|
57
|
+
/**
|
|
58
|
+
* Callback that will be executed when the command is triggered.
|
|
59
|
+
*/
|
|
26
60
|
run: ICommandHandler;
|
|
27
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Add a command.
|
|
64
|
+
*/
|
|
28
65
|
export declare function addCommand(descriptor: ICommandDescriptor): IDisposable;
|
|
66
|
+
/**
|
|
67
|
+
* Add an action to all editors.
|
|
68
|
+
*/
|
|
29
69
|
export declare function addEditorAction(descriptor: IActionDescriptor): IDisposable;
|
|
70
|
+
/**
|
|
71
|
+
* A keybinding rule.
|
|
72
|
+
*/
|
|
30
73
|
export interface IKeybindingRule {
|
|
31
74
|
keybinding: number;
|
|
32
75
|
command?: string | null;
|
|
33
76
|
commandArgs?: any;
|
|
34
77
|
when?: string | null;
|
|
35
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Add a keybinding rule.
|
|
81
|
+
*/
|
|
36
82
|
export declare function addKeybindingRule(rule: IKeybindingRule): IDisposable;
|
|
83
|
+
/**
|
|
84
|
+
* Add keybinding rules.
|
|
85
|
+
*/
|
|
37
86
|
export declare function addKeybindingRules(rules: IKeybindingRule[]): IDisposable;
|
|
87
|
+
/**
|
|
88
|
+
* Create a new editor model.
|
|
89
|
+
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
|
|
90
|
+
*/
|
|
38
91
|
export declare function createModel(value: string, language?: string, uri?: URI): ITextModel;
|
|
92
|
+
/**
|
|
93
|
+
* Change the language for a model.
|
|
94
|
+
*/
|
|
39
95
|
export declare function setModelLanguage(model: ITextModel, mimeTypeOrLanguageId: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Set the markers for a model.
|
|
98
|
+
*/
|
|
40
99
|
export declare function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void;
|
|
100
|
+
/**
|
|
101
|
+
* Remove all markers of an owner.
|
|
102
|
+
*/
|
|
41
103
|
export declare function removeAllMarkers(owner: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Get markers for owner and/or resource
|
|
106
|
+
*
|
|
107
|
+
* @returns list of markers
|
|
108
|
+
*/
|
|
42
109
|
export declare function getModelMarkers(filter: {
|
|
43
110
|
owner?: string;
|
|
44
111
|
resource?: URI;
|
|
45
112
|
take?: number;
|
|
46
113
|
}): IMarker[];
|
|
114
|
+
/**
|
|
115
|
+
* Emitted when markers change for a model.
|
|
116
|
+
* @event
|
|
117
|
+
*/
|
|
47
118
|
export declare function onDidChangeMarkers(listener: (e: readonly URI[]) => void): IDisposable;
|
|
119
|
+
/**
|
|
120
|
+
* Get the model that has `uri` if it exists.
|
|
121
|
+
*/
|
|
48
122
|
export declare function getModel(uri: URI): ITextModel | null;
|
|
123
|
+
/**
|
|
124
|
+
* Get all the created models.
|
|
125
|
+
*/
|
|
49
126
|
export declare function getModels(): ITextModel[];
|
|
127
|
+
/**
|
|
128
|
+
* Emitted when a model is created.
|
|
129
|
+
* @event
|
|
130
|
+
*/
|
|
50
131
|
export declare function onDidCreateModel(listener: (model: ITextModel) => void): IDisposable;
|
|
132
|
+
/**
|
|
133
|
+
* Emitted right before a model is disposed.
|
|
134
|
+
* @event
|
|
135
|
+
*/
|
|
51
136
|
export declare function onWillDisposeModel(listener: (model: ITextModel) => void): IDisposable;
|
|
137
|
+
/**
|
|
138
|
+
* Emitted when a different language is set to a model.
|
|
139
|
+
* @event
|
|
140
|
+
*/
|
|
52
141
|
export declare function onDidChangeModelLanguage(listener: (e: {
|
|
53
142
|
readonly model: ITextModel;
|
|
54
143
|
readonly oldLanguage: string;
|
|
55
144
|
}) => void): IDisposable;
|
|
145
|
+
/**
|
|
146
|
+
* Create a new web worker that has model syncing capabilities built in.
|
|
147
|
+
* Specify an AMD module to load that will `create` an object that will be proxied.
|
|
148
|
+
*/
|
|
56
149
|
export declare function createWebWorker<T extends object>(opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
|
|
150
|
+
/**
|
|
151
|
+
* Colorize the contents of `domNode` using attribute `data-lang`.
|
|
152
|
+
*/
|
|
57
153
|
export declare function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Colorize `text` using language `languageId`.
|
|
156
|
+
*/
|
|
58
157
|
export declare function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
|
|
158
|
+
/**
|
|
159
|
+
* Colorize a line in a model.
|
|
160
|
+
*/
|
|
59
161
|
export declare function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string;
|
|
162
|
+
/**
|
|
163
|
+
* Tokenize `text` using language `languageId`
|
|
164
|
+
*/
|
|
60
165
|
export declare function tokenize(text: string, languageId: string): languages.Token[][];
|
|
166
|
+
/**
|
|
167
|
+
* Define a new theme or update an existing theme.
|
|
168
|
+
*/
|
|
61
169
|
export declare function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
|
|
170
|
+
/**
|
|
171
|
+
* Switches to a theme.
|
|
172
|
+
*/
|
|
62
173
|
export declare function setTheme(themeName: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Clears all cached font measurements and triggers re-measurement.
|
|
176
|
+
*/
|
|
63
177
|
export declare function remeasureFonts(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Register a command.
|
|
180
|
+
*/
|
|
64
181
|
export declare function registerCommand(id: string, handler: (accessor: any, ...args: any[]) => void): IDisposable;
|
|
65
182
|
export interface ILinkOpener {
|
|
66
183
|
open(resource: URI): boolean | Promise<boolean>;
|
|
67
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Registers a handler that is called when a link is opened in any editor. The handler callback should return `true` if the link was handled and `false` otherwise.
|
|
187
|
+
* The handler that was registered last will be called first when a link is opened.
|
|
188
|
+
*
|
|
189
|
+
* Returns a disposable that can unregister the opener again.
|
|
190
|
+
*/
|
|
68
191
|
export declare function registerLinkOpener(opener: ILinkOpener): IDisposable;
|
|
192
|
+
/**
|
|
193
|
+
* Represents an object that can handle editor open operations (e.g. when "go to definition" is called
|
|
194
|
+
* with a resource other than the current model).
|
|
195
|
+
*/
|
|
69
196
|
export interface ICodeEditorOpener {
|
|
197
|
+
/**
|
|
198
|
+
* Callback that is invoked when a resource other than the current model should be opened (e.g. when "go to definition" is called).
|
|
199
|
+
* The callback should return `true` if the request was handled and `false` otherwise.
|
|
200
|
+
* @param source The code editor instance that initiated the request.
|
|
201
|
+
* @param resource The URI of the resource that should be opened.
|
|
202
|
+
* @param selectionOrPosition An optional position or selection inside the model corresponding to `resource` that can be used to set the cursor.
|
|
203
|
+
*/
|
|
70
204
|
openCodeEditor(source: ICodeEditor, resource: URI, selectionOrPosition?: IRange | IPosition): boolean | Promise<boolean>;
|
|
71
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Registers a handler that is called when a resource other than the current model should be opened in the editor (e.g. "go to definition").
|
|
208
|
+
* The handler callback should return `true` if the request was handled and `false` otherwise.
|
|
209
|
+
*
|
|
210
|
+
* Returns a disposable that can unregister the opener again.
|
|
211
|
+
*
|
|
212
|
+
* If no handler is registered the default behavior is to do nothing for models other than the currently attached one.
|
|
213
|
+
*/
|
|
72
214
|
export declare function registerEditorOpener(opener: ICodeEditorOpener): IDisposable;
|
|
215
|
+
/**
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
73
218
|
export declare function createMonacoEditorAPI(): typeof monaco.editor;
|
|
@@ -10,12 +10,33 @@ import * as model from "@codingame/monaco-vscode-api/vscode/vs/editor/common/mod
|
|
|
10
10
|
import { IMonarchLanguage } from "../common/monarch/monarchTypes.js";
|
|
11
11
|
import { IStandaloneThemeService } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/common/standaloneTheme.service";
|
|
12
12
|
import { IMarkerData } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers";
|
|
13
|
+
/**
|
|
14
|
+
* Register information about a new language.
|
|
15
|
+
*/
|
|
13
16
|
export declare function register(language: ILanguageExtensionPoint): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the information of all the registered languages.
|
|
19
|
+
*/
|
|
14
20
|
export declare function getLanguages(): ILanguageExtensionPoint[];
|
|
15
21
|
export declare function getEncodedLanguageId(languageId: string): number;
|
|
22
|
+
/**
|
|
23
|
+
* An event emitted when a language is associated for the first time with a text model.
|
|
24
|
+
* @event
|
|
25
|
+
*/
|
|
16
26
|
export declare function onLanguage(languageId: string, callback: () => void): IDisposable;
|
|
27
|
+
/**
|
|
28
|
+
* An event emitted when a language is associated for the first time with a text model or
|
|
29
|
+
* when a language is encountered during the tokenization of another language.
|
|
30
|
+
* @event
|
|
31
|
+
*/
|
|
17
32
|
export declare function onLanguageEncountered(languageId: string, callback: () => void): IDisposable;
|
|
33
|
+
/**
|
|
34
|
+
* Set the editing configuration for a language.
|
|
35
|
+
*/
|
|
18
36
|
export declare function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable;
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
19
40
|
export declare class EncodedTokenizationSupportAdapter implements languages.ITokenizationSupport, IDisposable {
|
|
20
41
|
private readonly _languageId;
|
|
21
42
|
private readonly _actual;
|
|
@@ -25,6 +46,9 @@ export declare class EncodedTokenizationSupportAdapter implements languages.ITok
|
|
|
25
46
|
tokenize(line: string, hasEOL: boolean, state: languages.IState): languages.TokenizationResult;
|
|
26
47
|
tokenizeEncoded(line: string, hasEOL: boolean, state: languages.IState): languages.EncodedTokenizationResult;
|
|
27
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
28
52
|
export declare class TokenizationSupportAdapter implements languages.ITokenizationSupport, IDisposable {
|
|
29
53
|
private readonly _languageId;
|
|
30
54
|
private readonly _actual;
|
|
@@ -41,74 +65,282 @@ export declare class TokenizationSupportAdapter implements languages.ITokenizati
|
|
|
41
65
|
private _toBinaryTokens;
|
|
42
66
|
tokenizeEncoded(line: string, hasEOL: boolean, state: languages.IState): languages.EncodedTokenizationResult;
|
|
43
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* A token.
|
|
70
|
+
*/
|
|
44
71
|
export interface IToken {
|
|
45
72
|
startIndex: number;
|
|
46
73
|
scopes: string;
|
|
47
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The result of a line tokenization.
|
|
77
|
+
*/
|
|
48
78
|
export interface ILineTokens {
|
|
79
|
+
/**
|
|
80
|
+
* The list of tokens on the line.
|
|
81
|
+
*/
|
|
49
82
|
tokens: IToken[];
|
|
83
|
+
/**
|
|
84
|
+
* The tokenization end state.
|
|
85
|
+
* A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
|
|
86
|
+
*/
|
|
50
87
|
endState: languages.IState;
|
|
51
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* The result of a line tokenization.
|
|
91
|
+
*/
|
|
52
92
|
export interface IEncodedLineTokens {
|
|
93
|
+
/**
|
|
94
|
+
* The tokens on the line in a binary, encoded format. Each token occupies two array indices. For token i:
|
|
95
|
+
* - at offset 2*i => startIndex
|
|
96
|
+
* - at offset 2*i + 1 => metadata
|
|
97
|
+
* Meta data is in binary format:
|
|
98
|
+
* - -------------------------------------------
|
|
99
|
+
* 3322 2222 2222 1111 1111 1100 0000 0000
|
|
100
|
+
* 1098 7654 3210 9876 5432 1098 7654 3210
|
|
101
|
+
* - -------------------------------------------
|
|
102
|
+
* bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL
|
|
103
|
+
* - -------------------------------------------
|
|
104
|
+
* - L = EncodedLanguageId (8 bits): Use `getEncodedLanguageId` to get the encoded ID of a language.
|
|
105
|
+
* - T = StandardTokenType (2 bits): Other = 0, Comment = 1, String = 2, RegEx = 3.
|
|
106
|
+
* - F = FontStyle (4 bits): None = 0, Italic = 1, Bold = 2, Underline = 4, Strikethrough = 8.
|
|
107
|
+
* - f = foreground ColorId (9 bits)
|
|
108
|
+
* - b = background ColorId (9 bits)
|
|
109
|
+
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
|
|
110
|
+
* e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
|
|
111
|
+
* id = 1 is for the default foreground color, id = 2 for the default background.
|
|
112
|
+
*/
|
|
53
113
|
tokens: Uint32Array;
|
|
114
|
+
/**
|
|
115
|
+
* The tokenization end state.
|
|
116
|
+
* A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
|
|
117
|
+
*/
|
|
54
118
|
endState: languages.IState;
|
|
55
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* A factory for token providers.
|
|
122
|
+
*/
|
|
56
123
|
export interface TokensProviderFactory {
|
|
57
124
|
create(): languages.ProviderResult<TokensProvider | EncodedTokensProvider | IMonarchLanguage>;
|
|
58
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* A "manual" provider of tokens.
|
|
128
|
+
*/
|
|
59
129
|
export interface TokensProvider {
|
|
130
|
+
/**
|
|
131
|
+
* The initial state of a language. Will be the state passed in to tokenize the first line.
|
|
132
|
+
*/
|
|
60
133
|
getInitialState(): languages.IState;
|
|
134
|
+
/**
|
|
135
|
+
* Tokenize a line given the state at the beginning of the line.
|
|
136
|
+
*/
|
|
61
137
|
tokenize(line: string, state: languages.IState): ILineTokens;
|
|
62
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* A "manual" provider of tokens, returning tokens in a binary form.
|
|
141
|
+
*/
|
|
63
142
|
export interface EncodedTokensProvider {
|
|
143
|
+
/**
|
|
144
|
+
* The initial state of a language. Will be the state passed in to tokenize the first line.
|
|
145
|
+
*/
|
|
64
146
|
getInitialState(): languages.IState;
|
|
147
|
+
/**
|
|
148
|
+
* Tokenize a line given the state at the beginning of the line.
|
|
149
|
+
*/
|
|
65
150
|
tokenizeEncoded(line: string, state: languages.IState): IEncodedLineTokens;
|
|
151
|
+
/**
|
|
152
|
+
* Tokenize a line given the state at the beginning of the line.
|
|
153
|
+
*/
|
|
66
154
|
tokenize?(line: string, state: languages.IState): ILineTokens;
|
|
67
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Change the color map that is used for token colors.
|
|
158
|
+
* Supported formats (hex): #RRGGBB, $RRGGBBAA, #RGB, #RGBA
|
|
159
|
+
*/
|
|
68
160
|
export declare function setColorMap(colorMap: string[] | null): void;
|
|
161
|
+
/**
|
|
162
|
+
* Register a tokens provider factory for a language. This tokenizer will be exclusive with a tokenizer
|
|
163
|
+
* set using `setTokensProvider` or one created using `setMonarchTokensProvider`, but will work together
|
|
164
|
+
* with a tokens provider set using `registerDocumentSemanticTokensProvider` or `registerDocumentRangeSemanticTokensProvider`.
|
|
165
|
+
*/
|
|
69
166
|
export declare function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable;
|
|
167
|
+
/**
|
|
168
|
+
* Set the tokens provider for a language (manual implementation). This tokenizer will be exclusive
|
|
169
|
+
* with a tokenizer created using `setMonarchTokensProvider`, or with `registerTokensProviderFactory`,
|
|
170
|
+
* but will work together with a tokens provider set using `registerDocumentSemanticTokensProvider`
|
|
171
|
+
* or `registerDocumentRangeSemanticTokensProvider`.
|
|
172
|
+
*/
|
|
70
173
|
export declare function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable<TokensProvider | EncodedTokensProvider>): IDisposable;
|
|
174
|
+
/**
|
|
175
|
+
* Set the tokens provider for a language (monarch implementation). This tokenizer will be exclusive
|
|
176
|
+
* with a tokenizer set using `setTokensProvider`, or with `registerTokensProviderFactory`, but will
|
|
177
|
+
* work together with a tokens provider set using `registerDocumentSemanticTokensProvider` or
|
|
178
|
+
* `registerDocumentRangeSemanticTokensProvider`.
|
|
179
|
+
*/
|
|
71
180
|
export declare function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable<IMonarchLanguage>): IDisposable;
|
|
181
|
+
/**
|
|
182
|
+
* Register a reference provider (used by e.g. reference search).
|
|
183
|
+
*/
|
|
72
184
|
export declare function registerReferenceProvider(languageSelector: LanguageSelector, provider: languages.ReferenceProvider): IDisposable;
|
|
185
|
+
/**
|
|
186
|
+
* Register a rename provider (used by e.g. rename symbol).
|
|
187
|
+
*/
|
|
73
188
|
export declare function registerRenameProvider(languageSelector: LanguageSelector, provider: languages.RenameProvider): IDisposable;
|
|
189
|
+
/**
|
|
190
|
+
* Register a new symbol-name provider (e.g., when a symbol is being renamed, show new possible symbol-names)
|
|
191
|
+
*/
|
|
74
192
|
export declare function registerNewSymbolNameProvider(languageSelector: LanguageSelector, provider: languages.NewSymbolNamesProvider): IDisposable;
|
|
193
|
+
/**
|
|
194
|
+
* Register a signature help provider (used by e.g. parameter hints).
|
|
195
|
+
*/
|
|
75
196
|
export declare function registerSignatureHelpProvider(languageSelector: LanguageSelector, provider: languages.SignatureHelpProvider): IDisposable;
|
|
197
|
+
/**
|
|
198
|
+
* Register a hover provider (used by e.g. editor hover).
|
|
199
|
+
*/
|
|
76
200
|
export declare function registerHoverProvider(languageSelector: LanguageSelector, provider: languages.HoverProvider): IDisposable;
|
|
201
|
+
/**
|
|
202
|
+
* Register a document symbol provider (used by e.g. outline).
|
|
203
|
+
*/
|
|
77
204
|
export declare function registerDocumentSymbolProvider(languageSelector: LanguageSelector, provider: languages.DocumentSymbolProvider): IDisposable;
|
|
205
|
+
/**
|
|
206
|
+
* Register a document highlight provider (used by e.g. highlight occurrences).
|
|
207
|
+
*/
|
|
78
208
|
export declare function registerDocumentHighlightProvider(languageSelector: LanguageSelector, provider: languages.DocumentHighlightProvider): IDisposable;
|
|
209
|
+
/**
|
|
210
|
+
* Register an linked editing range provider.
|
|
211
|
+
*/
|
|
79
212
|
export declare function registerLinkedEditingRangeProvider(languageSelector: LanguageSelector, provider: languages.LinkedEditingRangeProvider): IDisposable;
|
|
213
|
+
/**
|
|
214
|
+
* Register a definition provider (used by e.g. go to definition).
|
|
215
|
+
*/
|
|
80
216
|
export declare function registerDefinitionProvider(languageSelector: LanguageSelector, provider: languages.DefinitionProvider): IDisposable;
|
|
217
|
+
/**
|
|
218
|
+
* Register a implementation provider (used by e.g. go to implementation).
|
|
219
|
+
*/
|
|
81
220
|
export declare function registerImplementationProvider(languageSelector: LanguageSelector, provider: languages.ImplementationProvider): IDisposable;
|
|
221
|
+
/**
|
|
222
|
+
* Register a type definition provider (used by e.g. go to type definition).
|
|
223
|
+
*/
|
|
82
224
|
export declare function registerTypeDefinitionProvider(languageSelector: LanguageSelector, provider: languages.TypeDefinitionProvider): IDisposable;
|
|
225
|
+
/**
|
|
226
|
+
* Register a code lens provider (used by e.g. inline code lenses).
|
|
227
|
+
*/
|
|
83
228
|
export declare function registerCodeLensProvider(languageSelector: LanguageSelector, provider: languages.CodeLensProvider): IDisposable;
|
|
229
|
+
/**
|
|
230
|
+
* Register a code action provider (used by e.g. quick fix).
|
|
231
|
+
*/
|
|
84
232
|
export declare function registerCodeActionProvider(languageSelector: LanguageSelector, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): IDisposable;
|
|
233
|
+
/**
|
|
234
|
+
* Register a formatter that can handle only entire models.
|
|
235
|
+
*/
|
|
85
236
|
export declare function registerDocumentFormattingEditProvider(languageSelector: LanguageSelector, provider: languages.DocumentFormattingEditProvider): IDisposable;
|
|
237
|
+
/**
|
|
238
|
+
* Register a formatter that can handle a range inside a model.
|
|
239
|
+
*/
|
|
86
240
|
export declare function registerDocumentRangeFormattingEditProvider(languageSelector: LanguageSelector, provider: languages.DocumentRangeFormattingEditProvider): IDisposable;
|
|
241
|
+
/**
|
|
242
|
+
* Register a formatter than can do formatting as the user types.
|
|
243
|
+
*/
|
|
87
244
|
export declare function registerOnTypeFormattingEditProvider(languageSelector: LanguageSelector, provider: languages.OnTypeFormattingEditProvider): IDisposable;
|
|
245
|
+
/**
|
|
246
|
+
* Register a link provider that can find links in text.
|
|
247
|
+
*/
|
|
88
248
|
export declare function registerLinkProvider(languageSelector: LanguageSelector, provider: languages.LinkProvider): IDisposable;
|
|
249
|
+
/**
|
|
250
|
+
* Register a completion item provider (use by e.g. suggestions).
|
|
251
|
+
*/
|
|
89
252
|
export declare function registerCompletionItemProvider(languageSelector: LanguageSelector, provider: languages.CompletionItemProvider): IDisposable;
|
|
253
|
+
/**
|
|
254
|
+
* Register a document color provider (used by Color Picker, Color Decorator).
|
|
255
|
+
*/
|
|
90
256
|
export declare function registerColorProvider(languageSelector: LanguageSelector, provider: languages.DocumentColorProvider): IDisposable;
|
|
257
|
+
/**
|
|
258
|
+
* Register a folding range provider
|
|
259
|
+
*/
|
|
91
260
|
export declare function registerFoldingRangeProvider(languageSelector: LanguageSelector, provider: languages.FoldingRangeProvider): IDisposable;
|
|
261
|
+
/**
|
|
262
|
+
* Register a declaration provider
|
|
263
|
+
*/
|
|
92
264
|
export declare function registerDeclarationProvider(languageSelector: LanguageSelector, provider: languages.DeclarationProvider): IDisposable;
|
|
265
|
+
/**
|
|
266
|
+
* Register a selection range provider
|
|
267
|
+
*/
|
|
93
268
|
export declare function registerSelectionRangeProvider(languageSelector: LanguageSelector, provider: languages.SelectionRangeProvider): IDisposable;
|
|
269
|
+
/**
|
|
270
|
+
* Register a document semantic tokens provider. A semantic tokens provider will complement and enhance a
|
|
271
|
+
* simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
|
|
272
|
+
* or `setTokensProvider`.
|
|
273
|
+
*
|
|
274
|
+
* For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
|
|
275
|
+
*/
|
|
94
276
|
export declare function registerDocumentSemanticTokensProvider(languageSelector: LanguageSelector, provider: languages.DocumentSemanticTokensProvider): IDisposable;
|
|
277
|
+
/**
|
|
278
|
+
* Register a document range semantic tokens provider. A semantic tokens provider will complement and enhance a
|
|
279
|
+
* simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
|
|
280
|
+
* or `setTokensProvider`.
|
|
281
|
+
*
|
|
282
|
+
* For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
|
|
283
|
+
*/
|
|
95
284
|
export declare function registerDocumentRangeSemanticTokensProvider(languageSelector: LanguageSelector, provider: languages.DocumentRangeSemanticTokensProvider): IDisposable;
|
|
285
|
+
/**
|
|
286
|
+
* Register an inline completions provider.
|
|
287
|
+
*/
|
|
96
288
|
export declare function registerInlineCompletionsProvider(languageSelector: LanguageSelector, provider: languages.InlineCompletionsProvider): IDisposable;
|
|
289
|
+
/**
|
|
290
|
+
* Register an inlay hints provider.
|
|
291
|
+
*/
|
|
97
292
|
export declare function registerInlayHintsProvider(languageSelector: LanguageSelector, provider: languages.InlayHintsProvider): IDisposable;
|
|
293
|
+
/**
|
|
294
|
+
* Contains additional diagnostic information about the context in which
|
|
295
|
+
* a [code action](#CodeActionProvider.provideCodeActions) is run.
|
|
296
|
+
*/
|
|
98
297
|
export interface CodeActionContext {
|
|
298
|
+
/**
|
|
299
|
+
* An array of diagnostics.
|
|
300
|
+
*/
|
|
99
301
|
readonly markers: IMarkerData[];
|
|
302
|
+
/**
|
|
303
|
+
* Requested kind of actions to return.
|
|
304
|
+
*/
|
|
100
305
|
readonly only?: string;
|
|
306
|
+
/**
|
|
307
|
+
* The reason why code actions were requested.
|
|
308
|
+
*/
|
|
101
309
|
readonly trigger: languages.CodeActionTriggerType;
|
|
102
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* The code action interface defines the contract between extensions and
|
|
313
|
+
* the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
|
|
314
|
+
*/
|
|
103
315
|
export interface CodeActionProvider {
|
|
316
|
+
/**
|
|
317
|
+
* Provide commands for the given document and range.
|
|
318
|
+
*/
|
|
104
319
|
provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): languages.ProviderResult<languages.CodeActionList>;
|
|
320
|
+
/**
|
|
321
|
+
* Given a code action fill in the edit. Will only invoked when missing.
|
|
322
|
+
*/
|
|
105
323
|
resolveCodeAction?(codeAction: languages.CodeAction, token: CancellationToken): languages.ProviderResult<languages.CodeAction>;
|
|
106
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Metadata about the type of code actions that a {@link CodeActionProvider} provides.
|
|
327
|
+
*/
|
|
107
328
|
export interface CodeActionProviderMetadata {
|
|
329
|
+
/**
|
|
330
|
+
* List of code action kinds that a {@link CodeActionProvider} may return.
|
|
331
|
+
*
|
|
332
|
+
* This list is used to determine if a given `CodeActionProvider` should be invoked or not.
|
|
333
|
+
* To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The
|
|
334
|
+
* list of kinds may either be generic, such as `["quickfix", "refactor", "source"]`, or list out every kind provided,
|
|
335
|
+
* such as `["quickfix.removeLine", "source.fixAll" ...]`.
|
|
336
|
+
*/
|
|
108
337
|
readonly providedCodeActionKinds?: readonly string[];
|
|
109
338
|
readonly documentation?: ReadonlyArray<{
|
|
110
339
|
readonly kind: string;
|
|
111
340
|
readonly command: languages.Command;
|
|
112
341
|
}>;
|
|
113
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* @internal
|
|
345
|
+
*/
|
|
114
346
|
export declare function createMonacoLanguagesAPI(): typeof monaco.languages;
|
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
2
|
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
|
|
3
|
+
/**
|
|
4
|
+
* Create a new web worker that has model syncing capabilities built in.
|
|
5
|
+
* Specify an AMD module to load that will `create` an object that will be proxied.
|
|
6
|
+
*/
|
|
3
7
|
export declare function createWebWorker<T extends object>(modelService: IModelService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
|
|
8
|
+
/**
|
|
9
|
+
* A web worker that can provide a proxy to an arbitrary file.
|
|
10
|
+
*/
|
|
4
11
|
export interface MonacoWebWorker<T> {
|
|
12
|
+
/**
|
|
13
|
+
* Terminate the web worker, thus invalidating the returned proxy.
|
|
14
|
+
*/
|
|
5
15
|
dispose(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Get a proxy to the arbitrary loaded code.
|
|
18
|
+
*/
|
|
6
19
|
getProxy(): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Synchronize (send) the models at `resources` to the web worker,
|
|
22
|
+
* making them available in the monaco.worker.getMirrorModels().
|
|
23
|
+
*/
|
|
7
24
|
withSyncedResources(resources: URI[]): Promise<T>;
|
|
8
25
|
}
|
|
9
26
|
export interface IInternalWebWorkerOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The worker.
|
|
29
|
+
*/
|
|
10
30
|
worker: Worker | Promise<Worker>;
|
|
31
|
+
/**
|
|
32
|
+
* An object that can be used by the web worker to make calls back to the main thread.
|
|
33
|
+
*/
|
|
11
34
|
host?: any;
|
|
35
|
+
/**
|
|
36
|
+
* Keep idle models.
|
|
37
|
+
* Defaults to false, which means that idle models will stop syncing after a while.
|
|
38
|
+
*/
|
|
12
39
|
keepIdleModels?: boolean;
|
|
13
40
|
}
|
|
@@ -62,12 +62,46 @@ export interface IBranch {
|
|
|
62
62
|
value: FuzzyAction;
|
|
63
63
|
test?: (id: string, matches: string[], state: string, eos: boolean) => boolean;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Is a string null, undefined, or empty?
|
|
67
|
+
*/
|
|
65
68
|
export declare function empty(s: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Puts a string to lower case if 'ignoreCase' is set.
|
|
71
|
+
*/
|
|
66
72
|
export declare function fixCase(lexer: ILexerMin, str: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Ensures there are no bad characters in a CSS token class.
|
|
75
|
+
*/
|
|
67
76
|
export declare function sanitize(s: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Logs a message.
|
|
79
|
+
*/
|
|
68
80
|
export declare function log(lexer: ILexerMin, msg: string): void;
|
|
69
81
|
export declare function createError(lexer: ILexerMin, msg: string): Error;
|
|
82
|
+
/**
|
|
83
|
+
* substituteMatches is used on lexer strings and can substitutes predefined patterns:
|
|
84
|
+
* $$ => $
|
|
85
|
+
* $# => id
|
|
86
|
+
* $n => matched entry n
|
|
87
|
+
* @attr => contents of lexer[attr]
|
|
88
|
+
*
|
|
89
|
+
* See documentation for more info
|
|
90
|
+
*/
|
|
70
91
|
export declare function substituteMatches(lexer: ILexerMin, str: string, id: string, matches: string[], state: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* substituteMatchesRe is used on lexer regex rules and can substitutes predefined patterns:
|
|
94
|
+
* $Sn => n'th part of state
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
71
97
|
export declare function substituteMatchesRe(lexer: ILexerMin, str: string, state: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Find the tokenizer rules for a specific state (i.e. next action)
|
|
100
|
+
*/
|
|
72
101
|
export declare function findRules(lexer: ILexer, inState: string): IRule[] | null;
|
|
102
|
+
/**
|
|
103
|
+
* Is a certain state defined? In contrast to 'findRules' this works on a ILexerMin.
|
|
104
|
+
* This is used during compilation where we may know the defined states
|
|
105
|
+
* but not yet whether the corresponding rules are correct.
|
|
106
|
+
*/
|
|
73
107
|
export declare function stateExists(lexer: ILexerMin, inState: string): boolean;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import * as monarchCommon from "./monarchCommon.js";
|
|
2
2
|
import { IMonarchLanguage } from "./monarchTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Compiles a json description function into json where all regular expressions,
|
|
5
|
+
* case matches etc, are compiled and all include rules are expanded.
|
|
6
|
+
* We also compile the bracket definitions, supply defaults, and do many sanity checks.
|
|
7
|
+
* If the 'jsonStrict' parameter is 'false', we allow at certain locations
|
|
8
|
+
* regular expression objects and functions that get called during lexing.
|
|
9
|
+
* (Currently we have no samples that need this so perhaps we should always have
|
|
10
|
+
* jsonStrict to true).
|
|
11
|
+
*/
|
|
3
12
|
export declare function compile(languageId: string, json: IMonarchLanguage): monarchCommon.ILexer;
|