Skip to content

Commit e01e57f

Browse files
Move range utils to common
1 parent 073b7aa commit e01e57f

File tree

12 files changed

+21
-19
lines changed

12 files changed

+21
-19
lines changed

packages/common/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export * from "./util/Notifier";
110110
export * from "./util/object";
111111
export * from "./util/omitByDeep";
112112
export * from "./util/prettifyLanguageName";
113+
export * from "./util/rangeUtils";
113114
export * from "./util/regex";
114115
export * from "./util/selectionsEqual";
115116
export * from "./util/serializedMarksToTokenHats";
File renamed without changes.

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/shouldYieldScope.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Direction, Position } from "@cursorless/common";
2-
import { Range } from "@cursorless/common";
3-
import { strictlyContains } from "../../../util/rangeUtils";
2+
import { Range, strictlyContains } from "@cursorless/common";
43
import { compareTargetScopes } from "./compareTargetScopes";
54
import type { TargetScope } from "./scope.types";
65
import type { ScopeIteratorRequirements } from "./scopeHandler.types";

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/util/getCollectionItemRemovalRange.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Range, TextEditor } from "@cursorless/common";
2-
3-
import { getRangeLength } from "../../../../util/rangeUtils";
2+
import { getRangeLength } from "@cursorless/common";
43

54
/**
65
* Picks which of the leading and trailing delimiter ranges to use for removal when both are present.

packages/cursorless-engine/src/processTargets/targets/BoundedParagraphTarget.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { toLineRange, type Range } from "@cursorless/common";
1+
import { expandToFullLine, toLineRange, type Range } from "@cursorless/common";
22
import type { InteriorTarget, ParagraphTarget } from ".";
33
import type { TextualType } from "../../typings/target.types";
4-
import { expandToFullLine } from "../../util/rangeUtils";
54
import type { MinimumTargetParameters } from "./BaseTarget";
65
import { BaseTarget } from "./BaseTarget";
76
import { LineTarget } from "./LineTarget";

packages/cursorless-engine/src/processTargets/targets/DestinationImpl.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import type { InsertionMode, Selection, TextEditor } from "@cursorless/common";
2-
import { Range } from "@cursorless/common";
2+
import { Range, union } from "@cursorless/common";
33
import type { EditWithRangeUpdater } from "../../typings/Types";
44
import type {
55
Destination,
66
EditNewActionType,
77
Target,
88
} from "../../typings/target.types";
9-
import { union } from "../../util/rangeUtils";
109

1110
export class DestinationImpl implements Destination {
1211
public readonly contentRange: Range;

packages/cursorless-engine/src/processTargets/targets/LineTarget.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import type { TextEditor } from "@cursorless/common";
2-
import { Position, Range, toLineRange } from "@cursorless/common";
2+
import {
3+
expandToFullLine,
4+
Position,
5+
Range,
6+
toLineRange,
7+
} from "@cursorless/common";
38
import type { TextualType } from "../../typings/target.types";
4-
import { expandToFullLine } from "../../util/rangeUtils";
59
import { tryConstructTarget } from "../../util/tryConstructTarget";
610
import type { CommonTargetParameters } from "./BaseTarget";
711
import { BaseTarget } from "./BaseTarget";

packages/cursorless-engine/src/processTargets/targets/ParagraphTarget.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import type {
44
TextEditor,
55
TextLine,
66
} from "@cursorless/common";
7-
import { Position, Range, toLineRange } from "@cursorless/common";
7+
import {
8+
expandToFullLine,
9+
Position,
10+
Range,
11+
toLineRange,
12+
} from "@cursorless/common";
813
import type { TextualType } from "../../typings/target.types";
9-
import { expandToFullLine } from "../../util/rangeUtils";
1014
import type { CommonTargetParameters } from "./BaseTarget";
1115
import { BaseTarget } from "./BaseTarget";
1216
import { constructLineTarget, LineTarget } from "./LineTarget";

packages/cursorless-engine/src/processTargets/targets/util/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Range } from "@cursorless/common";
2+
import { union } from "@cursorless/common";
23
import type { Target } from "../../../../typings/target.types";
3-
import { union } from "../../../../util/rangeUtils";
44

55
/**
66
* Constructs a removal range for the given target that includes either the

packages/cursorless-engine/src/processTargets/targets/util/insertionRemovalBehaviors/TokenInsertionRemovalBehavior.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { TextEditor } from "@cursorless/common";
2-
import { Range } from "@cursorless/common";
2+
import { expandToFullLine, Range, union } from "@cursorless/common";
33
import type { Target } from "../../../../typings/target.types";
4-
import { expandToFullLine, union } from "../../../../util/rangeUtils";
54
import { PlainTarget } from "../../PlainTarget";
65

76
const leadingDelimiters = ['"', "'", "(", "[", "{", "<"];

0 commit comments

Comments
 (0)