C
C#12mo ago
Oxy

❔ C# dev kit completion "args"

Hey I'm trying vscode and I stumbled upon this behavior that seems strange. When it autocompletes after opening (), it completes with the named argument args even if I don't take it (by doing ", to input a string myself) Can I disable this behavior ?
40 Replies
Oxy
Oxy12mo ago
Result after inputing "
Oxy
Oxy12mo ago
I can prevent it by using Esc but it's boring to do for every methods
Oxy
Oxy12mo ago
You can observe exactly the same behavior on https://sharplab.io
SharpLab
C#/VB/F# compiler playground.
Oxy
Oxy12mo ago
But it has been a long time so I think it's not a particular issue of c# dev kit
333fred
333fred12mo ago
Please use the command palette to file an issue on the C# extension (not devkit)
Oxy
Oxy12mo ago
Okay I just wanted to see if someone else was having the same issue
333fred
333fred12mo ago
Hmm, actually, I cannot reproduce that
Oxy
Oxy12mo ago
Even on sharplab.io ?
333fred
333fred12mo ago
Don't use sharplab as a testbed for this
Oxy
Oxy12mo ago
Okay you are not using copilot ?
333fred
333fred12mo ago
I love it, but the editor support is terrible, and only marginally related to what vscode does
Oxy
Oxy12mo ago
Yeah you're right I'm saying that because the completion behavior is totally different with copilot
333fred
333fred12mo ago
Copilot shouldn't have an impact on this behavior Really
Oxy
Oxy12mo ago
Yeah I'd like to rec a little something to show you But I'm not having the same issue at least
333fred
333fred12mo ago
Not sure what copilot is doing for you there then. I cannot repro this with copilot enabled or disabled
Oxy
Oxy12mo ago
I should have showed that first
Oxy
Oxy12mo ago
Oxy
Oxy12mo ago
C# is in prerelease as hinted when installing c# dev kit c# dev kit is not
333fred
333fred12mo ago
They're both prerelease, but dev kit doesn't matter here The C# extension is what is providing completion I'm trying to figure out if there's some VSCode setting that controls accepting completions on "
Oxy
Oxy12mo ago
The interesting options I found in my settins.json
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.organizeImportsOnFormat": true,
"omnisharp.enableLspDriver": true,
"omnisharp.enableDecompilationSupport": true,
"dotnet.inlayHints.enableInlayHintsForParameters": true,
"dotnet.inlayHints.enableInlayHintsForLiteralParameters": true,
"dotnet.inlayHints.enableInlayHintsForIndexerParameters": true,
"csharp.inlayHints.enableInlayHintsForTypes": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.organizeImportsOnFormat": true,
"omnisharp.enableLspDriver": true,
"omnisharp.enableDecompilationSupport": true,
"dotnet.inlayHints.enableInlayHintsForParameters": true,
"dotnet.inlayHints.enableInlayHintsForLiteralParameters": true,
"dotnet.inlayHints.enableInlayHintsForIndexerParameters": true,
"csharp.inlayHints.enableInlayHintsForTypes": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
I also have this "editor.acceptSuggestionOnCommitCharacter": true I will disable it and try again
333fred
333fred12mo ago
Oh, that could very well be it I have that off Yup, that's it
Oxy
Oxy12mo ago
Oh you can reproduce it now ?
333fred
333fred12mo ago
This does still feel buggy to me though: " shouldn't be a commit character in an argument list Please do file that bug
Oxy
Oxy12mo ago
Okay your help was precious I have a track now I'm on azerty maybe that's related
333fred
333fred12mo ago
Nope
Oxy
Oxy12mo ago
And linux (x11) That could be a x issue
333fred
333fred12mo ago
We're saying that " is a character that should accept suggestions We shouldn't be doing that
Oxy
Oxy12mo ago
Yeah indeed
333fred
333fred12mo ago
Trust me. It's not a bug related to your environment
Oxy
Oxy12mo ago
Okay I'll link that issue here as soon as I wrote it, is it good for you ?
333fred
333fred12mo ago
👍
Oxy
Oxy12mo ago
(Just to be sure, I guess this is the window)
333fred
333fred12mo ago
That's the one Good news: it may already be about to be fixed
Oxy
Oxy12mo ago
GitHub
[Completion] " as commit character · Issue #5988 · dotnet/vscode-cs...
Type: Bug Issue Description When using the C# extension and with the option "editor.acceptSuggestionOnCommitCharacter": true " seems to be incorrectly considered as a commit characte...
Oxy
Oxy12mo ago
Oopsie I didn't see I can close it if you want
333fred
333fred12mo ago
No worries
ero
ero12mo ago
I have this issue as well fwiw If this is a top-level file, args shows up because it's passed by default
Oxy
Oxy12mo ago
Yeah it's related to the commit option, if you disable it you won't have this issue anymore "editor.acceptSuggestionOnCommitCharacter": true This one, if you don't need it you can put that to false It's true by default It will be fixed soon anyway Oh but you're the ero from speedrun serv 👋
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.