remove unused util functions
This commit is contained in:
@@ -47,49 +47,6 @@ M.copy_diagnostic_message = function()
|
||||
print("Diagnostic message was yanked")
|
||||
end
|
||||
|
||||
M.get_definitions = function()
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
|
||||
local resp = vim.lsp.buf_request_sync(0, "textDocument/definition", params, 1000)
|
||||
local result = {}
|
||||
for _, v in pairs(resp) do
|
||||
table.insert(result, v)
|
||||
end
|
||||
result = result[1].result
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
M.goto_local_definition = function()
|
||||
local definitions = M.get_definitions()
|
||||
|
||||
local local_definition = unpack(definitions)
|
||||
local target = local_definition.targetSelectionRange
|
||||
|
||||
local startLine = target.start.line + 1
|
||||
local startCol = target.start.character
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, { startLine, startCol })
|
||||
end
|
||||
|
||||
M.goto_global_definition = function()
|
||||
local definitions = M.get_definitions()
|
||||
|
||||
local global_definition = definitions[#definitions]
|
||||
local target = global_definition.targetSelectionRange
|
||||
|
||||
local startLine = target.start.line + 1
|
||||
local startCol = target.start.character
|
||||
|
||||
local fileuri = global_definition.targetUri
|
||||
local filepath = string.gsub(fileuri, "file://", "")
|
||||
|
||||
vim.cmd("tabnew")
|
||||
vim.cmd("e " .. filepath)
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, { startLine, startCol })
|
||||
end
|
||||
|
||||
M.lsp_organize_imports = function(bufnr, timeout)
|
||||
if not bufnr then
|
||||
bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
Reference in New Issue
Block a user