Skip to content

Commit aa9d43f

Browse files
committed
Remove the InitializableService interface
1 parent c57ad41 commit aa9d43f

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

packages/langium/src/services.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
// Ensure that all imports are erased at runtime to avoid circular dependencies.
88
import type { IParserErrorMessageProvider } from 'chevrotain';
9-
import type { InitializeParams, InitializedParams } from 'vscode-languageserver-protocol';
109
import type { CommentProvider } from './documentation/comment-provider.js';
1110
import type { DocumentationProvider } from './documentation/documentation-provider.js';
1211
import type { Grammar } from './languages/generated/ast.js';
@@ -26,7 +25,6 @@ import type { ScopeProvider } from './references/scope-provider.js';
2625
import type { JsonSerializer } from './serializer/json-serializer.js';
2726
import type { ServiceRegistry } from './service-registry.js';
2827
import type { AstReflection } from './syntax-tree.js';
29-
import type { MaybePromise } from './utils/promise-utils.js';
3028
import type { DocumentValidator } from './validation/document-validator.js';
3129
import type { ValidationRegistry } from './validation/validation-registry.js';
3230
import type { AstNodeDescriptionProvider, ReferenceDescriptionProvider } from './workspace/ast-descriptions.js';
@@ -40,15 +38,6 @@ import type { WorkspaceLock } from './workspace/workspace-lock.js';
4038
import type { Hydrator } from './serializer/hydrator.js';
4139
import type { WorkspaceManager } from './workspace/workspace-manager.js';
4240

43-
export type {
44-
InitializeParams, InitializedParams
45-
};
46-
47-
export interface InitializableService {
48-
initialize(params: InitializeParams): void
49-
initialized(params: InitializedParams): MaybePromise<void>
50-
}
51-
5241
/**
5342
* The services generated by `langium-cli` for a specific language. These are derived from the
5443
* grammar definition and the language configuration.

packages/langium/src/workspace/configuration.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,29 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7-
import type { ConfigurationItem, DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions } from 'vscode-languageserver-protocol';
7+
import type {
8+
ConfigurationItem, DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions, InitializeParams,
9+
InitializedParams
10+
} from 'vscode-languageserver-protocol';
811
import type { ServiceRegistry } from '../service-registry.js';
9-
import type { InitializableService, InitializeParams, InitializedParams, LangiumSharedCoreServices } from '../services.js';
12+
import type { LangiumSharedCoreServices } from '../services.js';
1013

1114
/* eslint-disable @typescript-eslint/no-explicit-any */
1215

13-
export interface ConfigurationProvider extends InitializableService {
16+
export interface ConfigurationProvider {
17+
18+
/**
19+
* When used in a language server context, this method is called when the server receives
20+
* the `initialize` request.
21+
*/
22+
initialize(params: InitializeParams): void;
23+
24+
/**
25+
* When used in a language server context, this method is called when the server receives
26+
* the `initialized` notification.
27+
*/
28+
initialized(params: ConfigurationInitializedParams): Promise<void>;
29+
1430
/**
1531
* Returns a configuration value stored for the given language.
1632
*

packages/langium/src/workspace/workspace-manager.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7+
import type { InitializeParams, InitializedParams } from 'vscode-languageserver-protocol';
78
import type { WorkspaceFolder } from 'vscode-languageserver-types';
89
import type { ServiceRegistry } from '../service-registry.js';
9-
import type { InitializableService, InitializeParams, InitializedParams, LangiumSharedCoreServices } from '../services.js';
10+
import type { LangiumSharedCoreServices } from '../services.js';
1011
import { CancellationToken } from '../utils/cancellation.js';
1112
import { interruptAndCheck } from '../utils/promise-utils.js';
1213
import { URI, UriUtils } from '../utils/uri-utils.js';
@@ -23,11 +24,23 @@ export type { WorkspaceFolder };
2324
* The workspace manager is responsible for finding source files in the workspace.
2425
* This service is shared between all languages of a language server.
2526
*/
26-
export interface WorkspaceManager extends InitializableService {
27+
export interface WorkspaceManager {
2728

2829
/** The options used for the initial workspace build. */
2930
initialBuildOptions: BuildOptions | undefined;
3031

32+
/**
33+
* When used in a language server context, this method is called when the server receives
34+
* the `initialize` request.
35+
*/
36+
initialize(params: InitializeParams): void;
37+
38+
/**
39+
* When used in a language server context, this method is called when the server receives
40+
* the `initialized` notification.
41+
*/
42+
initialized(params: InitializedParams): Promise<void>;
43+
3144
/**
3245
* Does the initial indexing of workspace folders.
3346
* Collects information about exported and referenced AstNodes in

0 commit comments

Comments
 (0)