Skip to content

Commit

Permalink
Add support for java.show.references (references codelens command)
Browse files Browse the repository at this point in the history
To support running `vim.lsp.codelens.run()` on a codelens showing the
number of references on a method.
  • Loading branch information
mfussenegger committed Nov 5, 2024
1 parent a9b5fc8 commit 7504327
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lua/jdtls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,19 @@ M.commands = {
})
return result and result or vim.NIL
end,
["java.show.references"] = function(args)
local arguments = args.arguments
-- arg1 -> uri
-- arg2 -> position
local locations = arguments[3]
local items = vim.lsp.util.locations_to_items(locations, "utf-16")
local list = {
title = "References",
items = items,
}
vim.fn.setqflist({}, ' ', list)
vim.cmd("botright copen")
end
}

if vim.lsp.commands then
Expand Down

0 comments on commit 7504327

Please sign in to comment.