Closed mkohlhaas closed 2 years ago
It looks like your editor is incorrectly configured regarding the workspace root, are you using nvim-lspconfig per the README? In particular the root_dir should be set correctly
I don't use neovim so I don't know how this works, but regardless of editing a file nested inside .spago, you should connect to the language server with a workspace folder of the actual purescript project (the folder with output/
in).
The LSP output logs should show this: "Starting with cwd: [...] and using root path: [...]" which should let you confirm that the root directory is configured correctly.
(Edited the title, this has nothing to do with spago sources
, which you have actually confirmed was working correctly)
Thanks Nicolas,
I was investigating the problem a bit more and it seems to be a problem with nvim-lspconfig. I will open an issue over there.
As it seems I am one of the few who work with PureScript under Neovim. Visual Studio Code is much more popular these days.
Thanks a lot for your language server. Makes working with PureScript a lot easier.
Purerl is also an amazing project!
Neovim setup (with built in lsp implementation) should definitely be working, I'm aware of people who are using it - I'm happy to update the suggested config if there's any changes required. Not sure the best place to look for support for that configuration.
I could imagine that if the strategy is to traverse upwards looking for a spago.dhall/etc there is an issue inside .spago directory as those packages do have those files - in a vscode-like model where you edit code relative to some folder, that issue doesn't arise
Your imagination is spot on! :-)
Nicolas,
Michael from the nvim-lspconfig project is asking if setting the root directory to where the output
directory is, would solve the problem. I use PureScript only with Spago, so I'm not sure how it would work with other project schemes (Bower, ...).
So the question is: Would setting the root directory
to output
be the solution to the problem?
Thanks for your help!
That's not a general solution, because output
is configurable, but for a particular user, if you do not reconfigure output
, it's a pretty good indicator. However that will only be present if the project is already built, which will be a difference even in the working case today.
Otherwise you can have some random file that your projects use but is never checked into git for a dependency
As it seems the language server does not call
spago sources
when using Neovim.Steps to reproduce:
Then using
goto definition
forlog
works fine and jumps to source code in the.spago
directory. But then I get the following error:and further code navigation is not possible.
Language server configuration:
Code navigation with the same project in VS Code works perfectly fine!