volar-service-typescript 0.0.25 → 0.0.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/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import type * as ts from 'typescript';
3
3
  export * from '@volar/typescript';
4
4
  export interface Provide {
5
5
  'typescript/typescript': () => typeof import('typescript');
6
- 'typescript/sys': () => ts.System;
7
6
  'typescript/languageService': () => ts.LanguageService;
8
7
  'typescript/languageServiceHost': () => ts.LanguageServiceHost;
9
8
  'typescript/syntacticLanguageService': () => ts.LanguageService;
package/index.js CHANGED
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.create = void 0;
18
18
  const semver = require("semver");
19
- const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
20
19
  const shared_1 = require("./lib/shared");
20
+ const vscode_uri_1 = require("vscode-uri");
21
21
  const typescript_1 = require("@volar/typescript");
22
22
  const tsFaster = require("typescript-auto-import-cache");
23
23
  const _callHierarchy = require("./lib/features/callHierarchy");
@@ -77,30 +77,26 @@ function create(ts) {
77
77
  };
78
78
  const syntacticCtx = {
79
79
  ...context,
80
- typescript: {
81
- languageServiceHost: syntacticServiceHost,
82
- languageService: ts.createLanguageService(syntacticServiceHost, undefined, 2),
83
- },
80
+ languageServiceHost: syntacticServiceHost,
81
+ languageService: ts.createLanguageService(syntacticServiceHost, undefined, 2),
84
82
  ts,
85
- getTextDocument(uri) {
86
- const fileName = context.env.uriToFileName(uri);
87
- const virtualFile = context.language.files.getVirtualFile(fileName)[0];
88
- if (virtualFile) {
89
- return context.documents.get(uri, virtualFile.languageId, virtualFile.snapshot);
83
+ uriToFileName: uri => {
84
+ if (uri !== syntacticHostCtx.document?.uri) {
85
+ throw new Error(`uriToFileName: uri not found: ${uri}`);
90
86
  }
91
- const sourceFile = context.language.files.getSourceFile(fileName);
92
- if (sourceFile && !sourceFile.virtualFile) {
93
- return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
87
+ return syntacticHostCtx.fileName;
88
+ },
89
+ fileNameToUri: fileName => {
90
+ if (fileName !== syntacticHostCtx.fileName) {
91
+ throw new Error(`fileNameToUri: fileName not found: ${fileName}`);
94
92
  }
95
- const snapshot = syntacticServiceHost.getScriptSnapshot(fileName);
96
- if (snapshot) {
97
- let document = documents.get(snapshot);
98
- if (!document) {
99
- document = vscode_languageserver_textdocument_1.TextDocument.create(uri, '', 0, snapshot.getText(0, snapshot.getLength()));
100
- documents.set(snapshot, document);
101
- }
102
- return document;
93
+ return syntacticHostCtx.document.uri;
94
+ },
95
+ getTextDocument(uri) {
96
+ if (uri !== syntacticHostCtx.document?.uri) {
97
+ throw new Error(`getTextDocument: uri not found: ${uri}`);
103
98
  }
99
+ return syntacticHostCtx.document;
104
100
  },
105
101
  };
106
102
  const findDocumentSymbols = documentSymbol.register(syntacticCtx);
@@ -109,19 +105,18 @@ function create(ts) {
109
105
  const syntacticService = {
110
106
  provide: {
111
107
  'typescript/typescript': () => ts,
112
- 'typescript/sys': () => sys,
113
- 'typescript/languageService': () => syntacticCtx.typescript.languageService,
114
- 'typescript/languageServiceHost': () => syntacticCtx.typescript.languageServiceHost,
115
- 'typescript/syntacticLanguageService': () => syntacticCtx.typescript.languageService,
116
- 'typescript/syntacticLanguageServiceHost': () => syntacticCtx.typescript.languageServiceHost,
108
+ 'typescript/languageService': () => syntacticCtx.languageService,
109
+ 'typescript/languageServiceHost': () => syntacticCtx.languageServiceHost,
110
+ 'typescript/syntacticLanguageService': () => syntacticCtx.languageService,
111
+ 'typescript/syntacticLanguageServiceHost': () => syntacticCtx.languageServiceHost,
117
112
  },
118
113
  provideAutoInsertionEdit(document, position, lastChange) {
119
114
  if ((document.languageId === 'javascriptreact' || document.languageId === 'typescriptreact')
120
115
  && lastChange.text.endsWith('>')) {
121
116
  const config = context.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.autoClosingTags') ?? true;
122
117
  if (config) {
123
- prepareSyntacticService(document);
124
- const close = syntacticCtx.typescript.languageService.getJsxClosingTagAtPosition(context.env.uriToFileName(document.uri), document.offsetAt(position));
118
+ const ctx = prepareSyntacticService(document);
119
+ const close = syntacticCtx.languageService.getJsxClosingTagAtPosition(ctx.fileName, document.offsetAt(position));
125
120
  if (close) {
126
121
  return '$0' + close.newText;
127
122
  }
@@ -163,7 +158,8 @@ function create(ts) {
163
158
  provideFormattingIndentSensitiveLines(document) {
164
159
  if (!(0, shared_1.isTsDocument)(document))
165
160
  return;
166
- const sourceFile = ts.createSourceFile(context.env.uriToFileName(document.uri), document.getText(), ts.ScriptTarget.ESNext);
161
+ const ctx = prepareSyntacticService(document);
162
+ const sourceFile = ts.createSourceFile(ctx.fileName, document.getText(), ts.ScriptTarget.ESNext);
167
163
  if (sourceFile) {
168
164
  const lines = [];
169
165
  sourceFile.forEachChild(function walk(node) {
@@ -192,7 +188,7 @@ function create(ts) {
192
188
  if (!context.language.typescript) {
193
189
  return syntacticService;
194
190
  }
195
- const { sys, languageServiceHost, synchronizeFileSystem } = context.language.typescript;
191
+ const { sys, languageServiceHost } = context.language.typescript;
196
192
  const created = tsFaster.createLanguageService(ts, sys, languageServiceHost, proxiedHost => ts.createLanguageService(proxiedHost, (0, typescript_1.getDocumentRegistry)(ts, sys.useCaseSensitiveFileNames, languageServiceHost.getCurrentDirectory())));
197
193
  const { languageService } = created;
198
194
  if (created.setPreferences && context.env.getConfiguration) {
@@ -217,7 +213,7 @@ function create(ts) {
217
213
  updateSourceScriptFileNames();
218
214
  }
219
215
  for (const change of params.changes) {
220
- const fileName = context.env.uriToFileName(change.uri);
216
+ const fileName = context.env.typescript.uriToFileName(change.uri);
221
217
  if (sourceScriptNames.has(normalizeFileName(fileName))) {
222
218
  created.projectUpdated?.(languageServiceHost.getCurrentDirectory());
223
219
  }
@@ -226,34 +222,52 @@ function create(ts) {
226
222
  function updateSourceScriptFileNames() {
227
223
  sourceScriptNames.clear();
228
224
  for (const fileName of languageServiceHost.getScriptFileNames()) {
229
- const virtualFile = context.language.files.getVirtualFile(fileName);
230
- if (virtualFile) {
231
- sourceScriptNames.add(normalizeFileName(fileName));
232
- continue;
225
+ const uri = context.env.typescript.fileNameToUri(fileName);
226
+ const sourceFile = context.language.files.get(uri);
227
+ if (sourceFile?.generated) {
228
+ const tsCode = sourceFile.generated.languagePlugin.typescript?.getScript(sourceFile.generated.code);
229
+ if (tsCode) {
230
+ sourceScriptNames.add(normalizeFileName(fileName));
231
+ }
233
232
  }
234
- const sourceFile = context.language.files.getSourceFile(fileName);
235
- if (sourceFile && !sourceFile.virtualFile) {
233
+ else if (sourceFile) {
236
234
  sourceScriptNames.add(normalizeFileName(fileName));
237
- continue;
238
235
  }
239
236
  }
240
237
  }
241
238
  }
242
- const documents = new WeakMap();
243
239
  const semanticCtx = {
244
- ...syntacticCtx,
245
- typescript: {
246
- languageServiceHost,
247
- languageService,
240
+ ...context,
241
+ languageServiceHost,
242
+ languageService,
243
+ ts,
244
+ uriToFileName: uri => {
245
+ const [_virtualCode, file] = context.documents.getVirtualCodeByUri(uri);
246
+ if (file) {
247
+ return context.env.typescript.uriToFileName(file.id);
248
+ }
249
+ else {
250
+ return context.env.typescript.uriToFileName(uri);
251
+ }
252
+ },
253
+ fileNameToUri: fileName => {
254
+ const uri = context.env.typescript.fileNameToUri(fileName);
255
+ const file = context.language.files.get(uri);
256
+ if (file?.generated) {
257
+ const script = file.generated.languagePlugin.typescript?.getScript(file.generated.code);
258
+ if (script) {
259
+ return context.documents.getVirtualCodeUri(uri, script.code.id);
260
+ }
261
+ }
262
+ return uri;
248
263
  },
249
264
  getTextDocument(uri) {
250
- const fileName = context.env.uriToFileName(uri);
251
- const virtualFile = context.language.files.getVirtualFile(fileName)[0];
252
- if (virtualFile) {
253
- return context.documents.get(uri, virtualFile.languageId, virtualFile.snapshot);
265
+ const virtualCode = context.documents.getVirtualCodeByUri(uri)[0];
266
+ if (virtualCode) {
267
+ return context.documents.get(uri, virtualCode.languageId, virtualCode.snapshot);
254
268
  }
255
- const sourceFile = context.language.files.getSourceFile(fileName);
256
- if (sourceFile && !sourceFile.virtualFile) {
269
+ const sourceFile = context.language.files.get(uri);
270
+ if (sourceFile) {
257
271
  return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
258
272
  }
259
273
  },
@@ -483,24 +497,25 @@ function create(ts) {
483
497
  },
484
498
  };
485
499
  async function worker(token, callback) {
486
- let oldSysVersion = await synchronizeFileSystem?.();
500
+ let oldSysVersion = await sys.sync?.();
487
501
  let result = await callback();
488
- let newSysVersion = await synchronizeFileSystem?.();
502
+ let newSysVersion = await sys.sync?.();
489
503
  while (newSysVersion !== oldSysVersion && !token.isCancellationRequested) {
490
504
  oldSysVersion = newSysVersion;
491
505
  result = await callback();
492
- newSysVersion = await synchronizeFileSystem?.();
506
+ newSysVersion = await sys.sync?.();
493
507
  }
494
508
  return result;
495
509
  }
496
510
  function prepareSyntacticService(document) {
497
- if (syntacticHostCtx.document === document && syntacticHostCtx.fileVersion === document.version) {
498
- return;
511
+ if (syntacticHostCtx.document !== document || syntacticHostCtx.fileVersion !== document.version) {
512
+ syntacticHostCtx.document = document;
513
+ syntacticHostCtx.fileName = vscode_uri_1.URI.parse(document.uri).fsPath.replace(/\\/g, '/');
514
+ syntacticHostCtx.fileVersion = document.version;
515
+ syntacticHostCtx.snapshot = ts.ScriptSnapshot.fromString(document.getText());
516
+ syntacticHostCtx.projectVersion++;
499
517
  }
500
- syntacticHostCtx.fileName = context.env.uriToFileName(document.uri);
501
- syntacticHostCtx.fileVersion = document.version;
502
- syntacticHostCtx.snapshot = ts.ScriptSnapshot.fromString(document.getText());
503
- syntacticHostCtx.projectVersion++;
518
+ return syntacticHostCtx;
504
519
  }
505
520
  },
506
521
  };
@@ -22,7 +22,7 @@ async function getUserPreferences(ctx, document) {
22
22
  includeCompletionsWithSnippetText: config.suggest?.includeCompletionsWithSnippetText ?? true,
23
23
  includeCompletionsWithClassMemberSnippets: config.suggest?.classMemberSnippets?.enabled ?? true,
24
24
  includeCompletionsWithObjectLiteralMethodSnippets: config.suggest?.objectLiteralMethodSnippets?.enabled ?? true,
25
- autoImportFileExcludePatterns: getAutoImportFileExcludePatternsPreference(preferencesConfig, ctx.typescript.languageServiceHost.getCurrentDirectory()),
25
+ autoImportFileExcludePatterns: getAutoImportFileExcludePatternsPreference(preferencesConfig, ctx.languageServiceHost.getCurrentDirectory()),
26
26
  useLabelDetailsInCompletionEntries: true,
27
27
  allowIncompleteCompletions: true,
28
28
  displayPartsForJSDoc: true,
@@ -11,9 +11,9 @@ function register(ctx) {
11
11
  const document = ctx.getTextDocument(uri);
12
12
  if (!document)
13
13
  return [];
14
- const fileName = ctx.env.uriToFileName(document.uri);
14
+ const fileName = ctx.uriToFileName(document.uri);
15
15
  const offset = document.offsetAt(position);
16
- const calls = (0, shared_1.safeCall)(() => ctx.typescript.languageService.prepareCallHierarchy(fileName, offset));
16
+ const calls = (0, shared_1.safeCall)(() => ctx.languageService.prepareCallHierarchy(fileName, offset));
17
17
  if (!calls)
18
18
  return [];
19
19
  const items = Array.isArray(calls) ? calls : [calls];
@@ -23,9 +23,9 @@ function register(ctx) {
23
23
  const document = ctx.getTextDocument(item.uri);
24
24
  if (!document)
25
25
  return [];
26
- const fileName = ctx.env.uriToFileName(item.uri);
26
+ const fileName = ctx.uriToFileName(item.uri);
27
27
  const offset = document.offsetAt(item.selectionRange.start);
28
- const calls = (0, shared_1.safeCall)(() => ctx.typescript.languageService.provideCallHierarchyIncomingCalls(fileName, offset));
28
+ const calls = (0, shared_1.safeCall)(() => ctx.languageService.provideCallHierarchyIncomingCalls(fileName, offset));
29
29
  if (!calls)
30
30
  return [];
31
31
  const items = Array.isArray(calls) ? calls : [calls];
@@ -35,9 +35,9 @@ function register(ctx) {
35
35
  const document = ctx.getTextDocument(item.uri);
36
36
  if (!document)
37
37
  return [];
38
- const fileName = ctx.env.uriToFileName(item.uri);
38
+ const fileName = ctx.uriToFileName(item.uri);
39
39
  const offset = document.offsetAt(item.selectionRange.start);
40
- const calls = (0, shared_1.safeCall)(() => ctx.typescript.languageService.provideCallHierarchyOutgoingCalls(fileName, offset));
40
+ const calls = (0, shared_1.safeCall)(() => ctx.languageService.provideCallHierarchyOutgoingCalls(fileName, offset));
41
41
  if (!calls)
42
42
  return [];
43
43
  const items = Array.isArray(calls) ? calls : [calls];
@@ -52,8 +52,8 @@ function register(ctx) {
52
52
  return item.kind === PConst.Kind.script || item.kind === PConst.Kind.module && item.selectionSpan.start === 0;
53
53
  }
54
54
  function fromProtocolCallHierarchyItem(item) {
55
- const rootPath = ctx.typescript.languageService.getProgram()?.getCompilerOptions().rootDir ?? '';
56
- const document = ctx.getTextDocument(ctx.env.fileNameToUri(item.file)); // TODO
55
+ const rootPath = ctx.languageService.getProgram()?.getCompilerOptions().rootDir ?? '';
56
+ const document = ctx.getTextDocument(ctx.fileNameToUri(item.file)); // TODO
57
57
  const useFileName = isSourceFileItem(item);
58
58
  const name = useFileName ? path.basename(item.file) : item.name;
59
59
  const detail = useFileName ? path.relative(rootPath, path.dirname(item.file)) : item.containerName ?? '';
@@ -61,7 +61,7 @@ function register(ctx) {
61
61
  kind: typeConverters.SymbolKind.fromProtocolScriptElementKind(item.kind),
62
62
  name,
63
63
  detail,
64
- uri: ctx.env.fileNameToUri(item.file),
64
+ uri: ctx.fileNameToUri(item.file),
65
65
  range: {
66
66
  start: document.positionAt(item.span.start),
67
67
  end: document.positionAt(item.span.start + item.span.length),
@@ -78,7 +78,7 @@ function register(ctx) {
78
78
  return result;
79
79
  }
80
80
  function fromProtocolCallHierarchyIncomingCall(item) {
81
- const document = ctx.getTextDocument(ctx.env.fileNameToUri(item.from.file));
81
+ const document = ctx.getTextDocument(ctx.fileNameToUri(item.from.file));
82
82
  return {
83
83
  from: fromProtocolCallHierarchyItem(item.from),
84
84
  fromRanges: item.fromSpans.map(fromSpan => ({
@@ -22,14 +22,14 @@ function register(ctx) {
22
22
  (0, getFormatCodeSettings_1.getFormatCodeSettings)(ctx, document),
23
23
  (0, getUserPreferences_1.getUserPreferences)(ctx, document),
24
24
  ]);
25
- const fileName = ctx.env.uriToFileName(document.uri);
25
+ const fileName = ctx.uriToFileName(document.uri);
26
26
  const start = document.offsetAt(range.start);
27
27
  const end = document.offsetAt(range.end);
28
28
  let result = [];
29
29
  const onlyQuickFix = matchOnlyKind(`${'quickfix'}.ts`);
30
30
  if (!context.only || onlyQuickFix) {
31
31
  for (const error of context.diagnostics) {
32
- const codeFixes = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getCodeFixesAtPosition(fileName, document.offsetAt(error.range.start), document.offsetAt(error.range.end), [Number(error.code)], formatOptions, preferences)) ?? [];
32
+ const codeFixes = (0, shared_1.safeCall)(() => ctx.languageService.getCodeFixesAtPosition(fileName, document.offsetAt(error.range.start), document.offsetAt(error.range.end), [Number(error.code)], formatOptions, preferences)) ?? [];
33
33
  for (const codeFix of codeFixes) {
34
34
  result = result.concat(transformCodeFix(codeFix, [error], onlyQuickFix ?? ''));
35
35
  }
@@ -38,7 +38,7 @@ function register(ctx) {
38
38
  if (context.only) {
39
39
  for (const only of context.only) {
40
40
  if (only.split('.')[0] === 'refactor') {
41
- const refactors = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getApplicableRefactors(fileName, { pos: start, end: end }, preferences, undefined, only)) ?? [];
41
+ const refactors = (0, shared_1.safeCall)(() => ctx.languageService.getApplicableRefactors(fileName, { pos: start, end: end }, preferences, undefined, only)) ?? [];
42
42
  for (const refactor of refactors) {
43
43
  result = result.concat(transformRefactor(refactor));
44
44
  }
@@ -46,7 +46,7 @@ function register(ctx) {
46
46
  }
47
47
  }
48
48
  else {
49
- const refactors = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getApplicableRefactors(fileName, { pos: start, end: end }, preferences, undefined, undefined)) ?? [];
49
+ const refactors = (0, shared_1.safeCall)(() => ctx.languageService.getApplicableRefactors(fileName, { pos: start, end: end }, preferences, undefined, undefined)) ?? [];
50
50
  for (const refactor of refactors) {
51
51
  result = result.concat(transformRefactor(refactor));
52
52
  }
@@ -27,13 +27,13 @@ function register(ctx) {
27
27
  }
28
28
  exports.register = register;
29
29
  function resolveFixAllCodeAction(ctx, codeAction, data, formatOptions, preferences) {
30
- const fixes = data.fixIds.map(fixId => (0, shared_1.safeCall)(() => ctx.typescript.languageService.getCombinedCodeFix({ type: 'file', fileName: data.fileName }, fixId, formatOptions, preferences)));
30
+ const fixes = data.fixIds.map(fixId => (0, shared_1.safeCall)(() => ctx.languageService.getCombinedCodeFix({ type: 'file', fileName: data.fileName }, fixId, formatOptions, preferences)));
31
31
  const changes = fixes.map(fix => fix?.changes ?? []).flat();
32
32
  codeAction.edit = (0, rename_1.fileTextChangesToWorkspaceEdit)(changes, ctx);
33
33
  }
34
34
  exports.resolveFixAllCodeAction = resolveFixAllCodeAction;
35
35
  function resolveRefactorCodeAction(ctx, codeAction, data, document, formatOptions, preferences) {
36
- const editInfo = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getEditsForRefactor(data.fileName, formatOptions, data.range, data.refactorName, data.actionName, preferences));
36
+ const editInfo = (0, shared_1.safeCall)(() => ctx.languageService.getEditsForRefactor(data.fileName, formatOptions, data.range, data.refactorName, data.actionName, preferences));
37
37
  if (!editInfo) {
38
38
  return;
39
39
  }
@@ -44,7 +44,7 @@ function resolveRefactorCodeAction(ctx, codeAction, data, document, formatOption
44
44
  }
45
45
  exports.resolveRefactorCodeAction = resolveRefactorCodeAction;
46
46
  function resolveOrganizeImportsCodeAction(ctx, codeAction, data, formatOptions, preferences) {
47
- const changes = (0, shared_1.safeCall)(() => ctx.typescript.languageService.organizeImports({ type: 'file', fileName: data.fileName }, formatOptions, preferences));
47
+ const changes = (0, shared_1.safeCall)(() => ctx.languageService.organizeImports({ type: 'file', fileName: data.fileName }, formatOptions, preferences));
48
48
  codeAction.edit = (0, rename_1.fileTextChangesToWorkspaceEdit)(changes ?? [], ctx);
49
49
  }
50
50
  exports.resolveOrganizeImportsCodeAction = resolveOrganizeImportsCodeAction;
@@ -15,9 +15,9 @@ function register(ctx) {
15
15
  if (!document)
16
16
  return;
17
17
  const preferences = await (0, getUserPreferences_1.getUserPreferences)(ctx, document);
18
- const fileName = ctx.env.uriToFileName(document.uri);
18
+ const fileName = ctx.uriToFileName(document.uri);
19
19
  const offset = document.offsetAt(position);
20
- const completionContext = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getCompletionsAtPosition(fileName, offset, {
20
+ const completionContext = (0, shared_1.safeCall)(() => ctx.languageService.getCompletionsAtPosition(fileName, offset, {
21
21
  ...preferences,
22
22
  ...options,
23
23
  }));
@@ -12,9 +12,9 @@ function register(ctx) {
12
12
  return;
13
13
  if (!isPotentiallyValidDocCompletionPosition(document, position))
14
14
  return;
15
- const fileName = ctx.env.uriToFileName(document.uri);
15
+ const fileName = ctx.uriToFileName(document.uri);
16
16
  const offset = document.offsetAt(position);
17
- const docCommentTemplate = ctx.typescript.languageService.getDocCommentTemplateAtPosition(fileName, offset);
17
+ const docCommentTemplate = ctx.languageService.getDocCommentTemplateAtPosition(fileName, offset);
18
18
  if (!docCommentTemplate)
19
19
  return;
20
20
  let insertText;
@@ -26,7 +26,7 @@ function register(ctx) {
26
26
  ]) : [{}, {}];
27
27
  let details;
28
28
  try {
29
- details = ctx.typescript.languageService.getCompletionEntryDetails(fileName, offset, data.originalItem.name, formatOptions, data.originalItem.source, preferences, data.originalItem.data);
29
+ details = ctx.languageService.getCompletionEntryDetails(fileName, offset, data.originalItem.name, formatOptions, data.originalItem.source, preferences, data.originalItem.data);
30
30
  }
31
31
  catch (err) {
32
32
  item.detail = `[TS Error]\n${err}\n${JSON.stringify(err, undefined, 2)}`;
@@ -76,7 +76,7 @@ function register(ctx) {
76
76
  const useCodeSnippetsOnMethodSuggest = await ctx.env.getConfiguration?.((0, shared_1.getConfigTitle)(document) + '.suggest.completeFunctionCalls') ?? false;
77
77
  const useCodeSnippet = useCodeSnippetsOnMethodSuggest && (item.kind === 3 || item.kind === 2);
78
78
  if (useCodeSnippet) {
79
- const shouldCompleteFunction = isValidFunctionCompletionContext(ctx.typescript.languageService, fileName, offset, document);
79
+ const shouldCompleteFunction = isValidFunctionCompletionContext(ctx.languageService, fileName, offset, document);
80
80
  if (shouldCompleteFunction) {
81
81
  const { snippet, parameterCount } = (0, snippetForFunctionCall_1.snippetForFunctionCall)({
82
82
  insertText: item.insertText ?? item.textEdit?.newText, // insertText is dropped by LSP in some case: https://github.com/microsoft/vscode-languageserver-node/blob/9b742021fb04ad081aa3676a9eecf4fa612084b4/client/src/common/codeConverter.ts#L659-L664
@@ -104,7 +104,7 @@ function register(ctx) {
104
104
  }
105
105
  return item;
106
106
  function toResource(path) {
107
- return ctx.env.fileNameToUri(path);
107
+ return ctx.fileNameToUri(path);
108
108
  }
109
109
  };
110
110
  }
@@ -8,9 +8,9 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
11
+ const fileName = ctx.uriToFileName(document.uri);
12
12
  const offset = document.offsetAt(position);
13
- const info = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getDefinitionAndBoundSpan(fileName, offset));
13
+ const info = (0, shared_1.safeCall)(() => ctx.languageService.getDefinitionAndBoundSpan(fileName, offset));
14
14
  if (!info)
15
15
  return [];
16
16
  return (0, transforms_1.boundSpanToLocationLinks)(info, document, ctx);
@@ -8,21 +8,21 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
12
- const program = ctx.typescript.languageService.getProgram();
11
+ const fileName = ctx.uriToFileName(document.uri);
12
+ const program = ctx.languageService.getProgram();
13
13
  const sourceFile = program?.getSourceFile(fileName);
14
14
  if (!program || !sourceFile)
15
15
  return [];
16
16
  const token = {
17
17
  isCancellationRequested() {
18
- return ctx.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested() ?? false;
18
+ return ctx.language.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested() ?? false;
19
19
  },
20
20
  throwIfCancellationRequested() { },
21
21
  };
22
22
  let errors = (0, shared_1.safeCall)(() => [
23
23
  ...options.semantic ? program.getSemanticDiagnostics(sourceFile, token) : [],
24
24
  ...options.syntactic ? program.getSyntacticDiagnostics(sourceFile, token) : [],
25
- ...options.suggestion ? ctx.typescript.languageService.getSuggestionDiagnostics(fileName) : [],
25
+ ...options.suggestion ? ctx.languageService.getSuggestionDiagnostics(fileName) : [],
26
26
  ]) ?? [];
27
27
  if (options.declaration && getEmitDeclarations(program.getCompilerOptions())) {
28
28
  errors = errors.concat(program.getDeclarationDiagnostics(sourceFile, token));
@@ -70,7 +70,7 @@ function register(ctx) {
70
70
  return;
71
71
  let document;
72
72
  if (diag.file) {
73
- document = ctx.getTextDocument(ctx.env.fileNameToUri(diag.file.fileName));
73
+ document = ctx.getTextDocument(ctx.fileNameToUri(diag.file.fileName));
74
74
  }
75
75
  if (!document)
76
76
  return;
@@ -8,9 +8,9 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
11
+ const fileName = ctx.uriToFileName(document.uri);
12
12
  const offset = document.offsetAt(position);
13
- const highlights = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getDocumentHighlights(fileName, offset, [fileName]));
13
+ const highlights = (0, shared_1.safeCall)(() => ctx.languageService.getDocumentHighlights(fileName, offset, [fileName]));
14
14
  if (!highlights)
15
15
  return [];
16
16
  const results = [];
@@ -29,8 +29,8 @@ function register(ctx) {
29
29
  const document = ctx.getTextDocument(uri);
30
30
  if (!document)
31
31
  return [];
32
- const fileName = ctx.env.uriToFileName(document.uri);
33
- const barItems = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getNavigationTree(fileName));
32
+ const fileName = ctx.uriToFileName(document.uri);
33
+ const barItems = (0, shared_1.safeCall)(() => ctx.languageService.getNavigationTree(fileName));
34
34
  if (!barItems)
35
35
  return [];
36
36
  // The root represents the file. Ignore this when showing in the UI
@@ -8,8 +8,8 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
12
- const entries = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getFileReferences(fileName));
11
+ const fileName = ctx.uriToFileName(document.uri);
12
+ const entries = (0, shared_1.safeCall)(() => ctx.languageService.getFileReferences(fileName));
13
13
  if (!entries)
14
14
  return [];
15
15
  return (0, transforms_1.entriesToLocations)([...entries], ctx);
@@ -12,9 +12,9 @@ function register(ctx) {
12
12
  (0, getFormatCodeSettings_1.getFormatCodeSettings)(ctx, document),
13
13
  (0, getUserPreferences_1.getUserPreferences)(ctx, document),
14
14
  ]) : [{}, {}];
15
- const fileToRename = ctx.env.uriToFileName(oldUri);
16
- const newFilePath = ctx.env.uriToFileName(newUri);
17
- const response = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getEditsForFileRename(fileToRename, newFilePath, formatOptions, preferences));
15
+ const fileToRename = ctx.uriToFileName(oldUri);
16
+ const newFilePath = ctx.uriToFileName(newUri);
17
+ const response = (0, shared_1.safeCall)(() => ctx.languageService.getEditsForFileRename(fileToRename, newFilePath, formatOptions, preferences));
18
18
  if (!response?.length)
19
19
  return;
20
20
  const edits = (0, rename_1.fileTextChangesToWorkspaceEdit)(response, ctx);
@@ -8,8 +8,8 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
12
- const outliningSpans = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getOutliningSpans(fileName));
11
+ const fileName = ctx.uriToFileName(document.uri);
12
+ const outliningSpans = (0, shared_1.safeCall)(() => ctx.languageService.getOutliningSpans(fileName));
13
13
  if (!outliningSpans)
14
14
  return [];
15
15
  const foldingRanges = [];
@@ -6,14 +6,14 @@ const shared_1 = require("../shared");
6
6
  function register(ctx) {
7
7
  return {
8
8
  onRange: async (document, range, options) => {
9
- const fileName = ctx.env.uriToFileName(document.uri);
9
+ const fileName = ctx.uriToFileName(document.uri);
10
10
  const tsOptions = await (0, getFormatCodeSettings_1.getFormatCodeSettings)(ctx, document, options);
11
11
  if (typeof (tsOptions.indentSize) === "boolean" || typeof (tsOptions.indentSize) === "string") {
12
12
  tsOptions.indentSize = undefined;
13
13
  }
14
14
  const scriptEdits = range
15
- ? (0, shared_1.safeCall)(() => ctx.typescript.languageService.getFormattingEditsForRange(fileName, document.offsetAt(range.start), document.offsetAt(range.end), tsOptions))
16
- : (0, shared_1.safeCall)(() => ctx.typescript.languageService.getFormattingEditsForDocument(fileName, tsOptions));
15
+ ? (0, shared_1.safeCall)(() => ctx.languageService.getFormattingEditsForRange(fileName, document.offsetAt(range.start), document.offsetAt(range.end), tsOptions))
16
+ : (0, shared_1.safeCall)(() => ctx.languageService.getFormattingEditsForDocument(fileName, tsOptions));
17
17
  if (!scriptEdits)
18
18
  return [];
19
19
  const result = [];
@@ -29,9 +29,9 @@ function register(ctx) {
29
29
  return result;
30
30
  },
31
31
  onType: async (document, options, position, key) => {
32
- const fileName = ctx.env.uriToFileName(document.uri);
32
+ const fileName = ctx.uriToFileName(document.uri);
33
33
  const tsOptions = await (0, getFormatCodeSettings_1.getFormatCodeSettings)(ctx, document, options);
34
- const scriptEdits = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getFormattingEditsAfterKeystroke(fileName, document.offsetAt(position), key, tsOptions));
34
+ const scriptEdits = (0, shared_1.safeCall)(() => ctx.languageService.getFormattingEditsAfterKeystroke(fileName, document.offsetAt(position), key, tsOptions));
35
35
  if (!scriptEdits)
36
36
  return [];
37
37
  const result = [];
@@ -9,9 +9,9 @@ function register(ctx) {
9
9
  const document = ctx.getTextDocument(uri);
10
10
  if (!document)
11
11
  return;
12
- const fileName = ctx.env.uriToFileName(document.uri);
12
+ const fileName = ctx.uriToFileName(document.uri);
13
13
  const offset = document.offsetAt(position);
14
- const info = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getQuickInfoAtPosition(fileName, offset));
14
+ const info = (0, shared_1.safeCall)(() => ctx.languageService.getQuickInfoAtPosition(fileName, offset));
15
15
  if (!info)
16
16
  return;
17
17
  const parts = [];
@@ -35,7 +35,7 @@ function register(ctx) {
35
35
  },
36
36
  };
37
37
  function toResource(path) {
38
- return ctx.env.fileNameToUri(path);
38
+ return ctx.fileNameToUri(path);
39
39
  }
40
40
  };
41
41
  }
@@ -8,9 +8,9 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
11
+ const fileName = ctx.uriToFileName(document.uri);
12
12
  const offset = document.offsetAt(position);
13
- const entries = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getImplementationAtPosition(fileName, offset));
13
+ const entries = (0, shared_1.safeCall)(() => ctx.languageService.getImplementationAtPosition(fileName, offset));
14
14
  if (!entries)
15
15
  return [];
16
16
  return (0, transforms_1.entriesToLocationLinks)([...entries], ctx);
@@ -10,11 +10,11 @@ function register(ctx) {
10
10
  if (!document)
11
11
  return;
12
12
  const preferences = await (0, getUserPreferences_1.getUserPreferences)(ctx, document);
13
- const fileName = ctx.env.uriToFileName(document.uri);
13
+ const fileName = ctx.uriToFileName(document.uri);
14
14
  const start = document.offsetAt(range.start);
15
15
  const end = document.offsetAt(range.end);
16
- const inlayHints = (0, shared_1.safeCall)(() => 'provideInlayHints' in ctx.typescript.languageService
17
- ? ctx.typescript.languageService.provideInlayHints(fileName, { start, length: end - start }, preferences)
16
+ const inlayHints = (0, shared_1.safeCall)(() => 'provideInlayHints' in ctx.languageService
17
+ ? ctx.languageService.provideInlayHints(fileName, { start, length: end - start }, preferences)
18
18
  : []) ?? [];
19
19
  return inlayHints.map(inlayHint => {
20
20
  const result = {
@@ -9,9 +9,9 @@ function register(ctx) {
9
9
  const document = ctx.getTextDocument(uri);
10
10
  if (!document)
11
11
  return;
12
- const fileName = ctx.env.uriToFileName(document.uri);
12
+ const fileName = ctx.uriToFileName(document.uri);
13
13
  const offset = document.offsetAt(position);
14
- const renameInfo = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getRenameInfo(fileName, offset, exports.renameInfoOptions));
14
+ const renameInfo = (0, shared_1.safeCall)(() => ctx.languageService.getRenameInfo(fileName, offset, exports.renameInfoOptions));
15
15
  if (!renameInfo)
16
16
  return;
17
17
  if (!renameInfo.canRename) {
@@ -8,9 +8,9 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
11
+ const fileName = ctx.uriToFileName(document.uri);
12
12
  const offset = document.offsetAt(position);
13
- const references = (0, shared_1.safeCall)(() => ctx.typescript.languageService.findReferences(fileName, offset));
13
+ const references = (0, shared_1.safeCall)(() => ctx.languageService.findReferences(fileName, offset));
14
14
  if (!references)
15
15
  return [];
16
16
  const result = [];
@@ -11,9 +11,9 @@ function register(ctx) {
11
11
  const document = ctx.getTextDocument(uri);
12
12
  if (!document)
13
13
  return;
14
- const fileName = ctx.env.uriToFileName(document.uri);
14
+ const fileName = ctx.uriToFileName(document.uri);
15
15
  const offset = document.offsetAt(position);
16
- const renameInfo = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getRenameInfo(fileName, offset, prepareRename_1.renameInfoOptions));
16
+ const renameInfo = (0, shared_1.safeCall)(() => ctx.languageService.getRenameInfo(fileName, offset, prepareRename_1.renameInfoOptions));
17
17
  if (!renameInfo?.canRename)
18
18
  return;
19
19
  if (renameInfo.fileToRename) {
@@ -24,7 +24,7 @@ function register(ctx) {
24
24
  return renameFile(renameInfo.fileToRename, newName, formatOptions, preferences);
25
25
  }
26
26
  const { providePrefixAndSuffixTextForRename } = await (0, getUserPreferences_1.getUserPreferences)(ctx, document);
27
- const entries = ctx.typescript.languageService.findRenameLocations(fileName, offset, false, false, providePrefixAndSuffixTextForRename);
27
+ const entries = ctx.languageService.findRenameLocations(fileName, offset, false, false, providePrefixAndSuffixTextForRename);
28
28
  if (!entries)
29
29
  return;
30
30
  const locations = locationsToWorkspaceEdit(newName, entries, ctx);
@@ -37,15 +37,15 @@ function register(ctx) {
37
37
  }
38
38
  const dirname = path.dirname(fileToRename);
39
39
  const newFilePath = path.join(dirname, newName);
40
- const response = ctx.typescript.languageService.getEditsForFileRename(fileToRename, newFilePath, formatOptions, preferences);
40
+ const response = ctx.languageService.getEditsForFileRename(fileToRename, newFilePath, formatOptions, preferences);
41
41
  const edits = fileTextChangesToWorkspaceEdit(response, ctx);
42
42
  if (!edits.documentChanges) {
43
43
  edits.documentChanges = [];
44
44
  }
45
45
  edits.documentChanges.push({
46
46
  kind: 'rename',
47
- oldUri: ctx.env.fileNameToUri(fileToRename),
48
- newUri: ctx.env.fileNameToUri(newFilePath),
47
+ oldUri: ctx.fileNameToUri(fileToRename),
48
+ newUri: ctx.fileNameToUri(newFilePath),
49
49
  });
50
50
  return edits;
51
51
  }
@@ -57,7 +57,7 @@ function fileTextChangesToWorkspaceEdit(changes, ctx) {
57
57
  if (!workspaceEdit.documentChanges) {
58
58
  workspaceEdit.documentChanges = [];
59
59
  }
60
- const uri = ctx.env.fileNameToUri(change.fileName);
60
+ const uri = ctx.fileNameToUri(change.fileName);
61
61
  let doc = ctx.getTextDocument(uri);
62
62
  if (change.isNewFile) {
63
63
  workspaceEdit.documentChanges.push({ kind: 'create', uri });
@@ -91,7 +91,7 @@ function locationsToWorkspaceEdit(newText, locations, ctx) {
91
91
  if (!workspaceEdit.changes) {
92
92
  workspaceEdit.changes = {};
93
93
  }
94
- const uri = ctx.env.fileNameToUri(location.fileName);
94
+ const uri = ctx.fileNameToUri(location.fileName);
95
95
  const doc = ctx.getTextDocument(uri);
96
96
  if (!doc)
97
97
  continue;
@@ -9,9 +9,9 @@ function register(ctx) {
9
9
  return [];
10
10
  const result = [];
11
11
  for (const position of positions) {
12
- const fileName = ctx.env.uriToFileName(document.uri);
12
+ const fileName = ctx.uriToFileName(document.uri);
13
13
  const offset = document.offsetAt(position);
14
- const range = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getSmartSelectionRange(fileName, offset));
14
+ const range = (0, shared_1.safeCall)(() => ctx.languageService.getSmartSelectionRange(fileName, offset));
15
15
  if (!range)
16
16
  continue;
17
17
  result.push(transformSelectionRange(range, document));
@@ -8,17 +8,17 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return;
11
- const file = ctx.env.uriToFileName(uri);
11
+ const file = ctx.uriToFileName(uri);
12
12
  const start = range ? document.offsetAt(range.start) : 0;
13
13
  const length = range ? (document.offsetAt(range.end) - start) : document.getText().length;
14
- if (ctx.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested())
14
+ if (ctx.language.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested())
15
15
  return;
16
- const response2 = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getEncodedSyntacticClassifications(file, { start, length }));
16
+ const response2 = (0, shared_1.safeCall)(() => ctx.languageService.getEncodedSyntacticClassifications(file, { start, length }));
17
17
  if (!response2)
18
18
  return;
19
- if (ctx.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested())
19
+ if (ctx.language.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested())
20
20
  return;
21
- const response1 = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getEncodedSemanticClassifications(file, { start, length }, ts.SemanticClassificationFormat.TwentyTwenty));
21
+ const response1 = (0, shared_1.safeCall)(() => ctx.languageService.getEncodedSemanticClassifications(file, { start, length }, ts.SemanticClassificationFormat.TwentyTwenty));
22
22
  if (!response1)
23
23
  return;
24
24
  let tokenModifiersTable = [];
@@ -26,9 +26,9 @@ function register(ctx) {
26
26
  triggerCharacter: context.triggerCharacter,
27
27
  };
28
28
  }
29
- const fileName = ctx.env.uriToFileName(document.uri);
29
+ const fileName = ctx.uriToFileName(document.uri);
30
30
  const offset = document.offsetAt(position);
31
- const helpItems = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getSignatureHelpItems(fileName, offset, options));
31
+ const helpItems = (0, shared_1.safeCall)(() => ctx.languageService.getSignatureHelpItems(fileName, offset, options));
32
32
  if (!helpItems)
33
33
  return;
34
34
  return {
@@ -8,9 +8,9 @@ function register(ctx) {
8
8
  const document = ctx.getTextDocument(uri);
9
9
  if (!document)
10
10
  return [];
11
- const fileName = ctx.env.uriToFileName(document.uri);
11
+ const fileName = ctx.uriToFileName(document.uri);
12
12
  const offset = document.offsetAt(position);
13
- const entries = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getTypeDefinitionAtPosition(fileName, offset));
13
+ const entries = (0, shared_1.safeCall)(() => ctx.languageService.getTypeDefinitionAtPosition(fileName, offset));
14
14
  if (!entries)
15
15
  return [];
16
16
  return (0, transforms_1.entriesToLocationLinks)([...entries], ctx);
@@ -22,7 +22,7 @@ function getSymbolKind(item) {
22
22
  }
23
23
  function register(ctx) {
24
24
  return (query) => {
25
- const items = (0, shared_1.safeCall)(() => ctx.typescript.languageService.getNavigateToItems(query));
25
+ const items = (0, shared_1.safeCall)(() => ctx.languageService.getNavigateToItems(query));
26
26
  if (!items)
27
27
  return [];
28
28
  return items
@@ -31,7 +31,7 @@ function register(ctx) {
31
31
  .filter((v) => !!v);
32
32
  function toWorkspaceSymbol(item) {
33
33
  const label = getLabel(item);
34
- const uri = ctx.env.fileNameToUri(item.fileName);
34
+ const uri = ctx.fileNameToUri(item.fileName);
35
35
  const document = ctx.getTextDocument(uri);
36
36
  if (document) {
37
37
  const range = {
package/lib/types.d.ts CHANGED
@@ -2,11 +2,11 @@ import type { ServiceContext } from '@volar/language-service';
2
2
  import type * as ts from 'typescript';
3
3
  import type { TextDocument } from 'vscode-languageserver-textdocument';
4
4
  export type SharedContext = ServiceContext & {
5
- typescript: {
6
- languageServiceHost: ts.LanguageServiceHost;
7
- languageService: ts.LanguageService;
8
- };
9
5
  ts: typeof import('typescript');
6
+ languageServiceHost: ts.LanguageServiceHost;
7
+ languageService: ts.LanguageService;
10
8
  getTextDocument: (uri: string) => TextDocument | undefined;
9
+ uriToFileName: (uri: string) => string;
10
+ fileNameToUri: (fileName: string) => string;
11
11
  };
12
12
  //# sourceMappingURL=types.d.ts.map
@@ -105,7 +105,7 @@ function convertLinkTags(parts, filePathConverter, ctx) {
105
105
  let target = currentLink.target;
106
106
  if (typeof currentLink.target === 'object' && 'fileName' in currentLink.target) {
107
107
  const _target = currentLink.target;
108
- const fileDoc = ctx.getTextDocument(ctx.env.uriToFileName(_target.fileName));
108
+ const fileDoc = ctx.getTextDocument(ctx.uriToFileName(_target.fileName));
109
109
  if (fileDoc) {
110
110
  const start = fileDoc.positionAt(_target.textSpan.start);
111
111
  const end = fileDoc.positionAt(_target.textSpan.start + _target.textSpan.length);
@@ -8,7 +8,7 @@ function entriesToLocations(entries, ctx) {
8
8
  }
9
9
  exports.entriesToLocations = entriesToLocations;
10
10
  function entryToLocation(entry, ctx) {
11
- const entryUri = ctx.env.fileNameToUri(entry.fileName);
11
+ const entryUri = ctx.fileNameToUri(entry.fileName);
12
12
  const doc = ctx.getTextDocument(entryUri);
13
13
  if (!doc)
14
14
  return;
@@ -23,7 +23,7 @@ exports.entryToLocation = entryToLocation;
23
23
  function entriesToLocationLinks(entries, ctx) {
24
24
  const locations = [];
25
25
  for (const entry of entries) {
26
- const entryUri = ctx.env.fileNameToUri(entry.fileName);
26
+ const entryUri = ctx.fileNameToUri(entry.fileName);
27
27
  const doc = ctx.getTextDocument(entryUri);
28
28
  if (!doc)
29
29
  continue;
@@ -59,7 +59,7 @@ function boundSpanToLocationLinks(info, originalDoc, ctx) {
59
59
  end: originalDoc.positionAt(info.textSpan.start + info.textSpan.length),
60
60
  };
61
61
  for (const entry of info.definitions) {
62
- const entryUri = ctx.env.fileNameToUri(entry.fileName);
62
+ const entryUri = ctx.fileNameToUri(entry.fileName);
63
63
  const doc = ctx.getTextDocument(entryUri);
64
64
  if (!doc)
65
65
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-typescript",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "Integrate TypeScript into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/typescript",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -37,13 +37,13 @@
37
37
  "vscode-uri": "^3.0.8"
38
38
  },
39
39
  "peerDependencies": {
40
- "@volar/language-service": "next",
41
- "@volar/typescript": "next"
40
+ "@volar/language-service": "~2.0",
41
+ "@volar/typescript": "~2.0"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@volar/language-service": {
45
45
  "optional": true
46
46
  }
47
47
  },
48
- "gitHead": "d8838f4288d4836a8829a458855f557d58732963"
48
+ "gitHead": "bc83e2d244f494e30f6f789b766e54eeaa0e7a01"
49
49
  }
package/lib/protocol.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=protocol.d.ts.map
package/lib/protocol.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=protocol.js.map