|
1 |
| -import { Position, Range, TextEditor } from "@cursorless/common"; |
2 |
| -import { Direction, ScopeType } from "@cursorless/common"; |
| 1 | +import { |
| 2 | + Direction, |
| 3 | + Position, |
| 4 | + Range, |
| 5 | + ScopeType, |
| 6 | + SimpleScopeTypeType, |
| 7 | + TextEditor, |
| 8 | +} from "@cursorless/common"; |
| 9 | +import { ide } from "../../../singletons/ide.singleton"; |
3 | 10 | import { LineTarget } from "../../targets";
|
4 | 11 | import { BaseScopeHandler } from "./BaseScopeHandler";
|
5 | 12 | import type { TargetScope } from "./scope.types";
|
6 | 13 |
|
7 | 14 | export class LineScopeHandler extends BaseScopeHandler {
|
8 | 15 | public readonly scopeType = { type: "line" } as const;
|
9 |
| - public readonly iterationScopeType = { type: "document" } as const; |
| 16 | + public readonly iterationScopeType: ScopeType; |
10 | 17 | protected readonly isHierarchical = false;
|
11 | 18 | public readonly includeAdjacentInEvery: boolean = true;
|
12 | 19 |
|
13 | 20 | constructor(_scopeType: ScopeType, _languageId: string) {
|
14 | 21 | super();
|
| 22 | + this.iterationScopeType = { type: getIterationScopeTypeType() }; |
15 | 23 | }
|
16 | 24 |
|
17 | 25 | *generateScopeCandidates(
|
@@ -67,3 +75,10 @@ export function fitRangeToLineContent(editor: TextEditor, range: Range) {
|
67 | 75 | endLine.lastNonWhitespaceCharacterIndex,
|
68 | 76 | );
|
69 | 77 | }
|
| 78 | + |
| 79 | +function getIterationScopeTypeType(): SimpleScopeTypeType { |
| 80 | + const useParagraph = ide().configuration.getOwnConfiguration( |
| 81 | + "private.lineParagraphIterationScope", |
| 82 | + ); |
| 83 | + return useParagraph ? "paragraph" : "document"; |
| 84 | +} |
0 commit comments