@volar/language-server 1.8.3 → 1.9.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.
@@ -1,4 +1,4 @@
1
1
  import * as vscode from 'vscode-languageserver';
2
- import type { Workspaces } from '../workspaces';
3
2
  import { RuntimeEnvironment } from '../../types';
3
+ import type { Workspaces } from '../workspaces';
4
4
  export declare function register(connection: vscode.Connection, workspaces: Workspaces, env: RuntimeEnvironment): void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.register = void 0;
4
- const protocol_1 = require("../../protocol");
5
4
  const language_core_1 = require("@volar/language-core");
5
+ const protocol_1 = require("../../protocol");
6
6
  function register(connection, workspaces, env) {
7
7
  const scriptVersions = new Map();
8
8
  const scriptVersionSnapshots = new WeakSet();
@@ -12,49 +12,6 @@ function register(connection, workspaces, env) {
12
12
  return { uri: env.fileNameToUri(project.tsconfig) };
13
13
  }
14
14
  });
15
- connection.onRequest(protocol_1.GetProjectsRequest.type, async (params) => {
16
- const matchProject = params ? (await workspaces.getProject(params.uri)) : undefined;
17
- const result = [];
18
- for (const [workspaceUri, _workspace] of workspaces.workspaces) {
19
- const workspace = (await _workspace);
20
- result.push({
21
- isInferredProject: true,
22
- rootUri: workspaceUri,
23
- tsconfig: undefined,
24
- created: !!workspace.getInferredProjectDontCreate(),
25
- isSelected: !!matchProject && await workspace.getInferredProjectDontCreate() === matchProject.project,
26
- });
27
- for (const _project of workspace.projects.values()) {
28
- const project = await _project;
29
- result.push({
30
- isInferredProject: false,
31
- rootUri: workspaceUri,
32
- tsconfig: project.tsConfig,
33
- created: !!project.getLanguageServiceDontCreate(),
34
- isSelected: !!matchProject && project === matchProject.project,
35
- });
36
- }
37
- }
38
- return result;
39
- });
40
- connection.onRequest(protocol_1.GetProjectFilesRequest.type, async (params) => {
41
- const workspace = await workspaces.workspaces.get(params.rootUri);
42
- if (!workspace)
43
- return [];
44
- if (!params.tsconfig) {
45
- const project = await workspace.getInferredProject();
46
- if (!project)
47
- return [];
48
- return project.languageHost.getScriptFileNames();
49
- }
50
- for (const _project of workspace.projects.values()) {
51
- const project = await _project;
52
- if (project.tsConfig === params.tsconfig) {
53
- return project.languageHost.getScriptFileNames();
54
- }
55
- }
56
- return [];
57
- });
58
15
  connection.onRequest(protocol_1.GetVirtualFilesRequest.type, async (document) => {
59
16
  const project = await workspaces.getProject(document.uri);
60
17
  if (project) {
@@ -128,6 +85,55 @@ function register(connection, workspaces, env) {
128
85
  }
129
86
  }
130
87
  });
88
+ connection.onRequest(protocol_1.LoadedTSFilesMetaRequest.type, async () => {
89
+ const sourceFilesData = new Map();
90
+ for (const workspace of workspaces.workspaces.values()) {
91
+ for (const _project of (await workspace).projects.values()) {
92
+ const project = await _project;
93
+ const service = project.getLanguageServiceDontCreate();
94
+ const languageService = service?.context.inject('typescript/languageService');
95
+ const program = languageService?.getProgram();
96
+ if (program) {
97
+ const projectName = typeof project.tsConfig === 'string' ? project.tsConfig : (project.languageHost.workspacePath + '(inferred)');
98
+ const sourceFiles = program?.getSourceFiles() ?? [];
99
+ for (const sourceFile of sourceFiles) {
100
+ if (!sourceFilesData.has(sourceFile)) {
101
+ let nodes = 0;
102
+ sourceFile.forEachChild(function walk(node) {
103
+ nodes++;
104
+ node.forEachChild(walk);
105
+ });
106
+ sourceFilesData.set(sourceFile, {
107
+ projectNames: [],
108
+ size: nodes * 128,
109
+ });
110
+ }
111
+ sourceFilesData.get(sourceFile).projectNames.push(projectName);
112
+ }
113
+ ;
114
+ }
115
+ }
116
+ }
117
+ const result = {
118
+ inputs: {},
119
+ outputs: {},
120
+ };
121
+ for (const [sourceFile, fileData] of sourceFilesData) {
122
+ let key = fileData.projectNames.sort().join(', ');
123
+ if (fileData.projectNames.length >= 2) {
124
+ key = `Shared in ${fileData.projectNames.length} projects (${key})`;
125
+ }
126
+ result.outputs[key] ??= {
127
+ imports: [],
128
+ exports: [],
129
+ entryPoint: '',
130
+ inputs: {},
131
+ bytes: 0,
132
+ };
133
+ result.outputs[key].inputs[sourceFile.fileName] = { bytesInOutput: fileData.size };
134
+ }
135
+ return result;
136
+ });
131
137
  }
