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

Visual Studio insists on autocorrecting the method name I type to a similarly named field #74482

Closed
vsfeedback opened this issue Jul 22, 2024 · 3 comments · Fixed by #74495
Closed
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@vsfeedback
Copy link

vsfeedback commented Jul 22, 2024

This issue has been moved from a ticket on Developer Community.


I am coding a C# class that has a switchedTime field above the keyboard cursor and a SwitchTime() method below. Admittedly, my code includes an unclosed brace, which could be preventing Roslyn or whatever is used in the back to recognize that the SwitchTime() method exists, but it should at least be able to scan the rest of the code for matching words, yet as soon as I type this.Sw - it auto-"corrects" it to this.sw and suggests completing it to this.switchedTime. I hit backspace twice to let revert the autocorrect and type what I intended and it auto-"corrects" me again. The only way I can type what I intended is by typing "S" and then "(", which very unhelpfully replaces the "S" with "SetTitleBar" and then backspacing through it all to type it again since once I have the opening parenthesis following the name it doesn't recognize - it seems to stop fighting me. VS should at least follow the long tradition of Office, where temporarily disabling autocorrect is as simple as pressing backspace.

I have a feeling that recently VS philosophy is that we only write code top to bottom and never edit it afterwards. I think somewhat recently it started insisting that every time I type a double quote - it needs to add another one to the right of the cursor (seemingly following the VS Code default), while in many if not most cases I actually want to type a double quote just before some string of already type text, so every time I do that - I end up with a string that starts and ends with two double quotes until I go back and fix those. I tried turning that off, but the only option to do so seems to be "Automatic brace completion", which also disables any other automatic quote/parenthesis/bracket/brace completion, likely increasing the chance of this new autocorrect being unable to recognize half of the symbols in my .cs file.

The unhelpful autocorrect functionality:
B69d62575a32140a58f59d496a6675ba5638571011867997598_20240718-123942-image

The code underneath the popup, which gets ignored and rejected:
B7438c743551f40c997375b2a98b5a5c3638571012107759630_20240718-124006-image


Original Comments

Feedback Bot on 7/21/2024, 08:30 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 22, 2024
@sharwell
Copy link
Member

The recovery here is poor. One of two things should have happened:

  1. The missing brace implicitly inserted before private, and recovery allows IntelliSense to be aware of the SwitchTime method.
  2. The missing brace is not implicitly inserted before private, and recovery allows IntelliSense to be aware of SwitchTime as a local function.

I'm guessing the latter did actually happen, but SwitchTime was filtered out of completion due to typing this..

@CyrusNajmabadi
Copy link
Member

Accessibility modifiers should ensure that we do '1'. If not, that's a parser bug.

@CyrusNajmabadi
Copy link
Member

I have a feeling that recently VS philosophy is that we only write code top to bottom and never edit it afterwards

This is not the case. This is just an example of poor error recovery due to the language getting more constructs that are ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
3 participants