mirror of
https://github.com/neovim/neovim.git
synced 2026-09-03 21:00:34 +00:00
fix(pack): read document links from the request buffer #41638
Problem: The `textDocument/documentLink` handler resolves the confirmation buffer from the request URI and checks it for `nil`, then reads lines from buffer `0`. When the confirmation buffer is not current, links are computed from unrelated text and returned against the confirmation buffer's line numbers, producing missing or misplaced links. Solution: Read lines from the resolved `bufnr`. AI-assisted
This commit is contained in:
committed by
GitHub
parent
45b645718c
commit
10fa98bb6e
@@ -122,7 +122,7 @@ methods['textDocument/documentLink'] = function(params, callback)
|
||||
--- @type vim.pack.lsp.DocumentLink[]
|
||||
local links = {}
|
||||
local cur_src = ''
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
for i, l in ipairs(lines) do
|
||||
cur_src = l:match('^Source: +(.+)$') or cur_src
|
||||
|
||||
|
||||
Reference in New Issue
Block a user