-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: update lsp4mp to 0.7.1 #895
Conversation
Wow it looks very cool We! We have a test in JDT with java cusrsor context please add it to check your implémentation is good. |
*/ | ||
public JavaCursorContextResult javaCursorContext(MicroProfileJavaCompletionParams params, IPsiUtils utils) { | ||
String uri = params.getUri(); | ||
PsiFile typeRoot = resolveTypeRoot(uri, utils); |
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.
Don't you need "ApplicationManager.getApplication().runReadAction()" to avoid exceptions?
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.
Could you exlain why we could have some exceptions please.
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.
I'm referring to exceptions like this:
java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
Current thread: Thread[JobScheduler FJ pool 0/7,4,main] 869433486 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 1514231839
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:127)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:70)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:220)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSetWithCustomData(WorkspaceFileIndexImpl.kt:205)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:133)
at io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.core.ls.PsiUtilsLSImpl.getModule(PsiUtilsLSImpl.java:79)
at io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.core.ls.PsiUtilsLSImpl.resolveCompilationUnit(PsiUtilsLSImpl.java:177)
at io.openliberty.tools.intellij.lsp4jakarta.lsp4ij.PropertiesManagerForJakarta.resolveTypeRoot(PropertiesManagerForJakarta.java:293)
at io.openliberty.tools.intellij.lsp4jakarta.lsp4ij.PropertiesManagerForJakarta.javaCursorContext(PropertiesManagerForJakarta.java:208)
...
PsiField psiField = (PsiField) parent; | ||
@Nullable PsiTypeElement fieldType = psiField.getTypeElement(); | ||
if (fieldType != null && completionOffset <= fieldType.getTextOffset()) { | ||
return JavaCursorContextKind.BEFORE_FIELD; |
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.
I'm not sure this will work according to the definition in JavaCursorContextKind line 87. Before_Field means the cursor is in whitespace before a field. E.g. int a; | int b;
In this code the parent of the whitespace is the containing class rather than a field (b
in this example). The same concept applies to methods also.
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.
the whole JavaCursor thing is mostly wrong for now, I'm working on it. I used chatGPT to quickly generate the initial PSI-based implem.
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.
@turkeylurkey can you check how the latest commit works for you?
0b6e94b
to
6d71448
Compare
@angelozerr I had to downgrade quarkus-qute-ls to from 0.14.1 down to 0.14.0, the following test fails:
|
@fbricon the CI build on main fails https://github.com/redhat-developer/intellij-quarkus/actions/runs/5133444014/jobs/9236030715 I think it is the same error that you have. |
5602f58
to
271c65e
Compare
} | ||
|
||
// @Test | ||
// public void testOneWord() throws Exception { |
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.
Is it normal that thoses testes are commented?
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.
Those are used when snippets are supported
Signed-off-by: Fred Bricon <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
It works like a charm! Great job @fbricon ! |
The
PropertiesManagerForJava.javaCursorContext(...)
implementation is much simpler than the JDT one, that's where you need to pay extra attention.I haven't looked at unit tests yet.
Currently includes #894already merged in mainPart of #806