@volar/language-server 1.4.0-alpha.0 → 1.4.0-alpha.10

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.
@@ -1,12 +1,4 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
1
+ "use strict";
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
3
  exports.createProject = void 0;
12
4
  const embeddedLS = require("@volar/language-service");
@@ -16,242 +8,228 @@ const vscode_uri_1 = require("vscode-uri");
16
8
  const types_1 = require("../types");
17
9
  const serverConfig_1 = require("./utils/serverConfig");
18
10
  const uriMap_1 = require("./utils/uriMap");
19
- function createProject(context) {
20
- var _a;
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const uriToFileName = context.workspace.workspaces.server.runtimeEnv.uriToFileName;
23
- const fileNameToUri = context.workspace.workspaces.server.runtimeEnv.fileNameToUri;
24
- const sys = context.workspace.workspaces.initOptions.serverMode === types_1.ServerMode.Syntactic || !context.workspace.workspaces.fileSystemHost
25
- ? {
26
- newLine: '\n',
27
- useCaseSensitiveFileNames: false,
28
- fileExists: () => false,
29
- readFile: () => undefined,
30
- readDirectory: () => [],
31
- getCurrentDirectory: () => '',
32
- realpath: () => '',
33
- resolvePath: () => '',
11
+ async function createProject(context) {
12
+ const uriToFileName = context.workspace.workspaces.server.runtimeEnv.uriToFileName;
13
+ const fileNameToUri = context.workspace.workspaces.server.runtimeEnv.fileNameToUri;
14
+ const sys = context.workspace.workspaces.initOptions.serverMode === types_1.ServerMode.Syntactic || !context.workspace.workspaces.fileSystemHost
15
+ ? {
16
+ newLine: '\n',
17
+ useCaseSensitiveFileNames: false,
18
+ fileExists: () => false,
19
+ readFile: () => undefined,
20
+ readDirectory: () => [],
21
+ getCurrentDirectory: () => '',
22
+ realpath: () => '',
23
+ resolvePath: () => '',
24
+ }
25
+ : context.workspace.workspaces.fileSystemHost.getWorkspaceFileSystem(context.rootUri);
26
+ let typeRootVersion = 0;
27
+ let projectVersion = 0;
28
+ let projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
29
+ let languageService;
30
+ let parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
31
+ const scripts = (0, uriMap_1.createUriMap)(fileNameToUri);
32
+ const languageServiceHost = createLanguageServiceHost();
33
+ const disposeWatchEvent = context.workspace.workspaces.fileSystemHost?.onDidChangeWatchedFiles(params => {
34
+ onWorkspaceFilesChanged(params.changes);
35
+ });
36
+ const disposeDocChange = context.workspace.workspaces.documents.onDidChangeContent(() => {
37
+ projectVersion++;
38
+ projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
39
+ });
40
+ return {
41
+ tsConfig: context.tsConfig,
42
+ scripts,
43
+ languageServiceHost,
44
+ getLanguageService,
45
+ getLanguageServiceDontCreate: () => languageService,
46
+ getParsedCommandLine: () => parsedCommandLine,
47
+ tryAddFile: (fileName) => {
48
+ if (!parsedCommandLine.fileNames.includes(fileName)) {
49
+ parsedCommandLine.fileNames.push(fileName);
50
+ projectVersion++;
51
+ projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
34
52
  }
35
- : context.workspace.workspaces.fileSystemHost.getWorkspaceFileSystem(context.rootUri);
36
- let typeRootVersion = 0;
37
- let projectVersion = 0;
38
- let projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
39
- let languageService;
40
- let parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
41
- const scripts = (0, uriMap_1.createUriMap)(fileNameToUri);
42
- const languageServiceHost = createLanguageServiceHost();
43
- const disposeWatchEvent = (_a = context.workspace.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.onDidChangeWatchedFiles(params => {
44
- onWorkspaceFilesChanged(params.changes);
45
- });
46
- const disposeDocChange = context.workspace.workspaces.documents.onDidChangeContent(() => {
47
- projectVersion++;
48
- projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
49
- });
50
- return {
51
- tsConfig: context.tsConfig,
52
- scripts,
53
- languageServiceHost,
54
- getLanguageService,
55
- getLanguageServiceDontCreate: () => languageService,
56
- getParsedCommandLine: () => parsedCommandLine,
57
- tryAddFile: (fileName) => {
58
- if (!parsedCommandLine.fileNames.includes(fileName)) {
59
- parsedCommandLine.fileNames.push(fileName);
60
- projectVersion++;
61
- projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
62
- }
63
- },
64
- dispose,
65
- };
66
- function getLanguageService() {
67
- var _a;
68
- if (!languageService) {
69
- let config = (_a = (context.workspace.rootUri.scheme === 'file' ? (0, serverConfig_1.loadConfig)(context.workspace.rootUri.path, context.workspace.workspaces.initOptions.configFilePath) : {})) !== null && _a !== void 0 ? _a : {};
70
- const options = {
71
- uriToFileName,
72
- fileNameToUri,
73
- rootUri: context.rootUri,
74
- host: languageServiceHost,
75
- get config() {
76
- return config;
77
- },
78
- locale: context.workspace.workspaces.initParams.locale,
79
- configurationHost: context.workspace.workspaces.configurationHost,
80
- fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
81
- documentContext: getDocumentContext(fileNameToUri, uriToFileName, context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
82
- schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {
83
- var _b;
84
- const protocol = uri.substring(0, uri.indexOf(':'));
85
- const builtInHandler = context.workspace.workspaces.server.runtimeEnv.schemaRequestHandlers[protocol];
86
- if (builtInHandler) {
87
- return (_b = yield builtInHandler(uri)) !== null && _b !== void 0 ? _b : '';
88
- }
89
- return '';
90
- }),
91
- };
92
- const lsCtx = {
93
- project: context,
94
- options,
95
- sys,
96
- host: languageServiceHost,
97
- };
98
- for (const plugin of context.workspace.workspaces.plugins) {
99
- if (plugin.resolveConfig) {
100
- config = plugin.resolveConfig(config, { typescript: lsCtx.project.workspace.workspaces.ts }, lsCtx);
53
+ },
54
+ dispose,
55
+ };
56
+ function getLanguageService() {
57
+ if (!languageService) {
58
+ let config = (context.workspace.rootUri.scheme === 'file' ? (0, serverConfig_1.loadConfig)(context.workspace.rootUri.path, context.workspace.workspaces.initOptions.configFilePath) : {}) ?? {};
59
+ const options = {
60
+ modules: { typescript: context.workspace.workspaces.ts },
61
+ uriToFileName,
62
+ fileNameToUri,
63
+ locale: context.workspace.workspaces.initParams.locale,
64
+ rootUri: context.rootUri,
65
+ capabilities: context.workspace.workspaces.initParams.capabilities,
66
+ host: languageServiceHost,
67
+ get config() {
68
+ return config;
69
+ },
70
+ configurationHost: context.workspace.workspaces.configurationHost,
71
+ fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
72
+ fileSystemHost: context.workspace.workspaces.fileSystemHost,
73
+ documentContext: getDocumentContext(fileNameToUri, uriToFileName, context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
74
+ schemaRequestService: async (uri) => {
75
+ const protocol = uri.substring(0, uri.indexOf(':'));
76
+ const builtInHandler = context.workspace.workspaces.server.runtimeEnv.schemaRequestHandlers[protocol];
77
+ if (builtInHandler) {
78
+ return await builtInHandler(uri) ?? '';
101
79
  }
80
+ return '';
81
+ },
82
+ };
83
+ const lsCtx = {
84
+ project: context,
85
+ options,
86
+ sys,
87
+ host: languageServiceHost,
88
+ };
89
+ for (const plugin of context.workspace.workspaces.plugins) {
90
+ if (plugin.resolveConfig) {
91
+ config = plugin.resolveConfig(config, lsCtx);
102
92
  }
103
- languageService = embeddedLS.createLanguageService(options, context.documentRegistry);
104
93
  }
105
- return languageService;
94
+ languageService = embeddedLS.createLanguageService(options, context.documentRegistry);
106
95
  }
107
- function onWorkspaceFilesChanged(changes) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- const _projectVersion = projectVersion;
110
- for (const change of changes) {
111
- const script = scripts.uriGet(change.uri);
112
- if (script && (change.type === vscode.FileChangeType.Changed || change.type === vscode.FileChangeType.Created)) {
113
- if (script.version >= 0) {
114
- script.version = -1;
115
- }
116
- else {
117
- script.version--;
118
- }
119
- }
120
- else if (script && change.type === vscode.FileChangeType.Deleted) {
121
- scripts.uriDelete(change.uri);
122
- }
123
- if (script
124
- || change.uri.endsWith('.d.ts')
125
- || change.uri.endsWith('/package.json')) {
126
- projectVersion++;
127
- }
128
- }
129
- const creates = changes.filter(change => change.type === vscode.FileChangeType.Created);
130
- const deletes = changes.filter(change => change.type === vscode.FileChangeType.Deleted);
131
- if (creates.length || deletes.length) {
132
- parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
133
- projectVersion++;
134
- typeRootVersion++;
96
+ return languageService;
97
+ }
98
+ async function onWorkspaceFilesChanged(changes) {
99
+ const _projectVersion = projectVersion;
100
+ for (const change of changes) {
101
+ const script = scripts.uriGet(change.uri);
102
+ if (script && (change.type === vscode.FileChangeType.Changed || change.type === vscode.FileChangeType.Created)) {
103
+ if (script.version >= 0) {
104
+ script.version = -1;
135
105
  }
136
- if (_projectVersion !== projectVersion) {
137
- projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
106
+ else {
107
+ script.version--;
138
108
  }
139
- });
109
+ }
110
+ else if (script && change.type === vscode.FileChangeType.Deleted) {
111
+ scripts.uriDelete(change.uri);
112
+ }
113
+ if (script
114
+ || change.uri.endsWith('.d.ts')
115
+ || change.uri.endsWith('/package.json')) {
116
+ projectVersion++;
117
+ }
140
118
  }
141
- function createLanguageServiceHost() {
142
- const token = {
143
- isCancellationRequested() {
144
- return context.workspace.workspaces.cancelTokenHost.getMtime() !== projectVersionUpdateTime;
145
- },
146
- throwIfCancellationRequested() { },
147
- };
148
- let host = {
149
- // ts
150
- getNewLine: () => sys.newLine,
151
- useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
152
- readFile: sys.readFile,
153
- writeFile: sys.writeFile,
154
- directoryExists: sys.directoryExists,
155
- getDirectories: sys.getDirectories,
156
- readDirectory: sys.readDirectory,
157
- realpath: sys.realpath,
158
- fileExists: sys.fileExists,
159
- getCurrentDirectory: () => uriToFileName(context.rootUri.toString()),
160
- getProjectReferences: () => parsedCommandLine.projectReferences,
161
- getCancellationToken: () => token,
162
- // custom
163
- getDefaultLibFileName: options => {
164
- if (context.workspace.workspaces.initOptions.typescript && context.workspace.workspaces.ts) {
165
- try {
166
- return context.workspace.workspaces.ts.getDefaultLibFilePath(options);
167
- }
168
- catch (_a) {
169
- // web
170
- const tsdk = context.workspace.workspaces.initOptions.typescript.tsdk;
171
- return tsdk + '/' + context.workspace.workspaces.ts.getDefaultLibFileName(options);
172
- }
119
+ const creates = changes.filter(change => change.type === vscode.FileChangeType.Created);
120
+ const deletes = changes.filter(change => change.type === vscode.FileChangeType.Deleted);
121
+ if (creates.length || deletes.length) {
122
+ parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
123
+ projectVersion++;
124
+ typeRootVersion++;
125
+ }
126
+ if (_projectVersion !== projectVersion) {
127
+ projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
128
+ }
129
+ }
130
+ function createLanguageServiceHost() {
131
+ const token = {
132
+ isCancellationRequested() {
133
+ return context.workspace.workspaces.cancelTokenHost.getMtime() !== projectVersionUpdateTime;
134
+ },
135
+ throwIfCancellationRequested() { },
136
+ };
137
+ let host = {
138
+ // ts
139
+ getNewLine: () => sys.newLine,
140
+ useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
141
+ readFile: sys.readFile,
142
+ writeFile: sys.writeFile,
143
+ directoryExists: sys.directoryExists,
144
+ getDirectories: sys.getDirectories,
145
+ readDirectory: sys.readDirectory,
146
+ realpath: sys.realpath,
147
+ fileExists: sys.fileExists,
148
+ getCurrentDirectory: () => uriToFileName(context.rootUri.toString()),
149
+ getProjectReferences: () => parsedCommandLine.projectReferences,
150
+ getCancellationToken: () => token,
151
+ // custom
152
+ getDefaultLibFileName: options => {
153
+ if (context.workspace.workspaces.initOptions.typescript && context.workspace.workspaces.ts) {
154
+ try {
155
+ return context.workspace.workspaces.ts.getDefaultLibFilePath(options);
173
156
  }
174
- return '';
175
- },
176
- getProjectVersion: () => projectVersion.toString(),
177
- getTypeRootsVersion: () => typeRootVersion,
178
- getScriptFileNames: () => parsedCommandLine.fileNames,
179
- getCompilationSettings: () => parsedCommandLine.options,
180
- getScriptVersion,
181
- getScriptSnapshot,
182
- getTypeScriptModule: context.workspace.workspaces.ts ? () => {
183
- return context.workspace.workspaces.ts;
184
- } : undefined,
185
- getScriptLanguageId: (fileName) => {
186
- var _a;
187
- return (_a = context.workspace.workspaces.documents.data.pathGet(fileName)) === null || _a === void 0 ? void 0 : _a.languageId;
188
- },
189
- };
190
- if (context.workspace.workspaces.initOptions.noProjectReferences) {
191
- host.getProjectReferences = undefined;
192
- host.getCompilationSettings = () => (Object.assign(Object.assign({}, parsedCommandLine.options), { rootDir: undefined, composite: false }));
157
+ catch {
158
+ // web
159
+ const tsdk = context.workspace.workspaces.initOptions.typescript.tsdk;
160
+ return tsdk + '/' + context.workspace.workspaces.ts.getDefaultLibFileName(options);
161
+ }
162
+ }
163
+ return '';
164
+ },
165
+ getProjectVersion: () => projectVersion.toString(),
166
+ getTypeRootsVersion: () => typeRootVersion,
167
+ getScriptFileNames: () => parsedCommandLine.fileNames,
168
+ getCompilationSettings: () => parsedCommandLine.options,
169
+ getScriptVersion,
170
+ getScriptSnapshot,
171
+ getScriptLanguageId: (fileName) => {
172
+ return context.workspace.workspaces.documents.data.pathGet(fileName)?.languageId;
173
+ },
174
+ };
175
+ if (context.workspace.workspaces.tsLocalized) {
176
+ host.getLocalizedDiagnosticMessages = () => context.workspace.workspaces.tsLocalized;
177
+ }
178
+ return host;
179
+ function getScriptVersion(fileName) {
180
+ const doc = context.workspace.workspaces.documents.data.pathGet(fileName);
181
+ if (doc) {
182
+ return doc.version.toString();
193
183
  }
194
- if (context.workspace.workspaces.tsLocalized) {
195
- host.getLocalizedDiagnosticMessages = () => context.workspace.workspaces.tsLocalized;
184
+ return scripts.pathGet(fileName)?.version.toString() ?? '';
185
+ }
186
+ function getScriptSnapshot(fileName) {
187
+ const doc = context.workspace.workspaces.documents.data.pathGet(fileName);
188
+ if (doc) {
189
+ return doc.getSnapshot();
196
190
  }
197
- return host;
198
- function getScriptVersion(fileName) {
199
- var _a, _b;
200
- const doc = context.workspace.workspaces.documents.data.pathGet(fileName);
201
- if (doc) {
202
- return doc.version.toString();
203
- }
204
- return (_b = (_a = scripts.pathGet(fileName)) === null || _a === void 0 ? void 0 : _a.version.toString()) !== null && _b !== void 0 ? _b : '';
191
+ const script = scripts.pathGet(fileName);
192
+ if (script && script.snapshotVersion === script.version) {
193
+ return script.snapshot;
205
194
  }
206
- function getScriptSnapshot(fileName) {
207
- var _a;
208
- const doc = context.workspace.workspaces.documents.data.pathGet(fileName);
209
- if (doc) {
210
- return doc.getSnapshot();
211
- }
212
- const script = scripts.pathGet(fileName);
213
- if (script && script.snapshotVersion === script.version) {
214
- return script.snapshot;
195
+ if (context.workspace.workspaces.ts && sys.fileExists(fileName)) {
196
+ if (context.workspace.workspaces.initOptions.maxFileSize) {
197
+ const fileSize = sys.getFileSize?.(fileName);
198
+ if (fileSize !== undefined && fileSize > context.workspace.workspaces.initOptions.maxFileSize) {
199
+ console.warn(`IGNORING "${fileName}" because it is too large (${fileSize}bytes > ${context.workspace.workspaces.initOptions.maxFileSize}bytes)`);
200
+ return context.workspace.workspaces.ts.ScriptSnapshot.fromString('');
201
+ }
215
202
  }
216
- if (context.workspace.workspaces.ts && sys.fileExists(fileName)) {
217
- if (context.workspace.workspaces.initOptions.maxFileSize) {
218
- const fileSize = (_a = sys.getFileSize) === null || _a === void 0 ? void 0 : _a.call(sys, fileName);
219
- if (fileSize !== undefined && fileSize > context.workspace.workspaces.initOptions.maxFileSize) {
220
- console.warn(`IGNORING "${fileName}" because it is too large (${fileSize}bytes > ${context.workspace.workspaces.initOptions.maxFileSize}bytes)`);
221
- return context.workspace.workspaces.ts.ScriptSnapshot.fromString('');
222
- }
203
+ const text = sys.readFile(fileName, 'utf8');
204
+ if (text !== undefined) {
205
+ const snapshot = context.workspace.workspaces.ts.ScriptSnapshot.fromString(text);
206
+ if (script) {
207
+ script.snapshot = snapshot;
208
+ script.snapshotVersion = script.version;
223
209
  }
224
- const text = sys.readFile(fileName, 'utf8');
225
- if (text !== undefined) {
226
- const snapshot = context.workspace.workspaces.ts.ScriptSnapshot.fromString(text);
227
- if (script) {
228
- script.snapshot = snapshot;
229
- script.snapshotVersion = script.version;
230
- }
231
- else {
232
- scripts.pathSet(fileName, {
233
- version: -1,
234
- fileName: fileName,
235
- snapshot: snapshot,
236
- snapshotVersion: -1,
237
- });
238
- }
239
- return snapshot;
210
+ else {
211
+ scripts.pathSet(fileName, {
212
+ version: -1,
213
+ fileName: fileName,
214
+ snapshot: snapshot,
215
+ snapshotVersion: -1,
216
+ });
240
217
  }
218
+ return snapshot;
241
219
  }
242
220
  }
243
221
  }
244
- function dispose() {
245
- languageService === null || languageService === void 0 ? void 0 : languageService.dispose();
246
- scripts.clear();
247
- disposeWatchEvent === null || disposeWatchEvent === void 0 ? void 0 : disposeWatchEvent();
248
- disposeDocChange();
249
- }
250
- });
222
+ }
223
+ function dispose() {
224
+ languageService?.dispose();
225
+ scripts.clear();
226
+ disposeWatchEvent?.();
227
+ disposeDocChange();
228
+ }
251
229
  }
252
230
  exports.createProject = createProject;
253
231
  function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
254
- const extraFileExtensions = plugins.map(plugin => { var _a; return (_a = plugin.extraFileExtensions) !== null && _a !== void 0 ? _a : []; }).flat();
232
+ const extraFileExtensions = plugins.map(plugin => plugin.extraFileExtensions ?? []).flat();
255
233
  if (ts) {
256
234
  try {
257
235
  let content;
@@ -269,7 +247,7 @@ function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
269
247
  content.fileNames = content.fileNames.map(fileName => fileName.replace(/\\/g, '/'));
270
248
  return content;
271
249
  }
272
- catch (_a) {
250
+ catch {
273
251
  // will be failed if web fs host first result not ready
274
252
  }
275
253
  }
@@ -282,7 +260,6 @@ function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
282
260
  function getDocumentContext(fileNameToUri, uriToFileName, ts, host, rootUri) {
283
261
  const documentContext = {
284
262
  resolveReference: (ref, base) => {
285
- var _a, _b;
286
263
  if (ts && host) { // support tsconfig.json paths
287
264
  const isUri = base.indexOf('://') >= 0;
288
265
  const resolveResult = ts.resolveModuleName(ref, isUri ? uriToFileName(base) : base, host.getCompilationSettings(), host);
@@ -291,7 +268,7 @@ function getDocumentContext(fileNameToUri, uriToFileName, ts, host, rootUri) {
291
268
  if (!failedLookupLocations) {
292
269
  console.warn(`[volar] failedLookupLocations not exists, ts: ${ts.version}`);
293
270
  }
294
- for (let failed of failedLookupLocations !== null && failedLookupLocations !== void 0 ? failedLookupLocations : []) {
271
+ for (let failed of failedLookupLocations ?? []) {
295
272
  const fileName = path.basename(failed);
296
273
  if (fileName === 'index.d.ts' || fileName === '*.d.ts') {
297
274
  dirs.add(path.dirname(failed));
@@ -307,7 +284,7 @@ function getDocumentContext(fileNameToUri, uriToFileName, ts, host, rootUri) {
307
284
  }
308
285
  }
309
286
  for (const dir of dirs) {
310
- if ((_b = (_a = host.directoryExists) === null || _a === void 0 ? void 0 : _a.call(host, dir)) !== null && _b !== void 0 ? _b : true) {
287
+ if (host.directoryExists?.(dir) ?? true) {
311
288
  return isUri ? fileNameToUri(dir) : dir;
312
289
  }
313
290
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const fs = require("fs");
3
4
  const vscode_uri_1 = require("vscode-uri");
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const request_light_1 = require("request-light");
3
4
  function handler(uri) {