Open fortime opened 1 day ago
Hmm... so far, we have not implemented those for a mix of many reasons:
None of which are a hard "no".
Would you mind sharing a minimal example and steps that would make jdt respond with a rename operation?
Can probably just rename a class in Java as the files have to match the class name.
Here is the steps:
diff --git a/ycmd/completers/java/java_completer.py b/ycmd/completers/java/java_completer.py
index 33803957..03dbc1c4 100644
--- a/ycmd/completers/java/java_completer.py
+++ b/ycmd/completers/java/java_completer.py
@@ -660,3 +660,13 @@ class JavaCompleter( language_server_completer.LanguageServerCompleter ):
*language_server_completer._LspLocationToLocationAndDescription(
request_data, item[ 'from' ] ) )
return result
+
+
+ def ExtraCapabilities( self ):
+ return {
+ 'workspace': {
+ 'workspaceEdit': {
+ 'resourceOperations': [ 'create', 'rename', 'delete' ],
+ }
+ }
+ }
diff --git a/ycmd/completers/language_server/language_server_completer.py b/ycmd/completers/language_server/language_server_completer.py
index 489e15d0..ebc45b11 100644
--- a/ycmd/completers/language_server/language_server_completer.py
+++ b/ycmd/completers/language_server/language_server_completer.py
@@ -3587,6 +3587,8 @@ def WorkspaceEditToFixIt( request_data,
"""Converts a LSP workspace edit to a ycmd FixIt suitable for passing to
responses.BuildFixItResponse."""
if not workspace_edit: return None
Create a maven project. The rename operation won't be returned in a single java source file.
mvn archetype:generate -DgroupId=test -DartifactId=test-resource-op -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false
Go into the project. And open a java file with vim.
cd test-resource-op
vim src/main/java/test/App.java
Move the cursor to the class name, and run YcmCompleter RefactorRename App1
. The rename operation will appear in the log file.
BTW, there is another issue here. In WorkspaceEditToFixIt
, it checks if there is changes
in the response. In above case, jdt returns both changes
and documentChanges
, and documentChanges
is being ignored.
BTW, there is another issue here. In WorkspaceEditToFixIt
Hardly surprising given that is only used with the capability you just added.
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I expected to happen and what actually happened.instdeleteall.py
(orcmake
/make
/ninja
) including its invocationThank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
About
workspace.workspaceEdit.resourceOperations
Why In Java, a rename operation is needed to refactor the name of a Java Class. Currently, since there is no support of rename operation, eclipse.jdt.ls won't return the rename operation. We must rename the file manually after a refactor. I think this problem may exist in other language too.
Is there any plan to support
workspace.workspaceEdit.resourceOperations
?