Skip to content

Commit

Permalink
Make paragraph line iteration scope
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Nov 27, 2023
1 parent 41cf78d commit 5644d6e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 29 deletions.
6 changes: 0 additions & 6 deletions packages/common/src/ide/types/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ export type CursorlessConfiguration = {
experimental: { snippetsDir: string | undefined; hatStability: HatStability };
decorationDebounceDelayMs: number;
debug: boolean;
private: {
lineParagraphIterationScope: boolean;
};
};

export type CursorlessConfigKey = keyof CursorlessConfiguration;
Expand All @@ -30,9 +27,6 @@ export const CONFIGURATION_DEFAULTS: CursorlessConfiguration = {
hatStability: HatStability.balanced,
},
debug: false,
private: {
lineParagraphIterationScope: false,
},
};

export interface Configuration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ import {
Position,
Range,
ScopeType,
SimpleScopeTypeType,
TextEditor,
} from "@cursorless/common";
import { ide } from "../../../singletons/ide.singleton";
import { LineTarget } from "../../targets";
import { BaseScopeHandler } from "./BaseScopeHandler";
import type { TargetScope } from "./scope.types";

export class LineScopeHandler extends BaseScopeHandler {
public readonly scopeType = { type: "line" } as const;
public readonly iterationScopeType: ScopeType;
public readonly iterationScopeType: ScopeType = {
type: "paragraph",
} as const;
protected readonly isHierarchical = false;
public readonly includeAdjacentInEvery: boolean = true;

constructor(_scopeType: ScopeType, _languageId: string) {
super();
this.iterationScopeType = { type: getIterationScopeTypeType() };
}

*generateScopeCandidates(
Expand Down Expand Up @@ -75,10 +74,3 @@ export function fitRangeToLineContent(editor: TextEditor, range: Range) {
endLine.lastNonWhitespaceCharacterIndex,
);
}

function getIterationScopeTypeType(): SimpleScopeTypeType {
const useParagraph = ide().configuration.getOwnConfiguration(
"private.lineParagraphIterationScope",
);
return useParagraph ? "paragraph" : "document";
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ finalState:
active: {line: 0, character: 0}
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
- anchor: {line: 2, character: 0}
active: {line: 2, character: 0}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ initialState:
d e
f g
selections:
- anchor: {line: 6, character: 0}
active: {line: 6, character: 0}
- anchor: {line: 5, character: 0}
active: {line: 5, character: 0}
marks: {}
finalState:
documentContents: |
Expand All @@ -30,17 +30,9 @@ finalState:
d e
f g
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
- anchor: {line: 1, character: 0}
active: {line: 1, character: 1}
- anchor: {line: 2, character: 0}
active: {line: 2, character: 0}
- anchor: {line: 3, character: 0}
active: {line: 3, character: 5}
- anchor: {line: 4, character: 0}
active: {line: 4, character: 5}
- anchor: {line: 5, character: 0}
active: {line: 5, character: 5}
- anchor: {line: 6, character: 0}
active: {line: 6, character: 0}

0 comments on commit 5644d6e

Please sign in to comment.