forked from external/vscode-xml
Add NativeCommands Service
This commit is contained in:
parent
a4366a5061
commit
b9d6659a26
7 changed files with 31 additions and 22 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { commands, workspace } from "vscode";
|
||||
import { workspace } from "vscode";
|
||||
import { ProviderResult, Range, TextEdit, TextEditor, TextEditorEdit } from "vscode";
|
||||
|
||||
import { NativeCommands } from "../../common";
|
||||
import * as constants from "../../constants";
|
||||
|
||||
import { XmlFormatterFactory } from "../xml-formatter";
|
||||
|
|
@ -38,14 +39,8 @@ export function formatAsXml(editor: TextEditor, edit: TextEditorEdit): void {
|
|||
editBuilder.replace(textEdit.range, textEdit.newText);
|
||||
|
||||
// wiggle the cursor to deselect the formatted XML (is there a non-hacky way to go about this?)
|
||||
await commands.executeCommand(constants.nativeCommands.cursorMove, {
|
||||
to: "left",
|
||||
by: "character"
|
||||
});
|
||||
await commands.executeCommand(constants.nativeCommands.cursorMove, {
|
||||
to: "right",
|
||||
by: "character"
|
||||
});
|
||||
await NativeCommands.cursorMove("left", "character");
|
||||
await NativeCommands.cursorMove("right", "character");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { commands, workspace } from "vscode";
|
||||
import { workspace } from "vscode";
|
||||
import { ProviderResult, Range, TextEdit, TextEditor, TextEditorEdit } from "vscode";
|
||||
|
||||
import * as constants from "../../constants";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue