@volar/language-server 1.4.0 → 1.5.0-alpha.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,2 +1,2 @@
1
- import { FileSystemHost, LanguageServerInitializationOptions, RuntimeEnvironment } from '../types';
2
- export declare function createWebFileSystemHost(_0: any, _1: any, env: RuntimeEnvironment, initOptions: LanguageServerInitializationOptions): FileSystemHost;
1
+ import { FileSystemHost, InitializationOptions, RuntimeEnvironment } from '../types';
2
+ export declare function createWebFileSystemHost(_0: any, _1: any, env: RuntimeEnvironment, initOptions: InitializationOptions): FileSystemHost;
@@ -1,5 +1,5 @@
1
- import { ConfigurationHost } from '@volar/language-service';
1
+ import { ServiceEnvironment } from '@volar/language-service';
2
2
  import * as vscode from 'vscode-languageserver';
3
- export declare function createConfigurationHost(params: vscode.InitializeParams, connection: vscode.Connection): ConfigurationHost & {
3
+ export declare function createConfigurationHost(params: vscode.InitializeParams, connection: vscode.Connection): Pick<ServiceEnvironment, 'getConfiguration' | 'onDidChangeConfiguration'> & {
4
4
  ready(): void;
5
5
  };
@@ -1,7 +1,7 @@
1
1
  import * as vscode from 'vscode-languageserver';
2
2
  import { CancellationTokenHost } from '../cancellationPipe';
3
3
  import type { Workspaces } from '../workspaces';
4
- import { RuntimeEnvironment, LanguageServerInitializationOptions } from '../../types';
4
+ import { RuntimeEnvironment, InitializationOptions } from '../../types';
5
5
  import { createDocuments } from '../documents';
6
- export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, initOptions: LanguageServerInitializationOptions, cancelHost: CancellationTokenHost, semanticTokensLegend: vscode.SemanticTokensLegend, runtime: RuntimeEnvironment, documents: ReturnType<typeof createDocuments>): void;
6
+ export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, initOptions: InitializationOptions, cancelHost: CancellationTokenHost, semanticTokensLegend: vscode.SemanticTokensLegend, runtime: RuntimeEnvironment, documents: ReturnType<typeof createDocuments>): void;
7
7
  export declare function sleep(ms: number): Promise<unknown>;
@@ -102,7 +102,7 @@ export declare function createProject(context: ProjectContext): Promise<{
102
102
  getOutgoingCalls(item: embeddedLS.CallHierarchyItem, token: embeddedLS.CancellationToken): Promise<embeddedLS.CallHierarchyOutgoingCall[]>;
103
103
  };
104
104
  dispose: () => void | undefined;
105
- context: embeddedLS.LanguageServicePluginContext;
105
+ context: embeddedLS.ServiceContext;
106
106
  };
107
107
  getLanguageServiceDontCreate: () => {
108
108
  triggerCharacters: string[];
@@ -150,7 +150,7 @@ export declare function createProject(context: ProjectContext): Promise<{
150
150
  getOutgoingCalls(item: embeddedLS.CallHierarchyItem, token: embeddedLS.CancellationToken): Promise<embeddedLS.CallHierarchyOutgoingCall[]>;
151
151
  };
152
152
  dispose: () => void | undefined;
153
- context: embeddedLS.LanguageServicePluginContext;
153
+ context: embeddedLS.ServiceContext;
154
154
  } | undefined;
155
155
  getParsedCommandLine: () => ts.ParsedCommandLine;
156
156
  tryAddFile: (fileName: string) => void;
@@ -55,21 +55,16 @@ async function createProject(context) {
55
55
  };
