@volar/language-server 1.0.0-beta.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/types.d.ts CHANGED
@@ -30,12 +30,12 @@ export type LanguageServerPlugin<A extends ServerInitializationOptions = ServerI
30
30
  semanticTokenLegend?: vscode.SemanticTokensLegend;
31
31
  resolveLanguageServiceHost?(ts: typeof import('typescript/lib/tsserverlibrary'), sys: FileSystem, tsConfig: string | ts.CompilerOptions, host: embedded.LanguageServiceHost): B;
32
32
  getLanguageModules?(host: B): embedded.EmbeddedLanguageModule[];
33
- getServicePlugins?(host: B, service: embeddedLS.LanguageService): embeddedLS.EmbeddedLanguageServicePlugin[];
33
+ getServicePlugins?(host: B, service: embeddedLS.LanguageService): embeddedLS.LanguageServicePlugin[];
34
34
  onInitialize?(connection: vscode.Connection, getLangaugeService: (uri: string) => Promise<C>): void;
35
35
  };
36
36
  documentService?: {
37
- getLanguageModules?(ts: typeof import('typescript/lib/tsserverlibrary'), env: embeddedLS.PluginContext['env']): embedded.EmbeddedLanguageModule[];
38
- getServicePlugins?(context: embeddedLS.DocumentServiceRuntimeContext): embeddedLS.EmbeddedLanguageServicePlugin[];
37
+ getLanguageModules?(ts: typeof import('typescript/lib/tsserverlibrary'), env: embeddedLS.LanguageServicePluginContext['env']): embedded.EmbeddedLanguageModule[];
38
+ getServicePlugins?(context: embeddedLS.DocumentServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
39
39
  };
40
40
  };
