Skip to content

Commit

Permalink
Merge pull request #272 from ckipp01/super
Browse files Browse the repository at this point in the history
fix: update arguments to be sent in with super method commands.
  • Loading branch information
ckipp01 authored Nov 12, 2021
2 parents 3ef2944 + 7d3c9c1 commit 152af73
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions doc/metals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ The following commands are provided by nvim-metals:
* |MetalsDisconnectBuild|
* |MetalsFindInDependencyJars|
* |MetalsGenerateBspConfig|
* |MetalsGotoSuperMethod|
* |MetalsImportBuild|
* |MetalsInstall|
* |MetalsInfo|
Expand Down Expand Up @@ -500,6 +501,9 @@ MetalsGenerateBspConfig Checks to see if your build tool can serve as a
generated, Metals will attempt to auto-connect to
it.

*MetalsGotoSuperMethod*
MetalsGotoSuperMethod Jump to the super method of the current symbol.

*MetalsImportBuild*
MetalsImportBuild Trigger an import for the current workspace.

Expand Down Expand Up @@ -676,6 +680,11 @@ disconnect_build() Use to execute a |metals.build-disconnect| command.
*generate_bsp_config()*
generate_bsp_config() Use to execute a |metals.generate-bsp-config| command.

*goto_super_method()*
goto_super_method() Use to execute a |metals.goto-super-method| command.
This is the same as triggering the code lens on a
symbol that is overriding another.

*find_in_dependency_jars()*
find_in_dependency_jars() Use to send in a `meatls/findTextInDependencyJars`
request to the server.
Expand Down
11 changes: 9 additions & 2 deletions lua/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,19 @@ M.start_server = function()
setup.initialize_or_attach()
end

M.goto_super_method = function()
local text_doc_position = lsp.util.make_position_params()
execute_command({
command = "metals.goto-super-method",
arguments = { text_doc_position },
})
end

M.super_method_hierarchy = function()
local uri = vim.uri_from_bufnr(0)
local text_doc_position = lsp.util.make_position_params()
execute_command({
command = "metals.super-method-hierarchy",
arguments = { { document = uri, position = text_doc_position.position } },
arguments = { text_doc_position },
})
end

Expand Down
5 changes: 5 additions & 0 deletions lua/metals/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ local commands_table = {
label = "Generate BSP Config",
hint = "Generate the BSP config for your build tool.",
},
{
id = "goto_super_method",
label = "Goto Super Method",
hint = "Goto the super method of this symbol.",
},
{
id = "import_build",
label = "Import Build",
Expand Down

0 comments on commit 152af73

Please sign in to comment.