MCPcopy Create free account
hub / github.com/continuedev/continue / union

Function union

core/util/ranges.ts:60–83  ·  view source on GitHub ↗
(a: Range, b: Range)

Source from the content-addressed store, hash-verified

58}
59
60export function union(a: Range, b: Range): Range {
61 let start: Position;
62 if (a.start.line === b.start.line) {
63 start = {
64 line: a.start.line,
65 character: Math.min(a.start.character, b.start.character),
66 };
67 } else if (a.start.line < b.start.line) start = a.start;
68 else start = b.start;
69
70 let end: Position;
71 if (a.end.line === b.end.line) {
72 end = {
73 line: a.end.line,
74 character: Math.max(a.end.character, b.end.character),
75 };
76 } else if (a.end.line > b.end.line) end = a.end;
77 else end = b.end;
78
79 return {
80 start,
81 end,
82 };
83}
84
85export function maxPosition(a: Position, b: Position): Position {
86 if (a.line > b.line) {

Callers 1

ranges.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected