File tree 1 file changed +22
-4
lines changed 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
local class = require (' java-core.utils.class' )
2
2
local notify = require (' java-core.utils.notify' )
3
3
local JdtlsClient = require (' java-core.ls.clients.jdtls-client' )
4
+ local List = require (' java-core.utils.list' )
5
+ local ui = require (' java.utils.ui' )
4
6
5
7
local available_commands = {
6
8
-- 'assignField',
@@ -51,21 +53,37 @@ function RefactorCommands:refactor(refactor_type, context)
51
53
52
54
local buffer = vim .api .nvim_get_current_buf ()
53
55
54
- local selection = {}
56
+ local selections = List : new ()
55
57
56
58
if
57
59
context .range .start .character == context .range [' end' ].character
58
60
and context .range .start .line == context .range [' end' ].line
59
61
then
60
- selection =
61
- self .jdtls_client :java_infer_selection (refactor_type , context , buffer )
62
+ local selection =
63
+ self .jdtls_client :java_infer_selection (refactor_type , context , buffer )[1 ]
64
+
65
+ if refactor_type == ' extractField' then
66
+ if selection .params and vim .islist (selection .params ) then
67
+ local initialize_in =
68
+ ui .select (' Initialize the field in' , selection .params )
69
+
70
+ if not initialize_in then
71
+ return
72
+ end
73
+
74
+ selections :push (initialize_in )
75
+ end
76
+ end
77
+
78
+ selections :push (selection )
79
+ vim .print (selections )
62
80
end
63
81
64
82
local edit = self .jdtls_client :java_get_refactor_edit (
65
83
refactor_type ,
66
84
context ,
67
85
formatting_options ,
68
- selection ,
86
+ selections ,
69
87
buffer
70
88
)
71
89
You can’t perform that action at this time.
0 commit comments