From 2bfc044dc31fb925fe402a1c9edb5a2fc94a6d73 Mon Sep 17 00:00:00 2001 From: Matt Jackson Date: Thu, 18 Jul 2024 09:50:31 -0400 Subject: [PATCH] Node Kind Provider Fix (#1580) * updated default class (NodeKindProvider) methods to align with interface signature argument types * marked default method arguments unused and touched up javadocs * jsdoc cleanup - removed @inherritdoc and type information --- packages/langium/src/lsp/node-kind-provider.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/langium/src/lsp/node-kind-provider.ts b/packages/langium/src/lsp/node-kind-provider.ts index 3ce6d7eb4..ef627e656 100644 --- a/packages/langium/src/lsp/node-kind-provider.ts +++ b/packages/langium/src/lsp/node-kind-provider.ts @@ -13,19 +13,33 @@ import { CompletionItemKind, SymbolKind } from 'vscode-languageserver'; export interface NodeKindProvider { /** * Returns a `SymbolKind` as used by `WorkspaceSymbolProvider` or `DocumentSymbolProvider`. + * @param node AST node or node description. + * @returns The corresponding symbol kind. */ getSymbolKind(node: AstNode | AstNodeDescription): SymbolKind; /** * Returns a `CompletionItemKind` as used by the `CompletionProvider`. + * @param node AST node or node description. + * @returns The corresponding completion item kind. */ getCompletionItemKind(node: AstNode | AstNodeDescription): CompletionItemKind; } +/** + * Default implementation of the `NodeKindProvider` interface. + * @remarks This implementation returns `SymbolKind.Field` for all nodes and `CompletionItemKind.Reference` for all nodes. Extend this class to customize symbol and completion types your langauge. + */ export class DefaultNodeKindProvider implements NodeKindProvider { - getSymbolKind(): SymbolKind { + /** + * @remarks The default implementation returns `SymbolKind.Field` for all nodes. + */ + getSymbolKind(_node: AstNode | AstNodeDescription): SymbolKind { return SymbolKind.Field; } - getCompletionItemKind(): CompletionItemKind { + /** + * @remarks The default implementation returns `CompletionItemKind.Reference` for all nodes. + */ + getCompletionItemKind(_node: AstNode | AstNodeDescription): CompletionItemKind { return CompletionItemKind.Reference; } }