Skip to content

Commit

Permalink
Add suport for type on code selection.
Browse files Browse the repository at this point in the history
This adds in initial support, but this issue in Metals
should be merged in first: scalameta/metals#3178.

Closes scalameta#228
  • Loading branch information
ckipp01 committed Oct 9, 2021
1 parent 85b55b7 commit e9fe002
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lua/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,34 @@ M.show_javap_verbose = function()
))
end

M.type_of_range = function()
--local _, start_line_num, start_col_num, _ = unpack(vim.fn.getpos("'<"))
--local _, end_line_num, end_col_num, _ = unpack(vim.fn.getpos("'>"))

-- Using this is so inconsistent it's crazy
--local start = vim.api.nvim_buf_get_mark(0, "<")
--local vend = vim.api.nvim_buf_get_mark(0, ">")

--Params: {
-- "textDocument": {
-- "uri": "file:///Users/ckipp/Documents/scala-workspace/sanity/src/main/scala/Thing.scala"
-- },
-- "range": {
-- "start": {
-- "line": 10,
-- "character": 1
-- },
-- "end": {
-- "line": 10,
-- "character": 11
-- }
-- }
--local range = vim.lsp.util.make_given_range_params({ start_line_num, start_col_num }, { end_line_num, end_col_num })

--P(vim.lsp.util.make_range_params())
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

0 comments on commit e9fe002

Please sign in to comment.