-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvscode.d.ts
14420 lines (12799 loc) · 515 KB
/
vscode.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module vscode {
/**
* Visual Studio Code 的版本。
*/
export const version: string;
/**
* 表示对命令的引用。提供一个标题,该标题将用于在 UI 中表示命令,
* 并且可以选择性地提供一个数组,该数组将在调用命令处理程序函数时传递给该命令处理程序函数。
*
* @maintainer {@link https://youngjuning.js.org @youngjuning}
*/
export interface Command {
/**
* 命令的标题,如 `save`。
*/
title: string;
/**
* 命令的标识符
* @see {@link commands.registerCommand}
*/
command: string;
/**
* 命令的提示信息,当命令显示在 UI 中时,会显示在提示信息中。
*/
tooltip?: string;
/**
* 命令处理程序被调用时,会把这些参数传入。
*/
arguments?: any[];
}
/**
* 表示一行文本,例如源代码中的一行。
*
* TextLine 对象是 __immutable__ 的。当 {@link TextDocument document} 改变时,
* 之前获取的行将不会表示最新的状态。
*
* @maintainer {@link https://youngjuning.js.org @youngjuning}
*/
export interface TextLine {
/**
* 行号,从 0 开始。
*/
readonly lineNumber: number;
/**
* 这一行的文本,不包含行分隔符。
*/
readonly text: string;
/**
* 这一行的范围,不包含行分隔符。
*/
readonly range: Range;
/**
* 这一行的范围,包含行分隔符。
*/
readonly rangeIncludingLineBreak: Range;
/**
* 第一个非空白字符的偏移量,如果这一行是空白的(`/\s/`),那么返回这一行的长度。
*/
readonly firstNonWhitespaceCharacterIndex: number;
/**
* 这一行是否是空白的,即 `/\s/`。
* {@link TextLine.firstNonWhitespaceCharacterIndex} === {@link TextLine.text TextLine.text.length}。
*/
readonly isEmptyOrWhitespace: boolean;
}
/**
* 表示文本文档,例如源文件。文本文档有 {@link TextLine lines} 和关于底层资源(如文件)的知识。
*
* @maintainer {@link https://youngjuning.js.org @youngjuning}
*/
export interface TextDocument {
/**
* 与此文档关联的 uri。
*
* *注意* 大多数文档使用 `file`-scheme,这意味着它们是磁盘上的文件。但是,**并非**所有文档都保存在磁盘上,
* 因此在尝试访问底层文件或磁盘上的兄弟文件之前,必须检查 `scheme`。
*
* @see {@link FileSystemProvider}
* @see {@link TextDocumentContentProvider}
*/
readonly uri: Uri;
/**
* 与此文档关联的资源的文件系统路径。{@link TextDocument.uri TextDocument.uri.fsPath} 的简写。
* 独立于 uri scheme。
*/
readonly fileName: string;
/**
* 这个文档是否表示尚未保存的未命名文件。*注意*,这并不意味着文档将被保存到磁盘上,
* 使用 {@linkcode Uri.scheme} 来找出文档将被 {@link FileSystemProvider saved} 的位置,例如 `file`、`ftp` 等。
*/
readonly isUntitled: boolean;
/**
* 与此文档关联的语言的标识符。
*/
readonly languageId: string;
/**
* 此文档的版本号(每次更改后都会严格增加,包括撤消/重做)。
*/
readonly version: number;
/**
* 如果有未持久化的更改则为 `true`。
*/
readonly isDirty: boolean;
/**
* 如果文档已关闭,则为 `true`。已关闭的文档不再同步,并且当再次打开相同的资源时,不会复用它。
*/
readonly isClosed: boolean;
/**
* 保存底层文件。
*
* @return 一个 promise,当文件保存时会 resolve 为 `true`。如果文件没有被修改或保存失败,则会返回 `false`。
*/
save(): Thenable<boolean>;
/**
* 这个文档中主要使用的 {@link EndOfLine end of line} 序列。
*/
readonly eol: EndOfLine;
/**
* 这个文档中的行数。
*/
readonly lineCount: number;
/**
* 返回由行号表示的文本行。请注意,返回的对象*不是*实时的,对文档的更改不会反映在其中。
*
* @param line 行号 [0, lineCount)。
* @return 一个 {@link TextLine line}。
*/
lineAt(line: number): TextLine;
/**
* 返回由位置表示的文本行。请注意,返回的对象*不是*实时的,对文档的更改不会反映在其中。
*
* 位置将被 {@link TextDocument.validatePosition adjusted}。
*
* @see {@link TextDocument.lineAt}
*
* @param position 一个位置。
* @return 一个 {@link TextLine line}。
*/
lineAt(position: Position): TextLine;
/**
* 将位置转换为基于 0 的偏移量。
*
* 位置将被 {@link TextDocument.validatePosition adjusted}。
*
* @param position 一个位置。
* @return 一个有效的基于 0 的偏移量。
*/
offsetAt(position: Position): number;
/**
* 将基于 0 的偏移量转换为位置。
*
* @param offset 一个基于 0 的偏移量。
* @return 一个有效的 {@link Position}。
*/
positionAt(offset: number): Position;
/**
* 获取此文档的文本。可以通过提供范围来检索子字符串。范围将被 {@link TextDocument.validateRange adjusted}。
*/
getText(range?: Range): string;
/**
* 获取给定位置的单词范围。默认情况下,单词由常见分隔符定义,例如空格、-、_ 等。
* 此外,可以定义每种语言的自定义 [单词定义]。还可以提供自定义正则表达式。
*
* * *注意 1:* 自定义正则表达式不得匹配空字符串,如果它这样做了,它将被忽略。
*
* * *注意 2:* 自定义正则表达式将无法匹配多行字符串,为了速度,正则表达式不应该匹配带有空格的单词。使用 {@linkcode TextLine.text} 以获取更复杂、非单词的场景。
*
* 位置将被 {@link TextDocument.validatePosition adjusted}。
*
* @param position 一个位置。
* @param regex 可选的正则表达式,描述了单词是什么。
* @return 一个范围,包含一个单词,或 `undefined`。
*/
getWordRangeAtPosition(position: Position, regex?: RegExp): Range | undefined;
/**
* 确保范围完全包含在此文档中。
*
* @param range 一个范围。
* @return 给定的范围或一个新的、调整过的范围。
*/
validateRange(range: Range): Range;
/**
* 确保位置包含在此文档的范围内。
*
* @param position 一个位置。
* @return 给定的位置或一个新的、调整过的位置。
*/
validatePosition(position: Position): Position;
}
/**
* 表示行和字符位置,例如光标的位置。
*
* Position 对象是不可变的。使用 {@link Position.with with} 或 {@link Position.translate translate} 方法从现有位置派生新位置。
*
* @maintainer {@link https://youngjuning.js.org @youngjuning}
*/
export class Position {
/**
* 基于零的行值。
*/
readonly line: number;
/**
* 基于零的字符值。
*/
readonly character: number;
/**
* @param line 基于零的行值。
* @param character 基于零的字符值。
*/
constructor(line: number, character: number);
/**
* 检查此位置是否在 `other` 之前。
*
* @param other 一个位置。
* @return 如果此位置在较小的行或在相同行但较小的字符上,则为 `true`。
*/
isBefore(other: Position): boolean;
/**
* 检查此位置是否在 `other` 之前或与其相等。
*
* @param other 一个位置。
* @return 如果位置在较小的行上,或者在相同的行上但在较小或相等的字符上,则返回 `true`。
*/
isBeforeOrEqual(other: Position): boolean;
/**
* 检查此位置是否在 other 之后。
*
* @param other 表示另一个位置。
* @return 如果该位置在更大的行上,或者在相同的行上但在更大的字符上,则返回 `true` 。
*/
isAfter(other: Position): boolean;
/**
* 检查此位置是否在 other 之后或相等。
*
* @param other 表示另一个位置。
* @return 如果该位置在更大的行上,或者在相同的行上但在更大或相等的字符上,则返回 true 。
*/
isAfterOrEqual(other: Position): boolean;
/**
* 检查此位置是否等于 other。
* @param other 表示另一个位置。
* @return 如果给定位置的行号和字符数与该位置的行号和字符数相等,则返回 true。
*/
isEqual(other: Position): boolean;
/**
* 将此位置与 `other` 比较。
*
* @param other 表示另一个位置。
* @return 如果此位置在给定位置之前,则返回一个小于零的数;如果此位置在给定位置之后,则返回一个大于零的数;如果此位置和给定位置相同,则返回零。
*/
compareTo(other: Position): number;
/**
* 创建一个相对于当前位置的新位置。
*
* @param lineDelta 表示行值(line value)的增量,缺省值是 `0`。
* @param characterDelta 表示列值(character value)的增量,缺省值是 `0`。
* @return 返回值为一个新的位置对象,该对象的行号和列号分别是当前位置的行号和列号加上相应的增量。
*/
translate(lineDelta?: number, characterDelta?: number): Position;
/**
* 这是一个关于位置操作的函数。
*
* @param change 是一个描述相对于当前位置的变化量的对象。
* @return 一个位置对象,它代表给定变化量所反映出的新位置。如果没有任何变化,则返回 `this` 位置对象。
*/
translate(change: { lineDelta?: number; characterDelta?: number; }): Position;
/**
* 这是一个用于创建新位置的函数。
*
* @param line 是一个可选参数,用于指定新位置的行数。如果未提供,则使用 {@link Position.line existing value}
* @param character 是另一个可选参数,用于指定新位置的列数。如果未提供则使用 {@link Position.character existing value}
* @return 一个新的位置对象,其中给定的行和列数替代了当前位置的对应属性值。
*/
with(line?: number, character?: number): Position;
/**
* 这是一个用于从当前位置创建新位置的函数。
*
* @param change 是一个对象,用于描述应用到当前位置的更改。
* @return 一个新的位置对象,其中反映了给定更改所造成的位置变化。如果更改不会改变任何位置,则返回 `this` 位置对象本身。
*/
with(change: { line?: number; character?: number; }): Position;
}
/**
* 表示两个位置之间的文本范围。
*
* 请注意,范围是不可变的。使用 {@link Range.with with} 或 {@link Range.intersection intersection}、{@link Range.union union} 方法从现有范围派生新范围。
*
* @maintainer {@link https://youngjuning.js.org @youngjuning}
*/
export class Range {
/**
* The start position. It is before or equal to {@link Range.end end}.
*/
readonly start: Position;
/**
* The end position. It is after or equal to {@link Range.start start}.
*/
readonly end: Position;
/**
* Create a new range from two positions. If `start` is not
* before or equal to `end`, the values will be swapped.
*
* @param start A position.
* @param end A position.
*/
constructor(start: Position, end: Position);
/**
* Create a new range from number coordinates. It is a shorter equivalent of
* using `new Range(new Position(startLine, startCharacter), new Position(endLine, endCharacter))`
*
* @param startLine A zero-based line value.
* @param startCharacter A zero-based character value.
* @param endLine A zero-based line value.
* @param endCharacter A zero-based character value.
*/
constructor(startLine: number, startCharacter: number, endLine: number, endCharacter: number);
/**
* `true` if `start` and `end` are equal.
*/
isEmpty: boolean;
/**
* `true` if `start.line` and `end.line` are equal.
*/
isSingleLine: boolean;
/**
* Check if a position or a range is contained in this range.
*
* @param positionOrRange A position or a range.
* @return `true` if the position or range is inside or equal
* to this range.
*/
contains(positionOrRange: Position | Range): boolean;
/**
* Check if `other` equals this range.
*
* @param other A range.
* @return `true` when start and end are {@link Position.isEqual equal} to
* start and end of this range.
*/
isEqual(other: Range): boolean;
/**
* Intersect `range` with this range and returns a new range or `undefined`
* if the ranges have no overlap.
*
* @param range A range.
* @return A range of the greater start and smaller end positions. Will
* return undefined when there is no overlap.
*/
intersection(range: Range): Range | undefined;
/**
* Compute the union of `other` with this range.
*
* @param other A range.
* @return A range of smaller start position and the greater end position.
*/
union(other: Range): Range;
/**
* Derived a new range from this range.
*
* @param start A position that should be used as start. The default value is the {@link Range.start current start}.
* @param end A position that should be used as end. The default value is the {@link Range.end current end}.
* @return A range derived from this range with the given start and end position.
* If start and end are not different `this` range will be returned.
*/
with(start?: Position, end?: Position): Range;
/**
* Derived a new range from this range.
*
* @param change An object that describes a change to this range.
* @return A range that reflects the given change. Will return `this` range if the change
* is not changing anything.
*/
with(change: { start?: Position, end?: Position }): Range;
}
/**
* Represents a text selection in an editor.
*/
export class Selection extends Range {
/**
* The position at which the selection starts.
* This position might be before or after {@link Selection.active active}.
*/
anchor: Position;
/**
* The position of the cursor.
* This position might be before or after {@link Selection.anchor anchor}.
*/
active: Position;
/**
* Create a selection from two positions.
*
* @param anchor A position.
* @param active A position.
*/
constructor(anchor: Position, active: Position);
/**
* Create a selection from four coordinates.
*
* @param anchorLine A zero-based line value.
* @param anchorCharacter A zero-based character value.
* @param activeLine A zero-based line value.
* @param activeCharacter A zero-based character value.
*/
constructor(anchorLine: number, anchorCharacter: number, activeLine: number, activeCharacter: number);
/**
* A selection is reversed if {@link Selection.active active}.isBefore({@link Selection.anchor anchor}).
*/
isReversed: boolean;
}
/**
* Represents sources that can cause {@link window.onDidChangeTextEditorSelection selection change events}.
*/
export enum TextEditorSelectionChangeKind {
/**
* Selection changed due to typing in the editor.
*/
Keyboard = 1,
/**
* Selection change due to clicking in the editor.
*/
Mouse = 2,
/**
* Selection changed because a command ran.
*/
Command = 3
}
/**
* Represents an event describing the change in a {@link TextEditor.selections text editor's selections}.
*/
export interface TextEditorSelectionChangeEvent {
/**
* The {@link TextEditor text editor} for which the selections have changed.
*/
readonly textEditor: TextEditor;
/**
* The new value for the {@link TextEditor.selections text editor's selections}.
*/
readonly selections: readonly Selection[];
/**
* The {@link TextEditorSelectionChangeKind change kind} which has triggered this
* event. Can be `undefined`.
*/
readonly kind?: TextEditorSelectionChangeKind;
}
/**
* Represents an event describing the change in a {@link TextEditor.visibleRanges text editor's visible ranges}.
*/
export interface TextEditorVisibleRangesChangeEvent {
/**
* The {@link TextEditor text editor} for which the visible ranges have changed.
*/
readonly textEditor: TextEditor;
/**
* The new value for the {@link TextEditor.visibleRanges text editor's visible ranges}.
*/
readonly visibleRanges: readonly Range[];
}
/**
* Represents an event describing the change in a {@link TextEditor.options text editor's options}.
*/
export interface TextEditorOptionsChangeEvent {
/**
* The {@link TextEditor text editor} for which the options have changed.
*/
readonly textEditor: TextEditor;
/**
* The new value for the {@link TextEditor.options text editor's options}.
*/
readonly options: TextEditorOptions;
}
/**
* Represents an event describing the change of a {@link TextEditor.viewColumn text editor's view column}.
*/
export interface TextEditorViewColumnChangeEvent {
/**
* The {@link TextEditor text editor} for which the view column has changed.
*/
readonly textEditor: TextEditor;
/**
* The new value for the {@link TextEditor.viewColumn text editor's view column}.
*/
readonly viewColumn: ViewColumn;
}
/**
* Rendering style of the cursor.
*/
export enum TextEditorCursorStyle {
/**
* Render the cursor as a vertical thick line.
*/
Line = 1,
/**
* Render the cursor as a block filled.
*/
Block = 2,
/**
* Render the cursor as a thick horizontal line.
*/
Underline = 3,
/**
* Render the cursor as a vertical thin line.
*/
LineThin = 4,
/**
* Render the cursor as a block outlined.
*/
BlockOutline = 5,
/**
* Render the cursor as a thin horizontal line.
*/
UnderlineThin = 6
}
/**
* Rendering style of the line numbers.
*/
export enum TextEditorLineNumbersStyle {
/**
* Do not render the line numbers.
*/
Off = 0,
/**
* Render the line numbers.
*/
On = 1,
/**
* Render the line numbers with values relative to the primary cursor location.
*/
Relative = 2
}
/**
* Represents a {@link TextEditor text editor}'s {@link TextEditor.options options}.
*/
export interface TextEditorOptions {
/**
* The size in spaces a tab takes. This is used for two purposes:
* - the rendering width of a tab character;
* - the number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true.
*
* When getting a text editor's options, this property will always be a number (resolved).
* When setting a text editor's options, this property is optional and it can be a number or `"auto"`.
*/
tabSize?: number | string;
/**
* When pressing Tab insert {@link TextEditorOptions.tabSize n} spaces.
* When getting a text editor's options, this property will always be a boolean (resolved).
* When setting a text editor's options, this property is optional and it can be a boolean or `"auto"`.
*/
insertSpaces?: boolean | string;
/**
* The rendering style of the cursor in this editor.
* When getting a text editor's options, this property will always be present.
* When setting a text editor's options, this property is optional.
*/
cursorStyle?: TextEditorCursorStyle;
/**
* Render relative line numbers w.r.t. the current line number.
* When getting a text editor's options, this property will always be present.
* When setting a text editor's options, this property is optional.
*/
lineNumbers?: TextEditorLineNumbersStyle;
}
/**
* Represents a handle to a set of decorations
* sharing the same {@link DecorationRenderOptions styling options} in a {@link TextEditor text editor}.
*
* To get an instance of a `TextEditorDecorationType` use
* {@link window.createTextEditorDecorationType createTextEditorDecorationType}.
*/
export interface TextEditorDecorationType {
/**
* Internal representation of the handle.
*/
readonly key: string;
/**
* Remove this decoration type and all decorations on all text editors using it.
*/
dispose(): void;
}
/**
* Represents different {@link TextEditor.revealRange reveal} strategies in a text editor.
*/
export enum TextEditorRevealType {
/**
* The range will be revealed with as little scrolling as possible.
*/
Default = 0,
/**
* The range will always be revealed in the center of the viewport.
*/
InCenter = 1,
/**
* If the range is outside the viewport, it will be revealed in the center of the viewport.
* Otherwise, it will be revealed with as little scrolling as possible.
*/
InCenterIfOutsideViewport = 2,
/**
* The range will always be revealed at the top of the viewport.
*/
AtTop = 3
}
/**
* Represents different positions for rendering a decoration in an {@link DecorationRenderOptions.overviewRulerLane overview ruler}.
* The overview ruler supports three lanes.
*/
export enum OverviewRulerLane {
Left = 1,
Center = 2,
Right = 4,
Full = 7
}
/**
* Describes the behavior of decorations when typing/editing at their edges.
*/
export enum DecorationRangeBehavior {
/**
* The decoration's range will widen when edits occur at the start or end.
*/
OpenOpen = 0,
/**
* The decoration's range will not widen when edits occur at the start of end.
*/
ClosedClosed = 1,
/**
* The decoration's range will widen when edits occur at the start, but not at the end.
*/
OpenClosed = 2,
/**
* The decoration's range will widen when edits occur at the end, but not at the start.
*/
ClosedOpen = 3
}
/**
* Represents options to configure the behavior of showing a {@link TextDocument document} in an {@link TextEditor editor}.
*/
export interface TextDocumentShowOptions {
/**
* An optional view column in which the {@link TextEditor editor} should be shown.
* The default is the {@link ViewColumn.Active active}, other values are adjusted to
* be `Min(column, columnCount + 1)`, the {@link ViewColumn.Active active}-column is
* not adjusted. Use {@linkcode ViewColumn.Beside} to open the
* editor to the side of the currently active one.
*/
viewColumn?: ViewColumn;
/**
* An optional flag that when `true` will stop the {@link TextEditor editor} from taking focus.
*/
preserveFocus?: boolean;
/**
* An optional flag that controls if an {@link TextEditor editor}-tab will be replaced
* with the next editor or if it will be kept.
*/
preview?: boolean;
/**
* An optional selection to apply for the document in the {@link TextEditor editor}.
*/
selection?: Range;
}
/**
* A reference to one of the workbench colors as defined in https://code.visualstudio.com/docs/getstarted/theme-color-reference.
* Using a theme color is preferred over a custom color as it gives theme authors and users the possibility to change the color.
*/
export class ThemeColor {
/**
* Creates a reference to a theme color.
* @param id of the color. The available colors are listed in https://code.visualstudio.com/docs/getstarted/theme-color-reference.
*/
constructor(id: string);
}
/**
* A reference to a named icon. Currently, {@link ThemeIcon.File File}, {@link ThemeIcon.Folder Folder},
* and [ThemeIcon ids](https://code.visualstudio.com/api/references/icons-in-labels#icon-listing) are supported.
* Using a theme icon is preferred over a custom icon as it gives product theme authors the possibility to change the icons.
*
* *Note* that theme icons can also be rendered inside labels and descriptions. Places that support theme icons spell this out
* and they use the `$(<name>)`-syntax, for instance `quickPick.label = "Hello World $(globe)"`.
*/
export class ThemeIcon {
/**
* Reference to an icon representing a file. The icon is taken from the current file icon theme or a placeholder icon is used.
*/
static readonly File: ThemeIcon;
/**
* Reference to an icon representing a folder. The icon is taken from the current file icon theme or a placeholder icon is used.
*/
static readonly Folder: ThemeIcon;
/**
* The id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
*/
readonly id: string;
/**
* The optional ThemeColor of the icon. The color is currently only used in {@link TreeItem}.
*/
readonly color?: ThemeColor;
/**
* Creates a reference to a theme icon.
* @param id id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
* @param color optional `ThemeColor` for the icon. The color is currently only used in {@link TreeItem}.
*/
constructor(id: string, color?: ThemeColor);
}
/**
* Represents theme specific rendering styles for a {@link TextEditorDecorationType text editor decoration}.
*/
export interface ThemableDecorationRenderOptions {
/**
* Background color of the decoration. Use rgba() and define transparent background colors to play well with other decorations.
* Alternatively a color from the color registry can be {@link ThemeColor referenced}.
*/
backgroundColor?: string | ThemeColor;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
outline?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'outline' for setting one or more of the individual outline properties.
*/
outlineColor?: string | ThemeColor;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'outline' for setting one or more of the individual outline properties.
*/
outlineStyle?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'outline' for setting one or more of the individual outline properties.
*/
outlineWidth?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
border?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'border' for setting one or more of the individual border properties.
*/
borderColor?: string | ThemeColor;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'border' for setting one or more of the individual border properties.
*/
borderRadius?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'border' for setting one or more of the individual border properties.
*/
borderSpacing?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'border' for setting one or more of the individual border properties.
*/
borderStyle?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
* Better use 'border' for setting one or more of the individual border properties.
*/
borderWidth?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
fontStyle?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
fontWeight?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
textDecoration?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
cursor?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
color?: string | ThemeColor;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
opacity?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
letterSpacing?: string;
/**
* An **absolute path** or an URI to an image to be rendered in the gutter.
*/
gutterIconPath?: string | Uri;
/**
* Specifies the size of the gutter icon.
* Available values are 'auto', 'contain', 'cover' and any percentage value.
* For further information: https://msdn.microsoft.com/en-us/library/jj127316(v=vs.85).aspx
*/
gutterIconSize?: string;
/**
* The color of the decoration in the overview ruler. Use rgba() and define transparent colors to play well with other decorations.
*/
overviewRulerColor?: string | ThemeColor;
/**
* Defines the rendering options of the attachment that is inserted before the decorated text.
*/
before?: ThemableDecorationAttachmentRenderOptions;
/**
* Defines the rendering options of the attachment that is inserted after the decorated text.
*/
after?: ThemableDecorationAttachmentRenderOptions;
}
export interface ThemableDecorationAttachmentRenderOptions {
/**
* Defines a text content that is shown in the attachment. Either an icon or a text can be shown, but not both.
*/
contentText?: string;
/**
* An **absolute path** or an URI to an image to be rendered in the attachment. Either an icon
* or a text can be shown, but not both.
*/
contentIconPath?: string | Uri;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
border?: string;
/**
* CSS styling property that will be applied to text enclosed by a decoration.
*/
borderColor?: string | ThemeColor;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
fontStyle?: string;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
fontWeight?: string;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
textDecoration?: string;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
color?: string | ThemeColor;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
backgroundColor?: string | ThemeColor;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
margin?: string;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
width?: string;
/**
* CSS styling property that will be applied to the decoration attachment.
*/
height?: string;
}
/**
* Represents rendering styles for a {@link TextEditorDecorationType text editor decoration}.
*/
export interface DecorationRenderOptions extends ThemableDecorationRenderOptions {
/**
* Should the decoration be rendered also on the whitespace after the line text.
* Defaults to `false`.
*/
isWholeLine?: boolean;
/**
* Customize the growing behavior of the decoration when edits occur at the edges of the decoration's range.
* Defaults to `DecorationRangeBehavior.OpenOpen`.
*/
rangeBehavior?: DecorationRangeBehavior;
/**
* The position in the overview ruler where the decoration should be rendered.
*/