volar-service-typescript 0.0.18 → 0.0.19
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/index.js +19 -17
- package/package.json +4 -4
package/out/index.js
CHANGED
|
@@ -82,15 +82,16 @@ function create(ts) {
|
|
|
82
82
|
},
|
|
83
83
|
ts,
|
|
84
84
|
getTextDocument(uri) {
|
|
85
|
-
const
|
|
85
|
+
const fileName = context.env.uriToFileName(uri);
|
|
86
|
+
const virtualFile = context.language.files.getVirtualFile(fileName)[0];
|
|
86
87
|
if (virtualFile) {
|
|
87
88
|
return context.documents.get(uri, virtualFile.languageId, virtualFile.snapshot);
|
|
88
89
|
}
|
|
89
|
-
const sourceFile = context.language.files.getSourceFile(
|
|
90
|
+
const sourceFile = context.language.files.getSourceFile(fileName);
|
|
90
91
|
if (sourceFile && !sourceFile.virtualFile) {
|
|
91
92
|
return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
|
|
92
93
|
}
|
|
93
|
-
const snapshot = syntacticServiceHost.getScriptSnapshot(
|
|
94
|
+
const snapshot = syntacticServiceHost.getScriptSnapshot(fileName);
|
|
94
95
|
if (snapshot) {
|
|
95
96
|
let document = documents.get(snapshot);
|
|
96
97
|
if (!document) {
|
|
@@ -205,34 +206,34 @@ function create(ts) {
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
if (created.projectUpdated) {
|
|
208
|
-
const
|
|
209
|
-
const
|
|
209
|
+
const sourceScriptNames = new Set();
|
|
210
|
+
const normalizeFileName = sys.useCaseSensitiveFileNames
|
|
210
211
|
? (id) => id
|
|
211
212
|
: (id) => id.toLowerCase();
|
|
212
|
-
|
|
213
|
+
updateSourceScriptFileNames();
|
|
213
214
|
context.env.onDidChangeWatchedFiles?.((params) => {
|
|
214
215
|
const someFileCreateOrDeiete = params.changes.some(change => change.type !== 2);
|
|
215
216
|
if (someFileCreateOrDeiete) {
|
|
216
|
-
|
|
217
|
+
updateSourceScriptFileNames();
|
|
217
218
|
}
|
|
218
219
|
for (const change of params.changes) {
|
|
219
|
-
|
|
220
|
+
const fileName = context.env.uriToFileName(change.uri);
|
|
221
|
+
if (sourceScriptNames.has(normalizeFileName(fileName))) {
|
|
220
222
|
created.projectUpdated?.(languageServiceHost.getCurrentDirectory());
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
});
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
+
function updateSourceScriptFileNames() {
|
|
227
|
+
sourceScriptNames.clear();
|
|
226
228
|
for (const fileName of languageServiceHost.getScriptFileNames()) {
|
|
227
|
-
const
|
|
228
|
-
const virtualFile = context.language.files.getVirtualFile(uri);
|
|
229
|
+
const virtualFile = context.language.files.getVirtualFile(fileName);
|
|
229
230
|
if (virtualFile) {
|
|
230
|
-
|
|
231
|
+
sourceScriptNames.add(normalizeFileName(fileName));
|
|
231
232
|
continue;
|
|
232
233
|
}
|
|
233
|
-
const sourceFile = context.language.files.getSourceFile(
|
|
234
|
+
const sourceFile = context.language.files.getSourceFile(fileName);
|
|
234
235
|
if (sourceFile && !sourceFile.virtualFile) {
|
|
235
|
-
|
|
236
|
+
sourceScriptNames.add(normalizeFileName(fileName));
|
|
236
237
|
continue;
|
|
237
238
|
}
|
|
238
239
|
}
|
|
@@ -246,11 +247,12 @@ function create(ts) {
|
|
|
246
247
|
languageService,
|
|
247
248
|
},
|
|
248
249
|
getTextDocument(uri) {
|
|
249
|
-
const
|
|
250
|
+
const fileName = context.env.uriToFileName(uri);
|
|
251
|
+
const virtualFile = context.language.files.getVirtualFile(fileName)[0];
|
|
250
252
|
if (virtualFile) {
|
|
251
253
|
return context.documents.get(uri, virtualFile.languageId, virtualFile.snapshot);
|
|
252
254
|
}
|
|
253
|
-
const sourceFile = context.language.files.getSourceFile(
|
|
255
|
+
const sourceFile = context.language.files.getSourceFile(fileName);
|
|
254
256
|
if (sourceFile && !sourceFile.virtualFile) {
|
|
255
257
|
return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
|
|
256
258
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Integrate TypeScript into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/typescript",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"vscode-uri": "^3.0.8"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@volar/language-service": "2.0.0-alpha.
|
|
42
|
-
"@volar/typescript": "2.0.0-alpha.
|
|
41
|
+
"@volar/language-service": "2.0.0-alpha.2",
|
|
42
|
+
"@volar/typescript": "2.0.0-alpha.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@volar/language-service": {
|
|
46
46
|
"optional": true
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ccd6cfec1b676091acd2f9ea78e1b695a4bf1dd1"
|
|
50
50
|
}
|