Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Lambda expressions and suggestions

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
mccheese Posted - Jun 18 2008 : 07:17:08 AM
It would be nice to stop auto-completion when typing the initial stage of a lambda expression e.g.

myDataTable.AsEnumerable().Where(x=>x.Field<int>("ID") == 1)

Currently, the intellisense kicks in after pressing '=' after the x therefore selecting the first x in the suggestions which is very annoying . I've set VAssistX to submit on Tab and removed '=' from the intellisense list for C# but the only way to stop it auto-completing is by turning off VAssistX every time i'm writing an expression.

Is there any way to stop this behaviour? Would it be possible to get VAssistX to recognise the start of a lambda expressions?

Thanks.
8   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 24 2008 : 2:29:11 PM
The most irritating thing here is that now I am seeing the same problem you are, but I don't know why. I do not seem to have made any changes to my VA or IDE options, but now "y" is replaced with "yield" every time, on two different machines. So why did I not see this problem the first time round?

Hopefully our developers will not have that problem:

case=17869

Thank you for your detailed bug report. Once this started happening it is very easy to reproduce.
mccheese Posted - Jun 24 2008 : 05:45:34 AM
Hi Feline,

Here is a collection of screen shots that may help explain the problem a bit better and the steps needed to re-create. Firstly my settings:









And this is what happens when I type in, note that yield is a keyword in c# and Func is a pre-defined delegate that lives in the System.Linq namespace.



On pressing space or = then yield is entered into the code automatically when a suggestion is not required at this stage as it is essentially a parameter name declaration. With VAssistX turned off, standard intellisense suggests yield but the suggestion box doesn't have focus and therefore it doesn't get submitted into the code in the next key press.

Changing the intellisense option as suggested like so:



Then suggestions are no longer provided for types e.g. if I add the System.Data namespace I'd expect to see the DataTable types in the suggestion box but I don't, only snippets and a few of the expected types.



Clicking 'Show All Symbols' or pressing ctrl-space shows everything but I'd rather be able to see the list in full by default if this is the only way to stop suggestions occurring for lambda expressions.

For the expression part of a lambda expression, the intellisense recognises the fact that 'y' is a parameter so I've had no problems with further suggestions.

A good explanation of lambda expressions can be found here: http://blogs.msdn.com/ericwhite/pages/Lambda-Expressions.aspx

Hopefully this clears up the problem I'm having with lambdas ;)

Sorry about all the images, seems the best way to explain after your last post!



feline Posted - Jun 20 2008 : 11:44:01 AM
mccheese I am not seeing the problem you are experiencing. I found this description semi useful:

http://www.codeproject.com/KB/linq/UnderstandingLINQ.aspx#LambdaExpressions4

It would help more if I knew what a delegate was but it allowed me to produce the following C# code, using VS2008 and VA 1640, which compiles quite happily:

class testCreatingDelegates
{
    // define the delegate type "MyDeleg"
    delegate R MyDeleg<A, R>(A arg);

    // doing something with delegate via an using anonymous method:
    MyDeleg<int, bool> IsPositiveAnonymous = delegate(int num)
    {
        return num > 0;
    };

    // doing the same thing using a lambda expression:
    MyDeleg<int, bool> IsPositiveLambda = num => num > 0;

    // try to reproduce thread problem
    int yield;
    MyDeleg<int, int> powerOf2 = y =>
        {
            return y * y;
        };
}


Notice I also typed in your sample, after changing the Delegate name to match the name I was using. I also added the member variable "yield" to make sure it would be suggested. The attached screen shot shows what I saw - a VA suggestion listbox:



When I typed the space after "y" the suggestion was *not* accepted. How similar is this to what you saw? Can you try adding my code to your solution and see what you get?

Do you have:

VA Options -> Advanced -> Listboxes -> Selections committed with: Any character not valid in a symbol

turned On or Off? This is turned Off on my system.
feline Posted - Jun 20 2008 : 09:11:08 AM
Can you start a new thread for this please? This does not seem to have anything to do with Lambda expressions in C#

