Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable an insert mode that never replaces (like TypeScript instead of VS) #10613

Closed
sean-mcmanus opened this issue Feb 28, 2023 · 19 comments
Closed
Assignees
Labels
bug Feature: Auto-complete fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@sean-mcmanus
Copy link
Contributor

          This issue prevails, even with `"editor.suggest.insertMode": "insert", "[cpp]": { "editor.suggest.insertMode": "insert" }`:

actual

I would expect the editor with the above settings to never ever ever delete characters, e. g. expect the following outcome:

expected

Originally posted by @Longhanks in #10553 (comment)

@sean-mcmanus
Copy link
Contributor Author

It looks likes this would be fixed by switching to returning https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#insertReplaceEdit (instead of the textEdit that is currently returned).

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.

@github-actions github-actions bot added the more votes needed Issues that have been postponed until more community members upvote it label Jun 3, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2023
@github-actions github-actions bot added this to the Triage milestone Jun 3, 2023
@Longhanks
Copy link

I think this goes against the spirit of the setting and should be considered a bug, rather than a feature request. Maybe the VS Code devs can chime in to clarify the proper idea of "insertMode": "insert".

@sean-mcmanus sean-mcmanus added bug and removed enhancement Improvement to an existing feature labels Jun 10, 2023
@sean-mcmanus
Copy link
Contributor Author

@sean-mcmanus Sure, we can consider it a bug, but I'm not sure when we'll get around to fixing it (although the issue is closed, it could still get fixed if we decide to prioritize it later on).

@loikkant
Copy link

This is how the issue replicates in the "folder" settings:
Screencast from 16 08 2023 10 21 12

When one selects the non-default mode (insert), it swaps back to the default (replace) as soon as the focused UI element is changed. To me this makes it seem like a bug even further.

I find it extremely annoying that the "insert" mode is not working.

@Colengms Colengms removed the more votes needed Issues that have been postponed until more community members upvote it label Aug 22, 2023
@Colengms Colengms reopened this Aug 22, 2023
@Colengms Colengms modified the milestones: Triage, 1.18 Aug 22, 2023
@Adnn
Copy link

Adnn commented Aug 24, 2023

I'm joining from #11353, is there anything we can do to help prioritize this issue?

@Adnn
Copy link

Adnn commented Aug 24, 2023

By the way, as there existed previous comments discussing the intent of this settings, and whether it was a bug:

// Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.
// - insert: Insert suggestion without overwriting text right of the cursor.
// - replace: Insert suggestion and overwrite text right of the cursor.

(from the documentation of the default settings)

@sean-mcmanus
Copy link
Contributor Author

@Adnn It's already been prioritized.

@albertcaldas84
Copy link

Hi, I've been always finding pretty annoying that either pressing tab/enter the autosuggestion feature always replace the text on the right of the cursor, I always want to "insert". The cpp extension ignores the insertmode setting from vscode and overwrites it. Is it going to be fixed? Thanks!

@n808
Copy link

n808 commented Oct 4, 2023

Trying to figure out how to fix this annoying behavior. Why is the setting "editor.suggest.insertMode": "insert", ignored?
It was "replace" but I changed the global and all languages, yet it deletes the next word when I am inserting auto-completed code.

@phogy
Copy link

phogy commented Oct 26, 2023

Hi, chiming in on this! I personally find it very annoying, and there must be quite a lot of us. How this is not the behavior everyone expects is beyond me, but at least respect the setting. It did use to work at some point, of this I'm certain, so it's not a feature request imho. Thanks in advance!

@Adnn
Copy link

Adnn commented Oct 26, 2023

Yes, this definitely worked as intended at some point.

@bobbrow
Copy link
Member

bobbrow commented Oct 26, 2023

This is actively being worked on and you won't have to wait too much longer.

@sean-mcmanus sean-mcmanus modified the milestones: 1.19, 1.18.1 Nov 1, 2023
@sean-mcmanus sean-mcmanus modified the milestones: 1.18.1, 1.19.0 Nov 1, 2023
@browntarik browntarik added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 2, 2023
@sean-mcmanus
Copy link
Contributor Author

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.19.0 (pre-release)

@albertcaldas84
Copy link

albertcaldas84 commented Feb 6, 2024

I'm still experiencing the same issue with pre-release 1.19.2.
I have "Editor › Suggest: Insert Mode" set to Insert.

@Adnn
Copy link

Adnn commented Feb 6, 2024

@albertcaldas84 I just checked back on this issue, and it works for me with pre-release 1.19.2.
Did you make sure to set the cpp insertMode to insert? For some reason, the default for Cpp is replace (by opposition to the "general" default, which is insert, and the language specific value takes precedence).

To set the value for Cpp, I added the following entry to my settings.json:

{
    ...
    "[cpp]": {
        "editor.suggest.insertMode": "insert"
    }
}

@albertcaldas84
Copy link

If I add this to the settings.json it works. I didn't have any entry, which should assume that "insert" was the default value.

@Adnn
Copy link

Adnn commented Feb 8, 2024

I didn't have any entry, which should assume that "insert" was the default value.

The default value for cpp language is replace (unlike the "general" default, but the cpp value takes precedence when you edit cpp). This is why it has to be set explicitly to get inset behaviour.

@bobbrow
Copy link
Member

bobbrow commented Feb 8, 2024

For some reason, the default for Cpp is replace (by opposition to the "general" default, which is insert, and the language specific value takes precedence).

I apologize in advance for the history lesson, but we chose "replace" even before the VS Code setting existed. This aligned better (though not exactly) with how C++ in Visual Studio behaves. When VS Code introduced the setting they reached out to us and there was a vote about what the default value for the setting would be. We narrowly lost the vote but were given a way to keep our behavior by overriding the default for c and cpp files. We recently suggested a new value "languageDefined" for the insert mode so that we could keep our default and also not require the weird language setting syntax to change it, but it didn't clear the triage bar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Auto-complete fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

10 participants