sublimelsp / LSP-jdtls

Convenience package for the Eclipse JDT language server
https://packagecontrol.io/packages/LSP-jdtls
MIT License
30 stars 4 forks source link

Bump jdt.ls to 1.37.0 #52

Closed mataha closed 3 months ago

mataha commented 5 months ago

And other plugins to their up-to-date versions. Fixes #48.

LDAP commented 5 months ago

Thanks! Can you confirm that running JUnit tests and jumping to test classes still work?

mataha commented 5 months ago

Yes (tested on https://github.com/TheAlgorithms/Java):

https://github.com/sublimelsp/LSP-jdtls/assets/7210216/76121c5e-6c74-4aee-8d3c-e558d51fa0dd

That said, this plugin doesn't handle missing tests gracefully:

Error handling None
Traceback (most recent call last):
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/sessions.py", line 2412, in on_payload
    handler(result)
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/promise.py", line 144, in <lambda>
    executor_func(lambda resolve_value=None: self._do_resolve(resolve_value))
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/promise.py", line 205, in _do_resolve
    callback(new_value)
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/promise.py", line 169, in callback_wrapper
    result = onfullfilled(resolve_value)
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Packages\LSP-jdtls\modules\test_extension_commands.py", line 151, in <lambda>
    else self.select_test_item(result, self.fetch_debug_args)
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Packages\LSP-jdtls\modules\test_extension_commands.py", line 346, in select_test_item
    tests = flatten_test_items(test_items)
  File "C:\Users\Mataha\AppData\Roaming\Sublime Text\Packages\LSP-jdtls\modules\utils.py", line 47, in flatten_test_items
    for item in test_items:
TypeError: 'NoneType' object is not iterable
LDAP commented 5 months ago

What exactly do you mean with missing tests?

mataha commented 5 months ago

What exactly do you mean with missing tests?

A file that has no tests.

LDAP commented 5 months ago

Ok, I opened an issue to keep track of that.

For the PR, I see errors like org.eclipse.core.internal.resources.ResourceException(/1920_latin_d9388dfc)[372]: java.lang.Exception: Project '1920_latin_d9388dfc' is not open. in the console. Might have to look into that.

mataha commented 5 months ago

Ok, I opened an issue to keep track of that.

For the PR, I see errors like org.eclipse.core.internal.resources.ResourceException(/1920_latin_d9388dfc)[372]: java.lang.Exception: Project '1920_latin_d9388dfc' is not open. in the console. Might have to look into that.

Can you share the details? What project and JDK are you working with?

LDAP commented 5 months ago
openjdk 22 2024-03-19
OpenJDK Runtime Environment (build 22)
OpenJDK 64-Bit Server VM (build 22, mixed mode, sharing)

The "project" is just an empty folder with a Test.java file.

mataha commented 5 months ago

Works fine here.

https://github.com/sublimelsp/LSP-jdtls/assets/7210216/daa23711-3411-4882-849f-c3797112c73d

Cache issues?

LDAP commented 5 months ago

Sadly not, I am also getting

jdtls: ERROR: Jul 6, 2024, 11:11:15 AM BadLocationException
null
org.eclipse.jface.text.BadLocationException
    at org.eclipse.jface.text.ListLineTracker.getLineOffset(ListLineTracker.java:197)
    at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:252)
    at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:868)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.convertRange(WorkspaceDiagnosticsHandler.java:475)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.toDiagnostic(WorkspaceDiagnosticsHandler.java:420)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.lambda$7(WorkspaceDiagnosticsHandler.java:394)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:194)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:702)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.toDiagnosticsArray(WorkspaceDiagnosticsHandler.java:396)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.publishDiagnostics(WorkspaceDiagnosticsHandler.java:333)
    at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceDiagnosticsHandler.publishDiagnostics(WorkspaceDiagnosticsHandler.java:249)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer$2.run(JDTLanguageServer.java:332)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

after a server restart. But I currently do not have time to look into it.

LDAP commented 3 months ago

Note to self: I'll merge it, but the issues need to be investigated in the future.