File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,22 @@ 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
4
5
+ local available_commands = {
6
+ -- 'assignField',
7
+ -- 'assignVariable',
8
+ -- 'changeSignature',
9
+ -- 'convertAnonymousClassToNestedCommand',
10
+ -- 'convertVariableToField',
11
+ ' extractConstant' ,
12
+ ' extractField' ,
13
+ -- 'extractInterface',
14
+ ' extractMethod' ,
15
+ ' extractVariable' ,
16
+ ' extractVariableAllOccurrence' ,
17
+ -- 'introduceParameter',
18
+ -- 'invertVariable',
19
+ }
20
+
5
21
--- @class java-refactor.RefactorCommands
6
22
--- @field jdtls_client java-core.JdtlsClient
7
23
local RefactorCommands = class ()
15
31
--- @param refactor_type jdtls.CodeActionCommand
16
32
--- @param context lsp.CodeActionContext
17
33
function RefactorCommands :refactor (refactor_type , context )
34
+ if not vim .tbl_contains (available_commands , refactor_type ) then
35
+ notify .error (
36
+ string.format (' Refactoring command "%s" is not supported' , refactor_type )
37
+ )
38
+ return
39
+ end
40
+
18
41
if not context then
19
42
context = vim .lsp .util .make_range_params (0 )
20
43
context .context = {}
You can’t perform that action at this time.
0 commit comments