@lvce-editor/shared-process 0.0.2 → 0.0.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/config/builtinCommands.json +367 -0
- package/config/colorTheme.json +98 -0
- package/config/defaultKeyBindings.json +649 -0
- package/config/defaultSettings.json +17 -0
- package/extensions/builtin.theme-slime/README.md +5 -0
- package/extensions/builtin.theme-slime/color-theme.json +205 -0
- package/extensions/builtin.theme-slime/extension.json +13 -0
- package/extensions/builtin.theme-slime/icon.png +0 -0
- package/package.json +3 -3
- package/src/parts/Env/Env.js +1 -1
- package/src/parts/Platform/Platform.js +7 -0
- package/src/parts/Preferences/Preferences.js +3 -6
- package/src/parts/Root/Root.js +1 -1
- package/test/Callback.test.js +0 -42
- package/test/ClipBoard.test.js +0 -105
- package/test/Credentials.test.js +0 -147
- package/test/Developer.test.js +0 -34
- package/test/Electron.test.js +0 -93
- package/test/Error.test.js +0 -16
- package/test/Exec.test.js +0 -25
- package/test/ExtensionHost.test.js +0 -127
- package/test/ExtensionHostColorTheme.test.js +0 -141
- package/test/ExtensionHostCommand.test.js +0 -27
- package/test/ExtensionHostCompletion.test.js +0 -45
- package/test/ExtensionHostDefinition.test.js +0 -35
- package/test/ExtensionHostDiagnostic.test.js +0 -23
- package/test/ExtensionHostFileSystem.test.js +0 -91
- package/test/ExtensionHostFormatting.test.js +0 -27
- package/test/ExtensionHostIconTheme.test.js +0 -73
- package/test/ExtensionHostLanguages.test.js +0 -212
- package/test/ExtensionHostOutput.test.js +0 -23
- package/test/ExtensionHostRename.test.js +0 -59
- package/test/ExtensionHostSemanticTokens.test.js +0 -26
- package/test/ExtensionHostTabCompletion.test.js +0 -35
- package/test/ExtensionHostTextDocument.test.js +0 -61
- package/test/ExtensionHostTypeDefinition.test.js +0 -35
- package/test/ExtensionHostWorkspace.test.js +0 -21
- package/test/ExtensionManagement.test.js +0 -408
- package/test/FileSystem.test.js +0 -294
- package/test/Json.test.js +0 -25
- package/test/Native.test.js +0 -31
- package/test/OutputChannel.test.js +0 -68
- package/test/Path.test.js +0 -17
- package/test/Platform.test.js +0 -61
- package/test/Preferences.test.js +0 -140
- package/test/Process.test.js +0 -9
- package/test/RgPath.test.js +0 -5
- package/test/Search.test.js +0 -45
- package/test/SearchFile.test.js +0 -80
- package/test/Terminal.test.js +0 -53
- package/test/Trash.test.js +0 -34
- package/test/WebSocketServer.test.js +0 -98
- package/test/fixture-search-1/index.html +0 -10
- package/test/fixture-search-file-1/fileA +0 -0
- package/test/fixture-search-file-1/fileB +0 -0
- package/test/fixture-search-file-1/nested/fileC +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, writeFile } from 'node:fs/promises'
|
|
2
|
-
import { tmpdir } from 'node:os'
|
|
3
|
-
import { join } from 'node:path'
|
|
4
|
-
import * as ExtensionHostIconTheme from '../src/parts/ExtensionHost/ExtensionHostIconTheme.js'
|
|
5
|
-
import * as ExtensionManagement from '../src/parts/ExtensionManagement/ExtensionManagement.js'
|
|
6
|
-
|
|
7
|
-
const getTmpDir = () => {
|
|
8
|
-
return mkdtemp(join(tmpdir(), 'foo-'))
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
test('getIconTheme - not found', async () => {
|
|
12
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
13
|
-
return []
|
|
14
|
-
}
|
|
15
|
-
await expect(
|
|
16
|
-
ExtensionHostIconTheme.getIconTheme('test-theme')
|
|
17
|
-
).rejects.toThrowError(
|
|
18
|
-
'Icon theme "test-theme" not found in extensions folder'
|
|
19
|
-
)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
test('getIconTheme - wrong/invalid path', async () => {
|
|
23
|
-
const tmpDir = await getTmpDir()
|
|
24
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
25
|
-
return [
|
|
26
|
-
{
|
|
27
|
-
status: 'fulfilled',
|
|
28
|
-
id: 'builtin.theme-test',
|
|
29
|
-
iconThemes: [
|
|
30
|
-
{
|
|
31
|
-
id: 'test',
|
|
32
|
-
label: 'Test',
|
|
33
|
-
path: 'icon-theme.json',
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
path: tmpDir,
|
|
37
|
-
},
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
const iconThemeJsonPath = join(tmpDir, 'icon-theme.json')
|
|
41
|
-
await expect(
|
|
42
|
-
ExtensionHostIconTheme.getIconTheme('test')
|
|
43
|
-
).rejects.toThrowError(
|
|
44
|
-
`Failed to load icon theme "test": ENOENT: no such file or directory, open '${iconThemeJsonPath}'`
|
|
45
|
-
)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
test('getIconTheme - invalid json', async () => {
|
|
49
|
-
const tmpDir = await getTmpDir()
|
|
50
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
51
|
-
return [
|
|
52
|
-
{
|
|
53
|
-
status: 'fulfilled',
|
|
54
|
-
id: 'builtin.icon-theme-test',
|
|
55
|
-
iconThemes: [
|
|
56
|
-
{
|
|
57
|
-
id: 'test',
|
|
58
|
-
label: 'Test',
|
|
59
|
-
path: 'icon-theme.json',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
path: tmpDir,
|
|
63
|
-
},
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
const iconThemeJsonPath = join(tmpDir, 'icon-theme.json')
|
|
67
|
-
await writeFile(iconThemeJsonPath, '{ 2 }')
|
|
68
|
-
await expect(
|
|
69
|
-
ExtensionHostIconTheme.getIconTheme('test')
|
|
70
|
-
).rejects.toThrowError(
|
|
71
|
-
'Failed to load icon theme "test": Unexpected number in JSON at position 2 while parsing \'{ 2 }\''
|
|
72
|
-
)
|
|
73
|
-
})
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, writeFile } from 'node:fs/promises'
|
|
2
|
-
import { tmpdir } from 'node:os'
|
|
3
|
-
import { join } from 'node:path'
|
|
4
|
-
import { pathToFileURL } from 'node:url'
|
|
5
|
-
import * as ExtensionHostLanguages from '../src/parts/ExtensionHost/ExtensionHostLanguages.js'
|
|
6
|
-
import * as ExtensionManagement from '../src/parts/ExtensionManagement/ExtensionManagement.js'
|
|
7
|
-
|
|
8
|
-
const getTmpDir = () => {
|
|
9
|
-
return mkdtemp(join(tmpdir(), 'foo-'))
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
test('getLanguages', async () => {
|
|
13
|
-
const tmpDir = await getTmpDir()
|
|
14
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
status: 'fulfilled',
|
|
18
|
-
id: 'builtin.plaintext',
|
|
19
|
-
languages: [
|
|
20
|
-
{
|
|
21
|
-
id: 'plaintext',
|
|
22
|
-
label: 'Plaintext',
|
|
23
|
-
tokenize: 'src/tokenizePlainText.js',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
path: tmpDir,
|
|
27
|
-
},
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
expect(await ExtensionHostLanguages.getLanguages()).toEqual([
|
|
31
|
-
{
|
|
32
|
-
id: 'plaintext',
|
|
33
|
-
label: 'Plaintext',
|
|
34
|
-
tokenize: `/remote/${pathToFileURL(
|
|
35
|
-
join(tmpDir, 'src/tokenizePlainText.js')
|
|
36
|
-
)
|
|
37
|
-
.toString()
|
|
38
|
-
.slice(8)}`,
|
|
39
|
-
},
|
|
40
|
-
])
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
// TODO
|
|
44
|
-
test('getLanguages - error - property languages is not of type array', async () => {
|
|
45
|
-
const tmpDir = await getTmpDir()
|
|
46
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
47
|
-
return [
|
|
48
|
-
{
|
|
49
|
-
status: 'fulfilled',
|
|
50
|
-
id: 'builtin.plaintext',
|
|
51
|
-
languages: {},
|
|
52
|
-
path: tmpDir,
|
|
53
|
-
},
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
// TODO should handle error gracefully
|
|
57
|
-
await expect(ExtensionHostLanguages.getLanguages()).rejects.toThrowError(
|
|
58
|
-
new TypeError('extension.languages.map is not a function')
|
|
59
|
-
)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('getLanguages - language without tokenize property', async () => {
|
|
63
|
-
const tmpDir = await getTmpDir()
|
|
64
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
65
|
-
return [
|
|
66
|
-
{
|
|
67
|
-
status: 'fulfilled',
|
|
68
|
-
id: 'builtin.icon-theme-test',
|
|
69
|
-
languages: [
|
|
70
|
-
{
|
|
71
|
-
id: 'plaintext',
|
|
72
|
-
label: 'Plaintext',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
path: tmpDir,
|
|
76
|
-
},
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
expect(await ExtensionHostLanguages.getLanguages()).toEqual([
|
|
80
|
-
{
|
|
81
|
-
id: 'plaintext',
|
|
82
|
-
label: 'Plaintext',
|
|
83
|
-
},
|
|
84
|
-
])
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
test('getLanguages - error - property tokenize is of type array', async () => {
|
|
88
|
-
const tmpDir = await getTmpDir()
|
|
89
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
90
|
-
return [
|
|
91
|
-
{
|
|
92
|
-
status: 'fulfilled',
|
|
93
|
-
id: 'builtin.test',
|
|
94
|
-
languages: [
|
|
95
|
-
{
|
|
96
|
-
id: 'python',
|
|
97
|
-
extensions: ['.py'],
|
|
98
|
-
configuration: './languageConfiguration.json',
|
|
99
|
-
tokenize: ['src/tokenizePython.js'],
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
path: tmpDir,
|
|
103
|
-
},
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
expect(await ExtensionHostLanguages.getLanguages()).toEqual([
|
|
107
|
-
{
|
|
108
|
-
configuration: './languageConfiguration.json',
|
|
109
|
-
extensions: ['.py'],
|
|
110
|
-
id: 'python',
|
|
111
|
-
tokenize: '',
|
|
112
|
-
},
|
|
113
|
-
])
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
test('getLanguageConfiguration', async () => {
|
|
117
|
-
const tmpDir = await getTmpDir()
|
|
118
|
-
await writeFile(
|
|
119
|
-
join(tmpDir, 'languageConfiguration.json'),
|
|
120
|
-
`{
|
|
121
|
-
"comments": {
|
|
122
|
-
"lineComment": "//",
|
|
123
|
-
"blockComment": ["/*", "*/"]
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
`
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
130
|
-
return [
|
|
131
|
-
{
|
|
132
|
-
status: 'fulfilled',
|
|
133
|
-
id: 'builtin.javascript',
|
|
134
|
-
languages: [
|
|
135
|
-
{
|
|
136
|
-
id: 'javascript',
|
|
137
|
-
extensions: ['.js'],
|
|
138
|
-
tokenize: 'src/tokenizeJavaScript.js',
|
|
139
|
-
configuration: './languageConfiguration.json',
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
path: tmpDir,
|
|
143
|
-
},
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
expect(
|
|
147
|
-
await ExtensionHostLanguages.getLanguageConfiguration('javascript')
|
|
148
|
-
).toEqual({
|
|
149
|
-
comments: {
|
|
150
|
-
blockComment: ['/*', '*/'],
|
|
151
|
-
lineComment: '//',
|
|
152
|
-
},
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
test('getLanguageConfiguration - error - language configuration not found', async () => {
|
|
156
|
-
const tmpDir = await getTmpDir()
|
|
157
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
158
|
-
return [
|
|
159
|
-
{
|
|
160
|
-
status: 'fulfilled',
|
|
161
|
-
id: 'builtin.javascript',
|
|
162
|
-
languages: [
|
|
163
|
-
{
|
|
164
|
-
id: 'javascript',
|
|
165
|
-
extensions: ['.js'],
|
|
166
|
-
tokenize: 'src/tokenizeJavaScript.js',
|
|
167
|
-
configuration: './languageConfiguration.json',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
path: tmpDir,
|
|
171
|
-
},
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
const languageConfigurationPath = join(tmpDir, 'languageConfiguration.json')
|
|
175
|
-
await expect(
|
|
176
|
-
ExtensionHostLanguages.getLanguageConfiguration('javascript')
|
|
177
|
-
).rejects.toThrowError(
|
|
178
|
-
new Error(
|
|
179
|
-
`Failed to load language configuration for javascript: ENOENT: no such file or directory, open '${languageConfigurationPath}'`
|
|
180
|
-
)
|
|
181
|
-
)
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
test('getLanguageConfiguration - error - language configuration has invalid json', async () => {
|
|
185
|
-
const tmpDir = await getTmpDir()
|
|
186
|
-
await writeFile(join(tmpDir, 'languageConfiguration.json'), '{')
|
|
187
|
-
ExtensionManagement.state.getExtensions = async () => {
|
|
188
|
-
return [
|
|
189
|
-
{
|
|
190
|
-
status: 'fulfilled',
|
|
191
|
-
id: 'builtin.javascript',
|
|
192
|
-
languages: [
|
|
193
|
-
{
|
|
194
|
-
id: 'javascript',
|
|
195
|
-
extensions: ['.js'],
|
|
196
|
-
tokenize: 'src/tokenizeJavaScript.js',
|
|
197
|
-
configuration: './languageConfiguration.json',
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
path: tmpDir,
|
|
201
|
-
},
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
// TODO should display path as well
|
|
205
|
-
await expect(
|
|
206
|
-
ExtensionHostLanguages.getLanguageConfiguration('javascript')
|
|
207
|
-
).rejects.toThrowError(
|
|
208
|
-
new Error(
|
|
209
|
-
'Failed to load language configuration for javascript: Unexpected end of JSON input while parsing "{"'
|
|
210
|
-
)
|
|
211
|
-
)
|
|
212
|
-
})
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostOutput from '../src/parts/ExtensionHost/ExtensionHostOutput.js'
|
|
2
|
-
|
|
3
|
-
test('getOutputChannels - empty', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
async invoke() {
|
|
6
|
-
return []
|
|
7
|
-
},
|
|
8
|
-
}
|
|
9
|
-
expect(
|
|
10
|
-
await ExtensionHostOutput.getOutputChannels(fakeExtensionHost)
|
|
11
|
-
).toEqual([])
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
test('getOutputChannels - error', async () => {
|
|
15
|
-
const fakeExtensionHost = {
|
|
16
|
-
async invoke() {
|
|
17
|
-
throw new TypeError('x is not a function')
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
await expect(
|
|
21
|
-
ExtensionHostOutput.getOutputChannels(fakeExtensionHost)
|
|
22
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
23
|
-
})
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostRename from '../src/parts/ExtensionHost/ExtensionHostRename.js'
|
|
2
|
-
|
|
3
|
-
test('executePrepareRename', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {
|
|
6
|
-
return {
|
|
7
|
-
canRename: true,
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
expect(
|
|
12
|
-
await ExtensionHostRename.executePrepareRename(fakeExtensionHost, 0, 0)
|
|
13
|
-
).toEqual({
|
|
14
|
-
canRename: true,
|
|
15
|
-
})
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test('executePrepareRename - error', async () => {
|
|
19
|
-
const fakeExtensionHost = {
|
|
20
|
-
invoke() {
|
|
21
|
-
throw new TypeError('x is not a function')
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
await expect(
|
|
25
|
-
ExtensionHostRename.executePrepareRename(fakeExtensionHost, 0, 0)
|
|
26
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test('executeRename', async () => {
|
|
30
|
-
const fakeExtensionHost = {
|
|
31
|
-
invoke() {
|
|
32
|
-
return [
|
|
33
|
-
{
|
|
34
|
-
file: '/test/file.txt',
|
|
35
|
-
edits: [],
|
|
36
|
-
},
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
expect(
|
|
41
|
-
await ExtensionHostRename.executeRename(fakeExtensionHost, 0, 0, '')
|
|
42
|
-
).toEqual([
|
|
43
|
-
{
|
|
44
|
-
file: '/test/file.txt',
|
|
45
|
-
edits: [],
|
|
46
|
-
},
|
|
47
|
-
])
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
test('executeRename - error', async () => {
|
|
51
|
-
const fakeExtensionHost = {
|
|
52
|
-
invoke() {
|
|
53
|
-
throw new TypeError('x is not a function')
|
|
54
|
-
},
|
|
55
|
-
}
|
|
56
|
-
await expect(
|
|
57
|
-
ExtensionHostRename.executeRename(fakeExtensionHost, 0, 0, '')
|
|
58
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
59
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostSemanticTokens from '../src/parts/ExtensionHost/ExtensionHostSemanticTokens.js'
|
|
2
|
-
|
|
3
|
-
test('executeSemanticTokenProvider', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {
|
|
6
|
-
return [1, 2, 3, 4, 5]
|
|
7
|
-
},
|
|
8
|
-
}
|
|
9
|
-
expect(
|
|
10
|
-
await ExtensionHostSemanticTokens.executeSemanticTokenProvider(
|
|
11
|
-
fakeExtensionHost,
|
|
12
|
-
0
|
|
13
|
-
)
|
|
14
|
-
).toEqual([1, 2, 3, 4, 5])
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test('executeCompletionProvider - error', async () => {
|
|
18
|
-
const fakeExtensionHost = {
|
|
19
|
-
invoke() {
|
|
20
|
-
throw new TypeError('x is not a function')
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
await expect(
|
|
24
|
-
ExtensionHostSemanticTokens.executeSemanticTokenProvider(fakeExtensionHost)
|
|
25
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
26
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostTabCompletion from '../src/parts/ExtensionHost/ExtensionHostTabCompletion.js'
|
|
2
|
-
|
|
3
|
-
test('executeTabCompletionProvider', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {
|
|
6
|
-
return {
|
|
7
|
-
inserted: '<div></div>',
|
|
8
|
-
deleted: 0,
|
|
9
|
-
type: /* Snippet */ 2,
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
expect(
|
|
14
|
-
await ExtensionHostTabCompletion.executeTabCompletionProvider(
|
|
15
|
-
fakeExtensionHost,
|
|
16
|
-
0,
|
|
17
|
-
0
|
|
18
|
-
)
|
|
19
|
-
).toEqual({
|
|
20
|
-
inserted: '<div></div>',
|
|
21
|
-
deleted: 0,
|
|
22
|
-
type: /* Snippet */ 2,
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('executeTabCompletionProvider - error', async () => {
|
|
27
|
-
const fakeExtensionHost = {
|
|
28
|
-
invoke() {
|
|
29
|
-
throw new TypeError('x is not a function')
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
await expect(
|
|
33
|
-
ExtensionHostTabCompletion.executeTabCompletionProvider(fakeExtensionHost)
|
|
34
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
35
|
-
})
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostTextDocument from '../src/parts/ExtensionHost/ExtensionHostTextDocument.js'
|
|
2
|
-
|
|
3
|
-
test('textDocumentSyncInitial', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {},
|
|
6
|
-
}
|
|
7
|
-
expect(
|
|
8
|
-
await ExtensionHostTextDocument.textDocumentSyncInitial(
|
|
9
|
-
fakeExtensionHost,
|
|
10
|
-
'/test/file.txt',
|
|
11
|
-
0,
|
|
12
|
-
'',
|
|
13
|
-
''
|
|
14
|
-
)
|
|
15
|
-
).toEqual(undefined)
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test('textDocumentSyncInitial - error', async () => {
|
|
19
|
-
const fakeExtensionHost = {
|
|
20
|
-
async invoke() {
|
|
21
|
-
throw new TypeError('x is not a function')
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
await expect(
|
|
25
|
-
ExtensionHostTextDocument.textDocumentSyncInitial(
|
|
26
|
-
fakeExtensionHost,
|
|
27
|
-
'/test/file.txt',
|
|
28
|
-
0,
|
|
29
|
-
'',
|
|
30
|
-
''
|
|
31
|
-
)
|
|
32
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
test('textDocumentSyncIncremental', async () => {
|
|
36
|
-
const fakeExtensionHost = {
|
|
37
|
-
invoke() {},
|
|
38
|
-
}
|
|
39
|
-
expect(
|
|
40
|
-
await ExtensionHostTextDocument.textDocumentSyncIncremental(
|
|
41
|
-
fakeExtensionHost,
|
|
42
|
-
0,
|
|
43
|
-
[]
|
|
44
|
-
)
|
|
45
|
-
).toEqual(undefined)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
test('textDocumentSyncInitial - error', async () => {
|
|
49
|
-
const fakeExtensionHost = {
|
|
50
|
-
async invoke() {
|
|
51
|
-
throw new TypeError('x is not a function')
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
await expect(
|
|
55
|
-
ExtensionHostTextDocument.textDocumentSyncIncremental(
|
|
56
|
-
fakeExtensionHost,
|
|
57
|
-
0,
|
|
58
|
-
[]
|
|
59
|
-
)
|
|
60
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
61
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostTypeDefinition from '../src/parts/ExtensionHost/ExtensionHostTypeDefinition.js'
|
|
2
|
-
|
|
3
|
-
test('executeTypeDefinitionProvider', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {
|
|
6
|
-
return {
|
|
7
|
-
uri: '/test/file.txt',
|
|
8
|
-
startOffset: 0,
|
|
9
|
-
endOffset: 0,
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
expect(
|
|
14
|
-
await ExtensionHostTypeDefinition.executeTypeDefinitionProvider(
|
|
15
|
-
fakeExtensionHost,
|
|
16
|
-
0,
|
|
17
|
-
0
|
|
18
|
-
)
|
|
19
|
-
).toEqual({
|
|
20
|
-
uri: '/test/file.txt',
|
|
21
|
-
startOffset: 0,
|
|
22
|
-
endOffset: 0,
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('executeTypeDefinitionProvider - error', async () => {
|
|
27
|
-
const fakeExtensionHost = {
|
|
28
|
-
invoke() {
|
|
29
|
-
throw new TypeError('x is not a function')
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
await expect(
|
|
33
|
-
ExtensionHostTypeDefinition.executeTypeDefinitionProvider(fakeExtensionHost)
|
|
34
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
35
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as ExtensionHostWorkspace from '../src/parts/ExtensionHost/ExtensionHostWorkspace.js'
|
|
2
|
-
|
|
3
|
-
test('setWorkspacePath', async () => {
|
|
4
|
-
const fakeExtensionHost = {
|
|
5
|
-
invoke() {},
|
|
6
|
-
}
|
|
7
|
-
expect(
|
|
8
|
-
await ExtensionHostWorkspace.setWorkspacePath(fakeExtensionHost, '/test')
|
|
9
|
-
).toEqual(undefined)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
test('setWorkspacePath - error', async () => {
|
|
13
|
-
const fakeExtensionHost = {
|
|
14
|
-
async invoke() {
|
|
15
|
-
throw new TypeError('x is not a function')
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
await expect(
|
|
19
|
-
ExtensionHostWorkspace.setWorkspacePath(fakeExtensionHost, '/test')
|
|
20
|
-
).rejects.toThrowError(new TypeError('x is not a function'))
|
|
21
|
-
})
|