From 2f35446fbed9792b5f2005d9c522c1361d8bfa0c Mon Sep 17 00:00:00 2001 From: rayx Date: Sat, 11 Jun 2022 16:09:49 +1000 Subject: [PATCH] issue #192 pylsp range missing (#193) * issue #192 pylsp range missing --- lua/navigator/symbols.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/navigator/symbols.lua b/lua/navigator/symbols.lua index 42df0b2..7ff3d03 100644 --- a/lua/navigator/symbols.lua +++ b/lua/navigator/symbols.lua @@ -65,6 +65,9 @@ M.document_symbol_handler = function(err, result, ctx) local kind = symbol_kind(item.kind) item.name = result[i].name item.range = result[i].range or result[i].location.range + if item.range == nil then + log("range missing in result", result[i]) + end item.uri = uri item.selectionRange = result[i].selectionRange item.detail = result[i].detail or '' @@ -72,7 +75,7 @@ M.document_symbol_handler = function(err, result, ctx) item.detail = 'func' end - item.lnum = result[i].range.start.line + 1 + item.lnum = item.range.start.line + 1 item.text = '[' .. kind .. ']' .. item.name .. ' ' .. item.detail item.filename = fname @@ -83,19 +86,19 @@ M.document_symbol_handler = function(err, result, ctx) local child = {} child.kind = c.kind child.name = c.name - child.range = c.range + child.range = c.range or c.location.range local ckind = symbol_kind(child.kind) child.selectionRange = c.selectionRange child.filename = fname child.uri = uri - child.lnum = c.range.start.line + 1 + child.lnum = child.range.start.line + 1 child.detail = c.detail or '' child.text = '  ' .. ckind .. '' .. child.name .. ' ' .. child.detail table.insert(locations, child) end end end - + local ft = vim.api.nvim_buf_get_option(bufnr, 'ft') gui.new_list_view({ items = locations, prompt = true, rawdata = true, ft = ft, api = ' ' }) end