Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 better handling of discards
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Aug 18 2020 :  06:30:28 AM  Show Profile  Reply with Quote
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.

like in:
return a switch
    {
        1 => "lalala",
        2 => "blalbla",
        3 => "lolollo",
        _ => "default"
    };

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Aug 19 2020 :  12:42:24 PM  Show Profile  Reply with Quote
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?

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Aug 19 2020 :  1:00:41 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Aug 20 2020 :  09:05:41 AM  Show Profile  Reply with Quote
Learning about discards as I go here. Based on this page, and the examples given:

https://docs.microsoft.com/en-us/dotnet/csharp/discards

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.

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Aug 20 2020 :  09:16:16 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Aug 25 2020 :  07:57:22 AM  Show Profile  Reply with Quote
I have put in a feature request to add _ as a symbol to listboxes in C#

case=142814

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?

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000