scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

Support for VSCode editor.suggest.insertMode #349

Closed lbialy closed 10 months ago

lbialy commented 1 year ago

Is your feature request related to a problem? Please describe.

Metals ignores the value of editor.suggest.insertMode setting in VSCode currently. This means that whenever you go to a start of some expression, insert one letter and wait for autocomplete suggestions, then select one and press either enter or tab the whole first word gets replaced. This is one of two possible behaviours for editor.suggest.insertMode setting (which are insert or replace).

Describe the solution you'd like

I'd like to use insert mode in which suggestion from autocomplete would be inserted BEFORE first word of existing code (caret should end up being exactly at the end of code inserted from suggestion and right before the first word of existing code).

Describe alternatives you've considered

The only available workaround is to press space, then left arrow to have a space separator between my caret and first identifier.

Additional context

Tragedy in pictures

Search terms

vscode editor.suggest.insertMode insertMode

tgodzik commented 12 months ago

Thanks for reporting! This was introduced in LSP 3.16.x and we currently only use TextEdit for completions, but we could also use InsertReplaceEdit, which specifies insert and replace ranges

tgodzik commented 10 months ago

Actually, I realised it's a duplicate https://github.com/scalameta/metals-feature-requests/issues/205