Hot answers tagged

9 votes
Accepted

lsp project root

You probably want (lsp-workspace-folders-add) to add sub-root directories. For example, if your Python files are located in the tests/ subdirectory, you add it as such with the command. Then, upon ...
RichieHH's user avatar
  • 873
4 votes

How to disable on-the-fly diagnostics in eglot?

I ended with the same situation, Where I wanted to use flymake directly with eslit wihout eglot. This code worked for me (add-hook 'eglot-managed-mode-hook (lambda () (remove-hook ...
nerding_it's user avatar
4 votes
Accepted

How to start lsp-mode connections lazily after desktop is restored?

How about: (use-package lsp-mode :straight t :init (setq lsp-keymap-prefix "C-c l") :hook (python-mode . lsp-deferred)) The doc for lsp-deferred: Signature (lsp-deferred) ...
C4ffeine Add1ct's user avatar
4 votes
Accepted

Can I use a local language server for remote files?

You will need to run the LSP server on the machine where the source code is, because the LSP protocol is predicated on the server having access to all of the source code at once, as files on disk. I ...
db48x's user avatar
  • 17.8k
3 votes

How to start lsp-mode connections lazily after desktop is restored?

The accepted answer didn't work for me, since when lsp-mode is already listed as a minor mode in the saved buffers, desktop-read will activate it before lsp-deferred runs. Instead, I'm using this: (...
scry's user avatar
  • 133
3 votes

How can I associate a schema with a json file using lsp-mode/lsp-json

I still don't know how to use the lsp-json-schemas variable, but with this mode properly activated in emacs you can add a top-level $schema property to the object you are presumably editing in the ...
Pieter Breed's user avatar
3 votes
Accepted

Is it possible to suppress `LSP :: Connected to [pyls:N].` message on minibuffer?

(defun disable-lsp-conn-msg-advice (func &rest r) (unless (string-prefix-p "Connected to" (car r)) (apply func r))) (advice-add 'lsp--info :around #'disable-lsp-conn-msg-advice)
TerryTsao's user avatar
  • 1,216
3 votes
Accepted

How to enable inlay hint in Eglot + Clangd

Eglot requires clangd version to be atleast 15 to enable inlay-hints feature and it is enabled out of the box and does not require additional configurations.
Nixmd's user avatar
  • 141
3 votes
Accepted

How to fix lsp-mode for Elisp?

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 ...
db48x's user avatar
  • 17.8k
3 votes
Accepted

How does emacs/eglot decide which syntax element to highlight and how could I change it?

Every buffer has one "major mode" which determines what Emacs will do to best support editing that particular language. See chapter 24.1 Major Modes in the Emacs manual for more information. ...
db48x's user avatar
  • 17.8k
2 votes
Accepted

How to disable on-the-fly diagnostics in eglot?

Disabling flymake-mode on eglot-managed-mode-hook should work.
albert200000's user avatar
2 votes
Accepted

How to configure lsp-cmake lsp server in vanilla emacs

You can try something like the following. (use-package lsp-mode :ensure t) (use-package cmake-mode :ensure t :mode ("CMakeLists\\.txt\\'" "\\.cmake\\'") :hook (cmake-mode ....
Swarnendu Biswas's user avatar
2 votes

my rust analyzer don't work on emacs 27

rust-analyzer can take a while to index and load a project. You should still be fine, even if the text in the minibuffer doesn't immediately change. Try using e.g. the auto completion and see if it ...
robertkrahn's user avatar
2 votes
Accepted

How to ignore specific flycheck warning messages for Python in lsp-mode?

Your python-lsp-server, named further pylsp as in lsp-pylsp.el file, can use pylint if it is enabled - you need the following code lines to be added to your lsp configuration block: ;; Adding pylint ...
Ian's user avatar
  • 1,468
2 votes
Accepted

How can I apply `noqa` in order to ignore warning messages when lsp-mode is enabled

tl;dr When trying to figure anything out, simplify! $ pip3 install 'pyparsing<3' $ pip3 install python-lsp-server # use a minimal `~/.emacs.d/init.el`, such as the one listed below Here's my ...
nega's user avatar
  • 3,211
2 votes
Accepted

How to run a test at point using lsp?

For my Emacs Python environment, I recently switched from Elpy to lsp-mode too. Mainly to benefit from the dap-mode debugger and a better "Find definition" functionality (able to find a ...
Loïc Lemaître's user avatar
2 votes

How to uninstall lsp servers

To uninstall a lsp server in Spacemacs delete the folder that has a similar name from ~/.emacs.d/.cache/lsp/ The folder name may have a different name because the folder name is the full name of ...
KhalfaniW's user avatar
  • 347
2 votes
Accepted

How to uninstall lsp servers

The problem was spacemacs was calling the package mspyls and list-packages has it under lsp-python-ms. To uninstall do M-x list-packages RET, search for the package, hit d with your cursor on the ...
mcp's user avatar
  • 546
2 votes
Accepted

how to configure Eglot over TRAMP?

eglot doesn't need any special config to work with tramp. You need to make tramp can find your remote pyright, maybe via: (add-to-list 'tramp-remote-path 'tramp-own-remote-path) For lsp-mode, you can ...
Tianshu Wang's user avatar
  • 1,754
2 votes
Accepted

How to list a source file's "structure" (e.g. list all the methods) with eglot/lsp?

Emacs has a built–in feature called Imenu that lets you easily jump to any definition in the current file (or project) by name. Any major mode can populate this menu, and therefore most do. Type M-g i ...
db48x's user avatar
  • 17.8k
2 votes
Accepted

How to get rid of `> run | debug` clickable text?

VSCode calls them “lenses” for whatever reason, so you can customize them with M-x customize-group lsp-rust-analyzer-lens.
db48x's user avatar
  • 17.8k
2 votes
Accepted

LaTeX equation numbers with Emacs

This is a capability of the LSP server. With TexLab, it can look like this: You need to install a LSP server and activate it within Emacs, I did M-x eglot RET and took texlab.
Arash Esbati's user avatar
  • 1,945
1 vote
Accepted

Is it possible to use LSP for font-lock or indentation?

Not really. LSP has a defined set of messages that can be sent back and forth between the editor and the compiler/language environment, and none of them have anything to do with syntax highlighting or ...
db48x's user avatar
  • 17.8k
1 vote
Accepted

lsp mode problems: not enabled, and clangd include file not found

The problem was that clang++ apparently looks for the "higher gcc version", and then expects that the corresponding g++ libraries and headers are installed. For some reasons, this was not ...
user52366's user avatar
  • 131
1 vote

add sonarlint in spacemacs

I found the solution with help. I was wrong in position of configuration. the right way is: (defun dotspacemacs/user-config () (setq lombok-jar-path (expand-file-name "/Users/...
chavalife17's user avatar
1 vote
Accepted

LSP: Bad JSON object: ":", 97

This is a pretty stupid mistake on my end. This was not related to LSP or emacs, just wrong formated json file, effect LSP-server within all the files in the repo. In a package.json file located in ...
alper's user avatar
  • 1,350
1 vote
Accepted

How can I list folder names that are added into lsp-workspace?

Just run M-x lsp-workspace-folders-open
Tianshu Wang's user avatar
  • 1,754
1 vote

dap-mode cpptools gives error `VTerm needs module support`

The resolution was to update my versions of emacs and spacemacs. For the latter, if you're on the develop branch you can just go to the .emacs.d folder (where the spacemacs configuration files are) ...
Lucas Myers's user avatar
1 vote

Disabling lsp-mode's autocomplete only for some languages

You may try something like: (add-hook 'tuareg-mode-hook (lambda () (setq-local lsp-completion-enable nil))) but make sure that this runs before lsp itself.
Ivan Dimitrov Yonchovski's user avatar
1 vote

lsp-rust-analyzer ignores edition value in Cargo.toml

It took me some time to realize that rust-analyzer was not the one to complain, but the buffer with the error message mentioned above was *rustfmt*, and indeed running rustfmt on my source file gave ...
Chen Levy's user avatar
  • 385

Only top scored, non community-wiki answers of a minimum length are eligible