Using LanguageServer.jl with eglot in emacs

I’ve updated eglot-jl to use the latest release of LanguageServer.jl (so it’s now compatible with julia 1.4) and have been using it for the past 24 hours with no issues so far. I’ve also cleaned up the code for locking eglot-jl to a specific version of LanguageServer.jl so that it should get the correct version even if LanguageServer.jl is installed in your default environment.

Big kudos to @ZacLN and @davidanthoff for the work on the language server in recent months. It seems much more stable to me now. In particular, the parallel symbol server caching is a big win for usability (no longer have to wait multiple hours for the symbol server to process all dependencies before getting a usable language server).

Give it a try and let me know if any problems. If you’ve been using lsp-julia, this a great chance to give the other side of the fence a try until julia 1.4 support is ironed out. :wink: I’ve updated the LanguageServer.jl wiki with a description of the capabilities that are currently working.

1 Like

I’ve been using eglot with eglot-jl lately and it has improved a lot since I first tried it. Now it helps instead of getting in the way!

Since this thread keeps popping up (mostly my fault) and I’m unable to edit the OP anymore, would somebody with discourse moderator rights be willing to edit this link into the OP?

Glad it’s working better for you now; I’ve experienced roughly the same thing in the past month (no longer a hinderance).

2 Likes

@ffevotte has contributed tooling to make using LanguageServer.jl compiled by PackageCompiler simple with eglot. I would appreciate if anyone who is interested in the significantly alleviated startup time this gives (from 15 seconds down to less than 1) could test out his branch before I merge to master so that we can work out any bugs.

5 Likes

based on a quick test, works crazy fast for me!

1 Like

Glad to hear that! What type of system did you try this on?

I’d really like it if a MacOS user could try it, since I have not been able to test on this OS…

manjaro linux, but I’ll try it on macOS when I have the time.

This sounds all kinds of awesome… I’m a more or less old-school emacs user and haven’t kept up with newer emacs features… How do I get this installed effectively?

I installed eglot-jl from MELPA, am in a julia buffer with julia mode and company mode on, and I get:

[jsonrpc] Server exited with status 1
error in process sentinel: eglot--error: [eglot] -1: Server died
error in process sentinel: [eglot] -1: Server died

Running julia 1.4.1 and emacs-gtk 1:26.3+1-2 on Debian testing.

Could you post the contents of the "EGLOT (Env/julia-mode) events buffer please?

Sure!

[client-request] (id:1) Fri Jun  5 16:49:51 2020:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 3314088 :rootPath "/home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :rootUri "file:///home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :initializationOptions nil :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false)
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false)
			:declaration
			(:dynamicRegistration :json-false)
			:implementation
			(:dynamicRegistration :json-false)
			:typeDefinition
			(:dynamicRegistration :json-false)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
					      (:valueSet
					       [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"])))
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false))
		       :experimental nil)))
