dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

HOW TO TURN OFF SPACE AUTO COMPLETE!!??? #3647

Open pedwards95 opened 4 years ago

pedwards95 commented 4 years ago

The space auto complete in this extention is horrid. It doesn't consider what you typed past the first couple of letters. EVEN IF YOU WAIT TO PRESS SPACEBAR. AND WHY IS THE AUTO COMPLETE BUTTON SPACEBAR??????? We use spacebar all the freaking time when coding. Why is such an important button the AUTOCOMPLETE.

After searching Google, this is a problem that has been around for at least 2 years. The only solution is to turn off autocomplete all together. Why can't I rebind it?

Bad design. Bad planning. Useless feature in current implementation.

ps. Its broken in insider too. pss. It happens with ONLY your extension installed, and stops when disabling setting in the extension. The problem is 100% this and only this.

Steps to reproduce

  1. Make sure Omnisharp is working on your active file. If your open directory is too large, Omnisharp does nothing. (another failure of this extension)
  2. Type anything that is not a command, that you intend to use as a variable. Some examples are i, and input. (I use these all the time, and they are corrected every time, hence my frustration)
  3. Press space (as a normal person would do when they have finished writing a word. What kind of monster doesn't put a space between their variable names and the =)

Expected behavior

Normal typing behavior as defined by every computer, phone, tablet, ect.

Actual behavior

Your typed word or letter changes into a long variable name that doesn't even work in the context of the code.

cartermp commented 4 years ago

Thanks for the report. Do you have a code sample or screenshot showing this behavior? Thanks!

jmarolf commented 4 years ago

Space should not be considered a commit character unless you have used the arrow keys to select something. Please let me know is this is not what you are seeing. A screen-shot or precise repo would help a lot :)

cartermp commented 4 years ago

Possible duplicate of https://github.com/OmniSharp/omnisharp-vscode/issues/1936

rhys-vdw commented 4 years ago

Could this be related? I get this madness when typing . in a comment, then space will autocomplete it.

image image

Sorry couldn't work out how to attach video.

pedwards95 commented 4 years ago

Its going to be a duplicate of many reports because its a problem that has existed for 2 years. @cartermp

I don't feel like taking a video of typing 'input' and pressing space. @jmarolf @cartermp

I did not and have never used the arrow keys. @jmarolf

Yes. @rhys-vdw

JoeRobich commented 4 years ago

OmniSharp is returning completion items while in doc comments and the completion items are not being returned as suggestions. Possible fix would be to first check if service.ShouldTriggerCompletion() returns true prior to generating a completion list here - https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Roslyn.CSharp/Services/Intellisense/IntellisenseService.cs#L42. Also, not sure if the method of determining suggestion mode will always be accurate here - https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Roslyn.CSharp/Services/Intellisense/IntellisenseService.cs#L56

2jacobtan commented 4 years ago

Workaround using Code Snippets:

image image image

At least now I can type var/*space*/ in peace, without it turning into EnvironmentVariableTarget.

P.S. @rhys-vdw I have faced the same problem T_T

