Hello, When I run a refactoring, Rename Method, for example, the refactoring is reformatting the code affected. Is it possible to configure Pharo to refactor without reformatting code? Depending on the refactoring, the reformat is so intrusive that make it more worth to make the refactoring by hand. Regards, Vitor |
That seems to violate the Principal Of Least Surprise. Whether or not it ends up getting changed, I think its worthwhile entering that directly in the issue tracker. It would assist if you could bisect to isolate which commit introduced the behaviour. cheers -ben On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz <[hidden email]> wrote:
|
Hi,
Yes, I happen to also not like that behaviour :(
Opening an issue is a good start. I also wonder, I think refactorings work like this since the beginning? But if it was introduced at some point, it should be nice to know if it can be easily reverted. Also, refactorings DO need to rebuild the source code after refactoring, so maybe there are some cases where maintaining the old formatting is difficult?
|
Am 20.05.20 um 10:45 schrieb Guillermo
Polito:
Hi,
me too. Although I am not on Pharo ;-) At least for the last 15 years.
Yeah, that's why I think it would be great if the RB engine could be extended with a(n optional) hook to call some "local/personal" formatter instead of reformatting immediately. This way we could at least make sure that the reformatting happens according to our taste and in line with whatever we use to format our code. Preserving the old formatting is likely to not be a good idea at least for some refactorings lie extract method, in addition to possibly being difficult. The plus of such a plugin/hook approach is that this could
probably be maintainable cross-platform. Every dialect could plug
their formatter without changing RBs internals. I don't know if
there still exists some "common code base" of RB at all, so maybe
this is just stupid blah blah anyways...
Joachim
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel [hidden email] Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 |
Hello,
Thanks for the reply. Yes, for me this behavior happens since ever. I can open an issue, but I will not be able to pinpoint the VCS commit where this behavior was introduced... One
thing I don't understand is why reformat is needed in some refactor
cases? I have never seen this behavior in any other IDE I have used. For
example, why extract method should reformat the entire method?
Shouldn't it replace the code extracted with the new message send? Sure,
the new message sent replacing the old code might be formatted according to the default
formatting configuration, but why does the refactoring process need to
touch the rest of the method code? Also, the old code needs only to be pasted in the new method with some changes, does it need to be reformated? Regards, Vitor
|
In reply to this post by jtuchel
You can pass to the pharo formatter a context and the setting browser shows you the formatting options.
-------------------------------------------- Stéphane Ducasse 03 59 35 87 52 Assistant: Julie Jonas FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France |
In reply to this post by Vitor Medina Cruz
There is what we would love to have and there is what we have.
It is difficult to conserve the formatting of the original method especially on extract or more generally on code transformation. Now it does not mean that we like it this way. But given the ratio income/results I think that Pharo is super super good. But but people can help people can pay for more. S.
-------------------------------------------- Stéphane Ducasse 03 59 35 87 52 Assistant: Julie Jonas FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France |
Ok, so should I open the issue or leave it as it is? On Wed, May 20, 2020 at 2:08 PM Stéphane Ducasse <[hidden email]> wrote:
|
I think what Stef means:
- yes, please open an issue (maybe check there is no one already there?) - If somebody wants to give it a try at fixing this, it would be SUPER welcome :P :) (and that nobody needs to be an expert to do that, it’s the other way around, you become an expert by doing it ^^)
|
I wanted to take a look at this, but I could not reproduce the
issue, although I distinctly remember I had the issue at some
point. On 21/05/2020 12:06, Guillermo Polito
wrote:
I think what Stef means: |
I will setup a class with examples, open an issue and then reply here. On Thu, May 21, 2020 at 11:20 AM hogoww <[hidden email]> wrote:
|
I attached a filled out class with some examples. On Thu, May 21, 2020 at 2:35 PM Vitor Medina Cruz <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |