HI,
I am in the process of refactoring lots of code and found a few tiny enhancements that would make me more productive with (presumably) little effort: 1. When I rename a method and get a prompter, add a title to the prompter saying "rename method xxx to?" instead of "Refactory" 2. Set the input focus onto the input field for the new method name instead of the OK button, preselect the contents of the input field so that I can start typing right away 3. Make the OK Button the default button The same is true for the prompter of teh extract methode refactoring and probably some others. Joachim -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
On Monday, May 13, 2013 5:27:20 AM UTC-4, [hidden email] wrote:
I am in the process of refactoring lots of code and found a few tiny enhancements that would make me more productive with (presumably) little effort: Well, if we're going there,I've got another one. It would be really nice if refactorings would stop throwing in extraneous parentheses! Tom You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
Hi Tom,
I rarely see extraneous parentheses. Do you mix RB with VA Code Assist? As I said, the improvements I mentioned in my first post were low hanging fruit, meaning they don't require going into RB internals at all. There's a long list here in my drawer about RB improvements. Some even made me tinker around a little, but I finally put them aside because there were other things to do (and things started to become more complicated than it seemed to be at the start). Just a few examples: Why Does RB ask me which Accossor(s) to create if I selected one or more instance var names? Why does RB always reformat my source code - and why is the way it formats different than QA code formatter? Same goes for remove. The menu items should be consolidated and cleaned up. You often end up searching for extract method and extract to temporary because they are not in the place where you expect them. Joachim Am Montag, 13. Mai 2013 12:02:55 UTC+2 schrieb Thomas Koschate: On Monday, May 13, 2013 5:27:20 AM UTC-4, [hidden email] wrote: You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
Probably the most common refactoring I do is Extract Method. This causes the extra parentheses, not to mention the annoying code format differences between RB and QA formatters that I don't even want to get started on.
Tom -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
Tom,
okay, I see. it seems I never got upset about the result of extract method... but i hate how extract method treats comments in the extracted code. But the code formatting in RB is evil. Not only does it reformat differently than QA, it also removes all my blank lines. I do place blank lines to improve readabilty (at least I think it improves readability) very much. RB simply wipes them out and I sometimes have to bite on my tongue not to do physical harm to my computer... I think there should be an option for RB not to format at all, or a possibility to plug QA formatter into rb. or better both. But this is another category than the simple enhancements I mwntioned initially. Those could be integrated and tested in very little time and have some impact on developers' workflow. Joachim Joachim Am Dienstag, 14. Mai 2013 00:08:42 UTC+2 schrieb Thomas Koschate: Probably the most common refactoring I do is Extract Method. This causes the extra parentheses, not to mention the annoying code format differences between RB and QA formatters that I don't even want to get started on.-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
I'm away from my Smalltalk environment for the week, but I seem to recall some ability to change the RB's formatter behavior, but I could never get it to match the QA formatter. You can't get away from changes to the formatted code because the RB does its work on an internalized version of the method and then spits out a refactored lexically equivalent version. However, a pass through the QA formatter should be possible. I've tried, but not very hard.
I agree -there's other low-hanging fruit, but we don't seem to be making enough noise about it. Tom -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
At least the two of us try now ;-)
Enjoy your absence from Smalltalk ;-) Joachim
-- Am Dienstag, 14. Mai 2013 13:21:40 UTC+2 schrieb Thomas Koschate: I'm away from my Smalltalk environment for the week, but I seem to recall some ability to change the RB's formatter behavior, but I could never get it to match the QA formatter. You can't get away from changes to the formatted code because the RB does its work on an internalized version of the method and then spits out a refactored lexically equivalent version. However, a pass through the QA formatter should be possible. I've tried, but not very hard. You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk?hl=en. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by jtuchel
Coming back to this, because Pharo people also don't like the fact that RB reformats code, or at least does so in a different way than the platform's formatters do (in our case QA Code formatter, for example). See here: https://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2020-May/046393.html So I guess it would be great if there was some kind of plugin mechanism in RB that invokes some "native" code formatter instead of introducing its own strange one... It's a bit annoying that a method rename potentially reformats a couple hundred methods in the blink of an eye and leaves the cleaning to the user.... Joachim Am Dienstag, 14. Mai 2013 08:19:28 UTC+2 schrieb Joachim Tuchel: Tom, You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/54d50dd8-a575-4c9d-a05d-dc631a1bf43d%40googlegroups.com. |
Administrator
|
On Wednesday, May 20, 2020 at 2:42:38 AM UTC-7, Joachim Tuchel wrote:
--
I know at least one version of the RB had a pluggable formatter. I don't know if that's the case with the current code base.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/e8287e7e-9441-4681-9d94-81998dc84fa7%40googlegroups.com. |
Administrator
|
I have exported an application I created quite a while ago to tweak the default RBFormatter behaviour. As of VA 6.0.2, it worked. It probably needs some renewal to work with the current versions. It's attached, in a zip file. The two big changes are: 1) to force #ifTrue:ifFalse: to have their expressions on separate lines from the receiver expression and each other. 2) to force and: [ ...and: [ ...and: [.... to go on separate lines with the and: keyword lined up vertically. It isn't perfect, but 90% was better than nothing. It is free for anyone to do anything they like with it. Public Domain. Have fun. On Wednesday, May 20, 2020 at 9:37:04 AM UTC-7, Richard Sargent wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/34f38472-1573-4080-8b58-f47cf89e064f%40googlegroups.com. FormattingApp.zip (9K) Download Attachment |
In reply to this post by Richard Sargent
Richard, this is interesting. Stef also mentioned this on the pharo mailing list, I wasn't aware of this. Do you happen to know where to llok for this hook? I'd love to experiment with uing the QA Code Formatter as the default formatter for RB... Joachim Am Mittwoch, 20. Mai 2020 18:37:04 UTC+2 schrieb Richard Sargent:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/81bd99c7-e4ad-4547-bdef-eff977444032%40googlegroups.com. |
On Fri, May 22, 2020 at 5:09 AM Joachim Tuchel <[hidden email]> wrote:
+ That would be good. At least as an option. Mariano Martinez Peck Software Engineer, Instantiations Inc. Email: [hidden email] Twitter: https://twitter.com/MartinezPeck Blog: https://marianopeck.wordpress.com/You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibF0aDOb6tMYCaXFiZCb_XDScKX40090K5Um5Oe5yCj6Ow%40mail.gmail.com. |
Hi,
-- I'm less familiar with the code behind the RefatoringBrowser...but I see RBProgramNode>>#formattedCode From here, it looks like it would call 'FormatterClass' class var which you might inject the class CfFormatter into. As an experiment, you could then implement CfFormatter>>#format: Ideally, from this method you would return something like '^self formatText: aNode source class: methodClass width: 100' except that I don't see where I have access to the methodClass....and I'm guessing its simply not available by design since it seems to be a sort of context-free formatter. But like I said, I'm not familiar enough with the code, so what I showed just might be a place where you could start looking. - Seth On Friday, May 22, 2020 at 9:45:22 AM UTC-4, Mariano Martinez Peck wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/3c2e130b-d401-40ce-9e65-9e451604a5ac%40googlegroups.com. |
Administrator
|
In reply to this post by jtuchel
On Fri, May 22, 2020, 01:09 Joachim Tuchel <[hidden email]> wrote:
The exported app that I shared shows the way. I don't know anything about the QA Code Formatter. Unless it provides the same API as the RB Formatter, I don't see how it could be used by the RB tools.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAGNapENko3FtKqwqO4YgWSZYD7A6ZD446_BYb%3DV3RtDWP8miaA%40mail.gmail.com. |
Hi Richard. I am slowly coming to this conclusion as well. RBFormatter formats RBProgramNodes. This can be Methods, but also smaller artefacts like Assignments, Blocks, Message sends etc. CfFormatter formats methods and "bigger" artefacts like Applications, etc. At first sight, it seems like RBProgramNodes somewhat map to EsParseNodes that are used in CfFormatter. If I understand correctly, ESParseNodes end up writing themselves onto a Stream in #formatOn: while RBFormatter implements he formatting for each kind of node in its #format*: protocol. So it seems what needs to be done is convert the RBNodes (after refactoring) to EsParseNodes and have those do their output. Seems like Richard's approach of subclassing RBFormatter with a Class that does this converson and implements the API of RBFormatter and delegates the actual formatting to the created EsPerseNodes is the way to go. Not actually a trivial thing, and not what I'd call a hook ;-) I'll probably play around a little with this idea and see if I get anywhere... Joachim Am Freitag, 22. Mai 2020 17:22:12 UTC+2 schrieb Richard Sargent:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/46c1d049-df80-4cbe-a9fe-cf457cb9a850%40googlegroups.com. |
Administrator
|
On Fri, May 22, 2020 at 11:50 AM Joachim Tuchel <[hidden email]> wrote:
I guess one of the things that hasn't been discussed is what formatting differences you desire compared to the default RB formatting. Adapting a different formatting strategy to RB might be more work than writing the RB formatter to do it. I'm not saying it would be, as I don't know what your goals are. I am always wary of "This is the solution I want to the (unarticulated) problem I have" statement of requirements.
Definitely not trivial. Hence my thought that staying in the RB realm might be easier. *might*
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAGNapEPzvKvOoZwunkgtwqE1rHX-mv8BTaQykW6PC2pzsRMFbA%40mail.gmail.com. |
Hi Richard, havng looked into this RB reformatting stuff a little, I tend to agree. Maybe the way to go is tame RB's reformatting the way you did and reuse that in order to replace QA Code Formatter. All that's needed is a menu item and keyboard shortcut in the browsers once the RB reformatter does a better job... Joachim You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/571015f7-3474-4ddf-ac3a-8fd65df6ea87%40googlegroups.com. |
I had posted something last August here in the forums about overriding the sourceString method of CompiledMethod to use the Envy QA formatter to allow people to see the code formatted the way they like without triggering a save every time it gets reformatted. Don't know if it is useful to anyone, but here's the link to the thread..... *Steve* You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/2b881a2c-06d3-4560-bfb5-299f2fa0cb2b%40googlegroups.com. |
Free forum by Nabble | Edit this page |