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

Jump to definition not working between files #25

Closed
prassee opened this issue Apr 24, 2020 · 21 comments
Closed

Jump to definition not working between files #25

prassee opened this issue Apr 24, 2020 · 21 comments

Comments

@prassee
Copy link

prassee commented Apr 24, 2020

I'm uisng the latest master with Julia 1.4. Basic LSP functions do work but the jumpt to definition and find references. In case of definitions, I can within the file but not to functions or variables defined in other files.

I got the following warning message

Warning (lsp-mode): Failed to process xref entry for filename ’’: Read error: Is a directory, /data/dataworkspace/vamana-ts-modelling

@gdkrmr
Copy link
Owner

gdkrmr commented Apr 25, 2020

Does it work with Julia 1.3? Julia 1.4 support does not work properly yet. How did you install lsp-julia?

@prassee
Copy link
Author

prassee commented Apr 26, 2020

I used (https://github.com/gdkrmr/lsp-julia) clone of lsp-julia to try with Julia1.4 (since gdkrmr repo seems to use the latest LangServer).
OTTH, while using this repo I got the same error with Julia 1.3.

I installed lsp-julia by cloning https://github.com/non-Jedi/lsp-julia repo and adding to lsp-julia.jl to the loadpath of emacs.

@prassee
Copy link
Author

prassee commented Apr 30, 2020

just curious to know any updates about this

@prassee
Copy link
Author

prassee commented Apr 30, 2020

I have created another issue I found after updating to the latest code - #27

@gdkrmr
Copy link
Owner

gdkrmr commented Apr 30, 2020

For me https://github.com/non-Jedi/lsp-julia works with julia 1.3 and https://github.com/gdkrmr/lsp-julia works with 1.4 (haven't done any tests with 1.3) but flycheck integration does not work, which is why I haven't merged yet.

@ghost
Copy link

ghost commented May 1, 2020

I'm also facing the same issue with the following

  • Julia 1.3.1
  • lsp-julia installed via quelpa
  • Emacs 26.3

What works?

  • autocompletion
  • jump to definition (with in the file)

What not works

  • jump to definition outside the file for eg. those included in to scope via include means files included with in a project. However it works for those added as a Pkg dependency.

@gdkrmr
Copy link
Owner

gdkrmr commented May 2, 2020

what is the exact version of lsp-julia? The one from https://github.com/gdkrmr/lsp-julia currently has issues.

@ghost
Copy link

ghost commented May 3, 2020

I'm using non-jedi version https://github.com/non-Jedi/lsp-julia

@gdkrmr
Copy link
Owner

gdkrmr commented May 3, 2020

that works fine for me. Sometimes LanguageServer.jl doesn't find the symbol. But seems to be a current limitation of LanguageServer.jl

@ghost
Copy link

ghost commented May 4, 2020

I dont think so as the more specific case is
let say I include utils.jl file in main.jl

util.jl


function to_upper(x::String)::String
     return uppercase(x)
end

main.jl

include("utils.jl")

lang = "julia"
lang = to_upper(lang)
to_lower(lang)

function to_lower(x::String)
    return lower_case(x)
end

In the above code, my specific issue is jump-to-definition :-

but works for

  • to_lower

doesn't work for

  • include("utils.jl")
  • to_upper(lang)

and ends up with a warning

Warning (lsp-mode): Failed to process xref entry for filename ’’: Read error: Is a directory

However the same behaviour works in VSCode hence it should not be issue from LanguageServer. Based on the warning message, I guess lsp-julia could not infer the mapping between functions and the respective files where they are defined.

OTTH, jump-to-definition works for all the modules where are loaded in to LOAD_PATH.

Hope I made it clear for everyone.
(Note :- I've also tried https://github.com/non-Jedi/eglot-jl and observed the same behavior as explained above.)

@non-Jedi
Copy link
Collaborator

non-Jedi commented May 5, 2020

Hi @prasannakog thanks for the good reproducer. For anyone else following along, the main.jl/utils.jl example above actually works inside a package, but it fails outside of a package because LanguageServer.jl uses a uri of "file://utils.jl" if outside of a package. I will file an issue with upstream.

@prassee
Copy link
Author

prassee commented May 5, 2020

Hi @prasannakog thanks for the good reproducer. For anyone else following along, the main.jl/utils.jl example above actually works inside a package, but it fails outside of a package because LanguageServer.jl uses a uri of "file://utils.jl" if outside of a package. I will file an issue with upstream.

Thanks @non-Jedi for taking this forward. I should have attached the json-log in my issue desc I would try to give as much as details if I found any in the future.

@ghost
Copy link

ghost commented Jun 1, 2020

looks like the related issue on the upstream repo got fixed , just curious to know any updates.

@ghost
Copy link

ghost commented Jul 9, 2020

@non-Jedi any updated on this

@non-Jedi
Copy link
Collaborator

non-Jedi commented Jul 9, 2020

That's up to @gdkrmr to update the versions bundled with lsp-julia. It's fixed upstream.

@ghost
Copy link

ghost commented Jul 9, 2020

Thanks ... but @gdkrmr fork of lsp-julia doesn't have issues feature enabled.

@non-Jedi
Copy link
Collaborator

non-Jedi commented Jul 9, 2020

He maintains this repo as well

@gdkrmr
Copy link
Owner

gdkrmr commented Jul 9, 2020

I am maintaining this repository and use my fork as the development version. master on my repo is currently not working without issues. I would have merged it a long time ago. There were/are numerous open issues on lsp-mode and LanguageServer.jl to figure this out and some patches have been merged but without success. The whole thing seems to be the communication between lsp-mode and LanguageServer.jl and I am not knowledgeable in the lsp specification. If you want to contribute, @prasannakog, I suggest you start at figuring out what about the communication between eglot <-> LanguagServer.jl or vscode <-> LanguageServer.jlis different from lsp-mode <-> LanguageServer.jl.

@gdkrmr
Copy link
Owner

gdkrmr commented Aug 27, 2020

Is this working now? Please update according to #20 (comment) and report back.

@spraharsh
Copy link

It solved the issue for me. It might help to make lsp-julia-default-environment to "~/.julia/environments/v1.5" so that users may not need to go down the rabbit hole. Thank you!

@gdkrmr
Copy link
Owner

gdkrmr commented Sep 4, 2020

Yes, I don't really have a good solution for setting the default environment. I guess the solution is to query julia --version.

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

4 participants