ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / css-language-features / server / src / test / completion.test.ts 205 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import { suite, test } from 'node:test' ;
import assert from 'node:assert/strict' ;
import * as path from 'node:path' ;
import { URI } from 'vscode-uri' ;
import { TextDocument, CompletionList, TextEdit } from 'vscode-languageserver-types' ;
import { WorkspaceFolder } from 'vscode-languageserver-protocol' ;
import { getCSSLanguageService, LanguageServiceOptions, getSCSSLanguageService } from 'vscode-css-languageservice' ;
import getNodeFSRequestService
getDocumentContext
label
resultText
completions CompletionList expected ItemDescription document TextDocument _offset
matches completions items completion
completion label expected label
assert matches length
match matches
expected resultText TextEdit match textEdit
assert TextDocument document match textEdit expected resultText
value expected count items ItemDescription testUri workspaceFolders WorkspaceFolder lang
offset value
value value offset value offset
document TextDocument testUri lang value
position document offset
workspaceFolders
workspaceFolders name uri testUri testUri
lsOptions LanguageServiceOptions fileSystemProvider
cssLanguageService lang lsOptions lsOptions
context testUri workspaceFolders
stylesheet cssLanguageService document
list cssLanguageService document position stylesheet context
expected count
assert list items length expected count
expected items
item expected items
list item document offset
testUri path meta dirname
folders name uri path meta dirname
items
label resultText
testUri folders
items
label resultText
label resultText
label resultText
testUri folders
items
label resultText
label resultText
label resultText
testUri folders
items
label resultText
testUri folders
items
label resultText
testUri folders
items
label resultText
testUri folders
items
label resultText
label resultText
label resultText
testUri folders
items
label resultText
testUri folders
testUri path meta dirname
folders name uri path meta dirname
items
label resultText
testUri folders
items
label resultText
testUri folders
items
label resultText
testUri folders
items
label resultText
testUri folders
testUri path meta dirname
folders name uri path meta dirname
items
label resultText
testUri folders
items
label resultText
label resultText
label resultText
label resultText
testUri folders
testCSSUri path meta dirname
folders name uri path meta dirname
items
label resultText
label resultText
testCSSUri folders
testSCSSUri path meta dirname
items
label resultText
testSCSSUri folders
testUri path meta dirname
folders name uri path meta dirname
count
testUri folders
{
}
from
'../node/nodeFs.js'
;
import
{
}
from
'../utils/documentContext.js'
;
export
interface
ItemDescription
{
:
string
;
?
:
string
;
}
suite
(
'Completions'
,
(
)
=>
{
const
assertCompletion
=
function
(
:
,
:
,
:
,
:
number
)
{
const
=
.
.
filter
(
=>
{
return
.
===
.
;
}
)
;
.
strictEqual
(
.
,
1
,
` ${ expected. label} should only existing once: Actual: ${ completions. items. map ( c => c. label) . join ( ', ' ) } `
)
;
const
=
[
0
]
;
if
(
.
&&
.
is
(
.
)
)
{
.
strictEqual
(
.
applyEdits
(
,
[
.
]
)
,
.
)
;
}
}
;
async
function
assertCompletions
(
:
string
,
:
{
?
:
number
;
?
:
[
]
}
,
:
string
,
?
:
[
]
,
:
string
=
'css'
)
:
Promise
<
any
>
{
const
=
.
indexOf
(
'|'
)
;
=
.
substr
(
0
,
)
+
.
substr
(
+
1
)
;
const
=
.
create
(
,
,
0
,
)
;
const
=
.
positionAt
(
)
;
if
(
!
)
{
=
[
{
:
'x'
,
:
.
substr
(
0
,
.
lastIndexOf
(
'/'
)
)
}
]
;
}
const
:
=
{
:
getNodeFSRequestService
(
)
}
;
const
=
===
'scss'
?
getSCSSLanguageService
(
)
:
getCSSLanguageService
(
)
;
const
=
getDocumentContext
(
,
)
;
const
=
.
parseStylesheet
(
)
;
const
=
await
.
doComplete2
(
,
,
,
)
;
if
(
.
)
{
.
strictEqual
(
.
.
,
.
)
;
}
if
(
.
)
{
for
(
const
of
.
)
{
assertCompletion
(
,
,
,
)
;
}
}
}
test
(
'CSS url() Path completion'
,
async
function
(
)
{
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/about/about.css'
)
)
.
toString
(
true
)
;
const
=
[
{
:
'x'
,
:
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test'
)
)
.
toString
(
true
)
}
]
;
await
assertCompletions
(
'html { background-image: url("./|")'
,
{
:
[
{
:
'about.html'
,
:
'html { background-image: url("./about.html")'
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('../|') `
,
{
:
[
{
:
'about/'
,
:
` html { background-image: url('../about/') `
}
,
{
:
'index.html'
,
:
` html { background-image: url('../index.html') `
}
,
{
:
'src/'
,
:
` html { background-image: url('../src/') `
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('../src/a|') `
,
{
:
[
{
:
'feature.js'
,
:
` html { background-image: url('../src/feature.js') `
}
,
{
:
'data/'
,
:
` html { background-image: url('../src/data/') `
}
,
{
:
'test.js'
,
:
` html { background-image: url('../src/test.js') `
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('../src/data/f|.asar') `
,
{
:
[
{
:
'foo.asar'
,
:
` html { background-image: url('../src/data/foo.asar') `
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('|') `
,
{
:
[
{
:
'about.html'
,
:
` html { background-image: url('about.html') `
}
,
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('/|') `
,
{
:
[
{
:
'pathCompletionFixtures/'
,
:
` html { background-image: url('/pathCompletionFixtures/') `
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url('/pathCompletionFixtures/|') `
,
{
:
[
{
:
'about/'
,
:
` html { background-image: url('/pathCompletionFixtures/about/') `
}
,
{
:
'index.html'
,
:
` html { background-image: url('/pathCompletionFixtures/index.html') `
}
,
{
:
'src/'
,
:
` html { background-image: url('/pathCompletionFixtures/src/') `
}
]
}
,
,
)
;
await
assertCompletions
(
` html { background-image: url("/|") `
,
{
:
[
{
:
'pathCompletionFixtures/'
,
:
` html { background-image: url("/pathCompletionFixtures/") `
}
]
}
,
,
)
;
}
)
;
test
(
'CSS url() Path Completion - Unquoted url'
,
async
function
(
)
{
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/about/about.css'
)
)
.
toString
(
true
)
;
const
=
[
{
:
'x'
,
:
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test'
)
)
.
toString
(
true
)
}
]
;
await
assertCompletions
(
'html { background-image: url(./|)'
,
{
:
[
{
:
'about.html'
,
:
'html { background-image: url(./about.html)'
}
]
}
,
,
)
;
await
assertCompletions
(
'html { background-image: url(./a|)'
,
{
:
[
{
:
'about.html'
,
:
'html { background-image: url(./about.html)'
}
]
}
,
,
)
;
await
assertCompletions
(
'html { background-image: url(../|src/)'
,
{
:
[
{
:
'about/'
,
:
'html { background-image: url(../about/)'
}
]
}
,
,
)
;
await
assertCompletions
(
'html { background-image: url(../s|rc/)'
,
{
:
[
{
:
'about/'
,
:
'html { background-image: url(../about/)'
}
]
}
,
,
)
;
}
)
;
test
(
'CSS @import Path completion'
,
async
function
(
)
{
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/about/about.css'
)
)
.
toString
(
true
)
;
const
=
[
{
:
'x'
,
:
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test'
)
)
.
toString
(
true
)
}
]
;
await
assertCompletions
(
` @import './|' `
,
{
:
[
{
:
'about.html'
,
:
` @import './about.html' `
}
,
]
}
,
,
)
;
await
assertCompletions
(
` @import '../|' `
,
{
:
[
{
:
'about/'
,
:
` @import '../about/' `
}
,
{
:
'scss/'
,
:
` @import '../scss/' `
}
,
{
:
'index.html'
,
:
` @import '../index.html' `
}
,
{
:
'src/'
,
:
` @import '../src/' `
}
]
}
,
,
)
;
}
)
;
test
(
'SCSS @import Path completion'
,
async
function
(
)
{
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/about/about.css'
)
)
.
toString
(
true
)
;
const
=
[
{
:
'x'
,
:
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test'
)
)
.
toString
(
true
)
}
]
;
await
assertCompletions
(
` @import '../scss/|' `
,
{
:
[
{
:
'main.scss'
,
:
` @import '../scss/main.scss' `
}
,
{
:
'_foo.scss'
,
:
` @import '../scss/_foo.scss' `
}
]
}
,
,
)
;
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/scss/main.scss'
)
)
.
toString
(
true
)
;
await
assertCompletions
(
` @import './|' `
,
{
:
[
{
:
'_foo.scss'
,
:
` @import './foo' `
}
]
}
,
,
,
'scss'
)
;
}
)
;
test
(
'Completion should ignore files/folders starting with dot'
,
async
function
(
)
{
const
=
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test/pathCompletionFixtures/about/about.css'
)
)
.
toString
(
true
)
;
const
=
[
{
:
'x'
,
:
URI
.
file
(
.
resolve
(
import
.
.
,
'../../test'
)
)
.
toString
(
true
)
}
]
;
await
assertCompletions
(
'html { background-image: url("../|")'
,
{
:
4
}
,
,
)
;
}
)
;
}
)
;