41
41
  export interface ServerInitializationOptions {
@@ -9,10 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createNodeFileSystemHost = void 0;
12
+ const shared = require("@volar/shared");
12
13
  const vscode = require("vscode-languageserver");
13
14
  const iterableWeakSet_1 = require("./iterableWeakSet");
14
15
  let currentCwd = '';
15
16
  function createNodeFileSystemHost(ts, capabilities) {
17
+ const instances = shared.createUriMap();
16
18
  const onDidChangeWatchedFilesCb = new Set();
17
19
  const caches = new iterableWeakSet_1.IterableWeakSet();
18
20
  return {
@@ -36,60 +38,67 @@ function createNodeFileSystemHost(ts, capabilities) {
36
38
  });
37
39
  },
38
40
  getWorkspaceFileSystem(rootUri) {
39
- var _a;
40
- const workspaceSys = new Proxy(ts.sys, {
41
- get(target, prop) {
42
- const fn = target[prop];
43
- if (typeof fn === 'function') {
44
- return new Proxy(fn, {
45
- apply(target, thisArg, args) {
46
- if (currentCwd !== rootUri.fsPath) {
47
- process.chdir(rootUri.fsPath);
48
- currentCwd = rootUri.fsPath;
49
- }
50
- return target.apply(thisArg, args);
41
+ let sys = instances.uriGet(rootUri.toString());
42
+ if (!sys) {
43
+ sys = createWorkspaceFileSystem(rootUri);
44
+ instances.uriSet(rootUri.toString(), sys);
45
+ }
46
+ return sys;
47
+ },
48
+ onDidChangeWatchedFiles: cb => {
49
+ onDidChangeWatchedFilesCb.add(cb);
50
+ return () => onDidChangeWatchedFilesCb.delete(cb);
51
+ },
52
+ };
53
+ function createWorkspaceFileSystem(rootUri) {
54
+ var _a;
55
+ const workspaceSys = new Proxy(ts.sys, {
56
+ get(target, prop) {
57
+ const fn = target[prop];
58
+ if (typeof fn === 'function') {
59
+ return new Proxy(fn, {
60
+ apply(target, thisArg, args) {
61
+ if (currentCwd !== rootUri.fsPath) {
62
+ process.chdir(rootUri.fsPath);
63
+ currentCwd = rootUri.fsPath;
51
64
  }
52
- });
53
- }
54
- return fn;
55
- },
56
- });
57
- const fileExistsCache = new Map();
58
- const directoryExistsCache = new Map();
59
- const sysWithCache = {
65
+ return target.apply(thisArg, args);
66
+ }
67
+ });
68
+ }
69
+ return fn;
70
+ },
71
+ });
72
+ const fileExistsCache = new Map();
73
+ const directoryExistsCache = new Map();
74
+ // don't cache fs result if client did not supports file watcher
75
+ const sys = ((_a = capabilities.workspace) === null || _a === void 0 ? void 0 : _a.didChangeWatchedFiles)
76
+ ? new Proxy({
60
77
  fileExists(path) {
61
78
  if (!fileExistsCache.has(path)) {
62
- fileExistsCache.set(path, ts.sys.fileExists(path));
79
+ fileExistsCache.set(path, workspaceSys.fileExists(path));
63
80
  }
64
81
  return fileExistsCache.get(path);
65
82
  },
66
83
  directoryExists(path) {
67
84
  if (!directoryExistsCache.has(path)) {
68
- directoryExistsCache.set(path, ts.sys.directoryExists(path));
85
+ directoryExistsCache.set(path, workspaceSys.directoryExists(path));
69
86
  }
70
87
  return directoryExistsCache.get(path);
71
88
  },
72
- };
73
- // don't cache fs result if client did not supports file watcher
74
- const sys = ((_a = capabilities.workspace) === null || _a === void 0 ? void 0 : _a.didChangeWatchedFiles)
75
- ? new Proxy(workspaceSys, {
76
- get(target, prop) {
77
- if (prop in sysWithCache) {
78
- return sysWithCache[prop];
79
- }
89
+ }, {
90
+ get(target, prop) {
91
+ if (prop in target) {
80
92
  return target[prop];
81
- },
82
- })
83
- : workspaceSys;
84
- caches.add(fileExistsCache);
85
- caches.add(directoryExistsCache);
86
- return sys;
87
- },
88
- onDidChangeWatchedFiles: cb => {
89
- onDidChangeWatchedFilesCb.add(cb);
90
- return () => onDidChangeWatchedFilesCb.delete(cb);
91
- },
92
- };
93
+ }
94
+ return workspaceSys[prop];
95
+ },
96
+ })
97
+ : workspaceSys;
98
+ caches.add(fileExistsCache);
99
+ caches.add(directoryExistsCache);
100
+ return sys;
101
+ }
93
102
  }
94
103
  exports.createNodeFileSystemHost = createNodeFileSystemHost;
95
104
  //# sourceMappingURL=nodeFileSystemHost.js.map
@@ -2,12 +2,12 @@ import * as embeddedLS from '@volar/language-service';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
3
  import * as vscode from 'vscode-languageserver';
4
4
  import { URI } from 'vscode-uri';
5
- import { FileSystem, FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, ServerInitializationOptions } from '../types';
5
+ import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, ServerInitializationOptions } from '../types';
6
6
  import { createSnapshots } from './snapshots';
7
7
  import { ConfigurationHost } from '@volar/vue-language-service';
8
8
  export interface Project extends ReturnType<typeof createProject> {
9
9
  }
