Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Apr 25, 2022
1 parent c59ccb3 commit 68cd980
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/actions/GenerateSnippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
import { ensureSingleTarget } from "../util/targetUtils";
import { range, repeat, zip } from "lodash";
import displayPendingEditDecorations from "../util/editDisplayUtils";
import { performEditsAndUpdateSelections } from "../util/updateSelections";
import { performDocumentEdits } from "../util/performDocumentEdits";
import { commands, SnippetString, window, workspace } from "vscode";
import { join } from "path";
import { open } from "fs/promises";
import { performEditsAndUpdateSelections } from "../core/updateSelections/updateSelections";

export default class GenerateSnippet implements Action {
getTargetPreferences: () => ActionPreferences[] = () => [
Expand Down Expand Up @@ -65,6 +65,7 @@ export default class GenerateSnippet implements Action {

const [placeholderRanges, [targetSelection]] =
await performEditsAndUpdateSelections(
this.graph.rangeUpdater,
editor,
originalSelections.map((selection, index) => ({
editor,
Expand Down Expand Up @@ -117,6 +118,7 @@ export default class GenerateSnippet implements Action {
});

await performDocumentEdits(
this.graph.rangeUpdater,
editor,
zip(placeholderRanges, originalSelectionTexts).map(([range, text]) => ({
editor,
Expand Down
2 changes: 2 additions & 0 deletions src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import ExecuteCommand from "./ExecuteCommand";
import FollowLink from "./FollowLink";
import Highlight from "./Highlight";
import InsertSnippet from "./InsertSnippet";
import GenerateSnippet from "./GenerateSnippet";

class Actions implements ActionRecord {
constructor(private graph: Graph) {}
Expand All @@ -58,6 +59,7 @@ class Actions implements ActionRecord {
insertEmptyLineBefore = new InsertEmptyLineAbove(this.graph);
insertEmptyLinesAround = new InsertEmptyLinesAround(this.graph);
insertSnippet = new InsertSnippet(this.graph);
generateSnippet = new GenerateSnippet(this.graph);
moveToTarget = new Move(this.graph);
outdentLine = new OutdentLines(this.graph);
pasteFromClipboard = new Paste(this.graph);
Expand Down
1 change: 1 addition & 0 deletions src/typings/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ export type ActionType =
| "findInWorkspace"
| "foldRegion"
| "followLink"
| "generateSnippet"
| "getText"
| "highlight"
| "indentLine"
Expand Down

0 comments on commit 68cd980

Please sign in to comment.