Refactor without formatting
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 <vitormcruz@gmail.com> wrote:
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
Hi,
El 20 may 2020, a las 1:54, Ben Coman <btc@openinworld.com> escribió:
That seems to violate the Principal Of Least Surprise.
Yes, I happen to also not like that behaviour :(
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.
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?
cheers -ben
On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> wrote: 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
Am 20.05.20 um 10:45 schrieb Guillermo Polito:
Hi,
El 20 may 2020, a las 1:54, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> escribió:
That seems to violate the Principal Of Least Surprise.
Yes, I happen to also not like that behaviour :(
me too. Although I am not on Pharo ;-)
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.
Opening an issue is a good start.
I also wonder, I think refactorings work like this since the beginning?
At least for the last 15 years.
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?
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
cheers -ben
On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> wrote:
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
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de 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 On Wed, May 20, 2020 at 6:52 AM jtuchel@objektfabrik.de < jtuchel@objektfabrik.de> wrote:
Am 20.05.20 um 10:45 schrieb Guillermo Polito:
Hi,
El 20 may 2020, a las 1:54, Ben Coman <btc@openinworld.com> escribió:
That seems to violate the Principal Of Least Surprise.
Yes, I happen to also not like that behaviour :(
me too. Although I am not on Pharo ;-)
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.
Opening an issue is a good start.
I also wonder, I think refactorings work like this since the beginning?
At least for the last 15 years.
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?
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
cheers -ben
On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
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
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de <jtuchel@objektfabrik.de> 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
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â¦
But this is the case. You can pass to the pharo formatter a context and the setting browser shows you the formatting options.
Joachim
cheers -ben
On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> wrote: 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
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de <mailto:jtuchel@objektfabrik.de> Fliederweg 1 http://www.objektfabrik.de <http://www.objektfabrik.de/> D-71640 Ludwigsburg http://joachimtuchel.wordpress.com <http://joachimtuchel.wordpress.com/> Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 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
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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 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 <stephane.ducasse@inria.fr> wrote:
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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 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
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 ^^)
El 20 may 2020, a las 21:16, Vitor Medina Cruz <vitormcruz@gmail.com> escribió:
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 <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: 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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> 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
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. Could you describe the problem further please? Pierre On 21/05/2020 12:06, Guillermo Polito 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 ^^)
El 20 may 2020, a las 21:16, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> escribió:
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 <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote:
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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com <mailto:vitormcruz@gmail.com>> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> 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
I will setup a class with examples, open an issue and then reply here. On Thu, May 21, 2020 at 11:20 AM hogoww <pierre.misse-chanabier@inria.fr> wrote:
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. Could you describe the problem further please?
Pierre On 21/05/2020 12:06, Guillermo Polito 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 ^^)
El 20 may 2020, a las 21:16, Vitor Medina Cruz <vitormcruz@gmail.com> escribió:
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 < stephane.ducasse@inria.fr> wrote:
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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 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
Here: https://github.com/pharo-project/pharo/issues/6387 I attached a filled out class with some examples. On Thu, May 21, 2020 at 2:35 PM Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
I will setup a class with examples, open an issue and then reply here.
On Thu, May 21, 2020 at 11:20 AM hogoww <pierre.misse-chanabier@inria.fr> wrote:
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. Could you describe the problem further please?
Pierre On 21/05/2020 12:06, Guillermo Polito 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 ^^)
El 20 may 2020, a las 21:16, Vitor Medina Cruz <vitormcruz@gmail.com> escribió:
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 < stephane.ducasse@inria.fr> wrote:
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.
On 19 May 2020, at 19:33, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
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
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 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
participants (6)
-
Ben Coman -
Guillermo Polito -
hogoww -
jtuchel@objektfabrik.de -
Stéphane Ducasse -
Vitor Medina Cruz