reddit / emacs

How to properly set up LSP ansible language server in emacs, for proper ansible playbook editing support?

bremen15 · 2022-10-23 07:50
sebasTEEan · 2022-10-23 08:25
You should look for yaml there is a mode, but it is not very helpfull.
Alric-Rahl · 2022-10-23 09:21
I tried it with `eglot` and couldn't get it to work, it says the server is running, and the same eglot setup worked for other languages but not for ansible. `lsp-mode` does have a dedicated page for it tho, so perhaps that might work? Didn't try it myself tho. Here is the link https://emacs-lsp.github.io/lsp-mode/page/lsp-ansible/ Edit: Oh, I see now you already checked this page, nvm.
yyoncho · 2022-10-23 10:16
Most likely you are doing M-x lsp-mode instead of lsp
brotzeitmacher · 2022-10-23 10:38
You need to enable ansible minor mode for lsp-mode. (use-package lsp-mode) (use-package ansible) (add-hook 'yaml-mode-hook 'ansible) (add-hook 'yaml-mode-hook 'lsp-deferred)
bremen15 · 2022-10-24 11:02
so i should do M-x lsp? doh, that worked! Where could I have read that? I honestly read and re-read the instructions and didn't see it. Are you familiar with lsp? Did you change the S-l (Super - l) prefix for LSP? what did you choose instead? Super-l collides with gnome.
bremen15 · 2022-10-24 11:04
I use that now. Thanks. Are you familiar with lsp? Did you change the S-l (Super - l) prefix for LSP? what did you choose instead? Super-l collides with gnome.
yyoncho · 2022-10-24 11:08
I am one of the maintainers. It is in the guides/sample configs, I will fix M-x lsp-mode to work just like M-x lsp (M-x lsp-mode is often confused). You may set `lsp-keymap-prefix` to change the default prefix(make sure to do that before loading lsp-mode).
bremen15 · 2022-10-24 12:16
I want to change the prefix, but what is a good free one?
brotzeitmacher · 2022-10-24 19:27
I've been using lsp for a few years. I rebind every command I use, very individually. You should experiment a little what works best for you.
SaggingLeftNut · 2022-10-30 08:45
Holly shit, there's an lsp mode for ansible?
bremen15 · 2022-10-30 16:57
you seem amazed. Why is that a big deal? Is LSP the shit? Why?
SaggingLeftNut · 2022-10-30 21:04
Well I've been using yaml lsp for all my ansible development. Had no idea it could be made easier.