You should try jetls, it is awesome!

You may already know more than I do, since I don’t know much, but I looked at some documentation for eglot and it seemed to me that you would set the directory-local variableeglot-workspace-configuration in a file .dir-locals.el as described here. I didn’t try it since it wasn’t clear to me what advantage this has over putting the configuration in .JETLSConfig.toml. Maybe I’m missing something. Is there some advantage that you know of?

I want the configuration to be global, not specific to a directory.

I think I need the user-specific configuration, which apparently requires translating JSON to elisp. I am just not sure where the :jetls and the plist goes, that’s all.

Yes, JETLS is a Julia server app that works in its own environment.

Awesome. I didn’t realize this point. I will give it a try!

I think you’ll want something like this:

(add-hook 'julia-mode-hook #'eglot-ensure)
(with-eval-after-load 'eglot
  (let ((jetls-config
         '(:code_lens (:references t) ; I would like to get this to work
           :formatter (:custom (:executable "runic-fork")))))
  (add-to-list 'eglot-server-programs
               `(((julia-mode :language-id "julia" :initializationOptions ,jetls-config)
                  (julia-ts-mode :language-id "julia" :initializationOptions ,jetls-config))
                 "jetls"
                 "serve"
                 "--socket"
                 :autoport))))

I had been thinking I’d be happy with a local per-project configuration. But I can see that having a default might be nice.

I did play around with trying to this with setq-default as in the user-specific configuration link. JETLS certainly sees it, but I seem to have completely failed at getting the plist right. JETLS gave errors with everything I tried. So I’m also stumped on this.

I have a question. I installed jetls with Julia 1.12 environment, as required. However, my project is developed with 1.10 with many packages installed in this environment. Is it possible for jetls to handle this situation directly? Or I have to install all the packages in the 1.12 environment?

See You should try jetls, it is awesome! - #14 by ufechner7

Thank you, but does this not install all the packages in the 1.12 env?

Well, not in the global environment, but in the local environment of your project. What is your problem with it? Are you short of disk space?

Yeah, I am worried about the disk space, but not a big issue. Thank you!

Here is the documentation: JETLS configuration · JETLS.jl.

What @tecosaur explained is the way Emacs eglot sends configuration to the server through an LSP request called workspace/configuration. This corresponds to what called as “Method 2” in the documentation.

On the other hand, placing .JETLSConfig.toml in the project root is a method that JETLS provides on its own (“Method 1”), separate from LSP. So that one should work editor-agnostically, regardless of how Emacs eglot implements workspace/configuration.

Please file an issue if you still have a reproducer for it!