56
56
  function getLanguageService() {
57
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 },
58
+ const env = {
61
59
  uriToFileName,
62
60
  fileNameToUri,
63
61
  locale: context.workspace.workspaces.initParams.locale,
64
62
  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,
63
+ clientCapabilities: context.workspace.workspaces.initParams.capabilities,
64
+ getConfiguration: context.workspace.workspaces.configurationHost?.getConfiguration,
65
+ onDidChangeConfiguration: context.workspace.workspaces.configurationHost?.onDidChangeConfiguration,
71
66
  fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
72
- fileSystemHost: context.workspace.workspaces.fileSystemHost,
67
+ onDidChangeWatchedFiles: context.workspace.workspaces.fileSystemHost?.onDidChangeWatchedFiles,
73
68
  documentContext: getDocumentContext(fileNameToUri, uriToFileName, context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
74
69
  schemaRequestService: async (uri) => {
75
70
  const protocol = uri.substring(0, uri.indexOf(':'));
@@ -80,18 +75,18 @@ async function createProject(context) {
80
75
  return '';
81
76
  },
82
77
  };
83
- const lsCtx = {
84
- project: context,
85
- options,
86
- sys,
87
- host: languageServiceHost,
88
- };
78
+ let config = (context.workspace.rootUri.scheme === 'file' ? (0, serverConfig_1.loadConfig)(context.workspace.rootUri.path, context.workspace.workspaces.initOptions.configFilePath) : {}) ?? {};
89
79
  for (const plugin of context.workspace.workspaces.plugins) {
90
80
  if (plugin.resolveConfig) {
91
- config = plugin.resolveConfig(config, lsCtx);
81
+ config = plugin.resolveConfig(config, {
82
+ env,
83
+ project: context,
84
+ sys,
85
+ host: languageServiceHost,
86
+ });
92
87
  }
93
88
  }
94
- languageService = embeddedLS.createLanguageService(options, context.documentRegistry);
89
+ languageService = embeddedLS.createLanguageService({ typescript: context.workspace.workspaces.ts }, env, config, languageServiceHost, context.documentRegistry);
95
90
  }
96
91
  return languageService;
97
92
  }
@@ -1,8 +1,8 @@
1
1
  import * as vscode from 'vscode-languageserver';
2
- import { LanguageServerInitializationOptions, LanguageServerPlugin, RuntimeEnvironment } from '../types';
2
+ import { InitializationOptions, LanguageServerPlugin, RuntimeEnvironment } from '../types';
3
3
  export interface ServerContext {
4
4
  connection: vscode.Connection;
5
5
  runtimeEnv: RuntimeEnvironment;
6
6
  plugins: LanguageServerPlugin[];
7
7
  }
8
- export declare function startCommonLanguageServer(connection: vscode.Connection, getCtx: (initOptions: LanguageServerInitializationOptions) => ServerContext): void;
8
+ export declare function startCommonLanguageServer(connection: vscode.Connection, getCtx: (initOptions: InitializationOptions) => ServerContext): void;
@@ -55,7 +55,7 @@ function startCommonLanguageServer(connection, getCtx) {
55
55
  },
56
56
  };
57
57
  configurationHost = initParams.capabilities.workspace?.configuration ? (0, configurationHost_1.createConfigurationHost)(initParams, connection) : undefined;
