File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 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')
22local notify = require (' java-core.utils.notify' )
33local JdtlsClient = require (' java-core.ls.clients.jdtls-client' )
44
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+
521--- @class java-refactor.RefactorCommands
622--- @field jdtls_client java-core.JdtlsClient
723local RefactorCommands = class ()
1531--- @param refactor_type jdtls.CodeActionCommand
1632--- @param context lsp.CodeActionContext
1733function 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+
1841 if not context then
1942 context = vim .lsp .util .make_range_params (0 )
2043 context .context = {}
You can’t perform that action at this time.
0 commit comments