132
138
  exports.register = register;
133
139
  //# sourceMappingURL=customFeatures.js.map
@@ -13,19 +13,7 @@ export interface ProjectContext extends WorkspaceContext {
13
13
  export type Project = ReturnType<typeof createProject>;
14
14
  export declare function createProject(context: ProjectContext): Promise<{
15
15
  context: ProjectContext;
16
- tsConfig: ts.CompilerOptions | path.PosixPath;
17
- scripts: {
18
- clear: () => void;
19
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
20
- uriDelete: (_uri: string) => boolean;
21
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
22
- uriHas: (_uri: string) => boolean;
23
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
24
- pathDelete: (path: string) => boolean;
25
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
26
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
27
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
28
- };
16
+ tsConfig: path.PosixPath | ts.CompilerOptions;
29
17
  languageHost: TypeScriptLanguageHost;
30
18
  getLanguageService: () => {
31
19
  getTriggerCharacters: () => string[];
@@ -7,6 +7,7 @@ const vscode = require("vscode-languageserver");
7
7
  const serverConfig_1 = require("./utils/serverConfig");
8
8
  const uriMap_1 = require("./utils/uriMap");
9
9
  const typescript_1 = require("@volar/typescript");
10
+ const globalSnapshots = new WeakMap();
10
11
  async function createProject(context) {
11
12
  let projectVersion = 0;
12
13
  let token = context.workspaces.cancelTokenHost.createCancellationToken();
@@ -24,15 +25,20 @@ async function createProject(context) {
24
25
  fs,
25
26
  console: context.server.runtimeEnv.console,
26
27
  locale: context.workspaces.initParams.locale,
28
+ workspaceUri: context.workspace.rootUri,
27
29
  rootUri: context.project.rootUri,
28
30
  clientCapabilities: context.workspaces.initParams.capabilities,
29
31
  getConfiguration: context.server.configurationHost?.getConfiguration,
30
32
  onDidChangeConfiguration: context.server.configurationHost?.onDidChangeConfiguration,
31
33
  onDidChangeWatchedFiles: context.server.onDidChangeWatchedFiles,
32
34
  };
33
- const fsScriptsCache = (0, uriMap_1.createUriMap)(fileNameToUri);
35
+ if (!globalSnapshots.has(fs)) {
36
+ globalSnapshots.set(fs, (0, uriMap_1.createUriMap)(fileNameToUri));
37
+ }
34
38
  const askedFiles = (0, uriMap_1.createUriMap)(fileNameToUri);
35
39
  const languageHost = {
40
+ workspacePath: uriToFileName(context.workspace.rootUri.toString()),
41
+ rootPath: uriToFileName(context.project.rootUri.toString()),
36
42
  getProjectVersion: () => projectVersion.toString(),
37
43
  getScriptFileNames: () => parsedCommandLine.fileNames,
38
44
  getScriptSnapshot: (fileName) => {
@@ -41,7 +47,7 @@ async function createProject(context) {
41
47
  if (doc) {
42
48
  return doc.getSnapshot();
43
49
  }
44
- const fsSnapshot = fsScriptsCache.pathGet(fileName);
50
+ const fsSnapshot = globalSnapshots.get(fs).pathGet(fileName);
45
51
  if (fsSnapshot) {
46
52
  return fsSnapshot;
47
53
  }
@@ -50,7 +56,6 @@ async function createProject(context) {
50
56
  getCancellationToken: () => tsToken,
51
57
  getCompilationSettings: () => parsedCommandLine.options,
52
58
  getLocalizedDiagnosticMessages: context.workspaces.tsLocalized ? () => context.workspaces.tsLocalized : undefined,
53
- getCurrentDirectory: () => uriToFileName(context.project.rootUri.toString()),
54
59
  getProjectReferences: () => parsedCommandLine.projectReferences,
55
60
  };
56
61
  const docChangeWatcher = context.workspaces.documents.onDidChangeContent(() => {
@@ -81,7 +86,6 @@ async function createProject(context) {
81
86
  return {
82
87
  context,
83
88
  tsConfig: context.project.tsConfig,
84
- scripts: fsScriptsCache,
85
89
  languageHost,
86
90
  getLanguageService,
87
91
  getLanguageServiceDontCreate: () => languageService,
@@ -107,7 +111,7 @@ async function createProject(context) {
107
111
  let dirty = false;
108
112
  for (const fileName of parsedCommandLine.fileNames) {
109
113
  const uri = fileNameToUri(fileName);
110
- if (!fsScriptsCache.uriGet(uri)) {
114
+ if (!globalSnapshots.get(fs).uriGet(uri)) {
111
115
  dirty = true;
112
116
  promises.push(updateRootScriptSnapshot(uri));
113
117
  }
@@ -117,7 +121,7 @@ async function createProject(context) {
117
121
  }
118
122
  async function updateRootScriptSnapshot(uri) {
119
123
  const text = await context.server.runtimeEnv.fs.readFile(uri);
120
- fsScriptsCache.uriSet(uri, text !== undefined ? {
124
+ globalSnapshots.get(fs).uriSet(uri, text !== undefined ? {
121
125
  getText: (start, end) => text.substring(start, end),
122
126
  getLength: () => text.length,
123
127
  getChangeRange: () => undefined,
@@ -133,13 +137,12 @@ async function createProject(context) {
133
137
  }
134
138
  }
135
139
  for (const change of changes) {
136
- const oldSnapshot = fsScriptsCache.uriGet(change.uri);
137
- if (oldSnapshot) {
140
+ if (askedFiles.uriGet(change.uri) && globalSnapshots.get(fs).uriGet(change.uri)) {
138
141
  if (change.type === vscode.FileChangeType.Changed) {
139
142
  updateRootScriptSnapshot(change.uri);
140
143
  }
141
144
  else if (change.type === vscode.FileChangeType.Deleted) {
142
- fsScriptsCache.uriSet(change.uri, undefined);
145
+ globalSnapshots.get(fs).uriSet(change.uri, undefined);
143
146
  }
144
147
  projectVersion++;
145
148
  }
@@ -14,19 +14,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
14
14
  clear: () => void;
15
15
  values: () => IterableIterator<Promise<{
16
16
  context: import("./project").ProjectContext;
17
- tsConfig: ts.CompilerOptions | path.PosixPath;
18
- scripts: {
19
- clear: () => void;
20
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
21
- uriDelete: (_uri: string) => boolean;
22
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
23
- uriHas: (_uri: string) => boolean;
24
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
25
- pathDelete: (path: string) => boolean;
26
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
27
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
28
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
29
- };
17
+ tsConfig: path.PosixPath | ts.CompilerOptions;
30
18
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
31
19
  getLanguageService: () => {
32
20
  getTriggerCharacters: () => string[];
@@ -153,19 +141,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
153
141
  uriDelete: (_uri: string) => boolean;
154
142
  uriGet: (_uri: string) => Promise<{
155
143
  context: import("./project").ProjectContext;
156
- tsConfig: ts.CompilerOptions | path.PosixPath;
157
- scripts: {
158
- clear: () => void;
159
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
160
- uriDelete: (_uri: string) => boolean;
161
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
162
- uriHas: (_uri: string) => boolean;
163
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
164
- pathDelete: (path: string) => boolean;
165
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
166
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
167
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
168
- };
144
+ tsConfig: path.PosixPath | ts.CompilerOptions;
169
145
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
170
146
  getLanguageService: () => {
171
147
  getTriggerCharacters: () => string[];
@@ -292,19 +268,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
292
268
  uriHas: (_uri: string) => boolean;
293
269
  uriSet: (_uri: string, item: Promise<{
294
270
  context: import("./project").ProjectContext;
295
- tsConfig: ts.CompilerOptions | path.PosixPath;
296
- scripts: {
297
- clear: () => void;
298
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
299
- uriDelete: (_uri: string) => boolean;
300
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
301
- uriHas: (_uri: string) => boolean;
302
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
303
- pathDelete: (path: string) => boolean;
304
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
305
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
306
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
307
- };
271
+ tsConfig: path.PosixPath | ts.CompilerOptions;
308
272
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
309
273
  getLanguageService: () => {
310
274
  getTriggerCharacters: () => string[];
@@ -431,19 +395,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
431
395
  pathDelete: (path: string) => boolean;
432
396
  pathGet: (path: string) => Promise<{
433
397
  context: import("./project").ProjectContext;
434
- tsConfig: ts.CompilerOptions | path.PosixPath;
435
- scripts: {
436
- clear: () => void;
437
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
438
- uriDelete: (_uri: string) => boolean;
439
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
440
- uriHas: (_uri: string) => boolean;
441
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
442
- pathDelete: (path: string) => boolean;
443
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
444
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
445
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
446
- };
398
+ tsConfig: path.PosixPath | ts.CompilerOptions;
447
399
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
448
400
  getLanguageService: () => {
449
401
  getTriggerCharacters: () => string[];
@@ -569,19 +521,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
569
521
  }> | undefined;
570
522
  pathHas: (path: string) => Promise<{
571
523
  context: import("./project").ProjectContext;
572
- tsConfig: ts.CompilerOptions | path.PosixPath;
573
- scripts: {
574
- clear: () => void;
575
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
576
- uriDelete: (_uri: string) => boolean;
577
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
578
- uriHas: (_uri: string) => boolean;
579
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
580
- pathDelete: (path: string) => boolean;
581
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
582
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
583
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
584
- };
524
+ tsConfig: path.PosixPath | ts.CompilerOptions;
585
525
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
586
526
  getLanguageService: () => {
587
527
  getTriggerCharacters: () => string[];
@@ -707,19 +647,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
707
647
  }> | undefined;
708
648
  pathSet: (path: string, item: Promise<{
709
649
  context: import("./project").ProjectContext;
710
- tsConfig: ts.CompilerOptions | path.PosixPath;
711
- scripts: {
712
- clear: () => void;
713
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
714
- uriDelete: (_uri: string) => boolean;
715
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
716
- uriHas: (_uri: string) => boolean;
717
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
718
- pathDelete: (path: string) => boolean;
719
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
720
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
721
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
722
- };
650
+ tsConfig: path.PosixPath | ts.CompilerOptions;
723
651
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
724
652
  getLanguageService: () => {
725
653
  getTriggerCharacters: () => string[];
@@ -848,19 +776,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
848
776
  tsconfig: string;
849
777
  project: {
850
778
  context: import("./project").ProjectContext;
851
- tsConfig: ts.CompilerOptions | path.PosixPath;
852
- scripts: {
853
- clear: () => void;
854
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
855
- uriDelete: (_uri: string) => boolean;
856
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
857
- uriHas: (_uri: string) => boolean;
858
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
859
- pathDelete: (path: string) => boolean;
860
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
861
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
862
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
863
- };
779
+ tsConfig: path.PosixPath | ts.CompilerOptions;
864
780
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
865
781
  getLanguageService: () => {
866
782
  getTriggerCharacters: () => string[];
@@ -987,19 +903,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
987
903
  } | undefined>;
988
904
  getInferredProject: () => Promise<{
989
905
  context: import("./project").ProjectContext;
990
- tsConfig: ts.CompilerOptions | path.PosixPath;
991
- scripts: {
992
- clear: () => void;
993
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
994
- uriDelete: (_uri: string) => boolean;
995
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
996
- uriHas: (_uri: string) => boolean;
997
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
998
- pathDelete: (path: string) => boolean;
999
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1000
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1001
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1002
- };
906
+ tsConfig: path.PosixPath | ts.CompilerOptions;
1003
907
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
1004
908
  getLanguageService: () => {
1005
909
  getTriggerCharacters: () => string[];
@@ -1125,19 +1029,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1125
1029
  }>;
1126
1030
  getInferredProjectDontCreate: () => Promise<{
1127
1031
  context: import("./project").ProjectContext;
1128
- tsConfig: ts.CompilerOptions | path.PosixPath;
1129
- scripts: {
1130
- clear: () => void;
1131
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
1132
- uriDelete: (_uri: string) => boolean;
1133
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
1134
- uriHas: (_uri: string) => boolean;
1135
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
1136
- pathDelete: (path: string) => boolean;
1137
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1138
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1139
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1140
- };
1032
+ tsConfig: path.PosixPath | ts.CompilerOptions;
1141
1033
  languageHost: import("@volar/language-service").TypeScriptLanguageHost;
1142
1034
  getLanguageService: () => {
1143
1035
  getTriggerCharacters: () => string[];
@@ -25,19 +25,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
25
25
  clear: () => void;
26
26
  values: () => IterableIterator<Promise<{
27
27
  context: import("./project").ProjectContext;
28
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
29
- scripts: {
30
- clear: () => void;
31
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
32
- uriDelete: (_uri: string) => boolean;
33
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
34
- uriHas: (_uri: string) => boolean;
35
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
36
- pathDelete: (path: string) => boolean;
37
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
38
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
39
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
40
- };
28
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
41
29
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
42
30
  getLanguageService: () => {
43
31
  getTriggerCharacters: () => string[];
@@ -164,19 +152,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
164
152
  uriDelete: (_uri: string) => boolean;
165
153
  uriGet: (_uri: string) => Promise<{
166
154
  context: import("./project").ProjectContext;
167
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
168
- scripts: {
169
- clear: () => void;
170
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
171
- uriDelete: (_uri: string) => boolean;
172
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
173
- uriHas: (_uri: string) => boolean;
174
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
175
- pathDelete: (path: string) => boolean;
176
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
177
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
178
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
179
- };
155
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
180
156
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
181
157
  getLanguageService: () => {
182
158
  getTriggerCharacters: () => string[];
@@ -303,19 +279,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
303
279
  uriHas: (_uri: string) => boolean;
304
280
  uriSet: (_uri: string, item: Promise<{
305
281
  context: import("./project").ProjectContext;
306
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
307
- scripts: {
308
- clear: () => void;
309
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
310
- uriDelete: (_uri: string) => boolean;
311
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
312
- uriHas: (_uri: string) => boolean;
313
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
314
- pathDelete: (path: string) => boolean;
315
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
316
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
317
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
318
- };
282
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
319
283
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
320
284
  getLanguageService: () => {
321
285
  getTriggerCharacters: () => string[];
@@ -442,19 +406,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
442
406
  pathDelete: (path: string) => boolean;
443
407
  pathGet: (path: string) => Promise<{
444
408
  context: import("./project").ProjectContext;
445
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
446
- scripts: {
447
- clear: () => void;
448
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
449
- uriDelete: (_uri: string) => boolean;
450
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
451
- uriHas: (_uri: string) => boolean;
452
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
453
- pathDelete: (path: string) => boolean;
454
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
455
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
456
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
457
- };
409
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
458
410
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
459
411
  getLanguageService: () => {
460
412
  getTriggerCharacters: () => string[];
@@ -580,19 +532,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
580
532
  }> | undefined;
581
533
  pathHas: (path: string) => Promise<{
582
534
  context: import("./project").ProjectContext;
583
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
584
- scripts: {
585
- clear: () => void;
586
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
587
- uriDelete: (_uri: string) => boolean;
588
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
589
- uriHas: (_uri: string) => boolean;
590
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
591
- pathDelete: (path: string) => boolean;
592
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
593
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
594
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
595
- };
535
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
596
536
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
597
537
  getLanguageService: () => {
598
538
  getTriggerCharacters: () => string[];
@@ -718,19 +658,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
718
658
  }> | undefined;
719
659
  pathSet: (path: string, item: Promise<{
720
660
  context: import("./project").ProjectContext;
721
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
722
- scripts: {
723
- clear: () => void;
724
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
725
- uriDelete: (_uri: string) => boolean;
726
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
727
- uriHas: (_uri: string) => boolean;
728
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
729
- pathDelete: (path: string) => boolean;
730
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
731
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
732
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
733
- };
661
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
734
662
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
735
663
  getLanguageService: () => {
736
664
  getTriggerCharacters: () => string[];
@@ -859,19 +787,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
859
787
  tsconfig: string;
860
788
  project: {
861
789
  context: import("./project").ProjectContext;
862
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
863
- scripts: {
864
- clear: () => void;
865
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
866
- uriDelete: (_uri: string) => boolean;
867
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
868
- uriHas: (_uri: string) => boolean;
869
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
870
- pathDelete: (path: string) => boolean;
871
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
872
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
873
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
874
- };
790
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
875
791
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
876
792
  getLanguageService: () => {
877
793
  getTriggerCharacters: () => string[];
@@ -998,19 +914,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
998
914
  } | undefined>;
999
915
  getInferredProject: () => Promise<{
1000
916
  context: import("./project").ProjectContext;
1001
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
1002
- scripts: {
1003
- clear: () => void;
1004
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
1005
- uriDelete: (_uri: string) => boolean;
1006
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
1007
- uriHas: (_uri: string) => boolean;
1008
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
1009
- pathDelete: (path: string) => boolean;
1010
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1011
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1012
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1013
- };
917
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
1014
918
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
1015
919
  getLanguageService: () => {
1016
920
  getTriggerCharacters: () => string[];
@@ -1136,19 +1040,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1136
1040
  }>;
1137
1041
  getInferredProjectDontCreate: () => Promise<{
1138
1042
  context: import("./project").ProjectContext;
1139
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
1140
- scripts: {
1141
- clear: () => void;
1142
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
1143
- uriDelete: (_uri: string) => boolean;
1144
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
1145
- uriHas: (_uri: string) => boolean;
1146
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
1147
- pathDelete: (path: string) => boolean;
1148
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1149
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1150
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1151
- };
1043
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
1152
1044
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
1153
1045
  getLanguageService: () => {
1154
1046
  getTriggerCharacters: () => string[];
@@ -1279,19 +1171,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1279
1171
  tsconfig: string;
1280
1172
  project: {
1281
1173
  context: import("./project").ProjectContext;
1282
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
1283
- scripts: {
1284
- clear: () => void;
1285
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
1286
- uriDelete: (_uri: string) => boolean;
1287
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
1288
- uriHas: (_uri: string) => boolean;
1289
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
1290
- pathDelete: (path: string) => boolean;
1291
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1292
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1293
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1294
- };
1174
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
1295
1175
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
1296
1176
  getLanguageService: () => {
1297
1177
  getTriggerCharacters: () => string[];
@@ -1419,19 +1299,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1419
1299
  tsconfig: undefined;
1420
1300
  project: {
1421
1301
  context: import("./project").ProjectContext;
1422
- tsConfig: ts.CompilerOptions | import("typesafe-path/posix").PosixPath;
1423
- scripts: {
1424
- clear: () => void;
1425
- values: () => IterableIterator<ts.IScriptSnapshot | undefined>;
1426
- uriDelete: (_uri: string) => boolean;
1427
- uriGet: (_uri: string) => ts.IScriptSnapshot | undefined;
1428
- uriHas: (_uri: string) => boolean;
1429
- uriSet: (_uri: string, item: ts.IScriptSnapshot | undefined) => void;
1430
- pathDelete: (path: string) => boolean;
1431
- pathGet: (path: string) => ts.IScriptSnapshot | undefined;
1432
- pathHas: (path: string) => ts.IScriptSnapshot | undefined;
1433
- pathSet: (path: string, item: ts.IScriptSnapshot | undefined) => void;
1434
- };
1302
+ tsConfig: import("typesafe-path/posix").PosixPath | ts.CompilerOptions;
1435
1303
  languageHost: import("@volar/language-core").TypeScriptLanguageHost;
1436
1304
  getLanguageService: () => {
1437
1305
  getTriggerCharacters: () => string[];
package/out/protocol.d.ts CHANGED
@@ -33,27 +33,6 @@ export declare namespace GetMatchTsConfigRequest {
33
33
  type ErrorType = never;
34
34
  const type: vscode.RequestType<vscode.TextDocumentIdentifier, ResponseType, never>;
35
35
  }
36
- export declare namespace GetProjectsRequest {
37
- type ParamsType = vscode.TextDocumentIdentifier;
38
- type ResponseType = {
39
- rootUri: string;
40
- tsconfig?: string;
41
- isInferredProject: boolean;
42
- created: boolean;
43
- isSelected: boolean;
44
- }[] | null | undefined;
45
- type ErrorType = never;
46
- const type: vscode.RequestType<vscode.TextDocumentIdentifier, ResponseType, never>;
47
- }
48
- export declare namespace GetProjectFilesRequest {
49
- type ParamsType = {
50
- rootUri: string;
51
- tsconfig?: string;
52
- };
53
- type ResponseType = string[] | null | undefined;
54
- type ErrorType = never;
55
- const type: vscode.RequestType<ParamsType, ResponseType, never>;
56
- }
57
36
  export declare namespace AutoInsertRequest {
58
37
  type ParamsType = vscode.TextDocumentPositionParams & {
59
38
  options: {
@@ -69,6 +48,9 @@ export declare namespace AutoInsertRequest {
69
48
  type ErrorType = never;
70
49
  const type: vscode.RequestType<ParamsType, ResponseType, never>;
71
50
  }
51
+ export declare namespace LoadedTSFilesMetaRequest {
52
+ const type: vscode.RequestType0<unknown, unknown>;
53
+ }
72
54
  export declare namespace WriteVirtualFilesNotification {
73
55
  const type: vscode.NotificationType<vscode.TextDocumentIdentifier>;
74
56
  }
package/out/protocol.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetVirtualFileRequest = exports.GetVirtualFilesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.AutoInsertRequest = exports.GetProjectFilesRequest = exports.GetProjectsRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.FsStatRequest = exports.FsReadDirectoryRequest = exports.FsReadFileRequest = void 0;
3
+ exports.GetVirtualFileRequest = exports.GetVirtualFilesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.LoadedTSFilesMetaRequest = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.FsStatRequest = exports.FsReadDirectoryRequest = exports.FsReadFileRequest = void 0;
4
4
  const vscode = require("vscode-languageserver-protocol");
5
5
  /**
6
6
  * Server request client
@@ -28,18 +28,14 @@ var GetMatchTsConfigRequest;
28
28
  (function (GetMatchTsConfigRequest) {
29
29
  GetMatchTsConfigRequest.type = new vscode.RequestType('volar/client/tsconfig');
30
30
  })(GetMatchTsConfigRequest || (exports.GetMatchTsConfigRequest = GetMatchTsConfigRequest = {}));
31
- var GetProjectsRequest;
32
- (function (GetProjectsRequest) {
33
- GetProjectsRequest.type = new vscode.RequestType('volar/client/projects');
34
- })(GetProjectsRequest || (exports.GetProjectsRequest = GetProjectsRequest = {}));
35
- var GetProjectFilesRequest;
36
- (function (GetProjectFilesRequest) {
37
- GetProjectFilesRequest.type = new vscode.RequestType('volar/client/projectFiles');
38
- })(GetProjectFilesRequest || (exports.GetProjectFilesRequest = GetProjectFilesRequest = {}));
39
31
  var AutoInsertRequest;
40
32
  (function (AutoInsertRequest) {
41
33
  AutoInsertRequest.type = new vscode.RequestType('volar/client/autoInsert');
42
34
  })(AutoInsertRequest || (exports.AutoInsertRequest = AutoInsertRequest = {}));
35
+ var LoadedTSFilesMetaRequest;
36
+ (function (LoadedTSFilesMetaRequest) {
37
+ LoadedTSFilesMetaRequest.type = new vscode.RequestType0('volar/client/loadedTsFiles');
38
+ })(LoadedTSFilesMetaRequest || (exports.LoadedTSFilesMetaRequest = LoadedTSFilesMetaRequest = {}));
43
39
  var WriteVirtualFilesNotification;
44
40
  (function (WriteVirtualFilesNotification) {
45
41
  WriteVirtualFilesNotification.type = new vscode.NotificationType('volar/client/writeVirtualFiles');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "1.8.3",
3
+ "version": "1.9.0",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -15,9 +15,9 @@
15
15
  "directory": "packages/language-server"
16
16
  },
17
17
  "dependencies": {
18
- "@volar/language-core": "1.8.3",
19
- "@volar/language-service": "1.8.3",
20
- "@volar/typescript": "1.8.3",
18
+ "@volar/language-core": "1.9.0",
19
+ "@volar/language-service": "1.9.0",
20
+ "@volar/typescript": "1.9.0",
21
21
  "@vscode/l10n": "^0.0.11",
22
22
  "request-light": "^0.7.0",
23
23
  "typesafe-path": "^0.2.2",
@@ -27,7 +27,7 @@
27
27
  "vscode-uri": "^3.0.7"
28
28
  },
29
29
  "devDependencies": {
30
- "@volar/source-map": "1.8.3"
30
+ "@volar/source-map": "1.9.0"
31
31
  },
32
- "gitHead": "dabfccbbc4c730d9c6f941fb6cd284a6c1178b0c"
32
+ "gitHead": "37453f868329df9c666e6ee44919a55b36484b93"
33
33
  }