Skip to content

Commit

Permalink
fix: fix #47
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Jul 15, 2023
1 parent 25c177b commit 18a33c9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lua/otter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ M.ask_document_symbols = function()
local main_uri = vim.uri_from_bufnr(main_nr)

local function redirect(res)
if not res.location or not res.location.uri then return end
local uri = res.location.uri
if require 'otter.tools.functions'.is_otterpath(uri) then
res.location.uri = main_uri
end
return res
end

Expand All @@ -175,16 +180,15 @@ M.ask_rename = function()
local main_uri = vim.uri_from_bufnr(main_nr)

local function redirect(res)
local changes = res.documentChanges
local changes = res.changes
local new_changes = {}
for _, change in ipairs(changes) do
local uri = change.textDocument.uri
for uri, change in pairs(changes) do
if require 'otter.tools.functions'.is_otterpath(uri) then
change.textDocument.uri = main_uri
uri = main_uri
end
table.insert(new_changes, change)
new_changes[uri]= change
end
res.documentChanges = new_changes
res.changes = new_changes
return res
end

Expand Down

0 comments on commit 18a33c9

Please sign in to comment.