Skip to content

Commit 2bcb516

Browse files
General cleanup (#235)
* Removed inference context * Unify inference of partial range and list targets * Capitalize all action names * Starting to clean up process targets * Added selection type to action preference * Updated variable names * Move modifiers to own process file * Moved process selection type to own file * Moved process mark to own file * Moved process position to own file * Moved files into folders * Rename start and end to anchor and active * Filter duplicate selections * cleanup * move cursor token out of navigational map * Reworked inference * Some minor tweaks * Small tweaks * Move some files Co-authored-by: Pokey Rule <[email protected]>
1 parent 91c3912 commit 2bcb516

File tree

92 files changed

+1625
-1671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1625
-1671
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"search.exclude": {
77
"out": true // set this to false to include "out" folder in search results
88
},
9+
"[typescript]": {
10+
"editor.defaultFormatter": "esbenp.prettier-vscode"
11+
},
912
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
1013
"typescript.tsc.autoDetect": "off",
1114
"cSpell.words": [

src/NavigationMap.ts

Lines changed: 0 additions & 139 deletions
This file was deleted.

src/actions/BringMoveSwap.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import {
55
Graph,
66
TypedSelection,
77
Edit,
8-
} from "../Types";
9-
import { runForEachEditor } from "../targetUtils";
8+
} from "../typings/Types";
9+
import { runForEachEditor } from "../util/targetUtils";
1010
import update from "immutability-helper";
11-
import displayPendingEditDecorations from "../editDisplayUtils";
12-
import { performOutsideAdjustment } from "../performInsideOutsideAdjustment";
11+
import displayPendingEditDecorations from "../util/editDisplayUtils";
12+
import { performOutsideAdjustment } from "../util/performInsideOutsideAdjustment";
1313
import { flatten, zip } from "lodash";
1414
import { Selection, TextEditor, Range } from "vscode";
15-
import { performEditsAndUpdateSelections } from "../updateSelections";
16-
import { getTextWithPossibleDelimiter } from "../getTextWithPossibleDelimiter";
15+
import { performEditsAndUpdateSelections } from "../util/updateSelections";
16+
import { getTextWithPossibleDelimiter } from "../util/getTextWithPossibleDelimiter";
1717

1818
type ActionType = "bring" | "move" | "swap";
1919

src/actions/Call.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import {
44
ActionPreferences,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { ensureSingleTarget } from "../targetUtils";
7+
} from "../typings/Types";
8+
import { ensureSingleTarget } from "../util/targetUtils";
99

1010
export default class Call implements Action {
11-
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];
11+
targetPreferences: ActionPreferences[] = [
12+
{ insideOutsideType: "inside" },
13+
{ insideOutsideType: "inside" },
14+
];
1215

1316
constructor(private graph: Graph) {
1417
this.run = this.run.bind(this);

src/actions/clear.ts renamed to src/actions/Clear.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { ensureSingleEditor } from "../targetUtils";
9-
import { setSelectionsAndFocusEditor } from "../setSelectionsAndFocusEditor";
7+
} from "../typings/Types";
8+
import { ensureSingleEditor } from "../util/targetUtils";
9+
import { setSelectionsAndFocusEditor } from "../util/setSelectionsAndFocusEditor";
1010

1111
export default class Clear implements Action {
1212
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

src/CommandAction.ts renamed to src/actions/CommandAction.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
Graph,
77
TypedSelection,
88
SelectionWithEditor,
9-
} from "./Types";
10-
import displayPendingEditDecorations from "./editDisplayUtils";
11-
import { runOnTargetsForEachEditor } from "./targetUtils";
12-
import { focusEditor } from "./setSelectionsAndFocusEditor";
9+
} from "../typings/Types";
10+
import displayPendingEditDecorations from "../util/editDisplayUtils";
11+
import { runOnTargetsForEachEditor } from "../util/targetUtils";
12+
import { focusEditor } from "../util/setSelectionsAndFocusEditor";
1313
import { flatten } from "lodash";
14-
import { callFunctionAndUpdateSelections } from "./updateSelections";
15-
import { ensureSingleEditor } from "./targetUtils";
14+
import { callFunctionAndUpdateSelections } from "../util/updateSelections";
15+
import { ensureSingleEditor } from "../util/targetUtils";
1616

1717
export default class CommandAction implements Action {
1818
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

src/actions/Comment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Graph } from "../Types";
2-
import CommandAction from "../CommandAction";
1+
import { Graph } from "../typings/Types";
2+
import CommandAction from "./CommandAction";
33

