Skip to content

Commit

Permalink
Release 0.2.3
Browse files Browse the repository at this point in the history
- see changelog
  • Loading branch information
babyraging committed Apr 30, 2020
1 parent 44f75e6 commit f8ba78c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Added
- Added override predefined symbol detection (yacc)
- Added predefined symbols to completion (yacc)

### Changed
- Changed default value for rules region range (lex/yacc)
Expand Down
18 changes: 12 additions & 6 deletions src/languages/services/yaccCompletions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TextDocument, CompletionList, CompletionItem, CompletionItemKind, Position } from 'vscode';
import { YACCDocument, NodeType } from '../parser/yaccParser';
import { YACCDocument, NodeType, predefined } from '../parser/yaccParser';
import { createScanner } from '../parser/yaccScanner';
import { TokenType } from '../yaccLanguageTypes';

Expand Down Expand Up @@ -51,24 +51,30 @@ export function doYACCComplete(document: TextDocument, position: Position, yaccD
if (node.nodeType === NodeType.Type)
Object.keys(yaccDocument.symbols).forEach((symbol) => {
completion = new CompletionItem(symbol)
completion.detail = "symbol";
completion.detail = "user defined non-terminal";
completion.kind = CompletionItemKind.Class;
result.push(completion);
});
break;
case NodeType.Rule:
Object.keys(yaccDocument.symbols).forEach((symbol) => {
completion = new CompletionItem(symbol)
completion.detail = "symbol";
completion.detail = "user defined non-terminal";
completion.kind = CompletionItemKind.Class;
result.push(completion);
})
});
Object.keys(yaccDocument.tokens).forEach((token) => {
completion = new CompletionItem(token)
completion.detail = "token";
completion.detail = "user defined token";
completion.kind = CompletionItemKind.Field;
result.push(completion);
})
});
Object.keys(predefined).forEach(key => {
completion = new CompletionItem(key)
completion.detail = "predefined symbol";
completion.kind = CompletionItemKind.Method;
result.push(completion);
});
break;
default:
break;
Expand Down

0 comments on commit f8ba78c

Please sign in to comment.