10
- export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, sys: FileSystem, ts: typeof import('typescript/lib/tsserverlibrary'), options: ServerInitializationOptions, rootUri: URI, rootPath: string, tsConfig: string | ts.CompilerOptions, tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, configHost: ConfigurationHost | undefined, documentRegistry: ts.DocumentRegistry | undefined): Promise<{
10
+ export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, ts: typeof import('typescript/lib/tsserverlibrary'), options: ServerInitializationOptions, rootUri: URI, tsConfig: string | ts.CompilerOptions, tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, configHost: ConfigurationHost | undefined, documentRegistry: ts.DocumentRegistry | undefined): Promise<{
11
11
  getLanguageService: () => {
12
12
  doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
13
13
  findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
@@ -18,12 +18,13 @@ const config_1 = require("./config");
18
18
  const requests_1 = require("../requests");
19
19
  const upath = require("upath");
20
20
  const path_1 = require("path");
21
- function createProject(runtimeEnv, plugins, fsHost, sys, ts, options, rootUri, rootPath, tsConfig, tsLocalized, documents, connection, configHost, documentRegistry) {
21
+ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConfig, tsLocalized, documents, connection, configHost, documentRegistry) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
+ const sys = fsHost.getWorkspaceFileSystem(rootUri);
23
24
  let typeRootVersion = 0;
24
25
  let projectVersion = 0;
25
26
  let vueLs;
26
- let parsedCommandLine = createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins);
27
+ let parsedCommandLine = createParsedCommandLine(ts, sys, shared.getPathOfUri(rootUri.toString()), tsConfig, plugins);
27
28
  const scripts = shared.createUriMap();
28
29
  const languageServiceHost = createLanguageServiceHost();
29
30
  const disposeWatchEvent = fsHost.onDidChangeWatchedFiles(params => {
@@ -103,7 +104,7 @@ function createProject(runtimeEnv, plugins, fsHost, sys, ts, options, rootUri, r
103
104
  const creates = changes.filter(change => change.type === vscode.FileChangeType.Created);
104
105
  const deletes = changes.filter(change => change.type === vscode.FileChangeType.Deleted);
105
106
  if (creates.length || deletes.length) {
106
- parsedCommandLine = createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins);
107
+ parsedCommandLine = createParsedCommandLine(ts, sys, shared.getPathOfUri(rootUri.toString()), tsConfig, plugins);
107
108
  typeRootVersion++;
108
109
  }
109
110
  });
@@ -121,7 +122,7 @@ function createProject(runtimeEnv, plugins, fsHost, sys, ts, options, rootUri, r
121
122
  readDirectory: sys.readDirectory,
122
123
  realpath: sys.realpath,
123
124
  fileExists: sys.fileExists,
124
- getCurrentDirectory: () => rootPath,
125
+ getCurrentDirectory: () => shared.getPathOfUri(rootUri.toString()),
125
126
  getProjectReferences: () => parsedCommandLine.projectReferences,
126
127
  // custom
127
128
  getDefaultLibFileName: options => {
@@ -197,23 +198,21 @@ function createProject(runtimeEnv, plugins, fsHost, sys, ts, options, rootUri, r
197
198
  }
198
199
  exports.createProject = createProject;
199
200
  function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
200
- const extraExts = plugins.map(plugin => plugin.extensions).flat();
201
+ const extraFileExtensions = plugins.map(plugin => plugin.extensions)
202
+ .flat()
203
+ .map(ext => ({
204
+ extension: ext.substring(1),
205
+ isMixedContent: true,
206
+ scriptKind: ts.ScriptKind.Deferred,
207
+ }));
201
208
  try {
202
- const parseConfigHost = {
203
- useCaseSensitiveFileNames: sys.useCaseSensitiveFileNames,
204
- readDirectory: (path, extensions, exclude, include, depth) => {
205
- return sys.readDirectory(path, [...extensions, ...extraExts], exclude, include, depth);
206
- },
207
- fileExists: sys.fileExists,
208
- readFile: sys.readFile,
209
- };
210
209
  let content;
211
210
  if (typeof tsConfig === 'string') {
212
- const config = ts.readJsonConfigFile(tsConfig, parseConfigHost.readFile);
213
- content = ts.parseJsonSourceFileConfigFileContent(config, parseConfigHost, path_1.posix.dirname(tsConfig), {}, path_1.posix.basename(tsConfig));
211
+ const config = ts.readJsonConfigFile(tsConfig, sys.readFile);
212
+ content = ts.parseJsonSourceFileConfigFileContent(config, sys, path_1.posix.dirname(tsConfig), {}, tsConfig, undefined, extraFileExtensions);
214
213
  }
215
214
  else {
216
- content = ts.parseJsonConfigFileContent({}, parseConfigHost, rootPath, tsConfig, 'jsconfig.json');
215
+ content = ts.parseJsonConfigFileContent({}, sys, rootPath, tsConfig, path_1.posix.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions);
217
216
  }
218
217
  // fix https://github.com/johnsoncodehk/volar/issues/1786
219
218
  // https://github.com/microsoft/TypeScript/issues/30457
@@ -9,14 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createWebFileSystemHost = void 0;
12
- const vscode = require("vscode-languageserver");
12
+ const shared = require("@volar/shared");
13
+ const path_1 = require("path");
13
14
  const vscode_html_languageservice_1 = require("vscode-html-languageservice");
15
+ const vscode = require("vscode-languageserver");
14
16
  const vscode_uri_1 = require("vscode-uri");
15
- const path_1 = require("path");
16
17
  const requests_1 = require("../requests");
17
18
  const utilities_1 = require("./ts/utilities");
18
19
  let currentCwd = '/';
19
20
  function createWebFileSystemHost() {
21
+ const instances = shared.createUriMap();
20
22
  const onDidChangeWatchedFilesCb = new Set();
21
23
  const root = {
22
24
  dirs: new Map(),
@@ -62,148 +64,156 @@ function createWebFileSystemHost() {
62
64
  root.searched = false;
63
65
  },
64
66
  getWorkspaceFileSystem(rootUri) {
65
- return {
66
- newLine: '\n',
67
- useCaseSensitiveFileNames: false,
68
- getCurrentDirectory: () => rootUri.fsPath,
69
- fileExists,
70
- readFile,
71
- readDirectory,
72
- getDirectories,
73
- resolvePath,
74
- realpath: path => path, // TODO: cannot implement with vscode
75
- };
76
- function resolvePath(fsPath) {
77
- if (currentCwd !== rootUri.fsPath) {
78
- process.chdir(rootUri.fsPath);
79
- currentCwd = rootUri.fsPath;
80
- }
81
- return path_1.posix.resolve(fsPath);
67
+ let sys = instances.uriGet(rootUri.toString());
68
+ if (!sys) {
69
+ sys = createWorkspaceFileSystem(rootUri);
70
+ instances.uriSet(rootUri.toString(), sys);
82
71
  }
83
- function fileExists(fsPath) {
84
- fsPath = resolvePath(fsPath);
85
- const dir = getDir(path_1.posix.dirname(fsPath));
86
- const name = path_1.posix.basename(fsPath);
87
- if (dir.fileTypes.has(name)) {
88
- return dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.File || dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.SymbolicLink;
89
- }
90
- dir.fileTypes.set(name, undefined);
91
- if (connection) {
92
- addPending(statAsync(connection, fsPath, dir));
93
- }
94
- else {
95
- onReadys.push((connection) => addPending(statAsync(connection, fsPath, dir)));
96
- }
97
- return false;
72
+ return sys;
73
+ },
74
+ onDidChangeWatchedFiles: cb => {
75
+ onDidChangeWatchedFilesCb.add(cb);
76
+ return () => onDidChangeWatchedFilesCb.delete(cb);
77
+ },
78
+ };
79
+ function createWorkspaceFileSystem(rootUri) {
80
+ return {
81
+ newLine: '\n',
82
+ useCaseSensitiveFileNames: false,
83
+ getCurrentDirectory: () => rootUri.fsPath,
84
+ fileExists,
85
+ readFile,
86
+ readDirectory,
87
+ getDirectories,
88
+ resolvePath,
89
+ realpath: path => path, // TODO: cannot implement with vscode
90
+ };
91
+ function resolvePath(fsPath) {
92
+ if (currentCwd !== rootUri.fsPath) {
93
+ process.chdir(rootUri.fsPath);
94
+ currentCwd = rootUri.fsPath;
98
95
  }
99
- function readFile(fsPath) {
100
- fsPath = resolvePath(fsPath);
101
- const dir = getDir(path_1.posix.dirname(fsPath));
102
- const name = path_1.posix.basename(fsPath);
103
- if (dir.fileTexts.has(name)) {
104
- return dir.fileTexts.get(name);
105
- }
106
- dir.fileTexts.set(name, '');
107
- if (connection) {
108
- addPending(readFileAsync(connection, fsPath, dir));
109
- }
110
- else {
111
- onReadys.push((connection) => addPending(readFileAsync(connection, fsPath, dir)));
112
- }
113
- return '';
96
+ return path_1.posix.resolve(fsPath);
97
+ }
98
+ function fileExists(fsPath) {
99
+ fsPath = resolvePath(fsPath);
100
+ const dir = getDir(path_1.posix.dirname(fsPath));
101
+ const name = path_1.posix.basename(fsPath);
102
+ if (dir.fileTypes.has(name)) {
103
+ return dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.File || dir.fileTypes.get(name) === vscode_html_languageservice_1.FileType.SymbolicLink;
114
104
  }
115
- function readDirectory(fsPath, extensions, exclude, include, depth) {
116
- fsPath = resolvePath(fsPath);
117
- return (0, utilities_1.matchFiles)(fsPath, extensions, exclude, include, false, rootUri.fsPath, depth, dirPath => {
118
- dirPath = resolvePath(dirPath);
119
- const dir = getDir(dirPath);
120
- const files = [...dir.fileTypes];
121
- if (!dir.searched) {
122
- dir.searched = true;
123
- if (connection) {
124
- addPending(readDirectoryAsync(connection, dirPath, dir));
125
- }
126
- else {
127
- onReadys.push((connection) => addPending(readDirectoryAsync(connection, dirPath, dir)));
128
- }
129
- }
130
- return {
131
- files: files.filter(file => file[1] === vscode_html_languageservice_1.FileType.File).map(file => file[0]),
132
- directories: files.filter(file => file[1] === vscode_html_languageservice_1.FileType.Directory).map(file => file[0]),
133
- };
134
- }, path => path);
105
+ dir.fileTypes.set(name, undefined);
106
+ if (connection) {
107
+ addPending(statAsync(connection, fsPath, dir));
135
108
  }
136
- // for import path completion
137
- function getDirectories(fsPath) {
138
- fsPath = resolvePath(fsPath);
139
- const dir = getDir(fsPath);
109
+ else {
110
+ onReadys.push((connection) => addPending(statAsync(connection, fsPath, dir)));
111
+ }
112
+ return false;
113
+ }
114
+ function readFile(fsPath) {
115
+ fsPath = resolvePath(fsPath);
116
+ const dir = getDir(path_1.posix.dirname(fsPath));
117
+ const name = path_1.posix.basename(fsPath);
118
+ if (dir.fileTexts.has(name)) {
119
+ return dir.fileTexts.get(name);
120
+ }
121
+ dir.fileTexts.set(name, '');
122
+ if (connection) {
123
+ addPending(readFileAsync(connection, fsPath, dir));
124
+ }
125
+ else {
126
+ onReadys.push((connection) => addPending(readFileAsync(connection, fsPath, dir)));
127
+ }
128
+ return '';
129
+ }
130
+ function readDirectory(fsPath, extensions, exclude, include, depth) {
131
+ fsPath = resolvePath(fsPath);
132
+ return (0, utilities_1.matchFiles)(fsPath, extensions, exclude, include, false, rootUri.fsPath, depth, dirPath => {
133
+ dirPath = resolvePath(dirPath);
134
+ const dir = getDir(dirPath);
140
135
  const files = [...dir.fileTypes];
141
136
  if (!dir.searched) {
142
137
  dir.searched = true;
143
138
  if (connection) {
144
- addPending(readDirectoryAsync(connection, fsPath, dir));
139
+ addPending(readDirectoryAsync(connection, dirPath, dir));
145
140
  }
146
141
  else {
147
- onReadys.push((connection) => addPending(readDirectoryAsync(connection, fsPath, dir)));
142
+ onReadys.push((connection) => addPending(readDirectoryAsync(connection, dirPath, dir)));
148
143
  }
149
144
  }
150
- return files.filter(file => file[1] === vscode_html_languageservice_1.FileType.Directory).map(file => file[0]);
151
- }
152
- function getFsPathUri(fsPath) {
153
- return vscode_uri_1.URI.file(fsPath).with({
154
- scheme: rootUri.scheme,
155
- authority: rootUri.authority,
156
- });
145
+ return {
146
+ files: files.filter(file => file[1] === vscode_html_languageservice_1.FileType.File).map(file => file[0]),
147
+ directories: files.filter(file => file[1] === vscode_html_languageservice_1.FileType.Directory).map(file => file[0]),
148
+ };
149
+ }, path => path);
150
+ }
151
+ // for import path completion
152
+ function getDirectories(fsPath) {
153
+ fsPath = resolvePath(fsPath);
154
+ const dir = getDir(fsPath);
155
+ const files = [...dir.fileTypes];
156
+ if (!dir.searched) {
157
+ dir.searched = true;
158
+ if (connection) {
159
+ addPending(readDirectoryAsync(connection, fsPath, dir));
160
+ }
161
+ else {
162
+ onReadys.push((connection) => addPending(readDirectoryAsync(connection, fsPath, dir)));
163
+ }
157
164
  }
158
- function statAsync(connection, fsPath, dir) {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- const uri = getFsPathUri(fsPath);
161
- const result = yield connection.sendRequest(requests_1.FsStatRequest.type, uri.toString());
162
- 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) {
163
- const name = path_1.posix.basename(fsPath);
164
- dir.fileTypes.set(name, result.type);
165
+ return files.filter(file => file[1] === vscode_html_languageservice_1.FileType.Directory).map(file => file[0]);
166
+ }
167
+ function getFsPathUri(fsPath) {
168
+ return vscode_uri_1.URI.file(fsPath).with({
169
+ scheme: rootUri.scheme,
170
+ authority: rootUri.authority,
171
+ });
172
+ }
173
+ function statAsync(connection, fsPath, dir) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ const uri = getFsPathUri(fsPath);
176
+ const result = yield connection.sendRequest(requests_1.FsStatRequest.type, uri.toString());
177
+ 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
+ dir.fileTypes.set(name, result.type);
180
+ changes.push({
181
+ uri: uri.toString(),
182
+ type: vscode.FileChangeType.Created,
183
+ });
184
+ }
185
+ });
186
+ }
187
+ function readFileAsync(connection, fsPath, dir) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const uri = getFsPathUri(fsPath);
190
+ const text = yield connection.sendRequest(requests_1.FsReadFileRequest.type, uri.toString());
191
+ if (text) {
192
+ const name = path_1.posix.basename(fsPath);
193
+ dir.fileTexts.set(name, text);
194
+ changes.push({
195
+ uri: uri.toString(),
196
+ type: vscode.FileChangeType.Changed,
197
+ });
198
+ }
199
+ });
200
+ }
201
+ function readDirectoryAsync(connection, fsPath, dir) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ const uri = getFsPathUri(fsPath);
204
+ const result = yield connection.sendRequest(requests_1.FsReadDirectoryRequest.type, uri.toString());
205
+ for (const [name, fileType] of result) {
206
+ if (dir.fileTypes.get(name) !== fileType && (fileType === vscode_html_languageservice_1.FileType.File || fileType === vscode_html_languageservice_1.FileType.SymbolicLink)) {
165
207
  changes.push({
166
- uri: uri.toString(),
208
+ uri: getFsPathUri(path_1.posix.join(fsPath, name)).toString(),
167
209
  type: vscode.FileChangeType.Created,
168
210
  });
169
211
  }
170
- });
171
- }
172
- function readFileAsync(connection, fsPath, dir) {
173
- return __awaiter(this, void 0, void 0, function* () {
174
- const uri = getFsPathUri(fsPath);
175
- const text = yield connection.sendRequest(requests_1.FsReadFileRequest.type, uri.toString());
176
- if (text) {
177
- const name = path_1.posix.basename(fsPath);
178
- dir.fileTexts.set(name, text);
179
- changes.push({
180
- uri: uri.toString(),
181
- type: vscode.FileChangeType.Changed,
182
- });
183
- }
184
- });
185
- }
186
- function readDirectoryAsync(connection, fsPath, dir) {
187
- return __awaiter(this, void 0, void 0, function* () {
188
- const uri = getFsPathUri(fsPath);
189
- const result = yield connection.sendRequest(requests_1.FsReadDirectoryRequest.type, uri.toString());
190
- for (const [name, fileType] of result) {
191
- if (dir.fileTypes.get(name) !== fileType && (fileType === vscode_html_languageservice_1.FileType.File || fileType === vscode_html_languageservice_1.FileType.SymbolicLink)) {
192
- changes.push({
193
- uri: getFsPathUri(path_1.posix.join(fsPath, name)).toString(),
194
- type: vscode.FileChangeType.Created,
195
- });
196
- }
197
- dir.fileTypes.set(name, fileType);
198
- }
199
- });
200
- }
201
- },
202
- onDidChangeWatchedFiles: cb => {
203
- onDidChangeWatchedFilesCb.add(cb);
204
- return () => onDidChangeWatchedFilesCb.delete(cb);
205
- },
206
- };
212
+ dir.fileTypes.set(name, fileType);
213
+ }
214
+ });
215
+ }
216
+ }
207
217
  function addPending(p) {
208
218
  return __awaiter(this, void 0, void 0, function* () {
209
219
  pendings.add(p);
@@ -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, sys, ts, options, rootUri, rootUri.fsPath, inferOptions, tsLocalized, documents, connection, configHost, documentRegistry);
91
+ return (0, project_1.createProject)(runtimeEnv, plugins, fsHost, ts, options, rootUri, inferOptions, tsLocalized, documents, connection, configHost, documentRegistry);
92
92
  }))();
93
93
  }
94
94
  return inferredProject;
@@ -198,7 +198,7 @@ function createWorkspaceProjects(runtimeEnv, plugins, fsHost, rootUri, ts, tsLoc
198
198
  function getProjectByCreate(tsConfig) {
199
199
  let project = projects.pathGet(rootUri, tsConfig);
200
200
  if (!project) {
201
- project = (0, project_1.createProject)(runtimeEnv, plugins, fsHost, sys, ts, options, rootUri, path.dirname(tsConfig), tsConfig, tsLocalized, documents, connection, configHost, documentRegistry);
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
202
  projects.pathSet(rootUri, tsConfig, project);
203
203
  }
204
204
  return project;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,9 +17,9 @@
17
17
  "directory": "packages/language-server"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-core": "1.0.0-beta.0",
21
- "@volar/language-service": "1.0.0-beta.0",
22
- "@volar/shared": "1.0.0-beta.0",
20
+ "@volar/language-core": "1.0.0-beta.1",
21
+ "@volar/language-service": "1.0.0-beta.1",
22
+ "@volar/shared": "1.0.0-beta.1",
23
23
  "request-light": "^0.5.8",
24
24
  "upath": "^2.0.1",
25
25
  "vscode-html-languageservice": "^5.0.1",
@@ -28,5 +28,5 @@
28
28
  "vscode-languageserver-textdocument": "^1.0.7",
29
29
  "vscode-uri": "^3.0.3"
30
30
  },
31
- "gitHead": "e93a2cf6e614f6c8fa9b8a61e314c123cbe9a95a"
31
+ "gitHead": "3421929c584e8fafd772b2386c12ffe9b48355f2"
32
32
  }