volar-service-html 0.0.37 → 0.0.38
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/index.js +9 -8
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -263,25 +263,26 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
|
|
|
263
263
|
return { ranges };
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
|
-
async provideAutoInsertionEdit(document,
|
|
266
|
+
async provideAutoInsertionEdit(document, selection, change) {
|
|
267
|
+
// selection must at end of change
|
|
268
|
+
if (document.offsetAt(selection) !== change.rangeOffset + change.text.length) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
267
271
|
return worker(document, async (htmlDocument) => {
|
|
268
|
-
|
|
269
|
-
const rangeLengthIsZero = lastChange.range.start.line === lastChange.range.end.line
|
|
270
|
-
&& lastChange.range.start.character === lastChange.range.end.character;
|
|
271
|
-
if (rangeLengthIsZero && lastCharacter === '=') {
|
|
272
|
+
if (change.rangeLength === 0 && change.text.endsWith('=')) {
|
|
272
273
|
const enabled = await isAutoCreateQuotesEnabled(document, context);
|
|
273
274
|
if (enabled) {
|
|
274
275
|
const completionConfiguration = await getCompletionConfiguration(document, context);
|
|
275
|
-
const text = htmlLs.doQuoteComplete(document,
|
|
276
|
+
const text = htmlLs.doQuoteComplete(document, selection, htmlDocument, completionConfiguration);
|
|
276
277
|
if (text) {
|
|
277
278
|
return text;
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
|
-
if (
|
|
282
|
+
if (change.rangeLength === 0 && (change.text.endsWith('>') || change.text.endsWith('/'))) {
|
|
282
283
|
const enabled = await isAutoClosingTagsEnabled(document, context);
|
|
283
284
|
if (enabled) {
|
|
284
|
-
const text = htmlLs.doTagComplete(document,
|
|
285
|
+
const text = htmlLs.doTagComplete(document, selection, htmlDocument);
|
|
285
286
|
if (text) {
|
|
286
287
|
return text;
|
|
287
288
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "Integrate vscode-languageservice-html into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/html",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"@types/node": "latest"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@volar/language-service": "~2.2.0-alpha.
|
|
35
|
+
"@volar/language-service": "~2.2.0-alpha.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@volar/language-service": {
|
|
39
39
|
"optional": true
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "65ba3d69ae39a3c780622c62a410ecff495e36a7"
|
|
43
43
|
}
|