58
- let lsPlugins = {};
58
+ let services = {};
59
59
  for (const root of roots) {
60
60
  if (root.scheme === 'file') {
61
61
  let config = (0, serverConfig_1.loadConfig)(root.path, options.configFilePath) ?? {};
@@ -64,15 +64,15 @@ function startCommonLanguageServer(connection, getCtx) {
64
64
  config = plugin.resolveConfig(config, undefined);
65
65
  }
66
66
  }
67
- if (config.plugins) {
68
- lsPlugins = {
69
- ...lsPlugins,
70
- ...config.plugins,
67
+ if (config.services) {
68
+ services = {
69
+ ...services,
70
+ ...config.services,
71
71
  };
72
72
  }
73
73
  }
74
74
  }
75
- (0, registerFeatures_1.setupCapabilities)(result.capabilities, options, plugins, getSemanticTokensLegend(), lsPlugins);
75
+ (0, registerFeatures_1.setupCapabilities)(result.capabilities, options, plugins, getSemanticTokensLegend(), services);
76
76
  await createLanguageServiceHost();
77
77
  try {
78
78
  // show version on LSP logs
@@ -125,19 +125,18 @@ function startCommonLanguageServer(connection, getCtx) {
125
125
  fsHost = ts ? context.runtimeEnv.createFileSystemHost(ts, initParams.capabilities, context.runtimeEnv, options) : undefined;
126
126
  const tsLocalized = options.typescript && initParams.locale ? await context.runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, initParams.locale) : undefined;
127
127
  const cancelTokenHost = (0, cancellationPipe_1.createCancellationTokenHost)(options.cancellationPipeName);
128
- const _projects = (0, workspaces_1.createWorkspaces)({
128
+ projects = (0, workspaces_1.createWorkspaces)({
129
129
  server: context,
130
130
  fileSystemHost: fsHost,
131
131
  configurationHost,
132
132
  ts,
133
133
  tsLocalized,
134
- initParams: initParams,
134
+ initParams,
135
135
  initOptions: options,
136
136
  documents,
137
137
  cancelTokenHost,
138
138
  plugins,
139
139
  });
140
- projects = _projects;
141
140
  for (const root of roots) {
142
141
  projects.add(root);
143
142
  }
@@ -1,3 +1,3 @@
1
- import { ConfigurationHost } from '@volar/language-service';
1
+ import { ServiceEnvironment } from '@volar/language-service';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
- export declare function getInferredCompilerOptions(configurationHost: ConfigurationHost | undefined): Promise<ts.CompilerOptions>;
3
+ export declare function getInferredCompilerOptions(ctx: Pick<ServiceEnvironment, 'getConfiguration' | 'onDidChangeConfiguration'> | undefined): Promise<ts.CompilerOptions>;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInferredCompilerOptions = void 0;
4
- async function getInferredCompilerOptions(configurationHost) {
4
+ async function getInferredCompilerOptions(ctx) {
5
5
  let [implicitProjectConfig_1, implicitProjectConfig_2] = await Promise.all([
6
- configurationHost?.getConfiguration('js/ts.implicitProjectConfig'),
7
- configurationHost?.getConfiguration('javascript.implicitProjectConfig'),
6
+ ctx?.getConfiguration?.('js/ts.implicitProjectConfig'),
7
+ ctx?.getConfiguration?.('javascript.implicitProjectConfig'),
8
8
  ]);
9
9
  implicitProjectConfig_1 = implicitProjectConfig_1 ?? {};
10
10
  implicitProjectConfig_2 = implicitProjectConfig_2 ?? {};
@@ -1,4 +1,4 @@
1
- import { LanguageServerPlugin, LanguageServerInitializationOptions } from '../../types';
1
+ import { LanguageServerPlugin, InitializationOptions } from '../../types';
2
2
  import * as vscode from 'vscode-languageserver';
3
3
  import { Config } from '@volar/language-service';
4
- export declare function setupCapabilities(server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend, lsPlugins: NonNullable<Config['plugins']>): void;
4
+ export declare function setupCapabilities(server: vscode.ServerCapabilities, initOptions: InitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend, services: NonNullable<Config['services']>): void;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupCapabilities = void 0;
4
4
  const types_1 = require("../../types");
5
5
  const vscode = require("vscode-languageserver");
6
- function setupCapabilities(server, initOptions, plugins, semanticTokensLegend, lsPlugins) {
7
- const lsPluginInstances = Object.values(lsPlugins)
8
- .map(plugin => typeof plugin === 'function' ? plugin() : plugin)
6
+ function setupCapabilities(server, initOptions, plugins, semanticTokensLegend, services) {
7
+ const lsPluginInstances = Object.values(services)
8
+ .map(plugin => typeof plugin === 'function' ? plugin(undefined, undefined) : plugin)
9
9
  .filter((plugin) => !!plugin);
10
10
  const serverMode = initOptions.serverMode ?? types_1.ServerMode.Semantic;
11
11
  if (serverMode === types_1.ServerMode.Semantic || serverMode === types_1.ServerMode.Syntactic) {
@@ -103,7 +103,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
103
103
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
104
104
  };
105
105
  dispose: () => void | undefined;
106
- context: import("@volar/language-service").LanguageServicePluginContext;
106
+ context: import("@volar/language-service").ServiceContext;
107
107
  };
108
108
  getLanguageServiceDontCreate: () => {
109
109
  triggerCharacters: string[];
@@ -151,7 +151,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
151
151
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
152
152
  };
153
153
  dispose: () => void | undefined;
154
- context: import("@volar/language-service").LanguageServicePluginContext;
154
+ context: import("@volar/language-service").ServiceContext;
155
155
  } | undefined;
156
156
  getParsedCommandLine: () => ts.ParsedCommandLine;
157
157
  tryAddFile: (fileName: string) => void;
@@ -249,7 +249,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
249
249
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
250
250
  };
251
251
  dispose: () => void | undefined;
252
- context: import("@volar/language-service").LanguageServicePluginContext;
252
+ context: import("@volar/language-service").ServiceContext;
253
253
  };
254
254
  getLanguageServiceDontCreate: () => {
255
255
  triggerCharacters: string[];
@@ -297,7 +297,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
297
297
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
298
298
  };
299
299
  dispose: () => void | undefined;
300
- context: import("@volar/language-service").LanguageServicePluginContext;
300
+ context: import("@volar/language-service").ServiceContext;
301
301
  } | undefined;
302
302
  getParsedCommandLine: () => ts.ParsedCommandLine;
303
303
  tryAddFile: (fileName: string) => void;
@@ -395,7 +395,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
395
395
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
396
396
  };
397
397
  dispose: () => void | undefined;
398
- context: import("@volar/language-service").LanguageServicePluginContext;
398
+ context: import("@volar/language-service").ServiceContext;
399
399
  };
400
400
  getLanguageServiceDontCreate: () => {
401
401
  triggerCharacters: string[];
@@ -443,7 +443,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
443
443
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
444
444
  };
445
445
  dispose: () => void | undefined;
446
- context: import("@volar/language-service").LanguageServicePluginContext;
446
+ context: import("@volar/language-service").ServiceContext;
447
447
  } | undefined;
