Skip to content

Commit

Permalink
Node Kind Provider Fix (#1580)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
snarkipus authored and msujew committed Aug 7, 2024
1 parent 6c602d5 commit 2bfc044
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/langium/src/lsp/node-kind-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 2bfc044

Please sign in to comment.