@vue/language-service 1.8.25 → 1.8.27
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.27",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@volar/language-service": "~1.11.1",
|
|
22
22
|
"@volar/typescript": "~1.11.1",
|
|
23
23
|
"@vue/compiler-dom": "^3.3.0",
|
|
24
|
-
"@vue/language-core": "1.8.
|
|
24
|
+
"@vue/language-core": "1.8.27",
|
|
25
25
|
"@vue/shared": "^3.3.0",
|
|
26
26
|
"computeds": "^0.0.1",
|
|
27
27
|
"path-browserify": "^1.0.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
44
44
|
"vscode-uri": "^3.0.8"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "09c04807eb19f1261cc429af1b90c6561166ad4f"
|
|
47
47
|
}
|
|
@@ -1,83 +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 shared_1 = require("@vue/shared");
|
|
6
|
-
const path = require("path-browserify");
|
|
7
|
-
const vue_extract_file_1 = require("../plugins/vue-extract-file");
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
function create(ts) {
|
|
10
|
-
return {
|
|
11
|
-
create(context) {
|
|
12
|
-
let casing = types_1.TagNameCasing.Pascal; // TODO
|
|
13
|
-
return {
|
|
14
|
-
async provideDocumentDropEdits(document, _position, dataTransfer) {
|
|
15
|
-
if (document.languageId !== 'html')
|
|
16
|
-
return;
|
|
17
|
-
const [virtualFile, sourceFile] = context.language.files.getVirtualFile(document.uri);
|
|
18
|
-
const vueFile = sourceFile?.virtualFile?.[0];
|
|
19
|
-
if (!virtualFile || !(vueFile instanceof language_core_1.VueFile))
|
|
20
|
-
return;
|
|
21
|
-
let importUri;
|
|
22
|
-
for (const [mimeType, item] of dataTransfer) {
|
|
23
|
-
if (mimeType === 'text/uri-list') {
|
|
24
|
-
importUri = item.value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (!importUri?.endsWith('.vue'))
|
|
28
|
-
return;
|
|
29
|
-
let baseName = importUri.substring(importUri.lastIndexOf('/') + 1);
|
|
30
|
-
baseName = baseName.substring(0, baseName.lastIndexOf('.'));
|
|
31
|
-
const newName = (0, shared_1.capitalize)((0, shared_1.camelize)(baseName));
|
|
32
|
-
let additionalEdit;
|
|
33
|
-
for (const file of (0, language_core_1.forEachEmbeddedFile)(vueFile)) {
|
|
34
|
-
if ((file.languageId === 'typescript'
|
|
35
|
-
|| file.languageId === 'javascript'
|
|
36
|
-
|| file.languageId === 'typescriptreact'
|
|
37
|
-
|| file.languageId === 'javascriptreact')
|
|
38
|
-
&& file.mappings.some(mapping => (0, language_core_1.isFoldingRangesEnabled)(mapping.data))) {
|
|
39
|
-
additionalEdit ??= {};
|
|
40
|
-
additionalEdit.changes ??= {};
|
|
41
|
-
additionalEdit.changes[file.id] = [];
|
|
42
|
-
const { sfc } = vueFile;
|
|
43
|
-
const script = sfc.scriptSetup ?? sfc.script;
|
|
44
|
-
if (!sfc.template || !script)
|
|
45
|
-
return;
|
|
46
|
-
const lastImportNode = (0, vue_extract_file_1.getLastImportNode)(ts, script.ast);
|
|
47
|
-
additionalEdit.changes[file.id].push({
|
|
48
|
-
range: lastImportNode ? {
|
|
49
|
-
start: document.positionAt(lastImportNode.end),
|
|
50
|
-
end: document.positionAt(lastImportNode.end),
|
|
51
|
-
} : {
|
|
52
|
-
start: document.positionAt(0),
|
|
53
|
-
end: document.positionAt(0),
|
|
54
|
-
},
|
|
55
|
-
newText: `\nimport ${newName} from './${path.relative(path.dirname(document.uri), importUri) || importUri.substring(importUri.lastIndexOf('/') + 1)}'`
|
|
56
|
-
+ (lastImportNode ? '' : '\n'),
|
|
57
|
-
});
|
|
58
|
-
if (sfc.script) {
|
|
59
|
-
const edit = (0, vue_extract_file_1.createAddComponentToOptionEdit)(ts, sfc.script.ast, newName);
|
|
60
|
-
if (edit) {
|
|
61
|
-
additionalEdit.changes[file.id].push({
|
|
62
|
-
range: {
|
|
63
|
-
start: document.positionAt(edit.range.start),
|
|
64
|
-
end: document.positionAt(edit.range.end),
|
|
65
|
-
},
|
|
66
|
-
newText: edit.newText,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
insertText: `<${casing === types_1.TagNameCasing.Kebab ? (0, shared_1.hyphenate)(newName) : newName}$0 />`,
|
|
74
|
-
insertTextFormat: 2,
|
|
75
|
-
additionalEdit,
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
exports.create = create;
|
|
83
|
-
//# sourceMappingURL=vue-document-drop.js.map
|