File tree Expand file tree Collapse file tree 7 files changed +53
-0
lines changed
data/fixtures/recorded/modifiers Expand file tree Collapse file tree 7 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 8989 "trailing" : " trailing" ,
9090 "content" : " keepContentFilter" ,
9191 "empty" : " keepEmptyFilter" ,
92+ "expand" : " expandToFullLine" ,
9293 "its" : " inferPreviousMark" ,
9394 "visible" : " visible"
9495 },
Original file line number Diff line number Diff line change 1+ languageId : plaintext
2+ command :
3+ version : 7
4+ spokenForm : change expand
5+ action :
6+ name : clearAndSetSelection
7+ target :
8+ type : primitive
9+ modifiers :
10+ - {type: expandToFullLine}
11+ usePrePhraseSnapshot : false
12+ initialState :
13+ documentContents : " foo "
14+ selections :
15+ - anchor : {line: 0, character: 4}
16+ active : {line: 0, character: 4}
17+ marks : {}
18+ finalState :
19+ documentContents : " "
20+ selections :
21+ - anchor : {line: 0, character: 0}
22+ active : {line: 0, character: 0}
Original file line number Diff line number Diff line change @@ -397,6 +397,10 @@ export interface TrailingModifier {
397397 type : "trailing" ;
398398}
399399
400+ export interface ExpandToFullLineModifier {
401+ type : "expandToFullLine" ;
402+ }
403+
400404export interface KeepContentFilterModifier {
401405 type : "keepContentFilter" ;
402406}
@@ -482,6 +486,7 @@ export type Modifier =
482486 | LeadingModifier
483487 | TrailingModifier
484488 | RawSelectionModifier
489+ | ExpandToFullLineModifier
485490 | ModifyIfUntypedModifier
486491 | FallbackModifier
487492 | RangeModifier
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { ClassFunctionNameStage } from "./modifiers/ClassFunctionNameStage";
77import { ModifyIfUntypedStage } from "./modifiers/ConditionalModifierStages" ;
88import { ContainingScopeStage } from "./modifiers/ContainingScopeStage" ;
99import { EveryScopeStage } from "./modifiers/EveryScopeStage" ;
10+ import { ExpandToFullLineStage } from "./modifiers/ExpandToFullLineStage" ;
1011import { FallbackStage } from "./modifiers/FallbackStage" ;
1112import {
1213 KeepContentFilterStage ,
@@ -57,6 +58,8 @@ export class ModifierStageFactoryImpl implements ModifierStageFactory {
5758 return new LeadingStage ( this , modifier ) ;
5859 case "trailing" :
5960 return new TrailingStage ( this , modifier ) ;
61+ case "expandToFullLine" :
62+ return new ExpandToFullLineStage ( modifier ) ;
6063 case "visible" :
6164 return new VisibleStage ( modifier ) ;
6265
Original file line number Diff line number Diff line change 1+ import type { ExpandToFullLineModifier } from "@cursorless/common" ;
2+ import type { Target } from "../../typings/target.types" ;
3+ import { expandToFullLine } from "../../util/rangeUtils" ;
4+ import type { ModifierStage } from "../PipelineStages.types" ;
5+ import { LineTarget , RawSelectionTarget } from "../targets" ;
6+
7+ export class ExpandToFullLineStage implements ModifierStage {
8+ constructor ( private modifier : ExpandToFullLineModifier ) { }
9+
10+ run ( target : Target ) : Target [ ] {
11+ const contentRange = expandToFullLine ( target . editor , target . contentRange ) ;
12+ return [
13+ new LineTarget ( {
14+ editor : target . editor ,
15+ contentRange,
16+ isReversed : target . isReversed ,
17+ } ) ,
18+ ] ;
19+ }
20+ }
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export const defaultSpokenFormMapCore: DefaultSpokenFormMapDefinition = {
122122 toRawSelection : "just" ,
123123 leading : "leading" ,
124124 trailing : "trailing" ,
125+ expandToFullLine : "expand" ,
125126 keepContentFilter : "content" ,
126127 keepEmptyFilter : "empty" ,
127128 inferPreviousMark : "its" ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export function getScopeType(modifier: Modifier): ScopeType | undefined {
2222 case "endOf" :
2323 case "extendThroughStartOf" :
2424 case "extendThroughEndOf" :
25+ case "expandToFullLine" :
2526 case "fallback" :
2627 case "range" :
2728 case "modifyIfUntyped" :
You can’t perform that action at this time.
0 commit comments