feat(diagnostic): inherit parent 'path' option in open_float (#31273)

Diagnostics sometimes contain stack traces, it's useful being able to
use `CTRL-W F` on them to open related files from within the diagnostic
window.
This commit is contained in:
Mathias Fußenegger 2024-11-25 17:11:22 +01:00 committed by GitHub
parent 165b099fa3
commit 99e7323aa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1962,6 +1962,7 @@ function M.open_float(opts, ...)
opts.focus_id = scope
end
local float_bufnr, winnr = vim.lsp.util.open_floating_preview(lines, 'plaintext', opts)
vim.bo[float_bufnr].path = vim.bo[bufnr].path
for i, hl in ipairs(highlights) do
local line = lines[i]
local prefix_len = hl.prefix and hl.prefix.length or 0