@volar/language-server 1.0.0-beta.2 → 1.0.0-beta.4

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.
@@ -15,13 +15,13 @@ const embedded = require("@volar/language-core");
15
15
  const vscode = require("vscode-languageserver");
16
16
  const vscode_uri_1 = require("vscode-uri");
17
17
  const config_1 = require("./config");
18
- const upath = require("upath");
19
- const path_1 = require("path");
20
- function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConfig, tsLocalized, documents, connection, configHost, documentRegistry) {
18
+ const path = require("typesafe-path");
19
+ function createProject(runtimeEnv, plugins, fsHost, ts, rootUri, tsConfig, tsLocalized, documents, configHost, documentRegistry, cancelTokenHost) {
21
20
  return __awaiter(this, void 0, void 0, function* () {
22
21
  const sys = fsHost.getWorkspaceFileSystem(rootUri);
23
22
  let typeRootVersion = 0;
24
23
  let projectVersion = 0;
24
+ let projectVersionUpdateTime = 0;
25
25
  let vueLs;
26
26
  let parsedCommandLine = createParsedCommandLine(ts, sys, shared.getPathOfUri(rootUri.toString()), tsConfig, plugins);
27
27
  const scripts = shared.createUriMap();
@@ -31,6 +31,7 @@ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConf
31
31
  });
32
32
  const disposeDocChange = documents.onDidChangeContent(params => {
33
33
  projectVersion++;
34
+ projectVersionUpdateTime = cancelTokenHost.getMtime();
34
35
  });
35
36
  return {
36
37
  getLanguageService,
@@ -100,6 +101,12 @@ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConf
100
101
  }
101
102
  function createLanguageServiceHost() {
102
103
  var _a;
104
+ const token = {
105
+ isCancellationRequested() {
106
+ return cancelTokenHost.getMtime() !== projectVersionUpdateTime;
107
+ },
108
+ throwIfCancellationRequested() { },
109
+ };
103
110
  let host = {
104
111
  // ts
105
112
  getNewLine: () => sys.newLine,
@@ -113,6 +120,7 @@ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConf
113
120
  fileExists: sys.fileExists,
114
121
  getCurrentDirectory: () => shared.getPathOfUri(rootUri.toString()),
115
122
  getProjectReferences: () => parsedCommandLine.projectReferences,
123
+ getCancellationToken: () => token,
116
124
  // custom
117
125
  getDefaultLibFileName: options => {
118
126
  try {
@@ -187,21 +195,15 @@ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConf
187
195
  }
188
196
  exports.createProject = createProject;
189
197
  function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
190
- const extraFileExtensions = plugins.map(plugin => plugin.extensions)
191
- .flat()
192
- .map(ext => ({
193
- extension: ext.substring(1),
194
- isMixedContent: true,
195
- scriptKind: ts.ScriptKind.Deferred,
196
- }));
198
+ const extraFileExtensions = plugins.map(plugin => plugin.extraFileExtensions).flat();
197
199
  try {
198
200
  let content;
199
201
  if (typeof tsConfig === 'string') {
200
202
  const config = ts.readJsonConfigFile(tsConfig, sys.readFile);
201
- content = ts.parseJsonSourceFileConfigFileContent(config, sys, path_1.posix.dirname(tsConfig), {}, tsConfig, undefined, extraFileExtensions);
203
+ content = ts.parseJsonSourceFileConfigFileContent(config, sys, path.dirname(tsConfig), {}, tsConfig, undefined, extraFileExtensions);
202
204
  }
203
205
  else {
204
- content = ts.parseJsonConfigFileContent({}, sys, rootPath, tsConfig, path_1.posix.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions);
206
+ content = ts.parseJsonConfigFileContent({}, sys, rootPath, tsConfig, path.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions);
205
207
  }
206
208
  // fix https://github.com/johnsoncodehk/volar/issues/1786
207
209
  // https://github.com/microsoft/TypeScript/issues/30457
@@ -227,20 +229,19 @@ function getHTMLDocumentContext(ts, host) {
227
229
  const resolveResult = ts.resolveModuleName(ref, isUri ? shared.getPathOfUri(base) : base, host.getCompilationSettings(), host);
228
230
  const failedLookupLocations = resolveResult.failedLookupLocations;
229
231
  const dirs = new Set();
230
- for (const failed of failedLookupLocations) {
231
- let path = failed;
232
- const fileName = upath.basename(path);
232
+ for (let failed of failedLookupLocations) {
233
+ const fileName = path.basename(failed);
233
234
  if (fileName === 'index.d.ts' || fileName === '*.d.ts') {
234
- dirs.add(upath.dirname(path));
235
+ dirs.add(path.dirname(failed));
235
236
  }
236
- if (path.endsWith('.d.ts')) {
237
- path = path.substring(0, path.length - '.d.ts'.length);
237
+ if (failed.endsWith('.d.ts')) {
238
+ failed = failed.substring(0, failed.length - '.d.ts'.length);
238
239
  }
239
240
  else {
240
241
  continue;
241
242
  }
242
- if (host.fileExists(path)) {
243
- return isUri ? shared.getUriByPath(vscode_uri_1.URI.parse(base), path) : path;
243
+ if (host.fileExists(failed)) {
244
+ return isUri ? shared.getUriByPath(vscode_uri_1.URI.parse(base), failed) : failed;
244
245
  }
245
246
  }
246
247
  for (const dir of dirs) {
@@ -33,10 +33,10 @@ export declare function createSnapshots(connection: vscode.Connection): {
33
33
  uriGet: (_uri: string) => IncrementalScriptSnapshot | undefined;
34
34
  uriHas: (_uri: string) => boolean;
35
35
  uriSet: (_uri: string, item: IncrementalScriptSnapshot) => void;
36
- pathDelete: (rootUri: shared._.URI, path: string) => boolean;
37
- pathGet: (rootUri: shared._.URI, path: string) => IncrementalScriptSnapshot | undefined;
38
- pathHas: (rootUri: shared._.URI, path: string) => IncrementalScriptSnapshot | undefined;
39
- pathSet: (rootUri: shared._.URI, path: string, item: IncrementalScriptSnapshot) => void;
36
+ pathDelete: (rootUri: shared._2.URI, path: string) => boolean;
37
+ pathGet: (rootUri: shared._2.URI, path: string) => IncrementalScriptSnapshot | undefined;
38
+ pathHas: (rootUri: shared._2.URI, path: string) => IncrementalScriptSnapshot | undefined;
39
+ pathSet: (rootUri: shared._2.URI, path: string, item: IncrementalScriptSnapshot) => void;
40
40
  };
41
41
  onDidOpen: (cb: (params: vscode.DidOpenTextDocumentParams) => void) => () => boolean;
42
42
  onDidChangeContent: (cb: (params: vscode.DidChangeTextDocumentParams) => void) => () => boolean;
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createWebFileSystemHost = void 0;
12
12
  const shared = require("@volar/shared");
13
- const path_1 = require("path");
13
+ const path = require("typesafe-path");
14
14
  const vscode_html_languageservice_1 = require("vscode-html-languageservice");
15
15
  const vscode = require("vscode-languageserver");
16
16
  const vscode_uri_1 = require("vscode-uri");
17
- const requests_1 = require("../requests");
17
+ const protocol_1 = require("../protocol");
18
18
  const utilities_1 = require("./ts/utilities");
19
19
  let currentCwd = '/';
20
20
  function createWebFileSystemHost() {
@@ -37,8 +37,8 @@ function createWebFileSystemHost() {
37
37
  connection.onDidChangeWatchedFiles(params => {
38
38
  for (const change of params.changes) {
39
39
  const fsPath = vscode_uri_1.URI.parse(change.uri).fsPath;
40
- const dir = getDir(path_1.posix.dirname(fsPath));
41
- const name = path_1.posix.basename(fsPath);
40
+ const dir = getDir(path.dirname(fsPath));
41
+ const name = path.basename(fsPath);
42
42
  if (change.type === vscode.FileChangeType.Created) {
43
43
  dir.fileTypes.set(name, vscode_html_languageservice_1.FileType.File);
44
44
  }
@@ -93,12 +93,12 @@ function createWebFileSystemHost() {
93
93
  process.chdir(rootUri.fsPath);
94
94
  currentCwd = rootUri.fsPath;
95
95
  }
96
- return path_1.posix.resolve(fsPath);
96
+ return path.resolve(fsPath);
97
97
  }
98
98
  function fileExists(fsPath) {
99
99
  fsPath = resolvePath(fsPath);
100
- const dir = getDir(path_1.posix.dirname(fsPath));
101
- const name = path_1.posix.basename(fsPath);
100
+ const dir = getDir(path.dirname(fsPath));
101
+ const name = path.basename(fsPath);
102
102
  if (dir.fileTypes.has(name)) {
103
103
  return dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.File || dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.SymbolicLink;
104
104
  }
@@ -113,8 +113,8 @@ function createWebFileSystemHost() {
113
113
  }
114
114
  function readFile(fsPath) {
115
115
  fsPath = resolvePath(fsPath);
116
- const dir = getDir(path_1.posix.dirname(fsPath));
117
- const name = path_1.posix.basename(fsPath);
116
+ const dir = getDir(path.dirname(fsPath));
117
+ const name = path.basename(fsPath);
118
118
  if (dir.fileTexts.has(name)) {
119
119
  return dir.fileTexts.get(name);
120
120
  }
@@ -129,7 +129,8 @@ function createWebFileSystemHost() {
129
129
  }
130
130
  function readDirectory(fsPath, extensions, exclude, include, depth) {
131
131
  fsPath = resolvePath(fsPath);
132
- return (0, utilities_1.matchFiles)(fsPath, extensions, exclude, include, false, rootUri.fsPath, depth, dirPath => {
132
+ return (0, utilities_1.matchFiles)(fsPath, extensions, exclude, include, false, rootUri.fsPath, depth, _dirPath => {
133
+ let dirPath = _dirPath;
133
134
  dirPath = resolvePath(dirPath);
134
135
  const dir = getDir(dirPath);
135
136
  const files = [...dir.fileTypes];
@@ -173,9 +174,9 @@ function createWebFileSystemHost() {
173
174
  function statAsync(connection, fsPath, dir) {
174
175
  return __awaiter(this, void 0, void 0, function* () {
175
176
  const uri = getFsPathUri(fsPath);
176
- const result = yield connection.sendRequest(requests_1.FsStatRequest.type, uri.toString());
177
+ const result = yield connection.sendRequest(protocol_1.FsStatRequest.type, uri.toString());
177
178
  if ((result === null || result === void 0 ? void 0 : result.type) === vscode_html_languageservice_1.FileType.File || (result === null || result === void 0 ? void 0 : result.type) === vscode_html_languageservice_1.FileType.SymbolicLink) {
178
- const name = path_1.posix.basename(fsPath);
179
+ const name = path.basename(fsPath);
179
180
  dir.fileTypes.set(name, result.type);
180
181
  changes.push({
181
182
  uri: uri.toString(),
@@ -187,9 +188,9 @@ function createWebFileSystemHost() {
187
188
  function readFileAsync(connection, fsPath, dir) {
188
189
  return __awaiter(this, void 0, void 0, function* () {
189
190
  const uri = getFsPathUri(fsPath);
190
- const text = yield connection.sendRequest(requests_1.FsReadFileRequest.type, uri.toString());
191
+ const text = yield connection.sendRequest(protocol_1.FsReadFileRequest.type, uri.toString());
191
192
  if (text) {
192
- const name = path_1.posix.basename(fsPath);
193
+ const name = path.basename(fsPath);
193
194
  dir.fileTexts.set(name, text);
194
195
  changes.push({
195
196
  uri: uri.toString(),
@@ -201,11 +202,11 @@ function createWebFileSystemHost() {
201
202
  function readDirectoryAsync(connection, fsPath, dir) {
202
203
  return __awaiter(this, void 0, void 0, function* () {
203
204
  const uri = getFsPathUri(fsPath);
204
- const result = yield connection.sendRequest(requests_1.FsReadDirectoryRequest.type, uri.toString());
205
+ const result = yield connection.sendRequest(protocol_1.FsReadDirectoryRequest.type, uri.toString());
205
206
  for (const [name, fileType] of result) {
206
207
  if (dir.fileTypes.get(name) !== fileType && (fileType === vscode_html_languageservice_1.FileType.File || fileType === vscode_html_languageservice_1.FileType.SymbolicLink)) {
207
208
  changes.push({
208
- uri: getFsPathUri(path_1.posix.join(fsPath, name)).toString(),
209
+ uri: getFsPathUri(path.join(fsPath, name)).toString(),
209
210
  type: vscode.FileChangeType.Created,
210
211
  });
211
212
  }
@@ -244,11 +245,11 @@ function createWebFileSystemHost() {
244
245
  function getDir(dirPath) {
245
246
  const dirNames = [];
246
247
  let currentDirPath = dirPath;
247
- let currentDirName = path_1.posix.basename(currentDirPath);
248
+ let currentDirName = path.basename(currentDirPath);
248
249
  while (currentDirName !== '') {
249
250
  dirNames.push(currentDirName);
250
- currentDirPath = path_1.posix.dirname(currentDirPath);
251
- currentDirName = path_1.posix.basename(currentDirPath);
251
+ currentDirPath = path.dirname(currentDirPath);
252
+ currentDirName = path.basename(currentDirPath);
252
253
  }
253
254
  let currentDir = root;
254
255
  for (let i = dirNames.length - 1; i >= 0; i--) {
@@ -1,13 +1,15 @@
1
1
  import * as shared from '@volar/shared';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
+ import * as path from 'typesafe-path';
3
4
  import * as vscode from 'vscode-languageserver';
4
5
  import { Project } from './project';
5
- import { LanguageServerPlugin, RuntimeEnvironment, FileSystemHost, InitializationOptions } from '../types';
6
+ import { LanguageServerPlugin, RuntimeEnvironment, FileSystemHost } from '../types';
6
7
  import { createSnapshots } from './snapshots';
7
8
  import { URI } from 'vscode-uri';
8
9
  import { ConfigurationHost } from '@volar/vue-language-service';
10
+ import { CancellactionTokenHost } from './cancellationPipe';
9
11
  export declare const rootTsConfigNames: string[];
10
- export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, options: InitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, configHost: ConfigurationHost | undefined): Promise<{
12
+ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, configHost: ConfigurationHost | undefined, cancelTokenHost: CancellactionTokenHost): Promise<{
11
13
  projects: {
12
14
  clear: () => void;
13
15
  values: () => IterableIterator<Project>;
@@ -15,25 +17,25 @@ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment,
15
17
  uriGet: (_uri: string) => Project | undefined;
16
18
  uriHas: (_uri: string) => boolean;
17
19
  uriSet: (_uri: string, item: Project) => void;
18
- pathDelete: (rootUri: shared._.URI, path: string) => boolean;
19
- pathGet: (rootUri: shared._.URI, path: string) => Project | undefined;
20
- pathHas: (rootUri: shared._.URI, path: string) => Project | undefined;
21
- pathSet: (rootUri: shared._.URI, path: string, item: Project) => void;
20
+ pathDelete: (rootUri: shared._2.URI, path: string) => boolean;
21
+ pathGet: (rootUri: shared._2.URI, path: string) => Project | undefined;
22
+ pathHas: (rootUri: shared._2.URI, path: string) => Project | undefined;
23
+ pathSet: (rootUri: shared._2.URI, path: string, item: Project) => void;
22
24
  };
23
25
  getProjectAndTsConfig: (uri: string) => Promise<{
24
26
  tsconfig: string;
25
27
  project: {
26
28
  getLanguageService: () => {
27
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
29
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
28
30
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
29
31
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
30
32
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
31
33
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
32
34
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
33
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
35
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
34
36
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
35
37
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
36
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
38
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
37
39
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
38
40
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
39
41
  isIncomplete: boolean;
@@ -67,16 +69,16 @@ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment,
67
69
  context: import("@volar/language-service").LanguageServiceRuntimeContext;
68
70
  };
69
71
  getLanguageServiceDontCreate: () => {
70
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
72
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
71
73
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
72
74
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
73
75
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
74
76
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
75
77
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
76
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
78
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
77
79
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
78
80
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
79
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
81
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
80
82
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
81
83
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
82
84
  isIncomplete: boolean;
@@ -117,4 +119,4 @@ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment,
117
119
  reload: () => void;
118
120
  dispose(): void;
119
121
  }>;
120
- export declare function sortTsConfigs(fsPath: string, a: string, b: string): number;
122
+ export declare function sortTsConfigs(fsPath: path.OsPath, a: path.OsPath, b: path.OsPath): number;
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.sortTsConfigs = exports.createWorkspaceProjects = exports.rootTsConfigNames = void 0;
12
12
  const shared = require("@volar/shared");
13
- const path = require("upath");
13
+ const path = require("typesafe-path");
14
14
  const vscode = require("vscode-languageserver");
15
15
  const project_1 = require("./project");
16
16
  const inferredCompilerOptions_1 = require("./inferredCompilerOptions");
17
17
  const vscode_uri_1 = require("vscode-uri");
18
18
  exports.rootTsConfigNames = ['tsconfig.json', 'jsconfig.json'];
19
- function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, options, documents, connection, configHost) {
19
+ function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, documents, configHost, cancelTokenHost) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
21
  let inferredProject;
22
22
  const sys = fsHost.getWorkspaceFileSystem(rootUri);
@@ -26,7 +26,7 @@ function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLoc
26
26
  const disposeWatch = fsHost.onDidChangeWatchedFiles((params, reason) => __awaiter(this, void 0, void 0, function* () {
27
27
  const disposes = [];
28
28
  for (const change of params.changes) {
29
- if (exports.rootTsConfigNames.includes(path.basename(change.uri))) {
29
+ if (exports.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1))) {
30
30
  if (change.type === vscode.FileChangeType.Created) {
31
31
  if (shared.isFileInDir(vscode_uri_1.URI.parse(change.uri).fsPath, rootUri.fsPath)) {
32
32
  rootTsConfigs.add(vscode_uri_1.URI.parse(change.uri).fsPath);
@@ -88,7 +88,7 @@ function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLoc
88
88
  if (!inferredProject) {
89
89
  inferredProject = (() => __awaiter(this, void 0, void 0, function* () {
90
90
  const inferOptions = yield (0, inferredCompilerOptions_1.getInferredCompilerOptions)(ts, configHost);
91
- return (0, project_1.createProject)(runtimeEnv, plugins, fsHost, ts, options, rootUri, inferOptions, tsLocalized, documents, connection, configHost, documentRegistry);
91
+ return (0, project_1.createProject)(runtimeEnv, plugins, fsHost, ts, rootUri, inferOptions, tsLocalized, documents, configHost, documentRegistry, cancelTokenHost);
92
92
  }))();
93
93
  }
94
94
  return inferredProject;
@@ -195,10 +195,11 @@ function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLoc
195
195
  }
196
196
  });
197
197
  }
198
- function getProjectByCreate(tsConfig) {
198
+ function getProjectByCreate(_tsConfig) {
199
+ const tsConfig = shared.normalizeFileName(_tsConfig);
199
200
  let project = projects.pathGet(rootUri, tsConfig);
200
201
  if (!project) {
201
- project = (0, project_1.createProject)(runtimeEnv, plugins, fsHost, ts, options, vscode_uri_1.URI.parse(shared.getUriByPath(rootUri, path.dirname(tsConfig))), tsConfig, tsLocalized, documents, connection, configHost, documentRegistry);
202
+ project = (0, project_1.createProject)(runtimeEnv, plugins, fsHost, ts, vscode_uri_1.URI.parse(shared.getUriByPath(rootUri, path.dirname(tsConfig))), tsConfig, tsLocalized, documents, configHost, documentRegistry, cancelTokenHost);
202
203
  projects.pathSet(rootUri, tsConfig, project);
203
204
  }
204
205
  return project;
@@ -214,8 +215,8 @@ function sortTsConfigs(fsPath, a, b) {
214
215
  const bWeight = inB ? 1 : 0;
215
216
  return bWeight - aWeight;
216
217
  }
217
- const aLength = a.split('/').length;
218
- const bLength = b.split('/').length;
218
+ const aLength = shared.normalizeFileName(a).split('/').length;
219
+ const bLength = shared.normalizeFileName(a).split('/').length;
219
220
  if (aLength === bLength) {
220
221
  const aWeight = path.basename(a) === 'tsconfig.json' ? 1 : 0;
221
222
  const bWeight = path.basename(b) === 'tsconfig.json' ? 1 : 0;
@@ -3,11 +3,12 @@ import { ConfigurationHost } from '@volar/vue-language-service';
3
3
  import type * as ts from 'typescript/lib/tsserverlibrary';
4
4
  import * as vscode from 'vscode-languageserver';
5
5
  import { URI } from 'vscode-uri';
6
- import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, InitializationOptions } from '../types';
6
+ import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, LanguageServerInitializationOptions } from '../types';
7
7
  import { createSnapshots } from './snapshots';
8
+ import { CancellactionTokenHost } from './cancellationPipe';
8
9
  export interface Workspaces extends ReturnType<typeof createWorkspaces> {
9
10
  }
10
- export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, client: vscode.ClientCapabilities, options: InitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection): {
11
+ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, client: vscode.ClientCapabilities, options: LanguageServerInitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, cancelTokenHost: CancellactionTokenHost): {
11
12
  workspaces: Map<string, Promise<{
12
13
  projects: {
13
14
  clear: () => void;
@@ -16,25 +17,25 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
16
17
  uriGet: (_uri: string) => import("./project").Project | undefined;
17
18
  uriHas: (_uri: string) => boolean;
18
19
  uriSet: (_uri: string, item: import("./project").Project) => void;
19
- pathDelete: (rootUri: shared._.URI, path: string) => boolean;
20
- pathGet: (rootUri: shared._.URI, path: string) => import("./project").Project | undefined;
21
- pathHas: (rootUri: shared._.URI, path: string) => import("./project").Project | undefined;
22
- pathSet: (rootUri: shared._.URI, path: string, item: import("./project").Project) => void;
20
+ pathDelete: (rootUri: shared._2.URI, path: string) => boolean;
21
+ pathGet: (rootUri: shared._2.URI, path: string) => import("./project").Project | undefined;
22
+ pathHas: (rootUri: shared._2.URI, path: string) => import("./project").Project | undefined;
23
+ pathSet: (rootUri: shared._2.URI, path: string, item: import("./project").Project) => void;
23
24
  };
24
25
  getProjectAndTsConfig: (uri: string) => Promise<{
25
26
  tsconfig: string;
26
27
  project: {
27
28
  getLanguageService: () => {
28
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
29
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
29
30
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
30
31
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
31
32
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
32
33
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
33
34
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
34
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
35
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
35
36
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
36
37
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
37
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
38
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
38
39
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
39
40
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
40
41
  isIncomplete: boolean;
@@ -68,16 +69,16 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
68
69
  context: import("@volar/language-service").LanguageServiceRuntimeContext;
69
70
  };
70
71
  getLanguageServiceDontCreate: () => {
71
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
72
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
72
73
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
73
74
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
74
75
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
75
76
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
76
77
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
77
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
78
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
78
79
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
79
80
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
80
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
81
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
81
82
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
82
83
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
83
84
  isIncomplete: boolean;
@@ -122,16 +123,16 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
122
123
  tsconfig: string;
123
124
  project: {
124
125
  getLanguageService: () => {
125
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
126
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
126
127
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
127
128
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
128
129
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
129
130
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
130
131
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
131
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
132
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
132
133
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
133
134
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
134
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
135
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
135
136
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
136
137
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
137
138
  isIncomplete: boolean;
@@ -165,16 +166,16 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
165
166
  context: import("@volar/language-service").LanguageServiceRuntimeContext;
166
167
  };
167
168
  getLanguageServiceDontCreate: () => {
168
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
169
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
169
170
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
170
171
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
171
172
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
172
173
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
173
174
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
174
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
175
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
175
176
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
176
177
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
177
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
178
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
178
179
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
179
180
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
180
181
  isIncomplete: boolean;
@@ -214,16 +215,16 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
214
215
  tsconfig: undefined;
215
216
  project: {
216
217
  getLanguageService: () => {
217
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
218
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
218
219
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
219
220
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
220
221
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
221
222
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
222
223
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
223
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
224
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
224
225
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
225
226
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
226
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
227
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
227
228
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
228
229
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
229
230
  isIncomplete: boolean;
@@ -257,16 +258,16 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
257
258
  context: import("@volar/language-service").LanguageServiceRuntimeContext;
258
259
  };
259
260
  getLanguageServiceDontCreate: () => {
260
- doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
261
+ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
261
262
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
262
263
  findFileReferences: (uri: string) => import("@volar/language-service").NullableResult<vscode.Location[]>;
263
264
  findDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
264
265
  findTypeDefinition: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
265
266
  findImplementations: (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
266
- prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
267
+ prepareRename: (uri: string, position: vscode.Position) => Promise<NonNullable<vscode.ResponseError<void> | vscode.Range | null | undefined> | undefined>;
267
268
  doRename: (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
268
269
  getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>;
269
- getSemanticTokens: (uri: string, range?: vscode.Range | undefined, cancleToken?: vscode.CancellationToken | undefined, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
270
+ getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/vue-language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/vue-language-service").SemanticToken[] | undefined> | undefined;
270
271
  doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
271
272
  doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{
272
273
  isIncomplete: boolean;
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createWorkspaces = void 0;
12
12
  const shared = require("@volar/shared");
13
+ const vscode = require("vscode-languageserver");
13
14
  const vscode_uri_1 = require("vscode-uri");
14
15
  const types_1 = require("../types");
15
16
  const workspaceProjects_1 = require("./workspaceProjects");
16
- function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, tsLocalized, client, options, documents, connection) {
17
+ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, tsLocalized, client, options, documents, connection, cancelTokenHost) {
17
18
  var _a;
18
19
  let semanticTokensReq = 0;
19
20
  let documentUpdatedReq = 0;
@@ -44,7 +45,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
44
45
  getProject,
45
46
  reloadProject,
46
47
  add: (rootUri) => {
47
- workspaces.set(rootUri.toString(), (0, workspaceProjects_1.createWorkspaceProjects)(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, options, documents, connection, configurationHost));
48
+ workspaces.set(rootUri.toString(), (0, workspaceProjects_1.createWorkspaceProjects)(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, documents, configurationHost, cancelTokenHost));
48
49
  },
49
50
  remove: (rootUri) => {
50
51
  const _workspace = workspaces.get(rootUri.toString());
@@ -85,13 +86,12 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
85
86
  return;
86
87
  const req = ++documentUpdatedReq;
87
88
  const delay = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'));
88
- const cancel = {
89
+ const cancel = cancelTokenHost.createCancellactionToken({
89
90
  get isCancellationRequested() {
90
91
  return req !== documentUpdatedReq;
91
92
  },
92
- // @ts-ignore
93
- onCancellationRequested: undefined,
94
- };
93
+ onCancellationRequested: vscode.Event.None,
94
+ });
95
95
  const changeDoc = docUri ? documents.data.uriGet(docUri) : undefined;
96
96
  const otherDocs = [...documents.data.values()].filter(doc => doc !== changeDoc);
97
97
  if (changeDoc) {
@@ -112,9 +112,9 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
112
112
  if (!project)
113
113
  return;
114
114
  const languageService = project.getLanguageService();
115
- const errors = yield languageService.doValidation(uri, result => {
115
+ const errors = yield languageService.doValidation(uri, cancel, result => {
116
116
  connection.sendDiagnostics({ uri: uri, diagnostics: result.map(addVersion), version });
117
- }, cancel);
117
+ });
118
118
  connection.sendDiagnostics({ uri: uri, diagnostics: errors.map(addVersion), version });
119
119
  function addVersion(error) {
120
120
  if (error.data === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,16 +17,16 @@
17
17
  "directory": "packages/language-server"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-core": "1.0.0-beta.2",
21
- "@volar/language-service": "1.0.0-beta.2",
22
- "@volar/shared": "1.0.0-beta.2",
20
+ "@volar/language-core": "1.0.0-beta.4",
21
+ "@volar/language-service": "1.0.0-beta.4",
22
+ "@volar/shared": "1.0.0-beta.4",
23
23
  "request-light": "^0.5.8",
24
- "upath": "^2.0.1",
24
+ "typesafe-path": "^0.2.0",
25
25
  "vscode-html-languageservice": "^5.0.1",
26
26
  "vscode-languageserver": "^8.0.2",
27
27
  "vscode-languageserver-protocol": "^3.17.2",
28
28
  "vscode-languageserver-textdocument": "^1.0.7",
29
29
  "vscode-uri": "^3.0.3"
30
30
  },
31
- "gitHead": "a523013ad349e28c9d0a7d9ad3f0c0834e0067e7"
31
+ "gitHead": "95f02fda8b432ca1d0cc08694ba3911c9e3b9ec6"
32
32
  }
@@ -1,3 +0,0 @@
1
- import * as vscode from 'vscode-languageserver';
2
- import { ServerInitializationOptions } from '../types';
3
- export declare function register(features: NonNullable<ServerInitializationOptions['documentFeatures']>, server: vscode.ServerCapabilities): void;