@vue/language-server 3.0.1 → 3.0.2

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 CHANGED
@@ -7,8 +7,8 @@ const language_core_1 = require("@vue/language-core");
7
7
  const language_service_1 = require("@vue/language-service");
8
8
  const ts = require("typescript");
9
9
  const vscode_uri_1 = require("vscode-uri");
10
- const reactionsAnalyze_1 = require("./lib/reactionsAnalyze");
11
- const reactionsAnalyzeLS_1 = require("./lib/reactionsAnalyzeLS");
10
+ const reactivityAnalyze_1 = require("./lib/reactivityAnalyze");
11
+ const reactivityAnalyzeLS_1 = require("./lib/reactivityAnalyzeLS");
12
12
  const connection = (0, node_1.createConnection)();
13
13
  const server = (0, node_1.createServer)(connection);
14
14
  const tsserverRequestHandlers = new Map();
@@ -109,13 +109,20 @@ connection.onInitialize(params => {
109
109
  filesToSearch: [fileName],
110
110
  });
111
111
  },
112
+ getEncodedSemanticClassifications(fileName, span) {
113
+ return sendTsServerRequest('_vue:encodedSemanticClassifications-full', {
114
+ file: fileName,
115
+ ...span,
116
+ format: ts.SemanticClassificationFormat.TwentyTwenty,
117
+ });
118
+ },
112
119
  async getQuickInfoAtPosition(fileName, { line, character }) {
113
120
  const result = await sendTsServerRequest('_vue:' + ts.server.protocol.CommandTypes.Quickinfo, {
114
121
  file: fileName,
115
122
  line: line + 1,
116
123
  offset: character + 1,
117
124
  });
118
- return ts.displayPartsToString(result?.displayParts ?? []);
125
+ return result?.displayString;
119
126
  },
120
127
  }));
121
128
  async function sendTsServerRequest(command, args) {
@@ -126,12 +133,9 @@ connection.onInitialize(params => {
126
133
  });
127
134
  }
128
135
  function createProjectLanguageService(server, tsconfig) {
129
- const commonLine = tsconfig
136
+ const commonLine = tsconfig && !ts.server.isInferredProjectName(tsconfig)
130
137
  ? (0, language_core_1.createParsedCommandLine)(ts, ts.sys, tsconfig)
131
- : {
132
- options: ts.getDefaultCompilerOptions(),
133
- vueOptions: (0, language_core_1.getDefaultCompilerOptions)(),
134
- };
138
+ : (0, language_core_1.createParsedCommandLineByJson)(ts, ts.sys, ts.sys.getCurrentDirectory(), {});
135
139
  const language = (0, language_core_1.createLanguage)([
136
140
  {
137
141
  getLanguageId: uri => server.documents.get(uri)?.languageId,
@@ -180,7 +184,7 @@ connection.onRequest('vue/interpolationRanges', async (params) => {
180
184
  return [];
181
185
  });
182
186
  const cacheDocuments = new Map();
183
- connection.onRequest('vue/reactionsAnalyze', async (params) => {
187
+ connection.onRequest('vue/reactivityAnalyze', async (params) => {
184
188
  if (params.syncDocument) {
185
189
  const document = language_server_1.TextDocument.create(params.textDocument.uri, params.syncDocument.languageId, 0, params.syncDocument.content);
186
190
  const snapshot = ts.ScriptSnapshot.fromString(params.syncDocument.content);
@@ -225,8 +229,8 @@ connection.onRequest('vue/reactionsAnalyze', async (params) => {
225
229
  document = languageService.context.documents.get(embeddedUri, serviceScript.code.languageId, serviceScript.code.snapshot);
226
230
  snapshot = serviceScript.code.snapshot;
227
231
  }
228
- const { languageService: tsLs, fileName } = (0, reactionsAnalyzeLS_1.getLanguageService)(ts, snapshot, document.languageId);
229
- const result = (0, reactionsAnalyze_1.analyze)(ts, tsLs, fileName, offset);
232
+ const { languageService: tsLs, fileName } = (0, reactivityAnalyzeLS_1.getLanguageService)(ts, snapshot, document.languageId);
233
+ const result = (0, reactivityAnalyze_1.analyze)(ts, tsLs, fileName, offset);
230
234
  if (!result) {
231
235
  return;
232
236
  }
@@ -0,0 +1,27 @@
1
+ import type * as ts from 'typescript';
2
+ declare const enum TrackKind {
3
+ AccessDotValue = 0,
4
+ AccessAnyValue = 1,
5
+ Call = 2
6
+ }
7
+ interface SignalNode {
8
+ bindingInfo?: {
9
+ isRef: boolean;
10
+ name: ts.BindingName;
11
+ trackKinds: TrackKind[];
12
+ };
13
+ trackInfo?: {
14
+ depsHandler: ts.Node;
15
+ needToUse: boolean;
16
+ };
17
+ sideEffectInfo?: {
18
+ isEffect: boolean;
19
+ handler: ts.Node;
20
+ };
21
+ }
22
+ export declare function analyze(ts: typeof import('typescript'), languageService: ts.LanguageService, fileName: string, position: number): {
23
+ sourceFile: ts.SourceFile;
24
+ subscribers: SignalNode[];
25
+ dependencies: ts.Node[];
26
+ } | undefined;
27
+ export {};
@@ -0,0 +1,460 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyze = analyze;
4
+ const language_core_1 = require("@vue/language-core");
5
+ function analyze(ts, languageService, fileName, position) {
6
+ const sourceFile = languageService.getProgram().getSourceFile(fileName);
7
+ const { signals, dotValueAccesses, dotAnyAccesses, functionCalls } = collect(ts, sourceFile);
8
+ let signal = findSignalByNamePosition(position);
9
+ if (!signal) {
10
+ signal = findEffectByEffectHandlerPosition(position);
11
+ if (signal?.bindingInfo) {
12
+ position = signal.bindingInfo.name.getStart(sourceFile);
13
+ }
14
+ }
15
+ if (!signal) {
16
+ return;
17
+ }
18
+ const subscribers = signal.bindingInfo
19
+ ? findSubscribers(signal.bindingInfo.name, signal.bindingInfo.trackKinds)
20
+ : [];
21
+ const dependencies = signal
22
+ ? findDependencies(signal)
23
+ : [];
24
+ if ((!signal.sideEffectInfo?.isEffect && !subscribers.length)
25
+ || (!signal.bindingInfo?.isRef && !dependencies.length)) {
26
+ return;
27
+ }
28
+ return {
29
+ sourceFile,
30
+ subscribers: [...new Set(subscribers)],
31
+ dependencies: [...new Set(dependencies)],
32
+ };
33
+ function findDependencies(signal, visited = new Set()) {
34
+ if (visited.has(signal)) {
35
+ return [];
36
+ }
37
+ visited.add(signal);
38
+ const nodes = [];
39
+ let hasRef = signal.bindingInfo?.isRef ?? false;
40
+ if (signal.trackInfo) {
41
+ const { needToUse } = signal.trackInfo;
42
+ visit(signal.trackInfo.depsHandler, needToUse);
43
+ signal.trackInfo.depsHandler.forEachChild(child => visit(child, needToUse));
44
+ }
45
+ if (!hasRef) {
46
+ return [];
47
+ }
48
+ return nodes;
49
+ function visit(node, needToUse, parentIsPropertyAccess = false) {
50
+ if (!needToUse) {
51
+ if (!parentIsPropertyAccess && ts.isIdentifier(node)) {
52
+ const definition = languageService.getDefinitionAtPosition(fileName, node.getStart(sourceFile));
53
+ for (const info of definition ?? []) {
54
+ if (info.fileName !== fileName) {
55
+ continue;
56
+ }
57
+ const signal = findSignalByNamePosition(info.textSpan.start);
58
+ if (!signal) {
59
+ continue;
60
+ }
61
+ if (signal.bindingInfo) {
62
+ nodes.push(signal.bindingInfo.name);
63
+ hasRef ||= signal.bindingInfo.isRef;
64
+ }
65
+ if (signal.sideEffectInfo) {
66
+ nodes.push(signal.sideEffectInfo.handler);
67
+ }
68
+ const deps = findDependencies(signal, visited);
69
+ nodes.push(...deps);
70
+ hasRef ||= deps.length > 0;
71
+ }
72
+ }
73
+ }
74
+ else if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) || ts.isCallExpression(node)) {
75
+ const definition = languageService.getDefinitionAtPosition(fileName, node.expression.getStart(sourceFile));
76
+ for (const info of definition ?? []) {
77
+ if (info.fileName !== fileName) {
78
+ continue;
79
+ }
80
+ const signal = findSignalByNamePosition(info.textSpan.start);
81
+ if (!signal) {
82
+ continue;
83
+ }
84
+ const oldSize = nodes.length;
85
+ if (signal.bindingInfo) {
86
+ for (const trackKind of signal.bindingInfo.trackKinds) {
87
+ if (ts.isPropertyAccessExpression(node)) {
88
+ if (trackKind === 0 /* TrackKind.AccessDotValue */ && node.name.text === 'value') {
89
+ nodes.push(signal.bindingInfo.name);
90
+ hasRef ||= signal.bindingInfo.isRef;
91
+ }
92
+ if (trackKind === 1 /* TrackKind.AccessAnyValue */ && node.name.text !== '') {
93
+ nodes.push(signal.bindingInfo.name);
94
+ hasRef ||= signal.bindingInfo.isRef;
95
+ }
96
+ }
97
+ else if (ts.isElementAccessExpression(node)) {
98
+ if (trackKind === 1 /* TrackKind.AccessAnyValue */) {
99
+ nodes.push(signal.bindingInfo.name);
100
+ hasRef ||= signal.bindingInfo.isRef;
101
+ }
102
+ }
103
+ else if (ts.isCallExpression(node)) {
104
+ if (trackKind === 2 /* TrackKind.Call */) {
105
+ nodes.push(signal.bindingInfo.name);
106
+ hasRef ||= signal.bindingInfo.isRef;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ const signalDetected = nodes.length > oldSize;
112
+ if (signalDetected) {
113
+ if (signal.sideEffectInfo) {
114
+ nodes.push(signal.sideEffectInfo.handler);
115
+ }
116
+ const deps = findDependencies(signal, visited);
117
+ nodes.push(...deps);
118
+ hasRef ||= deps.length > 0;
119
+ }
120
+ }
121
+ }
122
+ node.forEachChild(child => visit(child, needToUse, ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)));
123
+ }
124
+ }
125
+ function findSubscribers(refName, trackKinds, visited = new Set()) {
126
+ return (0, language_core_1.findBindingVars)(ts, refName, sourceFile)
127
+ .map(binding => findSubscribersWorker(binding, trackKinds, visited))
128
+ .flat();
129
+ }
130
+ function findSubscribersWorker(refName, trackKinds, visited = new Set()) {
131
+ if (visited.has(refName.start)) {
132
+ return [];
133
+ }
134
+ visited.add(refName.start);
135
+ const references = languageService.findReferences(fileName, refName.start);
136
+ if (!references) {
137
+ return [];
138
+ }
139
+ const result = [];
140
+ for (const reference of references) {
141
+ for (const reference2 of reference.references) {
142
+ if (reference2.fileName !== fileName) {
143
+ continue;
144
+ }
145
+ const effect = findEffectByDepsHandlerPosition(reference2.textSpan.start);
146
+ if (effect?.trackInfo) {
147
+ if (effect.trackInfo.needToUse) {
148
+ let match = false;
149
+ for (const trackKind of trackKinds) {
150
+ if (trackKind === 1 /* TrackKind.AccessAnyValue */) {
151
+ match = dotAnyAccesses.has(reference2.textSpan.start + reference2.textSpan.length);
152
+ }
153
+ else if (trackKind === 0 /* TrackKind.AccessDotValue */) {
154
+ match = dotValueAccesses.has(reference2.textSpan.start + reference2.textSpan.length);
155
+ }
156
+ else if (trackKind === 2 /* TrackKind.Call */) {
157
+ match = functionCalls.has(reference2.textSpan.start + reference2.textSpan.length);
158
+ }
159
+ if (match) {
160
+ break;
161
+ }
162
+ }
163
+ if (!match) {
164
+ continue;
165
+ }
166
+ }
167
+ let hasEffect = effect.sideEffectInfo?.isEffect;
168
+ if (effect.bindingInfo) {
169
+ const subs = findSubscribers(effect.bindingInfo.name, effect.bindingInfo.trackKinds, visited);
170
+ result.push(...subs);
171
+ hasEffect ||= subs.length > 0;
172
+ }
173
+ if (hasEffect) {
174
+ result.push(effect);
175
+ }
176
+ }
177
+ }
178
+ }
179
+ return result;
180
+ }
181
+ function findSignalByNamePosition(position) {
182
+ return signals.find(ref => ref.bindingInfo && ref.bindingInfo.name.getStart(sourceFile) <= position
183
+ && ref.bindingInfo.name.getEnd() >= position);
184
+ }
185
+ function findEffectByEffectHandlerPosition(position) {
186
+ return signals.filter(ref => ref.sideEffectInfo && ref.sideEffectInfo.handler.getStart(sourceFile) <= position
187
+ && ref.sideEffectInfo.handler.getEnd() >= position).sort((a, b) => a.sideEffectInfo.handler.getWidth(sourceFile) - b.sideEffectInfo.handler.getWidth(sourceFile))[0];
188
+ }
189
+ function findEffectByDepsHandlerPosition(position) {
190
+ return signals.filter(ref => ref.trackInfo && ref.trackInfo.depsHandler.getStart(sourceFile) <= position
191
+ && ref.trackInfo.depsHandler.getEnd() >= position).sort((a, b) => a.trackInfo.depsHandler.getWidth(sourceFile) - b.trackInfo.depsHandler.getWidth(sourceFile))[0];
192
+ }
193
+ }
194
+ function collect(ts, sourceFile) {
195
+ const signals = [];
196
+ const dotValueAccesses = new Set();
197
+ const dotAnyAccesses = new Set();
198
+ const functionCalls = new Set();
199
+ sourceFile.forEachChild(function visit(node) {
200
+ if (ts.isVariableDeclaration(node)) {
201
+ if (node.initializer && ts.isCallExpression(node.initializer)) {
202
+ const call = node.initializer;
203
+ if (ts.isIdentifier(call.expression)) {
204
+ const callName = call.expression.escapedText;
205
+ if (callName === 'ref' || callName === 'shallowRef' || callName === 'toRef' || callName === 'useTemplateRef'
206
+ || callName === 'defineModel') {
207
+ signals.push({
208
+ bindingInfo: {
209
+ isRef: true,
210
+ name: node.name,
211
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
212
+ },
213
+ });
214
+ }
215
+ else if (callName === 'reactive' || callName === 'shallowReactive' || callName === 'defineProps'
216
+ || callName === 'withDefaults') {
217
+ signals.push({
218
+ bindingInfo: {
219
+ isRef: true,
220
+ name: node.name,
221
+ trackKinds: [1 /* TrackKind.AccessAnyValue */],
222
+ },
223
+ });
224
+ }
225
+ // TODO: toRefs
226
+ }
227
+ }
228
+ }
229
+ else if (ts.isFunctionDeclaration(node)) {
230
+ if (node.name && node.body) {
231
+ signals.push({
232
+ bindingInfo: {
233
+ isRef: false,
234
+ name: node.name,
235
+ trackKinds: [2 /* TrackKind.Call */],
236
+ },
237
+ trackInfo: {
238
+ depsHandler: node.body,
239
+ needToUse: true,
240
+ },
241
+ sideEffectInfo: {
242
+ isEffect: false,
243
+ handler: node.body,
244
+ },
245
+ });
246
+ }
247
+ }
248
+ else if (ts.isVariableStatement(node)) {
249
+ for (const declaration of node.declarationList.declarations) {
250
+ const name = declaration.name;
251
+ const callback = declaration.initializer;
252
+ if (callback && ts.isIdentifier(name) && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))) {
253
+ signals.push({
254
+ bindingInfo: {
255
+ isRef: false,
256
+ name: name,
257
+ trackKinds: [2 /* TrackKind.Call */],
258
+ },
259
+ trackInfo: {
260
+ depsHandler: callback,
261
+ needToUse: true,
262
+ },
263
+ sideEffectInfo: {
264
+ isEffect: false,
265
+ handler: callback,
266
+ },
267
+ });
268
+ }
269
+ }
270
+ }
271
+ else if (ts.isParameter(node)) {
272
+ if (node.type && ts.isTypeReferenceNode(node.type)) {
273
+ const typeName = node.type.typeName.getText(sourceFile);
274
+ if (typeName.endsWith('Ref')) {
275
+ signals.push({
276
+ bindingInfo: {
277
+ isRef: true,
278
+ name: node.name,
279
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
280
+ },
281
+ });
282
+ }
283
+ }
284
+ }
285
+ else if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {
286
+ const call = node;
287
+ const callName = node.expression.escapedText;
288
+ if ((callName === 'effect' || callName === 'watchEffect') && call.arguments.length) {
289
+ const callback = call.arguments[0];
290
+ if (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) {
291
+ signals.push({
292
+ trackInfo: {
293
+ depsHandler: callback.body,
294
+ needToUse: true,
295
+ },
296
+ sideEffectInfo: {
297
+ isEffect: true,
298
+ handler: callback.body,
299
+ },
300
+ });
301
+ }
302
+ }
303
+ if (callName === 'watch' && call.arguments.length >= 2) {
304
+ const depsCallback = call.arguments[0];
305
+ const effectCallback = call.arguments[1];
306
+ if (ts.isArrowFunction(effectCallback) || ts.isFunctionExpression(effectCallback)) {
307
+ if (ts.isArrowFunction(depsCallback) || ts.isFunctionExpression(depsCallback)) {
308
+ signals.push({
309
+ trackInfo: {
310
+ depsHandler: depsCallback.body,
311
+ needToUse: true,
312
+ },
313
+ sideEffectInfo: {
314
+ isEffect: true,
315
+ handler: effectCallback.body,
316
+ },
317
+ });
318
+ }
319
+ else {
320
+ signals.push({
321
+ trackInfo: {
322
+ depsHandler: depsCallback,
323
+ needToUse: false,
324
+ },
325
+ sideEffectInfo: {
326
+ isEffect: true,
327
+ handler: effectCallback.body,
328
+ },
329
+ });
330
+ }
331
+ }
332
+ }
333
+ else if ((0, language_core_1.hyphenateAttr)(callName).startsWith('use-')) {
334
+ signals.push({
335
+ bindingInfo: ts.isVariableDeclaration(call.parent)
336
+ ? {
337
+ isRef: true,
338
+ name: call.parent.name,
339
+ trackKinds: [1 /* TrackKind.AccessAnyValue */, 2 /* TrackKind.Call */],
340
+ }
341
+ : undefined,
342
+ trackInfo: {
343
+ depsHandler: call,
344
+ needToUse: false,
345
+ },
346
+ });
347
+ }
348
+ else if ((callName === 'computed' || (0, language_core_1.hyphenateAttr)(callName).endsWith('-computed')) && call.arguments.length) {
349
+ const arg = call.arguments[0];
350
+ if (ts.isArrowFunction(arg) || ts.isFunctionExpression(arg)) {
351
+ signals.push({
352
+ bindingInfo: ts.isVariableDeclaration(call.parent)
353
+ ? {
354
+ isRef: true,
355
+ name: call.parent.name,
356
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
357
+ }
358
+ : undefined,
359
+ trackInfo: {
360
+ depsHandler: arg.body,
361
+ needToUse: true,
362
+ },
363
+ sideEffectInfo: {
364
+ isEffect: true,
365
+ handler: arg.body,
366
+ },
367
+ });
368
+ }
369
+ else if (ts.isIdentifier(arg)) {
370
+ signals.push({
371
+ bindingInfo: ts.isVariableDeclaration(call.parent)
372
+ ? {
373
+ isRef: true,
374
+ name: call.parent.name,
375
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
376
+ }
377
+ : undefined,
378
+ trackInfo: {
379
+ depsHandler: arg,
380
+ needToUse: false,
381
+ },
382
+ });
383
+ }
384
+ else if (ts.isObjectLiteralExpression(arg)) {
385
+ for (const prop of arg.properties) {
386
+ if (prop.name?.getText(sourceFile) === 'get') {
387
+ if (ts.isPropertyAssignment(prop)) {
388
+ const callback = prop.initializer;
389
+ if (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) {
390
+ signals.push({
391
+ bindingInfo: ts.isVariableDeclaration(call.parent)
392
+ ? {
393
+ isRef: true,
394
+ name: call.parent.name,
395
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
396
+ }
397
+ : undefined,
398
+ trackInfo: {
399
+ depsHandler: callback.body,
400
+ needToUse: true,
401
+ },
402
+ sideEffectInfo: {
403
+ isEffect: true,
404
+ handler: callback.body,
405
+ },
406
+ });
407
+ }
408
+ }
409
+ else if (ts.isMethodDeclaration(prop) && prop.body) {
410
+ signals.push({
411
+ bindingInfo: ts.isVariableDeclaration(call.parent)
412
+ ? {
413
+ isRef: true,
414
+ name: call.parent.name,
415
+ trackKinds: [0 /* TrackKind.AccessDotValue */],
416
+ }
417
+ : undefined,
418
+ trackInfo: {
419
+ depsHandler: prop.body,
420
+ needToUse: true,
421
+ },
422
+ sideEffectInfo: {
423
+ isEffect: true,
424
+ handler: prop.body,
425
+ },
426
+ });
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ node.forEachChild(visit);
434
+ });
435
+ sourceFile.forEachChild(function visit(node) {
436
+ if (ts.isPropertyAccessExpression(node)) {
437
+ if (node.name.text === 'value') {
438
+ dotValueAccesses.add(node.expression.getEnd());
439
+ dotAnyAccesses.add(node.expression.getEnd());
440
+ }
441
+ else if (node.name.text !== '') {
442
+ dotAnyAccesses.add(node.expression.getEnd());
443
+ }
444
+ }
445
+ else if (ts.isElementAccessExpression(node)) {
446
+ dotAnyAccesses.add(node.expression.getEnd());
447
+ }
448
+ else if (ts.isCallExpression(node)) {
449
+ functionCalls.add(node.expression.getEnd());
450
+ }
451
+ node.forEachChild(visit);
452
+ });
453
+ return {
454
+ signals,
455
+ dotValueAccesses,
456
+ dotAnyAccesses,
457
+ functionCalls,
458
+ };
459
+ }
460
+ //# sourceMappingURL=reactivityAnalyze.js.map
@@ -0,0 +1,5 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function getLanguageService(ts: typeof import('typescript'), snapshot: ts.IScriptSnapshot, languageId: string): {
3
+ languageService: ts.LanguageService;
4
+ fileName: string;
5
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLanguageService = getLanguageService;
4
+ let currentProjectVersion = -1;
5
+ let currentFileName = '';
6
+ let currentSnapshot;
7
+ let languageService;
8
+ const host = {
9
+ getProjectVersion: () => currentProjectVersion.toString(),
10
+ getScriptFileNames: () => [currentFileName],
11
+ getScriptVersion: () => currentProjectVersion.toString(),
12
+ getScriptSnapshot: fileName => fileName === currentFileName ? currentSnapshot : undefined,
13
+ getCompilationSettings: () => ({
14
+ allowJs: true,
15
+ }),
16
+ getCurrentDirectory: () => '',
17
+ getDefaultLibFileName: () => '',
18
+ readFile: () => undefined,
19
+ fileExists: fileName => fileName === currentFileName,
20
+ };
21
+ // TODO: share with volar-service-typescript
22
+ function getLanguageService(ts, snapshot, languageId) {
23
+ if (currentSnapshot !== snapshot) {
24
+ currentSnapshot = snapshot;
25
+ currentFileName = '/tmp.' + (languageId === 'javascript'
26
+ ? 'js'
27
+ : languageId === 'typescriptreact'
28
+ ? 'tsx'
29
+ : languageId === 'javascriptreact'
30
+ ? 'jsx'
31
+ : 'ts');
32
+ currentProjectVersion++;
33
+ }
34
+ languageService ??= ts.createLanguageService(host);
35
+ return {
36
+ languageService,
37
+ fileName: currentFileName,
38
+ };
39
+ }
40
+ //# sourceMappingURL=reactivityAnalyzeLS.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-server",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -16,10 +16,10 @@
16
16
  "directory": "packages/language-server"
17
17
  },
18
18
  "dependencies": {
19
- "@volar/language-server": "2.4.17",
20
- "@vue/language-core": "3.0.1",
21
- "@vue/language-service": "3.0.1",
22
- "@vue/typescript-plugin": "3.0.1",
19
+ "@volar/language-server": "2.4.19",
20
+ "@vue/language-core": "3.0.2",
21
+ "@vue/language-service": "3.0.2",
22
+ "@vue/typescript-plugin": "3.0.2",
23
23
  "vscode-uri": "^3.0.8"
24
24
  },
25
25
  "peerDependencies": {
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@typescript/server-harness": "latest",
30
- "@volar/test-utils": "2.4.17"
30
+ "@volar/test-utils": "2.4.19"
31
31
  },
32
- "gitHead": "43884409838dfdce44de51f6622926ac6ddd7318"
32
+ "gitHead": "7343119e9ca4f6a54f63b57f448f15df4b592a9a"
33
33
  }