@vue/language-service 1.9.0-alpha.3 → 2.0.1
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/data/template/en.json +2 -2
- package/data/template/fr.json +1 -1
- package/data/template/ja.json +2 -2
- package/data/template/ko.json +13 -13
- package/data/template/pt.json +18 -18
- package/data/template/zh-cn.json +2 -2
- package/index.d.ts +7 -0
- package/index.js +64 -0
- package/lib/ideFeatures/nameCasing.d.ts +13 -0
- package/{out → lib}/ideFeatures/nameCasing.js +82 -29
- package/lib/plugins/css.d.ts +2 -0
- package/lib/plugins/css.js +27 -0
- package/{out → lib}/plugins/data.d.ts +1 -2
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +10 -0
- package/{out → lib}/plugins/vue-autoinsert-dotvalue.js +70 -54
- package/lib/plugins/vue-autoinsert-parentheses.d.ts +2 -0
- package/lib/plugins/vue-autoinsert-parentheses.js +60 -0
- package/lib/plugins/vue-autoinsert-space.d.ts +2 -0
- package/lib/plugins/vue-autoinsert-space.js +34 -0
- package/lib/plugins/vue-codelens-references.d.ts +2 -0
- package/lib/plugins/vue-codelens-references.js +38 -0
- package/lib/plugins/vue-directive-comments.d.ts +2 -0
- package/lib/plugins/vue-directive-comments.js +61 -0
- package/lib/plugins/vue-document-drop.d.ts +2 -0
- package/lib/plugins/vue-document-drop.js +81 -0
- package/lib/plugins/vue-extract-file.d.ts +8 -0
- package/lib/plugins/vue-extract-file.js +258 -0
- package/lib/plugins/vue-sfc.d.ts +7 -0
- package/lib/plugins/vue-sfc.js +163 -0
- package/lib/plugins/vue-template.d.ts +3 -0
- package/lib/plugins/vue-template.js +594 -0
- package/lib/plugins/vue-toggle-v-bind-codeaction.d.ts +2 -0
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +126 -0
- package/lib/plugins/vue-twoslash-queries.d.ts +2 -0
- package/lib/plugins/vue-twoslash-queries.js +50 -0
- package/lib/plugins/vue-visualize-hidden-callback-param.d.ts +2 -0
- package/lib/plugins/vue-visualize-hidden-callback-param.js +45 -0
- package/{out → lib}/types.d.ts +1 -2
- package/{out → lib}/types.js +1 -1
- package/package.json +20 -20
- package/scripts/update-html-data.js +426 -0
- package/out/helpers.d.ts +0 -17
- package/out/helpers.js +0 -235
- package/out/ideFeatures/dragImport.d.ts +0 -9
- package/out/ideFeatures/dragImport.js +0 -50
- package/out/ideFeatures/nameCasing.d.ts +0 -16
- package/out/index.d.ts +0 -8
- package/out/index.js +0 -26
- package/out/languageService.d.ts +0 -9
- package/out/languageService.js +0 -239
- package/out/plugins/vue-autoinsert-dotvalue.d.ts +0 -7
- package/out/plugins/vue-autoinsert-parentheses.d.ts +0 -3
- package/out/plugins/vue-autoinsert-parentheses.js +0 -61
- package/out/plugins/vue-autoinsert-space.d.ts +0 -3
- package/out/plugins/vue-autoinsert-space.js +0 -32
- package/out/plugins/vue-codelens-references.d.ts +0 -3
- package/out/plugins/vue-codelens-references.js +0 -54
- package/out/plugins/vue-directive-comments.d.ts +0 -3
- package/out/plugins/vue-directive-comments.js +0 -57
- package/out/plugins/vue-extract-file.d.ts +0 -9
- package/out/plugins/vue-extract-file.js +0 -293
- package/out/plugins/vue-template.d.ts +0 -12
- package/out/plugins/vue-template.js +0 -548
- package/out/plugins/vue-toggle-v-bind-codeaction.d.ts +0 -3
- package/out/plugins/vue-toggle-v-bind-codeaction.js +0 -126
- package/out/plugins/vue-twoslash-queries.d.ts +0 -3
- package/out/plugins/vue-twoslash-queries.js +0 -60
- package/out/plugins/vue-visualize-hidden-callback-param.d.ts +0 -3
- package/out/plugins/vue-visualize-hidden-callback-param.js +0 -43
- package/out/plugins/vue.d.ts +0 -8
- package/out/plugins/vue.js +0 -169
- /package/{out → lib}/plugins/data.js +0 -0
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
const create = function () {
|
|
6
|
-
return (ctx, modules) => {
|
|
7
|
-
if (!modules?.typescript)
|
|
8
|
-
return {};
|
|
9
|
-
const ts = modules.typescript;
|
|
10
|
-
return {
|
|
11
|
-
provideCodeActions(document, range, _context) {
|
|
12
|
-
const startOffset = document.offsetAt(range.start);
|
|
13
|
-
const endOffset = document.offsetAt(range.end);
|
|
14
|
-
const [vueFile] = ctx.documents.getVirtualFileByUri(document.uri);
|
|
15
|
-
if (!vueFile || !(vueFile instanceof language_core_1.VueFile)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const { template } = vueFile.sfc;
|
|
19
|
-
if (!template?.ast)
|
|
20
|
-
return;
|
|
21
|
-
const templateStartOffset = template.startTagEnd;
|
|
22
|
-
const result = [];
|
|
23
|
-
(0, language_core_1.walkElementNodes)(template.ast, node => {
|
|
24
|
-
if (startOffset > templateStartOffset + node.loc.end.offset || endOffset < templateStartOffset + node.loc.start.offset) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
for (const prop of node.props) {
|
|
28
|
-
if (startOffset - templateStartOffset >= prop.loc.start.offset
|
|
29
|
-
&& endOffset - templateStartOffset <= prop.loc.end.offset) {
|
|
30
|
-
if (prop.type === 7 && prop.exp) {
|
|
31
|
-
const sourceFile = ts.createSourceFile('/a.ts', prop.exp.loc.source, ts.ScriptTarget.Latest, true);
|
|
32
|
-
const firstStatement = sourceFile.statements[0];
|
|
33
|
-
if (sourceFile.statements.length === 1 && ts.isExpressionStatement(firstStatement) && ts.isStringLiteralLike(firstStatement.expression)) {
|
|
34
|
-
const stringNode = sourceFile.statements[0];
|
|
35
|
-
const removeTextRanges = [
|
|
36
|
-
[prop.loc.start.offset, prop.loc.start.offset + 1],
|
|
37
|
-
// Work correctly with trivias for cases like <input :type=" 'password' " />
|
|
38
|
-
[prop.exp.loc.start.offset, prop.exp.loc.start.offset + stringNode.pos + stringNode.getLeadingTriviaWidth() + 1],
|
|
39
|
-
[prop.exp.loc.start.offset + stringNode.end - 1, prop.exp.loc.end.offset],
|
|
40
|
-
];
|
|
41
|
-
result.push({
|
|
42
|
-
title: 'Remove v-bind from attribute',
|
|
43
|
-
kind: 'refactor.rewrite.removeVBind',
|
|
44
|
-
edit: {
|
|
45
|
-
changes: {
|
|
46
|
-
[document.uri]: removeTextRanges.map(range => ({
|
|
47
|
-
newText: '',
|
|
48
|
-
range: {
|
|
49
|
-
start: document.positionAt(templateStartOffset + range[0]),
|
|
50
|
-
end: document.positionAt(templateStartOffset + range[1]),
|
|
51
|
-
}
|
|
52
|
-
}))
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (prop.type === 6) {
|
|
59
|
-
const edits = [];
|
|
60
|
-
const addVBindPos = document.positionAt(templateStartOffset + prop.loc.start.offset);
|
|
61
|
-
edits.push({
|
|
62
|
-
newText: ':',
|
|
63
|
-
range: {
|
|
64
|
-
start: addVBindPos,
|
|
65
|
-
end: addVBindPos,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
let newPosition;
|
|
69
|
-
if (prop.value) {
|
|
70
|
-
const valueStart = document.positionAt(templateStartOffset + prop.value.loc.start.offset);
|
|
71
|
-
const valueEnd = document.positionAt(templateStartOffset + prop.value.loc.end.offset);
|
|
72
|
-
if (prop.value.loc.end.offset - prop.value.loc.start.offset !== prop.value.content.length) {
|
|
73
|
-
valueStart.character++;
|
|
74
|
-
valueEnd.character--;
|
|
75
|
-
}
|
|
76
|
-
edits.push({
|
|
77
|
-
newText: "'",
|
|
78
|
-
range: {
|
|
79
|
-
start: valueStart,
|
|
80
|
-
end: valueStart,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
edits.push({
|
|
84
|
-
newText: "'",
|
|
85
|
-
range: {
|
|
86
|
-
start: valueEnd,
|
|
87
|
-
end: valueEnd,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const addValuePos = document.positionAt(templateStartOffset + prop.loc.end.offset);
|
|
93
|
-
newPosition = {
|
|
94
|
-
line: addValuePos.line,
|
|
95
|
-
character: addValuePos.character + ':'.length + '="'.length,
|
|
96
|
-
};
|
|
97
|
-
edits.push({
|
|
98
|
-
newText: '=""',
|
|
99
|
-
range: {
|
|
100
|
-
start: addValuePos,
|
|
101
|
-
end: addValuePos
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
result.push({
|
|
106
|
-
title: 'Add v-bind to attribute',
|
|
107
|
-
kind: 'refactor.rewrite.addVBind',
|
|
108
|
-
edit: {
|
|
109
|
-
changes: { [document.uri]: edits },
|
|
110
|
-
},
|
|
111
|
-
command: newPosition ? ctx?.commands.setSelection.create(newPosition) : undefined,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
return result;
|
|
118
|
-
},
|
|
119
|
-
transformCodeAction(item) {
|
|
120
|
-
return item; // ignore mapping
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
exports.create = create;
|
|
126
|
-
//# sourceMappingURL=vue-toggle-v-bind-codeaction.js.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const language_service_1 = require("@volar/language-service");
|
|
5
|
-
const vue = require("@vue/language-core");
|
|
6
|
-
const twoslashReg = /<!--\s*\^\?\s*-->/g;
|
|
7
|
-
const plugin = (context, modules) => {
|
|
8
|
-
if (!context || !modules?.typescript)
|
|
9
|
-
return {};
|
|
10
|
-
const ts = modules.typescript;
|
|
11
|
-
return {
|
|
12
|
-
provideInlayHints(document, range) {
|
|
13
|
-
return worker(document.uri, (vueFile) => {
|
|
14
|
-
const hoverOffsets = [];
|
|
15
|
-
const inlayHints = [];
|
|
16
|
-
const languageService = context.inject('typescript/languageService');
|
|
17
|
-
for (const pointer of document.getText(range).matchAll(twoslashReg)) {
|
|
18
|
-
const offset = pointer.index + pointer[0].indexOf('^?') + document.offsetAt(range.start);
|
|
19
|
-
const position = document.positionAt(offset);
|
|
20
|
-
hoverOffsets.push([position, document.offsetAt({
|
|
21
|
-
line: position.line - 1,
|
|
22
|
-
character: position.character,
|
|
23
|
-
})]);
|
|
24
|
-
}
|
|
25
|
-
(0, language_service_1.forEachEmbeddedFile)(vueFile, (embedded) => {
|
|
26
|
-
if (embedded.kind === language_service_1.FileKind.TypeScriptHostFile) {
|
|
27
|
-
for (const [_, map] of context.documents.getMapsByVirtualFileName(embedded.fileName)) {
|
|
28
|
-
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
29
|
-
for (const [tsOffset, mapping] of map.map.toGeneratedOffsets(hoverOffset)) {
|
|
30
|
-
if (mapping.data.hover) {
|
|
31
|
-
const quickInfo = languageService.getQuickInfoAtPosition(embedded.fileName, tsOffset);
|
|
32
|
-
if (quickInfo) {
|
|
33
|
-
inlayHints.push({
|
|
34
|
-
position: { line: pointerPosition.line, character: pointerPosition.character + 2 },
|
|
35
|
-
label: ts.displayPartsToString(quickInfo.displayParts),
|
|
36
|
-
paddingLeft: true,
|
|
37
|
-
paddingRight: false,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return inlayHints;
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
function worker(uri, callback) {
|
|
52
|
-
const [virtualFile] = context.documents.getVirtualFileByUri(uri);
|
|
53
|
-
if (!(virtualFile instanceof vue.VueFile))
|
|
54
|
-
return;
|
|
55
|
-
return callback(virtualFile);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const create = () => plugin;
|
|
59
|
-
exports.create = create;
|
|
60
|
-
//# sourceMappingURL=vue-twoslash-queries.js.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const plugin = (context) => {
|
|
5
|
-
if (!context)
|
|
6
|
-
return {};
|
|
7
|
-
return {
|
|
8
|
-
async provideInlayHints(document, range) {
|
|
9
|
-
const settings = {};
|
|
10
|
-
const result = [];
|
|
11
|
-
const [file] = context.documents.getVirtualFileByUri(document.uri);
|
|
12
|
-
if (file) {
|
|
13
|
-
const start = document.offsetAt(range.start);
|
|
14
|
-
const end = document.offsetAt(range.end);
|
|
15
|
-
for (const mapping of file.mappings) {
|
|
16
|
-
const hint = mapping.data.__hint;
|
|
17
|
-
if (mapping.generatedRange[0] >= start
|
|
18
|
-
&& mapping.generatedRange[1] <= end
|
|
19
|
-
&& hint) {
|
|
20
|
-
settings[hint.setting] ??= await context.env.getConfiguration?.(hint.setting) ?? false;
|
|
21
|
-
if (!settings[hint.setting])
|
|
22
|
-
continue;
|
|
23
|
-
result.push({
|
|
24
|
-
label: hint.label,
|
|
25
|
-
paddingRight: hint.paddingRight,
|
|
26
|
-
paddingLeft: hint.paddingLeft,
|
|
27
|
-
position: document.positionAt(mapping.generatedRange[0]),
|
|
28
|
-
kind: 2,
|
|
29
|
-
tooltip: {
|
|
30
|
-
kind: 'markdown',
|
|
31
|
-
value: hint.tooltip,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const create = () => plugin;
|
|
42
|
-
exports.create = create;
|
|
43
|
-
//# sourceMappingURL=vue-visualize-hidden-callback-param.js.map
|
package/out/plugins/vue.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Service } from '@volar/language-service';
|
|
2
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import * as vue from '@vue/language-core';
|
|
4
|
-
export interface Provide {
|
|
5
|
-
'vue/vueFile': (document: TextDocument) => vue.VueFile | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare const create: () => Service<Provide>;
|
|
8
|
-
//# sourceMappingURL=vue.d.ts.map
|
package/out/plugins/vue.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const html = require("vscode-html-languageservice");
|
|
5
|
-
const volar_service_html_1 = require("volar-service-html");
|
|
6
|
-
const vue = require("@vue/language-core");
|
|
7
|
-
const data_1 = require("./data");
|
|
8
|
-
let sfcDataProvider;
|
|
9
|
-
const create = () => (context, modules) => {
|
|
10
|
-
const htmlPlugin = (0, volar_service_html_1.default)({ languageId: 'vue', useCustomDataProviders: false })(context, modules);
|
|
11
|
-
if (!context)
|
|
12
|
-
return htmlPlugin;
|
|
13
|
-
sfcDataProvider ??= html.newHTMLDataProvider('vue', (0, data_1.loadLanguageBlocks)(context.env.locale ?? 'en'));
|
|
14
|
-
htmlPlugin.provide['html/languageService']().setDataProviders(false, [sfcDataProvider]);
|
|
15
|
-
return {
|
|
16
|
-
...htmlPlugin,
|
|
17
|
-
provide: {
|
|
18
|
-
'vue/vueFile': document => {
|
|
19
|
-
return worker(document, (vueFile) => {
|
|
20
|
-
return vueFile;
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
provideSemanticDiagnostics(document) {
|
|
25
|
-
return worker(document, (vueSourceFile) => {
|
|
26
|
-
const result = [];
|
|
27
|
-
const sfc = vueSourceFile.sfc;
|
|
28
|
-
const program = context.inject('typescript/languageService').getProgram();
|
|
29
|
-
if (program && !program.getSourceFile(vueSourceFile.mainScriptName)) {
|
|
30
|
-
for (const script of [sfc.script, sfc.scriptSetup]) {
|
|
31
|
-
if (!script || script.content === '')
|
|
32
|
-
continue;
|
|
33
|
-
const error = {
|
|
34
|
-
range: {
|
|
35
|
-
start: document.positionAt(script.start),
|
|
36
|
-
end: document.positionAt(script.startTagEnd),
|
|
37
|
-
},
|
|
38
|
-
message: `Virtual script ${JSON.stringify(vueSourceFile.mainScriptName)} not found, may missing <script lang="ts"> / "allowJs": true / jsconfig.json.`,
|
|
39
|
-
severity: 3,
|
|
40
|
-
source: 'vue',
|
|
41
|
-
};
|
|
42
|
-
result.push(error);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
provideDocumentLinks: undefined,
|
|
49
|
-
provideDocumentSymbols(document) {
|
|
50
|
-
return worker(document, (vueSourceFile) => {
|
|
51
|
-
const result = [];
|
|
52
|
-
const descriptor = vueSourceFile.sfc;
|
|
53
|
-
if (descriptor.template) {
|
|
54
|
-
result.push({
|
|
55
|
-
name: 'template',
|
|
56
|
-
kind: 2,
|
|
57
|
-
range: {
|
|
58
|
-
start: document.positionAt(descriptor.template.start),
|
|
59
|
-
end: document.positionAt(descriptor.template.end),
|
|
60
|
-
},
|
|
61
|
-
selectionRange: {
|
|
62
|
-
start: document.positionAt(descriptor.template.start),
|
|
63
|
-
end: document.positionAt(descriptor.template.startTagEnd),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (descriptor.script) {
|
|
68
|
-
result.push({
|
|
69
|
-
name: 'script',
|
|
70
|
-
kind: 2,
|
|
71
|
-
range: {
|
|
72
|
-
start: document.positionAt(descriptor.script.start),
|
|
73
|
-
end: document.positionAt(descriptor.script.end),
|
|
74
|
-
},
|
|
75
|
-
selectionRange: {
|
|
76
|
-
start: document.positionAt(descriptor.script.start),
|
|
77
|
-
end: document.positionAt(descriptor.script.startTagEnd),
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (descriptor.scriptSetup) {
|
|
82
|
-
result.push({
|
|
83
|
-
name: 'script setup',
|
|
84
|
-
kind: 2,
|
|
85
|
-
range: {
|
|
86
|
-
start: document.positionAt(descriptor.scriptSetup.start),
|
|
87
|
-
end: document.positionAt(descriptor.scriptSetup.end),
|
|
88
|
-
},
|
|
89
|
-
selectionRange: {
|
|
90
|
-
start: document.positionAt(descriptor.scriptSetup.start),
|
|
91
|
-
end: document.positionAt(descriptor.scriptSetup.startTagEnd),
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
for (const style of descriptor.styles) {
|
|
96
|
-
let name = 'style';
|
|
97
|
-
if (style.scoped)
|
|
98
|
-
name += ' scoped';
|
|
99
|
-
if (style.module)
|
|
100
|
-
name += ' module';
|
|
101
|
-
result.push({
|
|
102
|
-
name,
|
|
103
|
-
kind: 2,
|
|
104
|
-
range: {
|
|
105
|
-
start: document.positionAt(style.start),
|
|
106
|
-
end: document.positionAt(style.end),
|
|
107
|
-
},
|
|
108
|
-
selectionRange: {
|
|
109
|
-
start: document.positionAt(style.start),
|
|
110
|
-
end: document.positionAt(style.startTagEnd),
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
for (const customBlock of descriptor.customBlocks) {
|
|
115
|
-
result.push({
|
|
116
|
-
name: `${customBlock.type}`,
|
|
117
|
-
kind: 2,
|
|
118
|
-
range: {
|
|
119
|
-
start: document.positionAt(customBlock.start),
|
|
120
|
-
end: document.positionAt(customBlock.end),
|
|
121
|
-
},
|
|
122
|
-
selectionRange: {
|
|
123
|
-
start: document.positionAt(customBlock.start),
|
|
124
|
-
end: document.positionAt(customBlock.startTagEnd),
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
provideDocumentFormattingEdits(document) {
|
|
132
|
-
return worker(document, (vueSourceFile) => {
|
|
133
|
-
const blocks = [
|
|
134
|
-
vueSourceFile.sfc.script,
|
|
135
|
-
vueSourceFile.sfc.scriptSetup,
|
|
136
|
-
vueSourceFile.sfc.template,
|
|
137
|
-
...vueSourceFile.sfc.styles,
|
|
138
|
-
...vueSourceFile.sfc.customBlocks,
|
|
139
|
-
].filter((block) => !!block)
|
|
140
|
-
.sort((a, b) => b.start - a.start);
|
|
141
|
-
const edits = [];
|
|
142
|
-
for (const block of blocks) {
|
|
143
|
-
const startPos = document.positionAt(block.start);
|
|
144
|
-
if (startPos.character !== 0) {
|
|
145
|
-
edits.push({
|
|
146
|
-
range: {
|
|
147
|
-
start: {
|
|
148
|
-
line: startPos.line,
|
|
149
|
-
character: 0,
|
|
150
|
-
},
|
|
151
|
-
end: startPos,
|
|
152
|
-
},
|
|
153
|
-
newText: '',
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return edits;
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
function worker(document, callback) {
|
|
162
|
-
const [vueFile] = context.documents.getVirtualFileByUri(document.uri);
|
|
163
|
-
if (vueFile instanceof vue.VueFile) {
|
|
164
|
-
return callback(vueFile);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
exports.create = create;
|
|
169
|
-
//# sourceMappingURL=vue.js.map
|
|
File without changes
|