Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bbj-vscode/src/language/bbj-completion-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ export class BBjCompletionProvider extends DefaultCompletionProvider {
return super.getCompletion(document, params, cancelToken);
}

protected async getFieldCompletion(document: LangiumDocument, params: CompletionParams): Promise<CompletionList> {
protected async getFieldCompletion(document: LangiumDocument, params: CompletionParams): Promise<CompletionList | undefined> {
// Get cursor position (the # has already been typed)
const offset = document.textDocument.offsetAt(params.position);
const rootNode = document.parseResult.value;

// Find the leaf node at the # character position (cursor is after #, so offset - 1)
if (!rootNode.$cstNode) {
return { items: [], isIncomplete: false };
return undefined;
}
const leafNode = findLeafNodeAtOffset(rootNode.$cstNode, offset - 1);

if (!leafNode) {
return { items: [], isIncomplete: false };
return undefined;
}

// Check if cursor is inside a class method body
Expand All @@ -46,7 +46,7 @@ export class BBjCompletionProvider extends DefaultCompletionProvider {

if (!method || !klass) {
// Not inside a class method — don't provide field completion
return { items: [], isIncomplete: false };
return undefined;
}

// Collect fields from the class and its inheritance hierarchy
Expand Down