@lvce-editor/shared-process 0.8.0 → 0.8.2
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/config/defaultKeyBindings.json +10 -0
- package/extensions/builtin.language-basics-graphql/README.md +14 -0
- package/extensions/builtin.language-basics-graphql/extension.json +12 -0
- package/extensions/builtin.language-basics-graphql/src/tokenizeGraphql.js +28 -0
- package/extensions/builtin.language-basics-r/README.md +14 -0
- package/extensions/builtin.language-basics-r/extension.json +12 -0
- package/extensions/builtin.language-basics-r/src/tokenizeR.js +71 -0
- package/extensions/builtin.language-basics-shellscript/src/tokenizeShellScript.js +3 -14
- package/extensions/builtin.language-basics-toml/extension.json +2 -9
- package/extensions/builtin.language-basics-toml/src/tokenizeToml.js +5 -15
- package/extensions/builtin.theme-gruvbox/README.md +18 -0
- package/extensions/builtin.theme-gruvbox/color-theme.json +173 -0
- package/extensions/builtin.theme-gruvbox/extension.json +12 -0
- package/extensions/builtin.vscode-icons/icon.png +0 -0
- package/package.json +3 -3
- package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +1 -1
- package/src/parts/ExtensionManagement/ExtensionManagement.js +4 -130
|
@@ -307,6 +307,16 @@
|
|
|
307
307
|
"command": "Extensions.focusNext",
|
|
308
308
|
"when": "focus.Extensions"
|
|
309
309
|
},
|
|
310
|
+
{
|
|
311
|
+
"key": "Space",
|
|
312
|
+
"command": "Extensions.handleClickCurrentButKeepFocus",
|
|
313
|
+
"when": "focus.Extensions"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"key": "Enter",
|
|
317
|
+
"command": "Extensions.handleClickCurrent",
|
|
318
|
+
"when": "focus.Extensions"
|
|
319
|
+
},
|
|
310
320
|
{
|
|
311
321
|
"key": "ctrl+Space",
|
|
312
322
|
"command": "Extensions.toggleSuggest",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Language Basics Graphql
|
|
2
|
+
|
|
3
|
+
## Contributing
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
git clone git@github.com:lvce-editor/language-basics-graphql.git &&
|
|
7
|
+
cd language-basics-graphql &&
|
|
8
|
+
npm ci &&
|
|
9
|
+
npm test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Gitpod
|
|
13
|
+
|
|
14
|
+
[](https://gitpod.io/#https://github.com/lvce-editor/language-basics-graphql)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "builtin.language-basics-graphql",
|
|
3
|
+
"name": "Language Basics Graphql",
|
|
4
|
+
"description": "Provides syntax highlighting and bracket matching in Graphql files.",
|
|
5
|
+
"languages": [
|
|
6
|
+
{
|
|
7
|
+
"id": "graphql",
|
|
8
|
+
"extensions": [".gql"],
|
|
9
|
+
"tokenize": "src/tokenizeGraphql.js"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enum number
|
|
3
|
+
*/
|
|
4
|
+
export const TokenType = {
|
|
5
|
+
Text: 1,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const TokenMap = {
|
|
9
|
+
[TokenType.Text]: 'Text',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const initialLineState = {
|
|
13
|
+
state: 1,
|
|
14
|
+
tokens: [],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const hasArrayReturn = true
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} line
|
|
21
|
+
*/
|
|
22
|
+
export const tokenizeLine = (line) => {
|
|
23
|
+
const tokens = [TokenType.Text, line.length]
|
|
24
|
+
return {
|
|
25
|
+
state: 1,
|
|
26
|
+
tokens,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Language Basics R
|
|
2
|
+
|
|
3
|
+
## Contributing
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
git clone git@github.com:lvce-editor/language-basics-r.git &&
|
|
7
|
+
cd language-basics-r &&
|
|
8
|
+
npm ci &&
|
|
9
|
+
npm test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Gitpod
|
|
13
|
+
|
|
14
|
+
[](https://gitpod.io/#https://github.com/lvce-editor/language-basics-r)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "builtin.language-basics-r",
|
|
3
|
+
"name": "Language Basics R",
|
|
4
|
+
"description": "Provides syntax highlighting and bracket matching in R files.",
|
|
5
|
+
"languages": [
|
|
6
|
+
{
|
|
7
|
+
"id": "r",
|
|
8
|
+
"extensions": [".r", ".rhistory", ".rprofile", ".rt"],
|
|
9
|
+
"tokenize": "src/tokenizeR.js"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enum number
|
|
3
|
+
*/
|
|
4
|
+
export const State = {
|
|
5
|
+
TopLevelContent: 1,
|
|
6
|
+
InsideString: 2,
|
|
7
|
+
InsideLineComment: 3,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @enum number
|
|
12
|
+
*/
|
|
13
|
+
export const TokenType = {
|
|
14
|
+
None: 0,
|
|
15
|
+
Text: 1,
|
|
16
|
+
Function: 2,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const TokenMap = {
|
|
20
|
+
[TokenType.Text]: 'Text',
|
|
21
|
+
[TokenType.Function]: 'Function',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const initialLineState = {
|
|
25
|
+
state: State.TopLevelContent,
|
|
26
|
+
tokens: [],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const hasArrayReturn = true
|
|
30
|
+
|
|
31
|
+
const RE_BUILTIN_FUNCTION =
|
|
32
|
+
/^(?:abbreviate|abline|abs|acf2AR|acos|acosh|addmargins|addNA|addTaskCallback|addNextMethod|addNextCallback|adist|adjustcolor|aggregate|agrep|agrepl|alarm|alist|all\.equal|all|allGenerics|approx|approxfun|apropos|aregexc|argsAnywhere|arrows|as\.data\.frame|as\.Date|as\.double|as\.factor|as\.name|as\.numeric|as\.ordered|as\.single|assocplot|attach|attr|attributes|ave|axis|barplot|body|box|boxplot|browser|call|classLabel|classMetaName|className|completeSubclasses|doPrimitiveMethod|emptyMethodsList)\b/
|
|
33
|
+
const RE_ANYTHING = /^.+/s
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {string} line
|
|
37
|
+
* @param {any} lineState
|
|
38
|
+
*/
|
|
39
|
+
export const tokenizeLine = (line, lineState) => {
|
|
40
|
+
let next = null
|
|
41
|
+
let index = 0
|
|
42
|
+
let tokens = []
|
|
43
|
+
let token = TokenType.None
|
|
44
|
+
let state = lineState.state
|
|
45
|
+
while (index < line.length) {
|
|
46
|
+
const part = line.slice(index)
|
|
47
|
+
switch (state) {
|
|
48
|
+
case State.TopLevelContent:
|
|
49
|
+
if ((next = part.match(RE_BUILTIN_FUNCTION))) {
|
|
50
|
+
token = TokenType.Function
|
|
51
|
+
state = State.TopLevelContent
|
|
52
|
+
} else if ((next = part.match(RE_ANYTHING))) {
|
|
53
|
+
token = TokenType.Text
|
|
54
|
+
state = State.TopLevelContent
|
|
55
|
+
} else {
|
|
56
|
+
part //?
|
|
57
|
+
throw new Error('no')
|
|
58
|
+
}
|
|
59
|
+
break
|
|
60
|
+
default:
|
|
61
|
+
throw new Error('no')
|
|
62
|
+
}
|
|
63
|
+
const tokenLength = next[0].length
|
|
64
|
+
index += tokenLength
|
|
65
|
+
tokens.push(token, tokenLength)
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
state,
|
|
69
|
+
tokens,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -40,7 +40,7 @@ export const TokenMap = {
|
|
|
40
40
|
[TokenType.Text]: 'Text',
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const RE_LINE_COMMENT = /^#.*/s
|
|
44
44
|
const RE_SELECTOR = /^[\.a-zA-Z\d\-\:>]+/
|
|
45
45
|
const RE_WHITESPACE = /^ +/
|
|
46
46
|
const RE_CURLY_OPEN = /^\{/
|
|
@@ -110,9 +110,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
110
110
|
} else if ((next = part.match(RE_QUOTE_DOUBLE))) {
|
|
111
111
|
token = TokenType.PunctuationString
|
|
112
112
|
state = State.InsideString
|
|
113
|
-
} else if ((next = part.match(
|
|
113
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
114
114
|
token = TokenType.Comment
|
|
115
|
-
state = State.
|
|
115
|
+
state = State.TopLevelContent
|
|
116
116
|
} else if ((next = part.match(RE_ANYTHING))) {
|
|
117
117
|
token = TokenType.Text
|
|
118
118
|
state = State.TopLevelContent
|
|
@@ -132,14 +132,6 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
132
132
|
throw new Error('no')
|
|
133
133
|
}
|
|
134
134
|
break
|
|
135
|
-
case State.InsideLineComment:
|
|
136
|
-
if ((next = part.match(RE_ANYTHING))) {
|
|
137
|
-
token = TokenType.Comment
|
|
138
|
-
state = State.TopLevelContent
|
|
139
|
-
} else {
|
|
140
|
-
throw new Error('no')
|
|
141
|
-
}
|
|
142
|
-
break
|
|
143
135
|
default:
|
|
144
136
|
throw new Error('no')
|
|
145
137
|
}
|
|
@@ -147,9 +139,6 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
147
139
|
index += tokenLength
|
|
148
140
|
tokens.push(token, tokenLength)
|
|
149
141
|
}
|
|
150
|
-
if (state === State.InsideLineComment) {
|
|
151
|
-
state = State.TopLevelContent
|
|
152
|
-
}
|
|
153
142
|
return {
|
|
154
143
|
state,
|
|
155
144
|
tokens,
|
|
@@ -6,15 +6,8 @@
|
|
|
6
6
|
"languages": [
|
|
7
7
|
{
|
|
8
8
|
"id": "toml",
|
|
9
|
-
"extensions": [
|
|
10
|
-
|
|
11
|
-
".tml",
|
|
12
|
-
".replit"
|
|
13
|
-
],
|
|
14
|
-
"fileNames": [
|
|
15
|
-
"Cargo.lock",
|
|
16
|
-
"Gopkg.lock"
|
|
17
|
-
],
|
|
9
|
+
"extensions": [".toml", ".tml", ".replit"],
|
|
10
|
+
"fileNames": ["Cargo.lock", "Gopkg.lock"],
|
|
18
11
|
"tokenize": "src/tokenizeToml.js"
|
|
19
12
|
}
|
|
20
13
|
]
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const State = {
|
|
5
5
|
TopLevelContent: 1,
|
|
6
|
-
InsideLineComment: 2,
|
|
7
6
|
AfterPropertyName: 3,
|
|
8
7
|
AfterPropertyNameAfterEqualSign: 4,
|
|
9
8
|
InsideString: 5,
|
|
@@ -11,7 +10,6 @@ export const State = {
|
|
|
11
10
|
|
|
12
11
|
export const StateMap = {
|
|
13
12
|
[State.TopLevelContent]: 'TopLevelContent',
|
|
14
|
-
[State.InsideLineComment]: 'InsideLineComment',
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -53,7 +51,7 @@ export const TokenMap = {
|
|
|
53
51
|
[TokenType.String]: 'String',
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
const
|
|
54
|
+
const RE_LINE_COMMENT = /^#.*/s
|
|
57
55
|
const RE_WHITESPACE = /^ +/
|
|
58
56
|
const RE_CURLY_OPEN = /^\{/
|
|
59
57
|
const RE_CURLY_CLOSE = /^\}/
|
|
@@ -113,9 +111,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
113
111
|
if ((next = part.match(RE_PROPERTY_NAME))) {
|
|
114
112
|
token = TokenType.PropertyName
|
|
115
113
|
state = State.AfterPropertyName
|
|
116
|
-
} else if ((next = part.match(
|
|
114
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
117
115
|
token = TokenType.Comment
|
|
118
|
-
state = State.
|
|
116
|
+
state = State.TopLevelContent
|
|
119
117
|
} else if ((next = part.match(RE_WHITESPACE))) {
|
|
120
118
|
token = TokenType.Whitespace
|
|
121
119
|
state = State.TopLevelContent
|
|
@@ -127,14 +125,6 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
127
125
|
throw new Error('no')
|
|
128
126
|
}
|
|
129
127
|
break
|
|
130
|
-
case State.InsideLineComment:
|
|
131
|
-
if ((next = part.match(RE_ANYTHING))) {
|
|
132
|
-
token = TokenType.Comment
|
|
133
|
-
state = State.TopLevelContent
|
|
134
|
-
} else {
|
|
135
|
-
throw new Error('no')
|
|
136
|
-
}
|
|
137
|
-
break
|
|
138
128
|
case State.AfterPropertyName:
|
|
139
129
|
if ((next = part.match(RE_EQUAL_SIGN))) {
|
|
140
130
|
token = TokenType.Punctuation
|
|
@@ -162,9 +152,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
162
152
|
} else if ((next = part.match(RE_NUMERIC_FLOAT))) {
|
|
163
153
|
token = TokenType.Numeric
|
|
164
154
|
state = State.TopLevelContent
|
|
165
|
-
} else if ((next = part.match(
|
|
155
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
166
156
|
token = TokenType.Comment
|
|
167
|
-
state = State.
|
|
157
|
+
state = State.TopLevelContent
|
|
168
158
|
} else if ((next = part.match(RE_NAN))) {
|
|
169
159
|
token = TokenType.Numeric
|
|
170
160
|
state = State.TopLevelContent
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Theme Gruvbox
|
|
2
|
+
|
|
3
|
+
## Contributing
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
git clone git@github.com:lvce-editor/theme-gruvbox.git &&
|
|
7
|
+
cd theme-gruvbox &&
|
|
8
|
+
npm ci &&
|
|
9
|
+
npm run dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Gitpod
|
|
13
|
+
|
|
14
|
+
[](https://gitpod.io/#https://github.com/lvce-editor/theme-gruvbox)
|
|
15
|
+
|
|
16
|
+
## Credits
|
|
17
|
+
|
|
18
|
+
Extension is based on https://github.com/sainnhe/gruvbox-material-vscode by @sainnhe (License MIT)
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dark",
|
|
3
|
+
"colors": {
|
|
4
|
+
"ActivityBarBackground": "rgb(41, 40, 40)",
|
|
5
|
+
"ActivityBarActiveForeground": "rgb(168, 153, 132)",
|
|
6
|
+
"ActivityBarForeground": "rgb(124, 111, 100)",
|
|
7
|
+
|
|
8
|
+
"BadgeBackground": "",
|
|
9
|
+
"BadgeForeground": "",
|
|
10
|
+
|
|
11
|
+
"ContextMenuBackground": "rgb(41, 40, 40)",
|
|
12
|
+
"ContextMenuForeground": "rgb(168, 153, 132)",
|
|
13
|
+
|
|
14
|
+
"EditorBackGround": "rgb(41, 40, 40)",
|
|
15
|
+
"EditorScrollBarBackground": "rgba(124, 111, 100, 0.5)",
|
|
16
|
+
"EditorCursorBackground": "#d4be98",
|
|
17
|
+
"EditorSelectionBackground": "rgba(80, 73, 69, 0.69)",
|
|
18
|
+
|
|
19
|
+
"FocusOutline": "",
|
|
20
|
+
|
|
21
|
+
"InputBoxBackground": "",
|
|
22
|
+
"InputBoxForeground": "",
|
|
23
|
+
|
|
24
|
+
"ListActiveSelectionBackground": "rgba(69, 64, 61, 0.38)",
|
|
25
|
+
"ListActiveSelectionForeground": "",
|
|
26
|
+
"ListHoverBackground": "rgba(69, 64, 61, 0.38)",
|
|
27
|
+
"ListHoverForeground": "",
|
|
28
|
+
"ListInactiveSelectionBackground": "",
|
|
29
|
+
"ListForeground": "rgb(212, 190, 152)",
|
|
30
|
+
|
|
31
|
+
"MainBackground": "rgb(41, 40, 40)",
|
|
32
|
+
|
|
33
|
+
"MenuBackground": "",
|
|
34
|
+
"MenuForeground": "rgb(168, 153, 132)",
|
|
35
|
+
"MenuItemHoverBackground": "rgb(50, 48, 47)",
|
|
36
|
+
|
|
37
|
+
"PanelBackground": "rgb(41, 40, 40)",
|
|
38
|
+
"PanelBorderTopColor": "",
|
|
39
|
+
"PanelTabHoverForeground": "",
|
|
40
|
+
"PanelTabActiveForeground": "#a89984",
|
|
41
|
+
"PanelTabHoverForeground": "#a89984",
|
|
42
|
+
"PanelTabForeground": "rgb(124, 111, 100)",
|
|
43
|
+
|
|
44
|
+
"QuickPickBackground": "rgb(41, 40, 40)",
|
|
45
|
+
"QuickPickInputBackground": "",
|
|
46
|
+
|
|
47
|
+
"SideBarBackground": "rgb(41, 40, 40)",
|
|
48
|
+
"SideBarForeground": "rgb(168, 153, 132)",
|
|
49
|
+
|
|
50
|
+
"StatusBarBackground": "rgb(41, 40, 40)",
|
|
51
|
+
"StatusBarBorderTopColor": "",
|
|
52
|
+
|
|
53
|
+
"TabActiveForeground": "rgb(212, 190, 152)",
|
|
54
|
+
"TabForeground": "rgb(212, 190, 152)",
|
|
55
|
+
"TabActiveBackground": "",
|
|
56
|
+
"TabInactiveBackground": "",
|
|
57
|
+
|
|
58
|
+
"TabsBackground": "",
|
|
59
|
+
|
|
60
|
+
"TitleBarBackground": "rgb(41, 40, 40)",
|
|
61
|
+
"TitleBarBorderBottomColor": "",
|
|
62
|
+
"TitleBarForeground": "rgb(168, 153, 132)",
|
|
63
|
+
"TitleBarColorInactive": "",
|
|
64
|
+
|
|
65
|
+
"TreeItemForeground": "rgb(146, 131, 116)"
|
|
66
|
+
},
|
|
67
|
+
"tokenColors": [
|
|
68
|
+
{
|
|
69
|
+
"name": "CssSelector",
|
|
70
|
+
"foreground": "#EA6962"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "CssPropertyName",
|
|
74
|
+
"foreground": "#89B482"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "CssPropertyValue",
|
|
78
|
+
"foreground": "#A9B665"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "TagName",
|
|
82
|
+
"foreground": "#E78A4E"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "AttributeName",
|
|
86
|
+
"foreground": "#D8A657"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "String",
|
|
90
|
+
"foreground": "#A9B665"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "PunctuationString",
|
|
94
|
+
"foreground": ""
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "PunctuationTag",
|
|
98
|
+
"foreground": "#A9B665"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "JsonPropertyName",
|
|
102
|
+
"foreground": "#e78a4e"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "JsonPropertyValueString",
|
|
106
|
+
"foreground": "#a9b665"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "LanguageConstant",
|
|
110
|
+
"foreground": "#d3869b"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "Keyword",
|
|
114
|
+
"foreground": "#EA6962"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "Numeric",
|
|
118
|
+
"foreground": "#A9B665"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "KeywordImport",
|
|
122
|
+
"foreground": "#89B482"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "Type",
|
|
126
|
+
"foreground": ""
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "Macro",
|
|
130
|
+
"foreground": ""
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "KeywordControl",
|
|
134
|
+
"foreground": "#EA6962"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "Regex",
|
|
138
|
+
"foreground": "#D8A657"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "Function",
|
|
142
|
+
"foreground": ""
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "Comment",
|
|
146
|
+
"foreground": "#928374"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "Punctuation",
|
|
150
|
+
"foreground": "#928374"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "VariableName",
|
|
154
|
+
"foreground": "#D4BE98"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "Text",
|
|
158
|
+
"foreground": "#d4be98"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "KeywordReturn",
|
|
162
|
+
"foreground": "#EA6962"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "Heading",
|
|
166
|
+
"foreground": "#E78A4E"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "KeywordNew",
|
|
170
|
+
"foreground": "#EA6962"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"node": ">=16"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lvce-editor/extension-host": "0.8.
|
|
24
|
-
"@lvce-editor/pty-host": "0.8.
|
|
23
|
+
"@lvce-editor/extension-host": "0.8.2",
|
|
24
|
+
"@lvce-editor/pty-host": "0.8.2",
|
|
25
25
|
"chokidar": "^3.5.3",
|
|
26
26
|
"debug": "^4.3.4",
|
|
27
27
|
"execa": "^6.1.0",
|
|
@@ -13,7 +13,7 @@ export const Commands = {
|
|
|
13
13
|
'ExtensionHost.watchColorTheme':ExtensionHostColorTheme.watch,
|
|
14
14
|
'ExtensionManagement.disable': ExtensionManagement.disable,
|
|
15
15
|
'ExtensionManagement.enable': ExtensionManagement.enable,
|
|
16
|
-
'ExtensionManagement.getAllExtensions': ExtensionManagement.
|
|
16
|
+
'ExtensionManagement.getAllExtensions': ExtensionManagement.getExtensions,
|
|
17
17
|
'ExtensionManagement.getExtensions': ExtensionManagement.getExtensions,
|
|
18
18
|
'ExtensionManagement.install': ExtensionManagement.install,
|
|
19
19
|
'ExtensionManagement.uninstall': ExtensionManagement.uninstall,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { mkdir,
|
|
2
|
-
import { performance } from 'node:perf_hooks'
|
|
1
|
+
import { mkdir, rename, rm } from 'node:fs/promises'
|
|
3
2
|
import VError from 'verror'
|
|
4
3
|
import * as Debug from '../Debug/Debug.js'
|
|
5
4
|
import * as ExtensionManifestInputType from '../ExtensionManifestInputType/ExtensionManifestInputType.js'
|
|
@@ -8,28 +7,6 @@ import * as Path from '../Path/Path.js'
|
|
|
8
7
|
import * as Platform from '../Platform/Platform.js'
|
|
9
8
|
import * as Queue from '../Queue/Queue.js'
|
|
10
9
|
|
|
11
|
-
const isLanguageBasics = (extension) => {
|
|
12
|
-
if (extension && extension.id) {
|
|
13
|
-
return extension.id.includes('language-basics')
|
|
14
|
-
}
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const getEnabledExtensionWithOnlyExtension = (
|
|
19
|
-
builtinExtensions,
|
|
20
|
-
onlyExtension
|
|
21
|
-
) => {
|
|
22
|
-
const extensions = []
|
|
23
|
-
for (const builtinExtension of builtinExtensions) {
|
|
24
|
-
if (builtinExtension.id === onlyExtension.id) {
|
|
25
|
-
continue
|
|
26
|
-
}
|
|
27
|
-
extensions.push(builtinExtension)
|
|
28
|
-
}
|
|
29
|
-
extensions.push(onlyExtension)
|
|
30
|
-
return extensions
|
|
31
|
-
}
|
|
32
|
-
|
|
33
10
|
export const install = async (id) => {
|
|
34
11
|
// TODO this should be a stateless function, renderer-worker should have info on marketplace url
|
|
35
12
|
// TODO use command.execute
|
|
@@ -107,81 +84,7 @@ export const disable = async (id) => {
|
|
|
107
84
|
}
|
|
108
85
|
}
|
|
109
86
|
|
|
110
|
-
const
|
|
111
|
-
const disabledExtensionsPath = Platform.getDisabledExtensionsPath()
|
|
112
|
-
return Path.join(disabledExtensionsPath, dirent)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const getDisabledExtensionPaths = async () => {
|
|
116
|
-
try {
|
|
117
|
-
const disabledExtensionsPaths = Platform.getDisabledExtensionsPath()
|
|
118
|
-
const dirents = await readdir(disabledExtensionsPaths)
|
|
119
|
-
const paths = dirents.map(getAbsoluteDisabledPath)
|
|
120
|
-
return paths
|
|
121
|
-
} catch {
|
|
122
|
-
// TODO handle error
|
|
123
|
-
return []
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const getAbsoluteBuiltinExtensionPath = (dirent) => {
|
|
128
|
-
const builtinExtensionsPath = Platform.getBuiltinExtensionsPath()
|
|
129
|
-
return Path.join(builtinExtensionsPath, dirent)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const isIncludedBuiltinExtension = (dirent) => {
|
|
133
|
-
const SKIPPED = [
|
|
134
|
-
'hello-world',
|
|
135
|
-
'vite',
|
|
136
|
-
'soundcloud',
|
|
137
|
-
'npm',
|
|
138
|
-
// 'builtin.git', ~40MB memory usage (too many file watchers)
|
|
139
|
-
// 'builtin.prettier', ~20MB memory usage (maybe lazyload prettier)
|
|
140
|
-
// 'language-features-typescript',
|
|
141
|
-
// 'builtin.vscode-icons',
|
|
142
|
-
]
|
|
143
|
-
return !SKIPPED.includes(dirent)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// TODO pass builtin extensions path from renderer-worker
|
|
147
|
-
// only negative: more messages sent between renderer-worker and shared process on startup
|
|
148
|
-
const getBuiltinExtensionPaths = async () => {
|
|
149
|
-
try {
|
|
150
|
-
const builtinExtensionsPath = Platform.getBuiltinExtensionsPath()
|
|
151
|
-
const dirents = await readdir(builtinExtensionsPath)
|
|
152
|
-
const filteredDirents = dirents.filter(isIncludedBuiltinExtension)
|
|
153
|
-
const paths = filteredDirents.map(getAbsoluteBuiltinExtensionPath)
|
|
154
|
-
return paths
|
|
155
|
-
} catch {
|
|
156
|
-
console.info('no builtin extension paths found')
|
|
157
|
-
return []
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const getAbsoluteInstalledExtensionPath = (dirent) => {
|
|
162
|
-
const extensionsPath = Platform.getExtensionsPath()
|
|
163
|
-
return Path.join(extensionsPath, dirent)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const getInstalledExtensionPaths = async () => {
|
|
167
|
-
try {
|
|
168
|
-
const extensionsPath = Platform.getExtensionsPath()
|
|
169
|
-
const dirents = await readdir(extensionsPath)
|
|
170
|
-
const paths = dirents.map(getAbsoluteInstalledExtensionPath)
|
|
171
|
-
return paths
|
|
172
|
-
} catch (error) {
|
|
173
|
-
// TODO how to make typescript happy?
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
if (error.code === 'ENOENT') {
|
|
176
|
-
// TODO what if mkdir fails?
|
|
177
|
-
await mkdir(Platform.getExtensionsPath(), { recursive: true })
|
|
178
|
-
return []
|
|
179
|
-
}
|
|
180
|
-
throw new VError(error, 'Failed to get installed extensions')
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export const getBuiltinExtensions = async () => {
|
|
87
|
+
export const getBuiltinExtensions = () => {
|
|
185
88
|
return ExtensionManifests.getAll([
|
|
186
89
|
{
|
|
187
90
|
type: ExtensionManifestInputType.Folder,
|
|
@@ -199,7 +102,7 @@ export const getInstalledExtensions = () => {
|
|
|
199
102
|
])
|
|
200
103
|
}
|
|
201
104
|
|
|
202
|
-
export const getExtensions =
|
|
105
|
+
export const getExtensions = () => {
|
|
203
106
|
return ExtensionManifests.getAll([
|
|
204
107
|
{
|
|
205
108
|
type: ExtensionManifestInputType.OnlyExtension,
|
|
@@ -220,7 +123,7 @@ export const getExtensions = async () => {
|
|
|
220
123
|
])
|
|
221
124
|
}
|
|
222
125
|
|
|
223
|
-
export const getDisabledExtensions =
|
|
126
|
+
export const getDisabledExtensions = () => {
|
|
224
127
|
return ExtensionManifests.getAll([
|
|
225
128
|
{
|
|
226
129
|
type: ExtensionManifestInputType.Folder,
|
|
@@ -228,32 +131,3 @@ export const getDisabledExtensions = async () => {
|
|
|
228
131
|
},
|
|
229
132
|
])
|
|
230
133
|
}
|
|
231
|
-
|
|
232
|
-
export const getAllExtensions = async () => {
|
|
233
|
-
const onlyExtensionPath = Platform.getOnlyExtensionPath()
|
|
234
|
-
if (onlyExtensionPath) {
|
|
235
|
-
return ExtensionManifests.getAll([
|
|
236
|
-
{
|
|
237
|
-
type: ExtensionManifestInputType.OnlyExtension,
|
|
238
|
-
path: onlyExtensionPath,
|
|
239
|
-
},
|
|
240
|
-
])
|
|
241
|
-
}
|
|
242
|
-
const t1 = performance.now()
|
|
243
|
-
const [builtinExtensions, installedExtensions, disabledExtensions] =
|
|
244
|
-
// TODO handle error when one of them fails
|
|
245
|
-
await Promise.all([
|
|
246
|
-
getBuiltinExtensions(),
|
|
247
|
-
getInstalledExtensions(),
|
|
248
|
-
getDisabledExtensions(),
|
|
249
|
-
])
|
|
250
|
-
const t4 = performance.now()
|
|
251
|
-
// TODO can optimize this by loading extension manifest while loading paths (though 2ms isn't a bottleneck right now)
|
|
252
|
-
// e.g.
|
|
253
|
-
// await Promise.all([getBuiltinExtensionPaths.then(getExtensionManifests), getInstalledExtensionPaths.then(getExtensionManifests)])
|
|
254
|
-
const timings = {
|
|
255
|
-
total: t4 - t1,
|
|
256
|
-
}
|
|
257
|
-
// console.log(timings)
|
|
258
|
-
return [...builtinExtensions, ...installedExtensions, ...disabledExtensions]
|
|
259
|
-
}
|