File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
java/com/longforus/kotlincodesorter/sort Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ plugins {
14
14
}
15
15
16
16
group ' com.longforus'
17
- version ' 1.0 '
17
+ version ' 1.1 '
18
18
19
19
apply plugin : ' kotlin'
20
20
@@ -38,8 +38,9 @@ intellij {
38
38
}
39
39
patchPluginXml {
40
40
changeNotes """
41
- First version release.<br>
42
- <em>add default order: fields->initializer->constructors->functions</em>"""
41
+ Fix bugs that appear in the Code menu at the same time as LifecycleSorter.<br>
42
+ Performance optimization.<br>
43
+ <em>default order: fields->initializer->constructors->functions</em>"""
43
44
}
44
45
45
46
publishPlugin {
Original file line number Diff line number Diff line change @@ -19,17 +19,21 @@ class Sorter
19
19
20
20
fun realSort (classOrObject : KtClassOrObject ) {
21
21
val declarations = classOrObject.declarations
22
+ val before = declarations.hashCode()
22
23
val sort = CommonSortStrategy (declarations).sort()
24
+ val after = sort.hashCode()
23
25
sort.forEach {
24
26
if (it is KtClassOrObject ) {
25
27
realSort(it)
26
28
}
27
29
}
28
- sort.forEach {
29
- classOrObject.addDeclaration(it)
30
- }
31
- declarations.forEach {
32
- it.delete()
30
+ if (before != after) {
31
+ sort.forEach {
32
+ classOrObject.addDeclaration(it)
33
+ }
34
+ declarations.forEach {
35
+ it.delete()
36
+ }
33
37
}
34
38
}
35
39
Original file line number Diff line number Diff line change 21
21
<p><b>Features:</b>
22
22
<ul>
23
23
<li>Sort the kotlin code in the order of fields -> initializer -> constructors -> functions.</li>
24
+ <li>default shortcuts is <b>Ctrl+Alt+K</b>,if no effect, check the shortcut key Settings.</li>
24
25
</ul>
25
26
</p>
26
27
<br/>
42
43
</extensions >
43
44
44
45
<actions >
45
- <group id =" sorter " text =" Sort kotlin code" popup =" true" description =" Sort the kotlin code in order" >
46
+ <group id =" com.longforus.kotlincodesorter " text =" Sort kotlin code" popup =" true" description =" Sort the kotlin code in order" >
46
47
47
- <action class =" com.longforus.kotlincodesorter.action.SortAction" id =" sortStart " text =" fields->initializer->constructors->functions"
48
+ <action class =" com.longforus.kotlincodesorter.action.SortAction" id =" com.longforus.kotlincodesorter.action.SortAction " text =" fields->initializer->constructors->functions"
48
49
description =" Sort the kotlin code in this order" >
49
50
<keyboard-shortcut first-keystroke =" control alt K" keymap =" $default" />
50
51
</action >
You can’t perform that action at this time.
0 commit comments