I came across this repo arduino-language-server. My question is how to make it connect it to my emacs? (Maybe more generally, how to connect to any other LSP-server?)

Currently I've installed prerequisites, and can run it (as instructed on it's readme)

./arduino-language-server \
 -clangd /usr/local/bin/clangd \
 -cli /usr/local/bin/arduino-cli \
 -cli-config $HOME/.arduino15/arduino-cli.yaml \
 -fqbn esp32:esp32:esp32

This will gives me following:

01:12:49.446042 LS: : Initial board configuration: esp32:esp32:esp32
01:12:49.446069 LS: : arduino-language-server Version: 0.0.0-git Commit:  Date:
01:12:49.446080 LS: : Language server build path: /tmp/arduino-language-server951409904
01:12:49.446086 LS: : Language server build sketch root: /tmp/arduino-language-server951409904/sketch
01:12:49.446092 LS: : Language server FULL build path: /tmp/arduino-language-server52033989

arduino-language-server is a language server that provides IDE-like features to editors.

It should be used via an editor plugin rather than invoked directly. For more information, see:

1 Answer 1


You need to install either the lsp-mode or eglot-mode Emacs package. (If you have a new enough Emacs then eglot will be built–in). Each of these does basically the same job (teaching Emacs how to talk to an LSP server), but there are differences between them. In principle you should try them both; in practice it is probably best to choose one and get used to it.

Then you need need to check to see if there is an additional package that installs customizations specific to your language. For example, if you program in Java and use lsp-mode, then you would want to install lsp-java. If you use eglot-mode instead, then you would install eglot-java.

These additional packages usually just tell the main package how to run the correct LSP server. For example, here is how lsp-java tells lsp-mode how to run the Java LSP server:

  :new-connection (lsp-stdio-connection #'lsp-java--ls-command
  :major-modes '(java-mode jdee-mode)
  :server-id 'jdtls

The :new-connection attribute tells it how to run the server, and the :major-modes attribute tells it when to do so.

eglot-mode has similar configuration options, but I am less familiar with it.

I don’t see any such packages for the Arduino yet, so you might need to start writing one of your own. You’ll want to carefully read the documentation for either lsp-mode or eglot-mode to work out how best to do that; it’s a bit much to include here.

  • Thanks for your comment, I use lsp-mode (but I want to use eglot in the future, because it's native to emacs 29). I usually follow the instructions from emacs-lsp.github.io. However, there is no entry about this Arduino-language server (there is no lsp-arduino). That's why I'm asking about how to connect to other Language servers that's not included in M-x lsp-install-server. I will try lsp-register-client there is some instruction on here that's using same function
    – Garid
    Nov 14, 2022 at 6:39
  • I tried following: (lsp-register-client (make-lsp--client :new-connection (lsp-stdio-connection '("/home/garid/otherGit/arduino-language-server/arduino-language-server" "-clangd" "/usr/local/bin/clangd" "-cli /usr/local/bin/arduino-cli" "-cli-config" "/home/garid/.arduino15/arduino-cli.yaml" "-fqbn esp32:esp32:esp32")) :major-modes '(arduino-mode) :server-id 'arduino ) ) however it's giving me some error. 1. lsp-stdio-connection = shell script which starts the server, 2. major-mode which is arduino-mode. 3. server-id I don't know where to get this
    – Garid
    Nov 14, 2022 at 7:07
  • You’re on the right track, but comments are not adequate for answering that type of question. You should create a question instead. Make sure you include any error messages that it gives you.
    – db48x
    Nov 14, 2022 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.