This is a migrated thread and some comments may be shown as answers.

Extention Methods using Statements

6 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MiddleTommy
Top achievements
Rank 1
MiddleTommy asked on 03 Sep 2010, 06:00 PM
'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

6 Answers, 1 is accepted

Sort by
0
Deyan Varchev
Telerik team
answered on 04 Sep 2010, 12:33 PM
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
0
MiddleTommy
Top achievements
Rank 1
answered on 05 Sep 2010, 12:20 AM
"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.
0
Deyan Varchev
Telerik team
answered on 10 Sep 2010, 10:07 AM
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
0
MiddleTommy
Top achievements
Rank 1
answered on 10 Sep 2010, 03:08 PM
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
0
Hank
Top achievements
Rank 1
answered on 15 Oct 2010, 12:04 AM
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


0
Hank
Top achievements
Rank 1
answered on 18 Oct 2010, 05:43 PM
Downloaded the new Q3 Internal Build. This issue is fixed for me.

Thanks!
Tags
General Discussions
Asked by
MiddleTommy
Top achievements
Rank 1
Answers by
Deyan Varchev
Telerik team
MiddleTommy
Top achievements
Rank 1
Hank
Top achievements
Rank 1
Share this question
or