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
 suggestions/completions for Tuple stype assignment
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Apr 20 2020 :  06:21:28 AM  Show Profile  Reply with Quote
This is for sure the weirdest form of assignments and I am not sure if this should be a feature request or a bug request.

Given:
public void test()
{
	bool b; int i; string s;
	(b, i, s) = (true, 10, "test");
}


There is absolutly no suggestion or completion available inside the brackets.

Or another example:
public (bool, int, string) test(int n, bool v, string t)
{
	return (v, n, t);
}

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Apr 20 2020 :  2:32:19 PM  Show Profile  Reply with Quote
In both examples, can VA really take the Tuple to be "defined"? I am not sure myself, still reading up on and learning about some C# features.

From this page Tuple's can have just types for their components, or the components can also be named:

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

but in either case, Tuples are described as light weight, almost "temporary" things. Once the code is finished, it is reasonable to compare the tuple created to the one being assigned, or to the return type, but in general we don't know much about a tuple going into it, do we?

Or am I approaching this backwards, and you are wanting VA suggestion listboxes to suggest variable names when VA thinks you are typing a Tuple? If this is the case, I have tried the following simple example in C#, using VS2019 and VA 2366.0:

private (int, int) playingWithTuple()
{
    var namedTuple = (dimention: 23, length: false);
    int rectangleHeight = 3;
    int rectangleWidth = 4;
    var rectangleDimentions = (rectangleHeight, rectangleWidth);
}

when I am typing the Tuple, on the "rectangleDimentions" line, I am getting VA suggestions for the components, based on what I have started typing.

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

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Apr 21 2020 :  04:08:32 AM  Show Profile  Reply with Quote
In the case of my sample provided, types are known because they are defined outside the tuple. Yet no suggestions are made, so it seems that VA does not analyse the left side of the assignment. And in the case of the function returning a tuple, the type is also defined, so i would assume that VA would suggest the closest match of the same type.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Apr 21 2020 :  08:13:06 AM  Show Profile  Reply with Quote
We don't yet support tuples, but are working on getting support for them done soon:

case=99749

Here, are you thinking in terms of a suggestion inside the brackets, so a suggestion for each member of the tuple, or for VA to suggest a new tuple that is made up of existing members that match the types required? In your examples there is only one correct order for the local variables, but in general there will be several different valid combinations / orders for the tuple.

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

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Apr 21 2020 :  08:28:51 AM  Show Profile  Reply with Quote
In my logic I would expect a suggestion of default values when existing or any/all of the closest same-type variables. But anyway, case=99749 should solve this I hope.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Apr 21 2020 :  12:41:53 PM  Show Profile  Reply with Quote
That makes sense. Would one suggestion list per value, so a new suggestion listbox after each comma, work well in these situations? This way it is easy to handle 3 or 4 suggestions for each part of the tuple, without considering the total number of possible combinations of variables.

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

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Apr 21 2020 :  12:56:51 PM  Show Profile  Reply with Quote
Actually this is exactly what I would expect to happen. The coma should always initiate a new suggestion/completion list, just as it does for parameters in a function. At least when the type can be determined. Otherwise nothing more than letter by letter elimination from the global value pool is possible.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Apr 22 2020 :  05:33:44 AM  Show Profile  Reply with Quote
This makes sense, I just wanted to make sure that we were thinking about the same thing. When I started looking at tuple's I was thinking of them as a single complete item, rather than a collection of items, which is a better way of thinking about them. I have put the examples and comments for this onto the case.

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