P.P.S. Also works: disable "Accept Suggestion On Commit Character": image (I prefer to keep this setting enabled, because it's helpful usually.)

Radeonmann commented 3 years ago

I'm also giving +1

This is a big issue when e.g. adding an event handler with lambdas. What i want to write: image

I start to write: image

I press comma: image

@2jacobtan Thanks for the hint with "Accept Suggestion On Commit Character", it just saved my live, as I usually not use this functionality.

mogocat commented 3 years ago

This is really terrible! I even cannot type a 'var' with space! When could this be fixed? Thanks @2jacobtan for saving my life.

HymanZHAN commented 3 years ago

Thank you so much @2jacobtan for the tip! A true life saver! It's super annoying and frustrating, especially when you compared that to the implementation of TS intellisense, which does not register so many characters like =, , <SPACE>, etc. as commit characters. The range of commit characters is simply way too wide.

7Hazard commented 3 years ago

This is really annoying. Normally only tabbing should commit autocompletion. Thats how the autocompletion works on all other languages.

simonhunt commented 2 years ago

This setting fixed it for me:

image
Drupalique commented 2 years ago

Ohhhhhh, thank you! Typing "i" had become a nightmare! This is a feature?

SpechtMagnus commented 2 years ago

When will this finally be fixed? I'm thinking about disabling this extension altogether as "await" has become the bane of my existence!

pucsdian commented 2 years ago

image turning this off Thanks it worked for me !!!!!!!

Orkimedes commented 2 years ago

So weird to read about turning off space autocompletion. I have an opposite problem - how to turn it on in VS code - it uses TAB which is extremely uncomfortable.

Orkimedes commented 2 years ago

So weird to read about turning off space autocompletion. I have an opposite problem - how to turn it on in VS code - it uses TAB which is extremely uncomfortable.

I have the same problem, couldn't find a trigger to use space to accept the suggestion.

I found a way to add space(or any other button in the same way). You have to go to the keybindings.json and add there the following: { "key": "space", "command": "acceptSelectedSuggestion", "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus" }

mgoerlich90 commented 2 years ago

image turning this off Thanks it worked for me !!!!!!!

To anyone being used to autocomplete on Tab and/or Enter and only these: This is the solution you're looking for. Disable that and your autocomplete should be back to, as you're used to it.

https://code.visualstudio.com/docs/editor/intellisense#_settings

And @pedwards95 isn't quite right. It's not a direct issue/feature of OmniSharp that he's confused with, but rather a IntelliSense Feature. It works the same way in Visual Studio, so it shouldn't be that confusing when one already has some experience with C#.

The maintainers might consider pinning an issue explaining that this is not a bug and point the users to the docs, to prevent further "false-positives" And MS could document that Feature of IntelliSense a tid bit better, maybe a list of the commit charachters would be cool. But all of that is still not a reason for @pedwards95 to scream at people and act like a donkey, just because he's swamped.

igblip commented 1 year ago

A space should never be used as a completion character. This setting should be turned off by default.

distinctdan commented 1 year ago

What is this garbage?!! Who thought it was a good idea to make space accept the autocomplete? Utterly ridiculous that this hasn't been fixed by now, the authors of this extension obviously don't actually use it.

mzaprudin commented 1 year ago

It would be great if this "Editor: Accept Suggestion On Commit Character" would be disabled by default It was terrible when the extension overwrite my code if I want to add something at row beginning and I couldn't understand, why it's doing this strange thing and it was complicated to find the reason This option is real pain

mecha-moonboy commented 1 year ago

It would be great if this "Editor: Accept Suggestion On Commit Character" would be disabled by default It was terrible when the extension overwrite my code if I want to add something at row beginning and I couldn't understand, why it's doing this strange thing and it was complicated to find the reason This option is real pain

Agreed. This problem brought me here. This discussion should have been ended and fixed at least 2 years ago. I couldn't even add the 'public' keyword before an existing field without it autocompleting and doubling the time and typing required.

mzaprudin commented 1 year ago

It seems that after last update overwriting was fixed, if I write simething at row beginning and then press Enterk key, written text isn't errased and I can proceed normally without rewriting And even if I activate "Editor: Accept Suggestion On Commit Character" option, it works normally as expected Thank you so much!

calebmeyer commented 1 year ago

If you want to keep the behavior of acceptSuggestionOnCommitCharacter for other languages (just not csharp), you can use a language specific setting in your settings.json:

image
"[csharp]": {
  "editor.acceptSuggestionOnCommitCharacter": false
},
conor-mccullough commented 1 year ago

Ran into this with C#. Workaround as suggested here was to disable "Accept Suggestion On Commit Character".

How is this still an issue 3 years later? I understand that the workaround is fairly easy to implement, but this isn't exactly desired out-of-the-box behaviour.

cxlblm commented 6 months ago

This is a behavior that feels very uncomfortable to engage in, and there's no way to modify it.

JustinGrote commented 2 months ago

Ran into this with C#. Workaround as suggested here was to disable "Accept Suggestion On Commit Character".

How is this still an issue 3 years later? I understand that the workaround is fairly easy to implement, but this isn't exactly desired out-of-the-box behaviour.

Ran into this too, why in C# is space a commit character?

Here's how to do a C# specific disablement of that setting:

  "[csharp]": {
    "editor.acceptSuggestionOnCommitCharacter": false,
  }