vscode-cpptools
vscode-cpptools copied to clipboard
Enable an insert mode that never replaces (like TypeScript instead of VS)
This issue prevails, even with `"editor.suggest.insertMode": "insert", "[cpp]": { "editor.suggest.insertMode": "insert" }`:
I would expect the editor with the above settings to never ever ever delete characters, e. g. expect the following outcome:
Originally posted by @Longhanks in https://github.com/microsoft/vscode-cpptools/issues/10553#issuecomment-1448365253
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).
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.
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 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).
This is how the issue replicates in the "folder" settings:
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.
I'm joining from #11353, is there anything we can do to help prioritize this issue?
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.
@Adnn It's already been prioritized.
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!
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.
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!
Yes, this definitely worked as intended at some point.
This is actively being worked on and you won't have to wait too much longer.
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.19.0 (pre-release)
I'm still experiencing the same issue with pre-release 1.19.2. I have "Editor › Suggest: Insert Mode" set to Insert.
@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"
}
}
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.
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.
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.