@volar/language-server 1.6.9-patch.1 → 1.7.0
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/browser/index.js +57 -62
- package/out/common/cancellationPipe.js +2 -6
- package/out/common/configurationHost.js +7 -2
- package/out/common/documents.d.ts +2 -2
- package/out/common/documents.js +10 -2
- package/out/common/features/customFeatures.js +6 -5
- package/out/common/features/languageFeatures.js +5 -5
- package/out/common/project.d.ts +112 -112
- package/out/common/project.js +147 -260
- package/out/common/server.d.ts +5 -1
- package/out/common/server.js +83 -12
- package/out/common/workspace.d.ts +288 -289
- package/out/common/workspace.js +16 -16
- package/out/common/workspaces.d.ts +354 -357
- package/out/common/workspaces.js +3 -6
- package/out/node/index.js +82 -83
- package/out/protocol.d.ts +5 -2
- package/out/protocol.js +16 -12
- package/out/types.d.ts +12 -44
- package/out/types.js +2 -2
- package/package.json +7 -6
package/out/common/workspace.js
CHANGED
|
@@ -8,16 +8,16 @@ const project_1 = require("./project");
|
|
|
8
8
|
const inferredCompilerOptions_1 = require("./utils/inferredCompilerOptions");
|
|
9
9
|
const uriMap_1 = require("./utils/uriMap");
|
|
10
10
|
const isFileInDir_1 = require("./utils/isFileInDir");
|
|
11
|
+
const language_service_1 = require("@volar/language-service");
|
|
11
12
|
exports.rootTsConfigNames = ['tsconfig.json', 'jsconfig.json'];
|
|
12
13
|
async function createWorkspace(context) {
|
|
13
|
-
const fileNameToUri = context.server.runtimeEnv.fileNameToUri;
|
|
14
|
-
const uriToFileName = context.server.runtimeEnv.uriToFileName;
|
|
15
14
|
let inferredProject;
|
|
16
|
-
|
|
15
|
+
let disposeTsConfigWatch;
|
|
16
|
+
const { fileNameToUri, uriToFileName, fs } = context.server.runtimeEnv;
|
|
17
17
|
const projects = (0, uriMap_1.createUriMap)(fileNameToUri);
|
|
18
18
|
const rootTsConfigs = new Set();
|
|
19
19
|
const searchedDirs = new Set();
|
|
20
|
-
|
|
20
|
+
context.server.onDidChangeWatchedFiles(({ changes }) => {
|
|
21
21
|
for (const change of changes) {
|
|
22
22
|
if (exports.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1))) {
|
|
23
23
|
if (change.type === vscode.FileChangeType.Created) {
|
|
@@ -44,7 +44,7 @@ async function createWorkspace(context) {
|
|
|
44
44
|
reload: clearProjects,
|
|
45
45
|
dispose() {
|
|
46
46
|
clearProjects();
|
|
47
|
-
disposeTsConfigWatch?.();
|
|
47
|
+
disposeTsConfigWatch?.dispose();
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
function clearProjects() {
|
|
@@ -71,7 +71,7 @@ async function createWorkspace(context) {
|
|
|
71
71
|
function getInferredProject() {
|
|
72
72
|
if (!inferredProject) {
|
|
73
73
|
inferredProject = (async () => {
|
|
74
|
-
const inferOptions = await (0, inferredCompilerOptions_1.getInferredCompilerOptions)(context.
|
|
74
|
+
const inferOptions = await (0, inferredCompilerOptions_1.getInferredCompilerOptions)(context.server.configurationHost);
|
|
75
75
|
return (0, project_1.createProject)({
|
|
76
76
|
...context,
|
|
77
77
|
project: {
|
|
@@ -93,7 +93,7 @@ async function createWorkspace(context) {
|
|
|
93
93
|
searchedDirs.add(dir);
|
|
94
94
|
for (const tsConfigName of exports.rootTsConfigNames) {
|
|
95
95
|
const tsconfigPath = path.join(dir, tsConfigName);
|
|
96
|
-
if (
|
|
96
|
+
if ((await fs.stat?.(fileNameToUri(tsconfigPath)))?.type === language_service_1.FileType.File) {
|
|
97
97
|
rootTsConfigs.add(tsconfigPath);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -113,6 +113,12 @@ async function createWorkspace(context) {
|
|
|
113
113
|
await getParsedCommandLine(matches[0]);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
function findIndirectReferenceTsconfig() {
|
|
117
|
+
return findTsconfig(async (tsconfig) => {
|
|
118
|
+
const project = await projects.pathGet(tsconfig);
|
|
119
|
+
return project?.askedFiles.uriHas(uri.toString()) ?? false;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
116
122
|
function findDirectIncludeTsconfig() {
|
|
117
123
|
return findTsconfig(async (tsconfig) => {
|
|
118
124
|
const map = (0, uriMap_1.createUriMap)(fileNameToUri);
|
|
@@ -123,12 +129,6 @@ async function createWorkspace(context) {
|
|
|
123
129
|
return map.uriHas(uri.toString());
|
|
124
130
|
});
|
|
125
131
|
}
|
|
126
|
-
function findIndirectReferenceTsconfig() {
|
|
127
|
-
return findTsconfig(async (tsconfig) => {
|
|
128
|
-
const project = await projects.pathGet(tsconfig);
|
|
129
|
-
return project?.readFiles.has(uriToFileName(uri.toString())) ?? false;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
132
|
async function findTsconfig(match) {
|
|
133
133
|
const checked = new Set();
|
|
134
134
|
for (const rootTsConfig of [...rootTsConfigs].sort((a, b) => sortTsConfigs(uriToFileName(uri.toString()), a, b))) {
|
|
@@ -158,13 +158,13 @@ async function createWorkspace(context) {
|
|
|
158
158
|
for (const projectReference of parsedCommandLine.projectReferences) {
|
|
159
159
|
let tsConfigPath = projectReference.path.replace(/\\/g, '/');
|
|
160
160
|
// fix https://github.com/johnsoncodehk/volar/issues/712
|
|
161
|
-
if (
|
|
161
|
+
if ((await fs.stat?.(fileNameToUri(tsConfigPath)))?.type === language_service_1.FileType.File) {
|
|
162
162
|
const newTsConfigPath = path.join(tsConfigPath, 'tsconfig.json');
|
|
163
163
|
const newJsConfigPath = path.join(tsConfigPath, 'jsconfig.json');
|
|
164
|
-
if (
|
|
164
|
+
if ((await fs.stat?.(fileNameToUri(newTsConfigPath)))?.type === language_service_1.FileType.File) {
|
|
165
165
|
tsConfigPath = newTsConfigPath;
|
|
166
166
|
}
|
|
167
|
-
else if (
|
|
167
|
+
else if ((await fs.stat?.(fileNameToUri(newJsConfigPath)))?.type === language_service_1.FileType.File) {
|
|
168
168
|
tsConfigPath = newJsConfigPath;
|
|
169
169
|
}
|
|
170
170
|
}
|