mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
refactor(lsp): simplify reference range logic
This commit is contained in:

committed by
Lewis Russell

parent
0eae0bc804
commit
c5f217db01
@@ -1651,21 +1651,12 @@ do --[[ References ]]
|
|||||||
validate('bufnr', bufnr, 'number', true)
|
validate('bufnr', bufnr, 'number', true)
|
||||||
validate('offset_encoding', offset_encoding, 'string', false)
|
validate('offset_encoding', offset_encoding, 'string', false)
|
||||||
for _, reference in ipairs(references) do
|
for _, reference in ipairs(references) do
|
||||||
local start_line = reference.range.start.line
|
local range = reference.range
|
||||||
local start_char = reference.range.start.character
|
local start_line = range.start.line
|
||||||
local end_line = reference.range['end'].line
|
local end_line = range['end'].line
|
||||||
local end_char = reference.range['end'].character
|
|
||||||
|
|
||||||
local start_idx = get_line_byte_from_position(
|
local start_idx = get_line_byte_from_position(bufnr, range.start, offset_encoding)
|
||||||
bufnr,
|
local end_idx = get_line_byte_from_position(bufnr, range['end'], offset_encoding)
|
||||||
{ line = start_line, character = start_char },
|
|
||||||
offset_encoding
|
|
||||||
)
|
|
||||||
local end_idx = get_line_byte_from_position(
|
|
||||||
bufnr,
|
|
||||||
{ line = start_line, character = end_char },
|
|
||||||
offset_encoding
|
|
||||||
)
|
|
||||||
|
|
||||||
local document_highlight_kind = {
|
local document_highlight_kind = {
|
||||||
[protocol.DocumentHighlightKind.Text] = 'LspReferenceText',
|
[protocol.DocumentHighlightKind.Text] = 'LspReferenceText',
|
||||||
|
Reference in New Issue
Block a user