@codingame/monaco-vscode-api 1.79.11 → 1.79.13

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.
@@ -1,3707 +1,581 @@
1
- import { S as ServiceIdentifier, a as ServicesAccessor } from './instantiation.js';
2
- import { E as Event, a as IDisposable, C as CancellationToken, d as IWaitUntil } from './event.js';
3
- import { I as IJSONSchema } from './jsonSchema.js';
4
- import { q as ITextModel, P as Position, R as Range, S as Selection, v as IRange, E as EndOfLineSequence, u as IPosition, k as IMarkdownString, w as ISingleEditOperation, x as EditorAutoIndentStrategy, y as ITextEditorModel, z as ITextSnapshot, A as ITextBufferFactory } from './editorBrowser.js';
5
- import { S as Severity$1 } from './severity.js';
1
+ import { S as ServiceIdentifier } from './instantiation.js';
2
+ import { E as Event, a as IDisposable } from './event.js';
3
+ import { a as ILanguageIdCodec, S as StandardTokenType, b as ColorId, c as ITokenPresentation, R as ReferenceProvider, D as DefinitionProvider, T as TypeDefinitionProvider, d as DeclarationProvider, e as ImplementationProvider, f as CodeActionProvider, g as DocumentPasteEditProvider, h as RenameProvider, i as DocumentFormattingEditProvider, j as DocumentRangeFormattingEditProvider, O as OnTypeFormattingEditProvider, k as DocumentSymbolProvider, l as InlayHintsProvider, m as DocumentColorProvider, n as CodeLensProvider, o as SignatureHelpProvider, H as HoverProvider, p as DocumentHighlightProvider, q as DocumentRangeSemanticTokensProvider, s as DocumentSemanticTokensProvider, t as SelectionRangeProvider, F as FoldingRangeProvider, L as LinkProvider, u as InlineCompletionsProvider, v as CompletionItemProvider, w as LinkedEditingRangeProvider, x as InlineValuesProvider, E as EvaluatableExpressionProvider, y as DocumentOnDropEditProvider } from './colorRegistry.js';
4
+ import { r as EditorAutoIndentStrategy, j as ITextModel } from './editorBrowser.js';
5
+ import { n as IRelativePattern } from './files.js';
6
6
  import { U as URI } from './uri.js';
7
- import { o as ISaveOptions, m as IRevertOptions, S as SaveReason, q as SaveSource } from './editor.js';
8
- import { V as VSBuffer, n as VSBufferReadable, o as VSBufferReadableStream, p as IFileStatWithMetadata, q as FileOperation, r as ReadableStream, s as IReadFileStreamOptions, t as IWriteFileOptions, u as IBaseFileStatWithMetadata, v as IFileReadLimits, w as IRelativePattern } from './files.js';
9
- import { a as IProgress, b as IProgressStep } from './progress.js';
10
- import { T as ThemeIcon } from './themables.js';
11
- import { E as ExtensionIdentifier } from './extensions.d2.ts';
12
7
 
