Skip to content

Commit

Permalink
fix(eval): open the floating window under the cursor (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
toh995 committed Feb 17, 2024
1 parent d845ebd commit 7a1878c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/dapui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ function dapui.eval(expr, args)
prev_expr = expr
local elem = dapui.elements.hover
elem.set_expression(expr, args.context)
local line_no = async.fn.screenrow()
local col_no = async.fn.screencol()
local position = { line = line_no, col = col_no }
local win_pos = async.api.nvim_win_get_position(0)
local position = {
line = win_pos[1] + async.fn.winline(),
col = win_pos[2] + async.fn.wincol() - 1,
}
open_float = require("dapui.windows").open_float("hover", elem, position, args)
if open_float then
open_float:listen("close", function()
Expand Down

0 comments on commit 7a1878c

Please # to comment.