Describe the bug
When typing in an editor that supports textDocument/completion, after typing the do keyword, the only completion available is defoverridable, and pressing <Enter> (as you typically do after typing do since you're moving to the next line of an if expression, def, defmodule, etc) will accept the replacement. Here's a screenshot of my editor after typing do and then after pressing <Enter>:
To reproduce
Expected behavior
Ideally, do would be available as a completion and accepted by <Enter> so that I can keep typing the expression. elixir-ls had a similar issue documented here. They've solved it by adding a do completion to the list whenever the trigger characters are d or do and there's nothing after the cursor. As a corollary, they also set preselect on the completion to have it take precedence when needed, documented here.
Here's the current implementation from elixir-ls: https://github.com/elixir-lsp/elixir-ls/blob/a9a26f4f7c21b0b6fd0e55084a7b5bd628caf78e/apps/language_server/lib/language_server/providers/completion.ex#L325-L359
Here's a quick pass I took at implementing something similar for Dexter: superhawk610#2 Note that my implementation is much simpler and doesn't cover as many edge cases, I just wanted to see whether it worked (and it does). Having it expand to do\n $0\nend is also nice, but not necessary.
I've seen some people suggest adding do\n $0\nend as a snippet, which is a viable workaround, but I'd prefer to have it fixed at the source if possible.
Environment
- Dexter version (
dexter --version): 0.7.0
- Elixir version (
elixir --version): 1.19.4
- Editor and version: Zed 1.5.3
- OS: macOS Tahoe 26.5
Describe the bug
When typing in an editor that supports
textDocument/completion, after typing thedokeyword, the only completion available isdefoverridable, and pressing<Enter>(as you typically do after typingdosince you're moving to the next line of anifexpression,def,defmodule, etc) will accept the replacement. Here's a screenshot of my editor after typingdoand then after pressing<Enter>:To reproduce
Expected behavior
Ideally,
dowould be available as a completion and accepted by<Enter>so that I can keep typing the expression.elixir-lshad a similar issue documented here. They've solved it by adding adocompletion to the list whenever the trigger characters aredordoand there's nothing after the cursor. As a corollary, they also setpreselecton the completion to have it take precedence when needed, documented here.Here's the current implementation from
elixir-ls: https://github.com/elixir-lsp/elixir-ls/blob/a9a26f4f7c21b0b6fd0e55084a7b5bd628caf78e/apps/language_server/lib/language_server/providers/completion.ex#L325-L359Here's a quick pass I took at implementing something similar for Dexter: superhawk610#2 Note that my implementation is much simpler and doesn't cover as many edge cases, I just wanted to see whether it worked (and it does). Having it expand to
do\n $0\nendis also nice, but not necessary.I've seen some people suggest adding
do\n $0\nendas a snippet, which is a viable workaround, but I'd prefer to have it fixed at the source if possible.Environment
dexter --version): 0.7.0elixir --version): 1.19.4