-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LSP resource operation support. #277
Conversation
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaohaizh thanks for the contribution! It seems you have auto-formatted Protocol.xtend
, which leads to tons of whitespace changes. Please reapply your actual changes without the reformatting, otherwise a proper review is not possible.
Maybe we should keep the protocol file auto-formatted to avoid such problems in the future, but that's a separate issue.
Signed-off-by: Yaohai Zheng <[email protected]>
@spoenemann Update the PR. The auto-formatted should be triggered accidentally. Anyway, it would be great to provide unify format. Otherwise, the mixed tab and whitespace make it hard to maintain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Unfortunately, we need to break the API and introduce more special type adapters again, but the solution looks clean. A few more remarks below.
@@ -3261,6 +3313,193 @@ class TextDocumentEdit { | |||
} | |||
} | |||
|
|||
@JsonRpcData | |||
@JsonAdapter(ResourceOperationTypeAdapter) | |||
class ResourceOperation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be abstract.
|
||
@Override | ||
public ResourceOperation read(JsonReader in) throws IOException { | ||
JsonObject objectJson = jsonElementAdapter.read(in).getAsJsonObject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can parse the stream to a JSON tree with JsonParser
so there's no need for the jsonElementAdapter
:
JsonObject objectJson = jsonElementAdapter.read(in).getAsJsonObject(); | |
JsonObject objectJson = new JsonParser().parse(in).getAsJsonObject(); |
} | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw a JsonParseException in this case?
org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java
Show resolved
Hide resolved
@JsonRpcData | ||
class PrepareRenameResult { | ||
/** | ||
* The capabilities the language server provides. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment does not make sense.
* changes and documentChanges | ||
*/ | ||
@Deprecated | ||
new(Map<String, List<TextEdit>> changes, List<Either<TextDocumentEdit, ResourceOperation>> documentChanges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can safely remove this deprecated constructor because the API has been broken anyway.
As noted in #249 (comment), the new property |
@spoenemann Updated the PR |
Signed-off-by: Yaohai Zheng <[email protected]>
@spoenemann How could build a snapshot build for this PR. I would like to do some integration and test on the eclipse.jdt.ls side. Thanks. |
You can find nightly snapshots at https://oss.sonatype.org/content/repositories/snapshots/ |
Signed-off-by: Yaohai Zheng [email protected]