JakeBecker / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the JSON-based "Language Server Protocol" standard and provides debugger support via VS Code's debugger protocol.
Apache License 2.0
846 stars 52 forks source link

`editor.acceptSuggestionOnEnter` VSCode setting is not honored #206

Closed dorian-marchal closed 4 years ago

dorian-marchal commented 4 years ago

Editor: Accept Suggestion On Enter Controls whether suggestions should be accepted on Enter, in addition to Tab. Helps to avoid ambiguity between inserting new lines or accepting suggestions.

When this setting is enabled, I expect ElixirLS suggestions to be accepted on Enter.

It seems to be intentional since v0.2.16: 7 Mar 2018 (see the Changelog):

v0.2.16: 7 Mar 2018

ACCEPT AUTOCOMPLETE SUGGESTIONS WITH TAB INSTEAD OF ENTER. See readme for an explanation of why. You can change it back if you really want.

But I don't find the explanation in the README.

dorian-marchal commented 4 years ago

In fact, I blamed the changelog and it has been copied from vscode-elixir-ls, so the explanation is there:

It may take some getting used to, but I highly recommend leaving acceptSuggestionOnEnter off and using using tab instead of enter for autocomplete. In Elixir, it's very common to end a line with an identifier (such as :error, for example), and ElixirLS will sometimes try to autocomplete that (into :error_handler or :error_logger, for example). If you're typing quickly, you may hit enter before even noticing the suggestion and insert it by mistake. Automatic completion of do blocks is handled separately and does not require you to accept an autocomplete suggestion.

I'm used to pressing Escape when I see a suggestion at the end of the line, so I'm gonna disable that:

"[elixir]": {
    "editor.acceptSuggestionOnEnter": "on",
},

Thanks for the detailed explanation. :+1: