From 68cd980abb130b6b4466e153970c74928b701cf1 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Thu, 20 Jan 2022 20:31:20 +0000 Subject: [PATCH] Fixes --- src/actions/GenerateSnippet.ts | 4 +++- src/actions/index.ts | 2 ++ src/typings/Types.ts | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/actions/GenerateSnippet.ts b/src/actions/GenerateSnippet.ts index 1edc59cbb9..d1c6e59450 100644 --- a/src/actions/GenerateSnippet.ts +++ b/src/actions/GenerateSnippet.ts @@ -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[] = () => [ @@ -65,6 +65,7 @@ export default class GenerateSnippet implements Action { const [placeholderRanges, [targetSelection]] = await performEditsAndUpdateSelections( + this.graph.rangeUpdater, editor, originalSelections.map((selection, index) => ({ editor, @@ -117,6 +118,7 @@ export default class GenerateSnippet implements Action { }); await performDocumentEdits( + this.graph.rangeUpdater, editor, zip(placeholderRanges, originalSelectionTexts).map(([range, text]) => ({ editor, diff --git a/src/actions/index.ts b/src/actions/index.ts index 3f3b0f1240..fad71d0d19 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -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) {} @@ -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); diff --git a/src/typings/Types.ts b/src/typings/Types.ts index 6d76b6b8e4..cfc1848ee5 100644 --- a/src/typings/Types.ts +++ b/src/typings/Types.ts @@ -393,6 +393,7 @@ export type ActionType = | "findInWorkspace" | "foldRegion" | "followLink" + | "generateSnippet" | "getText" | "highlight" | "indentLine"