From 2f6eae9f2b746d82acf05577135ab2e44e88c412 Mon Sep 17 00:00:00 2001 From: Roe-xin Date: Wed, 11 Mar 2026 18:42:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=8F=90=E7=A4=BA=E4=BD=8D=E7=BD=AE=20-=20?= =?UTF-8?q?=E5=B0=86=E6=8F=90=E7=A4=BA=E6=98=BE=E7=A4=BA=E5=9C=A8=E9=80=89?= =?UTF-8?q?=E5=8C=BA=E6=9C=AB=E5=B0=BE=E8=A1=8C=E7=9A=84=E8=A1=8C=E5=B0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 2f436d3..171268f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -31,7 +31,11 @@ export async function activate(context: vscode.ExtensionContext) { if (!editor) return; if (!editor.selection.isEmpty) { - const range = new vscode.Range(editor.selection.end, editor.selection.end); + // 找到选区末尾所在的行,并将提示放在该行的末尾 + const { anchor, active } = editor.selection; + const endPos = anchor.isAfter(active) ? anchor : active; + const lineEndPos = editor.document.lineAt(endPos.line).range.end; + const range = new vscode.Range(lineEndPos, lineEndPos); const decoration = { range }; editor.setDecorations(decorationType, [decoration]); } else {