448
448
  getParsedCommandLine: () => ts.ParsedCommandLine;
449
449
  tryAddFile: (fileName: string) => void;
@@ -541,7 +541,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
541
541
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
542
542
  };
543
543
  dispose: () => void | undefined;
544
- context: import("@volar/language-service").LanguageServicePluginContext;
544
+ context: import("@volar/language-service").ServiceContext;
545
545
  };
546
546
  getLanguageServiceDontCreate: () => {
547
547
  triggerCharacters: string[];
@@ -589,7 +589,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
589
589
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
590
590
  };
591
591
  dispose: () => void | undefined;
592
- context: import("@volar/language-service").LanguageServicePluginContext;
592
+ context: import("@volar/language-service").ServiceContext;
593
593
  } | undefined;
594
594
  getParsedCommandLine: () => ts.ParsedCommandLine;
595
595
  tryAddFile: (fileName: string) => void;
@@ -686,7 +686,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
686
686
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
687
687
  };
688
688
  dispose: () => void | undefined;
689
- context: import("@volar/language-service").LanguageServicePluginContext;
689
+ context: import("@volar/language-service").ServiceContext;
690
690
  };
691
691
  getLanguageServiceDontCreate: () => {
692
692
  triggerCharacters: string[];
@@ -734,7 +734,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
734
734
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
735
735
  };
736
736
  dispose: () => void | undefined;
737
- context: import("@volar/language-service").LanguageServicePluginContext;
737
+ context: import("@volar/language-service").ServiceContext;
738
738
  } | undefined;
739
739
  getParsedCommandLine: () => ts.ParsedCommandLine;
740
740
  tryAddFile: (fileName: string) => void;
@@ -831,7 +831,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
831
831
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
832
832
  };
833
833
  dispose: () => void | undefined;
834
- context: import("@volar/language-service").LanguageServicePluginContext;
834
+ context: import("@volar/language-service").ServiceContext;
835
835
  };
836
836
  getLanguageServiceDontCreate: () => {
837
837
  triggerCharacters: string[];
@@ -879,7 +879,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
879
879
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
880
880
  };
881
881
  dispose: () => void | undefined;
882
- context: import("@volar/language-service").LanguageServicePluginContext;
882
+ context: import("@volar/language-service").ServiceContext;
883
883
  } | undefined;
884
884
  getParsedCommandLine: () => ts.ParsedCommandLine;
885
885
  tryAddFile: (fileName: string) => void;
@@ -980,7 +980,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
980
980
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
981
981
  };
982
982
  dispose: () => void | undefined;
983
- context: import("@volar/language-service").LanguageServicePluginContext;
983
+ context: import("@volar/language-service").ServiceContext;
984
984
  };
