Extention Methods using Statements

7 posts, 0 answers
  1. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 03 Sep 2010 Link to this post

    'ctrl + dot' on a unknown method
    does not automatically suggest using statements for ExtentionMethod namespaces

    example:
    IEnumerable<string> mydata = GetData();
    mydata.ToList(); //a ctrl dot on ToList will not suggest adding System.Linq
  2. Deyan Varchev
    Admin
    Deyan Varchev avatar
    150 posts

    Posted 04 Sep 2010 Link to this post

    Hi Tommy,

     Again many thanks for the report. I tried to reproduce the problem but with no success. Let me see if I understood you correctly. When you enter the code you mention then JustCode reports ToList() as unknown method and underlines it in red. Then you go to the method and hit Ctrl + dot to open up the visual aids menu - I attached an image of what is shown (Image_1.png). If you have unit tests in your solution you might see the tests menu first. In this case you need to hit the right arrow to go to the fix menu (F) (Image_2.png). There you see the option to use System.Linq.
    You can directly open the fix menu hitting Alt + Enter instead of Ctrl + dot.

    I hope this will help you. In case something is different and you are not able to see Use System.Linq please write back with what's different from the things I described.

    Sincerely yours,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 04 Sep 2010 Link to this post

    "Alt + Enter" and "ctrl + dot" do not bring up any helper context menus 
    I can hover the mouse over the tiny jsutcode menu and have it pull up the option to add the System.Linq using statement there.

    Also if you dont have a method Parenthesis that menu will not have an option to and the Using statement;
    ienum.ToList vs ienum.ToList()
    That means you have to type the parenthesis open and close then move the carret back to ToList before the menu will suggest using System.Linq

    I know control dot is a VS thing and not justcode but this used to work all the time when I was using resharper (on my old computer)
    either resharper added this feature for extentionmethods and ctrl dot  or justcode is blocking this (on my machine at least)

    Also I heard something about "ctrl+ ~" being used in the future for justcode refactor menus shortcut. When is that coming? I believe I have the latest build.
  5. Deyan Varchev
    Admin
    Deyan Varchev avatar
    150 posts

    Posted 10 Sep 2010 Link to this post

    Hello Tommy,

     Sorry for the late response. It was my mistake to point Ctrl + dot as the shortcut for showing JustCode's visual aids menu. In the latest release (Q2 Service Pack - 2010.2 826) the visual aids have keyboard navigation as well - the shortcut is as mentioned Ctrl + ~ (or more accurately Ctrl + `). It will show the available context menus and you can use the arrows to navigate through them. Ctrl + dot is what VS has as shortcut for opening their smart tag, but you can override it by going to Tool | Options | Environment | Keyboard. Then you can remove the shortcut Ctrl + . for the View.ShowSmartTag command and add it to JustCode.VisualAid. This way when pressing Ctrl + . you will show JustCode's smart tag.

     I tested the other case you mention, namely writing someArray.ToList (without parentheses) and trying to fix it. With and without JustCode, Visual Studio smart tag doesn't show up. You are right that JustCode needs the parentheses to be able to fix the problem and offer you to use some namespace. That's because if you don't have them we assume it's not a method but rather a property/field access and thus do the analysis bases on this assumption. This will greatly improve once we implement some smart intellisense that will allow you to choose the members you want to use even if the namespace is not in the using statements.

    Regards,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. MiddleTommy
    MiddleTommy avatar
    163 posts
    Member since:
    Nov 2009

    Posted 10 Sep 2010 Link to this post

    Funny I am using the Q2.826 and the ctrl + ` in not working. I will change my keyboard mapping manually (maybe on a fresh install vs upgrade the key mappings are there) now that I know what to map it to.

    And just for clarification when I meant ctrl + dot not working I was implying that it was not bringing up the visual studio refactor "add missing using statement " and thought maybe JustCode was suppressing it (accidentally). It has been a few months but I dont remember ever having this ctrl + dot issue when using Resharper (I had other issues hence the switch to JustCode). Or perhaps Resharper added the "add missing using statement" for extention methods functionality.

    Thanks for your help
  7. Hank
    Hank avatar
    4 posts
    Member since:
    Jul 2012

    Posted 14 Oct 2010 Link to this post

    I also have this problem. After installing the Q2 updates, the VS ViewSmart Tag is gone.
    I've found that if I simply go into Tool | Options | Environment | Keyboard, and not even change anything, simply hit ok, I can get the smart tag to appear once, but only once.

    I've actually use this quite a bit, so I've gotten into the habit of using the keybinding that opens up the Keyboard Settings and hitting enter, just to use the Smart Tag. lol


  8. Hank
    Hank avatar
    4 posts
    Member since:
    Jul 2012

    Posted 18 Oct 2010 Link to this post

    Downloaded the new Q3 Internal Build. This issue is fixed for me.

    Thanks!
Back to Top
DevCraft banner