diff --git a/lua/symbols-outline/hover.lua b/lua/symbols-outline/hover.lua index b42bafe..03e8fb4 100644 --- a/lua/symbols-outline/hover.lua +++ b/lua/symbols-outline/hover.lua @@ -1,6 +1,6 @@ local vim = vim -local state = require('symbols-outline').state +local main = require('symbols-outline') local util = vim.lsp.util local M = {} @@ -18,10 +18,10 @@ end -- handler yoinked from the default implementation function M.show_hover() - local current_line = vim.api.nvim_win_get_cursor(state.outline_win)[1] - local node = state.flattened_outline_items[current_line] + local current_line = vim.api.nvim_win_get_cursor(main.state.outline_win)[1] + local node = main.state.flattened_outline_items[current_line] - local hover_params = get_hover_params(node, state.code_win) + local hover_params = get_hover_params(node, main.state.code_win) vim.lsp.buf_request(hover_params.bufnr, "textDocument/hover", hover_params, function(_, method, result) @@ -54,9 +54,9 @@ function M.show_hover() return bufnr, winnr end) end) - -- kind of a hack but we want the state to always be the latest, so unload + -- kind of a hack but we want the main.state to always be the latest, so unload -- this module for the next time it is called its gonna be F R E S H - package.loaded["symbols-outline.hover"] = nil + -- package.loaded["symbols-outline.hover"] = nil end return M diff --git a/lua/symbols-outline/rename.lua b/lua/symbols-outline/rename.lua index ebc599f..12bc28d 100644 --- a/lua/symbols-outline/rename.lua +++ b/lua/symbols-outline/rename.lua @@ -1,6 +1,6 @@ local vim = vim -local state = require('symbols-outline').state +local main = require('symbols-outline') local M = {} @@ -16,10 +16,10 @@ local function get_rename_params(node, winnr) end function M.rename() - local current_line = vim.api.nvim_win_get_cursor(state.outline_win)[1] - local node = state.flattened_outline_items[current_line] + local current_line = vim.api.nvim_win_get_cursor(main.state.outline_win)[1] + local node = main.state.flattened_outline_items[current_line] - local params = get_rename_params(node, state.code_win) + local params = get_rename_params(node, main.state.code_win) local new_name = vim.fn.input("New Name: ", node.name) if not new_name or new_name == "" or new_name == node.name then return end @@ -32,9 +32,6 @@ function M.rename() vim.lsp.util.apply_workspace_edit(result) end end) - -- kind of a hack but we want the state to always be the latest, so unload - -- this module for the next time it is called its gonna be F R E S H - package.loaded["symbols-outline.rename"] = nil end return M