volar-service-html 0.0.17 → 0.0.19
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/out/index.d.ts +2 -3
- package/out/index.js +228 -229
- package/package.json +3 -3
package/out/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServicePlugin } from '@volar/language-service';
|
|
2
2
|
import * as html from 'vscode-html-languageservice';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
export interface Provide {
|
|
@@ -12,6 +12,5 @@ export declare function create({ languageId, useDefaultDataProvider, useCustomDa
|
|
|
12
12
|
languageId?: string;
|
|
13
13
|
useDefaultDataProvider?: boolean;
|
|
14
14
|
useCustomDataProviders?: boolean;
|
|
15
|
-
}):
|
|
16
|
-
export default create;
|
|
15
|
+
}): ServicePlugin;
|
|
17
16
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.js
CHANGED
|
@@ -18,258 +18,257 @@ function getHtmlDocument(document) {
|
|
|
18
18
|
return doc;
|
|
19
19
|
}
|
|
20
20
|
exports.getHtmlDocument = getHtmlDocument;
|
|
21
|
-
// https://github.com/microsoft/vscode/blob/09850876e652688fb142e2e19fd00fd38c0bc4ba/extensions/html-language-features/server/src/htmlServer.ts#L183
|
|
22
|
-
const triggerCharacters = ['.', ':', '<', '"', '=', '/'];
|
|
23
21
|
function create({ languageId = 'html', useDefaultDataProvider = true, useCustomDataProviders = true, } = {}) {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
readDirectory: async (uri) => context.env.fs?.readDirectory(uri) ?? [],
|
|
39
|
-
};
|
|
40
|
-
const documentContext = {
|
|
41
|
-
resolveReference(ref, base) {
|
|
42
|
-
if (ref.match(/^\w[\w\d+.-]*:/)) {
|
|
43
|
-
// starts with a schema
|
|
44
|
-
return ref;
|
|
45
|
-
}
|
|
46
|
-
if (ref[0] === '/') { // resolve absolute path against the current workspace folder
|
|
47
|
-
return base + ref;
|
|
48
|
-
}
|
|
49
|
-
const baseUri = vscode_uri_1.URI.parse(base);
|
|
50
|
-
const baseUriDir = baseUri.path.endsWith('/') ? baseUri : vscode_uri_1.Utils.dirname(baseUri);
|
|
51
|
-
return vscode_uri_1.Utils.resolvePath(baseUriDir, ref).toString(true);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
const htmlLs = html.getLanguageService({
|
|
55
|
-
fileSystemProvider,
|
|
56
|
-
clientCapabilities: context.env.clientCapabilities,
|
|
57
|
-
});
|
|
58
|
-
context.env.onDidChangeConfiguration?.(() => {
|
|
59
|
-
shouldUpdateCustomData = true;
|
|
60
|
-
});
|
|
61
|
-
return {
|
|
62
|
-
provide: {
|
|
63
|
-
'html/htmlDocument': (document) => {
|
|
64
|
-
if (document.languageId === languageId) {
|
|
65
|
-
return getHtmlDocument(document);
|
|
66
|
-
}
|
|
22
|
+
return {
|
|
23
|
+
// https://github.com/microsoft/vscode/blob/09850876e652688fb142e2e19fd00fd38c0bc4ba/extensions/html-language-features/server/src/htmlServer.ts#L183
|
|
24
|
+
triggerCharacters: ['.', ':', '<', '"', '=', '/'],
|
|
25
|
+
create(context) {
|
|
26
|
+
let shouldUpdateCustomData = true;
|
|
27
|
+
let customData = [];
|
|
28
|
+
let extraData = [];
|
|
29
|
+
const fileSystemProvider = {
|
|
30
|
+
stat: async (uri) => await context.env.fs?.stat(uri) ?? {
|
|
31
|
+
type: html.FileType.Unknown,
|
|
32
|
+
ctime: 0,
|
|
33
|
+
mtime: 0,
|
|
34
|
+
size: 0,
|
|
67
35
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const configs = await context.env.getConfiguration?.('html.completion');
|
|
76
|
-
return htmlLs.doComplete2(document, position, htmlDocument, documentContext, configs);
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
provideRenameRange(document, position) {
|
|
80
|
-
return worker(document, (htmlDocument) => {
|
|
81
|
-
const offset = document.offsetAt(position);
|
|
82
|
-
return htmlLs
|
|
83
|
-
.findDocumentHighlights(document, position, htmlDocument)
|
|
84
|
-
?.find(h => offset >= document.offsetAt(h.range.start) && offset <= document.offsetAt(h.range.end))
|
|
85
|
-
?.range;
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
provideRenameEdits(document, position, newName) {
|
|
89
|
-
return worker(document, (htmlDocument) => {
|
|
90
|
-
return htmlLs.doRename(document, position, newName, htmlDocument);
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
async provideHover(document, position) {
|
|
94
|
-
return worker(document, async (htmlDocument) => {
|
|
95
|
-
const hoverSettings = await context.env.getConfiguration?.('html.hover');
|
|
96
|
-
return htmlLs.doHover(document, position, htmlDocument, hoverSettings);
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
provideDocumentHighlights(document, position) {
|
|
100
|
-
return worker(document, (htmlDocument) => {
|
|
101
|
-
return htmlLs.findDocumentHighlights(document, position, htmlDocument);
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
provideDocumentLinks(document) {
|
|
105
|
-
return worker(document, () => {
|
|
106
|
-
return htmlLs.findDocumentLinks(document, documentContext);
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
provideDocumentSymbols(document) {
|
|
110
|
-
return worker(document, (htmlDocument) => {
|
|
111
|
-
return htmlLs.findDocumentSymbols2(document, htmlDocument);
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
provideFoldingRanges(document) {
|
|
115
|
-
return worker(document, () => {
|
|
116
|
-
return htmlLs.getFoldingRanges(document);
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
provideSelectionRanges(document, positions) {
|
|
120
|
-
return worker(document, () => {
|
|
121
|
-
return htmlLs.getSelectionRanges(document, positions);
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
async provideDocumentFormattingEdits(document, formatRange, options) {
|
|
125
|
-
return worker(document, async () => {
|
|
126
|
-
const options_2 = await context.env.getConfiguration?.('html.format');
|
|
127
|
-
if (options_2?.enable === false) {
|
|
128
|
-
return;
|
|
36
|
+
readDirectory: async (uri) => context.env.fs?.readDirectory(uri) ?? [],
|
|
37
|
+
};
|
|
38
|
+
const documentContext = {
|
|
39
|
+
resolveReference(ref, base) {
|
|
40
|
+
if (ref.match(/^\w[\w\d+.-]*:/)) {
|
|
41
|
+
// starts with a schema
|
|
42
|
+
return ref;
|
|
129
43
|
}
|
|
130
|
-
{ //
|
|
131
|
-
|
|
132
|
-
let endOffset = document.offsetAt(endPos);
|
|
133
|
-
const content = document.getText();
|
|
134
|
-
if (endPos.character === 0 && endPos.line > 0 && endOffset !== content.length) {
|
|
135
|
-
// if selection ends after a new line, exclude that new line
|
|
136
|
-
const prevLineStart = document.offsetAt({ line: endPos.line - 1, character: 0 });
|
|
137
|
-
while (isEOL(content, endOffset - 1) && endOffset > prevLineStart) {
|
|
138
|
-
endOffset--;
|
|
139
|
-
}
|
|
140
|
-
formatRange = {
|
|
141
|
-
start: formatRange.start,
|
|
142
|
-
end: document.positionAt(endOffset),
|
|
143
|
-
};
|
|
144
|
-
}
|
|
44
|
+
if (ref[0] === '/') { // resolve absolute path against the current workspace folder
|
|
45
|
+
return base + ref;
|
|
145
46
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
47
|
+
const baseUri = vscode_uri_1.URI.parse(base);
|
|
48
|
+
const baseUriDir = baseUri.path.endsWith('/') ? baseUri : vscode_uri_1.Utils.dirname(baseUri);
|
|
49
|
+
return vscode_uri_1.Utils.resolvePath(baseUriDir, ref).toString(true);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const htmlLs = html.getLanguageService({
|
|
53
|
+
fileSystemProvider,
|
|
54
|
+
clientCapabilities: context.env.clientCapabilities,
|
|
55
|
+
});
|
|
56
|
+
context.env.onDidChangeConfiguration?.(() => {
|
|
57
|
+
shouldUpdateCustomData = true;
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
provide: {
|
|
61
|
+
'html/htmlDocument': (document) => {
|
|
62
|
+
if (document.languageId === languageId) {
|
|
63
|
+
return getHtmlDocument(document);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
'html/languageService': () => htmlLs,
|
|
67
|
+
'html/documentContext': () => documentContext,
|
|
68
|
+
'html/updateCustomData': updateExtraCustomData,
|
|
69
|
+
},
|
|
70
|
+
async provideCompletionItems(document, position) {
|
|
71
|
+
return worker(document, async (htmlDocument) => {
|
|
72
|
+
const configs = await context.env.getConfiguration?.('html.completion');
|
|
73
|
+
return htmlLs.doComplete2(document, position, htmlDocument, documentContext, configs);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
provideRenameRange(document, position) {
|
|
77
|
+
return worker(document, (htmlDocument) => {
|
|
78
|
+
const offset = document.offsetAt(position);
|
|
79
|
+
return htmlLs
|
|
80
|
+
.findDocumentHighlights(document, position, htmlDocument)
|
|
81
|
+
?.find(h => offset >= document.offsetAt(h.range.start) && offset <= document.offsetAt(h.range.end))
|
|
82
|
+
?.range;
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
provideRenameEdits(document, position, newName) {
|
|
86
|
+
return worker(document, (htmlDocument) => {
|
|
87
|
+
return htmlLs.doRename(document, position, newName, htmlDocument);
|
|
149
88
|
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
89
|
+
},
|
|
90
|
+
async provideHover(document, position) {
|
|
91
|
+
return worker(document, async (htmlDocument) => {
|
|
92
|
+
const hoverSettings = await context.env.getConfiguration?.('html.hover');
|
|
93
|
+
return htmlLs.doHover(document, position, htmlDocument, hoverSettings);
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
provideDocumentHighlights(document, position) {
|
|
97
|
+
return worker(document, (htmlDocument) => {
|
|
98
|
+
return htmlLs.findDocumentHighlights(document, position, htmlDocument);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
provideDocumentLinks(document) {
|
|
102
|
+
return worker(document, () => {
|
|
103
|
+
return htmlLs.findDocumentLinks(document, documentContext);
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
provideDocumentSymbols(document) {
|
|
107
|
+
return worker(document, (htmlDocument) => {
|
|
108
|
+
return htmlLs.findDocumentSymbols2(document, htmlDocument);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
provideFoldingRanges(document) {
|
|
112
|
+
return worker(document, () => {
|
|
113
|
+
return htmlLs.getFoldingRanges(document);
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
provideSelectionRanges(document, positions) {
|
|
117
|
+
return worker(document, () => {
|
|
118
|
+
return htmlLs.getSelectionRanges(document, positions);
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
async provideDocumentFormattingEdits(document, formatRange, options) {
|
|
122
|
+
return worker(document, async () => {
|
|
123
|
+
const options_2 = await context.env.getConfiguration?.('html.format');
|
|
124
|
+
if (options_2?.enable === false) {
|
|
125
|
+
return;
|
|
164
126
|
}
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
127
|
+
{ // https://github.com/microsoft/vscode/blob/dce493cb6e36346ef2714e82c42ce14fc461b15c/extensions/html-language-features/server/src/modes/formatting.ts#L13-L23
|
|
128
|
+
const endPos = formatRange.end;
|
|
129
|
+
let endOffset = document.offsetAt(endPos);
|
|
130
|
+
const content = document.getText();
|
|
131
|
+
if (endPos.character === 0 && endPos.line > 0 && endOffset !== content.length) {
|
|
132
|
+
// if selection ends after a new line, exclude that new line
|
|
133
|
+
const prevLineStart = document.offsetAt({ line: endPos.line - 1, character: 0 });
|
|
134
|
+
while (isEOL(content, endOffset - 1) && endOffset > prevLineStart) {
|
|
135
|
+
endOffset--;
|
|
136
|
+
}
|
|
137
|
+
formatRange = {
|
|
138
|
+
start: formatRange.start,
|
|
139
|
+
end: document.positionAt(endOffset),
|
|
140
|
+
};
|
|
169
141
|
}
|
|
170
|
-
startCommentTagLine = undefined;
|
|
171
142
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
143
|
+
return htmlLs.format(document, formatRange, {
|
|
144
|
+
...options_2,
|
|
145
|
+
...options,
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
provideFormattingIndentSensitiveLines(document) {
|
|
150
|
+
return worker(document, (htmlDocument) => {
|
|
151
|
+
const lines = [];
|
|
152
|
+
/**
|
|
153
|
+
* comments
|
|
154
|
+
*/
|
|
155
|
+
const scanner = htmlLs.createScanner(document.getText());
|
|
156
|
+
let token = scanner.scan();
|
|
157
|
+
let startCommentTagLine;
|
|
158
|
+
while (token !== html.TokenType.EOS) {
|
|
159
|
+
if (token === html.TokenType.StartCommentTag) {
|
|
160
|
+
startCommentTagLine = document.positionAt(scanner.getTokenOffset()).line;
|
|
176
161
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// https://github.com/beautify-web/js-beautify/blob/686f8c1b265990908ece86ce39291733c75c997c/js/src/html/options.js#L81
|
|
184
|
-
const indentSensitiveTags = new Set(['pre', 'textarea']);
|
|
185
|
-
htmlDocument.roots.forEach(function visit(node) {
|
|
186
|
-
if (node.tag !== undefined
|
|
187
|
-
&& node.startTagEnd !== undefined
|
|
188
|
-
&& node.endTagStart !== undefined
|
|
189
|
-
&& indentSensitiveTags.has(node.tag)) {
|
|
190
|
-
for (let i = document.positionAt(node.startTagEnd).line + 1; i <= document.positionAt(node.endTagStart).line; i++) {
|
|
191
|
-
lines.push(i);
|
|
162
|
+
else if (token === html.TokenType.EndCommentTag) {
|
|
163
|
+
const line = document.positionAt(scanner.getTokenOffset()).line;
|
|
164
|
+
for (let i = startCommentTagLine + 1; i <= line; i++) {
|
|
165
|
+
lines.push(i);
|
|
166
|
+
}
|
|
167
|
+
startCommentTagLine = undefined;
|
|
192
168
|
}
|
|
169
|
+
else if (token === html.TokenType.AttributeValue) {
|
|
170
|
+
const startLine = document.positionAt(scanner.getTokenOffset()).line;
|
|
171
|
+
for (let i = 1; i < scanner.getTokenText().split('\n').length; i++) {
|
|
172
|
+
lines.push(startLine + i);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
token = scanner.scan();
|
|
193
176
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
177
|
+
/**
|
|
178
|
+
* tags
|
|
179
|
+
*/
|
|
180
|
+
// https://github.com/beautify-web/js-beautify/blob/686f8c1b265990908ece86ce39291733c75c997c/js/src/html/options.js#L81
|
|
181
|
+
const indentSensitiveTags = new Set(['pre', 'textarea']);
|
|
182
|
+
htmlDocument.roots.forEach(function visit(node) {
|
|
183
|
+
if (node.tag !== undefined
|
|
184
|
+
&& node.startTagEnd !== undefined
|
|
185
|
+
&& node.endTagStart !== undefined
|
|
186
|
+
&& indentSensitiveTags.has(node.tag)) {
|
|
187
|
+
for (let i = document.positionAt(node.startTagEnd).line + 1; i <= document.positionAt(node.endTagStart).line; i++) {
|
|
188
|
+
lines.push(i);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
node.children.forEach(visit);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return lines;
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
provideLinkedEditingRanges(document, position) {
|
|
199
|
+
return worker(document, (htmlDocument) => {
|
|
200
|
+
const ranges = htmlLs.findLinkedEditingRanges(document, position, htmlDocument);
|
|
201
|
+
if (!ranges)
|
|
202
|
+
return;
|
|
203
|
+
return { ranges };
|
|
197
204
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const lastCharacter = insertContext.lastChange.text[insertContext.lastChange.text.length - 1];
|
|
212
|
-
if (insertContext.lastChange.rangeLength === 0 && lastCharacter === '=') {
|
|
213
|
-
const enabled = (await context.env.getConfiguration?.('html.autoCreateQuotes')) ?? true;
|
|
214
|
-
if (enabled) {
|
|
215
|
-
const text = htmlLs.doQuoteComplete(document, position, htmlDocument, await context.env.getConfiguration?.('html.completion'));
|
|
216
|
-
if (text) {
|
|
217
|
-
return text;
|
|
205
|
+
},
|
|
206
|
+
async provideAutoInsertionEdit(document, position, lastChange) {
|
|
207
|
+
return worker(document, async (htmlDocument) => {
|
|
208
|
+
const lastCharacter = lastChange.text[lastChange.text.length - 1];
|
|
209
|
+
const rangeLengthIsZero = lastChange.range.start.line && lastChange.range.end.line
|
|
210
|
+
&& lastChange.range.start.character && lastChange.range.end.character;
|
|
211
|
+
if (rangeLengthIsZero && lastCharacter === '=') {
|
|
212
|
+
const enabled = (await context.env.getConfiguration?.('html.autoCreateQuotes')) ?? true;
|
|
213
|
+
if (enabled) {
|
|
214
|
+
const text = htmlLs.doQuoteComplete(document, position, htmlDocument, await context.env.getConfiguration?.('html.completion'));
|
|
215
|
+
if (text) {
|
|
216
|
+
return text;
|
|
217
|
+
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
220
|
+
if (rangeLengthIsZero && (lastCharacter === '>' || lastCharacter === '/')) {
|
|
221
|
+
const enabled = (await context.env.getConfiguration?.('html.autoClosingTags')) ?? true;
|
|
222
|
+
if (enabled) {
|
|
223
|
+
const text = htmlLs.doTagComplete(document, position, htmlDocument);
|
|
224
|
+
if (text) {
|
|
225
|
+
return text;
|
|
226
|
+
}
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
async function initCustomData() {
|
|
233
|
+
if (shouldUpdateCustomData && useCustomDataProviders) {
|
|
234
|
+
shouldUpdateCustomData = false;
|
|
235
|
+
customData = await getCustomData();
|
|
236
|
+
htmlLs.setDataProviders(useDefaultDataProvider, [...customData, ...extraData]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function updateExtraCustomData(data) {
|
|
240
|
+
extraData = data;
|
|
237
241
|
htmlLs.setDataProviders(useDefaultDataProvider, [...customData, ...extraData]);
|
|
238
242
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
newData.push(html.newHTMLDataProvider(customDataPath, require(jsonPath)));
|
|
253
|
-
}
|
|
254
|
-
catch (error) {
|
|
255
|
-
console.error(error);
|
|
243
|
+
async function getCustomData() {
|
|
244
|
+
const customData = await context.env.getConfiguration?.('html.customData') ?? [];
|
|
245
|
+
const newData = [];
|
|
246
|
+
for (const customDataPath of customData) {
|
|
247
|
+
try {
|
|
248
|
+
const pathModuleName = 'path'; // avoid bundle
|
|
249
|
+
const { posix: path } = require(pathModuleName);
|
|
250
|
+
const jsonPath = path.resolve(customDataPath);
|
|
251
|
+
newData.push(html.newHTMLDataProvider(customDataPath, require(jsonPath)));
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
console.error(error);
|
|
255
|
+
}
|
|
256
256
|
}
|
|
257
|
+
return newData;
|
|
257
258
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
259
|
+
async function worker(document, callback) {
|
|
260
|
+
if (document.languageId !== languageId)
|
|
261
|
+
return;
|
|
262
|
+
const htmlDocument = getHtmlDocument(document);
|
|
263
|
+
if (!htmlDocument)
|
|
264
|
+
return;
|
|
265
|
+
await initCustomData();
|
|
266
|
+
return callback(htmlDocument);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
exports.create = create;
|
|
272
|
-
exports.default = create;
|
|
273
272
|
function isEOL(content, offset) {
|
|
274
273
|
return isNewlineCharacter(content.charCodeAt(offset));
|
|
275
274
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
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",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"vscode-languageserver-textdocument": "^1.0.11"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@volar/language-service": "
|
|
36
|
+
"@volar/language-service": "2.0.0-alpha.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@volar/language-service": {
|
|
40
40
|
"optional": true
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ccd6cfec1b676091acd2f9ea78e1b695a4bf1dd1"
|
|
44
44
|
}
|