"do" Autocomplete in VS Code

Is there a way to fix autocomplete in VSCode (I’m using the ElixirLS exten.), so that when I type do at the end of a function signature it doesn’t always automatically insert defoverridable(). It’s quite annoying.

Thanks! :smiley:

15 Likes

Had the same issue in Emacs, where I just increased the minimum amount of characters before autocomplete would kick in to 3. Open for better suggestions though…

Edit: issue at github Autocomplete oddity for functions · Issue #302 · elixir-lsp/elixir-ls · GitHub

You can add ‘do’ snippet to elixir snippets:

	"do": {
		"prefix": "do",
		"body": "do",
		"description": "Inserts do"
	}
2 Likes

The next version of ElixirLS will fix this by including “do” and “end” completions:

I don’t have a set timeframe for the release but it will be a patch release so it’s mostly about finding some time to actually cut the release.

21 Likes

This would be great as I can remove the workaround! :slight_smile: Thanks for all the effort you put in the project

1 Like

Do you need contributors to help with the release?

It’s already fixed in the release from 1st of September. :slight_smile: Thanks a lot @axelson.

Thanks a lot for adding this!

I’ve noticed that there is no indentation after selecting the do autocompletion. Would that be possible?

To clarify, when typing (using <|> as the current cursor position here):

defmodule Foobar do<|>

the autocomplete list is shown with the do keyword selected (purrfect!), presssing enter results in:

defmodule Foobar do
<|>
end

where I would love to have an indented cursor:

defmodule Foobar do
  <|>
end

It’s a minor annoyance because it requires an extra keystroke. Not complaining too loud because it’s already a big improvement over the previous defoverridable() behavior! :smiley: