PhilippeChab / nwscript-ee-language-server

A NWScript Language Server.
https://marketplace.visualstudio.com/items?itemName=PhilippeChab.nwscript-ee-language-server
MIT License
20 stars 7 forks source link

nss indexing does not appear to work #24

Closed Liareth closed 2 years ago

Liareth commented 2 years ago

I've had great success with nwscript indexing and completion and code formatting but nss indexing for my code does not appear to work!

image

image

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.

Daztek commented 2 years ago

You need a function declaration like int return_1(); and then it'll work

PhilippeChab commented 2 years ago

As Daz said, only functions with a declaration provide intellisense when included in an other file.

Liareth commented 2 years ago

Thanks! But unfortunately it did not work for me:

nocompletion1

Neither does struct completion, even in the same file:

nocompletion2

nocompletion3

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,
}
Liareth commented 2 years ago

Note: Function intellisense does appear to work within the same file:

image

Liareth commented 2 years ago

I also tried on my work computer just now and got the same result following these steps:

#include "inc_main.nss"

void main()
{
}
int return_1();

int return_1() { return 1; }
Daztek commented 2 years ago

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;

Liareth commented 2 years ago

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!