Skip to content

Commit

Permalink
fix: Java file diagnostics is not refreshed when properties file is
Browse files Browse the repository at this point in the history
saved

Fixes #860

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Sep 9, 2023
1 parent 5d3b511 commit 5a27bbe
Show file tree
Hide file tree
Showing 14 changed files with 495 additions and 447 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ public List<MarkupContent> getMarkupContents(PsiElement element, @Nullable PsiEl
// (LSP textDocument/completion request)
return ((LSPPsiElementForLookupItem) element).getDocumentation();
}
if (originalElement == null || !Objects.equals(element.getContainingFile(), originalElement.getContainingFile())) {
return null;
}
Editor editor = LSPIJUtils.editorForElement(element);

Editor editor = LSPIJUtils.editorForElement(originalElement);
if (editor == null) {
return null;
}
Expand All @@ -111,7 +109,7 @@ public List<MarkupContent> getMarkupContents(PsiElement element, @Nullable PsiEl
VirtualFile file = originalElement.getContainingFile().getVirtualFile();
if (LSPVirtualFileWrapper.hasWrapper(file)) {
int targetOffset = getTargetOffset(originalElement);
return LSPVirtualFileWrapper.getLSPVirtualFileWrapper(file).getHoverContent(element, targetOffset, editor);
return LSPVirtualFileWrapper.getLSPVirtualFileWrapper(file).getHoverContent(originalElement, targetOffset, editor);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected List<MicroProfileDefinition> collectDefinitions(String propertyKey, Ra
// Collect all properties files (properties, yaml files) where the given
// property key is configured
List<MicroProfileConfigPropertyInformation> infos = PsiMicroProfileProjectManager.getInstance(context.getJavaProject().getProject())
.getJDTMicroProfileProject(javaProject).getPropertyInformations(propertyKey);
.getMicroProfileProject(javaProject).getPropertyInformations(propertyKey);
if (!infos.isEmpty()) {
return infos.stream().map(info -> {
MicroProfileDefinition definition = new MicroProfileDefinition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public Hover collectHover(JavaHoverContext context) {
propertyKey = propertyReplacer.apply(propertyKey);
}
PsiMicroProfileProject mpProject = PsiMicroProfileProjectManager.getInstance(javaProject.getProject())
.getJDTMicroProfileProject(javaProject);
.getMicroProfileProject(javaProject);
List<MicroProfileConfigPropertyInformation> propertyInformation = getConfigPropertyInformation(propertyKey,
annotation, defaultValueAnnotationMemberName, typeRoot, mpProject, utils);
return new Hover(getDocumentation(propertyInformation, context.getDocumentFormat(),
Expand Down
Loading

0 comments on commit 5a27bbe

Please sign in to comment.