44
export class CommentLines extends CommandAction {
55
constructor(graph: Graph) {

src/actions/CopyLines.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
7+
} from "../typings/Types";
88
import { Range, Selection, TextEditor } from "vscode";
9-
import { performEditsAndUpdateSelections } from "../updateSelections";
10-
import { displayPendingEditDecorationsForSelection } from "../editDisplayUtils";
11-
import { runOnTargetsForEachEditor } from "../targetUtils";
9+
import { performEditsAndUpdateSelections } from "../util/updateSelections";
10+
import { displayPendingEditDecorationsForSelection } from "../util/editDisplayUtils";
11+
import { runOnTargetsForEachEditor } from "../util/targetUtils";
1212
import { flatten } from "lodash";
13-
import unifyRanges from "../unifyRanges";
14-
import expandToContainingLine from "../expandToContainingLine";
13+
import unifyRanges from "../util/unifyRanges";
14+
import expandToContainingLine from "../util/expandToContainingLine";
1515

1616
class CopyLines implements Action {
1717
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

src/actions/CutCopyPaste.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { performInsideOutsideAdjustment } from "../performInsideOutsideAdjustment";
9-
import CommandAction from "../CommandAction";
10-
import displayPendingEditDecorations from "../editDisplayUtils";
11-
import { getOutsideOverflow } from "../targetUtils";
7+
} from "../typings/Types";
8+
import { performInsideOutsideAdjustment } from "../util/performInsideOutsideAdjustment";
9+
import CommandAction from "./CommandAction";
10+
import displayPendingEditDecorations from "../util/editDisplayUtils";
11+
import { getOutsideOverflow } from "../util/targetUtils";
1212
import { zip } from "lodash";
1313

1414
export class Cut implements Action {

src/actions/delete.ts renamed to src/actions/Delete.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { runOnTargetsForEachEditor } from "../targetUtils";
9-
import displayPendingEditDecorations from "../editDisplayUtils";
7+
} from "../typings/Types";
8+
import { runOnTargetsForEachEditor } from "../util/targetUtils";
9+
import displayPendingEditDecorations from "../util/editDisplayUtils";
1010
import { flatten } from "lodash";
11-
import { performEditsAndUpdateSelections } from "../updateSelections";
11+
import { performEditsAndUpdateSelections } from "../util/updateSelections";
1212

1313
export default class Delete implements Action {
1414
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "outside" }];

src/actions/EditNewLine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
7+
} from "../typings/Types";
88
import { commands, Selection } from "vscode";
99

1010
class EditNewLine implements Action {

src/actions/extractVariable.ts renamed to src/actions/ExtractVariable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { ensureSingleTarget } from "../targetUtils";
7+
} from "../typings/Types";
8+
import { ensureSingleTarget } from "../util/targetUtils";
99
import { commands } from "vscode";
1010

1111
export default class ExtractVariable implements Action {

src/actions/Find.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
ActionPreferences,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
7+
} from "../typings/Types";
88
import { commands } from "vscode";
9-
import { ensureSingleTarget } from "../targetUtils";
9+
import { ensureSingleTarget } from "../util/targetUtils";
1010

1111
export class FindInFiles implements Action {
1212
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

src/actions/fold.ts renamed to src/actions/Fold.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
ActionReturnValue,
66
Graph,
77
TypedSelection,
8-
} from "../Types";
9-
import { ensureSingleEditor } from "../targetUtils";
8+
} from "../typings/Types";
9+
import { ensureSingleEditor } from "../util/targetUtils";
1010

1111
class FoldAction implements Action {
1212
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "outside" }];

src/actions/GetText.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import displayPendingEditDecorations from "../editDisplayUtils";
9-
import { ensureSingleTarget } from "../targetUtils";
7+
} from "../typings/Types";
8+
import displayPendingEditDecorations from "../util/editDisplayUtils";
9+
import { ensureSingleTarget } from "../util/targetUtils";
1010

1111
export default class GetText implements Action {
1212
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

src/actions/Indent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Graph } from "../Types";
2-
import CommandAction from "../CommandAction";
1+
import { Graph } from "../typings/Types";
2+
import CommandAction from "./CommandAction";
33

44
export class IndentLines extends CommandAction {
55
constructor(graph: Graph) {

src/actions/InsertEmptyLines.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
7+
} from "../typings/Types";
88
import { Selection, Range } from "vscode";
9-
import { displayPendingEditDecorationsForSelection } from "../editDisplayUtils";
10-
import { runOnTargetsForEachEditor } from "../targetUtils";
11-
import { performEditsAndUpdateSelections } from "../updateSelections";
9+
import { displayPendingEditDecorationsForSelection } from "../util/editDisplayUtils";
10+
import { runOnTargetsForEachEditor } from "../util/targetUtils";
11+
import { performEditsAndUpdateSelections } from "../util/updateSelections";
1212
import { flatten } from "lodash";
1313

1414
class InsertEmptyLines implements Action {

src/actions/Replace.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import displayPendingEditDecorations from "../editDisplayUtils";
9-
import { runForEachEditor } from "../targetUtils";
7+
} from "../typings/Types";
8+
import displayPendingEditDecorations from "../util/editDisplayUtils";
9+
import { runForEachEditor } from "../util/targetUtils";
1010
import { flatten, zip } from "lodash";
11-
import { maybeAddDelimiter } from "../getTextWithPossibleDelimiter";
12-
import { performEditsAndUpdateSelections } from "../updateSelections";
11+
import { maybeAddDelimiter } from "../util/getTextWithPossibleDelimiter";
12+
import { performEditsAndUpdateSelections } from "../util/updateSelections";
1313

1414
type RangeGenerator = { start: number };
1515

src/actions/Scroll.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import {
44
ActionReturnValue,
55
Graph,
66
TypedSelection,
7-
} from "../Types";
8-
import { displayDecorationsWhileRunningFunc } from "../editDisplayUtils";
9-
import { groupBy } from "../itertools";
7+
} from "../typings/Types";
8+
import { displayDecorationsWhileRunningFunc } from "../util/editDisplayUtils";
9+
import { groupBy } from "../util/itertools";
1010
import { commands, window, workspace } from "vscode";
11-
import { focusEditor } from "../setSelectionsAndFocusEditor";
11+
import { focusEditor } from "../util/setSelectionsAndFocusEditor";
1212

1313
class Scroll implements Action {
1414
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }];

0 commit comments

Comments
 (0)