lego-spikeprime-mindstorms-vscode icon indicating copy to clipboard operation
lego-spikeprime-mindstorms-vscode copied to clipboard

Is it possible to use autocomplete for the spike libraries?

Open TravelTrader opened this issue 3 years ago • 9 comments

Thanks for this awesome tool. I recognized it for connecting the Remote Control to the Hub.

My question is just: Is it possible to use autocomplete for the spike libraries?

Thank you.

TravelTrader avatar Mar 06 '22 19:03 TravelTrader

Hey @TravelTrader , this is on my wish list too, but so far did not find a good way to achieve this...

PeterStaev avatar Mar 07 '22 12:03 PeterStaev

Can I help you in any way? I'm new with VSCode but I am coding for many years now. Maybe we can add this feature together in any way?

TravelTrader avatar Mar 07 '22 13:03 TravelTrader

Well, this is my first vscode extension as well 😄 Problem is I haven't found a way how to include custom language autocompletions in a plugin. Right now from what I understand they fully rely on the native language service that comes with the given language.

PeterStaev avatar Mar 11 '22 15:03 PeterStaev

Respect for this useful extension if it's your first. But I see the problem with the autocompletions. I'll tell you if I'd find anything, of course.

TravelTrader avatar Mar 12 '22 19:03 TravelTrader

Seems it might be possible to use python.autoComplete.extraPaths: https://code.visualstudio.com/docs/python/editing#_enable-intellisense-for-custom-package-locations

Not sure if it will be possible to create and distribute mock PY files with all the methods provided from the LEGO hub in the extension and then users to add the extraPaths settings to their workspace and point it to the directory within the plugin. Or even better - to have the extension auto append its autocomplete folder to the list when it is loaded.

PeterStaev avatar Apr 10 '22 12:04 PeterStaev

Hi!

We use an additional folder in the project directory. It describes all the classes and auto-completion works great. You can also describe functions in your language there.

Neko1993 avatar May 30 '22 13:05 Neko1993

For the spike library you can just put this file in the same folder as the program you're doing rn https://github.com/sanjayseshan/spikeprime-tools/blob/master/spiketools/hub/spike.py (I'm not sure if it has everything, but probably not since there is spike.control which can't be in the same file)

BlockOG avatar Jun 25 '22 15:06 BlockOG

For the spike library you can just put this file in the same folder as the program you're doing rn https://github.com/sanjayseshan/spikeprime-tools/blob/master/spiketools/hub/spike.py (I'm not sure if it has everything, but probably not since there is spike.control which can't be in the same file)

We use this for us and it does have all functions, just mixed together into one single file. We had to sort out control functions and move them into a seperate file, etc.

GSG-Robots avatar Dec 20 '23 13:12 GSG-Robots

@GSG-Robots and @PeterStaev the suggested work around using the 'spike.py' file also works with a 'mindstorms.py' file in the root directory.

Ruimtewese avatar Jan 01 '24 19:01 Ruimtewese