|T O P I C R E V I E W
||Posted - Aug 18 2020 : 06:30:28 AM
When using return switch expressions and other expressions where a discard (_)is used, after typing the _ VA insists in showing me all possible completions (great, as expected) but I have to cancel the completion list for it not to insert anything else.
Would be great to have the discard on itself allowed.
return a switch
1 => "lalala",
2 => "blalbla",
3 => "lolollo",
_ => "default"
|5 L A T E S T R E P L I E S (Newest First)
||Posted - Aug 25 2020 : 07:57:22 AM
I have put in a feature request to add _ as a symbol to listboxes in C#
I see what you mean about full focus on the listbox. VA is working on the theory that you are going to be using an existing symbol here, normally a reasonable assumption, but it does require we know all valid symbols here.
Is the full focus just an issue with discards, or is it proving to be a more general issue?
||Posted - Aug 20 2020 : 09:16:16 AM
I would like to see _ as option in the completion list, otherwise having only members starting with underscore is getting tiresome. In fact, its just like any other letter. The real problem here is the full focus, which makes you select an option in any case, instead of just writing ahead.
||Posted - Aug 20 2020 : 09:05:41 AM
Learning about discards as I go here. Based on this page, and the examples given:
typing _ is either the complete variable name, or the start of a variable name who's name starts with _
The switch syntax is something of a special case, but in general, I am not sure how we should be trying to handle this. Would adding _ as a "variable" to the listbox make sense as a good solution? It seems pointless having a listbox to accept a single character item, but it does solve the problem of separating out _ on its own and any symbol name who starts with _
Now I have a sensible test here, I am actually getting a listbox with focus that appears, and is then basically instantly replaced with a slightly longer listbox without full focus. So something in the VA and IDE options is happening here. But that doesn't actually tell us how to approach solving this.
||Posted - Aug 19 2020 : 1:00:41 PM
Yes, C# 8.0, .NET core 3.1
I do have some class members starting with _ so this might be a factor. I have the completion boxes with full focus, so always selects something.
||Posted - Aug 19 2020 : 12:42:24 PM
I am assuming you are working in VS2019, and this is C# 8 syntax, so you are using a C# project using .NET Core 3.1, is this correct?
This project type allows me to compile this code sample. So far, when testing this, when I type the underscore I then get a VA listbox immediately, not after typing the space after the underscore. For me the listbox has partial focus, the first item has outline only highlighting, so nothing is accepted from the listbox if I then type a space.
How does this compare to what you are seeing?