0

I have this set in my init file:

;; build dependency tree for function
(use-package lsp-mode
    :ensure t
    :hook ((clojure-mode . lsp)
           (clojurescript-mode . lsp)
           (prog-mode . lsp))
    :commands lsp)

However, I am receiving the following warning when I open my init.el file:

Warning (lsp-mode): Unable to calculate the languageId for buffer ‘init.el’. Take a look at ‘lsp-language-id-configuration’. The ‘major-mode’ is emacs-lisp-mode Disable showing Disable logging

I tried adding:

(emacs-lisp-mode . lsp)

But, it did not work.

How to fix this?

1

1 Answer 1

3

emacs-lisp-mode is derived from prog-mode (as so many modes are), so lsp was already being started in your Emacs Lisp buffers. The warning simply tells you that lsp doesn’t know what programming language the buffer contains, and therefore it cannot look up what server to start. But that’s not a problem, because you don’t want to use LSP at all for Emacs Lisp buffers.

As you are probably aware, LSP is a protocol (or series of predefined messages), which an editor may use to talk to another program called a “Language Server”. This server tells the editor how to behave while editing the document, and allows the user to query information like the filename where a function definition lies. But Emacs already has all of those features for Emacs Lisp code; you don’t need some external program to tell Emacs any of that information.

You shouldn’t activate lsp for prog-mode, because not every mode derived from prog-mode has a Language Server for LSP to talk to. Either that, or you should just ignore the warning. It is just a warning, after all.

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.