rokucommunity / vscode-brightscript-language

A Visual Studio Code extension for Roku's BrightScript language
MIT License
110 stars 41 forks source link

CompletionItem Work #68

Closed Romans-I-XVI closed 5 years ago

Romans-I-XVI commented 5 years ago

Hi, so I am in the process of switching over from Sublime to VSCode. In sublime I had a bunch of snippets just to help me remember what interface methods are available in BrightScript. I began working on porting those snippets over and turning them in to CompletionItem data as part of this extension. You can see the work I've done so far here -> https://github.com/Romans-I-XVI/vscode-brightscript-language/tree/adding-completion-items

So what I have going so far is to detect if the line ends with a particular interface and give available methods. It's not optimal as I don't usually explicitly type out the interface I'm referencing, but I wasn't sure how else to know what suggested completion items to return. So for instance code would need to be typed as such.

a = CreateObject("roAppManager")
a.ifAppManager.

After typing that "." after ifAppManager you would be given a drop-down of methods available to that interface.

You can see the general layout I have started in the fork I linked. My next steps are simply to work on implementing all available interface methods and the snippets & documentation for those methods. But before doing all that legwork I wanted to check in and see if there are already plans for how completion items will work, possibly in a more advanced way that what I have implemented as my implementation is pretty basic.

Thanks and best regards, Austin

TwitchBronBron commented 5 years ago

So I love this idea! as long as it doesn't produce false positives, I'm cool with your current approach.

In the medium-to-long-term, I hope to have a full language server written that would handle all of this auto completion stuff. However I would end up having to do all of the same legwork that you're doing anyway, so none of your work will be wasted. Doing it your way would definitely provide benefit to this extension which would hold us over until the language server is completed (I just started writing it 3 days ago, so it will be a while...)

So go for it, and let us know if there's any way we can help!

Romans-I-XVI commented 5 years ago

Oh ok awesome, I will continue work on it then and let you know if anything comes up.