Also you need to mention the IDE and programming language you are working in, since some of these points actually depend on both.
Dans Posted - Jun 20 2008 : 06:54:54 AM
quote:
Originally posted by feline

Turning off "Show completion list after a character is typed" is not supposed to do that. This used to be the standard work around to get Snippets to work in C#.



Feline, i'm looking for option to disable VA's Auto list box/Snippets popuping. I just need activating this feature by shortcut Ctrl+Space for example. It's not only my request. I know about ten people (regardless of many on other Developer forums) that are angry that VA popups something during typing. VA's suggestions is a good thing but we need to activate it only on demand.

It's another advantage for creating more Advanced options. You created some new feature, listen your own heart and implement behaviour that you think is the best... but this needs tweaking!

For example:
I don't like that Alt+G locates code in different positions. Sometimes on top of editor, sometimes in center sometimes in bottom. Every time when i jump i need to search little blinking carret in high resolution monitor. Save my eyes and time!

Possible options:
  • position carret in top of editor maybe with specified line offset (my prefer)

  • position cerret in center of of edit window

  • position cerret in center of visible area

  • leave as is (default)

  • switch: highlight located line and hide highlighting after key press


  • What you usually do when developer requested this:
  • Give him workaround: You can use for this our feature Highlight current line it will help you to locate carret (i don't like highlight)

  • Give him answer: we don't want to increase options dialog and changing current functionality - it will affect current customers. (hm, it's your product)

  • Or: we don't think that this will be useful by someone else (i want to fight with someone )

  • Consequence:
  • Nothing done or task postponed for unknown time period

  • Developer disappointed, and never go back to this forum. Search for other tool, nothing, C++ too difficult to parse...


  • Nothing personal
    feline Posted - Jun 19 2008 : 8:29:40 PM
    Turning off "Show completion list after a character is typed" is not supposed to do that. This used to be the standard work around to get Snippets to work in C#.

    Do you still have:

    IDE tools menu -> Options -> Text Editor -> C# -> General -> Auto list Members

    turned on?

    I need to read up on Lambda expressions a bit.
    mccheese Posted - Jun 19 2008 : 04:58:11 AM
    Turning off [IDE tools menu -> Options -> Text Editor -> C# -> IntelliSense -> Show completion list after a character is typed] appears to fix the problem! I've noticed that turning it off stops intellisense providing a full list of suggestions though .

    A lambda expression is anything that follows the "(input parameters) => expression" syntax and can be used with delegates like so:
    
    Func<int, int> powerOf2 = y =>
                    {
                        return y * y;
                    };
    

    With [Show completion list after a character is typed] and VAssistX turned on, typing in the above code will produce
    Func<int, int> powerOf2 = yield=
    .... as yield is the first y in the list.
    feline Posted - Jun 18 2008 : 4:01:08 PM
    Does turning off:

    IDE tools menu -> Options -> Text Editor -> C# -> IntelliSense -> Show completion list after a character is typed

    help?

    Does the following code snippet and comments describe the problem you are seeing?

    void testLinqFunctionParameterListboxFocus()
    {
        List<string> list = new List<string>();
        // this compiles, note "x" and "m" are never declared
        list.Find(x => x.Length > 5);
        list.Find(m => m.Length > 2);
        // bug - uncomment these two calls and disable VA
        // turn on:
        // IDE tools menu -> Options -> Text Editor -> C# -> IntelliSense
        //      -> Show completion list after a character is typed
        // type "m" in Find(), and notice the listbox item "mbox" does Not have focus
        // type "m" in Remove(), and notice the listbox item "mbox" Does have focus
        // with VA enabled both function parameter listboxes have focus
    /*
        list.Find();
        list.Remove();
    */
    }
    


    If Linq and Lambda are talking about the same thing then it might. This comes from:

    case=16277

    © 2023 Whole Tomato Software, LLC Go To Top Of Page
    Snitz Forums 2000