File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 270270--- @field params lsp.CodeActionParams
271271--- @field version number
272272
273+ --- @param params nvim.CodeActionParamsResponse
274+ function Action :override_methods_prompt (params )
275+ local status = self .jdtls :list_overridable_methods (params .params )
276+
277+ if not status or not status .methods or # status .methods < 1 then
278+ notify .warn (' No methods to override.' )
279+ return
280+ end
281+
282+ local selected_methods = ui .multi_select (
283+ ' Select methods to override.' ,
284+ status .methods ,
285+ function (method )
286+ return string.format (
287+ ' %s(%s)' ,
288+ method .name ,
289+ table.concat (method .parameters , ' , ' )
290+ )
291+ end
292+ )
293+
294+ if not selected_methods or # selected_methods < 1 then
295+ return
296+ end
297+
298+ local edit =
299+ self .jdtls :add_overridable_methods (params .params , selected_methods )
300+ vim .lsp .util .apply_workspace_edit (edit , ' utf-8' )
301+ end
273302return Action
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ local M = {
5757 end )
5858 end ,
5959
60+ --- @param params nvim.CodeActionParamsResponse
61+ [ClientCommand .OVERRIDE_METHODS_PROMPT ] = function (_ , params )
62+ run (' Failed to get overridable methods' , function (action )
63+ action :override_methods_prompt (params )
64+ require (' java-core.utils.notify' ).info (' Successfully built the workspace' )
65+ end )
66+ end ,
67+
6068 --- @param is_full_build boolean
6169 [ClientCommand .COMPILE_WORKSPACE ] = function (is_full_build )
6270 run (' Failed to build workspace' , function (action )
Original file line number Diff line number Diff line change @@ -98,8 +98,6 @@ function Refactor:move_file(action_info)
9898 params = nil ,
9999 })
100100
101- vim .print (move_des )
102-
103101 if
104102 not move_des
105103 or not move_des .destinations
You can’t perform that action at this time.
0 commit comments