985
985
  getLanguageServiceDontCreate: () => {
986
986
  triggerCharacters: string[];
@@ -1028,7 +1028,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1028
1028
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1029
1029
  };
1030
1030
  dispose: () => void | undefined;
1031
- context: import("@volar/language-service").LanguageServicePluginContext;
1031
+ context: import("@volar/language-service").ServiceContext;
1032
1032
  } | undefined;
1033
1033
  getParsedCommandLine: () => ts.ParsedCommandLine;
1034
1034
  tryAddFile: (fileName: string) => void;
@@ -1126,7 +1126,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1126
1126
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1127
1127
  };
1128
1128
  dispose: () => void | undefined;
1129
- context: import("@volar/language-service").LanguageServicePluginContext;
1129
+ context: import("@volar/language-service").ServiceContext;
1130
1130
  };
1131
1131
  getLanguageServiceDontCreate: () => {
1132
1132
  triggerCharacters: string[];
@@ -1174,7 +1174,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1174
1174
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1175
1175
  };
1176
1176
  dispose: () => void | undefined;
1177
- context: import("@volar/language-service").LanguageServicePluginContext;
1177
+ context: import("@volar/language-service").ServiceContext;
1178
1178
  } | undefined;
1179
1179
  getParsedCommandLine: () => ts.ParsedCommandLine;
1180
1180
  tryAddFile: (fileName: string) => void;
@@ -1271,7 +1271,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1271
1271
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1272
1272
  };
1273
1273
  dispose: () => void | undefined;
1274
- context: import("@volar/language-service").LanguageServicePluginContext;
1274
+ context: import("@volar/language-service").ServiceContext;
1275
1275
  };
1276
1276
  getLanguageServiceDontCreate: () => {
1277
1277
  triggerCharacters: string[];
@@ -1319,7 +1319,7 @@ export declare function createWorkspace(context: WorkspaceContext): Promise<{
1319
1319
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1320
1320
  };
1321
1321
  dispose: () => void | undefined;
1322
- context: import("@volar/language-service").LanguageServicePluginContext;
1322
+ context: import("@volar/language-service").ServiceContext;
1323
1323
  } | undefined;
1324
1324
  getParsedCommandLine: () => ts.ParsedCommandLine;
1325
1325
  tryAddFile: (fileName: string) => void;
@@ -1,8 +1,8 @@
1
- import { ConfigurationHost } from '@volar/language-service';
1
+ import { ServiceEnvironment } from '@volar/language-service';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
3
  import * as vscode from 'vscode-languageserver';
4
4
  import { URI } from 'vscode-uri';
5
- import { FileSystemHost, LanguageServerInitializationOptions, LanguageServerPlugin } from '../types';
5
+ import { FileSystemHost, InitializationOptions, LanguageServerPlugin } from '../types';
6
6
  import { CancellationTokenHost } from './cancellationPipe';
7
7
  import { createDocuments } from './documents';
8
8
  import { ServerContext } from './server';
@@ -10,12 +10,12 @@ import * as path from 'typesafe-path';
10
10
  export interface WorkspacesContext {
11
11
  server: ServerContext;
12
12
  initParams: vscode.InitializeParams;
13
- initOptions: LanguageServerInitializationOptions;
13
+ initOptions: InitializationOptions;
14
14
  plugins: ReturnType<LanguageServerPlugin>[];
15
15
  ts: typeof import('typescript/lib/tsserverlibrary') | undefined;
16
16
  tsLocalized: ts.MapLike<string> | undefined;
17
17
  fileSystemHost: FileSystemHost | undefined;
18
- configurationHost: ConfigurationHost | undefined;
18
+ configurationHost: Pick<ServiceEnvironment, 'getConfiguration' | 'onDidChangeConfiguration'> | undefined;
19
19
  documents: ReturnType<typeof createDocuments>;
20
20
  cancelTokenHost: CancellationTokenHost;
21
21
  }
@@ -116,7 +116,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
116
116
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
117
117
  };
118
118
  dispose: () => void | undefined;
119
- context: import("@volar/language-service").LanguageServicePluginContext;
119
+ context: import("@volar/language-service").ServiceContext;
120
120
  };
