-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix: debounce classpath/source change events #959
Conversation
4e4e68e
to
e9c7d3c
Compare
e9c7d3c
to
0b1d553
Compare
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.
please also fix the commit message
...main/java/com/redhat/devtools/intellij/quarkus/classpath/ClasspathResourceChangeManager.java
Outdated
Show resolved
Hide resolved
this.connection.disconnect(); | ||
PsiManager.getInstance(project).removePsiTreeChangeListener(listener); |
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.
shouldn't the listener be removed first?
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.
why?
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.
gut feeling. Feel free to ignore that question
...n/java/com/redhat/devtools/intellij/quarkus/classpath/ClasspathRessourceChangedListener.java
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,61 @@ | |||
package com.redhat.devtools.intellij.quarkus.classpath; |
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.
header
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.
fixed and I add Javadoc in class header
public void dispose() { | ||
connection.disconnect(); | ||
executor.shutdown(); | ||
private class ResourcesChangeListener extends PsiTreeChangeAdapter implements WorkspaceModelChangeListener { |
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.
remove if ClasspathResourceChangeManager is preferred
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.
Ok I clean the QuarkusprojectService which is used to create JSON schema and it seems it force loading of Quarkus deployment library if I have understood correctly.
} | ||
|
||
private void handleChangedPsiTree(PsiTreeChangeEvent event) { | ||
PsiFile psiFile = event.getFile(); |
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.
shouldn't you check psiFile.getVirtualFile()
instead?, since it's checked in tryToAddSourceFile
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.
sorry I don't understand what you mean
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're checking event.getFile() for null, why not psiFile.getVirtualFile() instead, since this is what is being used later on?
src/main/java/com/redhat/devtools/intellij/quarkus/classpath/SourceFileChangeNotifier.java
Outdated
Show resolved
Hide resolved
src/main/java/com/redhat/devtools/intellij/quarkus/classpath/SourceFileChangeNotifier.java
Outdated
Show resolved
Hide resolved
src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java
Outdated
Show resolved
Hide resolved
src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java
Outdated
Show resolved
Hide resolved
0b1d553
to
f2596ea
Compare
6a64f58
to
579b51b
Compare
579b51b
to
6753510
Compare
...a/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/PsiMicroProfileProjectManager.java
Outdated
Show resolved
Hide resolved
...n/java/com/redhat/devtools/intellij/quarkus/classpath/ClasspathRessourceChangedListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java
Outdated
Show resolved
Hide resolved
...main/java/com/redhat/devtools/intellij/quarkus/classpath/ClasspathResourceChangeManager.java
Outdated
Show resolved
Hide resolved
d80a7d0
to
f21055f
Compare
b1e3953
to
a89d8d1
Compare
...n/java/com/redhat/devtools/intellij/quarkus/classpath/ClasspathRessourceChangedListener.java
Outdated
Show resolved
Hide resolved
a89d8d1
to
c9307a6
Compare
libraryClass = getLibraryClass(); | ||
// here Java reflection is used to try to support several IJ versions | ||
if (libraryClass == null) { | ||
LOGGER.warn("Cannot find LibraryEntity class '" + String.join(",", LIBRARY_ENTITY_CLASSES) + "' in classpath."); |
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.
also LOGGER.warn("Reacting to classpath changes is not supported in this version of Intellij IDEA")
connection = project.getMessageBus().connect(); | ||
// Track end of Java libraries update | ||
WorkspaceModelTopicsBridge workspaceModelTopicsBridge = new WorkspaceModelTopicsBridge(); | ||
Object libraryChangedListener = new ClasspathLibraryChangedListener(project).getProxyInstance(); |
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.
no need to create a proxy instance if workspaceModelTopicsBridge.CHANGED == null
if ("getChanges".equals(method.getName())) { | ||
method.setAccessible(true); | ||
getChangesMethod = method; | ||
getChangesMethods.put(clazz, getChangesMethod); |
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.
break here
Tests fail:
and
|
6e350a7
to
84b7035
Compare
...a/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/PsiMicroProfileProjectManager.java
Outdated
Show resolved
Hide resolved
public CompletableFuture<Void> processModules() { | ||
return CompletableFuture.runAsync(() -> { | ||
for (var module : ModuleManager.getInstance(manager.getProject()).getModules()) { | ||
LOGGER.info("Calling ensure from processModules"); |
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.
calling checkQuarkusLibrary rather?
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 must not use Quarkus.
|
||
private final ClasspathResourceChangedManager manager; | ||
|
||
private final Set<Module> modulesBeingEnsured = new HashSet<>(); |
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.
quarkusModules or checkedQuarkusModules?
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 must not use Quarkus as it is MicroProfile.
ff3d875
to
7ac7f4e
Compare
Fixes redhat-developer#916 Signed-off-by: azerr <[email protected]>
7ac7f4e
to
a3b4a35
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@fbricon CI build is working again! |
fix: debounce classpath/source change events (#916)
Fixes #916
Fixes #958
Signed-off-by: azerr [email protected]