Inline Ctrl - 1 and Ctrl -2.
Posted: Wed Feb 09, 2011 6:34 am
by Dr Danyo
Something I've just started using is;
Rather than switching to Ctrl 1 and Ctrl 2 when typing to pull up the properties / methods list, if you are an autohotkeys user
http://www.autohotkey.com/ the following script will allow you to pull up the list by using a double "," character for properties or a double "." for methods.
Take a look and let me know what you think (or if you have any improvements.
Code: Select all
#ifWinActive JADE
,::
if (A_PriorHotkey = "," and A_TimeSincePriorHotkey < 400)
{
Send, {Left}
Send, {Delete}
Send, ^1
return
}
else
{
Send, {,}
return
}
.::
if (A_PriorHotkey = "." and A_TimeSincePriorHotkey < 400)
{
Send, {Left}
Send, {Delete}
Send, ^2
return
}
else
{
Send, {.}
return
}
Dr Danyo.
Re: Inline Ctrl - 1 and Ctrl -2.
Posted: Thu Mar 03, 2011 8:08 am
by andy-b
Nice one. I have downloaded autohotkeys and am using this now. Since I have moved from Visual Studio to Jade I do miss the automatic intelisense and have only recently gotten used to pressing ctrl-1, ctrl-2 etc.
This will go some way to make my life easier
I have also added a section to your script to show the constants list if you perform a double "?" (I initially set this up to be a double "/" but of course this interferes with adding comments
)
Code: Select all
?::
if (A_PriorHotkey = "?" and A_TimeSincePriorHotkey < 400)
{
Send, {Left}
Send, {Delete}
Send, ^3
return
}
else
{
Send, {?}
return
}
Re: Inline Ctrl - 1 and Ctrl -2.
Posted: Thu Mar 03, 2011 10:05 pm
by Dr Danyo
Thanks Andy, that is a good addition (I've just added it to my script file).
I've recently also been working on a couple of refactors you might be interested in.
Ctrl # will take the selected text and create a variable for you
^#::
Variable =
clipboard =
NewClipBoard =
Send, ^c
ClipWait, 1
Variable = vars`r`n%A_Tab%%clipboard%
Send, ^a
Send, ^c
ClipWait, 1
InputBox, Type, Add Variable, Enter the JADE primivite type to use, 0, 250
If ErrorLevel
{
Send, {Right}
Return
}
StringUpper, Type, Type, T
StringReplace, NewClipboard, clipboard, vars, %Variable%%A_Tab%: %Type%;
clipboard = %NewClipboard%
Send, ^v
return
and Ctrl ; will try to extract the selected text into a new method on the same class.
^;::
; HotKey to extract method from selected text
NewMethodName =
Clipboard =
Send, ^x
ClipWait, 1
InputBox, NewMethodName, Extract Method, Enter the new method name, 0, 250
If ErrorLevel
{
Send, ^v
Return
}
Send self.%NewMethodName%();
Send {F2}
Send {Alt}M
Send J
Send %NewMethodName%
Send {Enter}
Send ^{End}
Send {Up 2}
Send {Tab}
Send ^v
Send {F8}
return
Re: Inline Ctrl - 1 and Ctrl -2.
Posted: Fri Mar 04, 2011 7:57 am
by andy-b
Ohh yes I like the create variable one
I am playing around with another hotkey, I am not sure if it will be more of a help or a hindrance but will trial it and see how it goes.
Pressing "(" will bring up the method signature tooltip.
I thought this could get annoying with having to press escape to remove the tooltip, especially for methods with no parameters.
So also when pressing ")" will automatically close the tooltip for you.
Of course this way also tries to perform a ctrl-5 wherever you type a "(", in comments etc.
I was thinking another option would be that a double "(" could trigger the tooltip if this way was a bit of overkill, but I prefer to type naturally and have the hotkeys support as much as possible.
Re: Inline Ctrl - 1 and Ctrl -2.
Posted: Fri Mar 04, 2011 8:29 pm
by Dr Danyo
Cool, here is what I use for (
Basically it auto completed the ); displays the signature and returns you to within the first ( character.
~Shift & 9::
{
Send, {(}
Send, {)}
Send, {;}
Send, {LEFT 2}
Send, ^5
return
}
Re: Inline Ctrl - 1 and Ctrl -2.
Posted: Fri Mar 09, 2012 8:19 pm
by BeeJay
Is this now somewhat obsolete with the new & improved AutoComplete feature in Jade 7?
Cheers,
BeeJay.