121
121
  getLanguageServiceDontCreate: () => {
122
122
  triggerCharacters: string[];
@@ -164,7 +164,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
164
164
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
165
165
  };
166
166
  dispose: () => void | undefined;
167
- context: import("@volar/language-service").LanguageServicePluginContext;
167
+ context: import("@volar/language-service").ServiceContext;
168
168
  } | undefined;
169
169
  getParsedCommandLine: () => ts.ParsedCommandLine;
170
170
  tryAddFile: (fileName: string) => void;
@@ -262,7 +262,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
262
262
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
263
263
  };
264
264
  dispose: () => void | undefined;
265
- context: import("@volar/language-service").LanguageServicePluginContext;
265
+ context: import("@volar/language-service").ServiceContext;
266
266
  };
267
267
  getLanguageServiceDontCreate: () => {
268
268
  triggerCharacters: string[];
@@ -310,7 +310,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
310
310
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
311
311
  };
312
312
  dispose: () => void | undefined;
313
- context: import("@volar/language-service").LanguageServicePluginContext;
313
+ context: import("@volar/language-service").ServiceContext;
314
314
  } | undefined;
315
315
  getParsedCommandLine: () => ts.ParsedCommandLine;
316
316
  tryAddFile: (fileName: string) => void;
@@ -408,7 +408,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
408
408
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
409
409
  };
410
410
  dispose: () => void | undefined;
411
- context: import("@volar/language-service").LanguageServicePluginContext;
411
+ context: import("@volar/language-service").ServiceContext;
412
412
  };
413
413
  getLanguageServiceDontCreate: () => {
414
414
  triggerCharacters: string[];
@@ -456,7 +456,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
456
456
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
457
457
  };
458
458
  dispose: () => void | undefined;
459
- context: import("@volar/language-service").LanguageServicePluginContext;
459
+ context: import("@volar/language-service").ServiceContext;
460
460
  } | undefined;
461
461
  getParsedCommandLine: () => ts.ParsedCommandLine;
462
462
  tryAddFile: (fileName: string) => void;
@@ -554,7 +554,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
554
554
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
555
555
  };
556
556
  dispose: () => void | undefined;
557
- context: import("@volar/language-service").LanguageServicePluginContext;
557
+ context: import("@volar/language-service").ServiceContext;
558
558
  };
559
559
  getLanguageServiceDontCreate: () => {
560
560
  triggerCharacters: string[];
@@ -602,7 +602,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
602
602
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
603
603
  };
604
604
  dispose: () => void | undefined;
605
- context: import("@volar/language-service").LanguageServicePluginContext;
605
+ context: import("@volar/language-service").ServiceContext;
606
606
  } | undefined;
607
607
  getParsedCommandLine: () => ts.ParsedCommandLine;
608
608
  tryAddFile: (fileName: string) => void;
@@ -699,7 +699,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
699
699
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
700
700
  };
701
701
  dispose: () => void | undefined;
702
- context: import("@volar/language-service").LanguageServicePluginContext;
702
+ context: import("@volar/language-service").ServiceContext;
703
703
  };
704
704
  getLanguageServiceDontCreate: () => {
705
705
  triggerCharacters: string[];
@@ -747,7 +747,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
747
747
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
748
748
  };
749
749
  dispose: () => void | undefined;
750
- context: import("@volar/language-service").LanguageServicePluginContext;
750
+ context: import("@volar/language-service").ServiceContext;
751
751
  } | undefined;
752
752
  getParsedCommandLine: () => ts.ParsedCommandLine;
753
753
  tryAddFile: (fileName: string) => void;
@@ -844,7 +844,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
844
844
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
845
845
  };
846
846
  dispose: () => void | undefined;
847
- context: import("@volar/language-service").LanguageServicePluginContext;
847
+ context: import("@volar/language-service").ServiceContext;
848
848
  };
849
849
  getLanguageServiceDontCreate: () => {
850
850
  triggerCharacters: string[];
@@ -892,7 +892,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
892
892
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
893
893
  };
894
894
  dispose: () => void | undefined;
895
- context: import("@volar/language-service").LanguageServicePluginContext;
895
+ context: import("@volar/language-service").ServiceContext;
896
896
  } | undefined;
