-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
434 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
...ngine/src/actions/SetInstanceReference.ts → ...ss-engine/src/actions/SetSpecialTarget.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { StoredTargetKey } from "@cursorless/common"; | ||
import { Target } from "../typings/target.types"; | ||
import { SimpleAction, ActionReturnValue } from "./actions.types"; | ||
|
||
export class SetInstanceReference implements SimpleAction { | ||
constructor() { | ||
export class SetSpecialTarget implements SimpleAction { | ||
noAutomaticTokenExpansion = true; | ||
|
||
constructor(private key: StoredTargetKey) { | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
async run(targets: Target[]): Promise<ActionReturnValue> { | ||
return { | ||
thatTargets: targets, | ||
instanceReferenceTargets: targets, | ||
[`${this.key}Targets`]: targets, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
packages/cursorless-engine/src/processTargets/MarkStageFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { Mark } from "../typings/TargetDescriptor"; | ||
import { MarkStage } from "./PipelineStages.types"; | ||
|
||
export interface MarkStageFactoryOpts { | ||
/** If there is an `instance` modifier downstream in the pipeline */ | ||
isForInstance: boolean; | ||
} | ||
|
||
export interface MarkStageFactory { | ||
create(mark: Mark): MarkStage; | ||
create(mark: Mark, opts: MarkStageFactoryOpts): MarkStage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/cursorless-engine/src/processTargets/marks/ImplicitMarkStage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Target } from "../../typings/target.types"; | ||
import type { MarkStage } from "../PipelineStages.types"; | ||
import { MarkStageFactory, MarkStageFactoryOpts } from "../MarkStageFactory"; | ||
import { StoredTargetMap } from "../.."; | ||
|
||
export class ImplicitMarkStage implements MarkStage { | ||
private cursorMarkStage: MarkStage; | ||
|
||
constructor( | ||
markStageFactory: MarkStageFactory, | ||
private opts: MarkStageFactoryOpts, | ||
private storedTargets: StoredTargetMap, | ||
) { | ||
this.cursorMarkStage = markStageFactory.create( | ||
{ type: "cursor" }, | ||
{ isForInstance: this.opts.isForInstance }, | ||
); | ||
} | ||
|
||
run(): Target[] { | ||
if (this.opts.isForInstance) { | ||
return this.cursorMarkStage.run(); | ||
} | ||
|
||
return this.storedTargets.get("implicit") ?? this.cursorMarkStage.run(); | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
packages/cursorless-engine/src/processTargets/marks/RangeMarkStage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.