non-Jedi / eglot-jl

Wrapper for using Julia LanguageServer.jl with emacs eglot
Creative Commons Zero v1.0 Universal
61 stars 11 forks source link

eglot not recognizing functions from installed libraries #25

Closed LarryLegend33 closed 2 years ago

LarryLegend33 commented 3 years ago

Hi

I've been successfully using eglot-jl on my macbook pro (11.5.1) for a year; i just upgraded to an M1 mac, and installed eglot-jl as previously. the Base library of julia shows code completion; however, any libraries installed into the local environment are flagged as having a Missing Reference. It seems like eglot isn't properly reading out the dependencies in the .toml files.

In large projects, this results in lots of "Missing Reference" flags from flymake. In a minimal example where I only installed Makie into the local environment, completion works for Base functions, but Flymake enters a "Wait" state and eglot reports "pending continuations" for Makie functions.

Thanks and let me know what you think.

LarryLegend33 commented 3 years ago

here's a stacktrace of an error that occurs after calling eglot-jl-init

(:id 2 :jsonrpc "2.0" :result (:signatures [] :activeSignature 0 :activeParameter 0)) [stderr] nil [server-reply] (id:3) Thu Aug 19 17:30:50 2021: (:id 3 :jsonrpc "2.0" :result nil) [stderr] nil [stderr] ERROR: MethodError: no method matching isinmanifest(::Pkg.Types.Manifest, ::Base.UUID) [stderr] Closest candidates are: [stderr] isinmanifest(!Matched::Pkg.Types.Context, ::Base.UUID) at /Users/nightcrawler/.julia/packages/SymbolServer/2m6sg/src/utils.jl:117 [stderr] isinmanifest(!Matched::Dict{Base.UUID, Pkg.Types.PackageEntry}, ::Base.UUID) at /Users/nightcrawler/.julia/packages/SymbolServer/2m6sg/src/utils.jl:118 [stderr] Stacktrace: [stderr] Stacktrace: [stderr] [1] load_package_from_cache_into_store! [stderr] @ ~/.julia/packages/SymbolServer/2m6sg/src/SymbolServer.jl:159 [inlined] [stderr] @ ~/.julia/packages/SymbolServer/2m6sg/src/SymbolServer.jl:159 [inlined] [stderr] nil [stderr] [2] load_project_packages_into_store!(ssi::SymbolServerInstance, environment_path::String, store::Dict{Symbol, SymbolServer.ModuleStore}) [stderr] @ SymbolServer ~/.julia/packages/SymbolServer/2m6sg/src/SymbolServer.jl:143 [stderr] [3] getstore(ssi::SymbolServerInstance, environment_path::String, progress_callback::LanguageServer.var"#94#96"{LanguageServerInstance}, error_handler::Nothing) [stderr] @ SymbolServer ~/.julia/packages/SymbolServer/2m6sg/src/SymbolServer.jl:101 [stderr] [4] macro expansion [stderr] @ ~/.julia/packages/LanguageServer/y1ebo/src/languageserverinstance.jl:172 [inlined] [stderr] @ ~/.julia/packages/LanguageServer/y1ebo/src/languageserverinstance.jl:172 [inlined] [stderr] [5] (::LanguageServer.var"#93#95"{LanguageServerInstance})() [stderr] @ LanguageServer ./task.jl:411

non-Jedi commented 3 years ago

What julia version are you on? Any chance you could version bump all the eglot-jl dependencies to their latest release (update our manifest) and see if the problem persists?

non-Jedi commented 3 years ago

vs-code devs think this issue is probably fixed on SymbolServer 7.0.1, so definitely give updating the manifest a try. Note that to do so you'll have to update the Project.toml to use LanguageServer.jl major version 4.

LarryLegend33 commented 3 years ago

thanks! this largely worked; now the only flagged functions are from my two main libraries (GLMakie and Gen). these functions are still flagged as missing a reference -- this is a new behavior since switching to the M1 mac. Both statements "using GLMakie" and "using Gen" show "failed to load" when you hover over with the cursor. There's no clear error in the stacktrace explaining this in the EGLOT buffer.

LarryLegend33 commented 3 years ago

I'm not sure what happened today but now everything works. Thanks so much for the help!

mkschleg commented 2 years ago

I'm having a similar issue, but I think my issues are much more pervasive (i.e. linting isn't happening either). I'm presented with the isinmanifest error like above. But when upgrading to v4 the server keeps crashing on me. When running eglot-jl.jl in my project directory I get the following output/error:

[ Info: Environment successfully resolved
┌ Info: Running language server
│   env = "/Users/Matt/.emacs.d/elpa/eglot-jl-20210415.1207/Project.toml"
│   src_path = "/Users/Matt/Documents/Research/projects/ActionRNNs"
│   project_path = "/Users/Matt/Documents/Research/projects/ActionRNNs"
└   depot_path = ""
ERROR: MethodError: no method matching (::LanguageServer.var"#93#95"{LanguageServerInstance})(::String, ::Int64)
Closest candidates are:
  (::LanguageServer.var"#93#95")(::Any) at /Users/Matt/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:185
Stacktrace:
 [1] getstore(ssi::SymbolServerInstance, environment_path::String, progress_callback::LanguageServer.var"#93#95"{LanguageServerInstance}, error_handler::Nothing; download::Bool)
   @ SymbolServer ~/.julia/packages/SymbolServer/GBhfx/src/SymbolServer.jl:47
 [2] macro expansion
   @ ~/.julia/packages/LanguageServer/JrIEf/src/languageserverinstance.jl:182 [inlined]
 [3] (::LanguageServer.var"#92#94"{LanguageServerInstance})()
   @ LanguageServer ./task.jl:411

My manifest versions are:

  [00ebfdb7] CSTParser v3.3.0
  [34da2185] Compat v3.40.0
  [ffa9a821] DocumentFormat v3.2.4
  [48062228] FilePathsBase v0.9.17
  [682c06a0] JSON v0.21.2
  [b9b8584e] JSONRPC v1.3.3
  [2b0e0bc5] LanguageServer v4.1.0
  [69de0a69] Parsers v2.1.2
  [b3cc710f] StaticLint v8.0.1
  [cf896787] SymbolServer v7.1.0
  [0796e94c] Tokenize v0.5.21
  [30578b45] URIParser v0.4.1
  [0dad84c5] ArgTools
  .... # Rest are all Base

with julia version 1.6.4.

non-Jedi commented 2 years ago

@mkschleg If you're still having problems, could you open a new issue? This one will end up being closed by version bumping LanguageServer.jl, and what you're describing sound like something that may need reported upstream.

mkschleg commented 2 years ago

Sorry for the late response! This had to do with an issue upstream!