Skip to content

Commit a5c5db1

Browse files
jasonplattsgitbook-bot
authored andcommitted
GitBook: [#19] Added content to the API Reference section.
1 parent ec9b307 commit a5c5db1

File tree

9 files changed

+221
-10
lines changed

9 files changed

+221
-10
lines changed

Diff for: .gitbook/assets/file.drawing.svg

+3-3
Loading

Diff for: SUMMARY.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111

1212
## Guides
1313

14-
* [Building a Language Extension](guides/building-a-language-extension.md)
14+
* [Building a Completion Extension](guides/building-a-completion-extension.md)
1515
* [Building a Treeview Extension](guides/building-a-treeview-extension.md)
1616
* [Creating a Custom UI](guides/creating-a-custom-ui.md)
1717

1818
## API Reference
1919

2020
* [API Object Model](api-reference/api-object-model.md)
21-
* [Editor](api-reference/editor.md)
21+
* [TextEditor](api-reference/texteditor/README.md)
22+
* [TextEdit](api-reference/texteditor/textedit.md)
23+
* [Range](api-reference/texteditor/range.md)
2224
* [Completion Provider](api-reference/completion-provider.md)
2325
* [Context](api-reference/context.md)
2426
* [Scope](api-reference/scope.md)

Diff for: api-reference/completion-provider.md

+111-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,118 @@ It is expected that every `CompletionProvider` class include a `provideCompletio
2828

2929
In the case of the `CompletionProvider`, the `provideCompletionItems` method will be called each time the user types in the editor while the [activation event](../activation-events.md) conditions are met. CodeEdit will then determine the relevant suggestions.
3030

31-
The `provideCompletionItems` method expects an [editor](editor.md) and [context](context.md) as arguments. These objects provide the extension with information about the state when a completion is triggered, including the [scope](scope.md) of the current cursor position.
31+
The `provideCompletionItems` method expects an [editor](texteditor/textedit.md) and [context](context.md) as arguments. These objects provide the extension with information about the state when a completion is triggered, including the [scope](scope.md) of the current cursor position.
3232

33+
{% hint style="info" %}
3334
Using the [context](context.md) object, additional completion criteria can be defined by limiting the results returned by the provideCompletionItems method based on the current context. For example, a completion suggestion that is a CSS class name, should only be returned when the current context is within a valid HTML class attribute.
35+
{% endhint %}
3436

35-
## CompletionItem Interface
37+
## CompletionItem
3638

39+
### Constructor
40+
41+
`new CompletionItem(label: string, kind?:` [`CompletionItemKind`](completion-provider.md#undefined)`): CompletionItem`
42+
43+
Instantiates a new completion item object.
44+
45+
Completion items must have a label that is used as the default insert text as well as for sorting and filtering of completion suggestions.
46+
47+
### Properties
48+
49+
<details>
50+
51+
<summary>additionalTextEdits?: TextEdit[]</summary>
52+
53+
An array of additional text edits that should be applied when the completion is selected. _Edits must not overlap._
54+
55+
</details>
56+
57+
<details>
58+
59+
<summary>command?: Command</summary>
60+
61+
A command that should be executed after insertion of the selected completion.
62+
63+
</details>
64+
65+
<details>
66+
67+
<summary>commitCharacters?: string[]</summary>
68+
69+
70+
71+
</details>
72+
73+
<details>
74+
75+
<summary>detail?: string</summary>
76+
77+
78+
79+
</details>
80+
81+
<details>
82+
83+
<summary>documentation?: string | MarkdownString</summary>
84+
85+
86+
87+
</details>
88+
89+
<details>
90+
91+
<summary>filterText?: string</summary>
92+
93+
94+
95+
</details>
96+
97+
<details>
98+
99+
<summary>insertText?: string</summary>
100+
101+
102+
103+
</details>
104+
105+
<details>
106+
107+
<summary>keepWhitespace?: boolean</summary>
108+
109+
110+
111+
</details>
112+
113+
<details>
114+
115+
<summary>kind?: <a href="completion-provider.md#undefined">CompletionItemKind</a></summary>
116+
117+
118+
119+
</details>
120+
121+
<details>
122+
123+
<summary>label: string</summary>
124+
125+
The label of the completion item. It is also the default text that is inserted if the insertText property is not set.
126+
127+
</details>
128+
129+
<details>
130+
131+
<summary>range?: Range | {inserting: Range, replacing: Range}</summary>
132+
133+
134+
135+
</details>
136+
137+
<details>
138+
139+
<summary>sortText?: string</summary>
140+
141+
142+
143+
</details>
144+
145+
## CompletionItemKind

Diff for: api-reference/editor.md

-2
This file was deleted.

Diff for: api-reference/texteditor/README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# TextEditor
2+
3+
## TextEdit
4+
5+
### Class Methods
6+
7+
<details>
8+
9+
<summary>delete(range: Range): TextEdit</summary>
10+
11+
12+
13+
</details>
14+
15+
<details>
16+
17+
<summary>insert(position: Position, newText: string): TextEdit</summary>
18+
19+
20+
21+
</details>
22+
23+
<details>
24+
25+
<summary>replace(range: Range, newText: string): TextEdit</summary>
26+
27+
28+
29+
</details>
30+
31+
### Constructor
32+
33+
new TextEdit(range: Range, newText: string: TextEdit
34+
35+
### Properties
36+
37+
<details>
38+
39+
<summary>nextText: string</summary>
40+
41+
42+
43+
</details>
44+
45+
<details>
46+
47+
<summary>range: Range</summary>
48+
49+
50+
51+
</details>

Diff for: api-reference/texteditor/range.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Range
2+

Diff for: api-reference/texteditor/textedit.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# TextEdit
2+
3+
## Class Methods
4+
5+
<details>
6+
7+
<summary>delete(range: Range): TextEdit</summary>
8+
9+
10+
11+
</details>
12+
13+
<details>
14+
15+
<summary>insert(position: Position, newText: string): TextEdit</summary>
16+
17+
18+
19+
</details>
20+
21+
<details>
22+
23+
<summary>replace(range: Range, newText: string): TextEdit</summary>
24+
25+
26+
27+
</details>
28+
29+
## Constructor
30+
31+
`new TextEdit(range: Range, newText: string: TextEdit`
32+
33+
## Properties
34+
35+
<details>
36+
37+
<summary>nextText: string</summary>
38+
39+
40+
41+
</details>
42+
43+
<details>
44+
45+
<summary>range: Range</summary>
46+
47+
48+
49+
</details>

Diff for: faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Find answers to commonly asked questions.
88

99
<summary>What languages are supported by the CodeEdit extension architecture?</summary>
1010

11-
CodeEdit supports JavaScript for extension development. React is also supported for the creation of custom interfaces.
11+
CodeEdit supports JavaScript and TypeScript for extension development. React is also supported for the creation of custom interfaces.
1212

1313
</details>
1414

File renamed without changes.

0 commit comments

Comments
 (0)