-
Notifications
You must be signed in to change notification settings - Fork 676
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
Autocomplete prevents typing a lambda expression #4833
Comments
There is no option in this extension to make the suggestion mode less intrusive, but maybe configuring it this way could help. microsoft/vscode#70176 (comment) Duplicate #3394 |
This bug isn't the same as that one - this bug is that the set of suggested completions is simply incorrect because (presumably) the C# extension is not allowing for the possibility of a lambda expression in expression position. Since it works exactly as expected if you add parameters after you've added the ()=>, it's clearly capable of doing so. Is it not a bug that the set of suggestions is simply incorrect? |
In that VS screenshot, it looks like the first suggestion is what the user typed, which is a valid suggestion in the context and what would fix VS.Code's suggestions. Or maybe that's a box title? Even if VS did have the same autocomplete, I'm not sure I see how VS also having a bug means that VS.Code should ignore it. It's worth noting that VS.Code probably only does it for user-provided types. If you type (int bob, int lisa), it doesn't insert other things, so it seems like it might already have some handling for this that just needs to do the same with user-provided types. However, I probably will disable the commit characters, in config, as you suggest. |
Point taken. I think I approach a lot of these issues with the mindset that if I can get VS Code to work as well as VS then that is success. I've am now rethinking that. Thanks for the different perspective. |
Issue Description
Typing a lambda expression is a nightmare where you have to fight autocomplete and keep pressing escape to cancel suggestions
Steps to Reproduce
Try typing in a cs file (you can copy/paste before the var)):
Expected Behavior
You get the text you typed.
Actual Behavior
The var line comes out like:
This happens when typing lambdas in all expression contexts, including when filling in a known-type parameter - I just simplified it to the above.
Pressing escape lots can work, but you have to be watching really carefully. Otherwise, typing ()=> first and then filling in the brackets and then the expression is a good workaround.
(Fighting the autocomplete is a way of life, but having valid code typed in order in the natural fashion turn into the above is not fun.)
Environment information
VSCode version: 1.61.1
C# Extension: 1.23.16
Dotnet Information
.NET SDK (reflecting any global.json): Version: 5.0.402 Commit: e9d3381880Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.402\
Host (useful for support):
Version: 5.0.11
Commit: f431858f8b
.NET SDKs installed:
3.1.120 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]
5.0.402 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: