File tree 3 files changed +37
-2
lines changed
3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 270
270
--- @field params lsp.CodeActionParams
271
271
--- @field version number
272
272
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
273
302
return Action
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ local M = {
57
57
end )
58
58
end ,
59
59
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
+
60
68
--- @param is_full_build boolean
61
69
[ClientCommand .COMPILE_WORKSPACE ] = function (is_full_build )
62
70
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)
98
98
params = nil ,
99
99
})
100
100
101
- vim .print (move_des )
102
-
103
101
if
104
102
not move_des
105
103
or not move_des .destinations
You can’t perform that action at this time.
0 commit comments