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

Language server cannot detect all packages #3

Open
Zhizhou-Jia98 opened this issue May 18, 2024 · 5 comments
Open

Language server cannot detect all packages #3

Zhizhou-Jia98 opened this issue May 18, 2024 · 5 comments
Labels
external:lsp Related to LanguageServer.jl

Comments

@Zhizhou-Jia98
Copy link

Hi, thank you for develop this amazing Julia extension for Zed!
When I'm using the package "CairoMakie" the language server seems not to be able to detect this package and several other packages. However, when I ran runserver() in the "zed-julia" environment in the REPL, these packages were detected. I attached the LSP log from Zed and the output in the REPL. Can you please help me solve the problem? Thanks!
zed-lsp-log.txt
julia-runserver-output.txt

@piechologist
Copy link
Collaborator

Just guessing: can you check if the working directory is the same? Have a look at Zed's log (command zed: open log), you can see the working dir that's passed to the language server when it is starting.

@Zhizhou-Jia98
Copy link
Author

It might be a working directory problem? I tried to open up Zed using CLI at different directories. If I open up Zed at ~/.julia/environments/v1.10 (zed ~/.julia/environments/v1.10), the language server seems working and I can find the references for all packages. However, if I open up zed in another directory (e.g. zed ~/Research/rna-seq), it's still not working. I attached the log files for both success and failure cases, hope it helps.
dir_v1.10_successful.log
dir_another_failed.log

@piechologist
Copy link
Collaborator

Do you have a Project.toml that has CairoMakie somewhere in your ~/Research/... path? I think what's happening here is that the language server cannot find a reference to CairoMakie. You'd need to generate a Project.toml then.

On the other hand, CairoMakie is probably in your ~/.julia/environments/v1.10/Project.toml and that's why the language server is working there.

LanguageServer.jl is a tricky package. There are some threads over at discourse (in Tooling and Tooling/VSCode) about workarounds (and complaints 😬). TBH, I disabled the Julia LS, for me it's more trouble than help.

@Zhizhou-Jia98
Copy link
Author

Generating a Project.toml inside my working directory helped, thanks! It would be nice if the LS can look for packages in the default environment if there's no Project.toml in the working directory. Maybe disabling the Julia LS is a simpler solution :)

Thanks for your help!

@piechologist
Copy link
Collaborator

It would be nice if the LS can look for packages in the default environment if there's no Project.toml in the working directory.

I agree! Let's keep this issue open. I'm not sure if we could or should do this within the Zed extension. LanguageServer.jl would be the better place to implement this.

I'm glad it's working for you now!

@savq savq added the external:lsp Related to LanguageServer.jl label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external:lsp Related to LanguageServer.jl
Projects
None yet
Development

No branches or pull requests

3 participants