Skip to content

Commit 08978e0

Browse files
committed
Refatcors LineDecoration.compare.
1 parent 404a314 commit 08978e0

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/vs/editor/common/viewLayout/lineDecorations.ts

+16-15
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,24 @@ export class LineDecoration {
9696
}
9797

9898
public static compare(a: LineDecoration, b: LineDecoration): number {
99-
if (a.startColumn === b.startColumn) {
100-
if (a.endColumn === b.endColumn) {
101-
const typeCmp = LineDecoration._typeCompare(a.type, b.type);
102-
if (typeCmp === 0) {
103-
if (a.className < b.className) {
104-
return -1;
105-
}
106-
if (a.className > b.className) {
107-
return 1;
108-
}
109-
return 0;
110-
}
111-
return typeCmp;
112-
}
99+
if (a.startColumn !== b.startColumn) {
100+
return a.startColumn - b.startColumn;
101+
}
102+
103+
if (a.endColumn !== b.endColumn) {
113104
return a.endColumn - b.endColumn;
114105
}
115-
return a.startColumn - b.startColumn;
106+
107+
const typeCmp = LineDecoration._typeCompare(a.type, b.type);
108+
if (typeCmp !== 0) {
109+
return typeCmp;
110+
}
111+
112+
if (a.className !== b.className) {
113+
return a.className < b.className ? -1 : 1;
114+
}
115+
116+
return 0;
116117
}
117118
}
118119

0 commit comments

Comments
 (0)