@volar/language-service 1.0.13 → 1.0.16
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/documents.js
CHANGED
|
@@ -78,7 +78,7 @@ class SourceMap extends source_map_1.SourceMapBase {
|
|
|
78
78
|
return this.toPositions(position, filter, this.sourceDocument, this.mappedDocument, 'sourceRange', 'generatedRange', baseOffset);
|
|
79
79
|
}
|
|
80
80
|
*toPositions(position, filter, fromDoc, toDoc, from, to, baseOffset) {
|
|
81
|
-
for (const mapped of this.matcing(fromDoc.offsetAt(position), from, to)) {
|
|
81
|
+
for (const mapped of this.matcing(fromDoc.offsetAt(position), from, to, baseOffset === 'right')) {
|
|
82
82
|
if (!filter(mapped[1].data)) {
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
@@ -91,20 +91,14 @@ class SourceMap extends source_map_1.SourceMapBase {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
matchSourcePosition(position, mapping, baseOffset) {
|
|
94
|
-
let offset = this.matchOffset(this.mappedDocument.offsetAt(position), mapping['generatedRange'], mapping['sourceRange']);
|
|
94
|
+
let offset = this.matchOffset(this.mappedDocument.offsetAt(position), mapping['generatedRange'], mapping['sourceRange'], baseOffset === 'right');
|
|
95
95
|
if (offset !== undefined) {
|
|
96
|
-
if (baseOffset === 'right') {
|
|
97
|
-
offset += (mapping.sourceRange[1] - mapping.sourceRange[0]) - (mapping.generatedRange[1] - mapping.generatedRange[0]);
|
|
98
|
-
}
|
|
99
96
|
return this.sourceDocument.positionAt(offset);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
matchGeneratedPosition(position, mapping, baseOffset) {
|
|
103
|
-
let offset = this.matchOffset(this.sourceDocument.offsetAt(position), mapping['sourceRange'], mapping['generatedRange']);
|
|
100
|
+
let offset = this.matchOffset(this.sourceDocument.offsetAt(position), mapping['sourceRange'], mapping['generatedRange'], baseOffset === 'right');
|
|
104
101
|
if (offset !== undefined) {
|
|
105
|
-
if (baseOffset === 'right') {
|
|
106
|
-
offset += (mapping.generatedRange[1] - mapping.generatedRange[0]) - (mapping.sourceRange[1] - mapping.sourceRange[0]);
|
|
107
|
-
}
|
|
108
102
|
return this.mappedDocument.positionAt(offset);
|
|
109
103
|
}
|
|
110
104
|
}
|
|
@@ -203,17 +197,17 @@ function parseSourceFileDocument(sourceFile) {
|
|
|
203
197
|
const embeddedDocuments = new WeakMap();
|
|
204
198
|
const sourceMaps = new WeakMap();
|
|
205
199
|
// computed
|
|
206
|
-
const document = (0, reactivity_1.computed)(() => vscode_languageserver_textdocument_1.TextDocument.create(shared.getUriByPath(sourceFile.fileName), sourceFile.fileName.
|
|
200
|
+
const document = (0, reactivity_1.computed)(() => vscode_languageserver_textdocument_1.TextDocument.create(shared.getUriByPath(sourceFile.fileName), shared.syntaxToLanguageId(sourceFile.fileName.slice(sourceFile.fileName.lastIndexOf('.') + 1)), documentVersion++, sourceFile.text));
|
|
207
201
|
const allSourceMaps = (0, reactivity_1.computed)(() => {
|
|
208
202
|
const result = [];
|
|
209
|
-
(0, language_core_1.forEachEmbeddeds)(sourceFile
|
|
203
|
+
(0, language_core_1.forEachEmbeddeds)(sourceFile, embedded => {
|
|
210
204
|
result.push(getSourceMap(embedded));
|
|
211
205
|
});
|
|
212
206
|
return result;
|
|
213
207
|
});
|
|
214
208
|
const teleports = (0, reactivity_1.computed)(() => {
|
|
215
209
|
const result = [];
|
|
216
|
-
(0, language_core_1.forEachEmbeddeds)(sourceFile
|
|
210
|
+
(0, language_core_1.forEachEmbeddeds)(sourceFile, embedded => {
|
|
217
211
|
if (embedded.teleportMappings) {
|
|
218
212
|
const embeddedDocument = getEmbeddedDocument(embedded);
|
|
219
213
|
const sourceMap = new TeleportSourceMap(embedded, embeddedDocument, embedded.teleportMappings);
|
|
@@ -17,7 +17,7 @@ function register(context) {
|
|
|
17
17
|
const vueDocument = context.documents.get(oldUri);
|
|
18
18
|
if (vueDocument) {
|
|
19
19
|
let tsExt;
|
|
20
|
-
(0, language_core_1.forEachEmbeddeds)(vueDocument.file
|
|
20
|
+
(0, language_core_1.forEachEmbeddeds)(vueDocument.file, embedded => {
|
|
21
21
|
if (embedded.kind && embedded.fileName.replace(vueDocument.file.fileName, '').match(/^\.(js|ts)x?$/)) {
|
|
22
22
|
tsExt = embedded.fileName.substring(embedded.fileName.lastIndexOf('.'));
|
|
23
23
|
}
|
package/out/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { DocumentContext, FileSystemProvider } from 'vscode-html-languagese
|
|
|
6
6
|
import type { SchemaRequestService } from 'vscode-json-languageservice';
|
|
7
7
|
import { URI } from 'vscode-uri';
|
|
8
8
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
9
|
+
export * from 'vscode-languageserver-protocol';
|
|
9
10
|
export interface DocumentServiceRuntimeContext {
|
|
10
11
|
typescript: typeof import('typescript/lib/tsserverlibrary');
|
|
11
12
|
plugins: LanguageServicePlugin[];
|
package/out/types.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
|
+
};
|
|
1
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
__exportStar(require("vscode-languageserver-protocol"), exports);
|
|
2
17
|
;
|
|
3
18
|
;
|
|
4
19
|
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EmbeddedDocumentSourceMap, SourceFileDocument } from '../documents';
|
|
2
|
-
export declare function visitEmbedded(vueDocument: SourceFileDocument, cb: (sourceMap: EmbeddedDocumentSourceMap) => Promise<boolean>,
|
|
2
|
+
export declare function visitEmbedded(vueDocument: SourceFileDocument, cb: (sourceMap: EmbeddedDocumentSourceMap) => Promise<boolean>, current?: import("@volar/language-core").SourceFile): Promise<boolean>;
|
|
@@ -9,17 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.visitEmbedded = void 0;
|
|
12
|
-
function visitEmbedded(vueDocument, cb,
|
|
12
|
+
function visitEmbedded(vueDocument, cb, current = vueDocument.file) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
for (const embedded of embeddeds) {
|
|
15
|
-
if (!(yield visitEmbedded(vueDocument, cb, embedded
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
const sourceMap = vueDocument.getSourceMap(embedded);
|
|
19
|
-
if (!(yield cb(sourceMap))) {
|
|
14
|
+
for (const embedded of current.embeddeds) {
|
|
15
|
+
if (!(yield visitEmbedded(vueDocument, cb, embedded))) {
|
|
20
16
|
return false;
|
|
21
17
|
}
|
|
22
18
|
}
|
|
19
|
+
const sourceMap = vueDocument.getSourceMap(current);
|
|
20
|
+
if (!(yield cb(sourceMap))) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
23
|
return true;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -41,7 +41,7 @@ function documentArgFeatureWorker(context, document, arg, isValidSourceMap, tran
|
|
|
41
41
|
return true;
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
|
-
if (results.length === 0 || !!combineResult) {
|
|
44
|
+
else if (results.length === 0 || !!combineResult) {
|
|
45
45
|
context.prepareLanguageServices(document);
|
|
46
46
|
for (const plugin of context.plugins) {
|
|
47
47
|
const result = yield worker(plugin, document, arg);
|
|
@@ -88,7 +88,7 @@ function languageFeatureWorker(context, uri, arg, transformArg, worker, transfor
|
|
|
88
88
|
return true;
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
|
-
if (document && (results.length === 0 || !!combineResult)) {
|
|
91
|
+
else if (document && (results.length === 0 || !!combineResult)) {
|
|
92
92
|
for (const plugin of context.plugins) {
|
|
93
93
|
const embeddedResult = yield worker(plugin, document, arg, undefined, undefined);
|
|
94
94
|
if (!embeddedResult)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.0.
|
|
17
|
-
"@volar/shared": "1.0.
|
|
18
|
-
"@volar/source-map": "1.0.
|
|
19
|
-
"@volar/transforms": "1.0.
|
|
20
|
-
"@volar/typescript-faster": "1.0.
|
|
16
|
+
"@volar/language-core": "1.0.16",
|
|
17
|
+
"@volar/shared": "1.0.16",
|
|
18
|
+
"@volar/source-map": "1.0.16",
|
|
19
|
+
"@volar/transforms": "1.0.16",
|
|
20
|
+
"@volar/typescript-faster": "1.0.16",
|
|
21
21
|
"@vue/reactivity": "^3.2.45",
|
|
22
22
|
"vscode-html-languageservice": "^5.0.3",
|
|
23
23
|
"vscode-json-languageservice": "^5.1.3",
|
|
24
24
|
"vscode-languageserver-protocol": "^3.17.2",
|
|
25
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
26
|
-
"vscode-uri": "^3.0.
|
|
25
|
+
"vscode-languageserver-textdocument": "^1.0.8",
|
|
26
|
+
"vscode-uri": "^3.0.7"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "af476047d8859652254ed36f8aee184f1972a97a"
|
|
29
29
|
}
|