-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added find all action * Get text through graph * use get text in copy action * Cleanup * More cleanup Co-authored-by: Pokey Rule <pokey.rule@gmail.com>
- Loading branch information
1 parent
a1722a3
commit 477681d
Showing
6 changed files
with
80 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
Action, | ||
ActionReturnValue, | ||
ActionPreferences, | ||
Graph, | ||
TypedSelection, | ||
} from "../Types"; | ||
import { commands } from "vscode"; | ||
import { ensureSingleTarget } from "../targetUtils"; | ||
|
||
export class FindInFiles implements Action { | ||
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }]; | ||
|
||
constructor(private graph: Graph) { | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
async run([targets]: [TypedSelection[]]): Promise<ActionReturnValue> { | ||
ensureSingleTarget(targets); | ||
|
||
const { returnValue: query, thatMark } = | ||
await this.graph.actions.getText.run([targets]); | ||
|
||
await commands.executeCommand("workbench.action.findInFiles", { query }); | ||
|
||
return { returnValue: null, thatMark }; | ||
} | ||
} |
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,40 @@ | ||
import { | ||
Action, | ||
ActionPreferences, | ||
ActionReturnValue, | ||
Graph, | ||
TypedSelection, | ||
} from "../Types"; | ||
import displayPendingEditDecorations from "../editDisplayUtils"; | ||
|
||
export default class GetText implements Action { | ||
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }]; | ||
|
||
constructor(private graph: Graph) { | ||
this.run = this.run.bind(this); | ||
} | ||
|
||
async run( | ||
[targets]: [TypedSelection[]], | ||
showDecorations = true | ||
): Promise<ActionReturnValue> { | ||
if (showDecorations) { | ||
await displayPendingEditDecorations( | ||
targets, | ||
this.graph.editStyles.referenced, | ||
this.graph.editStyles.referencedLine | ||
); | ||
} | ||
|
||
const text = targets | ||
.map((target) => | ||
target.selection.editor.document.getText(target.selection.selection) | ||
) | ||
.join("\n"); | ||
|
||
return { | ||
returnValue: text, | ||
thatMark: targets.map((target) => target.selection), | ||
}; | ||
} | ||
} |
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