Skip to content

Commit 9ad0ef5

Browse files
committed
Update Language static configuration
1 parent cfd482d commit 9ad0ef5

File tree

5 files changed

+254
-430
lines changed

5 files changed

+254
-430
lines changed

language-configuration.json

Lines changed: 152 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,153 @@
11
{
2-
// Note that this file should stay in sync with 'javascript-language-basics/javascript-language-configuration.json'
3-
"comments": {
4-
"lineComment": "//",
5-
"blockComment": [
6-
"/*",
7-
"*/"
8-
]
9-
},
10-
"brackets": [
11-
[
12-
"${",
13-
"}"
14-
],
15-
[
16-
"{",
17-
"}"
18-
],
19-
[
20-
"[",
21-
"]"
22-
],
23-
[
24-
"(",
25-
")"
26-
]
27-
],
28-
"autoClosingPairs": [
29-
{
30-
"open": "{",
31-
"close": "}"
32-
},
33-
{
34-
"open": "[",
35-
"close": "]"
36-
},
37-
{
38-
"open": "(",
39-
"close": ")"
40-
},
41-
{
42-
"open": "'",
43-
"close": "'",
44-
"notIn": [
45-
"string",
46-
"comment"
47-
]
48-
},
49-
{
50-
"open": "\"",
51-
"close": "\"",
52-
"notIn": [
53-
"string"
54-
]
55-
},
56-
{
57-
"open": "`",
58-
"close": "`",
59-
"notIn": [
60-
"string",
61-
"comment"
62-
]
63-
},
64-
{
65-
"open": "/**",
66-
"close": " */",
67-
"notIn": [
68-
"string"
69-
]
70-
}
71-
],
72-
"surroundingPairs": [
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-
"colorizedBracketPairs": [
103-
[
104-
"(",
105-
")"
106-
],
107-
[
108-
"[",
109-
"]"
110-
],
111-
[
112-
"{",
113-
"}"
114-
],
115-
[
116-
"<",
117-
">"
118-
]
119-
],
120-
"autoCloseBefore": ";:.,=}])>` \n\t",
121-
"folding": {
122-
"markers": {
123-
"start": "^\\s*//\\s*#?region\\b",
124-
"end": "^\\s*//\\s*#?endregion\\b"
125-
}
126-
},
127-
"wordPattern": {
128-
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
129-
},
130-
"indentationRules": {
131-
"decreaseIndentPattern": {
132-
"pattern": "^((?!.*?/\\*).*\\*\/)?\\s*[\\}\\]].*$"
133-
},
134-
"increaseIndentPattern": {
135-
"pattern": "^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$"
136-
},
137-
// e.g. * ...| or */| or *-----*/|
138-
"unIndentedLinePattern": {
139-
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
140-
}
141-
},
142-
"onEnterRules": [
143-
{
144-
// e.g. /** | */
145-
"beforeText": {
146-
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
147-
},
148-
"afterText": {
149-
"pattern": "^\\s*\\*/$"
150-
},
151-
"action": {
152-
"indent": "indentOutdent",
153-
"appendText": " * "
154-
}
155-
},
156-
{
157-
// e.g. /** ...|
158-
"beforeText": {
159-
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
160-
},
161-
"action": {
162-
"indent": "none",
163-
"appendText": " * "
164-
}
165-
},
166-
{
167-
// e.g. * ...|
168-
"beforeText": {
169-
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
170-
},
171-
"previousLineText": {
172-
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"
173-
},
174-
"action": {
175-
"indent": "none",
176-
"appendText": "* "
177-
}
178-
},
179-
{
180-
// e.g. */|
181-
"beforeText": {
182-
"pattern": "^(\\t|[ ])*[ ]\\*/\\s*$"
183-
},
184-
"action": {
185-
"indent": "none",
186-
"removeText": 1
187-
},
188-
},
189-
{
190-
// e.g. *-----*/|
191-
"beforeText": {
192-
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$"
193-
},
194-
"action": {
195-
"indent": "none",
196-
"removeText": 1
197-
},
198-
},
199-
{
200-
"beforeText": {
201-
"pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$"
202-
},
203-
"afterText": {
204-
"pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))"
205-
},
206-
"action": {
207-
"indent": "indent"
208-
}
209-
}
210-
]
211-
}
2+
// Note that this file should stay in sync with 'javascript-language-basics/javascript-language-configuration.json'
3+
"comments": {
4+
"lineComment": "//",
5+
"blockComment": ["/*", "*/"]
6+
},
7+
"brackets": [
8+
["${", "}"],
9+
["{", "}"],
10+
["[", "]"],
11+
["(", ")"]
12+
],
13+
"autoClosingPairs": [
14+
{
15+
"open": "{",
16+
"close": "}"
17+
},
18+
{
19+
"open": "[",
20+
"close": "]"
21+
},
22+
{
23+
"open": "(",
24+
"close": ")"
25+
},
26+
{
27+
"open": "'",
28+
"close": "'",
29+
"notIn": ["string", "comment"]
30+
},
31+
{
32+
"open": "\"",
33+
"close": "\"",
34+
"notIn": ["string"]
35+
},
36+
{
37+
"open": "`",
38+
"close": "`",
39+
"notIn": ["string", "comment"]
40+
},
41+
{
42+
"open": "/**",
43+
"close": " */",
44+
"notIn": ["string"]
45+
}
46+
],
47+
"surroundingPairs": [
48+
["{", "}"],
49+
["[", "]"],
50+
["(", ")"],
51+
["'", "'"],
52+
["\"", "\""],
53+
["`", "`"],
54+
["<", ">"]
55+
],
56+
"colorizedBracketPairs": [
57+
["(", ")"],
58+
["[", "]"],
59+
["{", "}"],
60+
["<", ">"]
61+
],
62+
"autoCloseBefore": ";:.,=}])>` \n\t",
63+
"folding": {
64+
"markers": {
65+
"start": "^\\s*//\\s*#?region\\b",
66+
"end": "^\\s*//\\s*#?endregion\\b"
67+
}
68+
},
69+
"wordPattern": {
70+
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)"
71+
},
72+
"indentationRules": {
73+
"decreaseIndentPattern": {
74+
"pattern": "^((?!.*?/\\*).*\\*/)?\\s*[\\}\\]].*$"
75+
},
76+
"increaseIndentPattern": {
77+
"pattern": "^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$"
78+
},
79+
// e.g. * ...| or */| or *-----*/|
80+
"unIndentedLinePattern": {
81+
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
82+
}
83+
},
84+
"onEnterRules": [
85+
{
86+
// e.g. /** | */
87+
"beforeText": {
88+
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
89+
},
90+
"afterText": {
91+
"pattern": "^\\s*\\*/$"
92+
},
93+
"action": {
94+
"indent": "indentOutdent",
95+
"appendText": " * "
96+
}
97+
},
98+
{
99+
// e.g. /** ...|
100+
"beforeText": {
101+
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
102+
},
103+
"action": {
104+
"indent": "none",
105+
"appendText": " * "
106+
}
107+
},
108+
{
109+
// e.g. * ...|
110+
"beforeText": {
111+
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
112+
},
113+
"previousLineText": {
114+
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"
115+
},
116+
"action": {
117+
"indent": "none",
118+
"appendText": "* "
119+
}
120+
},
121+
{
122+
// e.g. */|
123+
"beforeText": {
124+
"pattern": "^(\\t|[ ])*[ ]\\*/\\s*$"
125+
},
126+
"action": {
127+
"indent": "none",
128+
"removeText": 1
129+
}
130+
},
131+
{
132+
// e.g. *-----*/|
133+
"beforeText": {
134+
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$"
135+
},
136+
"action": {
137+
"indent": "none",
138+
"removeText": 1
139+
}
140+
},
141+
{
142+
"beforeText": {
143+
"pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$"
144+
},
145+
"afterText": {
146+
"pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))"
147+
},
148+
"action": {
149+
"indent": "indent"
150+
}
151+
}
152+
]
153+
}

server/src/completion.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import {
55
} from 'vscode-languageserver/node.js';
66
import { documentation } from './information/documentation.js';
77
import { details } from './information/details.js';
8-
import { components } from './types/keywords.js';
8+
import { allKeywords, components, keywords } from './types/keywords.js';
99

1010
export class CompletionItemProvider {
1111
public static onCompletion(_textDocumentPosition: TextDocumentPositionParams) {
12-
const keywordsList = Object.keys(components);
13-
return keywordsList.map((symbol) => ({
12+
return allKeywords.map((symbol) => ({
1413
label: symbol,
1514
kind: CompletionItemKind.Keyword,
1615
data: 1,

server/src/lsp-connection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ export class LspConnection {
3636

3737
// Listen on the connection
3838
public listen() {
39+
// Make the text document manager listen on the connection
40+
// for open, change and close text document events
3941
this.documents.listen(this.connection);
42+
// Listen on the connection
4043
this.connection.listen();
4144
}
4245
}

0 commit comments

Comments
 (0)