@lvce-editor/shared-process 0.14.4 → 0.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/builtin.language-basics-coffeescript/src/tokenizeCoffeeScript.js +1 -1
- package/extensions/builtin.language-basics-css/src/tokenizeCss.js +4 -1
- package/extensions/builtin.language-basics-java/src/tokenizeJava.js +110 -10
- package/extensions/builtin.language-basics-ruby/src/tokenizeRuby.js +7 -0
- package/extensions/builtin.theme-atom-one-dark/color-theme.json +3 -0
- package/extensions/builtin.theme-cobalt2/color-theme.json +1 -0
- package/package.json +6 -6
|
@@ -60,7 +60,7 @@ export const TokenMap = {
|
|
|
60
60
|
const RE_LINE_COMMENT = /^#[^\n]*/
|
|
61
61
|
const RE_WHITESPACE = /^\s+/
|
|
62
62
|
const RE_VARIABLE_NAME = /^[\@a-zA-Z\_\$][a-zA-Z\_\/\-\$#\d\-]*/
|
|
63
|
-
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)<>\!\|\+\&\>\)
|
|
63
|
+
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)<>\!\|\+\&\>\)\?\-]/
|
|
64
64
|
const RE_NUMERIC =
|
|
65
65
|
/^((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b/
|
|
66
66
|
const RE_STRING_ESCAPE = /^\\./
|
|
@@ -88,7 +88,7 @@ const RE_SELECTOR_ID = /^#[\w\-\_]+/
|
|
|
88
88
|
const RE_WHITESPACE = /^\s+/
|
|
89
89
|
const RE_CURLY_OPEN = /^\{/
|
|
90
90
|
const RE_CURLY_CLOSE = /^\}/
|
|
91
|
-
const RE_PROPERTY_NAME = /^[a-zA-Z\-\w]
|
|
91
|
+
const RE_PROPERTY_NAME = /^[a-zA-Z\-\w]+/
|
|
92
92
|
const RE_COLON = /^:/
|
|
93
93
|
const RE_PROPERTY_VALUE = /^[^;\}]+/
|
|
94
94
|
const RE_PROPERTY_VALUE_SHORT = /^[^;\}\s\)]+/
|
|
@@ -329,6 +329,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
329
329
|
} else if ((next = part.match(RE_WHITESPACE))) {
|
|
330
330
|
token = TokenType.Whitespace
|
|
331
331
|
state = State.AfterPropertyName
|
|
332
|
+
} else if ((next = part.match(RE_NUMERIC))) {
|
|
333
|
+
token = TokenType.Numeric
|
|
334
|
+
state = State.AfterPropertyNameAfterColon
|
|
332
335
|
} else if ((next = part.match(RE_ANYTHING_UNTIL_CLOSE_BRACE))) {
|
|
333
336
|
token = TokenType.Unknown
|
|
334
337
|
state = State.InsideSelector
|
|
@@ -6,21 +6,29 @@ const State = {
|
|
|
6
6
|
TopLevelContent: 1,
|
|
7
7
|
InsideSingleQuoteString: 2,
|
|
8
8
|
InsideDoubleQuoteString: 3,
|
|
9
|
+
AfterKeywordClass: 4,
|
|
10
|
+
InsideBlockComment: 5,
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* @enum number
|
|
13
15
|
*/
|
|
14
16
|
export const TokenType = {
|
|
15
|
-
None: 99999999,
|
|
16
|
-
Keyword: 951,
|
|
17
17
|
Whitespace: 0,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
None: 1,
|
|
19
|
+
Keyword: 2,
|
|
20
|
+
NewLine: 3,
|
|
21
|
+
VariableName: 4,
|
|
22
|
+
Punctuation: 5,
|
|
23
|
+
String: 6,
|
|
24
|
+
Numeric: 7,
|
|
25
|
+
Attribute: 8,
|
|
26
|
+
KeywordControl: 9,
|
|
27
|
+
KeywordReturn: 10,
|
|
28
|
+
KeywordNew: 11,
|
|
29
|
+
KeywordThis: 12,
|
|
30
|
+
Class: 13,
|
|
31
|
+
Comment: 14,
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export const TokenMap = {
|
|
@@ -33,6 +41,12 @@ export const TokenMap = {
|
|
|
33
41
|
[TokenType.String]: 'String',
|
|
34
42
|
[TokenType.Numeric]: 'Numeric',
|
|
35
43
|
[TokenType.Attribute]: 'Attribute',
|
|
44
|
+
[TokenType.KeywordControl]: 'KeywordControl',
|
|
45
|
+
[TokenType.KeywordReturn]: 'KeywordReturn',
|
|
46
|
+
[TokenType.KeywordNew]: 'KeywordNew',
|
|
47
|
+
[TokenType.KeywordThis]: 'KeywordThis',
|
|
48
|
+
[TokenType.Class]: 'Class',
|
|
49
|
+
[TokenType.Comment]: 'Comment',
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
export const initialLineState = {
|
|
@@ -41,6 +55,7 @@ export const initialLineState = {
|
|
|
41
55
|
|
|
42
56
|
const RE_KEYWORD =
|
|
43
57
|
/^(?:_|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/
|
|
58
|
+
|
|
44
59
|
const RE_WHITESPACE = /^\s+/
|
|
45
60
|
const RE_VARIABLE_NAME = /^[a-zA-Z]+/
|
|
46
61
|
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)>]/
|
|
@@ -51,7 +66,14 @@ const RE_STRING_DOUBLE_QUOTE_CONTENT = /^[^"]+/
|
|
|
51
66
|
const RE_NUMERIC = /^\d+/
|
|
52
67
|
const RE_TRIPLE_DOUBLE_QUOTE = /^"""/
|
|
53
68
|
const RE_STRING_TRIPLE_CONTENT = /^.+?(?="""|$)/s
|
|
69
|
+
const RE_LINE_COMMENT = /^\/\/[^\n]*/
|
|
54
70
|
const RE_ATTRIBUTE = /^@\w+/
|
|
71
|
+
const RE_BLOCK_COMMENT_START = /^\/\*/
|
|
72
|
+
const RE_BLOCK_COMMENT_CONTENT = /^.+?(?=\*\/)/
|
|
73
|
+
const RE_BLOCK_COMMENT_END = /^\*\//
|
|
74
|
+
const RE_CURLY_OPEN = /^\{/
|
|
75
|
+
const RE_ANYTHING_UNTIL_END = /^.+/s
|
|
76
|
+
const RE_SLASH = /^\//
|
|
55
77
|
|
|
56
78
|
export const hasArrayReturn = true
|
|
57
79
|
|
|
@@ -73,8 +95,52 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
73
95
|
token = TokenType.Whitespace
|
|
74
96
|
state = State.TopLevelContent
|
|
75
97
|
} else if ((next = part.match(RE_KEYWORD))) {
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
switch (next[0]) {
|
|
99
|
+
case 'as':
|
|
100
|
+
case 'switch':
|
|
101
|
+
case 'default':
|
|
102
|
+
case 'case':
|
|
103
|
+
case 'else':
|
|
104
|
+
case 'if':
|
|
105
|
+
case 'break':
|
|
106
|
+
case 'throw':
|
|
107
|
+
case 'for':
|
|
108
|
+
case 'try':
|
|
109
|
+
case 'catch':
|
|
110
|
+
case 'finally':
|
|
111
|
+
case 'continue':
|
|
112
|
+
case 'while':
|
|
113
|
+
token = TokenType.KeywordControl
|
|
114
|
+
break
|
|
115
|
+
case 'return':
|
|
116
|
+
token = TokenType.KeywordReturn
|
|
117
|
+
break
|
|
118
|
+
case 'new':
|
|
119
|
+
token = TokenType.KeywordNew
|
|
120
|
+
break
|
|
121
|
+
case 'this':
|
|
122
|
+
token = TokenType.KeywordThis
|
|
123
|
+
break
|
|
124
|
+
case 'class':
|
|
125
|
+
token = TokenType.Keyword
|
|
126
|
+
state = State.AfterKeywordClass
|
|
127
|
+
break
|
|
128
|
+
default:
|
|
129
|
+
token = TokenType.Keyword
|
|
130
|
+
break
|
|
131
|
+
}
|
|
132
|
+
} else if ((next = part.match(RE_SLASH))) {
|
|
133
|
+
if ((next = part.match(RE_BLOCK_COMMENT_START))) {
|
|
134
|
+
token = TokenType.Comment
|
|
135
|
+
state = State.InsideBlockComment
|
|
136
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
137
|
+
token = TokenType.Comment
|
|
138
|
+
state = State.TopLevelContent
|
|
139
|
+
} else {
|
|
140
|
+
next = part.match(RE_SLASH)
|
|
141
|
+
token = TokenType.Punctuation
|
|
142
|
+
state = State.TopLevelContent
|
|
143
|
+
}
|
|
78
144
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
79
145
|
token = TokenType.VariableName
|
|
80
146
|
state = State.TopLevelContent
|
|
@@ -120,6 +186,40 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
120
186
|
throw new Error('no')
|
|
121
187
|
}
|
|
122
188
|
break
|
|
189
|
+
case State.AfterKeywordClass:
|
|
190
|
+
if ((next = part.match(RE_WHITESPACE))) {
|
|
191
|
+
token = TokenType.Whitespace
|
|
192
|
+
state = State.AfterKeywordClass
|
|
193
|
+
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
194
|
+
token = TokenType.Class
|
|
195
|
+
state = State.TopLevelContent
|
|
196
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
197
|
+
token = TokenType.Comment
|
|
198
|
+
state = State.TopLevelContent
|
|
199
|
+
} else if ((next = part.match(RE_BLOCK_COMMENT_START))) {
|
|
200
|
+
token = TokenType.Comment
|
|
201
|
+
state = State.InsideBlockComment
|
|
202
|
+
} else if ((next = part.match(RE_CURLY_OPEN))) {
|
|
203
|
+
token = TokenType.Punctuation
|
|
204
|
+
state = State.TopLevelContent
|
|
205
|
+
} else {
|
|
206
|
+
throw new Error('no')
|
|
207
|
+
}
|
|
208
|
+
break
|
|
209
|
+
case State.InsideBlockComment:
|
|
210
|
+
if ((next = part.match(RE_BLOCK_COMMENT_END))) {
|
|
211
|
+
token = TokenType.Comment
|
|
212
|
+
state = State.TopLevelContent
|
|
213
|
+
} else if ((next = part.match(RE_BLOCK_COMMENT_CONTENT))) {
|
|
214
|
+
token = TokenType.Comment
|
|
215
|
+
state = State.InsideBlockComment
|
|
216
|
+
} else if ((next = part.match(RE_ANYTHING_UNTIL_END))) {
|
|
217
|
+
token = TokenType.Comment
|
|
218
|
+
state = State.InsideBlockComment
|
|
219
|
+
} else {
|
|
220
|
+
throw new Error('no')
|
|
221
|
+
}
|
|
222
|
+
break
|
|
123
223
|
default:
|
|
124
224
|
state
|
|
125
225
|
throw new Error('no')
|
|
@@ -31,6 +31,7 @@ export const TokenType = {
|
|
|
31
31
|
KeywordReturn: 12,
|
|
32
32
|
Regex: 13,
|
|
33
33
|
KeywordImport: 14,
|
|
34
|
+
FunctionName: 15,
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export const TokenMap = {
|
|
@@ -48,6 +49,7 @@ export const TokenMap = {
|
|
|
48
49
|
[TokenType.KeywordReturn]: 'KeywordReturn',
|
|
49
50
|
[TokenType.Regex]: 'Regex',
|
|
50
51
|
[TokenType.KeywordImport]: 'KeywordImport',
|
|
52
|
+
[TokenType.FunctionName]: 'Function',
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
const RE_SELECTOR = /^[\.a-zA-Z\d\-\:>]+/
|
|
@@ -78,6 +80,7 @@ const RE_EOF_CONTENT = /.*/s
|
|
|
78
80
|
// const RE_REGEX = /^\/.+/
|
|
79
81
|
const RE_REGEX = /^\/.*\//
|
|
80
82
|
const RE_STRING_ESCAPE = /^\\./
|
|
83
|
+
const RE_FUNCTION_CALL_NAME = /^[\w]+(?=(\s+(\"|\w|\-))|\(|!)/
|
|
81
84
|
|
|
82
85
|
export const initialLineState = {
|
|
83
86
|
state: State.TopLevelContent,
|
|
@@ -121,6 +124,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
121
124
|
case 'then':
|
|
122
125
|
case 'while':
|
|
123
126
|
case 'end':
|
|
127
|
+
case 'def':
|
|
124
128
|
case 'begin':
|
|
125
129
|
case 'rescue':
|
|
126
130
|
case 'unless':
|
|
@@ -146,6 +150,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
146
150
|
token = TokenType.Punctuation
|
|
147
151
|
state = State.InsideEof
|
|
148
152
|
stringEnd = next[1]
|
|
153
|
+
} else if ((next = part.match(RE_FUNCTION_CALL_NAME))) {
|
|
154
|
+
token = TokenType.FunctionName
|
|
155
|
+
state = State.TopLevelContent
|
|
149
156
|
} else if ((next = part.match(RE_REGEX))) {
|
|
150
157
|
token = TokenType.Regex
|
|
151
158
|
state = State.TopLevelContent
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"BadgeForeground": "rgb(215, 218, 224)",
|
|
10
10
|
|
|
11
11
|
"CompletionListBackground": "#21252b",
|
|
12
|
+
"CompletionListForeground": "#abb2bf",
|
|
13
|
+
"CompletionListBorder": "transparent",
|
|
12
14
|
"CompletionListItemActiveBackground": "#2c313a",
|
|
15
|
+
"CompletionListItemActiveForeground": "#d7dae0",
|
|
13
16
|
|
|
14
17
|
"ContextMenuBackground": "rgb(53, 59, 69)",
|
|
15
18
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"CompletionListBackground": "#15232d",
|
|
12
12
|
"CompletionListItemActiveBackground": "#193549",
|
|
13
13
|
"CompletionListItemHoverBackground": "#193549",
|
|
14
|
+
"CompletionListItemActiveForeground": "#aaaaaa",
|
|
14
15
|
"CompletionListBorder": "#15232d",
|
|
15
16
|
|
|
16
17
|
"ContextMenuBackground": "#122738",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
4
4
|
"description": "Utility package for @lvce-editor/server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"node": ">=16"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@babel/code-frame": "^7.
|
|
20
|
-
"@lvce-editor/extension-host": "0.14.
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.14.
|
|
22
|
-
"@lvce-editor/pty-host": "0.14.
|
|
19
|
+
"@babel/code-frame": "^7.21.4",
|
|
20
|
+
"@lvce-editor/extension-host": "0.14.6",
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.14.6",
|
|
22
|
+
"@lvce-editor/pty-host": "0.14.6",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
24
|
"execa": "^7.1.1",
|
|
25
25
|
"exit-hook": "^3.2.0",
|
|
26
26
|
"got": "^12.6.0",
|
|
27
27
|
"is-object": "^1.0.2",
|
|
28
28
|
"lines-and-columns": "^2.0.3",
|
|
29
|
-
"open": "^9.
|
|
29
|
+
"open": "^9.1.0",
|
|
30
30
|
"p-queue": "^7.3.4",
|
|
31
31
|
"parse-json": "^6.0.2",
|
|
32
32
|
"symlink-dir": "^5.1.1",
|