13
- type TypeConstraint = string | Function;
14
-
15
- interface ICommandEvent {
16
- commandId: string;
17
- args: any[];
18
- }
19
-
20
- declare const ICommandService: ServiceIdentifier<ICommandService>;
21
- interface ICommandService {
22
- readonly _serviceBrand: undefined;
23
- onWillExecuteCommand: Event<ICommandEvent>;
24
- onDidExecuteCommand: Event<ICommandEvent>;
25
- executeCommand<T = any>(commandId: string, ...args: any[]): Promise<T | undefined>;
26
- }
27
- type ICommandsMap = Map<string, ICommand>;
28
- interface ICommandHandler {
29
- (accessor: ServicesAccessor, ...args: any[]): void;
30
- }
31
- interface ICommand {
32
- id: string;
33
- handler: ICommandHandler;
34
- description?: ICommandHandlerDescription | null;
35
- }
36
- interface ICommandHandlerDescription {
37
- readonly description: string;
38
- readonly args: ReadonlyArray<{
39
- readonly name: string;
40
- readonly isOptional?: boolean;
41
- readonly description?: string;
42
- readonly constraint?: TypeConstraint;
43
- readonly schema?: IJSONSchema;
44
- }>;
45
- readonly returns?: string;
46
- }
47
- interface ICommandRegistry {
48
- onDidRegisterCommand: Event<string>;
49
- registerCommand(id: string, command: ICommandHandler): IDisposable;
50
- registerCommand(command: ICommand): IDisposable;
51
- registerCommandAlias(oldId: string, newId: string): IDisposable;
52
- getCommand(id: string): ICommand | undefined;
53
- getCommands(): ICommandsMap;
8
+ interface IViewLineTokens {
9
+ equals(other: IViewLineTokens): boolean;
10
+ getCount(): number;
11
+ getForeground(tokenIndex: number): ColorId;
12
+ getEndOffset(tokenIndex: number): number;
13
+ getClassName(tokenIndex: number): string;
14
+ getInlineStyle(tokenIndex: number, colorMap: string[]): string;
15
+ getPresentation(tokenIndex: number): ITokenPresentation;
16
+ findTokenIndexAtOffset(offset: number): number;
17
+ getLineContent(): string;
18
+ getMetadata(tokenIndex: number): number;
19
+ getLanguageId(tokenIndex: number): string;
54
20
  }
55
- declare const CommandsRegistry: ICommandRegistry;
56
-
57
- declare class RGBA {
58
- _rgbaBrand: void;
59
- /**
60
- * Red: integer in [0-255]
61
- */
62
- readonly r: number;
63
- /**
64
- * Green: integer in [0-255]
65
- */
66
- readonly g: number;
21
+ declare class LineTokens implements IViewLineTokens {
22
+ _lineTokensBrand: void;
23
+ private readonly _tokens;
24
+ private readonly _tokensCount;
25
+ private readonly _text;
26
+ private readonly _languageIdCodec;
27
+ static defaultTokenMetadata: number;
28
+ static createEmpty(lineContent: string, decoder: ILanguageIdCodec): LineTokens;
29
+ constructor(tokens: Uint32Array, text: string, decoder: ILanguageIdCodec);
30
+ equals(other: IViewLineTokens): boolean;
31
+ slicedEquals(other: LineTokens, sliceFromTokenIndex: number, sliceTokenCount: number): boolean;
32
+ getLineContent(): string;
33
+ getCount(): number;
34
+ getStartOffset(tokenIndex: number): number;
35
+ getMetadata(tokenIndex: number): number;
36
+ getLanguageId(tokenIndex: number): string;
37
+ getStandardTokenType(tokenIndex: number): StandardTokenType;
38
+ getForeground(tokenIndex: number): ColorId;
39
+ getClassName(tokenIndex: number): string;
40
+ getInlineStyle(tokenIndex: number, colorMap: string[]): string;
41
+ getPresentation(tokenIndex: number): ITokenPresentation;
42
+ getEndOffset(tokenIndex: number): number;
67
43
  /**
68
- * Blue: integer in [0-255]
44
+ * Find the token containing offset `offset`.
45
+ * @param offset The search offset
46
+ * @return The index of the token containing the offset.
69
47
  */
70
- readonly b: number;
48
+ findTokenIndexAtOffset(offset: number): number;
49
+ inflate(): IViewLineTokens;
50
+ sliceAndInflate(startOffset: number, endOffset: number, deltaOffset: number): IViewLineTokens;
51
+ static convertToEndOffset(tokens: Uint32Array, lineTextLength: number): void;
52
+ static findIndexInTokensArray(tokens: Uint32Array, desiredIndex: number): number;
71
53
  /**
72
- * Alpha: float in [0-1]
73
- */
74
- readonly a: number;
75
- constructor(r: number, g: number, b: number, a?: number);
76
- static equals(a: RGBA, b: RGBA): boolean;
54
+ * @pure
55
+ * @param insertTokens Must be sorted by offset.
56
+ */
57
+ withInserted(insertTokens: {
58
+ offset: number;
59
+ text: string;
60
+ tokenMetadata: number;
61
+ }[]): LineTokens;
77
62
  }
78
- declare class HSLA {
79
- _hslaBrand: void;
80
- /**
81
- * Hue: integer in [0, 360]
82
- */
83
- readonly h: number;
63
+
64
+ declare class ScopedLineTokens {
65
+ _scopedLineTokensBrand: void;
66
+ readonly languageId: string;
67
+ private readonly _actual;
68
+ private readonly _firstTokenIndex;
69
+ private readonly _lastTokenIndex;
70
+ readonly firstCharOffset: number;
71
+ private readonly _lastCharOffset;
72
+ constructor(actual: LineTokens, languageId: string, firstTokenIndex: number, lastTokenIndex: number, firstCharOffset: number, lastCharOffset: number);
73
+ getLineContent(): string;
74
+ getActualLineContentBefore(offset: number): string;
75
+ getTokenCount(): number;
76
+ findTokenIndexAtOffset(offset: number): number;
77
+ getStandardTokenType(tokenIndex: number): StandardTokenType;
78
+ }
79
+
80
+ /**
81
+ * Describes how comments for a language work.
82
+ */
83
+ interface CommentRule {
84
84
  /**
85
- * Saturation: float in [0, 1]
85
+ * The line comment token, like `// this is a comment`
86
86
  */
87
- readonly s: number;
87
+ lineComment?: string | null;
88
88
  /**
89
- * Luminosity: float in [0, 1]
89
+ * The block comment character pair, like `/* block comment *&#47;`
90
90
  */
91
- readonly l: number;
91
+ blockComment?: CharacterPair | null;
92
+ }
93
+ /**
94
+ * The language configuration interface defines the contract between extensions and
95
+ * various editor features, like automatic bracket insertion, automatic indentation etc.
96
+ */
97
+ interface LanguageConfiguration {
92
98
  /**
93
- * Alpha: float in [0, 1]
99
+ * The language's comment settings.
94
100
  */
95
- readonly a: number;
96
- constructor(h: number, s: number, l: number, a: number);
97
- static equals(a: HSLA, b: HSLA): boolean;
101
+ comments?: CommentRule;
98
102
  /**
99
- * Converts an RGB color value to HSL. Conversion formula
100
- * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
101
- * Assumes r, g, and b are contained in the set [0, 255] and
102
- * returns h in the set [0, 360], s, and l in the set [0, 1].
103
+ * The language's brackets.
104
+ * This configuration implicitly affects pressing Enter around these brackets.
103
105
  */
104
- static fromRGBA(rgba: RGBA): HSLA;
105
- private static _hue2rgb;
106
+ brackets?: CharacterPair[];
106
107
  /**
107
- * Converts an HSL color value to RGB. Conversion formula
108
- * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
109
- * Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and
110
- * returns r, g, and b in the set [0, 255].
108
+ * The language's word definition.
109
+ * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
110
+ * to provide a word definition that uses exclusion of known separators.
111
+ * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
112
+ * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
111
113
  */
112
- static toRGBA(hsla: HSLA): RGBA;
113
- }
114
- declare class HSVA {
115
- _hsvaBrand: void;
114
+ wordPattern?: RegExp;
116
115
  /**
117
- * Hue: integer in [0, 360]
116
+ * The language's indentation settings.
118
117
  */
119
- readonly h: number;
118
+ indentationRules?: IndentationRule;
120
119
  /**
121
- * Saturation: float in [0, 1]
120
+ * The language's rules to be evaluated when pressing Enter.
122
121
  */
123
- readonly s: number;
122
+ onEnterRules?: OnEnterRule[];
124
123
  /**
125
- * Value: float in [0, 1]
124
+ * The language's auto closing pairs. The 'close' character is automatically inserted with the
125
+ * 'open' character is typed. If not set, the configured brackets will be used.
126
126
  */
127
- readonly v: number;
127
+ autoClosingPairs?: IAutoClosingPairConditional[];
128
128
  /**
129
- * Alpha: float in [0, 1]
129
+ * The language's surrounding pairs. When the 'open' character is typed on a selection, the
130
+ * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
131
+ * settings will be used.
130
132
  */
131
- readonly a: number;
132
- constructor(h: number, s: number, v: number, a: number);
133
- static equals(a: HSVA, b: HSVA): boolean;
134
- static fromRGBA(rgba: RGBA): HSVA;
135
- static toRGBA(hsva: HSVA): RGBA;
136
- }
137
- declare class Color {
138
- static fromHex(hex: string): Color;
139
- static equals(a: Color | null, b: Color | null): boolean;
140
- readonly rgba: RGBA;
141
- private _hsla?;
142
- get hsla(): HSLA;
143
- private _hsva?;
144
- get hsva(): HSVA;
145
- constructor(arg: RGBA | HSLA | HSVA);
146
- equals(other: Color | null): boolean;
133
+ surroundingPairs?: IAutoClosingPair[];
147
134
  /**
148
- * http://www.w3.org/TR/WCAG20/#relativeluminancedef
149
- * Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.
150
- */
151
- getRelativeLuminance(): number;
152
- private static _relativeLuminanceForComponent;
135
+ * Defines a list of bracket pairs that are colorized depending on their nesting level.
136
+ * If not set, the configured brackets will be used.
137
+ */
138
+ colorizedBracketPairs?: CharacterPair[];
153
139
  /**
154
- * http://www.w3.org/TR/WCAG20/#contrast-ratiodef
155
- * Returns the contrast ration number in the set [1, 21].
140
+ * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting.
141
+ *
142
+ * This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc.
156
143
  */
157
- getContrastRatio(another: Color): number;
144
+ autoCloseBefore?: string;
158
145
  /**
159
- * http://24ways.org/2010/calculating-color-contrast
160
- * Return 'true' if darker color otherwise 'false'
146
+ * The language's folding rules.
161
147
  */
162
- isDarker(): boolean;
148
+ folding?: FoldingRules;
163
149
  /**
164
- * http://24ways.org/2010/calculating-color-contrast
165
- * Return 'true' if lighter color otherwise 'false'
150
+ * **Deprecated** Do not use.
151
+ *
152
+ * @deprecated Will be replaced by a better API soon.
166
153
  */
167
- isLighter(): boolean;
168
- isLighterThan(another: Color): boolean;
169
- isDarkerThan(another: Color): boolean;
170
- lighten(factor: number): Color;
171
- darken(factor: number): Color;
172
- transparent(factor: number): Color;
173
- isTransparent(): boolean;
174
- isOpaque(): boolean;
175
- opposite(): Color;
176
- blend(c: Color): Color;
177
- makeOpaque(opaqueBackground: Color): Color;
178
- flatten(...backgrounds: Color[]): Color;
179
- private static _flatten;
180
- private _toString?;
181
- toString(): string;
182
- static getLighterColor(of: Color, relative: Color, factor?: number): Color;
183
- static getDarkerColor(of: Color, relative: Color, factor?: number): Color;
184
- static readonly white: Color;
185
- static readonly black: Color;
186
- static readonly red: Color;
187
- static readonly blue: Color;
188
- static readonly green: Color;
189
- static readonly cyan: Color;
190
- static readonly lightgrey: Color;
191
- static readonly transparent: Color;
192
- }
193
- declare namespace Color {
194
- namespace Format {
195
- namespace CSS {
196
- function formatRGB(color: Color): string;
197
- function formatRGBA(color: Color): string;
198
- function formatHSL(color: Color): string;
199
- function formatHSLA(color: Color): string;
200
- /**
201
- * Formats the color as #RRGGBB
202
- */
203
- function formatHex(color: Color): string;
204
- /**
205
- * Formats the color as #RRGGBBAA
206
- * If 'compact' is set, colors without transparancy will be printed as #RRGGBB
207
- */
208
- function formatHexA(color: Color, compact?: boolean): string;
209
- /**
210
- * The default format will use HEX if opaque and RGBA otherwise.
211
- */
212
- function format(color: Color): string;
213
- /**
214
- * Converts an Hex color value to a Color.
215
- * returns r, g, and b are contained in the set [0, 255]
216
- * @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA).
217
- */
218
- function parseHex(hex: string): Color | null;
219
- }
220
- }
221
- }
222
-
223
- interface IDataTransferFile {
224
- readonly id: string;
225
- readonly name: string;
226
- readonly uri?: URI;
227
- data(): Promise<Uint8Array>;
228
- }
229
- interface IDataTransferItem {
230
- asString(): Thenable<string>;
231
- asFile(): IDataTransferFile | undefined;
232
- value: any;
154
+ __electricCharacterSupport?: {
155
+ docComment?: IDocComment;
156
+ };
233
157
  }
234
- interface IReadonlyVSDataTransfer extends Iterable<readonly [string, IDataTransferItem]> {
158
+ /**
159
+ * Describes indentation rules for a language.
160
+ */
161
+ interface IndentationRule {
235
162
  /**
236
- * Get the total number of entries in this data transfer.
163
+ * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
237
164
  */
238
- get size(): number;
165
+ decreaseIndentPattern: RegExp;
239
166
  /**
240
- * Check if this data transfer contains data for `mimeType`.
241
- *
242
- * This uses exact matching and does not support wildcards.
167
+ * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
243
168
  */
244
- has(mimeType: string): boolean;
169
+ increaseIndentPattern: RegExp;
245
170
  /**
246
- * Check if this data transfer contains data matching `pattern`.
247
- *
248
- * This allows matching for wildcards, such as `image/*`.
249
- *
250
- * Use the special `files` mime type to match any file in the data transfer.
171
+ * If a line matches this pattern, then **only the next line** after it should be indented once.
251
172
  */
252
- matches(pattern: string): boolean;
173
+ indentNextLinePattern?: RegExp | null;
253
174
  /**
254
- * Retrieve the first entry for `mimeType`.
255
- *
256
- * Note that if you want to find all entries for a given mime type, use {@link IReadonlyVSDataTransfer.entries} instead.
175
+ * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
257
176
  */
258
- get(mimeType: string): IDataTransferItem | undefined;
259
- }
260
-
261
- /**
262
- * Open ended enum at runtime
263
- */
264
- declare const enum LanguageId {
265
- Null = 0,
266
- PlainText = 1
267
- }
268
- /**
269
- * Open ended enum at runtime
270
- */
271
- declare const enum ColorId {
272
- None = 0,
273
- DefaultForeground = 1,
274
- DefaultBackground = 2
275
- }
276
- /**
277
- * A standard token type.
278
- */
279
- declare const enum StandardTokenType {
280
- Other = 0,
281
- Comment = 1,
282
- String = 2,
283
- RegEx = 3
284
- }
285
- /**
286
- */
287
- interface ITokenPresentation {
288
- foreground: ColorId;
289
- italic: boolean;
290
- bold: boolean;
291
- underline: boolean;
292
- strikethrough: boolean;
293
- }
294
-
295
- /**
296
- *
297
- */
298
- interface IRelatedInformation {
299
- resource: URI;
300
- message: string;
301
- startLineNumber: number;
302
- startColumn: number;
303
- endLineNumber: number;
304
- endColumn: number;
305
- }
306
- declare const enum MarkerTag {
307
- Unnecessary = 1,
308
- Deprecated = 2
309
- }
310
- declare enum MarkerSeverity {
311
- Hint = 1,
312
- Info = 2,
313
- Warning = 4,
314
- Error = 8
315
- }
316
- declare namespace MarkerSeverity {
317
- function compare(a: MarkerSeverity, b: MarkerSeverity): number;
318
- function toString(a: MarkerSeverity): string;
319
- function fromSeverity(severity: Severity$1): MarkerSeverity;
320
- function toSeverity(severity: MarkerSeverity): Severity$1;
321
- }
322
- interface IResourceMarker {
323
- resource: URI;
324
- marker: IMarkerData;
325
- }
326
- interface IMarker {
327
- owner: string;
328
- resource: URI;
329
- severity: MarkerSeverity;
330
- code?: string | {
331
- value: string;
332
- target: URI;
333
- };
334
- message: string;
335
- source?: string;
336
- startLineNumber: number;
337
- startColumn: number;
338
- endLineNumber: number;
339
- endColumn: number;
340
- modelVersionId?: number;
341
- relatedInformation?: IRelatedInformation[];
342
- tags?: MarkerTag[];
343
- }
344
- interface MarkerStatistics {
345
- errors: number;
346
- warnings: number;
347
- infos: number;
348
- unknowns: number;
349
- }
350
- /**
351
- * A structure defining a problem/warning/etc.
352
- */
353
- interface IMarkerData {
354
- code?: string | {
355
- value: string;
356
- target: URI;
357
- };
358
- severity: MarkerSeverity;
359
- message: string;
360
- source?: string;
361
- startLineNumber: number;
362
- startColumn: number;
363
- endLineNumber: number;
364
- endColumn: number;
365
- modelVersionId?: number;
366
- relatedInformation?: IRelatedInformation[];
367
- tags?: MarkerTag[];
368
- }
369
- declare namespace IMarkerData {
370
- function makeKey(markerData: IMarkerData): string;
371
- function makeKeyOptionalMessage(markerData: IMarkerData, useMessage: boolean): string;
372
- }
373
-
374
- interface IMarkerService {
375
- readonly _serviceBrand: undefined;
376
- getStatistics(): MarkerStatistics;
377
- changeOne(owner: string, resource: URI, markers: IMarkerData[]): void;
378
- changeAll(owner: string, data: IResourceMarker[]): void;
379
- remove(owner: string, resources: URI[]): void;
380
- read(filter?: {
381
- owner?: string;
382
- resource?: URI;
383
- severities?: number;
384
- take?: number;
385
- }): IMarker[];
386
- readonly onMarkerChanged: Event<readonly URI[]>;
177
+ unIndentedLinePattern?: RegExp | null;
387
178
  }
388
- declare const IMarkerService: ServiceIdentifier<IMarkerService>;
389
-
390
179
  /**
391
- * @internal
180
+ * Describes language specific folding markers such as '#region' and '#endregion'.
181
+ * The start and end regexes will be tested against the contents of all lines and must be designed efficiently:
182
+ * - the regex should start with '^'
183
+ * - regexp flags (i, g) are ignored
392
184
  */
393
- interface ILanguageIdCodec {
394
- encodeLanguageId(languageId: string): LanguageId;
395
- decodeLanguageId(languageId: LanguageId): string;
185
+ interface FoldingMarkers {
186
+ start: RegExp;
187
+ end: RegExp;
396
188
  }
397
189
  /**
398
- * A provider result represents the values a provider, like the {@link HoverProvider},
399
- * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves
400
- * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a
401
- * thenable.
402
- */
403
- type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
404
- /**
405
- * A hover represents additional information for a symbol or word. Hovers are
406
- * rendered in a tooltip-like widget.
190
+ * Describes folding rules for a language.
407
191
  */
408
- interface Hover {
192
+ interface FoldingRules {
409
193
  /**
410
- * The contents of this hover.
194
+ * Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block.
195
+ * A language adheres to the off-side rule if blocks in that language are expressed by their indentation.
196
+ * See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information.
197
+ * If not set, `false` is used and empty lines belong to the previous block.
411
198
  */
412
- contents: IMarkdownString[];
199
+ offSide?: boolean;
413
200
  /**
414
- * The range to which this hover applies. When missing, the
415
- * editor will use the range at the current position or the
416
- * current position itself.
201
+ * Region markers used by the language.
417
202
  */
418
- range?: IRange;
203
+ markers?: FoldingMarkers;
419
204
  }
420
205
  /**
421
- * The hover provider interface defines the contract between extensions and
422
- * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
206
+ * Describes a rule to be evaluated when pressing Enter.
423
207
  */
424
- interface HoverProvider {
208
+ interface OnEnterRule {
425
209
  /**
426
- * Provide a hover for the given position and document. Multiple hovers at the same
427
- * position will be merged by the editor. A hover can have a range which defaults
428
- * to the word range at the position when omitted.
210
+ * This rule will only execute if the text before the cursor matches this regular expression.
429
211
  */
430
- provideHover(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<Hover>;
431
- }
432
- /**
433
- * An evaluatable expression represents additional information for an expression in a document. Evaluatable expressions are
434
- * evaluated by a debugger or runtime and their result is rendered in a tooltip-like widget.
435
- * @internal
436
- */
437
- interface EvaluatableExpression {
212
+ beforeText: RegExp;
438
213
  /**
439
- * The range to which this expression applies.
214
+ * This rule will only execute if the text after the cursor matches this regular expression.
440
215
  */
441
- range: IRange;
216
+ afterText?: RegExp;
442
217
  /**
443
- * This expression overrides the expression extracted from the range.
218
+ * This rule will only execute if the text above the this line matches this regular expression.
444
219
  */
445
- expression?: string;
446
- }
447
- /**
448
- * The evaluatable expression provider interface defines the contract between extensions and
449
- * the debug hover.
450
- * @internal
451
- */
452
- interface EvaluatableExpressionProvider {
220
+ previousLineText?: RegExp;
453
221
  /**
454
- * Provide a hover for the given position and document. Multiple hovers at the same
455
- * position will be merged by the editor. A hover can have a range which defaults
456
- * to the word range at the position when omitted.
222
+ * The action to execute.
457
223
  */
458
- provideEvaluatableExpression(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<EvaluatableExpression>;
224
+ action: EnterAction;
459
225
  }
460
226
  /**
461
- * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
462
- * @internal
227
+ * Definition of documentation comments (e.g. Javadoc/JSdoc)
463
228
  */
464
- interface InlineValueContext {
465
- frameId: number;
466
- stoppedLocation: Range;
229
+ interface IDocComment {
230
+ /**
231
+ * The string that starts a doc comment (e.g. '/**')
232
+ */
233
+ open: string;
234
+ /**
235
+ * The string that appears on the last line and closes the doc comment (e.g. ' * /').
236
+ */
237
+ close?: string;
467
238
  }
468
239
  /**
469
- * Provide inline value as text.
470
- * @internal
240
+ * A tuple of two characters, like a pair of
241
+ * opening and closing brackets.
471
242
  */
472
- interface InlineValueText {
473
- type: 'text';
474
- range: IRange;
475
- text: string;
243
+ type CharacterPair = [string, string];
244
+ interface IAutoClosingPair {
245
+ open: string;
246
+ close: string;
476
247
  }
477
- /**
478
- * Provide inline value through a variable lookup.
479
- * @internal
480
- */
481
- interface InlineValueVariableLookup {
482
- type: 'variable';
483
- range: IRange;
484
- variableName?: string;
485
- caseSensitiveLookup: boolean;
248
+ interface IAutoClosingPairConditional extends IAutoClosingPair {
249
+ notIn?: string[];
486
250
  }
487
251
  /**
488
- * Provide inline value through an expression evaluation.
489
- * @internal
252
+ * Describes what to do with the indentation when pressing Enter.
490
253
  */
491
- interface InlineValueExpression {
492
- type: 'expression';
493
- range: IRange;
494
- expression?: string;
495
- }
496
- /**
497
- * Inline value information can be provided by different means:
498
- * - directly as a text value (class InlineValueText).
499
- * - as a name to use for a variable lookup (class InlineValueVariableLookup)
500
- * - as an evaluatable expression (class InlineValueEvaluatableExpression)
501
- * The InlineValue types combines all inline value types into one type.
502
- * @internal
503
- */
504
- type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueExpression;
505
- /**
506
- * The inline values provider interface defines the contract between extensions and
507
- * the debugger's inline values feature.
508
- * @internal
509
- */
510
- interface InlineValuesProvider {
254
+ declare enum IndentAction {
511
255
  /**
256
+ * Insert new line and copy the previous line's indentation.
512
257
  */
513
- onDidChangeInlineValues?: Event<void> | undefined;
258
+ None = 0,
514
259
  /**
515
- * Provide the "inline values" for the given range and document. Multiple hovers at the same
516
- * position will be merged by the editor. A hover can have a range which defaults
517
- * to the word range at the position when omitted.
260
+ * Insert new line and indent once (relative to the previous line's indentation).
518
261
  */
519
- provideInlineValues(model: ITextModel, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
520
- }
521
- declare const enum CompletionItemKind {
522
- Method = 0,
523
- Function = 1,
524
- Constructor = 2,
525
- Field = 3,
526
- Variable = 4,
527
- Class = 5,
528
- Struct = 6,
529
- Interface = 7,
530
- Module = 8,
531
- Property = 9,
532
- Event = 10,
533
- Operator = 11,
534
- Unit = 12,
535
- Value = 13,
536
- Constant = 14,
537
- Enum = 15,
538
- EnumMember = 16,
539
- Keyword = 17,
540
- Text = 18,
541
- Color = 19,
542
- File = 20,
543
- Reference = 21,
544
- Customcolor = 22,
545
- Folder = 23,
546
- TypeParameter = 24,
547
- User = 25,
548
- Issue = 26,
549
- Snippet = 27
550
- }
551
- interface CompletionItemLabel {
552
- label: string;
553
- detail?: string;
554
- description?: string;
555
- }
556
- declare const enum CompletionItemTag {
557
- Deprecated = 1
558
- }
559
- declare const enum CompletionItemInsertTextRule {
560
- None = 0,
262
+ Indent = 1,
561
263
  /**
562
- * Adjust whitespace/indentation of multiline insert texts to
563
- * match the current line indentation.
264
+ * Insert two new lines:
265
+ * - the first one indented which will hold the cursor
266
+ * - the second one at the same indentation level
564
267
  */
565
- KeepWhitespace = 1,
268
+ IndentOutdent = 2,
566
269
  /**
567
- * `insertText` is a snippet.
270
+ * Insert new line and outdent once (relative to the previous line's indentation).
568
271
  */
569
- InsertAsSnippet = 4
570
- }
571
- interface CompletionItemRanges {
572
- insert: IRange;
573
- replace: IRange;
272
+ Outdent = 3
574
273
  }
575
274
  /**
576
- * A completion item represents a text snippet that is
577
- * proposed to complete text that is being typed.
275
+ * Describes what to do when pressing Enter.
578
276
  */
579
- interface CompletionItem {
580
- /**
581
- * The label of this completion item. By default
582
- * this is also the text that is inserted when selecting
583
- * this completion.
584
- */
585
- label: string | CompletionItemLabel;
586
- /**
587
- * The kind of this completion item. Based on the kind
588
- * an icon is chosen by the editor.
589
- */
590
- kind: CompletionItemKind;
591
- /**
592
- * A modifier to the `kind` which affect how the item
593
- * is rendered, e.g. Deprecated is rendered with a strikeout
594
- */
595
- tags?: ReadonlyArray<CompletionItemTag>;
596
- /**
597
- * A human-readable string with additional information
598
- * about this item, like type or symbol information.
599
- */
600
- detail?: string;
601
- /**
602
- * A human-readable string that represents a doc-comment.
603
- */
604
- documentation?: string | IMarkdownString;
605
- /**
606
- * A string that should be used when comparing this item
607
- * with other items. When `falsy` the {@link CompletionItem.label label}
608
- * is used.
609
- */
610
- sortText?: string;
611
- /**
612
- * A string that should be used when filtering a set of
613
- * completion items. When `falsy` the {@link CompletionItem.label label}
614
- * is used.
615
- */
616
- filterText?: string;
617
- /**
618
- * Select this item when showing. *Note* that only one completion item can be selected and
619
- * that the editor decides which item that is. The rule is that the *first* item of those
620
- * that match best is selected.
621
- */
622
- preselect?: boolean;
277
+ interface EnterAction {
623
278
  /**
624
- * A string or snippet that should be inserted in a document when selecting
625
- * this completion.
279
+ * Describe what to do with the indentation.
626
280
  */
627
- insertText: string;
281
+ indentAction: IndentAction;
628
282
  /**
629
- * Additional rules (as bitmask) that should be applied when inserting
630
- * this completion.
283
+ * Describes text to be appended after the new line and after the indentation.
631
284
  */
632
- insertTextRules?: CompletionItemInsertTextRule;
285
+ appendText?: string;
633
286
  /**
634
- * A range of text that should be replaced by this completion item.
635
- *
636
- * Defaults to a range from the start of the {@link TextDocument.getWordRangeAtPosition current word} to the
637
- * current position.
638
- *
639
- * *Note:* The range must be a {@link Range.isSingleLine single line} and it must
640
- * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}.
287
+ * Describes the number of characters to remove from the new line's indentation.
641
288
  */
642
- range: IRange | CompletionItemRanges;
289
+ removeText?: number;
290
+ }
291
+ /**
292
+ * @internal
293
+ */
294
+ declare class StandardAutoClosingPairConditional {
295
+ readonly open: string;
296
+ readonly close: string;
297
+ private readonly _inString;
298
+ private readonly _inComment;
299
+ private readonly _inRegEx;
300
+ private _neutralCharacter;
301
+ private _neutralCharacterSearched;
302
+ constructor(source: IAutoClosingPairConditional);
303
+ isOK(standardToken: StandardTokenType): boolean;
304
+ shouldAutoClose(context: ScopedLineTokens, column: number): boolean;
305
+ private _findNeutralCharacterInRange;
643
306
  /**
644
- * An optional set of characters that when pressed while this completion is active will accept it first and
645
- * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
646
- * characters will be ignored.
307
+ * Find a character in the range [0-9a-zA-Z] that does not appear in the open or close
647
308
  */
648
- commitCharacters?: string[];
309
+ findNeutralCharacter(): string | null;
310
+ }
311
+ /**
312
+ * @internal
313
+ */
314
+ declare class AutoClosingPairs {
315
+ /** Key is first character of open */
316
+ readonly autoClosingPairsOpenByStart: Map<string, StandardAutoClosingPairConditional[]>;
317
+ /** Key is last character of open */
318
+ readonly autoClosingPairsOpenByEnd: Map<string, StandardAutoClosingPairConditional[]>;
319
+ /** Key is first character of close */
320
+ readonly autoClosingPairsCloseByStart: Map<string, StandardAutoClosingPairConditional[]>;
321
+ /** Key is last character of close */
322
+ readonly autoClosingPairsCloseByEnd: Map<string, StandardAutoClosingPairConditional[]>;
323
+ /** Key is close. Only has pairs that are a single character */
324
+ readonly autoClosingPairsCloseSingleChar: Map<string, StandardAutoClosingPairConditional[]>;
325
+ constructor(autoClosingPairs: StandardAutoClosingPairConditional[]);
326
+ }
327
+
328
+ /**
329
+ * Captures all bracket related configurations for a single language.
330
+ * Immutable.
331
+ */
332
+ declare class LanguageBracketsConfiguration {
333
+ readonly languageId: string;
334
+ private readonly _openingBrackets;
335
+ private readonly _closingBrackets;
336
+ constructor(languageId: string, config: LanguageConfiguration);
649
337
  /**
650
- * An optional array of additional text edits that are applied when
651
- * selecting this completion. Edits must not overlap with the main edit
652
- * nor with themselves.
653
- */
654
- additionalTextEdits?: ISingleEditOperation[];
338
+ * No two brackets have the same bracket text.
339
+ */
340
+ get openingBrackets(): readonly OpeningBracketKind[];
655
341
  /**
656
- * A command that should be run upon acceptance of this item.
657
- */
658
- command?: Command;
342
+ * No two brackets have the same bracket text.
343
+ */
344
+ get closingBrackets(): readonly ClosingBracketKind[];
345
+ getOpeningBracketInfo(bracketText: string): OpeningBracketKind | undefined;
346
+ getClosingBracketInfo(bracketText: string): ClosingBracketKind | undefined;
347
+ getBracketInfo(bracketText: string): BracketKind | undefined;
348
+ }
349
+ type BracketKind = OpeningBracketKind | ClosingBracketKind;
350
+ declare class BracketKindBase {
351
+ protected readonly config: LanguageBracketsConfiguration;
352
+ readonly bracketText: string;
353
+ constructor(config: LanguageBracketsConfiguration, bracketText: string);
354
+ get languageId(): string;
355
+ }
356
+ declare class OpeningBracketKind extends BracketKindBase {
357
+ readonly openedBrackets: ReadonlySet<ClosingBracketKind>;
358
+ readonly isOpeningBracket = true;
359
+ constructor(config: LanguageBracketsConfiguration, bracketText: string, openedBrackets: ReadonlySet<ClosingBracketKind>);
360
+ }
361
+ declare class ClosingBracketKind extends BracketKindBase {
659
362
  /**
660
- * @internal
661
- */
662
- extensionId?: ExtensionIdentifier;
363
+ * Non empty array of all opening brackets this bracket closes.
364
+ */
365
+ readonly openingBrackets: ReadonlySet<OpeningBracketKind>;
366
+ private readonly openingColorizedBrackets;
367
+ readonly isOpeningBracket = false;
368
+ constructor(config: LanguageBracketsConfiguration, bracketText: string,
663
369
  /**
664
- * @internal
665
- */
666
- _id?: [number, number];
667
- }
668
- interface CompletionList {
669
- suggestions: CompletionItem[];
670
- incomplete?: boolean;
671
- dispose?(): void;
370
+ * Non empty array of all opening brackets this bracket closes.
371
+ */
372
+ openingBrackets: ReadonlySet<OpeningBracketKind>, openingColorizedBrackets: ReadonlySet<OpeningBracketKind>);
672
373
  /**
673
- * @internal
674
- */
675
- duration?: number;
374
+ * Checks if this bracket closes the given other bracket.
375
+ * If the bracket infos come from different configurations, this method will return false.
376
+ */
377
+ closes(other: OpeningBracketKind): boolean;
378
+ closesColorized(other: OpeningBracketKind): boolean;
379
+ getOpeningBrackets(): readonly OpeningBracketKind[];
676
380
  }
677
- /**
678
- * How a suggest provider was triggered.
679
- */
680
- declare const enum CompletionTriggerKind {
681
- Invoke = 0,
682
- TriggerCharacter = 1,
683
- TriggerForIncompleteCompletions = 2
381
+
382
+ declare class CharacterPairSupport {
383
+ static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ";:.,=}])> \n\t";
384
+ static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = "'\"`;:.,=}])> \n\t";
385
+ static readonly DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE = " \n\t";
386
+ private readonly _autoClosingPairs;
387
+ private readonly _surroundingPairs;
388
+ private readonly _autoCloseBeforeForQuotes;
389
+ private readonly _autoCloseBeforeForBrackets;
390
+ constructor(config: LanguageConfiguration);
391
+ getAutoClosingPairs(): StandardAutoClosingPairConditional[];
392
+ getAutoCloseBeforeSet(forQuotes: boolean): string;
393
+ getSurroundingPairs(): IAutoClosingPair[];
684
394
  }
395
+
685
396
  /**
686
- * Contains additional information about the context in which
687
- * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered.
397
+ * Represents a grouping of colliding bracket pairs.
398
+ *
399
+ * Most of the times this contains a single bracket pair,
400
+ * but sometimes this contains multiple bracket pairs in cases
401
+ * where the same string appears as a closing bracket for multiple
402
+ * bracket pairs, or the same string appears an opening bracket for
403
+ * multiple bracket pairs.
404
+ *
405
+ * e.g. of a group containing a single pair:
406
+ * open: ['{'], close: ['}']
407
+ *
408
+ * e.g. of a group containing multiple pairs:
409
+ * open: ['if', 'for'], close: ['end', 'end']
688
410
  */
689
- interface CompletionContext {
411
+ declare class RichEditBracket {
412
+ _richEditBracketBrand: void;
413
+ readonly languageId: string;
690
414
  /**
691
- * How the completion was triggered.
415
+ * A 0-based consecutive unique identifier for this bracket pair.
416
+ * If a language has 5 bracket pairs, out of which 2 are grouped together,
417
+ * it is expected that the `index` goes from 0 to 4.
692
418
  */
693
- triggerKind: CompletionTriggerKind;
419
+ readonly index: number;
694
420
  /**
695
- * Character that triggered the completion item provider.
421
+ * The open sequence for each bracket pair contained in this group.
422
+ *
423
+ * The open sequence at a specific index corresponds to the
424
+ * closing sequence at the same index.
696
425
  *
697
- * `undefined` if provider was not triggered by a character.
426
+ * [ open[i], closed[i] ] represent a bracket pair.
698
427
  */
699
- triggerCharacter?: string;
700
- }
701
- /**
702
- * The completion item provider interface defines the contract between extensions and
703
- * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).
704
- *
705
- * When computing *complete* completion items is expensive, providers can optionally implement
706
- * the `resolveCompletionItem`-function. In that case it is enough to return completion
707
- * items with a {@link CompletionItem.label label} from the
708
- * {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently,
709
- * when a completion item is shown in the UI and gains focus this provider is asked to resolve
710
- * the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}.
711
- */
712
- interface CompletionItemProvider {
428
+ readonly open: string[];
713
429
  /**
714
- * @internal
430
+ * The close sequence for each bracket pair contained in this group.
431
+ *
432
+ * The close sequence at a specific index corresponds to the
433
+ * opening sequence at the same index.
434
+ *
435
+ * [ open[i], closed[i] ] represent a bracket pair.
715
436
  */
716
- _debugDisplayName?: string;
717
- triggerCharacters?: string[];
437
+ readonly close: string[];
718
438
  /**
719
- * Provide completion items for the given position and document.
439
+ * A regular expression that is useful to search for this bracket pair group in a string.
440
+ *
441
+ * This regular expression is built in a way that it is aware of the other bracket
442
+ * pairs defined for the language, so it might match brackets from other groups.
443
+ *
444
+ * See the fine details in `getRegexForBracketPair`.
720
445
  */
721
- provideCompletionItems(model: ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionList>;
446
+ readonly forwardRegex: RegExp;
722
447
  /**
723
- * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment}
724
- * or {@link CompletionItem.detail details}.
448
+ * A regular expression that is useful to search for this bracket pair group in a string backwards.
449
+ *
450
+ * This regular expression is built in a way that it is aware of the other bracket
451
+ * pairs defined for the language, so it might match brackets from other groups.
725
452
  *
726
- * The editor will only resolve a completion item once.
453
+ * See the fine defails in `getReversedRegexForBracketPair`.
727
454
  */
728
- resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
729
- }
730
- /**
731
- * How an {@link InlineCompletionsProvider inline completion provider} was triggered.
732
- */
733
- declare enum InlineCompletionTriggerKind {
455
+ readonly reversedRegex: RegExp;
456
+ private readonly _openSet;
457
+ private readonly _closeSet;
458
+ constructor(languageId: string, index: number, open: string[], close: string[], forwardRegex: RegExp, reversedRegex: RegExp);
734
459
  /**
735
- * Completion was triggered automatically while editing.
736
- * It is sufficient to return a single completion item in this case.
460
+ * Check if the provided `text` is an open bracket in this group.
737
461
  */
738
- Automatic = 0,
462
+ isOpen(text: string): boolean;
739
463
  /**
740
- * Completion was triggered explicitly by a user gesture.
741
- * Return multiple completion items to enable cycling through them.
464
+ * Check if the provided `text` is a close bracket in this group.
742
465
  */
743
- Explicit = 1
466
+ isClose(text: string): boolean;
467
+ private static _toSet;
744
468
  }
745
- interface InlineCompletionContext {
469
+ declare class RichEditBrackets {
470
+ _richEditBracketsBrand: void;
746
471
  /**
747
- * How the completion was triggered.
472
+ * All groups of brackets defined for this language.
748
473
  */
749
- readonly triggerKind: InlineCompletionTriggerKind;
750
- readonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined;
751
- }
752
- declare class SelectedSuggestionInfo {
753
- readonly range: IRange;
754
- readonly text: string;
755
- readonly completionKind: CompletionItemKind;
756
- readonly isSnippetText: boolean;
757
- constructor(range: IRange, text: string, completionKind: CompletionItemKind, isSnippetText: boolean);
758
- equals(other: SelectedSuggestionInfo): boolean;
759
- }
760
- interface InlineCompletion {
474
+ readonly brackets: RichEditBracket[];
761
475
  /**
762
- * The text to insert.
763
- * If the text contains a line break, the range must end at the end of a line.
764
- * If existing text should be replaced, the existing text must be a prefix of the text to insert.
476
+ * A regular expression that is useful to search for all bracket pairs in a string.
765
477
  *
766
- * The text can also be a snippet. In that case, a preview with default parameters is shown.
767
- * When accepting the suggestion, the full snippet is inserted.
768
- */
769
- readonly insertText: string | {
770
- snippet: string;
771
- };
772
- /**
773
- * A text that is used to decide if this inline completion should be shown.
774
- * An inline completion is shown if the text to replace is a subword of the filter text.
478
+ * See the fine details in `getRegexForBrackets`.
775
479
  */
776
- readonly filterText?: string;
480
+ readonly forwardRegex: RegExp;
777
481
  /**
778
- * An optional array of additional text edits that are applied when
779
- * selecting this completion. Edits must not overlap with the main edit
780
- * nor with themselves.
482
+ * A regular expression that is useful to search for all bracket pairs in a string backwards.
483
+ *
484
+ * See the fine details in `getReversedRegexForBrackets`.
781
485
  */
782
- readonly additionalTextEdits?: ISingleEditOperation[];
783
- /**
784
- * The range to replace.
785
- * Must begin and end on the same line.
786
- */
787
- readonly range?: IRange;
788
- readonly command?: Command;
789
- /**
790
- * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
791
- * Defaults to `false`.
792
- */
793
- readonly completeBracketPairs?: boolean;
794
- }
795
- interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
796
- readonly items: readonly TItem[];
486
+ readonly reversedRegex: RegExp;
797
487
  /**
798
- * A list of commands associated with the inline completions of this list.
488
+ * The length (i.e. str.length) for the longest bracket pair.
799
489
  */
800
- readonly commands?: Command[];
801
- readonly suppressSuggestions?: boolean | undefined;
490
+ readonly maxBracketLength: number;
802
491
  /**
803
- * When set and the user types a suggestion without derivating from it, the inline suggestion is not updated.
492
+ * A map useful for decoding a regex match and finding which bracket group was matched.
804
493
  */
805
- readonly enableForwardStability?: boolean | undefined;
806
- }
807
- interface InlineCompletionsProvider<T extends InlineCompletions = InlineCompletions> {
808
- provideInlineCompletions(model: ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<T>;
809
- /**
810
- * Will be called when an item is shown.
811
- * @param updatedInsertText Is useful to understand bracket completion.
812
- */
813
- handleItemDidShow?(completions: T, item: T['items'][number], updatedInsertText: string): void;
494
+ readonly textIsBracket: {
495
+ [text: string]: RichEditBracket;
496
+ };
814
497
  /**
815
- * Will be called when an item is partially accepted.
498
+ * A set useful for decoding if a regex match is the open bracket of a bracket pair.
816
499
  */
817
- handlePartialAccept?(completions: T, item: T['items'][number], acceptedCharacters: number): void;
818
- /**
819
- * Will be called when a completions list is no longer in use and can be garbage-collected.
820
- */
821
- freeInlineCompletions(completions: T): void;
822
- }
823
- interface CodeAction {
824
- title: string;
825
- command?: Command;
826
- edit?: WorkspaceEdit;
827
- diagnostics?: IMarkerData[];
828
- kind?: string;
829
- isPreferred?: boolean;
830
- disabled?: string;
831
- }
832
- declare const enum CodeActionTriggerType {
833
- Invoke = 1,
834
- Auto = 2
500
+ readonly textIsOpenBracket: {
501
+ [text: string]: boolean;
502
+ };
503
+ constructor(languageId: string, _brackets: readonly CharacterPair[]);
835
504
  }
505
+
836
506
  /**
507
+ * Interface used to support electric characters
837
508
  * @internal
838
509
  */
839
- interface CodeActionContext {
840
- only?: string;
841
- trigger: CodeActionTriggerType;
842
- }
843
- interface CodeActionList extends IDisposable {
844
- readonly actions: ReadonlyArray<CodeAction>;
845
- }
846
- /**
847
- * The code action interface defines the contract between extensions and
848
- * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
849
- * @internal
850
- */
851
- interface CodeActionProvider {
852
- displayName?: string;
853
- /**
854
- * Provide commands for the given document and range.
855
- */
856
- provideCodeActions(model: ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult<CodeActionList>;
857
- /**
858
- * Given a code action fill in the edit. Will only invoked when missing.
859
- */
860
- resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;
861
- /**
862
- * Optional list of CodeActionKinds that this provider returns.
863
- */
864
- readonly providedCodeActionKinds?: ReadonlyArray<string>;
865
- readonly documentation?: ReadonlyArray<{
866
- readonly kind: string;
867
- readonly command: Command;
868
- }>;
869
- /**
870
- * @internal
871
- */
872
- _getAdditionalMenuItems?(context: CodeActionContext, actions: readonly CodeAction[]): Command[];
873
- }
874
- /**
875
- * @internal
876
- */
877
- interface DocumentPasteEdit {
878
- readonly id: string;
879
- readonly label: string;
880
- readonly detail: string;
881
- readonly priority: number;
882
- insertText: string | {
883
- readonly snippet: string;
884
- };
885
- additionalEdit?: WorkspaceEdit;
886
- }
887
- /**
888
- * @internal
889
- */
890
- interface DocumentPasteEditProvider {
891
- readonly id?: string;
892
- readonly copyMimeTypes?: readonly string[];
893
- readonly pasteMimeTypes?: readonly string[];
894
- prepareDocumentPaste?(model: ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): Promise<undefined | IReadonlyVSDataTransfer>;
895
- provideDocumentPasteEdits?(model: ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): Promise<DocumentPasteEdit | undefined>;
896
- }
897
- /**
898
- * Represents a parameter of a callable-signature. A parameter can
899
- * have a label and a doc-comment.
900
- */
901
- interface ParameterInformation {
902
- /**
903
- * The label of this signature. Will be shown in
904
- * the UI.
905
- */
906
- label: string | [number, number];
907
- /**
908
- * The human-readable doc-comment of this signature. Will be shown
909
- * in the UI but can be omitted.
910
- */
911
- documentation?: string | IMarkdownString;
912
- }
913
- /**
914
- * Represents the signature of something callable. A signature
915
- * can have a label, like a function-name, a doc-comment, and
916
- * a set of parameters.
917
- */
918
- interface SignatureInformation {
919
- /**
920
- * The label of this signature. Will be shown in
921
- * the UI.
922
- */
923
- label: string;
924
- /**
925
- * The human-readable doc-comment of this signature. Will be shown
926
- * in the UI but can be omitted.
927
- */
928
- documentation?: string | IMarkdownString;
929
- /**
930
- * The parameters of this signature.
931
- */
932
- parameters: ParameterInformation[];
933
- /**
934
- * Index of the active parameter.
935
- *
936
- * If provided, this is used in place of `SignatureHelp.activeSignature`.
937
- */
938
- activeParameter?: number;
939
- }
940
- /**
941
- * Signature help represents the signature of something
942
- * callable. There can be multiple signatures but only one
943
- * active and only one active parameter.
944
- */
945
- interface SignatureHelp {
946
- /**
947
- * One or more signatures.
948
- */
949
- signatures: SignatureInformation[];
950
- /**
951
- * The active signature.
952
- */
953
- activeSignature: number;
954
- /**
955
- * The active parameter of the active signature.
956
- */
957
- activeParameter: number;
958
- }
959
- interface SignatureHelpResult extends IDisposable {
960
- value: SignatureHelp;
961
- }
962
- declare enum SignatureHelpTriggerKind {
963
- Invoke = 1,
964
- TriggerCharacter = 2,
965
- ContentChange = 3
966
- }
967
- interface SignatureHelpContext {
968
- readonly triggerKind: SignatureHelpTriggerKind;
969
- readonly triggerCharacter?: string;
970
- readonly isRetrigger: boolean;
971
- readonly activeSignatureHelp?: SignatureHelp;
972
- }
973
- /**
974
- * The signature help provider interface defines the contract between extensions and
975
- * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
976
- */
977
- interface SignatureHelpProvider {
978
- readonly signatureHelpTriggerCharacters?: ReadonlyArray<string>;
979
- readonly signatureHelpRetriggerCharacters?: ReadonlyArray<string>;
980
- /**
981
- * Provide help for the signature at the given position and document.
982
- */
983
- provideSignatureHelp(model: ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
984
- }
985
- /**
986
- * A document highlight kind.
987
- */
988
- declare enum DocumentHighlightKind {
989
- /**
990
- * A textual occurrence.
991
- */
992
- Text = 0,
993
- /**
994
- * Read-access of a symbol, like reading a variable.
995
- */
996
- Read = 1,
997
- /**
998
- * Write-access of a symbol, like writing to a variable.
999
- */
1000
- Write = 2
1001
- }
1002
- /**
1003
- * A document highlight is a range inside a text document which deserves
1004
- * special attention. Usually a document highlight is visualized by changing
1005
- * the background color of its range.
1006
- */
1007
- interface DocumentHighlight {
1008
- /**
1009
- * The range this highlight applies to.
1010
- */
1011
- range: IRange;
1012
- /**
1013
- * The highlight kind, default is {@link DocumentHighlightKind.Text text}.
1014
- */
1015
- kind?: DocumentHighlightKind;
1016
- }
1017
- /**
1018
- * The document highlight provider interface defines the contract between extensions and
1019
- * the word-highlight-feature.
1020
- */
1021
- interface DocumentHighlightProvider {
1022
- /**
1023
- * Provide a set of document highlights, like all occurrences of a variable or
1024
- * all exit-points of a function.
1025
- */
1026
- provideDocumentHighlights(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
1027
- }
1028
- /**
1029
- * The linked editing range provider interface defines the contract between extensions and
1030
- * the linked editing feature.
1031
- */
1032
- interface LinkedEditingRangeProvider {
1033
- /**
1034
- * Provide a list of ranges that can be edited together.
1035
- */
1036
- provideLinkedEditingRanges(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
1037
- }
1038
- /**
1039
- * Represents a list of ranges that can be edited together along with a word pattern to describe valid contents.
1040
- */
1041
- interface LinkedEditingRanges {
1042
- /**
1043
- * A list of ranges that can be edited together. The ranges must have
1044
- * identical length and text content. The ranges cannot overlap
1045
- */
1046
- ranges: IRange[];
1047
- /**
1048
- * An optional word pattern that describes valid contents for the given ranges.
1049
- * If no pattern is provided, the language configuration's word pattern will be used.
1050
- */
1051
- wordPattern?: RegExp;
1052
- }
1053
- /**
1054
- * Value-object that contains additional information when
1055
- * requesting references.
1056
- */
1057
- interface ReferenceContext {
1058
- /**
1059
- * Include the declaration of the current symbol.
1060
- */
1061
- includeDeclaration: boolean;
1062
- }
1063
- /**
1064
- * The reference provider interface defines the contract between extensions and
1065
- * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
1066
- */
1067
- interface ReferenceProvider {
1068
- /**
1069
- * Provide a set of project-wide references for the given position and document.
1070
- */
1071
- provideReferences(model: ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
1072
- }
1073
- /**
1074
- * Represents a location inside a resource, such as a line
1075
- * inside a text file.
1076
- */
1077
- interface Location {
1078
- /**
1079
- * The resource identifier of this location.
1080
- */
1081
- uri: URI;
1082
- /**
1083
- * The document range of this locations.
1084
- */
1085
- range: IRange;
1086
- }
1087
- interface LocationLink {
1088
- /**
1089
- * A range to select where this link originates from.
1090
- */
1091
- originSelectionRange?: IRange;
1092
- /**
1093
- * The target uri this link points to.
1094
- */
1095
- uri: URI;
1096
- /**
1097
- * The full range this link points to.
1098
- */
1099
- range: IRange;
1100
- /**
1101
- * A range to select this link points to. Must be contained
1102
- * in `LocationLink.range`.
1103
- */
1104
- targetSelectionRange?: IRange;
1105
- }
1106
- type Definition = Location | Location[] | LocationLink[];
1107
- /**
1108
- * The definition provider interface defines the contract between extensions and
1109
- * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
1110
- * and peek definition features.
1111
- */
1112
- interface DefinitionProvider {
1113
- /**
1114
- * Provide the definition of the symbol at the given position and document.
1115
- */
1116
- provideDefinition(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
1117
- }
1118
- /**
1119
- * The definition provider interface defines the contract between extensions and
1120
- * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
1121
- * and peek definition features.
1122
- */
1123
- interface DeclarationProvider {
1124
- /**
1125
- * Provide the declaration of the symbol at the given position and document.
1126
- */
1127
- provideDeclaration(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
1128
- }
1129
- /**
1130
- * The implementation provider interface defines the contract between extensions and
1131
- * the go to implementation feature.
1132
- */
1133
- interface ImplementationProvider {
1134
- /**
1135
- * Provide the implementation of the symbol at the given position and document.
1136
- */
1137
- provideImplementation(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
1138
- }
1139
- /**
1140
- * The type definition provider interface defines the contract between extensions and
1141
- * the go to type definition feature.
1142
- */
1143
- interface TypeDefinitionProvider {
1144
- /**
1145
- * Provide the type definition of the symbol at the given position and document.
1146
- */
1147
- provideTypeDefinition(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
1148
- }
1149
- /**
1150
- * A symbol kind.
1151
- */
1152
- declare const enum SymbolKind {
1153
- File = 0,
1154
- Module = 1,
1155
- Namespace = 2,
1156
- Package = 3,
1157
- Class = 4,
1158
- Method = 5,
1159
- Property = 6,
1160
- Field = 7,
1161
- Constructor = 8,
1162
- Enum = 9,
1163
- Interface = 10,
1164
- Function = 11,
1165
- Variable = 12,
1166
- Constant = 13,
1167
- String = 14,
1168
- Number = 15,
1169
- Boolean = 16,
1170
- Array = 17,
1171
- Object = 18,
1172
- Key = 19,
1173
- Null = 20,
1174
- EnumMember = 21,
1175
- Struct = 22,
1176
- Event = 23,
1177
- Operator = 24,
1178
- TypeParameter = 25
1179
- }
1180
- declare const enum SymbolTag {
1181
- Deprecated = 1
1182
- }
1183
- interface DocumentSymbol {
1184
- name: string;
1185
- detail: string;
1186
- kind: SymbolKind;
1187
- tags: ReadonlyArray<SymbolTag>;
1188
- containerName?: string;
1189
- range: IRange;
1190
- selectionRange: IRange;
1191
- children?: DocumentSymbol[];
1192
- }
1193
- /**
1194
- * The document symbol provider interface defines the contract between extensions and
1195
- * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.
1196
- */
1197
- interface DocumentSymbolProvider {
1198
- displayName?: string;
1199
- /**
1200
- * Provide symbol information for the given document.
1201
- */
1202
- provideDocumentSymbols(model: ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;
1203
- }
1204
- interface TextEdit {
1205
- range: IRange;
1206
- text: string;
1207
- eol?: EndOfLineSequence;
1208
- }
1209
- /**
1210
- * Interface used to format a model
1211
- */
1212
- interface FormattingOptions {
1213
- /**
1214
- * Size of a tab in spaces.
1215
- */
1216
- tabSize: number;
1217
- /**
1218
- * Prefer spaces over tabs.
1219
- */
1220
- insertSpaces: boolean;
1221
- /**
1222
- * The list of multiple ranges to format at once, if the provider supports it.
1223
- */
1224
- ranges?: Range[];
1225
- }
1226
- /**
1227
- * The document formatting provider interface defines the contract between extensions and
1228
- * the formatting-feature.
1229
- */
1230
- interface DocumentFormattingEditProvider {
1231
- /**
1232
- * @internal
1233
- */
1234
- readonly extensionId?: ExtensionIdentifier;
1235
- readonly displayName?: string;
1236
- /**
1237
- * Provide formatting edits for a whole document.
1238
- */
1239
- provideDocumentFormattingEdits(model: ITextModel, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1240
- }
1241
- /**
1242
- * The document formatting provider interface defines the contract between extensions and
1243
- * the formatting-feature.
1244
- */
1245
- interface DocumentRangeFormattingEditProvider {
1246
- /**
1247
- * @internal
1248
- */
1249
- readonly extensionId?: ExtensionIdentifier;
1250
- readonly displayName?: string;
1251
- /**
1252
- * Provide formatting edits for a range in a document.
1253
- *
1254
- * The given range is a hint and providers can decide to format a smaller
1255
- * or larger range. Often this is done by adjusting the start and end
1256
- * of the range to full syntax nodes.
1257
- */
1258
- provideDocumentRangeFormattingEdits(model: ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1259
- provideDocumentRangesFormattingEdits?(model: ITextModel, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1260
- }
1261
- /**
1262
- * The document formatting provider interface defines the contract between extensions and
1263
- * the formatting-feature.
1264
- */
1265
- interface OnTypeFormattingEditProvider {
1266
- /**
1267
- * @internal
1268
- */
1269
- readonly extensionId?: ExtensionIdentifier;
1270
- autoFormatTriggerCharacters: string[];
1271
- /**
1272
- * Provide formatting edits after a character has been typed.
1273
- *
1274
- * The given position and character should hint to the provider
1275
- * what range the position to expand to, like find the matching `{`
1276
- * when `}` has been entered.
1277
- */
1278
- provideOnTypeFormattingEdits(model: ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1279
- }
1280
- /**
1281
- * @internal
1282
- */
1283
- interface IInplaceReplaceSupportResult {
1284
- value: string;
1285
- range: IRange;
1286
- }
1287
- /**
1288
- * A link inside the editor.
1289
- */
1290
- interface ILink {
1291
- range: IRange;
1292
- url?: URI | string;
1293
- tooltip?: string;
1294
- }
1295
- interface ILinksList {
1296
- links: ILink[];
1297
- dispose?(): void;
1298
- }
1299
- /**
1300
- * A provider of links.
1301
- */
1302
- interface LinkProvider {
1303
- provideLinks(model: ITextModel, token: CancellationToken): ProviderResult<ILinksList>;
1304
- resolveLink?: (link: ILink, token: CancellationToken) => ProviderResult<ILink>;
1305
- }
1306
- /**
1307
- * A color in RGBA format.
1308
- */
1309
- interface IColor {
1310
- /**
1311
- * The red component in the range [0-1].
1312
- */
1313
- readonly red: number;
1314
- /**
1315
- * The green component in the range [0-1].
1316
- */
1317
- readonly green: number;
1318
- /**
1319
- * The blue component in the range [0-1].
1320
- */
1321
- readonly blue: number;
1322
- /**
1323
- * The alpha component in the range [0-1].
1324
- */
1325
- readonly alpha: number;
1326
- }
1327
- /**
1328
- * String representations for a color
1329
- */
1330
- interface IColorPresentation {
1331
- /**
1332
- * The label of this color presentation. It will be shown on the color
1333
- * picker header. By default this is also the text that is inserted when selecting
1334
- * this color presentation.
1335
- */
1336
- label: string;
1337
- /**
1338
- * An {@link TextEdit edit} which is applied to a document when selecting
1339
- * this presentation for the color.
1340
- */
1341
- textEdit?: TextEdit;
1342
- /**
1343
- * An optional array of additional {@link TextEdit text edits} that are applied when
1344
- * selecting this color presentation.
1345
- */
1346
- additionalTextEdits?: TextEdit[];
1347
- }
1348
- /**
1349
- * A color range is a range in a text model which represents a color.
1350
- */
1351
- interface IColorInformation {
1352
- /**
1353
- * The range within the model.
1354
- */
1355
- range: IRange;
1356
- /**
1357
- * The color represented in this range.
1358
- */
1359
- color: IColor;
1360
- }
1361
- /**
1362
- * A provider of colors for editor models.
1363
- */
1364
- interface DocumentColorProvider {
1365
- /**
1366
- * Provides the color ranges for a specific model.
1367
- */
1368
- provideDocumentColors(model: ITextModel, token: CancellationToken): ProviderResult<IColorInformation[]>;
1369
- /**
1370
- * Provide the string representations for a color.
1371
- */
1372
- provideColorPresentations(model: ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult<IColorPresentation[]>;
1373
- }
1374
- interface SelectionRange {
1375
- range: IRange;
1376
- }
1377
- interface SelectionRangeProvider {
1378
- /**
1379
- * Provide ranges that should be selected from the given position.
1380
- */
1381
- provideSelectionRanges(model: ITextModel, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[][]>;
1382
- }
1383
- interface FoldingContext {
1384
- }
1385
- /**
1386
- * A provider of folding ranges for editor models.
1387
- */
1388
- interface FoldingRangeProvider {
1389
- /**
1390
- * @internal
1391
- */
1392
- readonly id?: string;
1393
- /**
1394
- * An optional event to signal that the folding ranges from this provider have changed.
1395
- */
1396
- onDidChange?: Event<this>;
1397
- /**
1398
- * Provides the folding ranges for a specific model.
1399
- */
1400
- provideFoldingRanges(model: ITextModel, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
1401
- }
1402
- interface FoldingRange {
1403
- /**
1404
- * The one-based start line of the range to fold. The folded area starts after the line's last character.
1405
- */
1406
- start: number;
1407
- /**
1408
- * The one-based end line of the range to fold. The folded area ends with the line's last character.
1409
- */
1410
- end: number;
1411
- /**
1412
- * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or
1413
- * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands
1414
- * like 'Fold all comments'. See
1415
- * {@link FoldingRangeKind} for an enumeration of standardized kinds.
1416
- */
1417
- kind?: FoldingRangeKind;
1418
- }
1419
- declare class FoldingRangeKind {
1420
- value: string;
1421
- /**
1422
- * Kind for folding range representing a comment. The value of the kind is 'comment'.
1423
- */
1424
- static readonly Comment: FoldingRangeKind;
1425
- /**
1426
- * Kind for folding range representing a import. The value of the kind is 'imports'.
1427
- */
1428
- static readonly Imports: FoldingRangeKind;
1429
- /**
1430
- * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
1431
- * The value of the kind is 'region'.
1432
- */
1433
- static readonly Region: FoldingRangeKind;
1434
- /**
1435
- * Returns a {@link FoldingRangeKind} for the given value.
1436
- *
1437
- * @param value of the kind.
1438
- */
1439
- static fromValue(value: string): FoldingRangeKind;
1440
- /**
1441
- * Creates a new {@link FoldingRangeKind}.
1442
- *
1443
- * @param value of the kind.
1444
- */
1445
- constructor(value: string);
1446
- }
1447
- interface WorkspaceEditMetadata {
1448
- needsConfirmation: boolean;
1449
- label: string;
1450
- description?: string;
1451
- /**
1452
- * @internal
1453
- */
1454
- iconPath?: ThemeIcon | URI | {
1455
- light: URI;
1456
- dark: URI;
1457
- };
1458
- }
1459
- interface WorkspaceFileEditOptions {
1460
- overwrite?: boolean;
1461
- ignoreIfNotExists?: boolean;
1462
- ignoreIfExists?: boolean;
1463
- recursive?: boolean;
1464
- copy?: boolean;
1465
- folder?: boolean;
1466
- skipTrashBin?: boolean;
1467
- maxSize?: number;
1468
- /**
1469
- * @internal
1470
- */
1471
- contents?: Promise<VSBuffer>;
1472
- }
1473
- interface IWorkspaceFileEdit {
1474
- oldResource?: URI;
1475
- newResource?: URI;
1476
- options?: WorkspaceFileEditOptions;
1477
- metadata?: WorkspaceEditMetadata;
1478
- }
1479
- interface IWorkspaceTextEdit {
1480
- resource: URI;
1481
- textEdit: TextEdit & {
1482
- insertAsSnippet?: boolean;
1483
- };
1484
- versionId: number | undefined;
1485
- metadata?: WorkspaceEditMetadata;
1486
- }
1487
- interface WorkspaceEdit {
1488
- edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit>;
1489
- }
1490
- interface Rejection {
1491
- rejectReason?: string;
1492
- }
1493
- interface RenameLocation {
1494
- range: IRange;
1495
- text: string;
1496
- }
1497
- interface RenameProvider {
1498
- provideRenameEdits(model: ITextModel, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit & Rejection>;
1499
- resolveRenameLocation?(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<RenameLocation & Rejection>;
1500
- }
1501
- interface Command {
1502
- id: string;
1503
- title: string;
1504
- tooltip?: string;
1505
- arguments?: any[];
1506
- }
1507
- /**
1508
- * @internal
1509
- */
1510
- declare namespace Command {
1511
- /**
1512
- * @internal
1513
- */
1514
- function is(obj: any): obj is Command;
1515
- }
1516
- interface CodeLens {
1517
- range: IRange;
1518
- id?: string;
1519
- command?: Command;
1520
- }
1521
- interface CodeLensList {
1522
- lenses: CodeLens[];
1523
- dispose(): void;
1524
- }
1525
- interface CodeLensProvider {
1526
- onDidChange?: Event<this>;
1527
- provideCodeLenses(model: ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
1528
- resolveCodeLens?(model: ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
1529
- }
1530
- declare enum InlayHintKind {
1531
- Type = 1,
1532
- Parameter = 2
1533
- }
1534
- interface InlayHintLabelPart {
1535
- label: string;
1536
- tooltip?: string | IMarkdownString;
1537
- command?: Command;
1538
- location?: Location;
1539
- }
1540
- interface InlayHint {
1541
- label: string | InlayHintLabelPart[];
1542
- tooltip?: string | IMarkdownString;
1543
- textEdits?: TextEdit[];
1544
- position: IPosition;
1545
- kind?: InlayHintKind;
1546
- paddingLeft?: boolean;
1547
- paddingRight?: boolean;
1548
- }
1549
- interface InlayHintList {
1550
- hints: InlayHint[];
1551
- dispose(): void;
1552
- }
1553
- interface InlayHintsProvider {
1554
- displayName?: string;
1555
- onDidChangeInlayHints?: Event<void>;
1556
- provideInlayHints(model: ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;
1557
- resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;
1558
- }
1559
- interface SemanticTokensLegend {
1560
- readonly tokenTypes: string[];
1561
- readonly tokenModifiers: string[];
1562
- }
1563
- interface SemanticTokens {
1564
- readonly resultId?: string;
1565
- readonly data: Uint32Array;
1566
- }
1567
- interface SemanticTokensEdit {
1568
- readonly start: number;
1569
- readonly deleteCount: number;
1570
- readonly data?: Uint32Array;
1571
- }
1572
- interface SemanticTokensEdits {
1573
- readonly resultId?: string;
1574
- readonly edits: SemanticTokensEdit[];
1575
- }
1576
- interface DocumentSemanticTokensProvider {
1577
- onDidChange?: Event<void>;
1578
- getLegend(): SemanticTokensLegend;
1579
- provideDocumentSemanticTokens(model: ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
1580
- releaseDocumentSemanticTokens(resultId: string | undefined): void;
1581
- }
1582
- interface DocumentRangeSemanticTokensProvider {
1583
- getLegend(): SemanticTokensLegend;
1584
- provideDocumentRangeSemanticTokens(model: ITextModel, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
1585
- }
1586
- /**
1587
- * @internal
1588
- */
1589
- interface DocumentOnDropEdit {
1590
- readonly id: string;
1591
- readonly label: string;
1592
- readonly priority: number;
1593
- insertText: string | {
1594
- readonly snippet: string;
1595
- };
1596
- additionalEdit?: WorkspaceEdit;
1597
- }
1598
- /**
1599
- * @internal
1600
- */
1601
- interface DocumentOnDropEditProvider {
1602
- readonly dropMimeTypes?: readonly string[];
1603
- provideDocumentOnDropEdits(model: ITextModel, position: IPosition, dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): ProviderResult<DocumentOnDropEdit>;
1604
- }
1605
-
1606
- interface IViewLineTokens {
1607
- equals(other: IViewLineTokens): boolean;
1608
- getCount(): number;
1609
- getForeground(tokenIndex: number): ColorId;
1610
- getEndOffset(tokenIndex: number): number;
1611
- getClassName(tokenIndex: number): string;
1612
- getInlineStyle(tokenIndex: number, colorMap: string[]): string;
1613
- getPresentation(tokenIndex: number): ITokenPresentation;
1614
- findTokenIndexAtOffset(offset: number): number;
1615
- getLineContent(): string;
1616
- getMetadata(tokenIndex: number): number;
1617
- getLanguageId(tokenIndex: number): string;
1618
- }
1619
- declare class LineTokens implements IViewLineTokens {
1620
- _lineTokensBrand: void;
1621
- private readonly _tokens;
1622
- private readonly _tokensCount;
1623
- private readonly _text;
1624
- private readonly _languageIdCodec;
1625
- static defaultTokenMetadata: number;
1626
- static createEmpty(lineContent: string, decoder: ILanguageIdCodec): LineTokens;
1627
- constructor(tokens: Uint32Array, text: string, decoder: ILanguageIdCodec);
1628
- equals(other: IViewLineTokens): boolean;
1629
- slicedEquals(other: LineTokens, sliceFromTokenIndex: number, sliceTokenCount: number): boolean;
1630
- getLineContent(): string;
1631
- getCount(): number;
1632
- getStartOffset(tokenIndex: number): number;
1633
- getMetadata(tokenIndex: number): number;
1634
- getLanguageId(tokenIndex: number): string;
1635
- getStandardTokenType(tokenIndex: number): StandardTokenType;
1636
- getForeground(tokenIndex: number): ColorId;
1637
- getClassName(tokenIndex: number): string;
1638
- getInlineStyle(tokenIndex: number, colorMap: string[]): string;
1639
- getPresentation(tokenIndex: number): ITokenPresentation;
1640
- getEndOffset(tokenIndex: number): number;
1641
- /**
1642
- * Find the token containing offset `offset`.
1643
- * @param offset The search offset
1644
- * @return The index of the token containing the offset.
1645
- */
1646
- findTokenIndexAtOffset(offset: number): number;
1647
- inflate(): IViewLineTokens;
1648
- sliceAndInflate(startOffset: number, endOffset: number, deltaOffset: number): IViewLineTokens;
1649
- static convertToEndOffset(tokens: Uint32Array, lineTextLength: number): void;
1650
- static findIndexInTokensArray(tokens: Uint32Array, desiredIndex: number): number;
1651
- /**
1652
- * @pure
1653
- * @param insertTokens Must be sorted by offset.
1654
- */
1655
- withInserted(insertTokens: {
1656
- offset: number;
1657
- text: string;
1658
- tokenMetadata: number;
1659
- }[]): LineTokens;
1660
- }
1661
-
1662
- declare class ScopedLineTokens {
1663
- _scopedLineTokensBrand: void;
1664
- readonly languageId: string;
1665
- private readonly _actual;
1666
- private readonly _firstTokenIndex;
1667
- private readonly _lastTokenIndex;
1668
- readonly firstCharOffset: number;
1669
- private readonly _lastCharOffset;
1670
- constructor(actual: LineTokens, languageId: string, firstTokenIndex: number, lastTokenIndex: number, firstCharOffset: number, lastCharOffset: number);
1671
- getLineContent(): string;
1672
- getActualLineContentBefore(offset: number): string;
1673
- getTokenCount(): number;
1674
- findTokenIndexAtOffset(offset: number): number;
1675
- getStandardTokenType(tokenIndex: number): StandardTokenType;
1676
- }
1677
-
1678
- /**
1679
- * Describes how comments for a language work.
1680
- */
1681
- interface CommentRule {
1682
- /**
1683
- * The line comment token, like `// this is a comment`
1684
- */
1685
- lineComment?: string | null;
1686
- /**
1687
- * The block comment character pair, like `/* block comment *&#47;`
1688
- */
1689
- blockComment?: CharacterPair | null;
1690
- }
1691
- /**
1692
- * The language configuration interface defines the contract between extensions and
1693
- * various editor features, like automatic bracket insertion, automatic indentation etc.
1694
- */
1695
- interface LanguageConfiguration {
1696
- /**
1697
- * The language's comment settings.
1698
- */
1699
- comments?: CommentRule;
1700
- /**
1701
- * The language's brackets.
1702
- * This configuration implicitly affects pressing Enter around these brackets.
1703
- */
1704
- brackets?: CharacterPair[];
1705
- /**
1706
- * The language's word definition.
1707
- * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
1708
- * to provide a word definition that uses exclusion of known separators.
1709
- * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
1710
- * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
1711
- */
1712
- wordPattern?: RegExp;
1713
- /**
1714
- * The language's indentation settings.
1715
- */
1716
- indentationRules?: IndentationRule;
1717
- /**
1718
- * The language's rules to be evaluated when pressing Enter.
1719
- */
1720
- onEnterRules?: OnEnterRule[];
1721
- /**
1722
- * The language's auto closing pairs. The 'close' character is automatically inserted with the
1723
- * 'open' character is typed. If not set, the configured brackets will be used.
1724
- */
1725
- autoClosingPairs?: IAutoClosingPairConditional[];
1726
- /**
1727
- * The language's surrounding pairs. When the 'open' character is typed on a selection, the
1728
- * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
1729
- * settings will be used.
1730
- */
1731
- surroundingPairs?: IAutoClosingPair[];
1732
- /**
1733
- * Defines a list of bracket pairs that are colorized depending on their nesting level.
1734
- * If not set, the configured brackets will be used.
1735
- */
1736
- colorizedBracketPairs?: CharacterPair[];
1737
- /**
1738
- * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting.
1739
- *
1740
- * This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc.
1741
- */
1742
- autoCloseBefore?: string;
1743
- /**
1744
- * The language's folding rules.
1745
- */
1746
- folding?: FoldingRules;
1747
- /**
1748
- * **Deprecated** Do not use.
1749
- *
1750
- * @deprecated Will be replaced by a better API soon.
1751
- */
1752
- __electricCharacterSupport?: {
1753
- docComment?: IDocComment;
1754
- };
1755
- }
1756
- /**
1757
- * Describes indentation rules for a language.
1758
- */
1759
- interface IndentationRule {
1760
- /**
1761
- * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
1762
- */
1763
- decreaseIndentPattern: RegExp;
1764
- /**
1765
- * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
1766
- */
1767
- increaseIndentPattern: RegExp;
1768
- /**
1769
- * If a line matches this pattern, then **only the next line** after it should be indented once.
1770
- */
1771
- indentNextLinePattern?: RegExp | null;
1772
- /**
1773
- * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
1774
- */
1775
- unIndentedLinePattern?: RegExp | null;
1776
- }
1777
- /**
1778
- * Describes language specific folding markers such as '#region' and '#endregion'.
1779
- * The start and end regexes will be tested against the contents of all lines and must be designed efficiently:
1780
- * - the regex should start with '^'
1781
- * - regexp flags (i, g) are ignored
1782
- */
1783
- interface FoldingMarkers {
1784
- start: RegExp;
1785
- end: RegExp;
1786
- }
1787
- /**
1788
- * Describes folding rules for a language.
1789
- */
1790
- interface FoldingRules {
1791
- /**
1792
- * Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block.
1793
- * A language adheres to the off-side rule if blocks in that language are expressed by their indentation.
1794
- * See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information.
1795
- * If not set, `false` is used and empty lines belong to the previous block.
1796
- */
1797
- offSide?: boolean;
1798
- /**
1799
- * Region markers used by the language.
1800
- */
1801
- markers?: FoldingMarkers;
1802
- }
1803
- /**
1804
- * Describes a rule to be evaluated when pressing Enter.
1805
- */
1806
- interface OnEnterRule {
1807
- /**
1808
- * This rule will only execute if the text before the cursor matches this regular expression.
1809
- */
1810
- beforeText: RegExp;
1811
- /**
1812
- * This rule will only execute if the text after the cursor matches this regular expression.
1813
- */
1814
- afterText?: RegExp;
1815
- /**
1816
- * This rule will only execute if the text above the this line matches this regular expression.
1817
- */
1818
- previousLineText?: RegExp;
1819
- /**
1820
- * The action to execute.
1821
- */
1822
- action: EnterAction;
1823
- }
1824
- /**
1825
- * Definition of documentation comments (e.g. Javadoc/JSdoc)
1826
- */
1827
- interface IDocComment {
1828
- /**
1829
- * The string that starts a doc comment (e.g. '/**')
1830
- */
1831
- open: string;
1832
- /**
1833
- * The string that appears on the last line and closes the doc comment (e.g. ' * /').
1834
- */
1835
- close?: string;
1836
- }
1837
- /**
1838
- * A tuple of two characters, like a pair of
1839
- * opening and closing brackets.
1840
- */
1841
- type CharacterPair = [string, string];
1842
- interface IAutoClosingPair {
1843
- open: string;
1844
- close: string;
1845
- }
1846
- interface IAutoClosingPairConditional extends IAutoClosingPair {
1847
- notIn?: string[];
1848
- }
1849
- /**
1850
- * Describes what to do with the indentation when pressing Enter.
1851
- */
1852
- declare enum IndentAction {
1853
- /**
1854
- * Insert new line and copy the previous line's indentation.
1855
- */
1856
- None = 0,
1857
- /**
1858
- * Insert new line and indent once (relative to the previous line's indentation).
1859
- */
1860
- Indent = 1,
1861
- /**
1862
- * Insert two new lines:
1863
- * - the first one indented which will hold the cursor
1864
- * - the second one at the same indentation level
1865
- */
1866
- IndentOutdent = 2,
1867
- /**
1868
- * Insert new line and outdent once (relative to the previous line's indentation).
1869
- */
1870
- Outdent = 3
1871
- }
1872
- /**
1873
- * Describes what to do when pressing Enter.
1874
- */
1875
- interface EnterAction {
1876
- /**
1877
- * Describe what to do with the indentation.
1878
- */
1879
- indentAction: IndentAction;
1880
- /**
1881
- * Describes text to be appended after the new line and after the indentation.
1882
- */
1883
- appendText?: string;
1884
- /**
1885
- * Describes the number of characters to remove from the new line's indentation.
1886
- */
1887
- removeText?: number;
1888
- }
1889
- /**
1890
- * @internal
1891
- */
1892
- declare class StandardAutoClosingPairConditional {
1893
- readonly open: string;
1894
- readonly close: string;
1895
- private readonly _inString;
1896
- private readonly _inComment;
1897
- private readonly _inRegEx;
1898
- private _neutralCharacter;
1899
- private _neutralCharacterSearched;
1900
- constructor(source: IAutoClosingPairConditional);
1901
- isOK(standardToken: StandardTokenType): boolean;
1902
- shouldAutoClose(context: ScopedLineTokens, column: number): boolean;
1903
- private _findNeutralCharacterInRange;
1904
- /**
1905
- * Find a character in the range [0-9a-zA-Z] that does not appear in the open or close
1906
- */
1907
- findNeutralCharacter(): string | null;
1908
- }
1909
- /**
1910
- * @internal
1911
- */
1912
- declare class AutoClosingPairs {
1913
- /** Key is first character of open */
1914
- readonly autoClosingPairsOpenByStart: Map<string, StandardAutoClosingPairConditional[]>;
1915
- /** Key is last character of open */
1916
- readonly autoClosingPairsOpenByEnd: Map<string, StandardAutoClosingPairConditional[]>;
1917
- /** Key is first character of close */
1918
- readonly autoClosingPairsCloseByStart: Map<string, StandardAutoClosingPairConditional[]>;
1919
- /** Key is last character of close */
1920
- readonly autoClosingPairsCloseByEnd: Map<string, StandardAutoClosingPairConditional[]>;
1921
- /** Key is close. Only has pairs that are a single character */
1922
- readonly autoClosingPairsCloseSingleChar: Map<string, StandardAutoClosingPairConditional[]>;
1923
- constructor(autoClosingPairs: StandardAutoClosingPairConditional[]);
1924
- }
1925
-
1926
- /**
1927
- * Captures all bracket related configurations for a single language.
1928
- * Immutable.
1929
- */
1930
- declare class LanguageBracketsConfiguration {
1931
- readonly languageId: string;
1932
- private readonly _openingBrackets;
1933
- private readonly _closingBrackets;
1934
- constructor(languageId: string, config: LanguageConfiguration);
1935
- /**
1936
- * No two brackets have the same bracket text.
1937
- */
1938
- get openingBrackets(): readonly OpeningBracketKind[];
1939
- /**
1940
- * No two brackets have the same bracket text.
1941
- */
1942
- get closingBrackets(): readonly ClosingBracketKind[];
1943
- getOpeningBracketInfo(bracketText: string): OpeningBracketKind | undefined;
1944
- getClosingBracketInfo(bracketText: string): ClosingBracketKind | undefined;
1945
- getBracketInfo(bracketText: string): BracketKind | undefined;
1946
- }
1947
- type BracketKind = OpeningBracketKind | ClosingBracketKind;
1948
- declare class BracketKindBase {
1949
- protected readonly config: LanguageBracketsConfiguration;
1950
- readonly bracketText: string;
1951
- constructor(config: LanguageBracketsConfiguration, bracketText: string);
1952
- get languageId(): string;
1953
- }
1954
- declare class OpeningBracketKind extends BracketKindBase {
1955
- readonly openedBrackets: ReadonlySet<ClosingBracketKind>;
1956
- readonly isOpeningBracket = true;
1957
- constructor(config: LanguageBracketsConfiguration, bracketText: string, openedBrackets: ReadonlySet<ClosingBracketKind>);
1958
- }
1959
- declare class ClosingBracketKind extends BracketKindBase {
1960
- /**
1961
- * Non empty array of all opening brackets this bracket closes.
1962
- */
1963
- readonly openingBrackets: ReadonlySet<OpeningBracketKind>;
1964
- private readonly openingColorizedBrackets;
1965
- readonly isOpeningBracket = false;
1966
- constructor(config: LanguageBracketsConfiguration, bracketText: string,
1967
- /**
1968
- * Non empty array of all opening brackets this bracket closes.
1969
- */
1970
- openingBrackets: ReadonlySet<OpeningBracketKind>, openingColorizedBrackets: ReadonlySet<OpeningBracketKind>);
1971
- /**
1972
- * Checks if this bracket closes the given other bracket.
1973
- * If the bracket infos come from different configurations, this method will return false.
1974
- */
1975
- closes(other: OpeningBracketKind): boolean;
1976
- closesColorized(other: OpeningBracketKind): boolean;
1977
- getOpeningBrackets(): readonly OpeningBracketKind[];
1978
- }
1979
-
1980
- declare class CharacterPairSupport {
1981
- static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ";:.,=}])> \n\t";
1982
- static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = "'\"`;:.,=}])> \n\t";
1983
- static readonly DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE = " \n\t";
1984
- private readonly _autoClosingPairs;
1985
- private readonly _surroundingPairs;
1986
- private readonly _autoCloseBeforeForQuotes;
1987
- private readonly _autoCloseBeforeForBrackets;
1988
- constructor(config: LanguageConfiguration);
1989
- getAutoClosingPairs(): StandardAutoClosingPairConditional[];
1990
- getAutoCloseBeforeSet(forQuotes: boolean): string;
1991
- getSurroundingPairs(): IAutoClosingPair[];
1992
- }
1993
-
1994
- /**
1995
- * Represents a grouping of colliding bracket pairs.
1996
- *
1997
- * Most of the times this contains a single bracket pair,
1998
- * but sometimes this contains multiple bracket pairs in cases
1999
- * where the same string appears as a closing bracket for multiple
2000
- * bracket pairs, or the same string appears an opening bracket for
2001
- * multiple bracket pairs.
2002
- *
2003
- * e.g. of a group containing a single pair:
2004
- * open: ['{'], close: ['}']
2005
- *
2006
- * e.g. of a group containing multiple pairs:
2007
- * open: ['if', 'for'], close: ['end', 'end']
2008
- */
2009
- declare class RichEditBracket {
2010
- _richEditBracketBrand: void;
2011
- readonly languageId: string;
2012
- /**
2013
- * A 0-based consecutive unique identifier for this bracket pair.
2014
- * If a language has 5 bracket pairs, out of which 2 are grouped together,
2015
- * it is expected that the `index` goes from 0 to 4.
2016
- */
2017
- readonly index: number;
2018
- /**
2019
- * The open sequence for each bracket pair contained in this group.
2020
- *
2021
- * The open sequence at a specific index corresponds to the
2022
- * closing sequence at the same index.
2023
- *
2024
- * [ open[i], closed[i] ] represent a bracket pair.
2025
- */
2026
- readonly open: string[];
2027
- /**
2028
- * The close sequence for each bracket pair contained in this group.
2029
- *
2030
- * The close sequence at a specific index corresponds to the
2031
- * opening sequence at the same index.
2032
- *
2033
- * [ open[i], closed[i] ] represent a bracket pair.
2034
- */
2035
- readonly close: string[];
2036
- /**
2037
- * A regular expression that is useful to search for this bracket pair group in a string.
2038
- *
2039
- * This regular expression is built in a way that it is aware of the other bracket
2040
- * pairs defined for the language, so it might match brackets from other groups.
2041
- *
2042
- * See the fine details in `getRegexForBracketPair`.
2043
- */
2044
- readonly forwardRegex: RegExp;
2045
- /**
2046
- * A regular expression that is useful to search for this bracket pair group in a string backwards.
2047
- *
2048
- * This regular expression is built in a way that it is aware of the other bracket
2049
- * pairs defined for the language, so it might match brackets from other groups.
2050
- *
2051
- * See the fine defails in `getReversedRegexForBracketPair`.
2052
- */
2053
- readonly reversedRegex: RegExp;
2054
- private readonly _openSet;
2055
- private readonly _closeSet;
2056
- constructor(languageId: string, index: number, open: string[], close: string[], forwardRegex: RegExp, reversedRegex: RegExp);
2057
- /**
2058
- * Check if the provided `text` is an open bracket in this group.
2059
- */
2060
- isOpen(text: string): boolean;
2061
- /**
2062
- * Check if the provided `text` is a close bracket in this group.
2063
- */
2064
- isClose(text: string): boolean;
2065
- private static _toSet;
2066
- }
2067
- declare class RichEditBrackets {
2068
- _richEditBracketsBrand: void;
2069
- /**
2070
- * All groups of brackets defined for this language.
2071
- */
2072
- readonly brackets: RichEditBracket[];
2073
- /**
2074
- * A regular expression that is useful to search for all bracket pairs in a string.
2075
- *
2076
- * See the fine details in `getRegexForBrackets`.
2077
- */
2078
- readonly forwardRegex: RegExp;
2079
- /**
2080
- * A regular expression that is useful to search for all bracket pairs in a string backwards.
2081
- *
2082
- * See the fine details in `getReversedRegexForBrackets`.
2083
- */
2084
- readonly reversedRegex: RegExp;
2085
- /**
2086
- * The length (i.e. str.length) for the longest bracket pair.
2087
- */
2088
- readonly maxBracketLength: number;
2089
- /**
2090
- * A map useful for decoding a regex match and finding which bracket group was matched.
2091
- */
2092
- readonly textIsBracket: {
2093
- [text: string]: RichEditBracket;
2094
- };
2095
- /**
2096
- * A set useful for decoding if a regex match is the open bracket of a bracket pair.
2097
- */
2098
- readonly textIsOpenBracket: {
2099
- [text: string]: boolean;
2100
- };
2101
- constructor(languageId: string, _brackets: readonly CharacterPair[]);
2102
- }
2103
-
2104
- /**
2105
- * Interface used to support electric characters
2106
- * @internal
2107
- */
2108
- interface IElectricAction {
2109
- matchOpenBracket: string;
2110
- }
2111
- declare class BracketElectricCharacterSupport {
2112
- private readonly _richEditBrackets;
2113
- constructor(richEditBrackets: RichEditBrackets | null);
2114
- getElectricCharacters(): string[];
2115
- onElectricCharacter(character: string, context: ScopedLineTokens, column: number): IElectricAction | null;
2116
- }
2117
-
2118
- declare class IndentRulesSupport {
2119
- private readonly _indentationRules;
2120
- constructor(indentationRules: IndentationRule);
2121
- shouldIncrease(text: string): boolean;
2122
- shouldDecrease(text: string): boolean;
2123
- shouldIndentNextLine(text: string): boolean;
2124
- shouldIgnore(text: string): boolean;
2125
- getIndentMetadata(text: string): number;
2126
- }
2127
-
2128
- /**
2129
- * Interface used to support insertion of mode specific comments.
2130
- */
2131
- interface ICommentsConfiguration {
2132
- lineCommentToken?: string;
2133
- blockCommentStartToken?: string;
2134
- blockCommentEndToken?: string;
2135
- }
2136
- declare class LanguageConfigurationServiceChangeEvent {
2137
- readonly languageId: string | undefined;
2138
- constructor(languageId: string | undefined);
2139
- affects(languageId: string): boolean;
2140
- }
2141
- interface ILanguageConfigurationService {
2142
- readonly _serviceBrand: undefined;
2143
- onDidChange: Event<LanguageConfigurationServiceChangeEvent>;
2144
- /**
2145
- * @param priority Use a higher number for higher priority
2146
- */
2147
- register(languageId: string, configuration: LanguageConfiguration, priority?: number): IDisposable;
2148
- getLanguageConfiguration(languageId: string): ResolvedLanguageConfiguration;
2149
- }
2150
- declare const ILanguageConfigurationService: ServiceIdentifier<ILanguageConfigurationService>;
2151
- /**
2152
- * Immutable.
2153
- */
2154
- declare class ResolvedLanguageConfiguration {
2155
- readonly languageId: string;
2156
- readonly underlyingConfig: LanguageConfiguration;
2157
- private _brackets;
2158
- private _electricCharacter;
2159
- private readonly _onEnterSupport;
2160
- readonly comments: ICommentsConfiguration | null;
2161
- readonly characterPair: CharacterPairSupport;
2162
- readonly wordDefinition: RegExp;
2163
- readonly indentRulesSupport: IndentRulesSupport | null;
2164
- readonly indentationRules: IndentationRule | undefined;
2165
- readonly foldingRules: FoldingRules;
2166
- readonly bracketsNew: LanguageBracketsConfiguration;
2167
- constructor(languageId: string, underlyingConfig: LanguageConfiguration);
2168
- getWordDefinition(): RegExp;
2169
- get brackets(): RichEditBrackets | null;
2170
- get electricCharacter(): BracketElectricCharacterSupport | null;
2171
- onEnter(autoIndent: EditorAutoIndentStrategy, previousLineText: string, beforeEnterText: string, afterEnterText: string): EnterAction | null;
2172
- getAutoClosingPairs(): AutoClosingPairs;
2173
- getAutoCloseBeforeSet(forQuotes: boolean): string;
2174
- getSurroundingPairs(): IAutoClosingPair[];
2175
- private static _handleComments;
2176
- }
2177
-
2178
- interface IAction {
2179
- readonly id: string;
2180
- label: string;
2181
- tooltip: string;
2182
- class: string | undefined;
2183
- enabled: boolean;
2184
- checked?: boolean;
2185
- run(...args: unknown[]): unknown;
2186
- }
2187
- interface IActionRunner extends IDisposable {
2188
- readonly onDidRun: Event<IRunEvent>;
2189
- readonly onWillRun: Event<IRunEvent>;
2190
- run(action: IAction, context?: unknown): unknown;
2191
- }
2192
- interface IRunEvent {
2193
- readonly action: IAction;
2194
- readonly error?: Error;
2195
- }
2196
- declare class SubmenuAction implements IAction {
2197
- readonly id: string;
2198
- readonly label: string;
2199
- readonly class: string | undefined;
2200
- readonly tooltip: string;
2201
- readonly enabled: boolean;
2202
- readonly checked: undefined;
2203
- private readonly _actions;
2204
- get actions(): readonly IAction[];
2205
- constructor(id: string, label: string, actions: readonly IAction[], cssClass?: string);
2206
- run(): Promise<void>;
2207
- }
2208
-
2209
- type Severity = Severity$1;
2210
- type NotificationMessage = string | Error;
2211
- declare enum NotificationPriority {
2212
- /**
2213
- * Default priority: notification will be visible unless do not disturb mode is enabled.
2214
- */
2215
- DEFAULT = 0,
2216
- /**
2217
- * Silent priority: notification will only be visible from the notifications center.
2218
- */
2219
- SILENT = 1,
2220
- /**
2221
- * Urgent priority: notification will be visible even when do not disturb mode is enabled.
2222
- */
2223
- URGENT = 2
2224
- }
2225
- interface INotificationProperties {
2226
- /**
2227
- * Sticky notifications are not automatically removed after a certain timeout.
2228
- *
2229
- * Currently, only 2 kinds of notifications are sticky:
2230
- * - Error notifications with primary actions
2231
- * - Notifications that show progress
2232
- */
2233
- readonly sticky?: boolean;
2234
- /**
2235
- * Allows to override the priority of the notification based on needs.
2236
- */
2237
- readonly priority?: NotificationPriority;
2238
- /**
2239
- * Adds an action to never show the notification again. The choice will be persisted
2240
- * such as future requests will not cause the notification to show again.
2241
- */
2242
- readonly neverShowAgain?: INeverShowAgainOptions;
2243
- }
2244
- declare enum NeverShowAgainScope {
2245
- /**
2246
- * Will never show this notification on the current workspace again.
2247
- */
2248
- WORKSPACE = 0,
2249
- /**
2250
- * Will never show this notification on any workspace of the same
2251
- * profile again.
2252
- */
2253
- PROFILE = 1,
2254
- /**
2255
- * Will never show this notification on any workspace across all
2256
- * profiles again.
2257
- */
2258
- APPLICATION = 2
2259
- }
2260
- interface INeverShowAgainOptions {
2261
- /**
2262
- * The id is used to persist the selection of not showing the notification again.
2263
- */
2264
- readonly id: string;
2265
- /**
2266
- * By default the action will show up as primary action. Setting this to true will
2267
- * make it a secondary action instead.
2268
- */
2269
- readonly isSecondary?: boolean;
2270
- /**
2271
- * Whether to persist the choice in the current workspace or for all workspaces. By
2272
- * default it will be persisted for all workspaces across all profiles
2273
- * (= `NeverShowAgainScope.APPLICATION`).
2274
- */
2275
- readonly scope?: NeverShowAgainScope;
2276
- }
2277
- interface INotification extends INotificationProperties {
2278
- /**
2279
- * The id of the notification. If provided, will be used to compare
2280
- * notifications with others to decide whether a notification is
2281
- * duplicate or not.
2282
- */
2283
- readonly id?: string;
2284
- /**
2285
- * The severity of the notification. Either `Info`, `Warning` or `Error`.
2286
- */
2287
- readonly severity: Severity;
2288
- /**
2289
- * The message of the notification. This can either be a `string` or `Error`. Messages
2290
- * can optionally include links in the format: `[text](link)`
2291
- */
2292
- readonly message: NotificationMessage;
2293
- /**
2294
- * The source of the notification appears as additional information.
2295
- */
2296
- readonly source?: string | {
2297
- label: string;
2298
- id: string;
2299
- };
2300
- /**
2301
- * Actions to show as part of the notification. Primary actions show up as
2302
- * buttons as part of the message and will close the notification once clicked.
2303
- *
2304
- * Secondary actions are meant to provide additional configuration or context
2305
- * for the notification and will show up less prominent. A notification does not
2306
- * close automatically when invoking a secondary action.
2307
- *
2308
- * **Note:** If your intent is to show a message with actions to the user, consider
2309
- * the `INotificationService.prompt()` method instead which are optimized for
2310
- * this usecase and much easier to use!
2311
- */
2312
- actions?: INotificationActions;
2313
- /**
2314
- * The initial set of progress properties for the notification. To update progress
2315
- * later on, access the `INotificationHandle.progress` property.
2316
- */
2317
- readonly progress?: INotificationProgressProperties;
2318
- }
2319
- interface INotificationActions {
2320
- /**
2321
- * Primary actions show up as buttons as part of the message and will close
2322
- * the notification once clicked.
2323
- *
2324
- * Pass `ActionWithMenuAction` for an action that has additional menu actions.
2325
- */
2326
- readonly primary?: readonly IAction[];
2327
- /**
2328
- * Secondary actions are meant to provide additional configuration or context
2329
- * for the notification and will show up less prominent. A notification does not
2330
- * close automatically when invoking a secondary action.
2331
- */
2332
- readonly secondary?: readonly IAction[];
2333
- }
2334
- interface INotificationProgressProperties {
2335
- /**
2336
- * Causes the progress bar to spin infinitley.
2337
- */
2338
- readonly infinite?: boolean;
2339
- /**
2340
- * Indicate the total amount of work.
2341
- */
2342
- readonly total?: number;
2343
- /**
2344
- * Indicate that a specific chunk of work is done.
2345
- */
2346
- readonly worked?: number;
2347
- }
2348
- interface INotificationProgress {
2349
- /**
2350
- * Causes the progress bar to spin infinitley.
2351
- */
2352
- infinite(): void;
2353
- /**
2354
- * Indicate the total amount of work.
2355
- */
2356
- total(value: number): void;
2357
- /**
2358
- * Indicate that a specific chunk of work is done.
2359
- */
2360
- worked(value: number): void;
2361
- /**
2362
- * Indicate that the long running operation is done.
2363
- */
2364
- done(): void;
2365
- }
2366
- interface INotificationHandle {
2367
- /**
2368
- * Will be fired once the notification is closed.
2369
- */
2370
- readonly onDidClose: Event<void>;
2371
- /**
2372
- * Will be fired whenever the visibility of the notification changes.
2373
- * A notification can either be visible as toast or inside the notification
2374
- * center if it is visible.
2375
- */
2376
- readonly onDidChangeVisibility: Event<boolean>;
2377
- /**
2378
- * Allows to indicate progress on the notification even after the
2379
- * notification is already visible.
2380
- */
2381
- readonly progress: INotificationProgress;
2382
- /**
2383
- * Allows to update the severity of the notification.
2384
- */
2385
- updateSeverity(severity: Severity): void;
2386
- /**
2387
- * Allows to update the message of the notification even after the
2388
- * notification is already visible.
2389
- */
2390
- updateMessage(message: NotificationMessage): void;
2391
- /**
2392
- * Allows to update the actions of the notification even after the
2393
- * notification is already visible.
2394
- */
2395
- updateActions(actions?: INotificationActions): void;
2396
- /**
2397
- * Hide the notification and remove it from the notification center.
2398
- */
2399
- close(): void;
2400
- }
2401
- interface IBasePromptChoice {
2402
- /**
2403
- * Label to show for the choice to the user.
2404
- */
2405
- readonly label: string;
2406
- /**
2407
- * Whether to keep the notification open after the choice was selected
2408
- * by the user. By default, will close the notification upon click.
2409
- */
2410
- readonly keepOpen?: boolean;
2411
- /**
2412
- * Triggered when the user selects the choice.
2413
- */
2414
- run: () => void;
2415
- }
2416
- interface IPromptChoice extends IBasePromptChoice {
2417
- /**
2418
- * Primary choices show up as buttons in the notification below the message.
2419
- * Secondary choices show up under the gear icon in the header of the notification.
2420
- */
2421
- readonly isSecondary?: boolean;
2422
- }
2423
- interface IPromptChoiceWithMenu extends IPromptChoice {
2424
- /**
2425
- * Additional choices those will be shown in the dropdown menu for this choice.
2426
- */
2427
- readonly menu: IBasePromptChoice[];
2428
- /**
2429
- * Menu is not supported on secondary choices
2430
- */
2431
- readonly isSecondary: false | undefined;
2432
- }
2433
- interface IPromptOptions extends INotificationProperties {
2434
- /**
2435
- * Will be called if the user closed the notification without picking
2436
- * any of the provided choices.
2437
- */
2438
- onCancel?: () => void;
2439
- }
2440
- interface IStatusMessageOptions {
2441
- /**
2442
- * An optional timeout after which the status message should show. By default
2443
- * the status message will show immediately.
2444
- */
2445
- readonly showAfter?: number;
2446
- /**
2447
- * An optional timeout after which the status message is to be hidden. By default
2448
- * the status message will not hide until another status message is displayed.
2449
- */
2450
- readonly hideAfter?: number;
2451
- }
2452
- declare enum NotificationsFilter {
2453
- /**
2454
- * No filter is enabled.
2455
- */
2456
- OFF = 0,
2457
- /**
2458
- * All notifications are configured as silent. See
2459
- * `INotificationProperties.silent` for more info.
2460
- */
2461
- SILENT = 1,
2462
- /**
2463
- * All notifications are silent except error notifications.
2464
- */
2465
- ERROR = 2
2466
- }
2467
- declare const INotificationService: ServiceIdentifier<INotificationService>;
2468
- /**
2469
- * A service to bring up notifications and non-modal prompts.
2470
- *
2471
- * Note: use the `IDialogService` for a modal way to ask the user for input.
2472
- */
2473
- interface INotificationService {
2474
- readonly _serviceBrand: undefined;
2475
- /**
2476
- * The DND mode can be enabled or disabled
2477
- * and will result in all info and warning
2478
- * notifications to be silent.
2479
- */
2480
- doNotDisturbMode: boolean;
2481
- /**
2482
- * Emitted when a new notification is added.
2483
- */
2484
- readonly onDidAddNotification: Event<INotification>;
2485
- /**
2486
- * Emitted when a notification is removed.
2487
- */
2488
- readonly onDidRemoveNotification: Event<INotification>;
2489
- /**
2490
- * Emitted when a do not disturb mode has changed.
2491
- */
2492
- readonly onDidChangeDoNotDisturbMode: Event<void>;
2493
- /**
2494
- * Show the provided notification to the user. The returned `INotificationHandle`
2495
- * can be used to control the notification afterwards.
2496
- *
2497
- * **Note:** If your intent is to show a message with actions to the user, consider
2498
- * the `INotificationService.prompt()` method instead which are optimized for
2499
- * this usecase and much easier to use!
2500
- *
2501
- * @returns a handle on the notification to e.g. hide it or update message, buttons, etc.
2502
- */
2503
- notify(notification: INotification): INotificationHandle;
2504
- /**
2505
- * A convenient way of reporting infos. Use the `INotificationService.notify`
2506
- * method if you need more control over the notification.
2507
- */
2508
- info(message: NotificationMessage | NotificationMessage[]): void;
2509
- /**
2510
- * A convenient way of reporting warnings. Use the `INotificationService.notify`
2511
- * method if you need more control over the notification.
2512
- */
2513
- warn(message: NotificationMessage | NotificationMessage[]): void;
2514
- /**
2515
- * A convenient way of reporting errors. Use the `INotificationService.notify`
2516
- * method if you need more control over the notification.
2517
- */
2518
- error(message: NotificationMessage | NotificationMessage[]): void;
2519
- /**
2520
- * Shows a prompt in the notification area with the provided choices. The prompt
2521
- * is non-modal. If you want to show a modal dialog instead, use `IDialogService`.
2522
- *
2523
- * @param severity the severity of the notification. Either `Info`, `Warning` or `Error`.
2524
- * @param message the message to show as status.
2525
- * @param choices options to be chosen from.
2526
- * @param options provides some optional configuration options.
2527
- *
2528
- * @returns a handle on the notification to e.g. hide it or update message, buttons, etc.
2529
- */
2530
- prompt(severity: Severity, message: string, choices: (IPromptChoice | IPromptChoiceWithMenu)[], options?: IPromptOptions): INotificationHandle;
2531
- /**
2532
- * Shows a status message in the status area with the provided text.
2533
- *
2534
- * @param message the message to show as status
2535
- * @param options provides some optional configuration options
2536
- *
2537
- * @returns a disposable to hide the status message
2538
- */
2539
- status(message: NotificationMessage, options?: IStatusMessageOptions): IDisposable;
2540
- }
2541
- declare class NoOpNotification implements INotificationHandle {
2542
- readonly progress: NoOpProgress;
2543
- readonly onDidClose: Event<any>;
2544
- readonly onDidChangeVisibility: Event<any>;
2545
- updateSeverity(severity: Severity): void;
2546
- updateMessage(message: NotificationMessage): void;
2547
- updateActions(actions?: INotificationActions): void;
2548
- close(): void;
2549
- }
2550
- declare class NoOpProgress implements INotificationProgress {
2551
- infinite(): void;
2552
- done(): void;
2553
- total(value: number): void;
2554
- worked(value: number): void;
2555
- }
2556
-
2557
- declare const enum WorkingCopyCapabilities {
2558
- /**
2559
- * Signals no specific capability for the working copy.
2560
- */
2561
- None = 0,
2562
- /**
2563
- * Signals that the working copy requires
2564
- * additional input when saving, e.g. an
2565
- * associated path to save to.
2566
- */
2567
- Untitled = 2,
2568
- /**
2569
- * The working copy will not indicate that
2570
- * it is dirty and unsaved content will be
2571
- * discarded without prompting if closed.
2572
- */
2573
- Scratchpad = 4
2574
- }
2575
- /**
2576
- * Data to be associated with working copy backups. Use
2577
- * `IWorkingCopyBackupService.resolve(workingCopy)` to
2578
- * retrieve the backup when loading the working copy.
2579
- */
2580
- interface IWorkingCopyBackup {
2581
- /**
2582
- * Any serializable metadata to be associated with the backup.
2583
- */
2584
- meta?: IWorkingCopyBackupMeta;
2585
- /**
2586
- * The actual snapshot of the contents of the working copy at
2587
- * the time the backup was made.
2588
- */
2589
- content?: VSBufferReadable | VSBufferReadableStream;
2590
- }
2591
- /**
2592
- * Working copy backup metadata that can be associated
2593
- * with the backup.
2594
- *
2595
- * Some properties may be reserved as outlined here and
2596
- * cannot be used.
2597
- */
2598
- interface IWorkingCopyBackupMeta {
2599
- /**
2600
- * Any property needs to be serializable through JSON.
2601
- */
2602
- [key: string]: unknown;
2603
- /**
2604
- * `typeId` is a reserved property that cannot be used
2605
- * as backup metadata.
2606
- */
2607
- typeId?: never;
2608
- }
2609
- /**
2610
- * Every working copy has in common that it is identified by
2611
- * a resource `URI` and a `typeId`. There can only be one
2612
- * working copy registered with the same `URI` and `typeId`.
2613
- */
2614
- interface IWorkingCopyIdentifier {
2615
- /**
2616
- * The type identifier of the working copy for grouping
2617
- * working copies of the same domain together.
2618
- *
2619
- * There can only be one working copy for a given resource
2620
- * and type identifier.
2621
- */
2622
- readonly typeId: string;
2623
- /**
2624
- * The resource of the working copy must be unique for
2625
- * working copies of the same `typeId`.
2626
- */
2627
- readonly resource: URI;
2628
- }
2629
- interface IWorkingCopySaveEvent {
2630
- /**
2631
- * The reason why the working copy was saved.
2632
- */
2633
- readonly reason?: SaveReason;
2634
- /**
2635
- * The source of the working copy save request.
2636
- */
2637
- readonly source?: SaveSource;
2638
- }
2639
- /**
2640
- * A working copy is an abstract concept to unify handling of
2641
- * data that can be worked on (e.g. edited) in an editor.
2642
- *
2643
- *
2644
- * A working copy resource may be the backing store of the data
2645
- * (e.g. a file on disk), but that is not a requirement. If
2646
- * your working copy is file based, consider to use the
2647
- * `IFileWorkingCopy` instead that simplifies a lot of things
2648
- * when working with file based working copies.
2649
- */
2650
- interface IWorkingCopy extends IWorkingCopyIdentifier {
2651
- /**
2652
- * Human readable name of the working copy.
2653
- */
2654
- readonly name: string;
2655
- /**
2656
- * The capabilities of the working copy.
2657
- */
2658
- readonly capabilities: WorkingCopyCapabilities;
2659
- /**
2660
- * Used by the workbench to signal if the working copy
2661
- * is dirty or not. Typically a working copy is dirty
2662
- * once changed until saved or reverted.
2663
- */
2664
- readonly onDidChangeDirty: Event<void>;
2665
- /**
2666
- * Used by the workbench e.g. to trigger auto-save
2667
- * (unless this working copy is untitled) and backups.
2668
- */
2669
- readonly onDidChangeContent: Event<void>;
2670
- /**
2671
- * Used by the workbench e.g. to track local history
2672
- * (unless this working copy is untitled).
2673
- */
2674
- readonly onDidSave: Event<IWorkingCopySaveEvent>;
2675
- /**
2676
- * Indicates that the file has unsaved changes
2677
- * and should confirm before closing.
2678
- */
2679
- isDirty(): boolean;
2680
- /**
2681
- * Indicates that the file has unsaved changes.
2682
- * Used for backup tracking and accounts for
2683
- * working copies that are never dirty e.g.
2684
- * scratchpads.
2685
- */
2686
- isModified(): boolean;
2687
- /**
2688
- * The workbench may call this method often after it receives
2689
- * the `onDidChangeContent` event for the working copy. The motivation
2690
- * is to allow to quit VSCode with dirty working copies present.
2691
- *
2692
- * Providers of working copies should use `IWorkingCopyBackupService.resolve(workingCopy)`
2693
- * to retrieve the backup metadata associated when loading the working copy.
2694
- *
2695
- * @param token support for cancellation
2696
- */
2697
- backup(token: CancellationToken): Promise<IWorkingCopyBackup>;
2698
- /**
2699
- * Asks the working copy to save. If the working copy was dirty, it is
2700
- * expected to be non-dirty after this operation has finished.
2701
- *
2702
- * @returns `true` if the operation was successful and `false` otherwise.
2703
- */
2704
- save(options?: ISaveOptions): Promise<boolean>;
2705
- /**
2706
- * Asks the working copy to revert. If the working copy was dirty, it is
2707
- * expected to be non-dirty after this operation has finished.
2708
- */
2709
- revert(options?: IRevertOptions): Promise<void>;
2710
- }
2711
-
2712
- interface IUntitledTextEditorModel extends ITextEditorModel, ILanguageSupport, IEncodingSupport, IWorkingCopy {
2713
- /**
2714
- * Emits an event when the encoding of this untitled model changes.
2715
- */
2716
- readonly onDidChangeEncoding: Event<void>;
2717
- /**
2718
- * Emits an event when the name of this untitled model changes.
2719
- */
2720
- readonly onDidChangeName: Event<void>;
2721
- /**
2722
- * Emits an event when this untitled model is reverted.
2723
- */
2724
- readonly onDidRevert: Event<void>;
2725
- /**
2726
- * Whether this untitled text model has an associated file path.
2727
- */
2728
- readonly hasAssociatedFilePath: boolean;
2729
- /**
2730
- * Whether this model has an explicit language or not.
2731
- */
2732
- readonly hasLanguageSetExplicitly: boolean;
2733
- /**
2734
- * Sets the encoding to use for this untitled model.
2735
- */
2736
- setEncoding(encoding: string): Promise<void>;
2737
- /**
2738
- * Resolves the untitled model.
2739
- */
2740
- resolve(): Promise<void>;
2741
- }
2742
-
2743
- interface INewUntitledTextEditorOptions {
2744
- /**
2745
- * Initial value of the untitled editor. An untitled editor with initial
2746
- * value is dirty right from the beginning.
2747
- */
2748
- initialValue?: string;
2749
- /**
2750
- * Preferred language id to use when saving the untitled editor.
2751
- */
2752
- languageId?: string;
2753
- /**
2754
- * Preferred encoding to use when saving the untitled editor.
2755
- */
2756
- encoding?: string;
2757
- }
2758
- interface IExistingUntitledTextEditorOptions extends INewUntitledTextEditorOptions {
2759
- /**
2760
- * A resource to identify the untitled editor to create or return
2761
- * if already existing.
2762
- *
2763
- * Note: the resource will not be used unless the scheme is `untitled`.
2764
- */
2765
- untitledResource?: URI;
2766
- }
2767
- interface INewUntitledTextEditorWithAssociatedResourceOptions extends INewUntitledTextEditorOptions {
2768
- /**
2769
- * Resource components to associate with the untitled editor. When saving
2770
- * the untitled editor, the associated components will be used and the user
2771
- * is not being asked to provide a file path.
2772
- *
2773
- * Note: currently it is not possible to specify the `scheme` to use. The
2774
- * untitled editor will saved to the default local or remote resource.
2775
- */
2776
- associatedResource?: {
2777
- authority: string;
2778
- path: string;
2779
- query: string;
2780
- fragment: string;
2781
- };
2782
- }
2783
- interface IUntitledTextEditorModelManager {
2784
- /**
2785
- * Events for when untitled text editors change (e.g. getting dirty, saved or reverted).
2786
- */
2787
- readonly onDidChangeDirty: Event<IUntitledTextEditorModel>;
2788
- /**
2789
- * Events for when untitled text editor encodings change.
2790
- */
2791
- readonly onDidChangeEncoding: Event<IUntitledTextEditorModel>;
2792
- /**
2793
- * Events for when untitled text editor labels change.
2794
- */
2795
- readonly onDidChangeLabel: Event<IUntitledTextEditorModel>;
2796
- /**
2797
- * Events for when untitled text editors are about to be disposed.
2798
- */
2799
- readonly onWillDispose: Event<IUntitledTextEditorModel>;
2800
- /**
2801
- * Creates a new untitled editor model with the provided options. If the `untitledResource`
2802
- * property is provided and the untitled editor exists, it will return that existing
2803
- * instance instead of creating a new one.
2804
- */
2805
- create(options?: INewUntitledTextEditorOptions): IUntitledTextEditorModel;
2806
- create(options?: INewUntitledTextEditorWithAssociatedResourceOptions): IUntitledTextEditorModel;
2807
- create(options?: IExistingUntitledTextEditorOptions): IUntitledTextEditorModel;
2808
- /**
2809
- * Returns an existing untitled editor model if already created before.
2810
- */
2811
- get(resource: URI): IUntitledTextEditorModel | undefined;
2812
- /**
2813
- * Returns the value of the untitled editor, undefined if none exists
2814
- * @param resource The URI of the untitled file
2815
- * @returns The content, or undefined
2816
- */
2817
- getValue(resource: URI): string | undefined;
2818
- /**
2819
- * Resolves an untitled editor model from the provided options. If the `untitledResource`
2820
- * property is provided and the untitled editor exists, it will return that existing
2821
- * instance instead of creating a new one.
2822
- */
2823
- resolve(options?: INewUntitledTextEditorOptions): Promise<IUntitledTextEditorModel>;
2824
- resolve(options?: INewUntitledTextEditorWithAssociatedResourceOptions): Promise<IUntitledTextEditorModel>;
2825
- resolve(options?: IExistingUntitledTextEditorOptions): Promise<IUntitledTextEditorModel>;
2826
- /**
2827
- * Figures out if the given resource has an associated resource or not.
2828
- */
2829
- isUntitledWithAssociatedResource(resource: URI): boolean;
2830
- }
2831
-
2832
- /**
2833
- * A resource based `IWorkingCopy` is backed by a `URI` from a
2834
- * known file system provider.
2835
- */
2836
- interface IResourceWorkingCopy extends IWorkingCopy, IDisposable {
2837
- /**
2838
- * An event for when the orphaned state of the resource working copy changes.
2839
- */
2840
- readonly onDidChangeOrphaned: Event<void>;
2841
- /**
2842
- * Whether the resource working copy is orphaned or not.
2843
- */
2844
- isOrphaned(): boolean;
2845
- /**
2846
- * An event for when the file working copy has been disposed.
2847
- */
2848
- readonly onWillDispose: Event<void>;
2849
- /**
2850
- * Whether the file working copy has been disposed or not.
2851
- */
2852
- isDisposed(): boolean;
2853
- }
2854
-
2855
- /**
2856
- * A generic file working copy model to be reused by untitled
2857
- * and stored file working copies.
2858
- */
2859
- interface IFileWorkingCopyModel extends IDisposable {
2860
- /**
2861
- * This event signals ANY changes to the contents, for example:
2862
- * - through the user typing into the editor
2863
- * - from API usage (e.g. bulk edits)
2864
- * - when `IFileWorkingCopyModel#update` is invoked with contents
2865
- * that are different from the current contents
2866
- *
2867
- * The file working copy will listen to these changes and may mark
2868
- * the working copy as dirty whenever this event fires.
2869
- *
2870
- * Note: ONLY report changes to the model but not the underlying
2871
- * file. The file working copy is tracking changes to the file
2872
- * automatically.
2873
- */
2874
- readonly onDidChangeContent: Event<unknown>;
2875
- /**
2876
- * An event emitted right before disposing the model.
2877
- */
2878
- readonly onWillDispose: Event<void>;
2879
- /**
2880
- * Snapshots the model's current content for writing. This must include
2881
- * any changes that were made to the model that are in memory.
2882
- *
2883
- * @param token support for cancellation
2884
- */
2885
- snapshot(token: CancellationToken): Promise<VSBufferReadableStream>;
2886
- /**
2887
- * Updates the model with the provided contents. The implementation should
2888
- * behave in a similar fashion as `IFileWorkingCopyModelFactory#createModel`
2889
- * except that here the model already exists and just needs to update to
2890
- * the provided contents.
2891
- *
2892
- * Note: it is expected that the model fires a `onDidChangeContent` event
2893
- * as part of the update.
2894
- *
2895
- * @param contents the contents to use for the model
2896
- * @param token support for cancellation
2897
- */
2898
- update(contents: VSBufferReadableStream, token: CancellationToken): Promise<void>;
2899
- }
2900
- interface IFileWorkingCopy<M extends IFileWorkingCopyModel> extends IWorkingCopy, IDisposable {
2901
- /**
2902
- * An event for when the file working copy has been reverted.
2903
- */
2904
- readonly onDidRevert: Event<void>;
2905
- /**
2906
- * An event for when the file working copy has been disposed.
2907
- */
2908
- readonly onWillDispose: Event<void>;
2909
- /**
2910
- * Provides access to the underlying model of this file
2911
- * based working copy. As long as the file working copy
2912
- * has not been resolved, the model is `undefined`.
2913
- */
2914
- readonly model: M | undefined;
2915
- /**
2916
- * Resolves the file working copy and thus makes the `model`
2917
- * available.
2918
- */
2919
- resolve(): Promise<void>;
2920
- /**
2921
- * Whether we have a resolved model or not.
2922
- */
2923
- isResolved(): this is IResolvedFileWorkingCopy<M>;
2924
- }
2925
- interface IResolvedFileWorkingCopy<M extends IFileWorkingCopyModel> extends IFileWorkingCopy<M> {
2926
- /**
2927
- * A resolved file working copy has a resolved model.
2928
- */
2929
- readonly model: M;
2930
- }
2931
-
2932
- /**
2933
- * The underlying model of a stored file working copy provides some
2934
- * methods for the stored file working copy to function. The model is
2935
- * typically only available after the working copy has been
2936
- * resolved via it's `resolve()` method.
2937
- */
2938
- interface IStoredFileWorkingCopyModel extends IFileWorkingCopyModel {
2939
- readonly onDidChangeContent: Event<IStoredFileWorkingCopyModelContentChangedEvent>;
2940
- /**
2941
- * A version ID of the model. If a `onDidChangeContent` is fired
2942
- * from the model and the last known saved `versionId` matches
2943
- * with the `model.versionId`, the stored file working copy will
2944
- * discard any dirty state.
2945
- *
2946
- * A use case is the following:
2947
- * - a stored file working copy gets edited and thus dirty
2948
- * - the user triggers undo to revert the changes
2949
- * - at this point the `versionId` should match the one we had saved
2950
- *
2951
- * This requires the model to be aware of undo/redo operations.
2952
- */
2953
- readonly versionId: unknown;
2954
- /**
2955
- * Close the current undo-redo element. This offers a way
2956
- * to create an undo/redo stop point.
2957
- *
2958
- * This method may for example be called right before the
2959
- * save is triggered so that the user can always undo back
2960
- * to the state before saving.
2961
- */
2962
- pushStackElement(): void;
2963
- }
2964
- interface IStoredFileWorkingCopyModelContentChangedEvent {
2965
- /**
2966
- * Flag that indicates that this event was generated while undoing.
2967
- */
2968
- readonly isUndoing: boolean;
2969
- /**
2970
- * Flag that indicates that this event was generated while redoing.
2971
- */
2972
- readonly isRedoing: boolean;
2973
- }
2974
- /**
2975
- * A stored file based `IWorkingCopy` is backed by a `URI` from a
2976
- * known file system provider. Given this assumption, a lot
2977
- * of functionality can be built on top, such as saving in
2978
- * a secure way to prevent data loss.
2979
- */
2980
- interface IStoredFileWorkingCopy<M extends IStoredFileWorkingCopyModel> extends IResourceWorkingCopy, IFileWorkingCopy<M> {
2981
- /**
2982
- * An event for when a stored file working copy was resolved.
2983
- */
2984
- readonly onDidResolve: Event<void>;
2985
- /**
2986
- * An event for when a stored file working copy was saved successfully.
2987
- */
2988
- readonly onDidSave: Event<IStoredFileWorkingCopySaveEvent>;
2989
- /**
2990
- * An event indicating that a stored file working copy save operation failed.
2991
- */
2992
- readonly onDidSaveError: Event<void>;
2993
- /**
2994
- * An event for when the readonly state of the stored file working copy changes.
2995
- */
2996
- readonly onDidChangeReadonly: Event<void>;
2997
- /**
2998
- * Resolves a stored file working copy.
2999
- */
3000
- resolve(options?: IStoredFileWorkingCopyResolveOptions): Promise<void>;
3001
- /**
3002
- * Explicitly sets the working copy to be modified.
3003
- */
3004
- markModified(): void;
3005
- /**
3006
- * Whether the stored file working copy is in the provided `state`
3007
- * or not.
3008
- *
3009
- * @param state the `FileWorkingCopyState` to check on.
3010
- */
3011
- hasState(state: StoredFileWorkingCopyState): boolean;
3012
- /**
3013
- * Allows to join a state change away from the provided `state`.
3014
- *
3015
- * @param state currently only `FileWorkingCopyState.PENDING_SAVE`
3016
- * can be awaited on to resolve.
3017
- */
3018
- joinState(state: StoredFileWorkingCopyState.PENDING_SAVE): Promise<void>;
3019
- /**
3020
- * Whether we have a resolved model or not.
3021
- */
3022
- isResolved(): this is IResolvedStoredFileWorkingCopy<M>;
3023
- /**
3024
- * Whether the stored file working copy is readonly or not.
3025
- */
3026
- isReadonly(): boolean;
3027
- }
3028
- interface IResolvedStoredFileWorkingCopy<M extends IStoredFileWorkingCopyModel> extends IStoredFileWorkingCopy<M> {
3029
- /**
3030
- * A resolved stored file working copy has a resolved model.
3031
- */
3032
- readonly model: M;
3033
- }
3034
- /**
3035
- * States the stored file working copy can be in.
3036
- */
3037
- declare const enum StoredFileWorkingCopyState {
3038
- /**
3039
- * A stored file working copy is saved.
3040
- */
3041
- SAVED = 0,
3042
- /**
3043
- * A stored file working copy is dirty.
3044
- */
3045
- DIRTY = 1,
3046
- /**
3047
- * A stored file working copy is currently being saved but
3048
- * this operation has not completed yet.
3049
- */
3050
- PENDING_SAVE = 2,
3051
- /**
3052
- * A stored file working copy is in conflict mode when changes
3053
- * cannot be saved because the underlying file has changed.
3054
- * Stored file working copies in conflict mode are always dirty.
3055
- */
3056
- CONFLICT = 3,
3057
- /**
3058
- * A stored file working copy is in orphan state when the underlying
3059
- * file has been deleted.
3060
- */
3061
- ORPHAN = 4,
3062
- /**
3063
- * Any error that happens during a save that is not causing
3064
- * the `StoredFileWorkingCopyState.CONFLICT` state.
3065
- * Stored file working copies in error mode are always dirty.
3066
- */
3067
- ERROR = 5
3068
- }
3069
- interface IStoredFileWorkingCopyResolveOptions {
3070
- /**
3071
- * The contents to use for the stored file working copy if known. If not
3072
- * provided, the contents will be retrieved from the underlying
3073
- * resource or backup if present.
3074
- *
3075
- * If contents are provided, the stored file working copy will be marked
3076
- * as dirty right from the beginning.
3077
- */
3078
- readonly contents?: VSBufferReadableStream;
3079
- /**
3080
- * Go to disk bypassing any cache of the stored file working copy if any.
3081
- */
3082
- readonly forceReadFromFile?: boolean;
3083
- }
3084
- interface IStoredFileWorkingCopySaveEvent extends IWorkingCopySaveEvent {
3085
- /**
3086
- * The resolved stat from the save operation.
3087
- */
3088
- readonly stat: IFileStatWithMetadata;
3089
- }
3090
-
3091
- interface SourceTargetPair {
3092
- /**
3093
- * The source resource that is defined for move operations.
3094
- */
3095
- readonly source?: URI;
3096
- /**
3097
- * The target resource the event is about.
3098
- */
3099
- readonly target: URI;
3100
- }
3101
- interface IFileOperationUndoRedoInfo {
3102
- /**
3103
- * Id of the undo group that the file operation belongs to.
3104
- */
3105
- undoRedoGroupId?: number;
3106
- /**
3107
- * Flag indicates if the operation is an undo.
3108
- */
3109
- isUndoing?: boolean;
3110
- }
3111
- interface WorkingCopyFileEvent extends IWaitUntil {
3112
- /**
3113
- * An identifier to correlate the operation through the
3114
- * different event types (before, after, error).
3115
- */
3116
- readonly correlationId: number;
3117
- /**
3118
- * The file operation that is taking place.
3119
- */
3120
- readonly operation: FileOperation;
3121
- /**
3122
- * The array of source/target pair of files involved in given operation.
3123
- */
3124
- readonly files: readonly SourceTargetPair[];
3125
- }
3126
- interface IWorkingCopyFileOperationParticipant {
3127
- /**
3128
- * Participate in a file operation of working copies. Allows to
3129
- * change the working copies before they are being saved to disk.
3130
- */
3131
- participate(files: SourceTargetPair[], operation: FileOperation, undoInfo: IFileOperationUndoRedoInfo | undefined, timeout: number, token: CancellationToken): Promise<void>;
3132
- }
3133
- interface IStoredFileWorkingCopySaveParticipant {
3134
- /**
3135
- * Participate in a save operation of file stored working copies.
3136
- * Allows to make changes before content is being saved to disk.
3137
- */
3138
- participate(workingCopy: IStoredFileWorkingCopy<IStoredFileWorkingCopyModel>, context: {
3139
- reason: SaveReason;
3140
- }, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
3141
- }
3142
- interface ICreateOperation {
3143
- resource: URI;
3144
- overwrite?: boolean;
3145
- }
3146
- interface ICreateFileOperation extends ICreateOperation {
3147
- contents?: VSBuffer | VSBufferReadable | VSBufferReadableStream;
3148
- }
3149
- interface IDeleteOperation {
3150
- resource: URI;
3151
- useTrash?: boolean;
3152
- recursive?: boolean;
3153
- }
3154
- interface IMoveOperation {
3155
- file: Required<SourceTargetPair>;
3156
- overwrite?: boolean;
510
+ interface IElectricAction {
511
+ matchOpenBracket: string;
3157
512
  }
3158
- interface ICopyOperation extends IMoveOperation {
513
+ declare class BracketElectricCharacterSupport {
514
+ private readonly _richEditBrackets;
515
+ constructor(richEditBrackets: RichEditBrackets | null);
516
+ getElectricCharacters(): string[];
517
+ onElectricCharacter(character: string, context: ScopedLineTokens, column: number): IElectricAction | null;
3159
518
  }
3160
- /**
3161
- * Returns the working copies for a given resource.
3162
- */
3163
- type WorkingCopyProvider = (resourceOrFolder: URI) => IWorkingCopy[];
3164
519
 
3165
- declare const IWorkingCopyFileService: ServiceIdentifier<IWorkingCopyFileService>;
3166
- /**
3167
- * A service that allows to perform file operations with working copy support.
3168
- * Any operation that would leave a stale dirty working copy behind will make
3169
- * sure to revert the working copy first.
3170
- *
3171
- * On top of that events are provided to participate in each state of the
3172
- * operation to perform additional work.
3173
- */
3174
- interface IWorkingCopyFileService {
3175
- readonly _serviceBrand: undefined;
3176
- /**
3177
- * An event that is fired when a certain working copy IO operation is about to run.
3178
- *
3179
- * Participants can join this event with a long running operation to keep some state
3180
- * before the operation is started, but working copies should not be changed at this
3181
- * point in time. For that purpose, use the `IWorkingCopyFileOperationParticipant` API.
3182
- */
3183
- readonly onWillRunWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
3184
- /**
3185
- * An event that is fired after a working copy IO operation has failed.
3186
- *
3187
- * Participants can join this event with a long running operation to clean up as needed.
3188
- */
3189
- readonly onDidFailWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
3190
- /**
3191
- * An event that is fired after a working copy IO operation has been performed.
3192
- *
3193
- * Participants can join this event with a long running operation to make changes
3194
- * after the operation has finished.
3195
- */
3196
- readonly onDidRunWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
3197
- /**
3198
- * Adds a participant for file operations on working copies.
3199
- */
3200
- addFileOperationParticipant(participant: IWorkingCopyFileOperationParticipant): IDisposable;
3201
- /**
3202
- * Whether save participants are present for stored file working copies.
3203
- */
3204
- get hasSaveParticipants(): boolean;
3205
- /**
3206
- * Adds a participant for save operations on stored file working copies.
3207
- */
3208
- addSaveParticipant(participant: IStoredFileWorkingCopySaveParticipant): IDisposable;
3209
- /**
3210
- * Runs all available save participants for stored file working copies.
3211
- */
3212
- runSaveParticipants(workingCopy: IStoredFileWorkingCopy<IStoredFileWorkingCopyModel>, context: {
3213
- reason: SaveReason;
3214
- }, token: CancellationToken): Promise<void>;
3215
- /**
3216
- * Will create a resource with the provided optional contents, optionally overwriting any target.
3217
- *
3218
- * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
3219
- * `onDidRunWorkingCopyFileOperation` events to participate.
3220
- */
3221
- create(operations: ICreateFileOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
3222
- /**
3223
- * Will create a folder and any parent folder that needs to be created.
3224
- *
3225
- * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
3226
- * `onDidRunWorkingCopyFileOperation` events to participate.
3227
- *
3228
- * Note: events will only be emitted for the provided resource, but not any
3229
- * parent folders that are being created as part of the operation.
3230
- */
3231
- createFolder(operations: ICreateOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
3232
- /**
3233
- * Will move working copies matching the provided resources and corresponding children
3234
- * to the target resources using the associated file service for those resources.
3235
- *
3236
- * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
3237
- * `onDidRunWorkingCopyFileOperation` events to participate.
3238
- */
3239
- move(operations: IMoveOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
3240
- /**
3241
- * Will copy working copies matching the provided resources and corresponding children
3242
- * to the target resources using the associated file service for those resources.
3243
- *
3244
- * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
3245
- * `onDidRunWorkingCopyFileOperation` events to participate.
3246
- */
3247
- copy(operations: ICopyOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
3248
- /**
3249
- * Will delete working copies matching the provided resources and children
3250
- * using the associated file service for those resources.
3251
- *
3252
- * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
3253
- * `onDidRunWorkingCopyFileOperation` events to participate.
3254
- */
3255
- delete(operations: IDeleteOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<void>;
3256
- /**
3257
- * Register a new provider for working copies based on a resource.
3258
- *
3259
- * @return a disposable that unregisters the provider.
3260
- */
3261
- registerWorkingCopyProvider(provider: WorkingCopyProvider): IDisposable;
3262
- /**
3263
- * Will return all working copies that are dirty matching the provided resource.
3264
- * If the resource is a folder and the scheme supports file operations, a working
3265
- * copy that is dirty and is a child of that folder will also be returned.
3266
- */
3267
- getDirty(resource: URI): readonly IWorkingCopy[];
520
+ declare class IndentRulesSupport {
521
+ private readonly _indentationRules;
522
+ constructor(indentationRules: IndentationRule);
523
+ shouldIncrease(text: string): boolean;
524
+ shouldDecrease(text: string): boolean;
525
+ shouldIndentNextLine(text: string): boolean;
526
+ shouldIgnore(text: string): boolean;
527
+ getIndentMetadata(text: string): number;
3268
528
  }
3269
529
 
3270
- declare const ITextFileService: ServiceIdentifier<ITextFileService>;
3271
- interface ITextFileService extends IDisposable {
3272
- readonly _serviceBrand: undefined;
3273
- /**
3274
- * Access to the manager of text file editor models providing further
3275
- * methods to work with them.
3276
- */
3277
- readonly files: ITextFileEditorModelManager;
3278
- /**
3279
- * Access to the manager of untitled text editor models providing further
3280
- * methods to work with them.
3281
- */
3282
- readonly untitled: IUntitledTextEditorModelManager;
3283
- /**
3284
- * Helper to determine encoding for resources.
3285
- */
3286
- readonly encoding: IResourceEncodings;
3287
- /**
3288
- * A resource is dirty if it has unsaved changes or is an untitled file not yet saved.
3289
- *
3290
- * @param resource the resource to check for being dirty
3291
- */
3292
- isDirty(resource: URI): boolean;
3293
- /**
3294
- * Saves the resource.
3295
- *
3296
- * @param resource the resource to save
3297
- * @param options optional save options
3298
- * @return Path of the saved resource or undefined if canceled.
3299
- */
3300
- save(resource: URI, options?: ITextFileSaveOptions): Promise<URI | undefined>;
3301
- /**
3302
- * Saves the provided resource asking the user for a file name or using the provided one.
3303
- *
3304
- * @param resource the resource to save as.
3305
- * @param targetResource the optional target to save to.
3306
- * @param options optional save options
3307
- * @return Path of the saved resource or undefined if canceled.
3308
- */
3309
- saveAs(resource: URI, targetResource?: URI, options?: ITextFileSaveAsOptions): Promise<URI | undefined>;
3310
- /**
3311
- * Reverts the provided resource.
3312
- *
3313
- * @param resource the resource of the file to revert.
3314
- * @param force to force revert even when the file is not dirty
3315
- */
3316
- revert(resource: URI, options?: IRevertOptions): Promise<void>;
3317
- /**
3318
- * Read the contents of a file identified by the resource.
3319
- */
3320
- read(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileContent>;
3321
- /**
3322
- * Read the contents of a file identified by the resource as stream.
3323
- */
3324
- readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent>;
3325
- /**
3326
- * Update a file with given contents.
3327
- */
3328
- write(resource: URI, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<IFileStatWithMetadata>;
3329
- /**
3330
- * Create files. If the file exists it will be overwritten with the contents if
3331
- * the options enable to overwrite.
3332
- */
3333
- create(operations: {
3334
- resource: URI;
3335
- value?: string | ITextSnapshot;
3336
- options?: {
3337
- overwrite?: boolean;
3338
- };
3339
- }[], undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
3340
- /**
3341
- * Returns the readable that uses the appropriate encoding. This method should
3342
- * be used whenever a `string` or `ITextSnapshot` is being persisted to the
3343
- * file system.
3344
- */
3345
- getEncodedReadable(resource: URI, value: ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBufferReadable>;
3346
- getEncodedReadable(resource: URI, value: string, options?: IWriteTextFileOptions): Promise<VSBuffer>;
3347
- getEncodedReadable(resource: URI, value?: ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBufferReadable | undefined>;
3348
- getEncodedReadable(resource: URI, value?: string, options?: IWriteTextFileOptions): Promise<VSBuffer | undefined>;
3349
- getEncodedReadable(resource: URI, value?: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBuffer | VSBufferReadable | undefined>;
3350
- /**
3351
- * Returns a stream of strings that uses the appropriate encoding. This method should
3352
- * be used whenever a `VSBufferReadableStream` is being loaded from the file system.
3353
- *
3354
- * Will throw an error if `acceptTextOnly: true` for resources that seem to be binary.
3355
- */
3356
- getDecodedStream(resource: URI, value: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise<ReadableStream<string>>;
3357
- }
3358
- interface IReadTextFileEncodingOptions {
3359
- /**
3360
- * The optional encoding parameter allows to specify the desired encoding when resolving
3361
- * the contents of the file.
3362
- */
3363
- readonly encoding?: string;
3364
- /**
3365
- * The optional guessEncoding parameter allows to guess encoding from content of the file.
3366
- */
3367
- readonly autoGuessEncoding?: boolean;
3368
- /**
3369
- * The optional acceptTextOnly parameter allows to fail this request early if the file
3370
- * contents are not textual.
3371
- */
3372
- readonly acceptTextOnly?: boolean;
3373
- }
3374
- interface IReadTextFileOptions extends IReadTextFileEncodingOptions, IReadFileStreamOptions {
3375
- }
3376
- interface IWriteTextFileOptions extends IWriteFileOptions {
3377
- /**
3378
- * The encoding to use when updating a file.
3379
- */
3380
- readonly encoding?: string;
3381
- /**
3382
- * Whether to write to the file as elevated (admin) user. When setting this option a prompt will
3383
- * ask the user to authenticate as super user.
3384
- */
3385
- readonly writeElevated?: boolean;
3386
- }
3387
- interface IResourceEncodings {
3388
- getPreferredReadEncoding(resource: URI): Promise<IResourceEncoding>;
3389
- getPreferredWriteEncoding(resource: URI, preferredEncoding?: string): Promise<IResourceEncoding>;
3390
- }
3391
- interface IResourceEncoding {
3392
- readonly encoding: string;
3393
- readonly hasBOM: boolean;
3394
- }
3395
530
  /**
3396
- * The save error handler can be installed on the text file editor model to install code that executes when save errors occur.
3397
- */
3398
- interface ISaveErrorHandler {
3399
- /**
3400
- * Called whenever a save fails.
3401
- */
3402
- onSaveError(error: Error, model: ITextFileEditorModel): void;
3403
- }
3404
- /**
3405
- * States the text file editor model can be in.
531
+ * Interface used to support insertion of mode specific comments.
3406
532
  */
3407
- declare const enum TextFileEditorModelState {
3408
- /**
3409
- * A model is saved.
3410
- */
3411
- SAVED = 0,
3412
- /**
3413
- * A model is dirty.
3414
- */
3415
- DIRTY = 1,
3416
- /**
3417
- * A model is currently being saved but this operation has not completed yet.
3418
- */
3419
- PENDING_SAVE = 2,
3420
- /**
3421
- * A model is in conflict mode when changes cannot be saved because the
3422
- * underlying file has changed. Models in conflict mode are always dirty.
3423
- */
3424
- CONFLICT = 3,
3425
- /**
3426
- * A model is in orphan state when the underlying file has been deleted.
3427
- */
3428
- ORPHAN = 4,
3429
- /**
3430
- * Any error that happens during a save that is not causing the CONFLICT state.
3431
- * Models in error mode are always dirty.
3432
- */
3433
- ERROR = 5
3434
- }
3435
- declare const enum TextFileResolveReason {
3436
- EDITOR = 1,
3437
- REFERENCE = 2,
3438
- OTHER = 3
3439
- }
3440
- interface IBaseTextFileContent extends IBaseFileStatWithMetadata {
3441
- /**
3442
- * The encoding of the content if known.
3443
- */
3444
- readonly encoding: string;
3445
- }
3446
- interface ITextFileContent extends IBaseTextFileContent {
3447
- /**
3448
- * The content of a text file.
3449
- */
3450
- readonly value: string;
3451
- }
3452
- interface ITextFileStreamContent extends IBaseTextFileContent {
3453
- /**
3454
- * The line grouped content of a text file.
3455
- */
3456
- readonly value: ITextBufferFactory;
3457
- }
3458
- interface ITextFileEditorModelResolveOrCreateOptions extends ITextFileResolveOptions {
3459
- /**
3460
- * The language id to use for the model text content.
3461
- */
3462
- readonly languageId?: string;
3463
- /**
3464
- * The encoding to use when resolving the model text content.
3465
- */
3466
- readonly encoding?: string;
3467
- /**
3468
- * If the model was already resolved before, allows to trigger
3469
- * a reload of it to fetch the latest contents.
3470
- */
3471
- readonly reload?: {
3472
- /**
3473
- * Controls whether the reload happens in the background
3474
- * or whether `resolve` will await the reload to happen.
3475
- */
3476
- readonly async: boolean;
3477
- };
3478
- }
3479
- interface ITextFileSaveEvent extends ITextFileEditorModelSaveEvent {
3480
- /**
3481
- * The model that was saved.
3482
- */
3483
- readonly model: ITextFileEditorModel;
3484
- }
3485
- interface ITextFileResolveEvent {
3486
- /**
3487
- * The model that was resolved.
3488
- */
3489
- readonly model: ITextFileEditorModel;
3490
- /**
3491
- * The reason why the model was resolved.
3492
- */
3493
- readonly reason: TextFileResolveReason;
3494
- }
3495
- interface ITextFileSaveParticipant {
3496
- /**
3497
- * Participate in a save of a model. Allows to change the model
3498
- * before it is being saved to disk.
3499
- */
3500
- participate(model: ITextFileEditorModel, context: {
3501
- reason: SaveReason;
3502
- }, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
3503
- }
3504
- interface ITextFileEditorModelManager {
3505
- readonly onDidCreate: Event<ITextFileEditorModel>;
3506
- readonly onDidResolve: Event<ITextFileResolveEvent>;
3507
- readonly onDidChangeDirty: Event<ITextFileEditorModel>;
3508
- readonly onDidChangeReadonly: Event<ITextFileEditorModel>;
3509
- readonly onDidRemove: Event<URI>;
3510
- readonly onDidChangeOrphaned: Event<ITextFileEditorModel>;
3511
- readonly onDidChangeEncoding: Event<ITextFileEditorModel>;
3512
- readonly onDidSaveError: Event<ITextFileEditorModel>;
3513
- readonly onDidSave: Event<ITextFileSaveEvent>;
3514
- readonly onDidRevert: Event<ITextFileEditorModel>;
3515
- /**
3516
- * Access to all text file editor models in memory.
3517
- */
3518
- readonly models: ITextFileEditorModel[];
3519
- /**
3520
- * Allows to configure the error handler that is called on save errors.
3521
- */
3522
- saveErrorHandler: ISaveErrorHandler;
3523
- /**
3524
- * Returns the text file editor model for the provided resource
3525
- * or undefined if none.
3526
- */
3527
- get(resource: URI): ITextFileEditorModel | undefined;
3528
- /**
3529
- * Allows to resolve a text file model from disk.
3530
- */
3531
- resolve(resource: URI, options?: ITextFileEditorModelResolveOrCreateOptions): Promise<ITextFileEditorModel>;
3532
- /**
3533
- * Adds a participant for saving text file models.
3534
- */
3535
- addSaveParticipant(participant: ITextFileSaveParticipant): IDisposable;
3536
- /**
3537
- * Runs the registered save participants on the provided model.
3538
- */
3539
- runSaveParticipants(model: ITextFileEditorModel, context: {
3540
- reason: SaveReason;
3541
- }, token: CancellationToken): Promise<void>;
3542
- /**
3543
- * Waits for the model to be ready to be disposed. There may be conditions
3544
- * under which the model cannot be disposed, e.g. when it is dirty. Once the
3545
- * promise is settled, it is safe to dispose the model.
3546
- */
3547
- canDispose(model: ITextFileEditorModel): true | Promise<true>;
3548
- }
3549
- interface ITextFileSaveOptions extends ISaveOptions {
3550
- /**
3551
- * Save the file with an attempt to unlock it.
3552
- */
3553
- readonly writeUnlock?: boolean;
3554
- /**
3555
- * Save the file with elevated privileges.
3556
- *
3557
- * Note: This may not be supported in all environments.
3558
- */
3559
- readonly writeElevated?: boolean;
3560
- /**
3561
- * Allows to write to a file even if it has been modified on disk.
3562
- */
3563
- readonly ignoreModifiedSince?: boolean;
3564
- /**
3565
- * If set, will bubble up the error to the caller instead of handling it.
3566
- */
3567
- readonly ignoreErrorHandler?: boolean;
3568
- }
3569
- interface ITextFileSaveAsOptions extends ITextFileSaveOptions {
3570
- /**
3571
- * Optional URI to use as suggested file path to save as.
3572
- */
3573
- readonly suggestedTarget?: URI;
3574
- }
3575
- interface ITextFileResolveOptions {
3576
- /**
3577
- * The contents to use for the model if known. If not
3578
- * provided, the contents will be retrieved from the
3579
- * underlying resource or backup if present.
3580
- */
3581
- readonly contents?: ITextBufferFactory;
3582
- /**
3583
- * Go to file bypassing any cache of the model if any.
3584
- */
3585
- readonly forceReadFromFile?: boolean;
3586
- /**
3587
- * Allow to resolve a model even if we think it is a binary file.
3588
- */
3589
- readonly allowBinary?: boolean;
3590
- /**
3591
- * Context why the model is being resolved.
3592
- */
3593
- readonly reason?: TextFileResolveReason;
3594
- /**
3595
- * If provided, the size of the file will be checked against the limits
3596
- * and an error will be thrown if any limit is exceeded.
3597
- */
3598
- readonly limits?: IFileReadLimits;
3599
- }
3600
- declare const enum EncodingMode {
3601
- /**
3602
- * Instructs the encoding support to encode the object with the provided encoding
3603
- */
3604
- Encode = 0,
3605
- /**
3606
- * Instructs the encoding support to decode the object with the provided encoding
3607
- */
3608
- Decode = 1
3609
- }
3610
- interface IEncodingSupport {
3611
- /**
3612
- * Gets the encoding of the object if known.
3613
- */
3614
- getEncoding(): string | undefined;
3615
- /**
3616
- * Sets the encoding for the object for saving.
3617
- */
3618
- setEncoding(encoding: string, mode: EncodingMode): Promise<void>;
533
+ interface ICommentsConfiguration {
534
+ lineCommentToken?: string;
535
+ blockCommentStartToken?: string;
536
+ blockCommentEndToken?: string;
3619
537
  }
3620
- interface ILanguageSupport {
3621
- /**
3622
- * Sets the language id of the object.
3623
- */
3624
- setLanguageId(languageId: string, source?: string): void;
538
+ declare class LanguageConfigurationServiceChangeEvent {
539
+ readonly languageId: string | undefined;
540
+ constructor(languageId: string | undefined);
541
+ affects(languageId: string): boolean;
3625
542
  }
3626
- interface ITextFileEditorModelSaveEvent extends IWorkingCopySaveEvent {
543
+ interface ILanguageConfigurationService {
544
+ readonly _serviceBrand: undefined;
545
+ onDidChange: Event<LanguageConfigurationServiceChangeEvent>;
3627
546
  /**
3628
- * The resolved stat from the save operation.
547
+ * @param priority Use a higher number for higher priority
3629
548
  */
3630
- readonly stat: IFileStatWithMetadata;
3631
- }
3632
- interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport, ILanguageSupport, IWorkingCopy {
3633
- readonly onDidSave: Event<ITextFileEditorModelSaveEvent>;
3634
- readonly onDidSaveError: Event<void>;
3635
- readonly onDidChangeOrphaned: Event<void>;
3636
- readonly onDidChangeReadonly: Event<void>;
3637
- readonly onDidChangeEncoding: Event<void>;
3638
- hasState(state: TextFileEditorModelState): boolean;
3639
- joinState(state: TextFileEditorModelState.PENDING_SAVE): Promise<void>;
3640
- updatePreferredEncoding(encoding: string | undefined): void;
3641
- save(options?: ITextFileSaveOptions): Promise<boolean>;
3642
- revert(options?: IRevertOptions): Promise<void>;
3643
- resolve(options?: ITextFileResolveOptions): Promise<void>;
3644
- isDirty(): this is IResolvedTextFileEditorModel;
3645
- getLanguageId(): string | undefined;
3646
- isResolved(): this is IResolvedTextFileEditorModel;
3647
- }
3648
- interface IResolvedTextFileEditorModel extends ITextFileEditorModel {
3649
- readonly textEditorModel: ITextModel;
3650
- createSnapshot(): ITextSnapshot;
3651
- }
3652
-
3653
- type ColorIdentifier = string;
3654
- declare const enum ColorTransformType {
3655
- Darken = 0,
3656
- Lighten = 1,
3657
- Transparent = 2,
3658
- Opaque = 3,
3659
- OneOf = 4,
3660
- LessProminent = 5,
3661
- IfDefinedThenElse = 6
3662
- }
3663
- type ColorTransform = {
3664
- op: ColorTransformType.Darken;
3665
- value: ColorValue;
3666
- factor: number;
3667
- } | {
3668
- op: ColorTransformType.Lighten;
3669
- value: ColorValue;
3670
- factor: number;
3671
- } | {
3672
- op: ColorTransformType.Transparent;
3673
- value: ColorValue;
3674
- factor: number;
3675
- } | {
3676
- op: ColorTransformType.Opaque;
3677
- value: ColorValue;
3678
- background: ColorValue;
3679
- } | {
3680
- op: ColorTransformType.OneOf;
3681
- values: readonly ColorValue[];
3682
- } | {
3683
- op: ColorTransformType.LessProminent;
3684
- value: ColorValue;
3685
- background: ColorValue;
3686
- factor: number;
3687
- transparency: number;
3688
- } | {
3689
- op: ColorTransformType.IfDefinedThenElse;
3690
- if: ColorIdentifier;
3691
- then: ColorValue;
3692
- else: ColorValue;
3693
- };
3694
- interface ColorDefaults {
3695
- light: ColorValue | null;
3696
- dark: ColorValue | null;
3697
- hcDark: ColorValue | null;
3698
- hcLight: ColorValue | null;
549
+ register(languageId: string, configuration: LanguageConfiguration, priority?: number): IDisposable;
550
+ getLanguageConfiguration(languageId: string): ResolvedLanguageConfiguration;
3699
551
  }
552
+ declare const ILanguageConfigurationService: ServiceIdentifier<ILanguageConfigurationService>;
3700
553
  /**
3701
- * A Color Value is either a color literal, a reference to an other color or a derived color
3702
- */
3703
- type ColorValue = Color | string | ColorIdentifier | ColorTransform;
3704
- declare function registerColor(id: string, defaults: ColorDefaults | null, description: string, needsTransparency?: boolean, deprecationMessage?: string): ColorIdentifier;
554
+ * Immutable.
555
+ */
556
+ declare class ResolvedLanguageConfiguration {
557
+ readonly languageId: string;
558
+ readonly underlyingConfig: LanguageConfiguration;
559
+ private _brackets;
560
+ private _electricCharacter;
561
+ private readonly _onEnterSupport;
562
+ readonly comments: ICommentsConfiguration | null;
563
+ readonly characterPair: CharacterPairSupport;
564
+ readonly wordDefinition: RegExp;
565
+ readonly indentRulesSupport: IndentRulesSupport | null;
566
+ readonly indentationRules: IndentationRule | undefined;
567
+ readonly foldingRules: FoldingRules;
568
+ readonly bracketsNew: LanguageBracketsConfiguration;
569
+ constructor(languageId: string, underlyingConfig: LanguageConfiguration);
570
+ getWordDefinition(): RegExp;
571
+ get brackets(): RichEditBrackets | null;
572
+ get electricCharacter(): BracketElectricCharacterSupport | null;
573
+ onEnter(autoIndent: EditorAutoIndentStrategy, previousLineText: string, beforeEnterText: string, afterEnterText: string): EnterAction | null;
574
+ getAutoClosingPairs(): AutoClosingPairs;
575
+ getAutoCloseBeforeSet(forQuotes: boolean): string;
576
+ getSurroundingPairs(): IAutoClosingPair[];
577
+ private static _handleComments;
578
+ }
3705
579
 
3706
580
  interface LanguageFilter {
3707
581
  readonly language?: string;
@@ -3780,4 +654,4 @@ interface ILanguageFeaturesService {
3780
654
  setNotebookTypeResolver(resolver: NotebookInfoResolver | undefined): void;
3781
655
  }
3782
656
 
3783
- export { INotificationHandle as A, IPromptChoice as B, CommandsRegistry as C, IPromptChoiceWithMenu as D, IPromptOptions as E, FoldingRangeProvider as F, IStatusMessageOptions as G, NoOpNotification as H, ILanguageFeaturesService as I, NoOpProgress as J, LanguageFeatureRegistry as L, NotificationsFilter as N, SubmenuAction as S, TextEdit as T, WorkspaceEdit as W, ILanguageConfigurationService as a, INotificationService as b, ITextFileEditorModel as c, ILanguageIdCodec as d, IAction as e, ICommandService as f, ColorIdentifier as g, Color as h, LanguageSelector as i, Command as j, IInplaceReplaceSupportResult as k, WorkspaceEditMetadata as l, IActionRunner as m, IMarkerService as n, ITextFileService as o, IWorkingCopyFileService as p, NotificationMessage as q, registerColor as r, NotificationPriority as s, INotificationProperties as t, NeverShowAgainScope as u, INeverShowAgainOptions as v, INotification as w, INotificationActions as x, INotificationProgress as y, INotificationProgressProperties as z };
657
+ export { ILanguageFeaturesService as I, LanguageFeatureRegistry as L, ILanguageConfigurationService as a, LanguageSelector as b };