897
897
  getParsedCommandLine: () => ts.ParsedCommandLine;
898
898
  tryAddFile: (fileName: string) => void;
@@ -993,7 +993,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
993
993
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
994
994
  };
995
995
  dispose: () => void | undefined;
996
- context: import("@volar/language-service").LanguageServicePluginContext;
996
+ context: import("@volar/language-service").ServiceContext;
997
997
  };
998
998
  getLanguageServiceDontCreate: () => {
999
999
  triggerCharacters: string[];
@@ -1041,7 +1041,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1041
1041
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1042
1042
  };
1043
1043
  dispose: () => void | undefined;
1044
- context: import("@volar/language-service").LanguageServicePluginContext;
1044
+ context: import("@volar/language-service").ServiceContext;
1045
1045
  } | undefined;
1046
1046
  getParsedCommandLine: () => ts.ParsedCommandLine;
1047
1047
  tryAddFile: (fileName: string) => void;
@@ -1139,7 +1139,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1139
1139
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1140
1140
  };
1141
1141
  dispose: () => void | undefined;
1142
- context: import("@volar/language-service").LanguageServicePluginContext;
1142
+ context: import("@volar/language-service").ServiceContext;
1143
1143
  };
1144
1144
  getLanguageServiceDontCreate: () => {
1145
1145
  triggerCharacters: string[];
@@ -1187,7 +1187,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1187
1187
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1188
1188
  };
1189
1189
  dispose: () => void | undefined;
1190
- context: import("@volar/language-service").LanguageServicePluginContext;
1190
+ context: import("@volar/language-service").ServiceContext;
1191
1191
  } | undefined;
1192
1192
  getParsedCommandLine: () => ts.ParsedCommandLine;
1193
1193
  tryAddFile: (fileName: string) => void;
@@ -1284,7 +1284,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1284
1284
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1285
1285
  };
1286
1286
  dispose: () => void | undefined;
1287
- context: import("@volar/language-service").LanguageServicePluginContext;
1287
+ context: import("@volar/language-service").ServiceContext;
1288
1288
  };
1289
1289
  getLanguageServiceDontCreate: () => {
1290
1290
  triggerCharacters: string[];
@@ -1332,7 +1332,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1332
1332
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1333
1333
  };
1334
1334
  dispose: () => void | undefined;
1335
- context: import("@volar/language-service").LanguageServicePluginContext;
1335
+ context: import("@volar/language-service").ServiceContext;
1336
1336
  } | undefined;
1337
1337
  getParsedCommandLine: () => ts.ParsedCommandLine;
1338
1338
  tryAddFile: (fileName: string) => void;
@@ -1434,7 +1434,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1434
1434
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1435
1435
  };
1436
1436
  dispose: () => void | undefined;
1437
- context: import("@volar/language-service").LanguageServicePluginContext;
1437
+ context: import("@volar/language-service").ServiceContext;
1438
1438
  };
1439
1439
  getLanguageServiceDontCreate: () => {
1440
1440
  triggerCharacters: string[];
@@ -1482,7 +1482,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1482
1482
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1483
1483
  };
1484
1484
  dispose: () => void | undefined;
1485
- context: import("@volar/language-service").LanguageServicePluginContext;
1485
+ context: import("@volar/language-service").ServiceContext;
1486
1486
  } | undefined;
1487
1487
  getParsedCommandLine: () => ts.ParsedCommandLine;
1488
1488
  tryAddFile: (fileName: string) => void;
@@ -1581,7 +1581,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1581
1581
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1582
1582
  };
1583
1583
  dispose: () => void | undefined;
1584
- context: import("@volar/language-service").LanguageServicePluginContext;
1584
+ context: import("@volar/language-service").ServiceContext;
1585
1585
  };
1586
1586
  getLanguageServiceDontCreate: () => {
1587
1587
  triggerCharacters: string[];
@@ -1629,7 +1629,7 @@ export declare function createWorkspaces(context: WorkspacesContext): {
1629
1629
  getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
1630
1630
  };
1631
1631
  dispose: () => void | undefined;
1632
- context: import("@volar/language-service").LanguageServicePluginContext;
1632
+ context: import("@volar/language-service").ServiceContext;
1633
1633
  } | undefined;
