-
Notifications
You must be signed in to change notification settings - Fork 15
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
Bad performance when working with non quarkus/MP projects #290
Conversation
At first, to test this PR you need the vscode-quarkus PR https://github.com/redhat-developer/vscode-quarkus/pull/242/files To test this PR:
An avanced test, is to change the pom.xml dependency by adding a MP/Quarkus dependency to Lemminx and check you have traces with microprofile/java/* when a java file from Lemminx is changed (codeAction, codelens, Hover, etc). @fbricon could you give me feedback about this PR if your performance are better? This PR is a draft PR because I need to clean my code and write some tests. |
235b7c5
to
2499336
Compare
This works on my machine
I am having some issues with this part. When I add Quarkus dependencies to the Lemminx pom.xml, I do not get Same for the other way around. I get Here are the Quarkus elements I added/removed in the pom.xml:
Inside the
|
20e98ad
to
9dde208
Compare
It should work now, please retry |
180479d
to
c78dd1f
Compare
My PR is ready now (my code should be cleaned, tests are written).
|
@@ -31,9 +37,29 @@ public JavaProjectDelegateCommandHandler() { | |||
public Object executeCommand(String commandId, List<Object> arguments, IProgressMonitor progress) throws Exception { | |||
switch (commandId) { | |||
case PROJECT_LABELS_COMMAND_ID: |
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 deprecate this command?
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 command is used for this issue. Before this pr this command returned a List of project used by typescript. I renamed this command by adding a s. In other words the two commands are requiered
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.
So you changed the semantic of the existing command (bad) and the 2 command names are too close (bad).
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.
So you changed the semantic of the existing command (bad)
Indeed but it's only TypeScript which consumes it and the command name uses "project
" although it's for all project
and not for a given project
and the 2 command names are too close (bad).
What is your suggestion?
...ain/java/com/redhat/microprofile/jdt/internal/core/ls/JavaProjectDelegateCommandHandler.java
Outdated
Show resolved
Hide resolved
...ain/java/com/redhat/microprofile/jdt/internal/core/ls/JavaProjectDelegateCommandHandler.java
Outdated
Show resolved
Hide resolved
....core/src/main/java/com/redhat/microprofile/commons/MicroProfileJavaProjectLabelsParams.java
Outdated
Show resolved
Hide resolved
...icroprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/ProjectLabelManager.java
Outdated
Show resolved
Hide resolved
private static final IMicroProfilePropertiesChangedListener LISTENER = (event) -> { | ||
try { | ||
// Execute client command with a timeout of 5 seconds to avoid blocking jobs. | ||
JavaLanguageServerPlugin.getInstance().getClientConnection().executeClientCommand( |
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 be getClientConnection().sendNotification(), since we're not waiting for a response
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.
Yes it should be that, but there is a bug on vscode-java. I tried to fix it with the following PR redhat-developer/vscode-java#1369
@@ -31,9 +37,29 @@ public JavaProjectDelegateCommandHandler() { | |||
public Object executeCommand(String commandId, List<Object> arguments, IProgressMonitor progress) throws Exception { | |||
switch (commandId) { | |||
case PROJECT_LABELS_COMMAND_ID: |
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.
So you changed the semantic of the existing command (bad) and the 2 command names are too close (bad).
@@ -102,9 +102,12 @@ public void didClose(DidCloseTextDocumentParams params) { | |||
|
|||
@Override | |||
public void didSave(DidSaveTextDocumentParams params) { | |||
triggerValidationFor(documents.all().stream().map(TextDocument::getUri).collect(Collectors.toList())); | |||
// validate all opened java files which belong to a MicroProfile project | |||
triggerValidationForAll(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.
we're losing the info about which file was saved, it'll certainly come in handy later
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.
we're losing the info about which file was saved, it'll certainly come in handy later
We don't need this information, the idea is when a java file is saved, all diagnostics are recomputed (to managed diagnostics for Java files which could depend on the saved java file).
You want I add the uri as parameter in triggerValidationForAll (even if it is not used)?
...m.redhat.microprofile.ls/src/test/java/com/redhat/microprofile/ls/JavaTextDocumentsTest.java
Outdated
Show resolved
Hide resolved
e5949d1
to
fe9a97d
Compare
The fix works/looks great to me |
fe9a97d
to
e10e9c7
Compare
See redhat-developer/vscode-quarkus#240 Signed-off-by: azerr <azerr@redhat.com>
Thanks for the feedback. I have just renamed the command (with projectlabels and workspaceLabels). Please update the vscode-quarkus PR https://github.com/redhat-developer/vscode-quarkus/pull/242/files too. @xorye could you check that the call of JDT LS of workspaceLabels works like before in TypeScript side when you collect the labels of projects. |
It is still working like before. It looks like https://github.com/redhat-developer/vscode-quarkus/pull/242/files already has the updated |
Seems much better, but I still see microprofile/java/projectLabels requests whenever I open a new java file in LemMinX |
When you open a Java file, you need to know the project URI owner. To do that, you need to trigger a JDT LS extension command. We could have a simple JDT LS command which returns the project URI of the java file uri and call after microprofile/java/projectLabels if the project is not cached, but as computing labels for a project is very quick, I consume it when file is opened. I have not found a better way to get the project URI of the opened java file which requires a call of JDT LS command. |
ok fair enough. Since it's just a single call on open, it should be fine |
Yes it's that. |
Bad perfomance when working with non quarkus/MP projects
See redhat-developer/vscode-quarkus#240
Signed-off-by: azerr azerr@redhat.com