Skip to content

Commit

Permalink
adjust generator to setup lsp-based services, expose partials for these
Browse files Browse the repository at this point in the history
too
  • Loading branch information
montymxb committed Dec 7, 2023
1 parent d3b1ef8 commit 437c575
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/langium-cli/src/generator/module-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ export function generateModule(grammars: Grammar[], config: LangiumConfig, gramm
import type { LanguageMetaData } from '../../languages/language-meta-data${config.importExtension}';
import { ${config.projectName}AstReflection } from '../../languages/generated/ast${config.importExtension}';
import type { Module } from '../../dependency-injection${config.importExtension}';
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices } from '../../services${config.importExtension}';
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices } from '../../services${config.importExtension}';
import type { LangiumSharedServices, LangiumServices } from '../../lsp/lsp-services${config.importExtension}';
`.appendTemplateIf(hasIParserConfigImport)`
import type { IParserConfig } from '../../parser/parser-config${config.importExtension}';
`
).appendTemplateIf(!config.langiumInternal)`
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, LanguageMetaData, Module${hasIParserConfigImport ? ', IParserConfig' : ''} } from 'langium';
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LanguageMetaData, Module${hasIParserConfigImport ? ', IParserConfig' : ''} } from 'langium';
import type { LangiumSharedServices, LangiumServices } from 'langium/lsp';
import { ${config.projectName}AstReflection } from './ast${config.importExtension}';
`.appendTemplate`
Expand Down
14 changes: 12 additions & 2 deletions packages/langium/src/lsp/lsp-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,21 @@ export type LangiumSharedLSPServices = {
};

/**
* Language-specific services to be partially overridden via dependency injection.
* Language-specific LSP services to be partially overridden via dependency injection.
*/
export type PartialLangiumLSPServices = DeepPartial<LangiumLSPServices>

/**
* Shared services to be partially overridden via dependency injection.
* Language-specific services to be partially overridden via dependency injection.
*/
export type PartialLangiumServices = DeepPartial<LangiumServices>

/**
* Shared LSP services to be partially overridden via dependency injection.
*/
export type PartialLangiumSharedLSPServices = DeepPartial<LangiumSharedLSPServices>

/**
* Shared services to be partially overridden via dependency injection.
*/
export type PartialLangiumSharedServices = DeepPartial<LangiumSharedServices>

0 comments on commit 437c575

Please sign in to comment.