vscode-abl icon indicating copy to clipboard operation
vscode-abl copied to clipboard

Reuse the DocumentSymbolProvider implementation to provider Code completion

Open chriscamicas opened this issue 6 years ago • 6 comments

We should be able to implement a minimal code completion service with the symbol already extracted with the document symbol provider https://code.visualstudio.com/api/references/vscode-api#CompletionItemProvider

chriscamicas avatar Apr 09 '19 12:04 chriscamicas

@mscheblein what do you think ?

chriscamicas avatar Apr 09 '19 12:04 chriscamicas

One would need to figure out what type of code fragment the user is editing to present a filtered list of symbols. Symbol Provider cant do that, but i think the code may be modified to do that. Another Problem is that a lot of ABL specific stuff (Buffers, Frame, Menue ...) are just defined as vscode.SymbolKind.Object, as VS does not provide appropriate Symbols. We might have to add more Symbols (in an Upgrade Save way).

mscheblein avatar Apr 10 '19 10:04 mscheblein

a filtered list can come in a second time We should split the parser code from the classification. The parser would identify ABL objects with their real type/nature (Buffers, Frame, etc.), and the SymbolProvider could then categorize them differently (Buffer+Frame=> Object)

chriscamicas avatar Apr 10 '19 10:04 chriscamicas

It appears that VSCode filters the CompletionItemList by whatever Character(s) the User has entered. The most simple implementation is to just return the name of the Symbols generated by the SymbolProvider. I will try this out, should be easy enough.

mscheblein avatar Apr 12 '19 08:04 mscheblein

This was easier than expected. My Branch https://github.com/mscheblein/vscode-abl/tree/CodeCompletion now has simple but working code completion.

mscheblein avatar Apr 12 '19 11:04 mscheblein

Brilliant! great job, I tested it, it works just fine for variables but not for 'object' such as TempTable or Buffer, and I just found out why, I think you could treat vscode.SymbolKind.Object as a vscode.CompletionItemKind.Variable (Javascript object are considered variables too) in the ParseType2ItemKind function.

I think, we should continue this discussion in a PR.

chriscamicas avatar Apr 12 '19 12:04 chriscamicas