do<enter><tab> expands as snippet, replacing `do` with `defoverridable()`
Environment
- Elixir & Erlang versions (elixir --version):
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Elixir 1.12.3 (compiled with Erlang/OTP 24)
- Operating system: MacOS 12.1
- Editor or IDE name (e.g. Emacs/VSCode): VSCode 1.62.3
- Editor Plugin/LSP Client name: ElixirLS
Troubleshooting
- [x] Restart your editor (which will restart ElixirLS) sometimes fixes issues
- [x] Stop your editor, remove the entire
.elixir_lsdirectory, then restart your editor
Logs
(Not an error, no relevant logs)
Issue
This is very similar to #610, but a slightly different pattern.
This happens when you don’t use a snippet while defining a block, like if you just type def x do<enter><tab>. The reason I press tab here is because VSCode does not add an indent level by itself, so to have properly indented code inside the do-block, pressing tab is the natural thing to do. Unfortunately, tab is also the default binding for expanding snippets in VSCode, so it decides that I was trying to type defoverridable(), so deletes my linebreak and replaces the do with that.
To get around this, I have to consciously avoid properly indenting the new block and instead rely on the code formatter to do it for me.
I have tried finding a way to tell VSCode that defoverridable() is not a snippet I want to expand ever, but I have not been able to find a way.
Also related: #593 – unfortunately, this issue still haunts me in ElixirLS v0.8.1.
Defining a do-block snippet as mentioned in this comment does make the problem go away, so that might be a possible workaround.
Also present for me in 0.9.0
Fixed in https://github.com/elixir-lsp/elixir-ls/commit/e4576def20c479dc7be7cc7e6079d017cb980c98 and released in v0.11
still running into this issue on v0.11 😅 I am using neovim with nvim-lsp. Deleted my project's .elixir_ls folder and no change unfortunately. Tested with vscode as well, and it seems to work as intended there, not sure why the functionality would be different though. Going to mess around some more with my lsp config and see if it's an issue there maybe
@RobertYost my guess is nvim-lsp is sorting items differently or not respecting the preselect flag...