fix: 优化代码选择提示位置 - 将提示显示在选区末尾行的行尾
This commit is contained in:
@ -31,7 +31,11 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||||||
if (!editor) return;
|
if (!editor) return;
|
||||||
|
|
||||||
if (!editor.selection.isEmpty) {
|
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 };
|
const decoration = { range };
|
||||||
editor.setDecorations(decorationType, [decoration]);
|
editor.setDecorations(decorationType, [decoration]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user