Skip to content

Commit 147752b

Browse files
committed
Fix broken copy
Signed-off-by: worksofliam <[email protected]>
1 parent 780be18 commit 147752b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/uriHandler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { commands, env, Uri, UriHandler, window, workspace } from "vscode";
1+
import { commands, env, Selection, Uri, UriHandler, window, workspace } from "vscode";
22
import querystring from "querystring";
33
import Document from "./language/sql/document";
44
import { ServerComponent } from "./connection/serverComponent";
@@ -57,7 +57,9 @@ export const getStatementUri = commands.registerCommand(`vscode-db2i.getStatemen
5757
const currentStmt = sqlDocument.getGroupByOffset(cursor);
5858

5959
if (currentStmt) {
60-
const uri = `vscode://halcyontechltd.vscode-db2i/sql?content=${encodeURIComponent(sqlDocument.content)}`;
60+
const stmtContent = content.substring(currentStmt.range.start, currentStmt.range.end);
61+
editor.selection = new Selection(editor.document.positionAt(currentStmt.range.start), editor.document.positionAt(currentStmt.range.end));
62+
const uri = `vscode://halcyontechltd.vscode-db2i/sql?content=${encodeURIComponent(stmtContent)}`;
6163

6264
env.clipboard.writeText(uri);
6365
window.showInformationMessage(`Statement URI copied to clipboard.`);

0 commit comments

Comments
 (0)