@volar/typescript 2.4.0-alpha.8 → 2.4.0-alpha.9
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,7 +1,7 @@
|
|
|
1
1
|
import type { LanguageServiceEnvironment, Disposable } from '@volar/language-service';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
3
|
import { URI } from 'vscode-uri';
|
|
4
|
-
export declare function createSys(sys: ts.System | undefined,
|
|
4
|
+
export declare function createSys(sys: ts.System | undefined, env: LanguageServiceEnvironment, getCurrentDirectory: () => string, uriConverter: {
|
|
5
5
|
asUri(fileName: string): URI;
|
|
6
6
|
asFileName(uri: URI): string;
|
|
7
7
|
}): ts.System & {
|
|
@@ -5,7 +5,7 @@ const path = require("path-browserify");
|
|
|
5
5
|
const utilities_1 = require("../typescript/utilities");
|
|
6
6
|
const vscode_uri_1 = require("vscode-uri");
|
|
7
7
|
let currentCwd = '';
|
|
8
|
-
function createSys(sys,
|
|
8
|
+
function createSys(sys, env, getCurrentDirectory, uriConverter) {
|
|
9
9
|
let version = 0;
|
|
10
10
|
const caseSensitive = sys?.useCaseSensitiveFileNames ?? false;
|
|
11
11
|
const root = {
|
|
@@ -15,7 +15,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
15
15
|
requestedRead: false,
|
|
16
16
|
};
|
|
17
17
|
const promises = new Set();
|
|
18
|
-
const fileWatcher = onDidChangeWatchedFiles?.(({ changes }) => {
|
|
18
|
+
const fileWatcher = env.onDidChangeWatchedFiles?.(({ changes }) => {
|
|
19
19
|
version++;
|
|
20
20
|
for (const change of changes) {
|
|
21
21
|
const changeUri = vscode_uri_1.URI.parse(change.uri);
|
|
@@ -108,7 +108,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
108
108
|
const dir = getDir(dirName);
|
|
109
109
|
if (dir.exists === undefined) {
|
|
110
110
|
dir.exists = false;
|
|
111
|
-
const result = fs?.stat(uriConverter.asUri(dirName));
|
|
111
|
+
const result = env.fs?.stat(uriConverter.asUri(dirName));
|
|
112
112
|
if (typeof result === 'object' && 'then' in result) {
|
|
113
113
|
const promise = result;
|
|
114
114
|
promises.add(promise);
|
|
@@ -149,7 +149,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
149
149
|
return exists();
|
|
150
150
|
}
|
|
151
151
|
function handleStat(fileName, file) {
|
|
152
|
-
const result = fs?.stat(uriConverter.asUri(fileName));
|
|
152
|
+
const result = env.fs?.stat(uriConverter.asUri(fileName));
|
|
153
153
|
if (typeof result === 'object' && 'then' in result) {
|
|
154
154
|
const promise = result;
|
|
155
155
|
promises.add(promise);
|
|
@@ -222,7 +222,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
222
222
|
}
|
|
223
223
|
file.requestedText = true;
|
|
224
224
|
const uri = uriConverter.asUri(fileName);
|
|
225
|
-
const result = fs?.readFile(uri, encoding);
|
|
225
|
+
const result = env.fs?.readFile(uri, encoding);
|
|
226
226
|
if (typeof result === 'object' && 'then' in result) {
|
|
227
227
|
const promise = result;
|
|
228
228
|
promises.add(promise);
|
|
@@ -247,7 +247,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
dir.requestedRead = true;
|
|
250
|
-
const result = fs?.readDirectory(uriConverter.asUri(dirName || '.'));
|
|
250
|
+
const result = env.fs?.readDirectory(uriConverter.asUri(dirName || '.'));
|
|
251
251
|
if (typeof result === 'object' && 'then' in result) {
|
|
252
252
|
const promise = result;
|
|
253
253
|
promises.add(promise);
|
|
@@ -269,7 +269,7 @@ function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, ur
|
|
|
269
269
|
for (const [name, _fileType] of result) {
|
|
270
270
|
let fileType = _fileType;
|
|
271
271
|
if (fileType === 64) {
|
|
272
|
-
const stat = fs?.stat(uriConverter.asUri(dirName + '/' + name));
|
|
272
|
+
const stat = env.fs?.stat(uriConverter.asUri(dirName + '/' + name));
|
|
273
273
|
if (typeof stat === 'object' && 'then' in stat) {
|
|
274
274
|
const promise = stat;
|
|
275
275
|
promises.add(promise);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/typescript",
|
|
3
|
-
"version": "2.4.0-alpha.
|
|
3
|
+
"version": "2.4.0-alpha.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"directory": "packages/typescript"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.4.0-alpha.
|
|
15
|
+
"@volar/language-core": "2.4.0-alpha.9",
|
|
16
16
|
"path-browserify": "^1.0.1",
|
|
17
17
|
"vscode-uri": "^3.0.8"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "latest",
|
|
21
21
|
"@types/path-browserify": "latest",
|
|
22
|
-
"@volar/language-service": "2.4.0-alpha.
|
|
22
|
+
"@volar/language-service": "2.4.0-alpha.9"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "4a3fc1bf36eb12ccd58bc8cb25f11f1a9f7b2300"
|
|
25
25
|
}
|