nim-lang / langserver

The Nim language server implementation (based on nimsuggest)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear how to configure project-specific settings on neovim

michaelnew opened this issue · comments

If I have a main.nimble file in my project directory and if I open main.nim, everything works as expected. If I try to open otherfile.nim I get this error:

In orde to get the IDE features working you must either configure nim.projectMapping or import the module.

(and yes there's a typo in "order"). I assume that I need to configure nim.projectMapping, but I have no idea where that's supposed to go. Is there a specific file that I need to create? I assume that for vscode the file is .vscode/settings.json, but I'm using neovim.

That is a question for the client, not the server.

Okay, just putting this here for anyone else struggling with it. I was using nimlsp to set up the language server, and apparently there's different ways of doing project-local settings. It sounds like this is sometimes handled by the language server itself (lua-language-server does this), but not always. I tried the plugin nlsp-settings but did not have much luck with it.

I ended up switching to coc, and after setting up the server was able to create a local settings file with :CocLocalConfig and setting the nim.projectMapping like mentioned in the readme.

TBH I don't really understand why I have to configure projectMapping to get the the language server running on otherfile.nim (or import it from main.nim), but the whole thing is a bit beyond me. It's at least working with the local config.

EDIT: nope, never mind the local settings aren't loaded. I have no idea how this shit works. It seems like it's loading the local config but the server still complains about nim.projectMapping.