/** * Custom DocumentSymbolProvider for DomainLang. * * Extends Langium's DefaultDocumentSymbolProvider to add meaningful * `detail` text to outline items, improving the Outline view, breadcrumbs, * and Go to Symbol experience. * * The default provider handles the full AST walk, child nesting, and * range computation. We only override `getSymbol` to enrich the detail * property with DDD-relevant information (descriptions, visions, counts). * * @module lsp/domain-lang-document-symbol-provider */ import type { AstNode, LangiumDocument } from 'langium'; import { DocumentSymbol } from 'vscode-languageserver'; import { DefaultDocumentSymbolProvider } from 'langium/lsp'; /** * Enriches document symbols with DDD-specific detail text and grouping. * * Detail text shown in the Outline view next to each symbol: * - Domain: vision or description * - BoundedContext: description or domain name * - ContextMap: number of contained contexts * - DomainMap: number of contained domains * - Namespace: qualified namespace name * - Relationship: formatted endpoint summary (e.g., "OrderContext -> PaymentContext") * * Grouping: Creates synthetic folder nodes for collections in the grammar: * - BoundedContext: decisions, terminology, relationships, metadata * * Note: Relationship and MetadataEntry symbols are created manually (not via NameProvider) * to avoid polluting the global scope/reference system. These are display-only synthetic symbols. */ export declare class DomainLangDocumentSymbolProvider extends DefaultDocumentSymbolProvider { protected getSymbol(document: LangiumDocument, astNode: AstNode): DocumentSymbol[]; /** * Override to add synthetic grouping folders for collections. * Groups decisions, terminology, relationships, and metadata under folder nodes. */ protected getChildSymbols(document: LangiumDocument, astNode: AstNode): DocumentSymbol[] | undefined; /** Adds decisions folder if collection is non-empty. */ private addDecisionsFolder; /** Adds terminology folder if collection is non-empty. */ private addTerminologyFolder; /** Adds relationships folder with manually created symbols. */ private addRelationshipsFolder; /** Adds metadata folder with manually created symbols. */ private addMetadataFolder; /** * Creates a synthetic folder DocumentSymbol for grouping children. */ private createFolderSymbol; /** * Creates a DocumentSymbol for a Relationship node. */ private createRelationshipSymbol; /** * Creates a DocumentSymbol for a MetadataEntry node. */ private createMetadataSymbol; /** * Returns DDD-specific detail text for a given AST node. * Shown alongside the symbol name in the Outline view. */ private getDetailText; /** Builds BC detail: "BC for DomainName — description". */ private getBcDetail; /** Returns "N item(s)" or undefined when count is 0. */ private pluralize; /** * Formats a relationship as a compact detail string: * e.g., "OrderContext -> PaymentContext" */ private formatRelationshipDetail; /** * Gets a display name from a BoundedContextRef. */ private getRefName; }