[stderr] nil
[stderr]    Updating registry at `~/.julia/registries/General`
[stderr] nil
[stderr]    Updating git-repo `https://github.com/JuliaRegistries/General.git`
[stderr] nil
[stderr]   Installed FilePathsBase ── v0.9.2
[stderr]   Installed StaticLint ───── v4.3.0
[stderr]   Installed LanguageServer ─ v3.0.0
[stderr]   Installed SymbolServer ─── v4.4.0
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr]  [1] include(::Module, ::String) at ./Base.jl:377
[stderr]  [2] include(::String) at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:1
[stderr]  [3] top-level scope at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr]  [4] include(::Module, ::String) at ./Base.jl:377
[stderr]  [5] top-level scope at none:2
[stderr]  [6] eval at ./boot.jl:331 [inlined]
[stderr]  [7] eval(::Expr) at ./client.jl:449
[stderr]  [8] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] top-level scope at none:2
[stderr]  [8] eval at ./boot.jl:331 [inlined]
[stderr]  [9] eval(::Expr) at ./client.jl:449
[stderr]  [10] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/LanguageServer/mpNvN/src/LanguageServer.jl:3
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr] nil
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] exec_options(::Base.JLOptions) at ./client.jl:288
[stderr]  [8] _start() at ./client.jl:484
[stderr] in expression starting at /home/dlakelan/.emacs.d/elpa/eglot-jl-20200521.1739/eglot-jl.jl:33
[internal] Fri Jun  5 16:50:16 2020:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (JuliaDataTutorials/julia-mode) stderr finished
[client-request] (id:1) Fri Jun  5 16:50:27 2020:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 3314088 :rootPath "/home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :rootUri "file:///home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :initializationOptions nil :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false)
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false)
			:declaration
			(:dynamicRegistration :json-false)
			:implementation
			(:dynamicRegistration :json-false)
			:typeDefinition
			(:dynamicRegistration :json-false)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
					      (:valueSet
					       [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"])))
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false))
		       :experimental nil)))
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr]  [1] include(::Module, ::String) at ./Base.jl:377
[stderr]  [2] include(::String) at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:1
[stderr]  [3] top-level scope at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr]  [4] include(::Module, ::String) at ./Base.jl:377
[stderr]  [5] top-level scope at none:2
[stderr]  [6] eval at ./boot.jl:331 [inlined]
[stderr]  [7] eval(::Expr) at ./client.jl:449
[stderr]  [8] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] top-level scope at none:2
[stderr]  [7] top-level scope at none:2
[stderr]  [8] eval at ./boot.jl:331 [inlined]
[stderr]  [9] eval(::Expr) at ./client.jl:449
[stderr]  [10] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/LanguageServer/mpNvN/src/LanguageServer.jl:3
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr] nil
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] exec_options(::Base.JLOptions) at ./client.jl:288
[stderr]  [8] _start() at ./client.jl:484
[stderr] in expression starting at /home/dlakelan/.emacs.d/elpa/eglot-jl-20200521.1739/eglot-jl.jl:33
[internal] Fri Jun  5 16:50:34 2020:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (JuliaDataTutorials/julia-mode) stderr<1> finished
[client-request] (id:1) Fri Jun  5 16:51:45 2020:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 3314088 :rootPath "/home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :rootUri "file:///home/dlakelan/Consulting/LakelandAppliedSciLLC/JuliaDataTutorials/" :initializationOptions nil :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false)
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false)
			:declaration
			(:dynamicRegistration :json-false)
			:implementation
			(:dynamicRegistration :json-false)
			:typeDefinition
			(:dynamicRegistration :json-false)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
					      (:valueSet
					       [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"])))
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false))
		       :experimental nil)))
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] ERROR: LoadError: could not open file /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/utils.jl
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr]  [1] include(::Module, ::String) at ./Base.jl:377
[stderr]  [2] include(::String) at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:1
[stderr]  [3] top-level scope at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr]  [4] include(::Module, ::String) at ./Base.jl:377
[stderr]  [5] top-level scope at none:2
[stderr]  [6] eval at ./boot.jl:331 [inlined]
[stderr]  [7] eval(::Expr) at ./client.jl:449
[stderr]  [8] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/DocumentFormat/sra7h/src/DocumentFormat.jl:198
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile DocumentFormat [ffa9a821-9c82-50df-894e-fbcef3ed31cd] to /home/dlakelan/.julia/compiled/v1.4/DocumentFormat/JgtLh_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] top-level scope at none:2
[stderr]  [8] eval at ./boot.jl:331 [inlined]
[stderr]  [9] eval(::Expr) at ./client.jl:449
[stderr]  [10] top-level scope at ./none:3
[stderr] in expression starting at /home/dlakelan/.julia/packages/LanguageServer/mpNvN/src/LanguageServer.jl:3
[stderr] nil
[stderr] nil
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] ERROR: LoadError: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/dlakelan/.julia/compiled/v1.4/LanguageServer/ite7n_V7OMW.ji.
[stderr] Stacktrace:
[stderr] Stacktrace:
[stderr] nil
[stderr] nil
[stderr] nil
[stderr]  [1] error(::String) at ./error.jl:33
[stderr]  [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[stderr]  [3] _require(::Base.PkgId) at ./loading.jl:1029
[stderr]  [4] require(::Base.PkgId) at ./loading.jl:927
[stderr]  [5] require(::Module, ::Symbol) at ./loading.jl:922
[stderr]  [6] include(::Module, ::String) at ./Base.jl:377
[stderr]  [7] exec_options(::Base.JLOptions) at ./client.jl:288
[stderr]  [8] _start() at ./client.jl:484
[stderr] in expression starting at /home/dlakelan/.emacs.d/elpa/eglot-jl-20200521.1739/eglot-jl.jl:33
[internal] Fri Jun  5 16:51:50 2020:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (JuliaDataTutorials/julia-mode) stderr finished

I tested the sysimage branch on MacOS, it seems to work and indeed accelerate the startup time.

Not sure whether it matters but I tested it only on a mock project .

I am having some problems with the language server crashing on a real project (not related to this branch) which are probably related to LanguageServer.jl. I will try to open an issue. Is there a way to make eglot to not reconnect after a server crash? I would like to provide the relevant details from the event buffer but eglot just keeps reconnecting (and the server keeps crashing) swamping the event buffer with new info.

1 Like

Thanks for testing!

You can try to customize eglot-autoreconnect:

(setq eglot-autoreconnect nil)

Does that EGLOT events buffer give any clue as to what happened?

It looks like your installation of DocumentFormat.jl in your ~/.julia depot is corrupted in some way. Run rm -fr /home/dlakelan/.julia/packages/DocumentFormat.jl/sra7h and then try eglot again (with long eglot-connect-timeout) to see if it works.

1 Like

Yeah, it looks like that worked. Weird.

I’m now getting eglot features, but I’m not seeing the pop-up completions from company mode. Is that supported?

Should be, ya. There’s a gif of it working with company in the README. Might just be that the symbol server is still indexing (can take literal hours). When it’s finished, you should see something like [ Info: Received new data from Julia Symbol Server. in the events buffer.

1 Like

Yay, I can’t wait… or rather I will wait and then be excited. Will check back if it’s still not doing its thing by tomorrow.

When I use the following code

server = LanguageServerInstance(stdin, stdout, true, "/home/ossifragus/.julia/environments/v1.4", "", Dict())

I got the following error. Did I do anything wrong? Thanks.

ERROR: MethodError: Cannot convert an object of type String to an object of type Function
Closest candidates are:
convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
[1] convert(::Type{Union{Nothing, Function}}, ::String) at ./some.jl:34
[2] JSONRPC.JSONRPCEndpoint(::Base.TTY, ::Base.TTY, ::String) at /home/ossifragus/.julia/packages/JSONRPC/1Kq3H/src/core.jl:61
[3] LanguageServerInstance(::Base.TTY, ::Base.TTY, ::Bool, ::String, ::String, ::Dict{Any,Any}) at /home/ossifragus/.julia/packages/LanguageServer/y1ebo/src/languageserverinstance.jl:66
[4] top-level scope at REPL[5]:1

Here is my version of your snipped:

using LanguageServer, SymbolServer
import Pkg

env_dir = joinpath(Pkg.envdir(), string("v", VERSION)[1:end-2])
server = LanguageServerInstance(stdin, stdout, true, env_dir, "", Dict())
run(server)

after the command server = ...
The error-message is:

ERROR: MethodError: no method matching JSONRPC.JSONRPCEndpoint(::Base.TTY, ::Base.TTY, ::Channel{Any}, ::Channel{Any}, ::Dict{String, Channel{Any}}, ::String, ::Symbol, ::Nothing, ::Nothing)
Closest candidates are:
  JSONRPC.JSONRPCEndpoint(::IOIn, ::IOOut, ::Channel{Any}, ::Channel{Any}, ::Dict{String, Channel{Any}}, ::Union{Nothing, Function}, ::Symbol, ::Union{Nothing, Task}, ::Union{Nothing, Task}) where {IOIn<:IO, IOOut<:IO} at C:\Users\stefanpofahl\.julia\packages\JSONRPC\P0G1p\src\core.jl:45
  JSONRPC.JSONRPCEndpoint(::Any, ::Any, ::Any) at C:\Users\stefanpofahl\.julia\packages\JSONRPC\P0G1p\src\core.jl:61
  JSONRPC.JSONRPCEndpoint(::Any, ::Any) at C:\Users\stefanpofahl\.julia\packages\JSONRPC\P0G1p\src\core.jl:61
Stacktrace:
 [1] JSONRPC.JSONRPCEndpoint(pipe_in::Base.TTY, pipe_out::Base.TTY, err_handler::String)
   @ JSONRPC C:\Users\stefanpofahl\.julia\packages\JSONRPC\P0G1p\src\core.jl:61
 [2] LanguageServerInstance(pipe_in::Base.TTY, pipe_out::Base.TTY, env_path::Bool, depot_path::String, err_handler::String, symserver_store_path::Dict{Any, Any}, download::Bool, symbolcache_upstream::Nothing) (repeats 2 times)
   @ LanguageServer C:\Users\stefanpofahl\.julia\packages\LanguageServer\0vsx2\src\languageserverinstance.jl:67
 [3] top-level scope
   @ REPL[7]:1

Can you reproduce my error? Julia version is: v1.8.3

I recommend using eglot-jl, and letting it download the server for you and keep it in its separate environment. I’ll share my configuration with you, @ellocco :


(require 'yasnippet)
(yas-reload-all)

(use-package vterm :ensure t)

(use-package julia-mode
    :mode "\\.jl\\'"
    :interpreter ("julia" . julia-mode)
    :init
    (setenv "JULIA_NUM_THREADS" "4")
    :config
    (add-hook 'julia-mode-hook 'company-mode)
    (add-hook 'julia-mode-hook #'yas-minor-mode)
    (add-hook 'julia-mode-hook 'julia-repl-mode)
    (add-hook 'julia-mode-hook (lambda () (setq julia-repl-set-terminal-backend 'vterm)))
    (add-hook 'julia-mode-hook 'eglot-jl-init)
    (add-hook 'julia-mode-hook 'eglot-ensure)
    (add-hook 'julia-mode-hook (lambda () (setq eglot-connect-timeout 120)))
    (add-hook 'julia-mode-hook (lambda () (setq eglot-autoshutdown t)))
    )

I have only left lines that might be relevant for julia editing.
You might want to change

setq eglot-connect-timeout 120

To some ridiculously higher number instead of 120 for the first time you try editing a .jl file, to allow it time to download and install the server code. See here: GitHub - non-Jedi/eglot-jl: Wrapper for using Julia LanguageServer.jl with emacs eglot