1634
1634
  getParsedCommandLine: () => ts.ParsedCommandLine;
1635
1635
  tryAddFile: (fileName: string) => void;
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver';
2
- import { FileSystemHost, LanguageServerInitializationOptions, RuntimeEnvironment } from '../types';
3
- export declare function createNodeFileSystemHost(ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities, env: RuntimeEnvironment, _initOptions: LanguageServerInitializationOptions): FileSystemHost;
2
+ import { FileSystemHost, InitializationOptions, RuntimeEnvironment } from '../types';
3
+ export declare function createNodeFileSystemHost(ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities, env: RuntimeEnvironment, _initOptions: InitializationOptions): FileSystemHost;
package/out/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { LanguageService, LanguageServiceOptions } from '@volar/language-service';
2
+ import { LanguageService, ServiceEnvironment } from '@volar/language-service';
3
3
  import * as embedded from '@volar/language-core';
4
4
  import type { FileSystemProvider } from 'vscode-html-languageservice';
5
5
  import type * as ts from 'typescript/lib/tsserverlibrary';
@@ -24,24 +24,23 @@ export interface RuntimeEnvironment {
24
24
  };
25
25
  onDidChangeConfiguration?: (settings: any) => void;
26
26
  fileSystemProvide: FileSystemProvider | undefined;
27
- createFileSystemHost: (ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities, env: RuntimeEnvironment, initOptions: LanguageServerInitializationOptions) => FileSystemHost;
27
+ createFileSystemHost: (ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities, env: RuntimeEnvironment, initOptions: InitializationOptions) => FileSystemHost;
28
28
  readonly timer: {
29
29
  setImmediate(callback: (...args: any[]) => void, ...args: any[]): vscode.Disposable;
30
30
  };
31
31
  }
32
- export interface LanguageServiceContext {
33
- project: ProjectContext;
34
- options: LanguageServiceOptions;
35
- host: embedded.LanguageServiceHost;
36
- sys: FileSystem;
37
- }
38
32
  export interface LanguageServerPlugin {
39
- (initOptions: LanguageServerInitializationOptions, modules: {
33
+ (initOptions: InitializationOptions, modules: {
40
34
  typescript?: typeof import('typescript/lib/tsserverlibrary');
41
35
  }): {
42
36
  extraFileExtensions?: ts.FileExtensionInfo[];
43
37
  watchFileExtensions?: string[];
44
- resolveConfig?(config: Config, ctx: LanguageServiceContext | undefined): Config;
38
+ resolveConfig?(config: Config, ctx: {
39
+ env: ServiceEnvironment;
40
+ project: ProjectContext;
41
+ host: embedded.LanguageServiceHost;
42
+ sys: FileSystem;
43
+ } | undefined): Config;
45
44
  onInitialized?(getLanguageService: (uri: string) => Promise<LanguageService | undefined>, env: RuntimeEnvironment): void;
46
45
  };
47
46
  }
@@ -55,7 +54,7 @@ export declare enum DiagnosticModel {
55
54
  Push = 1,
56
55
  Pull = 2
57
56
  }
58
- export interface LanguageServerInitializationOptions {
57
+ export interface InitializationOptions {
59
58
  typescript?: {
60
59
  /**
61
60
  * Absolute path to node_modules/typescript/lib
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "1.4.0",
3
+ "version": "1.5.0-alpha.0",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,8 +17,8 @@
17
17
  "directory": "packages/language-server"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-core": "1.4.0",
21
- "@volar/language-service": "1.4.0",
20
+ "@volar/language-core": "1.5.0-alpha.0",
21
+ "@volar/language-service": "1.5.0-alpha.0",
22
22
  "@vscode/l10n": "^0.0.11",
23
23
  "request-light": "^0.7.0",
24
24
  "typesafe-path": "^0.2.2",
@@ -28,5 +28,5 @@
28
28
  "vscode-languageserver-textdocument": "^1.0.8",
29
29
  "vscode-uri": "^3.0.7"
30
30
  },
31
- "gitHead": "9bf14ef0d08c53f9ae32cf538d9748fa91cc4ab7"
31
+ "gitHead": "a4e1b3766ccb5affe1613cad7630513b9073d275"
32
32
  }