Closed Liareth closed 2 years ago
You need a function declaration like int return_1();
and then it'll work
As Daz said, only functions with a declaration provide intellisense when included in an other file.
Thanks! But unfortunately it did not work for me:
Neither does struct completion, even in the same file:
This is on a fresh install of VS Code with the latest plugin. I've also never seen the "indexing files..." prompt that the README shows, even when opening a very large codebase. Is it possible I have to enable or activate something within VSCode other than installing the plugin? These are my settings:
{
"nwscript-ee-lsp.autoCompleteFunctionsWithParams": true,
"nwscript-ee-lsp.includeCommentsInFunctionsHover": true,
"nwscript-ee-lsp.formatter": {
"enabled": true,
"executable": "clang-format"
},
"files.associations": {
"*.nss": "nwscript"
},
"[nwscript]": {
"editor.defaultFormatter": "PhilippeChab.nwscript-ee-language-server",
"editor.formatOnSave": true,
},
"editor.detectIndentation": false,
}
Note: Function intellisense does appear to work within the same file:
I also tried on my work computer just now and got the same result following these steps:
main.nss
#include "inc_main.nss"
void main()
{
}
inc_main.nss
int return_1();
int return_1() { return 1; }
main.nss
for function in inc_main.nss
nor for structs defined in main.nss
.Oh, you need to do #include "inc_main"
without the extension
And for structs, it needs the struct
type in the variable declaration: struct TestStruct str;
Thanks Daz. Ignore me, I'm just an idiot who is apparently trying her best to violate every single rule of nwscript. May this issue serve as a reminder for any other poor souls that come in the future: REMOVE THE .NSS FROM YOUR INCLUDES!
I've had great success with nwscript indexing and completion and code formatting but nss indexing for my code does not appear to work!
I'd love to debug this myself but I'm not quite sure where to start. I didn't see any obvious errors anywhere in VSCode to indicate there might be an issue.