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: Editor is already disposed in LSP hover operation (#914) #924
fix: Editor is already disposed in LSP hover operation (#914) #924
Conversation
As IJ hover provider API doesn't provide the target offset (it provies the hovered PsiElement), the master code defines the getCursorOffset https://github.com/redhat-developer/intellij-quarkus/pull/924/files#diff-3226f92e605d133b246286d765a9045cc993a8fc0804b4ef662b3d6403639857L121 which uses invokeLater https://github.com/redhat-developer/intellij-quarkus/pull/924/files#diff-3226f92e605d133b246286d765a9045cc993a8fc0804b4ef662b3d6403639857L123 The main idea of this PR is to remove thisCompletableFuture which get the cursor. To remove rhis getCursorOffet, the idea is to implement https://github.com/redhat-developer/intellij-quarkus/pull/924/files#diff-3226f92e605d133b246286d765a9045cc993a8fc0804b4ef662b3d6403639857L123 to get the target offset. |
} | ||
|
||
@Nullable | ||
@Override | ||
public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) { | ||
Editor editor = LSPIJUtils.editorForElement(element); | ||
if (editor != null) { | ||
initiateHoverRequest(element, editor); |
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.
can't you use int offset = PsiUtilCore.getElementOffsetInFile(element);
instead ?
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.
Hover should work without PsiElement to avoid client to implement a Psi parser. We need just the hovered offset and we don't use PsiElement.
4a93a99
to
2e3d776
Compare
…per#914) Fixes redhat-developer#914 Signed-off-by: azerr <azerr@redhat.com>
Kudos, SonarCloud Quality Gate passed! |
@fbricon are you agree with my changes? I would like to include this PR in the release |
LGTM |
Thanks @angelozerr! |
fix: Editor is already disposed in LSP hover operation (#914)
Fixes #914