Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server process spawned on home not project root #5

Open
ericdallo opened this issue Nov 16, 2022 · 10 comments
Open

server process spawned on home not project root #5

ericdallo opened this issue Nov 16, 2022 · 10 comments

Comments

@ericdallo
Copy link
Member

testing with clojure-lsp, it seems that the process is being sapwned from my home dir and not the project root, this probably shows a bug on server side, but other servers may rely on the same

@gagbo
Copy link

gagbo commented Nov 16, 2022

I think I encountered the same with rust-analyzer, but to be sure to repro I'll need to make sure that I can log the folder that's been chosen, I just assumed I had weird Doom shenanigans, and it might still be the case tbh

In upstream Emacs, the process is spawned in default-directory as working dir ? Is that what we need to check for the fork?

@ericdallo
Copy link
Member Author

ericdallo commented Nov 17, 2022

I think so @gagbo , I made a commit on clojure-lsp fixing this on server side, but it'd be nice to follow same emacs standard to avoid issues indeed

@acowley
Copy link

acowley commented Dec 13, 2022

I am experiencing something that seems like it may be related. The error message I'm seeing with rust-analyzer is,

LSP :: rust-analyzer failed to load workspace: "cargo" "--version" failed: No such file or directory (os error 2)

I use direnv to setup development environments, and it seems like emacs-lsp is finding rust-analyzer (which is supplied by direnv in the project directory), but then starting rust-analyzer itself in the wrong directory.

@gagbo
Copy link

gagbo commented Dec 13, 2022

os error 2 is "file not found", and given that the command that errored is cargo --version, I suspect that your setup doesn't give a path where cargo is found by Emacs, rather than rust-analyzer

@acowley
Copy link

acowley commented Dec 13, 2022

Yes, but emacs is finding rust-analyzer which is only available with direnv in the project directory (rust-analyzer and cargo are provisioned via nix). So somehow the server initialization is getting started in the right directory with the right PATH, and is then going wrong.

I have no such issues with the main branch of emacs.

@yyoncho
Copy link
Member

yyoncho commented Dec 13, 2022

I think it is caused by the fact that we don't propagate the emacs env. Which ATM is kind of expected with the code as it is.

@acowley
Copy link

acowley commented Dec 13, 2022

Yes, I thought it was interesting how clearly the error message suggested that given the direnv interaction. Is the needed change to fill out the SSP_Opts value in json-rpc-connection?

@yyoncho
Copy link
Member

yyoncho commented Dec 13, 2022

If you mean envp in SSP_Opts - I believe the answer is yes.

@andresilva
Copy link

Is there any temporary/easy workaround for this? My setup is the same as @acowley with direnv, so I'd need env to be propagated.

@sophicshift
Copy link

I'm probably facing the same issue with lean4, the server complains about unknown project files/modules as if it was spawned in the same directory as the emacs process (instead of default-directory). One simple workaround is to start the emacs process in the project directory itself, the server works perfectly in this setting but it has the caveat I need one emacs process per project. The issue is not present in upstream emacs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants