trouble with env_path in (n)vim
So followed the instructions from the wiki on how to use the langserver in nvim and it worked straight away except for one thing.
The environment being used was always the base dir even if there was a Project.toml file in the directory in which I opened nvim (this dir was also reported as the "LC project root").
Hardcoding the path in the config worked so it looks like dirname(Pkg.Types.Context().env.project_file) is not being run in the same dir as nvim.
I've been using coc.nvim and ran into this at first too. If it helps, I've gotten a measure of success with the following in my config (open with :CocConfig)
{
"languageserver": {
"julia": {
"command": "julia",
"args" : [
"--project=.",
"--startup-file=no",
"--history-file=no",
"-e",
"using LanguageServer;\nusing Pkg;\nimport StaticLint;\nimport SymbolServer;\nenv_path = dirname(Pkg.project().path);\nserver = LanguageServer.LanguageServerInstance(stdin, stdout, env_path);\nserver.runlinter = true;\nrun(server);"
],
"filetypes": ["julia"]
}
}
}
I always open nvim in my project directory so --project=. is a reasonable assumption for me. It sounds like you're doing the same, so it might be worth a shot.
Thanks for your reply. Unfortunately that did not work for me. coc.nvim was recently updated and now it does find the dependencies. I still cannot get it to recognize modules or functions defined in sibling dirs though