Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suport for type on code selection. #232

Merged
merged 1 commit into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/metals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,17 @@ toggle_setting({setting})
lua require("metals").toggle_setting("showImplicitArguments")
<

*type_of_range()*
type_of_range() Use to get the type of the selected range. NOTE that
the mapping for this requires an `<Esc>` before the
actual mapping to ensure that the last correct range
is used.

Example usage: >

api.nvim_set_keymap("v", "K", [[<Esc><cmd>lua require("metals").type_of_range()<CR>]])

<

================================================================================
METALS TVP MODULE *metals-tvp-module*
Expand Down
4 changes: 4 additions & 0 deletions lua/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ M.show_javap_verbose = function()
))
end

M.type_of_range = function()
vim.lsp.buf_request(0, "textDocument/hover", vim.lsp.util.make_given_range_params())
end

-- Since we want metals to be the entrypoint for everything, just for ensure that it's
-- easy to set anything for users, we simply include them in here and then expose them.
M.bare_config = setup.bare_config
Expand Down