File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -299,4 +299,24 @@ function Action:override_methods_prompt(params)
299299 self .jdtls :add_overridable_methods (params .params , selected_methods )
300300 vim .lsp .util .apply_workspace_edit (edit , ' utf-8' )
301301end
302+
303+ --- @param selections jdtls.ImportSelection[]
304+ function Action .choose_imports (selections )
305+ local selected_candidates = {}
306+
307+ for _ , selection in ipairs (selections ) do
308+ local selected_candidate = ui .select_sync (
309+ ' Select methods to override.' ,
310+ selection .candidates ,
311+ function (candidate , index )
312+ return index .. ' ' .. candidate .fullyQualifiedName
313+ end
314+ )
315+
316+ table.insert (selected_candidates , selected_candidate )
317+ end
318+
319+ return selected_candidates
320+ end
321+
302322return Action
Original file line number Diff line number Diff line change @@ -65,6 +65,25 @@ local M = {
6565 end )
6666 end ,
6767
68+ --- @param params [string , jdtls.ImportSelection[] , boolean]
69+ [ClientCommand .CHOOSE_IMPORTS ] = function (params )
70+ local get_error_handler = require (' java-refactor.utils.error_handler' )
71+ local instance = require (' java-refactor.utils.instance-factory' )
72+ local action = instance .get_action ()
73+
74+ local selections = params [2 ]
75+ local ok , result = pcall (function ()
76+ return action .choose_imports (selections )
77+ end )
78+
79+ if not ok then
80+ get_error_handler (' Failed to choose imports' )(result )
81+ return
82+ end
83+
84+ return result or {}
85+ end ,
86+
6887 --- @param is_full_build boolean
6988 [ClientCommand .COMPILE_WORKSPACE ] = function (is_full_build )
7089 run (' Failed to build workspace' , function (action )
You can’t perform that action at this time.
0 commit comments