Skip to content

Commit d9854fd

Browse files
authored
Add text selection passing to atelier api
1 parent 4b48de1 commit d9854fd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/commands/studio.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ function doMenuAction(uri: vscode.Uri, menuType: string): Promise<any> {
4242
.then(action => {
4343
if (action) {
4444
const query = "select * from %Atelier_v1_Utils.Extension_UserAction(?, ?, ?, ?)";
45-
const parameters = ["0", action.id, name, ""];
45+
let selectedText = "";
46+
const editor = vscode.window.activeTextEditor;
47+
if (!editor) {
48+
selectedText = ""
49+
}
50+
const selection = editor.selection;
51+
selectedText = editor.document.getText(selection);
52+
53+
const parameters = ["0", action.id, name, selectedText];
4654
return vscode.window.withProgress(
4755
{
4856
cancellable: false,

0 commit comments

Comments
 (0)