# Using LanguageServer.jl with eglot in emacs

**URL:** <https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125>\
**Category:** Tooling\
**Tags:** editors, emacs\
**Created:** [April 14, 2019, 1:46am UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125 "2019-04-14T01:46:19Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [April 14, 2020, 6:46pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/61 "2020-04-14T18:46:58Z")

</div>

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. 😉 I’ve updated [the LanguageServer.jl wiki](https://github.com/julia-vscode/LanguageServer.jl/wiki/Emacs#eglot) with a description of the capabilities that are currently working.

---

<div class="post-metadata">

**Author:** ![4aHxKzD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/4ahxkzd/32/10833_2.png) [@4aHxKzD](https://discourse.julialang.org/u/4aHxKzD)\
**Post date:** [May 1, 2020, 5:39pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/62 "2020-05-01T17:39:04Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [May 1, 2020, 6:19pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/63 "2020-05-01T18:19:31Z")

</div>

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?

> **[GitHub - non-Jedi/eglot-jl: Wrapper for using Julia LanguageServer.jl with...](https://github.com/non-Jedi/eglot-jl)**
>
> Wrapper for using Julia LanguageServer.jl with emacs eglot - GitHub - non-Jedi/eglot-jl: Wrapper for using Julia LanguageServer.jl with emacs eglot

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

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [June 5, 2020, 12:47pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/64 "2020-06-05T12:47:03Z")

</div>

@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.

> <https://github.com/non-Jedi/eglot-jl/pull/12>
>
> The following PR introduces features helping compile and use custom system image…s for LanguageServer and SymbolServer. The expected benefits are reduced start-up times for the language server. On my (old-ish) machine, start-up times are reduced from 20 seconds to less than 2. On a newer machine where I also tested this, times went from 15 seconds down to less than 1.
> 
> The idea is the following:
> \- \`eglot-jl.jl\` looks at the \`EGLOT\_JL\_TEST\` environment variable; when it is set, the server is configured to read from an IOBuffer that sends it an \`exit\` instruction as soon as it is able to process requests. This allows \`eglot-jl.jl\` to be used as a \`precompile\_execution\_file\` that exercises the (language) server before gracefully exiting.
> \- a \`compile.jl\` script automates the generation of a system image, named after the julia version (and having the relevant extension depending on the OS).
> 
> This is what the first commit in this PR introduces, alongside with instructions in \`README.org\` explaining how to compile the system image, and set \`eglot-jl-julia-args\` to use it.
> 
> The second commit goes a step further: it automates the search for a suitable system image at server startup, in order to use it if one is found.
> \- a first call to julia allows getting the version number. This involves something like 0.1s additional latency before the server is run, which I think is acceptable but is nevertheless quite a large amount of time for such an insignificant-looking task
> \- a suitable system image is looked for, based on the version number; if one is found, the corresponding \`--sysimage\` command-line switch is generated. If not, nothing happens; no system image is used, so users who have not generated any system image will not be impacted by this.
> \- the whole process handling system images can be deactivated using a new \`eglot-jl-enable-sysimage\` customizable option. This allows users to opt out of the system, even if they have previously generated a system image (for example in case it would become stale for some reason). It also completely removes the julia version overhead.
> 
> Additionally, a new autoloaded command allows running the system image generation script from within emacs. The same command could be used to re-generate a system image if the previous one caused problems for any reason.
> 
> This is documented in \`README.org\`. I've tested this with Julia 1.3 and 1.4, on Windows and Linux, without encountering any problem (I don't have access to a Mac).
> 
> I know you were reluctant to handle system images in \`eglot-jl\`, and were (rightfully) especially concerned about possible ways that a system image would become obsolete. I tried making this implementation as robust as possible, but I might very well have overlooked something. So please do not hesitate to tell me if something bothers you with this proposal.

---

<div class="post-metadata">

**Author:** ![4aHxKzD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/4ahxkzd/32/10833_2.png) [@4aHxKzD](https://discourse.julialang.org/u/4aHxKzD)\
**Post date:** [June 5, 2020, 2:50pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/65 "2020-06-05T14:50:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [June 5, 2020, 4:43pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/66 "2020-06-05T16:43:06Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![4aHxKzD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/4ahxkzd/32/10833_2.png) [@4aHxKzD](https://discourse.julialang.org/u/4aHxKzD)\
**Post date:** [June 5, 2020, 4:49pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/67 "2020-06-05T16:49:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [June 5, 2020, 11:54pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/68 "2020-06-05T23:54:21Z")

</div>

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:

```julia
[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.

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [June 5, 2020, 11:59pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/69 "2020-06-05T23:59:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [June 6, 2020, 12:01am UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/70 "2020-06-06T00:01:53Z")

</div>

Sure!

```julia
[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

```

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [June 6, 2020, 7:26am UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/71 "2020-06-06T07:26:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [June 6, 2020, 11:06am UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/72 "2020-06-06T11:06:30Z")

</div>

> [@orialb](#):
>
> I tested the sysimage branch on MacOS, it seems to work and indeed accelerate the startup time.

Thanks for testing!

> [@orialb](#):
>
> 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.

You can try to customize `eglot-autoreconnect`:

```elisp
(setq eglot-autoreconnect nil)

```

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [June 7, 2020, 2:33am UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/73 "2020-06-07T02:33:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [June 8, 2020, 12:27pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/74 "2020-06-08T12:27:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [June 8, 2020, 3:15pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/75 "2020-06-08T15:15:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [June 8, 2020, 3:22pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/76 "2020-06-08T15:22:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [June 8, 2020, 3:26pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/77 "2020-06-08T15:26:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ossifragus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ossifragus/32/22768_2.png) [@Ossifragus](https://discourse.julialang.org/u/Ossifragus)\
**Post date:** [July 25, 2020, 4:00pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/78 "2020-07-25T16:00:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [December 1, 2022, 12:32pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/79 "2022-12-01T12:32:57Z")

</div>

> [@pfitzseb](#):
>
> I’d recommend running something like
> 
> ```julia
> using LanguageServer, SymbolServer
> server = LanguageServerInstance(stdin, stdout, true, "/home/you/.julia/environments/v1.1", "", Dict())
> run(server)
> 
> ```

Here is my version of your snipped:

```julia
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:

```julia
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

---

<div class="post-metadata">

**Author:** ![tom-plaa](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Post date:** [December 1, 2022, 1:13pm UTC](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125/80 "2022-12-01T13:13:19Z")

</div>

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 :

```julia

(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

```julia
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](https://github.com/non-Jedi/eglot-jl)

[Previous page](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125.md?page=3)

[Next page](https://discourse.julialang.org/t/using-languageserver-jl-with-eglot-in-emacs/23125.md?page=5)
