tjstankus
Elixir-ls snippets insert tabs with emacs lsp-mode
I haven’t hit upon the correct setting to solve the annoying problem in the image above: when snippets complete, tabs are inserted instead of spaces. I’ve tried a few things including verifying that indent-tabs-mode is nil. I’ve also tried toggling lsp-enable-indentation but that setting has no effect. I’m using doom-emacs with emacs-lsp and elixir-ls. It’s working really well, except for this issue.
Any ideas? Thanks!
Most Liked
tjstankus
Thanks for responding. ![]()
I’m using the latest master of ElixirLS and have this in my ~/.doom.d/config.el
(setq lsp-clients-elixir-server-executable "~/code/tools/elixir-ls/release/language_server.sh")
(add-hook 'before-save-hook (lambda () (when (eq 'elixir-mode major-mode)
(lsp-format-buffer))))
I have yasnippet installed and yasnippet-minor-mode is enabled. When I run yas-insert-snippet I get the output I prefer. However, lsp-mode is picking the snippets from ElixirLS by default (see screenshot below). I do notice there’s a tab in those snippet definitions. But that doesn’t seem to be an issue in VS Code, only in Emacs.
I’ve looked around for a way to force lsp-mode to prefer yasnippets, but haven’t hit upon the right config just yet. It’s not so bad, since I’m formatting the buffer on save - and I save a lot.









