<div dir="ltr"><div>Hi folks,</div><div><br></div><div>Attached is a fix for the order in which the parameters of the extract method refactoring </div><div><br></div><div><b>Actual behavior</b>: when extracting a method using the Extract Method refactoring, the order of the parameters is non-deterministic.</div><div><br></div><div>Trying to extract <font face="monospace">a + b</font> from the following example multiple times might suggest to the user the message <font face="monospace">keyword1: a keyword2: b</font> or <font face="monospace">keyword1: b keyword2: a</font> randomly.</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">a := 1.</font></div><div><font face="monospace">b := 2.</font></div><div><font face="monospace">^ a + b</font></div></blockquote><div><font face="monospace"><br></font></div>This bug has two causes:<div><ul><li><font face="monospace">Encoder>>#initializeCompleteSourceRangesBasedOn:</font> uses a <font face="monospace">Dictionary</font> to store source ranges.</li><li>Even if this is fixed, <font face="monospace">Encoder</font> itself uses a <font face="monospace">Dictionary</font> to store source ranges (used in the method above).</li></ul><div>This use of <span style="font-family:monospace">Dictionary</span> makes enumeration order non-deterministic.</div><div><br></div><div><b>Expected behavior</b>: parameters should be suggested in the order they appear in the source code.</div><div><br></div><div><b>Proposed solution</b>: the bug was fixed by sorting the parameter nodes for the method to be extracted by the position they appear in the source code.</div><div><br></div><div>Cheers!</div><div>Nico PM</div><div><br></div><div><font face="monospace"><br></font></div></div></div>