Not sure if anyone else notices this, but it really spoils my programming
experience when I realise that I need some brackets around the previous statement so that I can do an #ifTrue: or a #do: etc. Maybe its how my brain works, but I I think about the reciever, and then message I send to it, and then just when I' a about to start typing one of the abover messages, I then realise, damn without the brackets I'm going to get a DNU. At this point I really wish there was a CTRL-) that would surround the previous statement with a matching ( bracket. Anyone else notice this? I kee thinking I should just type superfluous ()'s all the time and rely on the reformatter to remove them, but I hate typing the ()'s as they are a bit of a reach on the keyboard when touch typing. Tim |
TimM wrote:
> At this point I really wish there was a CTRL-) that would surround the > previous statement with a matching ( bracket. Try the attached package. Largely untested. Could probably be improved significantly by someone who understands the RB parser (I do not) and how it is used by the workspace (which I also do not). -- chris`1 begin 666 CU Parenthesise Keyword.zip M4$L#!!0````(`"IU63.O_+7F/ <``" 4```;````0U4@4&%R96YT:&5S:7-E M($ME>7=O<F0N<&%CO5A_;QLW$OU;`?P=QO(!*^'L15RT14^YZYVM)(712QI4 M28.#K0+4+J5EM4OND5PK`OR%[EOV#;E:R:DL&W?7`@&R&LX,AX^/\\-W5(ML M*1:2[HZ>;3Y'?Z-W[:<6E1Q1,OX`B97:%](I)^E[N5X9FR?IUJ@6GWZ2UBFC M1W3^XNA9;R:<RL:FJF#&+DR]MFI1>/H/C0NK''VH:U&>TA?/GW\%/QG+TH9E M_ZBD%PMMG%=9:NSBZ-G1LS=*&TO8=.FPHR3YR4O-NY$OA*=*+*6CL;>F_/-S M4MI)ZVDP)&%-HW/H($ K;Y5I'"UC\.0D5N T$RX3N4QYF_=0]-)6CF FL6&A MLH+6IL$.:VIP=%\@=&?F?@5 X%^.<-9_L4+C/&GC*2N%JF)8;+BRQDM2/GU$ MSZSTCA9OI3S%-1L6@<\R!'F5)#F)&@?*E B^2<V#CUSE.DD\_G?>JEF#Q<KD M:JYD3K?Q=ARME"],$WR74B 8;]=*+\@;'+TLJ<*Q9JS J&6%T M R][9C"\0 MZ/D"R)01L][9&87;XQ])$&U($3@PR:RJ_05(<%+SG6KG!;:I&Z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KN;AXA?J M5NH(L$-8S#K./)_QD3(#?B#);<B(0N"0K,)3N]=9<\ YMZ@`BMNET/VB?Y7" M1MJ%9CX//2BV#QMO[M2!DT%:Y7DIX[/P9BGU*4LU/+L5G\PVV":<;,4#2A3# MR5R43J;WF1M0[".;^H_"7>4T5];Y*WSU,<4@^S*+3\8?\*QDGCY,Z$,$.(1Y M=-EWBA\S&22&2CG1/K#>(+C=/,01_6DT!'2O^1B!?^% T]8'O@T@U6@_<25F M%8\6,&W1XV:?!H1&-0PNBJ^Q0$I#!94X'CK43,2Q1M*/E_ YLV85((V-;9PE M<#6HPP6T_4I*S7U=K\LX>%3G$(A0(WJ#>_+A]DB05I>ET$L'-PNTJVW*'21\ MP/>VV7.^K) (-20C5#9,8Y)GK@Y;M66'^HP>8=]P7>'GA-'@9KDS'M)?=SWM M#0!308EI4.-R;GDN="VV'32R#DQ']<\4>I.R%(F+&[8W2@.>&S$&1+B':<K, MV5(/]-D&\2U25LC?UYL>`2>\0&>L\MC[8(ZSXT)8Y(V#I#L[;VG7_1Y&DH?$ MU=&==W]TIW!WP81M!]O08Z2=L^G^6^P'FGHT/G4L;N&%L30^M=V))+9!(>'& MU5==>8IQQ"4N">%F@\[8Z.V2T:^L-9:SO+06>?XS/F$^YB2$#BH'F7"3*YF M4:4Q2Z;LW-B_<V@_MWE N3:14O"Y$;Z)B:Y%8"-M_R:"\>,XMFZ'>NNC/[8[ MN/^7D-@%Y+][,S78-%-#-%-TO+_[S%!Z%L8JR0WHZ,%AZABGJ^#-'=?-K%39 MT_T].F3]UZX/#E_'A2QK:>$TEM<G>SU,G+W!XIF]BJS8C$]Y-R7$OK\_P5R! MS>*DT X#<:+8# S]RS#6W5?Y%5!+`0(4"Q0````(`"IU63.O_+7F/ <``" 4 M```;``````````$`( ````````!#52!087)E;G1H97-I<V4@2V5Y=V]R9"YP 886-02P4&``````$``0!)````=0<````` ` end |
Hey Chris - I finally got a chance to give it a whirl... its close but not
quite, but you've shown how to approach it and its a good little train ride to work project to play with. Basically things like the following don't work: mockFile isPresent or: [ 2 = 3 ] 5 = 3 or: [ 2 = 3] It puts brackets around the "isPresent" or the "3", so I guess it doesn't quite find the highest parent parse node... (having recently played with the parser I think I'm starting to get the hang of it). By the way - I notice you register your keystroke as follows: bindings := SmalltalkWorkspace acceleratorKeyBindings. bindings at: 'Ctrl+0' put: #parenthesisePreviousKewordSend;.... Someone else posted the following to me: browsers := OrderedCollection with: ClassBrowserShell with: SystemBrowserShell. browsers do: [:shell | bindings := shell acceleratorKeyBindings. bindings at: 'Ctrl+0' put: #runCurrentClassAsUnitTest. Which is the best way? It seems like what I was shown takes priority over your approach (I happen to use Ctrl-0 to run all my tests). I think yours does it for all browsers? Thanks for hacking this together for me though... Tim "Chris Uppal" <[hidden email]> wrote in message news:[hidden email]... > TimM wrote: > >> At this point I really wish there was a CTRL-) that would surround the >> previous statement with a matching ( bracket. > > Try the attached package. Largely untested. Could probably be improved > significantly by someone who understands the RB parser (I do not) and how > it is > used by the workspace (which I also do not). > > -- chris`1 > > > |
TimM wrote:
> Hey Chris - I finally got a chance to give it a whirl... its close but not > quite, but you've shown how to approach it and its a good little train > ride to work project to play with. > > Basically things like the following don't work: > > mockFile isPresent or: [ 2 = 3 ] > 5 = 3 or: [ 2 = 3] That's right. The specification I was working from ;-) was to find the shortest complete and grammatically correct prior sequence, which in both those cases would give the wrong answer. It turns out that for me it's usually close enough and I'm finding it a useful extensions, although it is really no more than a proof-of-concept that should be reimplemented properly. A /much/ better approach would be to plug into the RB stuff for the whole expression/method, but -- as I said -- I don't know how to do that. Indeed I don't know whether it is even a well-defined concept for workspaces in general (code-completion has problems in "pure" workspaces too). I have no current plans to try to improve it, but you are the one with commuting time to fill. Happy hacking ! > By the way - I notice you register your keystroke as follows: > > bindings := SmalltalkWorkspace acceleratorKeyBindings. > bindings at: 'Ctrl+0' put: #parenthesisePreviousKewordSend;.... > > Someone else posted the following to me: > > browsers := OrderedCollection with: ClassBrowserShell with: > SystemBrowserShell. > > browsers > do: > [:shell | > bindings := shell acceleratorKeyBindings. > bindings at: 'Ctrl+0' put: #runCurrentClassAsUnitTest. Well, for /my/ purposes I think the way I did it is better. I want the accelerator added to /all/ workspaces, no matter what tool (workspace, debugger, inspector, ...) they are embedded in, not just to the System- and ClassHierarchyBrowsers. -- chris |
Free forum by Nabble | Edit this page |