This is a simple command line tool that some scripters using Visual Studio Code to write their scripts may find useful.
What I always missed in VSC was intellisense or even a simpler form of autocomplete. NSSnippets lets you quickly generate snippets from function headers and constant declarations found in nwscript.nss, the script you are working on and in any includes directly used by it.
You use the tool as follows:
./NSSnippets <path to nwscript.nss> <path to your script> <path to the directory containing includes of your script> <path to VSC nwscript.json file with custom snippets>
You can (and probably should) add the tool to your custom VSC tasks and then add a key shortcut to run it. Then you can reload your snippets with a single keystroke to get suggestions relevant to the script you're working on and the includes it has.
Features (as of version 1.1):
-support for function headers and constants
-support for NWScript native API (nwscript.nss) and custom includes
-support for function descriptions/summaries
-support for the sqlquery type
Limitations (as of version 1.1):
-you need to reload the snippets to update them based on the includes (but it's not a big problem if you have it mapped to a shortcut)
-at this stage it won't properly recognize some valid function/constant declarations (such as a function header written across multiple lines or a few constants defined at once and separated with a coma)
-it only gives suggestions based on the script's includes and not includes of the includes, etc (but this is deliberate, because it gives you greater control of what suggestions you want and you often don't need the includes of your includes)
-lack of support for built-in includes such as "x3_inc_string" unless they're extracted (because it expects the include script to be present in the module directory)
I haven't tested the Windows version, but it should work. The source code is extremely basic (not to use the phrase "hastily and badly written"), but it can be found in https://gitlab.com/Taro94/nwscript-snippets/-/tree/master/NSSnippets. I may make it a bit more elegant in the future, but I probably won't, at least unless I decide to make a new version with new features or bugfixes.
Attachment | Size |
---|---|
![]() | 7.59 MB |
![]() | 8.09 MB |
Awesome
So far I have not been able to launch this, but respect and health to you are a kind person!
Without VSC, I would die))
What is the problem you're having? Also, are you trying it on Windows or Linux? Admittedly, I never bothered to test if the Windows version works, but it's .NET Core, it should. :)
Win10. Understood, launched ...
This thing ruined my snippet. Painfully.
Not deadly.
There are nitpicking to the result, but in general, as I wrote earlier - great! Thanks!